@insforge/install 0.0.42 → 0.0.43
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/index.js +33 -35
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -236,55 +236,53 @@ import {
|
|
|
236
236
|
writeConfig(config, argv.client);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
// Fetch instructions documentation
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const response = await fetch(`${apiBaseUrl}/api/docs/instructions`);
|
|
239
|
+
// Fetch instructions documentation and save to appropriate files
|
|
240
|
+
let instructionsContent = null;
|
|
241
|
+
try {
|
|
242
|
+
const fetch = (await import('node-fetch')).default;
|
|
243
|
+
const fs = await import('fs');
|
|
244
|
+
const apiBaseUrl = envVars.API_BASE_URL || "http://localhost:7130";
|
|
245
|
+
const response = await fetch(`${apiBaseUrl}/api/docs/instructions`);
|
|
247
246
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
247
|
+
if (response.ok) {
|
|
248
|
+
const result = await response.json();
|
|
249
|
+
if (result && result.content) {
|
|
250
|
+
instructionsContent = result.content;
|
|
253
251
|
}
|
|
254
|
-
} catch (fetchError) {
|
|
255
|
-
logger.warn(`Could not download instructions: ${fetchError.message}`);
|
|
256
252
|
}
|
|
253
|
+
} catch (fetchError) {
|
|
254
|
+
logger.warn(`Could not download instructions: ${fetchError.message}`);
|
|
255
|
+
}
|
|
257
256
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
// Save instructions to appropriate files based on client
|
|
258
|
+
if (instructionsContent) {
|
|
259
|
+
const fs = await import('fs');
|
|
260
|
+
const frontmatter = `---
|
|
262
261
|
description: Instructions building apps with MCP
|
|
263
262
|
globs: *
|
|
264
263
|
alwaysApply: true
|
|
265
264
|
---
|
|
266
265
|
|
|
267
266
|
`;
|
|
268
|
-
|
|
267
|
+
const contentWithFrontmatter = frontmatter + instructionsContent;
|
|
269
268
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
269
|
+
// Save CLAUDE.md for claude-code client
|
|
270
|
+
if (argv.client === "claude-code") {
|
|
271
|
+
const claudeMdPath = path.join(process.cwd(), 'CLAUDE.md');
|
|
272
|
+
fs.writeFileSync(claudeMdPath, contentWithFrontmatter, 'utf-8');
|
|
273
|
+
logger.info(`Saved instructions to: ${claudeMdPath}`);
|
|
274
|
+
}
|
|
276
275
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
276
|
+
// Save cursor rules for cursor client
|
|
277
|
+
if (argv.client === "cursor") {
|
|
278
|
+
const cursorRulesDir = path.join(process.cwd(), '.cursor', 'rules');
|
|
279
|
+
const cursorRulesPath = path.join(cursorRulesDir, 'cursor-rules.mdc');
|
|
281
280
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
fs.writeFileSync(cursorRulesPath, contentWithFrontmatter, 'utf-8');
|
|
286
|
-
logger.info(`Saved cursor rules to: ${cursorRulesPath}`);
|
|
281
|
+
if (!fs.existsSync(cursorRulesDir)) {
|
|
282
|
+
fs.mkdirSync(cursorRulesDir, { recursive: true });
|
|
287
283
|
}
|
|
284
|
+
fs.writeFileSync(cursorRulesPath, contentWithFrontmatter, 'utf-8');
|
|
285
|
+
logger.info(`Saved cursor rules to: ${cursorRulesPath}`);
|
|
288
286
|
}
|
|
289
287
|
}
|
|
290
288
|
|