airband 0.0.1 → 0.0.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/README.md +1 -1
- package/airband-hook.js +152 -54
- package/airband-mcp.js +104 -96
- package/airband.js +273 -219
- package/package.json +1 -1
package/airband-mcp.js
CHANGED
|
@@ -3301,8 +3301,8 @@ var require_utils = __commonJS({
|
|
|
3301
3301
|
}
|
|
3302
3302
|
return ind;
|
|
3303
3303
|
}
|
|
3304
|
-
function removeDotSegments(
|
|
3305
|
-
let input2 =
|
|
3304
|
+
function removeDotSegments(path13) {
|
|
3305
|
+
let input2 = path13;
|
|
3306
3306
|
const output2 = [];
|
|
3307
3307
|
let nextSlash = -1;
|
|
3308
3308
|
let len = 0;
|
|
@@ -3712,8 +3712,8 @@ var require_schemes = __commonJS({
|
|
|
3712
3712
|
}
|
|
3713
3713
|
if (wsComponent.resourceName) {
|
|
3714
3714
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
3715
|
-
const
|
|
3716
|
-
wsComponent.path =
|
|
3715
|
+
const path13 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
3716
|
+
wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
|
|
3717
3717
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
3718
3718
|
wsComponent.resourceName = void 0;
|
|
3719
3719
|
}
|
|
@@ -7272,12 +7272,12 @@ var require_dist = __commonJS({
|
|
|
7272
7272
|
throw new Error(`Unknown format "${name2}"`);
|
|
7273
7273
|
return f;
|
|
7274
7274
|
};
|
|
7275
|
-
function addFormats(ajv, list,
|
|
7275
|
+
function addFormats(ajv, list, fs17, exportName) {
|
|
7276
7276
|
var _a3;
|
|
7277
7277
|
var _b;
|
|
7278
7278
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
7279
7279
|
for (const f of list)
|
|
7280
|
-
ajv.addFormat(f,
|
|
7280
|
+
ajv.addFormat(f, fs17[f]);
|
|
7281
7281
|
}
|
|
7282
7282
|
module2.exports = exports2 = formatsPlugin;
|
|
7283
7283
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -9375,11 +9375,11 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
9375
9375
|
throw toThrow;
|
|
9376
9376
|
}, "quit_");
|
|
9377
9377
|
var scriptDirectory = "";
|
|
9378
|
-
function locateFile(
|
|
9378
|
+
function locateFile(path13) {
|
|
9379
9379
|
if (Module["locateFile"]) {
|
|
9380
|
-
return Module["locateFile"](
|
|
9380
|
+
return Module["locateFile"](path13, scriptDirectory);
|
|
9381
9381
|
}
|
|
9382
|
-
return scriptDirectory +
|
|
9382
|
+
return scriptDirectory + path13;
|
|
9383
9383
|
}
|
|
9384
9384
|
__name(locateFile, "locateFile");
|
|
9385
9385
|
var readAsync, readBinary;
|
|
@@ -11336,8 +11336,8 @@ ${JSON.stringify(symbolNames, null, 2)}`);
|
|
|
11336
11336
|
|
|
11337
11337
|
// src/mcp/server.ts
|
|
11338
11338
|
init_define_AIRBAND_GRAMMARS();
|
|
11339
|
-
var
|
|
11340
|
-
var
|
|
11339
|
+
var fs16 = __toESM(require("node:fs"));
|
|
11340
|
+
var path12 = __toESM(require("node:path"));
|
|
11341
11341
|
|
|
11342
11342
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
11343
11343
|
init_define_AIRBAND_GRAMMARS();
|
|
@@ -11736,8 +11736,8 @@ function getErrorMap() {
|
|
|
11736
11736
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
11737
11737
|
init_define_AIRBAND_GRAMMARS();
|
|
11738
11738
|
var makeIssue = (params) => {
|
|
11739
|
-
const { data, path:
|
|
11740
|
-
const fullPath2 = [...
|
|
11739
|
+
const { data, path: path13, errorMaps, issueData } = params;
|
|
11740
|
+
const fullPath2 = [...path13, ...issueData.path || []];
|
|
11741
11741
|
const fullIssue = {
|
|
11742
11742
|
...issueData,
|
|
11743
11743
|
path: fullPath2
|
|
@@ -11856,11 +11856,11 @@ var errorUtil;
|
|
|
11856
11856
|
|
|
11857
11857
|
// node_modules/zod/v3/types.js
|
|
11858
11858
|
var ParseInputLazyPath = class {
|
|
11859
|
-
constructor(parent, value,
|
|
11859
|
+
constructor(parent, value, path13, key2) {
|
|
11860
11860
|
this._cachedPath = [];
|
|
11861
11861
|
this.parent = parent;
|
|
11862
11862
|
this.data = value;
|
|
11863
|
-
this._path =
|
|
11863
|
+
this._path = path13;
|
|
11864
11864
|
this._key = key2;
|
|
11865
11865
|
}
|
|
11866
11866
|
get path() {
|
|
@@ -15823,10 +15823,10 @@ function mergeDefs(...defs) {
|
|
|
15823
15823
|
function cloneDef(schema) {
|
|
15824
15824
|
return mergeDefs(schema._zod.def);
|
|
15825
15825
|
}
|
|
15826
|
-
function getElementAtPath(obj,
|
|
15827
|
-
if (!
|
|
15826
|
+
function getElementAtPath(obj, path13) {
|
|
15827
|
+
if (!path13)
|
|
15828
15828
|
return obj;
|
|
15829
|
-
return
|
|
15829
|
+
return path13.reduce((acc, key2) => acc?.[key2], obj);
|
|
15830
15830
|
}
|
|
15831
15831
|
function promiseAllObject(promisesObj) {
|
|
15832
15832
|
const keys = Object.keys(promisesObj);
|
|
@@ -16166,11 +16166,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
16166
16166
|
}
|
|
16167
16167
|
return false;
|
|
16168
16168
|
}
|
|
16169
|
-
function prefixIssues(
|
|
16169
|
+
function prefixIssues(path13, issues) {
|
|
16170
16170
|
return issues.map((iss) => {
|
|
16171
16171
|
var _a3;
|
|
16172
16172
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
16173
|
-
iss.path.unshift(
|
|
16173
|
+
iss.path.unshift(path13);
|
|
16174
16174
|
return iss;
|
|
16175
16175
|
});
|
|
16176
16176
|
}
|
|
@@ -16636,16 +16636,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
|
|
|
16636
16636
|
}
|
|
16637
16637
|
function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
16638
16638
|
const fieldErrors = { _errors: [] };
|
|
16639
|
-
const processError = (error63,
|
|
16639
|
+
const processError = (error63, path13 = []) => {
|
|
16640
16640
|
for (const issue2 of error63.issues) {
|
|
16641
16641
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16642
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16642
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
16643
16643
|
} else if (issue2.code === "invalid_key") {
|
|
16644
|
-
processError({ issues: issue2.issues }, [...
|
|
16644
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
16645
16645
|
} else if (issue2.code === "invalid_element") {
|
|
16646
|
-
processError({ issues: issue2.issues }, [...
|
|
16646
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
16647
16647
|
} else {
|
|
16648
|
-
const fullpath = [...
|
|
16648
|
+
const fullpath = [...path13, ...issue2.path];
|
|
16649
16649
|
if (fullpath.length === 0) {
|
|
16650
16650
|
fieldErrors._errors.push(mapper(issue2));
|
|
16651
16651
|
} else {
|
|
@@ -16684,17 +16684,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
|
|
|
16684
16684
|
}
|
|
16685
16685
|
function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
16686
16686
|
const result = { errors: [] };
|
|
16687
|
-
const processError = (error63,
|
|
16687
|
+
const processError = (error63, path13 = []) => {
|
|
16688
16688
|
var _a3;
|
|
16689
16689
|
for (const issue2 of error63.issues) {
|
|
16690
16690
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
16691
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
16691
|
+
issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
|
|
16692
16692
|
} else if (issue2.code === "invalid_key") {
|
|
16693
|
-
processError({ issues: issue2.issues }, [...
|
|
16693
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
16694
16694
|
} else if (issue2.code === "invalid_element") {
|
|
16695
|
-
processError({ issues: issue2.issues }, [...
|
|
16695
|
+
processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
|
|
16696
16696
|
} else {
|
|
16697
|
-
const fullpath = [...
|
|
16697
|
+
const fullpath = [...path13, ...issue2.path];
|
|
16698
16698
|
if (fullpath.length === 0) {
|
|
16699
16699
|
result.errors.push(mapper(issue2));
|
|
16700
16700
|
continue;
|
|
@@ -16733,8 +16733,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
|
|
|
16733
16733
|
}
|
|
16734
16734
|
function toDotPath(_path) {
|
|
16735
16735
|
const segs = [];
|
|
16736
|
-
const
|
|
16737
|
-
for (const seg of
|
|
16736
|
+
const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
16737
|
+
for (const seg of path13) {
|
|
16738
16738
|
if (typeof seg === "number")
|
|
16739
16739
|
segs.push(`[${seg}]`);
|
|
16740
16740
|
else if (typeof seg === "symbol")
|
|
@@ -32375,11 +32375,11 @@ function normalizeObjectSchema(schema) {
|
|
|
32375
32375
|
}
|
|
32376
32376
|
return void 0;
|
|
32377
32377
|
}
|
|
32378
|
-
function getDotPath(
|
|
32379
|
-
if (
|
|
32378
|
+
function getDotPath(path13) {
|
|
32379
|
+
if (path13.length === 0) {
|
|
32380
32380
|
return "object root";
|
|
32381
32381
|
}
|
|
32382
|
-
return
|
|
32382
|
+
return path13.reduce((acc, seg, index) => {
|
|
32383
32383
|
if (index === 0) {
|
|
32384
32384
|
return String(seg);
|
|
32385
32385
|
}
|
|
@@ -34621,13 +34621,13 @@ function resolveRef(ref, ctx) {
|
|
|
34621
34621
|
if (!ref.startsWith("#")) {
|
|
34622
34622
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
34623
34623
|
}
|
|
34624
|
-
const
|
|
34625
|
-
if (
|
|
34624
|
+
const path13 = ref.slice(1).split("/").filter(Boolean);
|
|
34625
|
+
if (path13.length === 0) {
|
|
34626
34626
|
return ctx.rootSchema;
|
|
34627
34627
|
}
|
|
34628
34628
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
34629
|
-
if (
|
|
34630
|
-
const key2 =
|
|
34629
|
+
if (path13[0] === defsKey) {
|
|
34630
|
+
const key2 = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
|
|
34631
34631
|
if (!key2 || !ctx.defs[key2]) {
|
|
34632
34632
|
throw new Error(`Reference not found: ${ref}`);
|
|
34633
34633
|
}
|
|
@@ -41656,8 +41656,8 @@ function exchangeText(id, n, max = 2e4) {
|
|
|
41656
41656
|
|
|
41657
41657
|
// src/codemap/index.ts
|
|
41658
41658
|
init_define_AIRBAND_GRAMMARS();
|
|
41659
|
-
var
|
|
41660
|
-
var
|
|
41659
|
+
var fs13 = __toESM(require("node:fs"));
|
|
41660
|
+
var path10 = __toESM(require("node:path"));
|
|
41661
41661
|
|
|
41662
41662
|
// src/codemap/extract.ts
|
|
41663
41663
|
init_define_AIRBAND_GRAMMARS();
|
|
@@ -41911,8 +41911,8 @@ var TABLES = {
|
|
|
41911
41911
|
if (f?.type === "identifier") return [void 0, f.text];
|
|
41912
41912
|
if (f?.type === "scoped_identifier") {
|
|
41913
41913
|
const name2 = field(f, "name")?.text;
|
|
41914
|
-
const
|
|
41915
|
-
if (
|
|
41914
|
+
const path13 = field(f, "path")?.text.split("::").pop();
|
|
41915
|
+
if (path13 && /^[A-Z]\w*$/.test(path13)) return [void 0, path13];
|
|
41916
41916
|
if (name2) return [void 0, name2];
|
|
41917
41917
|
}
|
|
41918
41918
|
}
|
|
@@ -43561,12 +43561,17 @@ function makeResolver(root2, files) {
|
|
|
43561
43561
|
|
|
43562
43562
|
// src/codemap/store.ts
|
|
43563
43563
|
init_define_AIRBAND_GRAMMARS();
|
|
43564
|
+
var crypto5 = __toESM(require("node:crypto"));
|
|
43565
|
+
var fs12 = __toESM(require("node:fs"));
|
|
43566
|
+
var path9 = __toESM(require("node:path"));
|
|
43567
|
+
var zlib = __toESM(require("node:zlib"));
|
|
43568
|
+
var import_node_child_process = require("node:child_process");
|
|
43569
|
+
|
|
43570
|
+
// src/codemap/where.ts
|
|
43571
|
+
init_define_AIRBAND_GRAMMARS();
|
|
43564
43572
|
var crypto4 = __toESM(require("node:crypto"));
|
|
43565
43573
|
var fs11 = __toESM(require("node:fs"));
|
|
43566
43574
|
var path8 = __toESM(require("node:path"));
|
|
43567
|
-
var zlib = __toESM(require("node:zlib"));
|
|
43568
|
-
var import_node_child_process = require("node:child_process");
|
|
43569
|
-
var STORE_VERSION = 1;
|
|
43570
43575
|
function folderId(root2) {
|
|
43571
43576
|
let real = root2;
|
|
43572
43577
|
try {
|
|
@@ -43579,14 +43584,17 @@ function folderId(root2) {
|
|
|
43579
43584
|
function storeDir(root2) {
|
|
43580
43585
|
return airbandFile("codemap", folderId(root2));
|
|
43581
43586
|
}
|
|
43582
|
-
|
|
43583
|
-
|
|
43587
|
+
|
|
43588
|
+
// src/codemap/store.ts
|
|
43589
|
+
var STORE_VERSION = 1;
|
|
43590
|
+
var filesPath = (root2) => path9.join(storeDir(root2), "files.jsonl.gz");
|
|
43591
|
+
var metaPath = (root2) => path9.join(storeDir(root2), "meta.json");
|
|
43584
43592
|
function loadEntries(root2) {
|
|
43585
43593
|
const out2 = /* @__PURE__ */ new Map();
|
|
43586
43594
|
try {
|
|
43587
|
-
const meta3 = JSON.parse(
|
|
43595
|
+
const meta3 = JSON.parse(fs12.readFileSync(metaPath(root2), "utf8"));
|
|
43588
43596
|
if (meta3.v !== STORE_VERSION) return out2;
|
|
43589
|
-
const text2 = zlib.gunzipSync(
|
|
43597
|
+
const text2 = zlib.gunzipSync(fs12.readFileSync(filesPath(root2))).toString("utf8");
|
|
43590
43598
|
for (const line of text2.split("\n")) {
|
|
43591
43599
|
if (!line) continue;
|
|
43592
43600
|
try {
|
|
@@ -43607,24 +43615,24 @@ function saveEntries(root2, entries) {
|
|
|
43607
43615
|
files++;
|
|
43608
43616
|
}
|
|
43609
43617
|
const gz = zlib.gzipSync(lines.join("\n"), { level: 6 });
|
|
43610
|
-
|
|
43618
|
+
fs12.mkdirSync(storeDir(root2), { recursive: true });
|
|
43611
43619
|
const tmp = `${filesPath(root2)}.${process.pid}.${Date.now()}.tmp`;
|
|
43612
|
-
|
|
43613
|
-
|
|
43620
|
+
fs12.writeFileSync(tmp, gz);
|
|
43621
|
+
fs12.renameSync(tmp, filesPath(root2));
|
|
43614
43622
|
const meta3 = { v: STORE_VERSION, root: root2, builtAt: Date.now(), files, bytes: gz.length };
|
|
43615
43623
|
writeFileAtomic(metaPath(root2), JSON.stringify(meta3));
|
|
43616
43624
|
return meta3;
|
|
43617
43625
|
}
|
|
43618
43626
|
function readMeta(root2) {
|
|
43619
43627
|
try {
|
|
43620
|
-
const meta3 = JSON.parse(
|
|
43628
|
+
const meta3 = JSON.parse(fs12.readFileSync(metaPath(root2), "utf8"));
|
|
43621
43629
|
return meta3.v === STORE_VERSION ? meta3 : void 0;
|
|
43622
43630
|
} catch {
|
|
43623
43631
|
return void 0;
|
|
43624
43632
|
}
|
|
43625
43633
|
}
|
|
43626
43634
|
function contentHash(text2) {
|
|
43627
|
-
return
|
|
43635
|
+
return crypto5.createHash("sha1").update(text2).digest("hex").slice(0, 16);
|
|
43628
43636
|
}
|
|
43629
43637
|
var SKIP_DIR = /(^|\/)(node_modules|\.git|\.next|\.nuxt|\.svelte-kit|\.turbo|\.vercel|\.cache|dist|build|out|out-test|coverage|vendor|venv|\.venv|env|__pycache__|\.mypy_cache|\.pytest_cache|\.tox|site-packages|bower_components|\.airband|\.context|\.claude|\.codex|\.gemini|storybook-static|playwright-report|test-results)(\/|$)/;
|
|
43630
43638
|
var SKIP_FILE = /(\.min\.(js|mjs|cjs)|\.bundle\.js|\.chunk\.js|-lock\.json|\.map|\.generated\.(ts|js)|\.gen\.(ts|js)|_pb2(_grpc)?\.py)$/;
|
|
@@ -43647,14 +43655,14 @@ async function listFiles(root2) {
|
|
|
43647
43655
|
if (depth > 20 || out2.length > 5e4) return;
|
|
43648
43656
|
let items;
|
|
43649
43657
|
try {
|
|
43650
|
-
items =
|
|
43658
|
+
items = fs12.readdirSync(dir2, { withFileTypes: true });
|
|
43651
43659
|
} catch {
|
|
43652
43660
|
return;
|
|
43653
43661
|
}
|
|
43654
43662
|
for (const it of items) {
|
|
43655
43663
|
const r = rel ? `${rel}/${it.name}` : it.name;
|
|
43656
43664
|
if (it.isDirectory()) {
|
|
43657
|
-
if (!SKIP_DIR.test(`${r}/`) && !it.name.startsWith(".")) walk(
|
|
43665
|
+
if (!SKIP_DIR.test(`${r}/`) && !it.name.startsWith(".")) walk(path9.join(dir2, it.name), r, depth + 1);
|
|
43658
43666
|
} else if (it.isFile() && mappable(r)) out2.push(r);
|
|
43659
43667
|
}
|
|
43660
43668
|
};
|
|
@@ -43731,7 +43739,7 @@ var CodeMap = class {
|
|
|
43731
43739
|
nameExists(name2) {
|
|
43732
43740
|
this.load();
|
|
43733
43741
|
const rel = name2.replace(/^\.\//, "");
|
|
43734
|
-
if (this.files.has(rel) ||
|
|
43742
|
+
if (this.files.has(rel) || fs13.existsSync(path10.join(this.root, rel))) return true;
|
|
43735
43743
|
for (const f of this.files.values()) if (f.d.some((d) => d.n === name2)) return true;
|
|
43736
43744
|
return false;
|
|
43737
43745
|
}
|
|
@@ -43782,7 +43790,7 @@ var CodeMap = class {
|
|
|
43782
43790
|
let removed = 0;
|
|
43783
43791
|
const listing = full || !this.files.size || Date.now() - this.lastListed > LIST_EVERY_MS || this.foldersChanged();
|
|
43784
43792
|
if (changed && !full) {
|
|
43785
|
-
paths = changed.map((p) => (
|
|
43793
|
+
paths = changed.map((p) => (path10.isAbsolute(p) ? path10.relative(this.root, p) : p).split(path10.sep).join("/")).filter((p) => !p.startsWith(".."));
|
|
43786
43794
|
} else if (listing) {
|
|
43787
43795
|
paths = await listFiles(this.root);
|
|
43788
43796
|
this.lastListed = Date.now();
|
|
@@ -43803,10 +43811,10 @@ var CodeMap = class {
|
|
|
43803
43811
|
let lastYield = Date.now();
|
|
43804
43812
|
for (const p of paths) {
|
|
43805
43813
|
if (!langOf(p)) continue;
|
|
43806
|
-
const abs =
|
|
43814
|
+
const abs = path10.join(this.root, p);
|
|
43807
43815
|
let st;
|
|
43808
43816
|
try {
|
|
43809
|
-
st =
|
|
43817
|
+
st = fs13.lstatSync(abs);
|
|
43810
43818
|
} catch {
|
|
43811
43819
|
if (this.files.delete(p)) removed++;
|
|
43812
43820
|
continue;
|
|
@@ -43819,7 +43827,7 @@ var CodeMap = class {
|
|
|
43819
43827
|
if (prev && prev.z === st.size && prev.m === Math.floor(st.mtimeMs)) continue;
|
|
43820
43828
|
let text2;
|
|
43821
43829
|
try {
|
|
43822
|
-
text2 =
|
|
43830
|
+
text2 = fs13.readFileSync(abs, "utf8");
|
|
43823
43831
|
} catch {
|
|
43824
43832
|
continue;
|
|
43825
43833
|
}
|
|
@@ -43856,15 +43864,15 @@ var CodeMap = class {
|
|
|
43856
43864
|
this.dirTimes.clear();
|
|
43857
43865
|
const dirs = /* @__PURE__ */ new Set([""]);
|
|
43858
43866
|
for (const p of paths) {
|
|
43859
|
-
let d =
|
|
43867
|
+
let d = path10.posix.dirname(p);
|
|
43860
43868
|
while (d !== "." && !dirs.has(d)) {
|
|
43861
43869
|
dirs.add(d);
|
|
43862
|
-
d =
|
|
43870
|
+
d = path10.posix.dirname(d);
|
|
43863
43871
|
}
|
|
43864
43872
|
}
|
|
43865
43873
|
for (const d of dirs) {
|
|
43866
43874
|
try {
|
|
43867
|
-
this.dirTimes.set(d,
|
|
43875
|
+
this.dirTimes.set(d, fs13.statSync(path10.join(this.root, d)).mtimeMs);
|
|
43868
43876
|
} catch {
|
|
43869
43877
|
}
|
|
43870
43878
|
}
|
|
@@ -43874,7 +43882,7 @@ var CodeMap = class {
|
|
|
43874
43882
|
if (!this.dirTimes.size) return false;
|
|
43875
43883
|
for (const [d, t] of this.dirTimes) {
|
|
43876
43884
|
try {
|
|
43877
|
-
if (
|
|
43885
|
+
if (fs13.statSync(path10.join(this.root, d)).mtimeMs !== t) return true;
|
|
43878
43886
|
} catch {
|
|
43879
43887
|
return true;
|
|
43880
43888
|
}
|
|
@@ -43887,7 +43895,7 @@ var CodeMap = class {
|
|
|
43887
43895
|
const rank = graph.rank;
|
|
43888
43896
|
const near = /* @__PURE__ */ new Set();
|
|
43889
43897
|
for (const f of focus ?? []) {
|
|
43890
|
-
const rel =
|
|
43898
|
+
const rel = path10.isAbsolute(f) ? path10.relative(this.root, f).split(path10.sep).join("/") : f;
|
|
43891
43899
|
if (!this.files.has(rel)) continue;
|
|
43892
43900
|
near.add(rel);
|
|
43893
43901
|
for (const t of graph.imports.get(rel) ?? []) near.add(t);
|
|
@@ -43943,7 +43951,7 @@ var CodeMap = class {
|
|
|
43943
43951
|
outline(target, budget = 600) {
|
|
43944
43952
|
this.load();
|
|
43945
43953
|
const t = target.trim().replace(/^\.\//, "").replace(/\/$/, "");
|
|
43946
|
-
const rel =
|
|
43954
|
+
const rel = path10.isAbsolute(t) ? path10.relative(this.root, t).split(path10.sep).join("/") : t;
|
|
43947
43955
|
const file2 = this.files.get(rel);
|
|
43948
43956
|
if (file2) return this.fileOutline(file2, budget);
|
|
43949
43957
|
const prefix = rel === "" || rel === "." ? "" : `${rel}/`;
|
|
@@ -43963,7 +43971,7 @@ var CodeMap = class {
|
|
|
43963
43971
|
}
|
|
43964
43972
|
signature(file2, d) {
|
|
43965
43973
|
try {
|
|
43966
|
-
const text2 =
|
|
43974
|
+
const text2 = fs13.readFileSync(path10.join(this.root, file2.p), "utf8");
|
|
43967
43975
|
const lines = text2.split("\n").slice(d.s - 1, Math.min(d.e, d.s + 3));
|
|
43968
43976
|
let sig = "";
|
|
43969
43977
|
for (const l of lines) {
|
|
@@ -44011,7 +44019,7 @@ var CodeMap = class {
|
|
|
44011
44019
|
}
|
|
44012
44020
|
const rank = (f) => this.graph.rank.get(f.p) ?? 0;
|
|
44013
44021
|
const out2 = [`${prefix || "./"} ${files.length} files`];
|
|
44014
|
-
const mod = this.modules().find((m) => `${m.id}/` === prefix) ?? (prefix &&
|
|
44022
|
+
const mod = this.modules().find((m) => `${m.id}/` === prefix) ?? (prefix && fs13.existsSync(docPath(this.root, prefix.slice(0, -1))) ? this.moduleOrFolder(prefix.slice(0, -1)) : void 0);
|
|
44015
44023
|
let doc;
|
|
44016
44024
|
if (mod) {
|
|
44017
44025
|
if (mod.dependsOn.length) out2.push(`uses: ${mod.dependsOn.join(", ")}`);
|
|
@@ -44115,15 +44123,15 @@ ${edgeLines(uses, "to", 10)}`);
|
|
|
44115
44123
|
overview(budget = 500) {
|
|
44116
44124
|
this.load();
|
|
44117
44125
|
const out2 = [];
|
|
44118
|
-
const pkg = readJsonFile(
|
|
44126
|
+
const pkg = readJsonFile(path10.join(this.root, "package.json"));
|
|
44119
44127
|
if (pkg?.scripts) {
|
|
44120
44128
|
const keep = Object.keys(pkg.scripts).filter((s) => /^(dev|start|build|test|lint|typecheck|check|e2e|format)(:|$)/.test(s)).slice(0, 8);
|
|
44121
44129
|
if (keep.length) out2.push(`commands: ${keep.map((s) => `npm run ${s}`).join(" \xB7 ")}`);
|
|
44122
44130
|
}
|
|
44123
|
-
if (
|
|
44124
|
-
if (
|
|
44131
|
+
if (fs13.existsSync(path10.join(this.root, "pyproject.toml"))) out2.push("python: pyproject.toml");
|
|
44132
|
+
if (fs13.existsSync(path10.join(this.root, "Makefile"))) {
|
|
44125
44133
|
try {
|
|
44126
|
-
const targets = [...
|
|
44134
|
+
const targets = [...fs13.readFileSync(path10.join(this.root, "Makefile"), "utf8").matchAll(/^([a-zA-Z][\w-]*):/gm)].map((m) => m[1]).slice(0, 8);
|
|
44127
44135
|
if (targets.length) out2.push(`make: ${targets.join(" \xB7 ")}`);
|
|
44128
44136
|
} catch {
|
|
44129
44137
|
}
|
|
@@ -44189,7 +44197,7 @@ ${conv.map((c) => ` ${c}`).join("\n")}`);
|
|
|
44189
44197
|
for (const f of this.files.values()) {
|
|
44190
44198
|
let text2;
|
|
44191
44199
|
try {
|
|
44192
|
-
text2 =
|
|
44200
|
+
text2 = fs13.readFileSync(path10.join(this.root, f.p), "utf8");
|
|
44193
44201
|
} catch {
|
|
44194
44202
|
continue;
|
|
44195
44203
|
}
|
|
@@ -44227,7 +44235,7 @@ ${conv.map((c) => ` ${c}`).join("\n")}`);
|
|
|
44227
44235
|
};
|
|
44228
44236
|
function readJsonFile(file2) {
|
|
44229
44237
|
try {
|
|
44230
|
-
return JSON.parse(
|
|
44238
|
+
return JSON.parse(fs13.readFileSync(file2, "utf8"));
|
|
44231
44239
|
} catch {
|
|
44232
44240
|
return void 0;
|
|
44233
44241
|
}
|
|
@@ -44272,7 +44280,7 @@ function clip2(text2, budget) {
|
|
|
44272
44280
|
|
|
44273
44281
|
// src/core/tokens.ts
|
|
44274
44282
|
init_define_AIRBAND_GRAMMARS();
|
|
44275
|
-
var
|
|
44283
|
+
var fs14 = __toESM(require("node:fs"));
|
|
44276
44284
|
var SEARCH_CMD = /^\s*(cd [^&;]+(&&|;)\s*)?(grep|rg|ag|ack|find|fd|ls|tree|git (grep|ls-files))\b/;
|
|
44277
44285
|
var READ_CMD = /^\s*(cd [^&;]+(&&|;)\s*)?(cat|head|tail|sed -n|less|bat|nl|wc|git (show|log|diff|blame))\b/;
|
|
44278
44286
|
var tokensOf2 = (chars) => Math.round(chars / 4);
|
|
@@ -44295,14 +44303,14 @@ function resultText(content) {
|
|
|
44295
44303
|
return "";
|
|
44296
44304
|
}
|
|
44297
44305
|
function eachLine(file2, fn, maxBytes = 512 * 1024 * 1024) {
|
|
44298
|
-
const fd =
|
|
44306
|
+
const fd = fs14.openSync(file2, "r");
|
|
44299
44307
|
try {
|
|
44300
|
-
const size = Math.min(
|
|
44308
|
+
const size = Math.min(fs14.fstatSync(fd).size, maxBytes);
|
|
44301
44309
|
const chunk = Buffer.alloc(4 * 1024 * 1024);
|
|
44302
44310
|
let pos = 0;
|
|
44303
44311
|
let rest = Buffer.alloc(0);
|
|
44304
44312
|
while (pos < size) {
|
|
44305
|
-
const n =
|
|
44313
|
+
const n = fs14.readSync(fd, chunk, 0, Math.min(chunk.length, size - pos), pos);
|
|
44306
44314
|
if (n <= 0) break;
|
|
44307
44315
|
pos += n;
|
|
44308
44316
|
let buf = Buffer.concat([rest, chunk.subarray(0, n)]);
|
|
@@ -44316,7 +44324,7 @@ function eachLine(file2, fn, maxBytes = 512 * 1024 * 1024) {
|
|
|
44316
44324
|
}
|
|
44317
44325
|
if (rest.length) fn(rest.toString("utf8"));
|
|
44318
44326
|
} finally {
|
|
44319
|
-
|
|
44327
|
+
fs14.closeSync(fd);
|
|
44320
44328
|
}
|
|
44321
44329
|
}
|
|
44322
44330
|
function tokenReport(tool, file2) {
|
|
@@ -44346,13 +44354,13 @@ function tokenReport(tool, file2) {
|
|
|
44346
44354
|
pt.tokens += t;
|
|
44347
44355
|
pt.calls++;
|
|
44348
44356
|
perTool.set(name2, pt);
|
|
44349
|
-
const
|
|
44350
|
-
if (call && typeof
|
|
44351
|
-
const rd = reads.get(
|
|
44357
|
+
const path13 = call && (call.input.file_path ?? call.input.absolute_path ?? call.input.path);
|
|
44358
|
+
if (call && typeof path13 === "string" && /^(Read|read_file)$/.test(name2)) {
|
|
44359
|
+
const rd = reads.get(path13) ?? { times: 0, tokens: 0, whole: 0 };
|
|
44352
44360
|
rd.times++;
|
|
44353
44361
|
rd.tokens += t;
|
|
44354
44362
|
if (!call.input.offset && !call.input.limit) rd.whole = Math.max(rd.whole, t);
|
|
44355
|
-
reads.set(
|
|
44363
|
+
reads.set(path13, rd);
|
|
44356
44364
|
}
|
|
44357
44365
|
};
|
|
44358
44366
|
eachLine(file2, (line) => {
|
|
@@ -44448,8 +44456,8 @@ function renderTokenReport(r, name2) {
|
|
|
44448
44456
|
|
|
44449
44457
|
// src/library/index.ts
|
|
44450
44458
|
init_define_AIRBAND_GRAMMARS();
|
|
44451
|
-
var
|
|
44452
|
-
var
|
|
44459
|
+
var fs15 = __toESM(require("node:fs"));
|
|
44460
|
+
var path11 = __toESM(require("node:path"));
|
|
44453
44461
|
|
|
44454
44462
|
// src/library/content/ci.md
|
|
44455
44463
|
var ci_default = "---\nname: ci\ntitle: Fix CI\npack: engineering\ndescription: Find why a CI run or deployment failed from its logs, and fix the cause rather than the symptom.\nargs: run = Failing run, PR or job (default: the latest failing run on this branch)\ntriggers: ci failing, fix ci, failing checks, github actions, pipeline failed, build failed, deploy failed, make ci green\n---\nFix the failure in {{run}}.\n\n1. **Read the failure first:** `gh run list --branch <branch> --limit 5`, then `gh run view <id> --log-failed`. Find the first real error, not the last line.\n2. **Reproduce locally** with the same command the job runs (read the workflow file for it). If it passes locally, compare versions, environment variables, caches and the files CI checks out.\n3. **Classify:** our code broke \xB7 a test is wrong or flaky (prove which: run it ten times) \xB7 environment or dependency changed \xB7 the workflow itself.\n4. **Fix the cause.** Never skip, retry-until-green, or loosen a check to get past it; if a check is truly wrong, say so and change it in its own commit with the reason.\n5. Run the same command again and show it passing. Ask before pushing.\n\nReport: the cause in one line, the fix, and how you verified it.\n";
|
|
@@ -44679,16 +44687,16 @@ function userCommands() {
|
|
|
44679
44687
|
const read = (d, depth) => {
|
|
44680
44688
|
let items;
|
|
44681
44689
|
try {
|
|
44682
|
-
items =
|
|
44690
|
+
items = fs15.readdirSync(d, { withFileTypes: true });
|
|
44683
44691
|
} catch {
|
|
44684
44692
|
return;
|
|
44685
44693
|
}
|
|
44686
44694
|
for (const it of items) {
|
|
44687
|
-
const p =
|
|
44695
|
+
const p = path11.join(d, it.name);
|
|
44688
44696
|
if (it.isDirectory() && depth < 1) read(p, depth + 1);
|
|
44689
44697
|
else if (it.isFile() && it.name.endsWith(".md")) {
|
|
44690
44698
|
try {
|
|
44691
|
-
const c = parseCommand(
|
|
44699
|
+
const c = parseCommand(fs15.readFileSync(p, "utf8"), p);
|
|
44692
44700
|
if (c && c.description !== STARTER_DESCRIPTION) out2.push(c);
|
|
44693
44701
|
} catch {
|
|
44694
44702
|
}
|
|
@@ -44722,7 +44730,7 @@ var INSTRUCTIONS = [
|
|
|
44722
44730
|
"- When the person refers to earlier work or another chat (what was done, which chat changed something, what happened while they were away), call airband_flightlog: with query to search every chat, or with chat to read one.",
|
|
44723
44731
|
"- airband_notes holds notes chats left for this project; read them before working in an unfamiliar area, and save one when you learn something the next chat should know."
|
|
44724
44732
|
].join("\n");
|
|
44725
|
-
var server = new McpServer({ name: "airband", version: "0.0.
|
|
44733
|
+
var server = new McpServer({ name: "airband", version: "0.0.2" }, { instructions: INSTRUCTIONS });
|
|
44726
44734
|
var text = (t, isError = false) => ({ content: [{ type: "text", text: t }], ...isError ? { isError } : {} });
|
|
44727
44735
|
var codeMap = new CodeMap(root);
|
|
44728
44736
|
var lastSweep = 0;
|
|
@@ -44806,7 +44814,7 @@ server.registerTool(
|
|
|
44806
44814
|
if (!chat) {
|
|
44807
44815
|
const heads = listHeads().slice(0, 25);
|
|
44808
44816
|
return text(
|
|
44809
|
-
heads.length ? heads.map((h2) => `${nameOf(h2)} \xB7 ${h2.cwd ?
|
|
44817
|
+
heads.length ? heads.map((h2) => `${nameOf(h2)} \xB7 ${h2.cwd ? path12.basename(h2.cwd) : "?"} \xB7 ${h2.n} asks \xB7 ${when(h2.updatedAt)} \xB7 id ${h2.id.slice(0, 8)}`).join("\n") : "No flightlogs yet. Airband starts one for each chat as it replies."
|
|
44810
44818
|
);
|
|
44811
44819
|
}
|
|
44812
44820
|
const found = findRecords(chat);
|
|
@@ -44816,7 +44824,7 @@ server.registerTool(
|
|
|
44816
44824
|
return words2 ? text(words2) : text(`No ask #${n} in a flightlog matching "${chat}".`, true);
|
|
44817
44825
|
}
|
|
44818
44826
|
if (found.length > 1 && !found.some((h2) => h2.id === chat)) {
|
|
44819
|
-
const list = found.slice(0, 10).map((h2) => `${nameOf(h2)} \xB7 ${h2.cwd ?
|
|
44827
|
+
const list = found.slice(0, 10).map((h2) => `${nameOf(h2)} \xB7 ${h2.cwd ? path12.basename(h2.cwd) : "?"} \xB7 ${h2.n} asks \xB7 id ${h2.id.slice(0, 8)}`);
|
|
44820
44828
|
if (found.length > 10) list.push(`\u2026 ${found.length - 10} more`);
|
|
44821
44829
|
return text(`Several chats match; name one by id:
|
|
44822
44830
|
${list.join("\n")}`);
|
|
@@ -44851,7 +44859,7 @@ async function recall(query2) {
|
|
|
44851
44859
|
try {
|
|
44852
44860
|
const map2 = await freshMap();
|
|
44853
44861
|
const hits = map2.findHits(query2).filter((h) => h.score > 20).slice(0, 3);
|
|
44854
|
-
files = new Set(hits.map((h) =>
|
|
44862
|
+
files = new Set(hits.map((h) => path12.join(root, h.doc.file.p)));
|
|
44855
44863
|
} catch {
|
|
44856
44864
|
}
|
|
44857
44865
|
const found = [];
|
|
@@ -44937,9 +44945,9 @@ setInterval(() => {
|
|
|
44937
44945
|
let stamp = "";
|
|
44938
44946
|
try {
|
|
44939
44947
|
const dir2 = userLibraryDir();
|
|
44940
|
-
for (const f of
|
|
44948
|
+
for (const f of fs16.readdirSync(dir2, { recursive: true })) {
|
|
44941
44949
|
if (!f.endsWith(".md")) continue;
|
|
44942
|
-
const st =
|
|
44950
|
+
const st = fs16.statSync(path12.join(dir2, f));
|
|
44943
44951
|
stamp += `${f}:${st.mtimeMs}:${st.size};`;
|
|
44944
44952
|
}
|
|
44945
44953
|
} catch {
|