mason-context 0.3.0 → 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.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", reject);
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.0"
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."
@@ -2004,10 +2010,11 @@ function extractMarkdown(raw) {
2004
2010
  return trimmed;
2005
2011
  }
2006
2012
  function createCLI() {
2013
+ process.on("SIGINT", () => process.exit(130));
2007
2014
  const program2 = new Command();
2008
2015
  program2.name("mason").description(
2009
2016
  "Context engineering CLI & MCP server \u2014 generates intelligent CLAUDE.md files"
2010
- ).version("0.3.0");
2017
+ ).version("0.3.2");
2011
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) => {
2012
2019
  const { execFile: execFile9 } = await import("child_process");
2013
2020
  const { promisify: promisify9 } = await import("util");
@@ -2089,7 +2096,7 @@ function createCLI() {
2089
2096
  }
2090
2097
  const rootDir = path7.resolve(dir);
2091
2098
  const runConfig = opts.model ? { ...config, model: opts.model } : config;
2092
- const spinner = ora("Analyzing codebase...").start();
2099
+ const spinner = ora({ discardStdin: false, text: "Analyzing codebase..." }).start();
2093
2100
  const analysisData = await fullAnalysis(rootDir);
2094
2101
  spinner.text = `Generating CLAUDE.md with ${runConfig.provider}...`;
2095
2102
  try {
@@ -2124,7 +2131,7 @@ ${analysisData}`
2124
2131
  success(`Generated ${outPath}`);
2125
2132
  try {
2126
2133
  const { createSnapshot: createSnapshot2 } = await Promise.resolve().then(() => (init_snapshot(), snapshot_exports));
2127
- const spinner2 = ora("Building concept map...").start();
2134
+ const spinner2 = ora({ discardStdin: false, text: "Building concept map..." }).start();
2128
2135
  const snapshot = await createSnapshot2(rootDir, runConfig);
2129
2136
  spinner2.stop();
2130
2137
  const featureCount = Object.keys(snapshot.features).length;
@@ -2183,7 +2190,7 @@ ${analysisData}`
2183
2190
  );
2184
2191
  process.exit(1);
2185
2192
  }
2186
- const spinner = ora("Building project snapshot...").start();
2193
+ const spinner = ora({ discardStdin: false, text: "Building project snapshot..." }).start();
2187
2194
  try {
2188
2195
  const snapshot = await createSnapshot2(rootDir, config);
2189
2196
  spinner.stop();
@@ -2217,7 +2224,7 @@ ${analysisData}`
2217
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) => {
2218
2225
  const { analyzeImpact: analyzeImpact2 } = await Promise.resolve().then(() => (init_impact(), impact_exports));
2219
2226
  const rootDir = path7.resolve(opts.dir);
2220
- const spinner = ora("Analyzing impact...").start();
2227
+ const spinner = ora({ discardStdin: false, text: "Analyzing impact..." }).start();
2221
2228
  const result = await analyzeImpact2(rootDir, files);
2222
2229
  spinner.stop();
2223
2230
  console.log(chalk2.bold(`
@@ -2254,7 +2261,7 @@ Impact analysis for: ${result.targetFiles.join(", ")}
2254
2261
  });
2255
2262
  program2.command("analyze").description("Analyze the codebase and print findings").argument("[dir]", "Directory to analyze", ".").action(async (dir) => {
2256
2263
  const rootDir = path7.resolve(dir);
2257
- const spinner = ora("Analyzing codebase...").start();
2264
+ const spinner = ora({ discardStdin: false, text: "Analyzing codebase..." }).start();
2258
2265
  const context = await buildContext2(rootDir);
2259
2266
  const results = await runAll(context);
2260
2267
  spinner.stop();