mason-context 0.3.1 → 0.3.2
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/mason-mcp.js +1 -1
- package/dist/bin/mason-mcp.js.map +1 -1
- package/dist/bin/mason.js +14 -8
- package/dist/bin/mason.js.map +1 -1
- package/dist/src/cli.js +14 -8
- package/dist/src/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/mason.js
CHANGED
|
@@ -378,6 +378,8 @@ function spawnWithStdin(command, args, input) {
|
|
|
378
378
|
stdio: ["pipe", "pipe", "pipe"],
|
|
379
379
|
timeout: 3e5
|
|
380
380
|
});
|
|
381
|
+
const onSigint = () => proc.kill("SIGINT");
|
|
382
|
+
process.on("SIGINT", onSigint);
|
|
381
383
|
let stdout = "";
|
|
382
384
|
let stderr = "";
|
|
383
385
|
proc.stdout.on("data", (data) => {
|
|
@@ -387,13 +389,17 @@ function spawnWithStdin(command, args, input) {
|
|
|
387
389
|
stderr += data.toString();
|
|
388
390
|
});
|
|
389
391
|
proc.on("close", (code) => {
|
|
392
|
+
process.off("SIGINT", onSigint);
|
|
390
393
|
if (code === 0) {
|
|
391
394
|
resolve(stdout.trim());
|
|
392
395
|
} else {
|
|
393
396
|
reject(new Error(`${command} exited with code ${code}: ${stderr}`));
|
|
394
397
|
}
|
|
395
398
|
});
|
|
396
|
-
proc.on("error",
|
|
399
|
+
proc.on("error", (err) => {
|
|
400
|
+
process.off("SIGINT", onSigint);
|
|
401
|
+
reject(err);
|
|
402
|
+
});
|
|
397
403
|
proc.stdin.write(input);
|
|
398
404
|
proc.stdin.end();
|
|
399
405
|
});
|
|
@@ -1823,7 +1829,7 @@ function createMcpServer() {
|
|
|
1823
1829
|
const server = new McpServer(
|
|
1824
1830
|
{
|
|
1825
1831
|
name: "mason",
|
|
1826
|
-
version: "0.3.
|
|
1832
|
+
version: "0.3.2"
|
|
1827
1833
|
},
|
|
1828
1834
|
{
|
|
1829
1835
|
instructions: "Mason is a context engineering tool. Always call get_snapshot before using Explore agents, Glob, or Grep to understand the codebase. The snapshot is a concept map that maps features and flows to their implementing files \u2014 it eliminates the need to search. This applies to ANY question about architecture, features, flows, how things work, cross-feature interactions, or bug investigation. Workflow: 1) Call get_snapshot first. 2) If no snapshot, call full_analysis and then save_snapshot to create one. 3) If the snapshot is stale, tell the user and offer to update it. 4) Use your native file reading tool to read files the snapshot points to. 5) Before modifying a file, call get_impact to check what else might be affected. 6) After making significant changes (new features, refactors, architecture changes), call save_snapshot to update the concept map."
|
|
@@ -2008,7 +2014,7 @@ function createCLI() {
|
|
|
2008
2014
|
const program2 = new Command();
|
|
2009
2015
|
program2.name("mason").description(
|
|
2010
2016
|
"Context engineering CLI & MCP server \u2014 generates intelligent CLAUDE.md files"
|
|
2011
|
-
).version("0.3.
|
|
2017
|
+
).version("0.3.2");
|
|
2012
2018
|
program2.command("setup").description("Register Mason as an MCP server with Claude Code").option("--scope <scope>", "Config scope: user or project", "user").action(async (opts) => {
|
|
2013
2019
|
const { execFile: execFile9 } = await import("child_process");
|
|
2014
2020
|
const { promisify: promisify9 } = await import("util");
|
|
@@ -2090,7 +2096,7 @@ function createCLI() {
|
|
|
2090
2096
|
}
|
|
2091
2097
|
const rootDir = path7.resolve(dir);
|
|
2092
2098
|
const runConfig = opts.model ? { ...config, model: opts.model } : config;
|
|
2093
|
-
const spinner = ora("Analyzing codebase...").start();
|
|
2099
|
+
const spinner = ora({ discardStdin: false, text: "Analyzing codebase..." }).start();
|
|
2094
2100
|
const analysisData = await fullAnalysis(rootDir);
|
|
2095
2101
|
spinner.text = `Generating CLAUDE.md with ${runConfig.provider}...`;
|
|
2096
2102
|
try {
|
|
@@ -2125,7 +2131,7 @@ ${analysisData}`
|
|
|
2125
2131
|
success(`Generated ${outPath}`);
|
|
2126
2132
|
try {
|
|
2127
2133
|
const { createSnapshot: createSnapshot2 } = await Promise.resolve().then(() => (init_snapshot(), snapshot_exports));
|
|
2128
|
-
const spinner2 = ora("Building concept map...").start();
|
|
2134
|
+
const spinner2 = ora({ discardStdin: false, text: "Building concept map..." }).start();
|
|
2129
2135
|
const snapshot = await createSnapshot2(rootDir, runConfig);
|
|
2130
2136
|
spinner2.stop();
|
|
2131
2137
|
const featureCount = Object.keys(snapshot.features).length;
|
|
@@ -2184,7 +2190,7 @@ ${analysisData}`
|
|
|
2184
2190
|
);
|
|
2185
2191
|
process.exit(1);
|
|
2186
2192
|
}
|
|
2187
|
-
const spinner = ora("Building project snapshot...").start();
|
|
2193
|
+
const spinner = ora({ discardStdin: false, text: "Building project snapshot..." }).start();
|
|
2188
2194
|
try {
|
|
2189
2195
|
const snapshot = await createSnapshot2(rootDir, config);
|
|
2190
2196
|
spinner.stop();
|
|
@@ -2218,7 +2224,7 @@ ${analysisData}`
|
|
|
2218
2224
|
program2.command("impact").description("Show files affected by changes to a given file").argument("<files...>", "File paths or names to analyze").option("-d, --dir <dir>", "Project directory", ".").action(async (files, opts) => {
|
|
2219
2225
|
const { analyzeImpact: analyzeImpact2 } = await Promise.resolve().then(() => (init_impact(), impact_exports));
|
|
2220
2226
|
const rootDir = path7.resolve(opts.dir);
|
|
2221
|
-
const spinner = ora("Analyzing impact...").start();
|
|
2227
|
+
const spinner = ora({ discardStdin: false, text: "Analyzing impact..." }).start();
|
|
2222
2228
|
const result = await analyzeImpact2(rootDir, files);
|
|
2223
2229
|
spinner.stop();
|
|
2224
2230
|
console.log(chalk2.bold(`
|
|
@@ -2255,7 +2261,7 @@ Impact analysis for: ${result.targetFiles.join(", ")}
|
|
|
2255
2261
|
});
|
|
2256
2262
|
program2.command("analyze").description("Analyze the codebase and print findings").argument("[dir]", "Directory to analyze", ".").action(async (dir) => {
|
|
2257
2263
|
const rootDir = path7.resolve(dir);
|
|
2258
|
-
const spinner = ora("Analyzing codebase...").start();
|
|
2264
|
+
const spinner = ora({ discardStdin: false, text: "Analyzing codebase..." }).start();
|
|
2259
2265
|
const context = await buildContext2(rootDir);
|
|
2260
2266
|
const results = await runAll(context);
|
|
2261
2267
|
spinner.stop();
|