mason-context 0.3.4 → 0.3.6
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/README.md +8 -0
- package/dist/bin/mason-mcp.js +14 -1
- package/dist/bin/mason-mcp.js.map +1 -1
- package/dist/bin/mason.js +15 -2
- package/dist/bin/mason.js.map +1 -1
- package/dist/src/cli.js +15 -2
- package/dist/src/cli.js.map +1 -1
- package/package.json +2 -1
package/dist/src/cli.js
CHANGED
|
@@ -1789,10 +1789,23 @@ async function fullAnalysis(dir) {
|
|
|
1789
1789
|
}
|
|
1790
1790
|
return JSON.stringify(output, null, 2);
|
|
1791
1791
|
}
|
|
1792
|
+
function sanitizePaths(rootDir, files) {
|
|
1793
|
+
return files.filter((f) => {
|
|
1794
|
+
const resolved = path6.resolve(rootDir, f);
|
|
1795
|
+
return resolved.startsWith(rootDir) && !f.startsWith("/") && !f.includes("..");
|
|
1796
|
+
});
|
|
1797
|
+
}
|
|
1792
1798
|
async function saveSnapshotData(dir, features, flows) {
|
|
1793
1799
|
const rootDir = path6.resolve(dir);
|
|
1794
1800
|
const gitHash = await getCurrentGitHash(rootDir);
|
|
1795
1801
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1802
|
+
for (const feat of Object.values(features)) {
|
|
1803
|
+
feat.files = sanitizePaths(rootDir, feat.files);
|
|
1804
|
+
if (feat.tests) feat.tests = sanitizePaths(rootDir, feat.tests);
|
|
1805
|
+
}
|
|
1806
|
+
for (const flow of Object.values(flows)) {
|
|
1807
|
+
flow.chain = sanitizePaths(rootDir, flow.chain);
|
|
1808
|
+
}
|
|
1796
1809
|
const existing = await loadSnapshot(rootDir);
|
|
1797
1810
|
if (existing) {
|
|
1798
1811
|
existing.features = { ...existing.features, ...features };
|
|
@@ -1866,7 +1879,7 @@ function createMcpServer() {
|
|
|
1866
1879
|
const server = new McpServer(
|
|
1867
1880
|
{
|
|
1868
1881
|
name: "mason",
|
|
1869
|
-
version: "0.3.
|
|
1882
|
+
version: "0.3.6"
|
|
1870
1883
|
},
|
|
1871
1884
|
{
|
|
1872
1885
|
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."
|
|
@@ -2051,7 +2064,7 @@ function createCLI() {
|
|
|
2051
2064
|
const program = new Command();
|
|
2052
2065
|
program.name("mason").description(
|
|
2053
2066
|
"Context engineering CLI & MCP server \u2014 generates intelligent CLAUDE.md files"
|
|
2054
|
-
).version("0.3.
|
|
2067
|
+
).version("0.3.6");
|
|
2055
2068
|
program.command("setup").description("Register Mason as an MCP server with Claude Code").option("--scope <scope>", "Config scope: user or project", "user").action(async (opts) => {
|
|
2056
2069
|
const { execFile: execFile9 } = await import("child_process");
|
|
2057
2070
|
const { promisify: promisify9 } = await import("util");
|