Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .dockerignore

This file was deleted.

7 changes: 0 additions & 7 deletions Dockerfile

This file was deleted.

181 changes: 0 additions & 181 deletions bun.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion generated/tool-index/local-tool-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"golang_list_patterns": "src/plugins/golang/tools/list-patterns.js",
"golang_list_practices": "src/plugins/golang/tools/list-practices.js",
"golang_search_docs": "src/plugins/golang/tools/search-docs.js",
"hyperstack_setup": "src/plugins/hyperstack/tools/setup.js",
"lenis_generate_setup": "src/plugins/lenis/tools/generate-setup.js",
"lenis_get_api": "src/plugins/lenis/tools/get-api.js",
"lenis_get_pattern": "src/plugins/lenis/tools/get-pattern.js",
Expand Down
1 change: 0 additions & 1 deletion generated/tool-index/local-tool-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export const LOCAL_TOOL_REGISTRY = {
"golang_list_patterns": () => import("src/plugins/golang/tools/list-patterns.js"),
"golang_list_practices": () => import("src/plugins/golang/tools/list-practices.js"),
"golang_search_docs": () => import("src/plugins/golang/tools/search-docs.js"),
"hyperstack_setup": () => import("src/plugins/hyperstack/tools/setup.js"),
"lenis_generate_setup": () => import("src/plugins/lenis/tools/generate-setup.js"),
"lenis_get_api": () => import("src/plugins/lenis/tools/get-api.js"),
"lenis_get_pattern": () => import("src/plugins/lenis/tools/get-pattern.js"),
Expand Down
12 changes: 3 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@orkait-ai/hyperstack",
"version": "1.1.3",
"description": "Disciplined MCP server + skill system. 12 plugins, 80 tools, 21 skills with adversarial enforcement. Designer/DESIGN.md pipeline, shadcn/ui, React Flow, Motion, Lenis, React 19, Echo, Go, Rust, design tokens, UI/UX.",
"version": "2.0.0",
"description": "Topology-driven CLI for 11 plugin tool families covering designer, design tokens, UI/UX, React, shadcn, Motion, Lenis, React Flow, Echo, Go, and Rust.",
"bin": {
"hyperstack": "bin/hyperstack.mjs"
},
Expand All @@ -11,20 +11,14 @@
"compile:context": "tsx src/internal/compile-runtime-context.ts",
"generate:local-tools": "tsx scripts/generate-local-tool-registry.ts",
"generate:topology": "tsx scripts/generate-topology-artifacts.ts",
"start": "bun src/index.ts",
"dev": "bun --watch src/index.ts",
"docker:run": "bun scripts/ensure-singleton.ts",
"skills:index": "tsx scripts/generate-skills-index.ts",
"mcp:start": "bun scripts/start-mcp.ts",
"setup": "tsx scripts/setup.ts"
"skills:index": "tsx scripts/generate-skills-index.ts"
},
"author": "Orkait",
"license": "MIT",
"engines": {
"node": ">=18"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.17.0",
"tsx": "^4.21.0",
"yaml": "^2.5.1",
"zod": "^3.23.0"
Expand Down
44 changes: 0 additions & 44 deletions scripts/ensure-singleton.ts

This file was deleted.

54 changes: 0 additions & 54 deletions scripts/setup.ts

This file was deleted.

74 changes: 0 additions & 74 deletions scripts/start-mcp.ts

This file was deleted.

89 changes: 61 additions & 28 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,64 @@
import { validateArtifactPayload } from "./engine/artifact-validator.js";
import { routeRequest } from "./engine/router.js";
import { loadTopology } from "./engine/topology-loader.js";
import { assertToolAllowedForAgent, getAgent } from "./engine/policy.js";
import { invokeLocalTool } from "./adapters/local-tools/index.js";

type ParsedArgs = {
positional: string[];
flags: Record<string, string>;
};

function parseArgs(argv: string[]): ParsedArgs {
const positional: string[] = [];
const flags: Record<string, string> = {};
for (let i = 0; i < argv.length; i += 1) {
const token = argv[i];
if (token.startsWith("--")) {
const name = token.slice(2);
const next = argv[i + 1];
if (next === undefined || next.startsWith("--")) {
flags[name] = "true";
} else {
flags[name] = next;
i += 1;
}
} else {
positional.push(token);
}
}
return { positional, flags };
}

function usage(): never {
process.stderr.write(
"Usage:\n" +
" hyperstack tool <tool-name> --json '{...}' [--agent <agent-id>]\n" +
" hyperstack route --json '{...}'\n" +
" hyperstack artifact validate <artifact-id> --json '{...}'\n" +
"\n" +
"Topology enforcement:\n" +
" Pass --agent <id> or set HYPERSTACK_AGENT to enforce bundle allow/deny\n" +
" on `tool` calls. When unset, tools run without topology check.\n",
);
process.exit(1);
}

async function main() {
const [command, toolName, flag, json] = process.argv.slice(2);
const { positional, flags } = parseArgs(process.argv.slice(2));
const [command, ...rest] = positional;
const topology = loadTopology(process.cwd());

if (command === "tool") {
if (!toolName || flag !== "--json" || !json) {
process.stderr.write('Usage: hyperstack tool <tool-name> --json \'{"key":"value"}\'\n');
process.exit(1);
const toolName = rest[0];
const json = flags.json;
if (!toolName || !json) usage();

const agentId = flags.agent ?? process.env.HYPERSTACK_AGENT;
if (agentId) {
const agent = getAgent(topology, agentId);
const bundle = assertToolAllowedForAgent(topology, agent, toolName);
process.stderr.write(`[topology] agent=${agent.id} bundle=${bundle.id} tool=${toolName}\n`);
}

const args = JSON.parse(json) as Record<string, unknown>;
Expand All @@ -20,44 +68,29 @@ async function main() {
}

if (command === "route") {
if (toolName !== "--json" || !flag) {
process.stderr.write("Usage: hyperstack route --json '{...}'\n");
process.exit(1);
}

const input = JSON.parse(flag) as {
const json = flags.json;
if (!json) usage();
const input = JSON.parse(json) as {
requestId: string;
domainTargets: string[];
capabilityTargets: string[];
workspaceInventory: { projectMode: "greenfield" | "existing"; existingPatterns: string[] };
changeClassification: string;
};

process.stdout.write(`${JSON.stringify(routeRequest(topology, input), null, 2)}\n`);
process.exit(0);
}

if (command === "artifact" && toolName === "validate") {
const artifactId = flag;
const jsonFlag = process.argv[5];
const jsonPayload = process.argv[6];

if (!artifactId || jsonFlag !== "--json" || !jsonPayload) {
process.stderr.write("Usage: hyperstack artifact validate <artifact-id> --json '{...}'\n");
process.exit(1);
}

const payload = JSON.parse(jsonPayload) as Record<string, unknown>;
if (command === "artifact" && rest[0] === "validate") {
const artifactId = rest[1];
const json = flags.json;
if (!artifactId || !json) usage();
const payload = JSON.parse(json) as Record<string, unknown>;
process.stdout.write(`${JSON.stringify(validateArtifactPayload(topology, artifactId, payload), null, 2)}\n`);
process.exit(0);
}

process.stderr.write(
"Usage: hyperstack tool <tool-name> --json '{...}'\n" +
" or: hyperstack route --json '{...}'\n" +
" or: hyperstack artifact validate <artifact-id> --json '{...}'\n",
);
process.exit(1);
usage();
}

main().catch((error) => {
Expand Down
10 changes: 0 additions & 10 deletions src/engine/injector.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/engine/navigation.ts

This file was deleted.

Loading
Loading