@infinitedusky/indusk-mcp 0.1.0 → 0.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/bin/cli.js +3 -2
- package/dist/bin/commands/init.d.ts +4 -1
- package/dist/bin/commands/init.js +18 -15
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -13,9 +13,10 @@ program
|
|
|
13
13
|
program
|
|
14
14
|
.command("init")
|
|
15
15
|
.description("Initialize a project with InDusk dev system")
|
|
16
|
-
.
|
|
16
|
+
.option("-f, --force", "Overwrite existing files (except CLAUDE.md and planning/)")
|
|
17
|
+
.action(async (opts) => {
|
|
17
18
|
const { init } = await import("./commands/init.js");
|
|
18
|
-
await init(process.cwd());
|
|
19
|
+
await init(process.cwd(), { force: opts.force ?? false });
|
|
19
20
|
});
|
|
20
21
|
program
|
|
21
22
|
.command("update")
|
|
@@ -70,9 +70,10 @@ function createCgcIgnore(projectRoot) {
|
|
|
70
70
|
].join("\n"));
|
|
71
71
|
console.info(" create: .cgcignore");
|
|
72
72
|
}
|
|
73
|
-
export async function init(projectRoot) {
|
|
73
|
+
export async function init(projectRoot, options = {}) {
|
|
74
|
+
const { force = false } = options;
|
|
74
75
|
const projectName = basename(projectRoot);
|
|
75
|
-
console.info(
|
|
76
|
+
console.info(`Initializing InDusk dev system...${force ? " (--force)" : ""}\n`);
|
|
76
77
|
// 1. Copy skills
|
|
77
78
|
console.info("[Skills]");
|
|
78
79
|
const skillsSource = join(packageRoot, "skills");
|
|
@@ -82,19 +83,21 @@ export async function init(projectRoot) {
|
|
|
82
83
|
const skillName = file.replace(".md", "");
|
|
83
84
|
const targetDir = join(skillsTarget, skillName);
|
|
84
85
|
const targetFile = join(targetDir, "SKILL.md");
|
|
85
|
-
if (existsSync(targetFile)) {
|
|
86
|
+
if (existsSync(targetFile) && !force) {
|
|
86
87
|
console.info(` skip: .claude/skills/${skillName}/SKILL.md (already exists)`);
|
|
87
88
|
continue;
|
|
88
89
|
}
|
|
89
90
|
mkdirSync(targetDir, { recursive: true });
|
|
90
91
|
cpSync(join(skillsSource, file), targetFile);
|
|
91
|
-
console.info(` create: .claude/skills/${skillName}/SKILL.md`);
|
|
92
|
+
console.info(` ${existsSync(targetFile) ? "overwrite" : "create"}: .claude/skills/${skillName}/SKILL.md`);
|
|
92
93
|
}
|
|
93
|
-
// 2. Create CLAUDE.md
|
|
94
|
+
// 2. Create CLAUDE.md (never overwrite — write CLAUDE-NEW.md if exists)
|
|
94
95
|
console.info("\n[Project files]");
|
|
95
96
|
const claudeMdPath = join(projectRoot, "CLAUDE.md");
|
|
96
97
|
if (existsSync(claudeMdPath)) {
|
|
97
|
-
|
|
98
|
+
const newPath = join(projectRoot, "CLAUDE-NEW.md");
|
|
99
|
+
cpSync(join(packageRoot, "templates/CLAUDE.md"), newPath);
|
|
100
|
+
console.info(" create: CLAUDE-NEW.md (merge manually with existing CLAUDE.md)");
|
|
98
101
|
}
|
|
99
102
|
else {
|
|
100
103
|
cpSync(join(packageRoot, "templates/CLAUDE.md"), claudeMdPath);
|
|
@@ -131,17 +134,17 @@ export async function init(projectRoot) {
|
|
|
131
134
|
const existing = JSON.parse(readFileSync(mcpJsonPath, "utf-8"));
|
|
132
135
|
let updated = false;
|
|
133
136
|
existing.mcpServers = existing.mcpServers || {};
|
|
134
|
-
if (!existing.mcpServers.indusk) {
|
|
137
|
+
if (!existing.mcpServers.indusk || force) {
|
|
135
138
|
existing.mcpServers.indusk = induskEntry;
|
|
136
|
-
console.info("
|
|
139
|
+
console.info(` ${existing.mcpServers.indusk ? "overwrite" : "add"}: .mcp.json indusk entry`);
|
|
137
140
|
updated = true;
|
|
138
141
|
}
|
|
139
142
|
else {
|
|
140
143
|
console.info(" skip: .mcp.json indusk entry (already exists)");
|
|
141
144
|
}
|
|
142
|
-
if (!existing.mcpServers.codegraphcontext) {
|
|
145
|
+
if (!existing.mcpServers.codegraphcontext || force) {
|
|
143
146
|
existing.mcpServers.codegraphcontext = cgcEntry;
|
|
144
|
-
console.info(`
|
|
147
|
+
console.info(` ${existing.mcpServers.codegraphcontext ? "overwrite" : "add"}: .mcp.json codegraphcontext (graph: ${projectName})`);
|
|
145
148
|
updated = true;
|
|
146
149
|
}
|
|
147
150
|
else {
|
|
@@ -164,24 +167,24 @@ export async function init(projectRoot) {
|
|
|
164
167
|
// 5. Generate .vscode/settings.json
|
|
165
168
|
console.info("\n[Editor]");
|
|
166
169
|
const vscodePath = join(projectRoot, ".vscode/settings.json");
|
|
167
|
-
if (existsSync(vscodePath)) {
|
|
170
|
+
if (existsSync(vscodePath) && !force) {
|
|
168
171
|
console.info(" skip: .vscode/settings.json (already exists)");
|
|
169
172
|
}
|
|
170
173
|
else {
|
|
171
174
|
mkdirSync(join(projectRoot, ".vscode"), { recursive: true });
|
|
172
175
|
cpSync(join(packageRoot, "templates/vscode-settings.json"), vscodePath);
|
|
173
|
-
console.info("
|
|
176
|
+
console.info(` ${existsSync(vscodePath) ? "overwrite" : "create"}: .vscode/settings.json`);
|
|
174
177
|
}
|
|
175
178
|
// 6. Create base biome.json
|
|
176
179
|
const biomePath = join(projectRoot, "biome.json");
|
|
177
|
-
if (existsSync(biomePath)) {
|
|
180
|
+
if (existsSync(biomePath) && !force) {
|
|
178
181
|
console.info(" skip: biome.json (already exists)");
|
|
179
182
|
}
|
|
180
183
|
else {
|
|
181
184
|
cpSync(join(packageRoot, "templates/biome.template.json"), biomePath);
|
|
182
|
-
console.info("
|
|
185
|
+
console.info(` ${existsSync(biomePath) ? "overwrite" : "create"}: biome.json`);
|
|
183
186
|
}
|
|
184
|
-
// 7. Create .cgcignore
|
|
187
|
+
// 7. Create .cgcignore (always overwrite — package-owned)
|
|
185
188
|
createCgcIgnore(projectRoot);
|
|
186
189
|
// 8. Infrastructure: FalkorDB + CGC
|
|
187
190
|
console.info("\n[Infrastructure]");
|