@ulpi/codemap 0.3.12 → 0.3.13
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 +28 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5924,13 +5924,10 @@ function registerInit(program2) {
|
|
|
5924
5924
|
console.log(` ${chalk3.cyan("codemap search")} Search your code`);
|
|
5925
5925
|
console.log(` ${chalk3.cyan("codemap serve")} Start MCP server`);
|
|
5926
5926
|
console.log();
|
|
5927
|
-
|
|
5927
|
+
await showAgentSnippet(program2.opts().cwd || process.cwd());
|
|
5928
5928
|
});
|
|
5929
5929
|
}
|
|
5930
|
-
|
|
5931
|
-
console.log(chalk3.bold("Add to your CLAUDE.md / agents.md / rules:"));
|
|
5932
|
-
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
5933
|
-
console.log(`
|
|
5930
|
+
var AGENT_SNIPPET = `
|
|
5934
5931
|
## Code Intelligence (codemap)
|
|
5935
5932
|
|
|
5936
5933
|
This project is indexed with codemap for semantic code search,
|
|
@@ -5976,10 +5973,34 @@ symbol lookup, dependency analysis, and PageRank file ranking.
|
|
|
5976
5973
|
- **Understanding impact**: \`get_dependents\` to see what breaks if you change a file
|
|
5977
5974
|
- **Architecture review**: \`get_coupling_metrics\` and \`find_cycles\` for code health
|
|
5978
5975
|
- **Navigation**: \`get_file_rank\` to identify the most important files
|
|
5979
|
-
|
|
5976
|
+
- **Cross-project**: Any \`codemap-<name>\` MCP servers (e.g. \`codemap-frontend\`) are connected projects \u2014 use their tools to search and trace dependencies across your stack
|
|
5977
|
+
`.trim();
|
|
5978
|
+
async function showAgentSnippet(projectDir) {
|
|
5979
|
+
console.log(chalk3.bold("Agent configuration snippet:"));
|
|
5980
|
+
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
5981
|
+
console.log(AGENT_SNIPPET);
|
|
5980
5982
|
console.log();
|
|
5981
5983
|
console.log(chalk3.dim("\u2500".repeat(60)));
|
|
5982
|
-
|
|
5984
|
+
const claudeMdPath = path11.join(projectDir, "CLAUDE.md");
|
|
5985
|
+
const exists = fs13.existsSync(claudeMdPath);
|
|
5986
|
+
const prompt = exists ? `Append this to ${chalk3.cyan("CLAUDE.md")}? (Y/n): ` : `Create ${chalk3.cyan("CLAUDE.md")} with this content? (Y/n): `;
|
|
5987
|
+
const answer = await ask(prompt);
|
|
5988
|
+
if (answer.toLowerCase() !== "n") {
|
|
5989
|
+
if (exists) {
|
|
5990
|
+
const current = fs13.readFileSync(claudeMdPath, "utf-8");
|
|
5991
|
+
if (current.includes("## Code Intelligence (codemap)")) {
|
|
5992
|
+
console.log(chalk3.yellow("CLAUDE.md already contains a codemap section. Skipping."));
|
|
5993
|
+
} else {
|
|
5994
|
+
fs13.appendFileSync(claudeMdPath, "\n\n" + AGENT_SNIPPET + "\n");
|
|
5995
|
+
console.log(chalk3.green("Appended to ") + chalk3.cyan("CLAUDE.md"));
|
|
5996
|
+
}
|
|
5997
|
+
} else {
|
|
5998
|
+
fs13.writeFileSync(claudeMdPath, AGENT_SNIPPET + "\n");
|
|
5999
|
+
console.log(chalk3.green("Created ") + chalk3.cyan("CLAUDE.md"));
|
|
6000
|
+
}
|
|
6001
|
+
} else {
|
|
6002
|
+
console.log(chalk3.dim("Skipped. You can copy the snippet above manually."));
|
|
6003
|
+
}
|
|
5983
6004
|
console.log();
|
|
5984
6005
|
console.log(chalk3.bold("Multi-project setup"));
|
|
5985
6006
|
console.log();
|