ninja-terminals 2.4.3 → 2.4.4
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/cli.js +22 -12
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -92,7 +92,10 @@ if (hasFlag('--setup')) {
|
|
|
92
92
|
fs.writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
93
93
|
console.log(`✅ Added ninja-terminals to ${mcpPath}`);
|
|
94
94
|
|
|
95
|
-
// 3. Copy orchestrator prompt to CLAUDE.md
|
|
95
|
+
// 3. Copy orchestrator prompt to CLAUDE.md in the current directory.
|
|
96
|
+
// Wrapped in try/catch: running from a protected dir (e.g. an Admin shell
|
|
97
|
+
// sitting in C:\Windows\System32) makes this write fail with EPERM. Warn
|
|
98
|
+
// and guide instead of crashing — .mcp.json is already configured.
|
|
96
99
|
const claudeMd = path.join(process.cwd(), 'CLAUDE.md');
|
|
97
100
|
const orchestratorPrompt = path.join(npmRoot, 'ORCHESTRATOR-PROMPT.md');
|
|
98
101
|
|
|
@@ -100,19 +103,26 @@ if (hasFlag('--setup')) {
|
|
|
100
103
|
const prompt = fs.readFileSync(orchestratorPrompt, 'utf-8');
|
|
101
104
|
const marker = '<!-- NINJA TERMINALS ORCHESTRATOR -->';
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
try {
|
|
107
|
+
let claudeContent = '';
|
|
108
|
+
if (fs.existsSync(claudeMd)) {
|
|
109
|
+
claudeContent = fs.readFileSync(claudeMd, 'utf-8');
|
|
110
|
+
if (claudeContent.includes(marker)) {
|
|
111
|
+
console.log(`✅ Orchestrator prompt already in CLAUDE.md`);
|
|
112
|
+
} else {
|
|
113
|
+
fs.writeFileSync(claudeMd, claudeContent + `\n\n${marker}\n${prompt}`);
|
|
114
|
+
console.log(`✅ Added orchestrator prompt to ${claudeMd}`);
|
|
115
|
+
}
|
|
108
116
|
} else {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
console.log(`✅ Added orchestrator prompt to CLAUDE.md`);
|
|
117
|
+
fs.writeFileSync(claudeMd, `${marker}\n${prompt}`);
|
|
118
|
+
console.log(`✅ Created ${claudeMd}`);
|
|
112
119
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
console.log(
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.log(`⚠️ Couldn't write CLAUDE.md in ${process.cwd()} (${e.code || e.message}).`);
|
|
122
|
+
console.log(` This usually means you're in a protected folder (e.g. C:\\Windows\\System32).`);
|
|
123
|
+
console.log(` Re-run setup from your project folder, e.g.:`);
|
|
124
|
+
console.log(` cd <your-project> && npx ninja-terminals --setup`);
|
|
125
|
+
console.log(` (.mcp.json is already configured, so MCP tools will still load.)`);
|
|
116
126
|
}
|
|
117
127
|
}
|
|
118
128
|
|
package/package.json
CHANGED