@cubis/foundry 0.3.53 → 0.3.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -0
- package/README.md +109 -3
- package/bin/cubis.js +5 -10286
- package/dist/cli/commands/register.js +88 -0
- package/dist/cli/commands/register.js.map +1 -0
- package/dist/cli/config/index.js +2 -0
- package/dist/cli/config/index.js.map +1 -0
- package/dist/cli/constants.js +4 -0
- package/dist/cli/constants.js.map +1 -0
- package/dist/cli/core.js +9173 -0
- package/dist/cli/core.js.map +1 -0
- package/dist/cli/index.js +3 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init/banner.js +21 -0
- package/dist/cli/init/banner.js.map +1 -0
- package/dist/cli/init/execute.js +65 -0
- package/dist/cli/init/execute.js.map +1 -0
- package/dist/cli/init/index.js +5 -0
- package/dist/cli/init/index.js.map +1 -0
- package/dist/cli/init/prompts.js +122 -0
- package/dist/cli/init/prompts.js.map +1 -0
- package/dist/cli/init/types.js +2 -0
- package/dist/cli/init/types.js.map +1 -0
- package/dist/cli/io.js +2 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/mcp/commands.js +67 -0
- package/dist/cli/mcp/commands.js.map +1 -0
- package/dist/cli/mcp/index.js +2 -0
- package/dist/cli/mcp/index.js.map +1 -0
- package/dist/cli/pathing.js +51 -0
- package/dist/cli/pathing.js.map +1 -0
- package/dist/cli/platforms.js +2 -0
- package/dist/cli/platforms.js.map +1 -0
- package/dist/cli/rules/commands.js +26 -0
- package/dist/cli/rules/commands.js.map +1 -0
- package/dist/cli/rules/index.js +2 -0
- package/dist/cli/rules/index.js.map +1 -0
- package/dist/cli/tech/index.js +2 -0
- package/dist/cli/tech/index.js.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/cli/workflows/commands.js +74 -0
- package/dist/cli/workflows/commands.js.map +1 -0
- package/dist/cli/workflows/index.js +2 -0
- package/dist/cli/workflows/index.js.map +1 -0
- package/package.json +17 -6
- package/src/cli/commands/register.ts +163 -0
- package/src/cli/config/index.ts +1 -0
- package/src/cli/constants.ts +3 -0
- package/src/cli/core.ts +11325 -0
- package/src/cli/index.ts +3 -0
- package/src/cli/init/banner.ts +20 -0
- package/src/cli/init/execute.ts +88 -0
- package/src/cli/init/index.ts +4 -0
- package/src/cli/init/prompts.ts +163 -0
- package/src/cli/init/types.ts +43 -0
- package/src/cli/io.ts +1 -0
- package/src/cli/mcp/commands.ts +131 -0
- package/src/cli/mcp/index.ts +1 -0
- package/src/cli/pathing.ts +50 -0
- package/src/cli/platforms.ts +1 -0
- package/src/cli/rules/commands.ts +40 -0
- package/src/cli/rules/index.ts +1 -0
- package/src/cli/tech/index.ts +1 -0
- package/src/cli/types.ts +15 -0
- package/src/cli/workflows/commands.ts +163 -0
- package/src/cli/workflows/index.ts +1 -0
- package/tsconfig.cli.json +19 -0
- package/workflows/workflows/agent-environment-setup/platforms/antigravity/rules/GEMINI.md +18 -40
- package/workflows/workflows/agent-environment-setup/platforms/codex/rules/AGENTS.md +18 -41
- package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/AGENTS.md +18 -40
- package/workflows/workflows/agent-environment-setup/platforms/copilot/rules/copilot-instructions.md +18 -40
package/src/cli/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function renderInitWelcome({ version }: { version: string }) {
|
|
2
|
+
const safeVersion = String(version || "").trim() || "dev";
|
|
3
|
+
const lines = [
|
|
4
|
+
"╔══════════════════════════════════════════════════════════════╗",
|
|
5
|
+
"║ Cubis Foundry CLI ║",
|
|
6
|
+
"║ Interactive Init ║",
|
|
7
|
+
"╚══════════════════════════════════════════════════════════════╝",
|
|
8
|
+
"",
|
|
9
|
+
" ██████╗",
|
|
10
|
+
" ██╔════╝",
|
|
11
|
+
" ██║ Cubis Foundry",
|
|
12
|
+
" ██║ C icon",
|
|
13
|
+
" ╚██████╗",
|
|
14
|
+
" ╚═════╝",
|
|
15
|
+
"",
|
|
16
|
+
`CLI Version ${safeVersion}`,
|
|
17
|
+
"",
|
|
18
|
+
];
|
|
19
|
+
return lines.join("\n");
|
|
20
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InitExecutionPlan,
|
|
3
|
+
InitExecutionPlanItem,
|
|
4
|
+
InitMcpId,
|
|
5
|
+
InitWizardSelections,
|
|
6
|
+
} from "./types.js";
|
|
7
|
+
|
|
8
|
+
function hasMcpSelection(selectedMcps: InitMcpId[], mcpId: InitMcpId) {
|
|
9
|
+
return selectedMcps.includes(mcpId);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function buildInitExecutionPlan({
|
|
13
|
+
selections,
|
|
14
|
+
dryRun,
|
|
15
|
+
target,
|
|
16
|
+
}: {
|
|
17
|
+
selections: InitWizardSelections;
|
|
18
|
+
dryRun: boolean;
|
|
19
|
+
target?: string;
|
|
20
|
+
}): InitExecutionPlan {
|
|
21
|
+
const planItems: InitExecutionPlanItem[] = [];
|
|
22
|
+
const wantsPostman = hasMcpSelection(selections.selectedMcps, "postman");
|
|
23
|
+
const wantsStitch = hasMcpSelection(selections.selectedMcps, "stitch");
|
|
24
|
+
const wantsFoundry = hasMcpSelection(selections.selectedMcps, "cubis-foundry");
|
|
25
|
+
|
|
26
|
+
for (const platform of selections.platforms) {
|
|
27
|
+
const stitchSupported = platform === "antigravity";
|
|
28
|
+
const stitchEnabled = wantsStitch && stitchSupported;
|
|
29
|
+
const warnings: string[] = [];
|
|
30
|
+
if (wantsStitch && !stitchSupported) {
|
|
31
|
+
warnings.push(
|
|
32
|
+
`Stitch is not supported on '${platform}'. It will be skipped for this platform.`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const installOptions: Record<string, unknown> = {
|
|
37
|
+
platform,
|
|
38
|
+
scope: selections.skillsScope,
|
|
39
|
+
bundle: selections.bundleId,
|
|
40
|
+
skillProfile: selections.skillProfile,
|
|
41
|
+
allSkills: selections.skillProfile === "full",
|
|
42
|
+
dryRun,
|
|
43
|
+
yes: true,
|
|
44
|
+
target,
|
|
45
|
+
postman: wantsPostman,
|
|
46
|
+
stitch: stitchEnabled,
|
|
47
|
+
stitchDefaultForAntigravity: false,
|
|
48
|
+
mcpScope: selections.mcpScope,
|
|
49
|
+
foundryMcp: wantsFoundry,
|
|
50
|
+
mcpToolSync: wantsPostman || stitchEnabled,
|
|
51
|
+
mcpRuntime: wantsPostman || stitchEnabled ? selections.mcpRuntime : "local",
|
|
52
|
+
mcpFallback: "local",
|
|
53
|
+
mcpBuildLocal:
|
|
54
|
+
wantsPostman || stitchEnabled ? selections.mcpBuildLocal : false,
|
|
55
|
+
postmanMode: wantsPostman ? selections.postmanMode : undefined,
|
|
56
|
+
postmanWorkspaceId: wantsPostman
|
|
57
|
+
? selections.postmanWorkspaceId
|
|
58
|
+
: undefined,
|
|
59
|
+
initWizardMode: true,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
planItems.push({
|
|
63
|
+
platform,
|
|
64
|
+
installOptions,
|
|
65
|
+
warnings,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
items: planItems,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function formatInitSummary(selections: InitWizardSelections) {
|
|
75
|
+
const postmanSelected = selections.selectedMcps.includes("postman");
|
|
76
|
+
return [
|
|
77
|
+
"Init plan summary:",
|
|
78
|
+
`- Bundle: ${selections.bundleId}`,
|
|
79
|
+
`- Platforms: ${selections.platforms.join(", ")}`,
|
|
80
|
+
`- Skill profile: ${selections.skillProfile}`,
|
|
81
|
+
`- Skills scope: ${selections.skillsScope}`,
|
|
82
|
+
`- MCP scope: ${selections.mcpScope}`,
|
|
83
|
+
`- MCP runtime: ${selections.mcpRuntime}${selections.mcpRuntime === "docker" ? selections.mcpBuildLocal ? " (build local image)" : " (pull image)" : ""}`,
|
|
84
|
+
`- MCP selections: ${selections.selectedMcps.length > 0 ? selections.selectedMcps.join(", ") : "(none)"}`,
|
|
85
|
+
`- Postman mode: ${postmanSelected ? selections.postmanMode : "(not selected)"}`,
|
|
86
|
+
`- Postman workspace: ${postmanSelected ? selections.postmanWorkspaceId === null ? "null" : selections.postmanWorkspaceId : "(not selected)"}`,
|
|
87
|
+
].join("\n");
|
|
88
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { checkbox, confirm, password, select } from "@inquirer/prompts";
|
|
2
|
+
import type {
|
|
3
|
+
InitMcpId,
|
|
4
|
+
InitMcpRuntime,
|
|
5
|
+
InitPlatformId,
|
|
6
|
+
InitPostmanMode,
|
|
7
|
+
InitScope,
|
|
8
|
+
InitSkillProfile,
|
|
9
|
+
} from "./types.js";
|
|
10
|
+
|
|
11
|
+
export async function promptInitBundle({
|
|
12
|
+
bundleIds,
|
|
13
|
+
defaultBundle,
|
|
14
|
+
}: {
|
|
15
|
+
bundleIds: string[];
|
|
16
|
+
defaultBundle: string;
|
|
17
|
+
}) {
|
|
18
|
+
return select({
|
|
19
|
+
message: "Select workflow bundle:",
|
|
20
|
+
default: defaultBundle,
|
|
21
|
+
choices: bundleIds.map((bundleId) => ({
|
|
22
|
+
name: bundleId,
|
|
23
|
+
value: bundleId,
|
|
24
|
+
})),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function promptInitPlatforms({
|
|
29
|
+
defaultPlatforms,
|
|
30
|
+
}: {
|
|
31
|
+
defaultPlatforms: InitPlatformId[];
|
|
32
|
+
}) {
|
|
33
|
+
return checkbox<InitPlatformId>({
|
|
34
|
+
message: "Select target platform(s):",
|
|
35
|
+
required: true,
|
|
36
|
+
choices: [
|
|
37
|
+
{ name: "Codex", value: "codex", checked: defaultPlatforms.includes("codex") },
|
|
38
|
+
{
|
|
39
|
+
name: "Antigravity",
|
|
40
|
+
value: "antigravity",
|
|
41
|
+
checked: defaultPlatforms.includes("antigravity"),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "GitHub Copilot",
|
|
45
|
+
value: "copilot",
|
|
46
|
+
checked: defaultPlatforms.includes("copilot"),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function promptInitSkillProfile(defaultSkillProfile: InitSkillProfile) {
|
|
53
|
+
return select<InitSkillProfile>({
|
|
54
|
+
message: "Select skills install profile:",
|
|
55
|
+
default: defaultSkillProfile,
|
|
56
|
+
choices: [
|
|
57
|
+
{ name: "core", value: "core" },
|
|
58
|
+
{ name: "web-backend", value: "web-backend" },
|
|
59
|
+
{ name: "full", value: "full" },
|
|
60
|
+
],
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function promptInitMcpSelection(defaultMcps: InitMcpId[]) {
|
|
65
|
+
return checkbox<InitMcpId>({
|
|
66
|
+
message: "Select which MCP integrations to configure:",
|
|
67
|
+
choices: [
|
|
68
|
+
{
|
|
69
|
+
name: "Cubis Foundry",
|
|
70
|
+
value: "cubis-foundry",
|
|
71
|
+
checked: defaultMcps.includes("cubis-foundry"),
|
|
72
|
+
},
|
|
73
|
+
{ name: "Postman", value: "postman", checked: defaultMcps.includes("postman") },
|
|
74
|
+
{ name: "Stitch", value: "stitch", checked: defaultMcps.includes("stitch") },
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function promptInitScope({
|
|
80
|
+
message,
|
|
81
|
+
defaultScope,
|
|
82
|
+
}: {
|
|
83
|
+
message: string;
|
|
84
|
+
defaultScope: InitScope;
|
|
85
|
+
}) {
|
|
86
|
+
return select<InitScope>({
|
|
87
|
+
message,
|
|
88
|
+
default: defaultScope,
|
|
89
|
+
choices: [
|
|
90
|
+
{ name: defaultScope === "global" ? "Global (recommended)" : "Global", value: "global" },
|
|
91
|
+
{
|
|
92
|
+
name: defaultScope === "project" ? "Project (recommended)" : "Project",
|
|
93
|
+
value: "project",
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function promptInitPostmanMode(defaultMode: InitPostmanMode) {
|
|
100
|
+
return select<InitPostmanMode>({
|
|
101
|
+
message: "Select Postman installation mode:",
|
|
102
|
+
default: defaultMode,
|
|
103
|
+
choices: [
|
|
104
|
+
{ name: "full", value: "full" },
|
|
105
|
+
{ name: "minimal", value: "minimal" },
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function promptInitMcpRuntime({
|
|
111
|
+
defaultRuntime,
|
|
112
|
+
defaultBuildLocal,
|
|
113
|
+
}: {
|
|
114
|
+
defaultRuntime: InitMcpRuntime;
|
|
115
|
+
defaultBuildLocal: boolean;
|
|
116
|
+
}) {
|
|
117
|
+
const defaultChoice =
|
|
118
|
+
defaultRuntime === "docker"
|
|
119
|
+
? defaultBuildLocal
|
|
120
|
+
? "docker-build-local"
|
|
121
|
+
: "docker-pull"
|
|
122
|
+
: "local";
|
|
123
|
+
|
|
124
|
+
const choice = await select<"local" | "docker-pull" | "docker-build-local">({
|
|
125
|
+
message: "Select MCP runtime mode:",
|
|
126
|
+
default: defaultChoice,
|
|
127
|
+
choices: [
|
|
128
|
+
{
|
|
129
|
+
name: "Local command server (cbx mcp serve)",
|
|
130
|
+
value: "local",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "Docker runtime (pull image)",
|
|
134
|
+
value: "docker-pull",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "Docker runtime (build image locally)",
|
|
138
|
+
value: "docker-build-local",
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
mcpRuntime: choice === "local" ? "local" : ("docker" as const),
|
|
145
|
+
mcpBuildLocal: choice === "docker-build-local",
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export async function promptOptionalSecret(message: string) {
|
|
150
|
+
const value = await password({
|
|
151
|
+
message,
|
|
152
|
+
mask: "*",
|
|
153
|
+
});
|
|
154
|
+
const normalized = String(value || "").trim();
|
|
155
|
+
return normalized || null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export async function promptInitApplyConfirmation(summary: string) {
|
|
159
|
+
return confirm({
|
|
160
|
+
message: `${summary}\n\nApply this installation plan?`,
|
|
161
|
+
default: true,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type InitScope = "project" | "global";
|
|
2
|
+
export type InitSkillProfile = "core" | "web-backend" | "full";
|
|
3
|
+
export type InitMcpId = "cubis-foundry" | "postman" | "stitch";
|
|
4
|
+
export type InitPostmanMode = "full" | "minimal";
|
|
5
|
+
export type InitPlatformId = "codex" | "antigravity" | "copilot";
|
|
6
|
+
export type InitMcpRuntime = "local" | "docker";
|
|
7
|
+
|
|
8
|
+
export interface InitWizardSelections {
|
|
9
|
+
bundleId: string;
|
|
10
|
+
platforms: InitPlatformId[];
|
|
11
|
+
skillProfile: InitSkillProfile;
|
|
12
|
+
skillsScope: InitScope;
|
|
13
|
+
mcpScope: InitScope;
|
|
14
|
+
mcpRuntime: InitMcpRuntime;
|
|
15
|
+
mcpBuildLocal: boolean;
|
|
16
|
+
selectedMcps: InitMcpId[];
|
|
17
|
+
postmanMode: InitPostmanMode;
|
|
18
|
+
postmanWorkspaceId: string | null;
|
|
19
|
+
postmanApiKey: string | null;
|
|
20
|
+
stitchApiKey: string | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface InitExecutionPlanItem {
|
|
24
|
+
platform: InitPlatformId;
|
|
25
|
+
installOptions: Record<string, unknown>;
|
|
26
|
+
warnings: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface InitExecutionPlan {
|
|
30
|
+
items: InitExecutionPlanItem[];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PerPlatformInitResult {
|
|
34
|
+
platform: InitPlatformId;
|
|
35
|
+
status: "success" | "failed";
|
|
36
|
+
warnings: string[];
|
|
37
|
+
error?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface InitWarnings {
|
|
41
|
+
global: string[];
|
|
42
|
+
perPlatform: Record<string, string[]>;
|
|
43
|
+
}
|
package/src/cli/io.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { WorkflowAction } from "../types.js";
|
|
3
|
+
|
|
4
|
+
export interface McpCommandDeps {
|
|
5
|
+
runMcpServe: WorkflowAction;
|
|
6
|
+
runMcpToolsSync: WorkflowAction;
|
|
7
|
+
runMcpToolsList: WorkflowAction;
|
|
8
|
+
runMcpRuntimeStatus: WorkflowAction;
|
|
9
|
+
runMcpRuntimeUp: WorkflowAction;
|
|
10
|
+
runMcpRuntimeDown: WorkflowAction;
|
|
11
|
+
defaultMcpDockerContainerName: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function registerMcpCommands(program: Command, deps: McpCommandDeps) {
|
|
15
|
+
const mcpCommand = program
|
|
16
|
+
.command("mcp")
|
|
17
|
+
.description("Manage Cubis MCP runtime catalogs and tool discovery");
|
|
18
|
+
|
|
19
|
+
mcpCommand
|
|
20
|
+
.command("serve")
|
|
21
|
+
.description(
|
|
22
|
+
"Launch bundled Cubis Foundry MCP server (canonical local entrypoint)",
|
|
23
|
+
)
|
|
24
|
+
.option("--transport <transport>", "stdio|http", "stdio")
|
|
25
|
+
.option("--scope <scope>", "auto|global|project", "auto")
|
|
26
|
+
.option("--port <port>", "HTTP port override")
|
|
27
|
+
.option("--host <host>", "HTTP host override")
|
|
28
|
+
.option("--scan-only", "scan vault and exit")
|
|
29
|
+
.option("--config <path>", "explicit MCP server config file path")
|
|
30
|
+
.option("--debug", "enable debug logging in MCP server")
|
|
31
|
+
.action(deps.runMcpServe);
|
|
32
|
+
|
|
33
|
+
const mcpToolsCommand = mcpCommand
|
|
34
|
+
.command("tools")
|
|
35
|
+
.description("Discover and inspect upstream MCP tool catalogs");
|
|
36
|
+
|
|
37
|
+
mcpToolsCommand
|
|
38
|
+
.command("sync")
|
|
39
|
+
.description("Discover upstream tools and persist local non-secret catalogs")
|
|
40
|
+
.option("--service <service>", "postman|stitch|all", "all")
|
|
41
|
+
.option(
|
|
42
|
+
"--scope <scope>",
|
|
43
|
+
"config scope: project|workspace|global|user",
|
|
44
|
+
"global",
|
|
45
|
+
)
|
|
46
|
+
.option("--dry-run", "preview sync without writing catalog files")
|
|
47
|
+
.action(deps.runMcpToolsSync);
|
|
48
|
+
|
|
49
|
+
mcpToolsCommand
|
|
50
|
+
.command("list")
|
|
51
|
+
.description("List cached tool names from local MCP catalog")
|
|
52
|
+
.requiredOption("--service <service>", "postman|stitch")
|
|
53
|
+
.option(
|
|
54
|
+
"--scope <scope>",
|
|
55
|
+
"config scope: project|workspace|global|user",
|
|
56
|
+
"global",
|
|
57
|
+
)
|
|
58
|
+
.action(deps.runMcpToolsList);
|
|
59
|
+
|
|
60
|
+
const mcpRuntimeCommand = mcpCommand
|
|
61
|
+
.command("runtime")
|
|
62
|
+
.description("Manage local Docker runtime container for Cubis MCP gateway");
|
|
63
|
+
|
|
64
|
+
mcpRuntimeCommand
|
|
65
|
+
.command("status")
|
|
66
|
+
.description("Show Docker runtime status and configured MCP runtime defaults")
|
|
67
|
+
.option(
|
|
68
|
+
"--scope <scope>",
|
|
69
|
+
"config scope: project|workspace|global|user",
|
|
70
|
+
"global",
|
|
71
|
+
)
|
|
72
|
+
.option(
|
|
73
|
+
"--name <name>",
|
|
74
|
+
"container name",
|
|
75
|
+
deps.defaultMcpDockerContainerName,
|
|
76
|
+
)
|
|
77
|
+
.option(
|
|
78
|
+
"--skills-root <path>",
|
|
79
|
+
"host skills directory to resolve/mount (default: auto-detect)",
|
|
80
|
+
)
|
|
81
|
+
.action(deps.runMcpRuntimeStatus);
|
|
82
|
+
|
|
83
|
+
mcpRuntimeCommand
|
|
84
|
+
.command("up")
|
|
85
|
+
.description("Start Docker runtime container for Cubis MCP gateway")
|
|
86
|
+
.option(
|
|
87
|
+
"--scope <scope>",
|
|
88
|
+
"config scope: project|workspace|global|user",
|
|
89
|
+
"global",
|
|
90
|
+
)
|
|
91
|
+
.option(
|
|
92
|
+
"--name <name>",
|
|
93
|
+
"container name",
|
|
94
|
+
deps.defaultMcpDockerContainerName,
|
|
95
|
+
)
|
|
96
|
+
.option("--image <image:tag>", "docker image to run")
|
|
97
|
+
.option("--update-policy <policy>", "pinned|latest")
|
|
98
|
+
.option(
|
|
99
|
+
"--fallback <fallback>",
|
|
100
|
+
"when endpoint is unreachable: local|fail|skip",
|
|
101
|
+
)
|
|
102
|
+
.option(
|
|
103
|
+
"--build-local",
|
|
104
|
+
"build MCP Docker image from local package mcp/ directory instead of pulling",
|
|
105
|
+
)
|
|
106
|
+
.option("--port <port>", "host port to map to container :3100")
|
|
107
|
+
.option(
|
|
108
|
+
"--skills-root <path>",
|
|
109
|
+
"host skills directory to mount into /workflows/skills (default: auto-detect)",
|
|
110
|
+
)
|
|
111
|
+
.option("--replace", "remove existing container with same name before start")
|
|
112
|
+
.action(deps.runMcpRuntimeUp);
|
|
113
|
+
|
|
114
|
+
mcpRuntimeCommand
|
|
115
|
+
.command("down")
|
|
116
|
+
.description("Stop and remove Docker runtime container")
|
|
117
|
+
.option(
|
|
118
|
+
"--name <name>",
|
|
119
|
+
"container name",
|
|
120
|
+
deps.defaultMcpDockerContainerName,
|
|
121
|
+
)
|
|
122
|
+
.action(deps.runMcpRuntimeDown);
|
|
123
|
+
|
|
124
|
+
mcpRuntimeCommand.action(() => {
|
|
125
|
+
mcpRuntimeCommand.help();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
mcpCommand.action(() => {
|
|
129
|
+
mcpCommand.help();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { AGENT_ASSETS_SUBDIR } from "./constants.js";
|
|
7
|
+
|
|
8
|
+
export function packageRoot() {
|
|
9
|
+
let currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
for (let i = 0; i < 5; i += 1) {
|
|
11
|
+
const candidatePackageJson = path.join(currentDir, "package.json");
|
|
12
|
+
if (existsSync(candidatePackageJson)) {
|
|
13
|
+
return currentDir;
|
|
14
|
+
}
|
|
15
|
+
const parentDir = path.resolve(currentDir, "..");
|
|
16
|
+
if (parentDir === currentDir) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
currentDir = parentDir;
|
|
20
|
+
}
|
|
21
|
+
return process.cwd();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function agentAssetsRoot() {
|
|
25
|
+
const preferred = path.join(packageRoot(), AGENT_ASSETS_SUBDIR);
|
|
26
|
+
return existsSync(preferred) ? preferred : packageRoot();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function workflowSkillsRoot() {
|
|
30
|
+
return path.join(agentAssetsRoot(), "skills");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function expandPath(inputPath: string, cwd = process.cwd()) {
|
|
34
|
+
if (!inputPath) return cwd;
|
|
35
|
+
if (inputPath === "~") return os.homedir();
|
|
36
|
+
if (inputPath.startsWith("~/"))
|
|
37
|
+
return path.join(os.homedir(), inputPath.slice(2));
|
|
38
|
+
if (path.isAbsolute(inputPath)) return inputPath;
|
|
39
|
+
return path.resolve(cwd, inputPath);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function findWorkspaceRoot(startDir = process.cwd()) {
|
|
43
|
+
let current = path.resolve(startDir);
|
|
44
|
+
while (true) {
|
|
45
|
+
if (existsSync(path.join(current, ".git"))) return current;
|
|
46
|
+
const parent = path.dirname(current);
|
|
47
|
+
if (parent === current) return path.resolve(startDir);
|
|
48
|
+
current = parent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type PlatformId = "codex" | "antigravity" | "copilot";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { WorkflowAction } from "../types.js";
|
|
3
|
+
|
|
4
|
+
export interface RulesCommandDeps {
|
|
5
|
+
runRulesInit: WorkflowAction;
|
|
6
|
+
runRulesTechMd: WorkflowAction;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function registerRulesCommands(program: Command, deps: RulesCommandDeps) {
|
|
10
|
+
const rulesCommand = program
|
|
11
|
+
.command("rules")
|
|
12
|
+
.description(
|
|
13
|
+
"Create and sync strict engineering rules and generated TECH.md",
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
rulesCommand
|
|
17
|
+
.command("init")
|
|
18
|
+
.description(
|
|
19
|
+
"Create/update ENGINEERING_RULES.md, patch active platform rule file with managed guardrail block, and generate TECH.md",
|
|
20
|
+
)
|
|
21
|
+
.option("-p, --platform <platform>", "target platform id")
|
|
22
|
+
.option("--scope <scope>", "target scope: project|global", "project")
|
|
23
|
+
.option("--overwrite", "overwrite existing ENGINEERING_RULES.md and TECH.md")
|
|
24
|
+
.option("--skip-tech", "skip TECH.md generation")
|
|
25
|
+
.option("--dry-run", "preview changes without writing files")
|
|
26
|
+
.action(deps.runRulesInit);
|
|
27
|
+
|
|
28
|
+
rulesCommand
|
|
29
|
+
.command("tech-md")
|
|
30
|
+
.description("Scan the codebase and generate/update TECH.md")
|
|
31
|
+
.option("--output <path>", "output path (default: <workspace-root>/TECH.md)")
|
|
32
|
+
.option("--overwrite", "overwrite existing TECH.md")
|
|
33
|
+
.option("--compact", "generate compact TECH.md (stack + context budget only)")
|
|
34
|
+
.option("--dry-run", "preview generation without writing files")
|
|
35
|
+
.action(deps.runRulesTechMd);
|
|
36
|
+
|
|
37
|
+
rulesCommand.action(() => {
|
|
38
|
+
rulesCommand.help();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/cli/types.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
export type AnyOptions = Record<string, unknown>;
|
|
4
|
+
|
|
5
|
+
export type WorkflowAction = (options: AnyOptions) => Promise<void> | void;
|
|
6
|
+
export type WorkflowTargetAction = (
|
|
7
|
+
target: string,
|
|
8
|
+
options: AnyOptions,
|
|
9
|
+
) => Promise<void> | void;
|
|
10
|
+
export type WorkflowDoctorAction = (
|
|
11
|
+
platform: string | undefined,
|
|
12
|
+
options: AnyOptions,
|
|
13
|
+
) => Promise<void> | void;
|
|
14
|
+
|
|
15
|
+
export type CommandDecorator = (command: Command) => Command;
|