@agiflowai/aicode-toolkit 1.0.26 → 1.2.0
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/dist/cli.cjs +181 -184
- package/dist/cli.mjs +59 -62
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts +0 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +2 -4
- package/dist/{mcp--A-5zuBI.cjs → mcp-CwMcfNLE.mjs} +23 -25
- package/dist/{mcp-CBcPdzNG.mjs → mcp-HNZY6MpT.cjs} +23 -7
- package/dist/mcp-XXavvCHL.cjs +3 -0
- package/dist/{utils-DMP5MQCv.cjs → utils-BdZqGo-L.cjs} +227 -209
- package/dist/{utils-BTSpNlWu.mjs → utils-re_0nbT6.mjs} +40 -23
- package/package.json +22 -22
- package/dist/mcp-B9X7HURl.cjs +0 -4
- package/dist/mcp-Cvo6pkS0.mjs +0 -3
package/dist/cli.mjs
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
2
|
+
import { n as MCP_SERVER_INFO, t as MCPServer } from "./mcp-CwMcfNLE.mjs";
|
|
3
|
+
import { a as TemplateSelectionService, c as SpecToolService, l as NewProjectService, o as SPEC_TOOL_INFO, r as displaySuccessMessage, s as SpecTool, t as displayBanner, u as CodingAgentService } from "./utils-re_0nbT6.mjs";
|
|
4
4
|
import { ProjectType, TemplatesManagerService, cloneRepository, cloneSubdirectory, detectProjectType, ensureDir, findWorkspaceRoot, icons, messages, parseGitHubUrl, pathExists, print, sections } from "@agiflowai/aicode-utils";
|
|
5
5
|
import { mkdir as mkdir$1, readFile as readFile$1, writeFile as writeFile$1 } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { Liquid } from "liquidjs";
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
10
|
-
import
|
|
10
|
+
import * as oraImport from "ora";
|
|
11
11
|
import { assign, createActor, createMachine, fromPromise } from "xstate";
|
|
12
12
|
import yaml from "js-yaml";
|
|
13
|
-
|
|
14
13
|
//#region package.json
|
|
15
|
-
var version = "1.0
|
|
16
|
-
|
|
14
|
+
var version = "1.1.0";
|
|
17
15
|
//#endregion
|
|
18
16
|
//#region src/commands/add.ts
|
|
19
17
|
/**
|
|
@@ -75,11 +73,9 @@ const addCommand = new Command("add").description("Add a template to templates f
|
|
|
75
73
|
process.exit(1);
|
|
76
74
|
}
|
|
77
75
|
});
|
|
78
|
-
|
|
79
76
|
//#endregion
|
|
80
77
|
//#region src/templates/settings.yaml.liquid?raw
|
|
81
78
|
var settings_yaml_default = "# .toolkit/settings.yaml\n# Toolkit configuration for aicode-toolkit\n#\n# Local overrides go in .toolkit/settings.local.yaml (add to .gitignore).\n# Local settings are shallow-merged over this file — useful for per-developer\n# LLM tool preferences or API keys without committing them.\n#\n# All fields are optional. Uncomment and edit what you need.\n\n# ---------------------------------------------------------------------------\n# Project identity\n# ---------------------------------------------------------------------------\n\n{% comment %}Project type: monolith (single app) or monorepo (multiple packages/apps){% endcomment %}\n{% if projectType %}\nprojectType: {{ projectType }}\n{% else %}\n# projectType: monolith\n{% endif %}\n\n{% comment %}Path to the scaffold templates directory, relative to workspace root.{% endcomment %}\n{% if templatesPath %}\ntemplatesPath: {{ templatesPath }}\n{% else %}\n# templatesPath: ./templates\n{% endif %}\n\n{% comment %}Active template name (monolith only — monorepo reads from project.json).{% endcomment %}\n{% if sourceTemplate %}\nsourceTemplate: {{ sourceTemplate }}\n{% else %}\n# sourceTemplate: react-vite\n{% endif %}\n\n# Config schema version.\n# version: '1.0'\n\n# ---------------------------------------------------------------------------\n# scaffold-mcp — configuration for the scaffold-mcp CLI\n# CLI flags always take precedence over values set here.\n# ---------------------------------------------------------------------------\n\nscaffold-mcp:\n\n # -------------------------------------------------------------------------\n # mcp-serve — defaults for `scaffold-mcp mcp-serve`\n # -------------------------------------------------------------------------\n mcp-serve:\n # Transport type: stdio | http | sse (default: stdio)\n # type: stdio\n\n # Port for http/sse transport (default: 3000)\n # port: 3000\n\n # Host to bind for http/sse transport (default: localhost)\n # host: localhost\n\n # Enable admin tools such as generate-boilerplate (default: false)\n # adminEnable: false\n\n # Render prompts with skill front matter for Claude Code (default: false)\n # promptAsSkill: false\n\n # Fallback LLM tool used when scaffold-mcp needs AI assistance.\n # Supported: claude-code | gemini-cli | codex\n {% if fallbackTool %}\n fallbackTool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n # Config passed to the fallback LLM tool.\n fallbackToolConfig:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% else %}\n # Config passed to the fallback LLM tool.\n # fallbackToolConfig:\n # model: gemini-2.0-flash\n {% endif %}\n {% else %}\n # fallbackTool: gemini-cli\n # Config passed to the fallback LLM tool.\n # fallbackToolConfig:\n # model: gemini-2.0-flash\n {% endif %}\n\n # Ordered fallback chain used when fallbackTool is not set.\n # The first valid entry wins.\n # fallbacks:\n # - tool: gemini-cli\n # config:\n # model: gemini-2.0-flash\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n\n # Extra CLI args merged into the mcp-serve command (key: value → --key value)\n # args:\n # review-tool: gemini-cli\n\n # -------------------------------------------------------------------------\n # hook — defaults for `scaffold-mcp hook`\n # Keyed by agent name, then by hook method.\n # Supported agents : claude-code | gemini-cli\n # Supported methods : preToolUse | postToolUse | userPromptSubmit | taskCompleted | stop\n # CLI flags --fallback-tool and --fallback-tool-config still take precedence.\n # -------------------------------------------------------------------------\n hook:\n\n claude-code:\n preToolUse:\n # LLM tool to use for this hook. Supported: claude-code | gemini-cli | codex\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # fallbacks:\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n # matcher: Edit|MultiEdit|Write\n # Extra CLI args appended to the generated hook command (key: value → --key value)\n # args:\n # llm-tool: gemini-cli\n\n postToolUse:\n # matcher: Edit|MultiEdit|Write\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # fallbacks:\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n # args:\n # llm-tool: gemini-cli\n\n userPromptSubmit:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # args:\n # llm-tool: gemini-cli\n\n taskCompleted:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # args:\n # llm-tool: gemini-cli\n\n stop:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # args:\n # llm-tool: gemini-cli\n\n gemini-cli:\n preToolUse:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n\n postToolUse:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n\n# ---------------------------------------------------------------------------\n# architect-mcp — configuration for the architect-mcp CLI\n# CLI flags always take precedence over values set here.\n# ---------------------------------------------------------------------------\n\narchitect-mcp:\n\n # -------------------------------------------------------------------------\n # mcp-serve — defaults for `architect-mcp mcp-serve`\n # -------------------------------------------------------------------------\n mcp-serve:\n # Transport type: stdio | http | sse (default: stdio)\n # type: stdio\n\n # Port for http/sse transport (default: 3000)\n # port: 3000\n\n # Host to bind for http/sse transport (default: localhost)\n # host: localhost\n\n # Enable admin tools such as add-design-pattern and add-rule (default: false)\n # adminEnable: false\n\n # Fallback LLM tool used for both design-pattern and review when specific tools are not set.\n # Supported: claude-code | gemini-cli | codex\n {% if fallbackTool %}\n fallbackTool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n # Config passed to the fallback LLM tool.\n fallbackToolConfig:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% else %}\n # Config passed to the fallback LLM tool.\n # fallbackToolConfig:\n # model: gemini-2.0-flash\n {% endif %}\n {% else %}\n # fallbackTool: gemini-cli\n # Config passed to the fallback LLM tool.\n # fallbackToolConfig:\n # model: gemini-2.0-flash\n {% endif %}\n\n # Ordered fallback chain used when fallbackTool is not set.\n # The first valid entry wins.\n # fallbacks:\n # - tool: gemini-cli\n # config:\n # model: gemini-2.0-flash\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n\n # LLM tool used specifically for get-file-design-pattern analysis.\n # Overrides fallbackTool for design pattern operations.\n # designPatternTool: gemini-cli\n\n # Config passed to the design pattern LLM tool.\n # designPatternToolConfig:\n # model: gemini-2.0-flash\n\n # LLM tool used specifically for review-code-change analysis.\n # Overrides fallbackTool for code review operations.\n # reviewTool: gemini-cli\n\n # Config passed to the review LLM tool.\n # reviewToolConfig:\n # model: gemini-2.0-flash\n\n # Extra CLI args merged into the mcp-serve command (key: value → --key value)\n # args:\n # review-tool: gemini-cli\n\n # -------------------------------------------------------------------------\n # hook — defaults for `architect-mcp hook`\n # Keyed by agent name, then by hook method.\n # Supported agents : claude-code | gemini-cli\n # Supported methods : preToolUse | postToolUse\n # CLI flags --llm-tool, --fallback-tool, and --tool-config still take precedence.\n # -------------------------------------------------------------------------\n hook:\n\n claude-code:\n preToolUse:\n # Static pattern matching is usually enough here. Leave llm-tool unset unless\n # you want extra pattern filtering via LLM.\n {% if fallbackTool %}\n fallback-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n fallback-tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # fallback-tool: gemini-cli\n # fallback-tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # fallbacks:\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n # matcher: Edit|MultiEdit|Write\n # Extra CLI args appended to the generated hook command (key: value → --key value)\n # args:\n # llm-tool: gemini-cli\n\n postToolUse:\n # matcher: Edit|MultiEdit|Write\n # Set llm-tool only if you want LLM-based review. A cheap model is recommended.\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n # fallbacks:\n # - tool: codex\n # config:\n # model: gpt-5.2-mini\n # args:\n # llm-tool: gemini-cli\n\n gemini-cli:\n preToolUse:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n\n postToolUse:\n {% if fallbackTool %}\n llm-tool: {{ fallbackTool }}\n {% if fallbackToolConfig %}\n tool-config:\n {% for pair in fallbackToolConfig %}\n {{ pair[0] }}: {{ pair[1] }}\n {% endfor %}\n {% endif %}\n {% else %}\n # llm-tool: gemini-cli\n # tool-config:\n # model: gemini-2.0-flash\n {% endif %}\n\n# ---------------------------------------------------------------------------\n# mcp-config — generates mcp-config.yaml via `aicode sync --mcp`\n# Servers listed here become entries in mcp-config.yaml.\n# Run `aicode sync` to write the output file.\n# ---------------------------------------------------------------------------\n\n# mcp-config:\n# servers:\n# scaffold-mcp:\n# command: bun\n# args:\n# - run\n# - packages/scaffold-mcp/src/cli.ts\n# - mcp-serve\n# - --admin-enable\n# - --prompt-as-skill\n# instruction: \"Use this server for generating boilerplate code, scaffolding new projects, and adding features to existing projects.\"\n# architect-mcp:\n# command: bun\n# args:\n# - run\n# - packages/architect-mcp/src/cli.ts\n# - mcp-serve\n# instruction: \"Use this server for design pattern guidance and code review.\"\n# skills:\n# paths:\n# - docs/skills\n";
|
|
82
|
-
|
|
83
79
|
//#endregion
|
|
84
80
|
//#region src/states/init-machine.ts
|
|
85
81
|
/**
|
|
@@ -91,7 +87,7 @@ const initMachine = createMachine({
|
|
|
91
87
|
id: "init",
|
|
92
88
|
types: {},
|
|
93
89
|
initial: "displayingBanner",
|
|
94
|
-
context: ({ input
|
|
90
|
+
context: ({ input }) => ({
|
|
95
91
|
workspaceRoot: void 0,
|
|
96
92
|
projectName: void 0,
|
|
97
93
|
projectType: void 0,
|
|
@@ -106,7 +102,7 @@ const initMachine = createMachine({
|
|
|
106
102
|
codingAgent: void 0,
|
|
107
103
|
detectedSpecTool: void 0,
|
|
108
104
|
useSpecDrivenApproach: void 0,
|
|
109
|
-
options: input
|
|
105
|
+
options: input.options,
|
|
110
106
|
error: void 0
|
|
111
107
|
}),
|
|
112
108
|
states: {
|
|
@@ -431,9 +427,14 @@ const initMachine = createMachine({
|
|
|
431
427
|
failed: { type: "final" }
|
|
432
428
|
}
|
|
433
429
|
}, { guards: {} });
|
|
434
|
-
|
|
435
430
|
//#endregion
|
|
436
431
|
//#region src/commands/init.ts
|
|
432
|
+
function resolveOra(value, depth = 0) {
|
|
433
|
+
if (typeof value === "function") return value;
|
|
434
|
+
if (depth < 3 && value && (typeof value === "object" || typeof value === "function") && "default" in value) return resolveOra(value.default, depth + 1);
|
|
435
|
+
throw new Error("Unable to resolve ora instance");
|
|
436
|
+
}
|
|
437
|
+
const ora = resolveOra(oraImport);
|
|
437
438
|
const DEFAULT_TEMPLATE_REPO = {
|
|
438
439
|
owner: "AgiFlow",
|
|
439
440
|
repo: "aicode-toolkit",
|
|
@@ -459,10 +460,10 @@ const initActors = {
|
|
|
459
460
|
}
|
|
460
461
|
return { exists: false };
|
|
461
462
|
}),
|
|
462
|
-
detectProjectType: fromPromise(async ({ input
|
|
463
|
+
detectProjectType: fromPromise(async ({ input }) => {
|
|
463
464
|
print.divider();
|
|
464
465
|
print.info("Detecting project type...");
|
|
465
|
-
const result = await detectProjectType(input
|
|
466
|
+
const result = await detectProjectType(input.workspaceRoot);
|
|
466
467
|
if (result.projectType) print.success(`Detected ${result.projectType} project`);
|
|
467
468
|
return result;
|
|
468
469
|
}),
|
|
@@ -605,11 +606,11 @@ const initActors = {
|
|
|
605
606
|
}),
|
|
606
607
|
checkTemplatesFolder: fromPromise(async ({ input: actorInput }) => {
|
|
607
608
|
try {
|
|
608
|
-
const fs
|
|
609
|
+
const fs = await import("node:fs/promises");
|
|
609
610
|
const defaultTemplatesPath = path.join(actorInput.workspaceRoot, "templates");
|
|
610
611
|
let templatesExists = false;
|
|
611
612
|
try {
|
|
612
|
-
await fs
|
|
613
|
+
await fs.access(defaultTemplatesPath);
|
|
613
614
|
templatesExists = true;
|
|
614
615
|
} catch {
|
|
615
616
|
templatesExists = false;
|
|
@@ -637,7 +638,7 @@ const initActors = {
|
|
|
637
638
|
print.info("");
|
|
638
639
|
finalTemplatesPath = path.join(actorInput.workspaceRoot, customDir.trim());
|
|
639
640
|
try {
|
|
640
|
-
await fs
|
|
641
|
+
await fs.mkdir(finalTemplatesPath, { recursive: true });
|
|
641
642
|
print.success(`Created templates directory at: ${finalTemplatesPath}`);
|
|
642
643
|
} catch (error) {
|
|
643
644
|
throw new Error(`Failed to create templates directory at ${finalTemplatesPath}: ${error.message}`);
|
|
@@ -674,8 +675,8 @@ const initActors = {
|
|
|
674
675
|
return null;
|
|
675
676
|
}
|
|
676
677
|
}),
|
|
677
|
-
listTemplates: fromPromise(async ({ input
|
|
678
|
-
const templates = await new TemplateSelectionService(input
|
|
678
|
+
listTemplates: fromPromise(async ({ input }) => {
|
|
679
|
+
const templates = await new TemplateSelectionService(input.tmpTemplatesPath).listTemplates();
|
|
679
680
|
print.header("\nAvailable templates:");
|
|
680
681
|
for (const template of templates) print.item(`${template.name}${template.description ? ` - ${template.description}` : ""}`);
|
|
681
682
|
return templates;
|
|
@@ -684,18 +685,18 @@ const initActors = {
|
|
|
684
685
|
const templates = await new TemplateSelectionService(actorInput.tmpTemplatesPath).listTemplates();
|
|
685
686
|
if (templates.length === 0) throw new Error("No templates available");
|
|
686
687
|
if (actorInput.projectType === ProjectType.MONOLITH) {
|
|
687
|
-
const choices
|
|
688
|
+
const choices = templates.map((t) => ({
|
|
688
689
|
name: t.name,
|
|
689
690
|
value: t.name,
|
|
690
691
|
description: t.description ? `\n ${t.description}` : void 0
|
|
691
692
|
}));
|
|
692
693
|
print.divider();
|
|
693
|
-
const selected
|
|
694
|
+
const selected = await select({
|
|
694
695
|
message: "Select template (monolith allows only one):",
|
|
695
|
-
choices
|
|
696
|
+
choices
|
|
696
697
|
});
|
|
697
698
|
print.info("");
|
|
698
|
-
return [selected
|
|
699
|
+
return [selected];
|
|
699
700
|
}
|
|
700
701
|
const checkbox = await import("@inquirer/prompts").then((m) => m.checkbox);
|
|
701
702
|
const choices = templates.map((t) => ({
|
|
@@ -782,20 +783,20 @@ const initActors = {
|
|
|
782
783
|
throw error;
|
|
783
784
|
}
|
|
784
785
|
}),
|
|
785
|
-
cleanup: fromPromise(async ({ input
|
|
786
|
-
if (input
|
|
786
|
+
cleanup: fromPromise(async ({ input }) => {
|
|
787
|
+
if (input.tmpTemplatesPath) {
|
|
787
788
|
const spinner = ora("Cleaning up temporary files...").start();
|
|
788
789
|
try {
|
|
789
|
-
await new TemplateSelectionService(input
|
|
790
|
+
await new TemplateSelectionService(input.tmpTemplatesPath).cleanup();
|
|
790
791
|
spinner.succeed("Cleaned up temporary files");
|
|
791
792
|
} catch (_error) {
|
|
792
793
|
spinner.warn("Could not clean up all temporary files");
|
|
793
794
|
}
|
|
794
795
|
}
|
|
795
796
|
}),
|
|
796
|
-
detectSpecTool: fromPromise(async ({ input
|
|
797
|
+
detectSpecTool: fromPromise(async ({ input }) => {
|
|
797
798
|
print.info("\nDetecting spec tools...");
|
|
798
|
-
const detectedTool = await new SpecToolService(input
|
|
799
|
+
const detectedTool = await new SpecToolService(input.workspaceRoot).detectSpecTool();
|
|
799
800
|
if (detectedTool) print.success(`Detected ${SPEC_TOOL_INFO[detectedTool].name} in workspace`);
|
|
800
801
|
else print.info("No spec tool detected");
|
|
801
802
|
return detectedTool;
|
|
@@ -803,12 +804,12 @@ const initActors = {
|
|
|
803
804
|
promptSpecDrivenApproach: fromPromise(async ({ input: actorInput }) => {
|
|
804
805
|
if (actorInput.detectedSpecTool) {
|
|
805
806
|
print.divider();
|
|
806
|
-
const result
|
|
807
|
+
const result = await confirm({
|
|
807
808
|
message: `${SPEC_TOOL_INFO[actorInput.detectedSpecTool].name} is installed. Would you like to update the agent instructions for spec-driven development?`,
|
|
808
809
|
default: true
|
|
809
810
|
});
|
|
810
811
|
print.info("");
|
|
811
|
-
return result
|
|
812
|
+
return result;
|
|
812
813
|
}
|
|
813
814
|
print.divider();
|
|
814
815
|
const result = await confirm({
|
|
@@ -818,18 +819,18 @@ const initActors = {
|
|
|
818
819
|
print.info("");
|
|
819
820
|
return result;
|
|
820
821
|
}),
|
|
821
|
-
setupSpec: fromPromise(async ({ input
|
|
822
|
-
const codingAgentService = new CodingAgentService(input
|
|
823
|
-
const specToolService = new SpecToolService(input
|
|
824
|
-
if (input
|
|
822
|
+
setupSpec: fromPromise(async ({ input }) => {
|
|
823
|
+
const codingAgentService = new CodingAgentService(input.workspaceRoot);
|
|
824
|
+
const specToolService = new SpecToolService(input.workspaceRoot, SpecTool.OPENSPEC, codingAgentService);
|
|
825
|
+
if (input.isAlreadyInstalled) {
|
|
825
826
|
const spinner = ora("Updating OpenSpec agent instructions...").start();
|
|
826
827
|
try {
|
|
827
828
|
const enabledMcps = {
|
|
828
|
-
scaffoldMcp: input
|
|
829
|
-
architectMcp: input
|
|
830
|
-
projectType: input
|
|
829
|
+
scaffoldMcp: input.selectedMcpServers?.includes(MCPServer.SCAFFOLD) ?? false,
|
|
830
|
+
architectMcp: input.selectedMcpServers?.includes(MCPServer.ARCHITECT) ?? false,
|
|
831
|
+
projectType: input.projectType
|
|
831
832
|
};
|
|
832
|
-
await specToolService.updateInstructions(enabledMcps, input
|
|
833
|
+
await specToolService.updateInstructions(enabledMcps, input.codingAgent);
|
|
833
834
|
spinner.succeed("OpenSpec agent instructions updated");
|
|
834
835
|
} catch (error) {
|
|
835
836
|
spinner.fail("Failed to update OpenSpec instructions");
|
|
@@ -857,17 +858,17 @@ const initActors = {
|
|
|
857
858
|
print.info("");
|
|
858
859
|
return result;
|
|
859
860
|
}),
|
|
860
|
-
updateSpecInstructions: fromPromise(async ({ input
|
|
861
|
+
updateSpecInstructions: fromPromise(async ({ input }) => {
|
|
861
862
|
const spinner = ora("Updating OpenSpec agent instructions...").start();
|
|
862
863
|
try {
|
|
863
|
-
const codingAgentService = new CodingAgentService(input
|
|
864
|
-
const specToolService = new SpecToolService(input
|
|
864
|
+
const codingAgentService = new CodingAgentService(input.workspaceRoot);
|
|
865
|
+
const specToolService = new SpecToolService(input.workspaceRoot, SpecTool.OPENSPEC, codingAgentService);
|
|
865
866
|
const enabledMcps = {
|
|
866
|
-
scaffoldMcp: input
|
|
867
|
-
architectMcp: input
|
|
868
|
-
projectType: input
|
|
867
|
+
scaffoldMcp: input.selectedMcpServers?.includes(MCPServer.SCAFFOLD) ?? false,
|
|
868
|
+
architectMcp: input.selectedMcpServers?.includes(MCPServer.ARCHITECT) ?? false,
|
|
869
|
+
projectType: input.projectType
|
|
869
870
|
};
|
|
870
|
-
await specToolService.updateInstructions(enabledMcps, input
|
|
871
|
+
await specToolService.updateInstructions(enabledMcps, input.codingAgent);
|
|
871
872
|
spinner.succeed("OpenSpec agent instructions updated");
|
|
872
873
|
} catch (error) {
|
|
873
874
|
spinner.fail("Failed to update OpenSpec instructions");
|
|
@@ -875,11 +876,11 @@ const initActors = {
|
|
|
875
876
|
}
|
|
876
877
|
})
|
|
877
878
|
};
|
|
878
|
-
function resolveGeneratedSettingsValues(input
|
|
879
|
-
const resolvedTemplatesPath = input
|
|
879
|
+
function resolveGeneratedSettingsValues(input) {
|
|
880
|
+
const resolvedTemplatesPath = input.templatesPath ?? path.join(input.workspaceRoot, TemplatesManagerService.getTemplatesFolderName());
|
|
880
881
|
return {
|
|
881
|
-
relativeTemplatesPath: path.relative(input
|
|
882
|
-
sourceTemplate: input
|
|
882
|
+
relativeTemplatesPath: path.relative(input.workspaceRoot, resolvedTemplatesPath) || "templates",
|
|
883
|
+
sourceTemplate: input.selectedTemplates?.[0]
|
|
883
884
|
};
|
|
884
885
|
}
|
|
885
886
|
/**
|
|
@@ -909,16 +910,14 @@ const initCommand = new Command("init").description("Initialize project with tem
|
|
|
909
910
|
print.header("\nSetup Complete!");
|
|
910
911
|
if (templatesPath) print.info(`Templates location: ${templatesPath}`);
|
|
911
912
|
if (projectType) print.info(`Project type: ${projectType}`);
|
|
912
|
-
const gradient = await import("gradient-string");
|
|
913
913
|
print.newline();
|
|
914
|
-
|
|
914
|
+
displaySuccessMessage("🎉 Congratulations! Your project is ready to go!");
|
|
915
915
|
print.newline();
|
|
916
916
|
} catch (error) {
|
|
917
917
|
print.error(`\nError: ${error.message}`);
|
|
918
918
|
process.exit(1);
|
|
919
919
|
}
|
|
920
920
|
});
|
|
921
|
-
|
|
922
921
|
//#endregion
|
|
923
922
|
//#region src/commands/sync.ts
|
|
924
923
|
/**
|
|
@@ -964,10 +963,10 @@ function buildHookCommand(server, hookType, extraFlags) {
|
|
|
964
963
|
const serverArgs = server.args ?? [];
|
|
965
964
|
const scriptIdx = serverArgs.findIndex((arg) => /\.(ts|js|mjs|cjs)$/.test(arg));
|
|
966
965
|
if (scriptIdx >= 0) {
|
|
967
|
-
const prefixArgs
|
|
966
|
+
const prefixArgs = serverArgs.slice(0, scriptIdx + 1);
|
|
968
967
|
return [
|
|
969
968
|
server.command,
|
|
970
|
-
...prefixArgs
|
|
969
|
+
...prefixArgs,
|
|
971
970
|
"hook",
|
|
972
971
|
"--type",
|
|
973
972
|
hookType,
|
|
@@ -1075,12 +1074,13 @@ async function writeClaudeSettings(config, workspaceRoot) {
|
|
|
1075
1074
|
}
|
|
1076
1075
|
if (!hasAny) {
|
|
1077
1076
|
print.warning("No scaffold-mcp/architect-mcp hook.claude-code config found — skipping .claude/settings.json");
|
|
1078
|
-
return;
|
|
1077
|
+
return false;
|
|
1079
1078
|
}
|
|
1080
1079
|
const settings = { hooks: hooksOutput };
|
|
1081
1080
|
const claudeDir = path.join(workspaceRoot, CLAUDE_SETTINGS_DIR);
|
|
1082
1081
|
await mkdir$1(claudeDir, { recursive: true });
|
|
1083
1082
|
await writeFile$1(path.join(claudeDir, CLAUDE_SETTINGS_FILE), JSON.stringify(settings, null, 2), "utf-8");
|
|
1083
|
+
return true;
|
|
1084
1084
|
} catch (err) {
|
|
1085
1085
|
const message = err instanceof Error ? err.message : String(err);
|
|
1086
1086
|
throw new Error(`Failed to write ${CLAUDE_SETTINGS_DIR}/${CLAUDE_SETTINGS_FILE}: ${message}`);
|
|
@@ -1091,9 +1091,10 @@ async function writeMcpConfig(config, workspaceRoot) {
|
|
|
1091
1091
|
const mcpConfig = buildMcpConfigYaml(config);
|
|
1092
1092
|
if (!mcpConfig) {
|
|
1093
1093
|
print.warning("No mcp-config.servers or mcp-config.skills config found — skipping mcp-config.yaml");
|
|
1094
|
-
return;
|
|
1094
|
+
return false;
|
|
1095
1095
|
}
|
|
1096
1096
|
await writeFile$1(path.join(workspaceRoot, MCP_CONFIG_FILE), yaml.dump(mcpConfig, { indent: 2 }), "utf-8");
|
|
1097
|
+
return true;
|
|
1097
1098
|
} catch (err) {
|
|
1098
1099
|
const message = err instanceof Error ? err.message : String(err);
|
|
1099
1100
|
throw new Error(`Failed to write ${MCP_CONFIG_FILE}: ${message}`);
|
|
@@ -1109,12 +1110,10 @@ const syncCommand = new Command("sync").description("Generate .claude/settings.j
|
|
|
1109
1110
|
const shouldWriteHooks = options.hooks || !options.hooks && !options.mcp;
|
|
1110
1111
|
const shouldWriteMcp = options.mcp || !options.hooks && !options.mcp;
|
|
1111
1112
|
if (shouldWriteHooks) if (hasHookConfig(config)) {
|
|
1112
|
-
await writeClaudeSettings(config, workspaceRoot);
|
|
1113
|
-
print.success("Written .claude/settings.json");
|
|
1113
|
+
if (await writeClaudeSettings(config, workspaceRoot)) print.success("Written .claude/settings.json");
|
|
1114
1114
|
} else print.warning("No hook.claude-code config found in toolkit settings — skipping");
|
|
1115
1115
|
if (shouldWriteMcp) if (buildMcpConfigYaml(config)) {
|
|
1116
|
-
await writeMcpConfig(config, workspaceRoot);
|
|
1117
|
-
print.success("Written mcp-config.yaml");
|
|
1116
|
+
if (await writeMcpConfig(config, workspaceRoot)) print.success("Written mcp-config.yaml");
|
|
1118
1117
|
} else print.warning("No mcp-config.servers or mcp-config.skills config found — skipping mcp-config.yaml");
|
|
1119
1118
|
} catch (error) {
|
|
1120
1119
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -1122,7 +1121,6 @@ const syncCommand = new Command("sync").description("Generate .claude/settings.j
|
|
|
1122
1121
|
process.exit(1);
|
|
1123
1122
|
}
|
|
1124
1123
|
});
|
|
1125
|
-
|
|
1126
1124
|
//#endregion
|
|
1127
1125
|
//#region src/cli.ts
|
|
1128
1126
|
/**
|
|
@@ -1143,6 +1141,5 @@ async function main() {
|
|
|
1143
1141
|
}
|
|
1144
1142
|
}
|
|
1145
1143
|
main();
|
|
1146
|
-
|
|
1147
1144
|
//#endregion
|
|
1148
|
-
export {
|
|
1145
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
require(
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils = require("./utils-BdZqGo-L.cjs");
|
|
4
3
|
exports.BANNER_GRADIENT = require_utils.BANNER_GRADIENT;
|
|
5
4
|
exports.CodingAgentService = require_utils.CodingAgentService;
|
|
6
5
|
exports.NewProjectService = require_utils.NewProjectService;
|
|
@@ -8,4 +7,4 @@ exports.THEME = require_utils.THEME;
|
|
|
8
7
|
exports.TemplateSelectionService = require_utils.TemplateSelectionService;
|
|
9
8
|
exports.TemplatesService = require_utils.TemplatesService;
|
|
10
9
|
exports.displayBanner = require_utils.displayBanner;
|
|
11
|
-
exports.displayCompactBanner = require_utils.displayCompactBanner;
|
|
10
|
+
exports.displayCompactBanner = require_utils.displayCompactBanner;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CodingAgentId } from "@agiflowai/coding-agent-bridge";
|
|
2
2
|
import { ProjectType } from "@agiflowai/aicode-utils";
|
|
3
|
-
|
|
4
3
|
//#region src/constants/theme.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Theme color constants for AICode Toolkit
|
|
@@ -60,7 +59,6 @@ declare const THEME: {
|
|
|
60
59
|
declare const BANNER_GRADIENT: ("#10b981" | "#059669" | "#0d9488" | "#0f766e")[];
|
|
61
60
|
//#endregion
|
|
62
61
|
//#region src/services/CodingAgentService.d.ts
|
|
63
|
-
|
|
64
62
|
type CodingAgent = CodingAgentId;
|
|
65
63
|
declare class CodingAgentService {
|
|
66
64
|
private workspaceRoot;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CodingAgentId } from "@agiflowai/coding-agent-bridge";
|
|
2
2
|
import { ProjectType } from "@agiflowai/aicode-utils";
|
|
3
|
-
|
|
4
3
|
//#region src/constants/theme.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Theme color constants for AICode Toolkit
|
|
@@ -60,7 +59,6 @@ declare const THEME: {
|
|
|
60
59
|
declare const BANNER_GRADIENT: ("#10b981" | "#059669" | "#0d9488" | "#0f766e")[];
|
|
61
60
|
//#endregion
|
|
62
61
|
//#region src/services/CodingAgentService.d.ts
|
|
63
|
-
|
|
64
62
|
type CodingAgent = CodingAgentId;
|
|
65
63
|
declare class CodingAgentService {
|
|
66
64
|
private workspaceRoot;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, displayBanner, displayCompactBanner };
|
|
1
|
+
import { a as TemplateSelectionService, d as BANNER_GRADIENT, f as THEME, i as TemplatesService, l as NewProjectService, n as displayCompactBanner, t as displayBanner, u as CodingAgentService } from "./utils-re_0nbT6.mjs";
|
|
2
|
+
export { BANNER_GRADIENT, CodingAgentService, NewProjectService, THEME, TemplateSelectionService, TemplatesService, displayBanner, displayCompactBanner };
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
2
13
|
//#region src/constants/mcp.ts
|
|
14
|
+
var mcp_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
+
MCPServer: () => MCPServer,
|
|
16
|
+
MCP_CONFIG_FILES: () => MCP_CONFIG_FILES,
|
|
17
|
+
MCP_SERVER_INFO: () => MCP_SERVER_INFO
|
|
18
|
+
});
|
|
3
19
|
/**
|
|
4
20
|
* MCP (Model Context Protocol) Server Constants
|
|
5
21
|
*
|
|
@@ -14,11 +30,11 @@
|
|
|
14
30
|
/**
|
|
15
31
|
* Available MCP servers
|
|
16
32
|
*/
|
|
17
|
-
let MCPServer = /* @__PURE__ */ function(MCPServer
|
|
18
|
-
MCPServer
|
|
19
|
-
MCPServer
|
|
20
|
-
MCPServer
|
|
21
|
-
return MCPServer
|
|
33
|
+
let MCPServer = /* @__PURE__ */ function(MCPServer) {
|
|
34
|
+
MCPServer["ONE_MCP"] = "one-mcp";
|
|
35
|
+
MCPServer["ARCHITECT"] = "architect-mcp";
|
|
36
|
+
MCPServer["SCAFFOLD"] = "scaffold-mcp";
|
|
37
|
+
return MCPServer;
|
|
22
38
|
}({});
|
|
23
39
|
/**
|
|
24
40
|
* MCP server configuration files
|
|
@@ -50,23 +66,5 @@ const MCP_SERVER_INFO = {
|
|
|
50
66
|
description: "Project scaffolding, boilerplates, and feature generation"
|
|
51
67
|
}
|
|
52
68
|
};
|
|
53
|
-
|
|
54
69
|
//#endregion
|
|
55
|
-
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return MCPServer;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, 'MCP_CONFIG_FILES', {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () {
|
|
64
|
-
return MCP_CONFIG_FILES;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
Object.defineProperty(exports, 'MCP_SERVER_INFO', {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
get: function () {
|
|
70
|
-
return MCP_SERVER_INFO;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
70
|
+
export { MCP_SERVER_INFO as n, mcp_exports as r, MCPServer as t };
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
/**
|
|
14
14
|
* Available MCP servers
|
|
15
15
|
*/
|
|
16
|
-
let MCPServer = /* @__PURE__ */ function(MCPServer
|
|
17
|
-
MCPServer
|
|
18
|
-
MCPServer
|
|
19
|
-
MCPServer
|
|
20
|
-
return MCPServer
|
|
16
|
+
let MCPServer = /* @__PURE__ */ function(MCPServer) {
|
|
17
|
+
MCPServer["ONE_MCP"] = "one-mcp";
|
|
18
|
+
MCPServer["ARCHITECT"] = "architect-mcp";
|
|
19
|
+
MCPServer["SCAFFOLD"] = "scaffold-mcp";
|
|
20
|
+
return MCPServer;
|
|
21
21
|
}({});
|
|
22
22
|
/**
|
|
23
23
|
* MCP server configuration files
|
|
@@ -49,6 +49,22 @@ const MCP_SERVER_INFO = {
|
|
|
49
49
|
description: "Project scaffolding, boilerplates, and feature generation"
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
|
|
53
52
|
//#endregion
|
|
54
|
-
|
|
53
|
+
Object.defineProperty(exports, "MCPServer", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function() {
|
|
56
|
+
return MCPServer;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "MCP_CONFIG_FILES", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function() {
|
|
62
|
+
return MCP_CONFIG_FILES;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "MCP_SERVER_INFO", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function() {
|
|
68
|
+
return MCP_SERVER_INFO;
|
|
69
|
+
}
|
|
70
|
+
});
|