mason-context 0.3.1 → 0.3.3
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 +12 -11
- package/dist/bin/mason-mcp.js.map +1 -1
- package/dist/bin/mason.js +54 -24
- package/dist/bin/mason.js.map +1 -1
- package/dist/src/cli.js +54 -24
- package/dist/src/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/mason-mcp.js
CHANGED
|
@@ -115,7 +115,7 @@ import fs5 from "fs/promises";
|
|
|
115
115
|
import path5 from "path";
|
|
116
116
|
import { execFile as execFile7 } from "child_process";
|
|
117
117
|
import { promisify as promisify7 } from "util";
|
|
118
|
-
import
|
|
118
|
+
import fg5 from "fast-glob";
|
|
119
119
|
async function analyzeImpact(rootDir, targetFiles) {
|
|
120
120
|
const resolvedRoot = path5.resolve(rootDir);
|
|
121
121
|
const resolvedTargets = await resolveTargetFiles(resolvedRoot, targetFiles);
|
|
@@ -138,7 +138,7 @@ async function resolveTargetFiles(rootDir, targets) {
|
|
|
138
138
|
resolved.push(target);
|
|
139
139
|
continue;
|
|
140
140
|
}
|
|
141
|
-
const matches = await
|
|
141
|
+
const matches = await fg5(`**/${target}`, {
|
|
142
142
|
cwd: rootDir,
|
|
143
143
|
ignore: IGNORE2
|
|
144
144
|
});
|
|
@@ -146,7 +146,7 @@ async function resolveTargetFiles(rootDir, targets) {
|
|
|
146
146
|
resolved.push(matches[0]);
|
|
147
147
|
} else {
|
|
148
148
|
const noExt = target.replace(/\.[^.]+$/, "");
|
|
149
|
-
const extMatches = await
|
|
149
|
+
const extMatches = await fg5(`**/${noExt}.*`, {
|
|
150
150
|
cwd: rootDir,
|
|
151
151
|
ignore: IGNORE2
|
|
152
152
|
});
|
|
@@ -203,7 +203,7 @@ async function getReferences(rootDir, targetFiles) {
|
|
|
203
203
|
const basename = path5.basename(target).replace(/\.[^.]+$/, "");
|
|
204
204
|
searchNames.add(basename);
|
|
205
205
|
}
|
|
206
|
-
const allSourceFiles = await
|
|
206
|
+
const allSourceFiles = await fg5(`**/${SOURCE_EXTENSIONS2}`, {
|
|
207
207
|
cwd: rootDir,
|
|
208
208
|
ignore: IGNORE2
|
|
209
209
|
});
|
|
@@ -252,7 +252,7 @@ async function getRelatedTests(rootDir, targetFiles) {
|
|
|
252
252
|
"**/*Test.swift",
|
|
253
253
|
"**/*_test.rs"
|
|
254
254
|
];
|
|
255
|
-
const testFiles = await
|
|
255
|
+
const testFiles = await fg5(testPatterns, { cwd: rootDir, ignore: IGNORE2 });
|
|
256
256
|
const results = [];
|
|
257
257
|
for (const target of targetFiles) {
|
|
258
258
|
const targetBaseName = path5.basename(target).replace(/\.[^.]+$/, "");
|
|
@@ -304,7 +304,7 @@ import fs6 from "fs/promises";
|
|
|
304
304
|
import path6 from "path";
|
|
305
305
|
import { execFile as execFile8 } from "child_process";
|
|
306
306
|
import { promisify as promisify8 } from "util";
|
|
307
|
-
import
|
|
307
|
+
import fg6 from "fast-glob";
|
|
308
308
|
|
|
309
309
|
// src/analyzers/git-history.ts
|
|
310
310
|
import { execFile } from "child_process";
|
|
@@ -910,6 +910,7 @@ import fs4 from "fs/promises";
|
|
|
910
910
|
import path4 from "path";
|
|
911
911
|
import { execFile as execFile6 } from "child_process";
|
|
912
912
|
import { promisify as promisify6 } from "util";
|
|
913
|
+
import fg4 from "fast-glob";
|
|
913
914
|
init_test_map();
|
|
914
915
|
|
|
915
916
|
// src/llm/providers.ts
|
|
@@ -1061,7 +1062,7 @@ async function detectProjectSnapshot(rootDir) {
|
|
|
1061
1062
|
];
|
|
1062
1063
|
const testInfo = {};
|
|
1063
1064
|
for (const pattern of testDirs) {
|
|
1064
|
-
const files = await
|
|
1065
|
+
const files = await fg6(`${pattern}/**/*`, {
|
|
1065
1066
|
cwd: rootDir,
|
|
1066
1067
|
ignore: IGNORE3,
|
|
1067
1068
|
onlyFiles: true
|
|
@@ -1081,12 +1082,12 @@ async function detectProjectSnapshot(rootDir) {
|
|
|
1081
1082
|
{ pattern: "**/*_test.rs", label: "*_test.rs" }
|
|
1082
1083
|
];
|
|
1083
1084
|
for (const { pattern, label } of testFilePatterns) {
|
|
1084
|
-
const files = await
|
|
1085
|
+
const files = await fg6(pattern, { cwd: rootDir, ignore: IGNORE3 });
|
|
1085
1086
|
if (files.length > 0) {
|
|
1086
1087
|
testInfo[label] = files.length;
|
|
1087
1088
|
}
|
|
1088
1089
|
}
|
|
1089
|
-
const sourceFiles = await
|
|
1090
|
+
const sourceFiles = await fg6("**/*.{ts,tsx,js,jsx,kt,kts,java,py,go,rs,swift,rb,cs,cpp,c,dart}", {
|
|
1090
1091
|
cwd: rootDir,
|
|
1091
1092
|
ignore: IGNORE3
|
|
1092
1093
|
});
|
|
@@ -1119,7 +1120,7 @@ async function getCodeSamples(dir, count = 15) {
|
|
|
1119
1120
|
}
|
|
1120
1121
|
async function getProjectStructure(dir) {
|
|
1121
1122
|
const rootDir = path6.resolve(dir);
|
|
1122
|
-
const allFiles = await
|
|
1123
|
+
const allFiles = await fg6("**/*", {
|
|
1123
1124
|
cwd: rootDir,
|
|
1124
1125
|
ignore: IGNORE3,
|
|
1125
1126
|
onlyFiles: true
|
|
@@ -1269,7 +1270,7 @@ function createMcpServer() {
|
|
|
1269
1270
|
const server = new McpServer(
|
|
1270
1271
|
{
|
|
1271
1272
|
name: "mason",
|
|
1272
|
-
version: "0.3.
|
|
1273
|
+
version: "0.3.3"
|
|
1273
1274
|
},
|
|
1274
1275
|
{
|
|
1275
1276
|
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."
|