@mwillbanks/ast-mcp 0.8.0 → 0.9.0
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/CONTRIBUTING.md +5 -2
- package/README.md +3 -3
- package/dist/ast-mcp-launch.cjs +124 -0
- package/dist/ast-mcp.js +305 -302
- package/dist/ast-mcp.js.map +6 -6
- package/dist/npm-platforms.json +30 -0
- package/package.json +10 -3
- package/src/cli/index.ts +11 -1
- package/src/hooks/managed.ts +48 -13
- package/src/installer/index.ts +124 -14
- package/src/runtime/binary-resolution.ts +79 -1
- package/templates/skills/ast-mcp/SKILL.md +1 -1
- package/templates/skills/ast-mcp/references/cli.md +1 -0
- package/templates/skills/ast-mcp/references/configuration.md +8 -0
- package/templates/skills/ast-mcp/references/installation.md +4 -0
- package/templates/skills/ast-mcp/references/tool-catalog.md +3 -0
- package/templates/skills/ast-mcp/scripts/binary-resolution.ts +79 -1
- package/templates/skills/ast-mcp/scripts/check-install.ts +34 -21
- package/templates/skills/ast-mcp/scripts/managed-hook.ts +48 -13
package/CONTRIBUTING.md
CHANGED
|
@@ -100,7 +100,8 @@ An SSH service may not inherit Bun's Actions PATH. The recipe resolves Bun from
|
|
|
100
100
|
- Keep changes focused and explain the user-visible or boundary-level behavior.
|
|
101
101
|
- Add regression coverage for changed security, path, transport, patch, installer, or lifecycle behavior.
|
|
102
102
|
- Update canonical MCP skill resources, evaluation fixtures, and documentation when a public contract changes.
|
|
103
|
-
- Use Conventional Commits so
|
|
103
|
+
- Use Conventional Commits so Release Please can determine the next version.
|
|
104
|
+
- Record user-facing changes in the relevant docs, the unreleased notes draft, and the changelog.
|
|
104
105
|
- Do not commit generated `dist/`, `website/.output/`, or dependency directories.
|
|
105
106
|
|
|
106
107
|
## CI runner capacity recovery
|
|
@@ -113,4 +114,6 @@ To merge without starting release automation, include `[skip release]` in the re
|
|
|
113
114
|
|
|
114
115
|
## Releases
|
|
115
116
|
|
|
116
|
-
Releases are automated from `main`. Release Please opens and maintains the release pull request.
|
|
117
|
+
Releases are automated from `main`. Release Please opens and maintains the release pull request. The release workflow stamps the authored changelog and documentation with the proposed version. It moves the release notes draft to its versioned page, then dispatches CI for that exact head. Invalid inputs, formatting failures, and concurrent head changes stop dispatch.
|
|
118
|
+
|
|
119
|
+
Merging the release pull request builds the main npm tarball and six native tarballs. The workflow qualifies those artifacts on the supported targets and verifies their checksums. It publishes the platform packages before the main npm package and uses the versioned MDX page to generate GitHub release notes. See [CI and first npm publication](docs/ci.md#first-npm-publication-of-the-platform-packages) for the bootstrap and recovery procedure.
|
package/README.md
CHANGED
|
@@ -50,11 +50,11 @@ A stale hash, ambiguous match, capped preview, unsupported route, or lost MCP co
|
|
|
50
50
|
|
|
51
51
|
## Distribution
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
Available since 0.9.0. The npm package selects a compiled ESM bytecode executable on supported platforms. It embeds Bun and ships with its native runtime assets. The npm-installed `ast-mcp` command uses a Node launcher. Run `ast-mcp-bun` to invoke the packaged JavaScript bundle directly with an installed Bun runtime.
|
|
54
54
|
|
|
55
55
|
Native Bun, tree-sitter, ast-grep, LanceDB, and Transformers components power code intelligence. JSON and JSONC configuration parsing uses Bun support without another parsing dependency. Formatting is optional and uses explicitly configured external commands; ast-mcp does not download formatters during file operations. Extracted-package tests exercise parse, index, status, retrieval, and guarded writes through both stdio and Streamable HTTP.
|
|
56
56
|
|
|
57
|
-
GitHub Releases provides
|
|
57
|
+
GitHub Releases also provides archives for macOS arm64, Linux arm64 and x64 (glibc and musl), and Windows x64. Keep the extracted `runtime/` directory beside the executable. Alpine arm64 requires `gcompat` for the bundled Markdown parser.
|
|
58
58
|
|
|
59
59
|
## Install
|
|
60
60
|
|
|
@@ -194,7 +194,7 @@ Open each checkout with `workspace_open` before indexing or querying it. A works
|
|
|
194
194
|
|
|
195
195
|
The default `global` placement shares content-addressed LanceDB artifacts across workspaces. Select `local`, `parent`, or `explicit` placement through `workspace_open` when isolation or a specific storage location is required. Cross-repository graph comparison requires `federation: true`; ordinary graph requests remain repository-scoped.
|
|
196
196
|
|
|
197
|
-
Use `index` with `build`, `refresh`, `verify`, `collect`, or `status`. Use `index_status` for a read-only health view. `graph_query`, `graph_path`, `graph_explain`, and `graph_diff` require explicit workspace IDs and return generation, evidence, coverage, freshness, and pagination metadata. LanceDB
|
|
197
|
+
Use `index` with `build`, `refresh`, `verify`, `collect`, or `status`. Use `index_status` for a read-only health view. `graph_query`, `graph_path`, `graph_explain`, and `graph_diff` require explicit workspace IDs and return generation, evidence, coverage, freshness, and pagination metadata. LanceDB stores the index. A private SQLite journal supports guarded write recovery. Since 0.8.0, writes can acknowledge durable bytes before the index refresh finishes. Indexed reads can return a marked retained generation. Use `strictRead: true` to wait within the request budget.
|
|
198
198
|
|
|
199
199
|
## MCP configuration
|
|
200
200
|
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require("node:child_process");
|
|
4
|
+
const { lstatSync, statSync } = require("node:fs");
|
|
5
|
+
const { dirname, join } = require("node:path");
|
|
6
|
+
const platforms = require("./npm-platforms.json");
|
|
7
|
+
|
|
8
|
+
function platformPackage() {
|
|
9
|
+
const { platform, arch } = process;
|
|
10
|
+
const libc =
|
|
11
|
+
platform === "linux"
|
|
12
|
+
? process.report.getReport().header.glibcVersionRuntime
|
|
13
|
+
? "glibc"
|
|
14
|
+
: "musl"
|
|
15
|
+
: undefined;
|
|
16
|
+
const target = Object.entries(platforms).find(
|
|
17
|
+
([, entry]) =>
|
|
18
|
+
entry.os === platform && entry.cpu === arch && entry.libc === libc,
|
|
19
|
+
);
|
|
20
|
+
return target && `@mwillbanks/ast-mcp-${target[0]}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resolveManifest(packageName) {
|
|
24
|
+
try {
|
|
25
|
+
return require.resolve(`${packageName}/package.json`);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
|
28
|
+
for (const directory of require.resolve.paths(packageName) ?? []) {
|
|
29
|
+
try {
|
|
30
|
+
lstatSync(join(directory, packageName));
|
|
31
|
+
} catch (cause) {
|
|
32
|
+
if (cause.code === "ENOENT" || cause.code === "ENOTDIR") continue;
|
|
33
|
+
throw cause;
|
|
34
|
+
}
|
|
35
|
+
throw new Error(
|
|
36
|
+
`${packageName} is installed without its package manifest`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function nativeCommand(rootManifest) {
|
|
44
|
+
const packageName = platformPackage();
|
|
45
|
+
if (!packageName || !rootManifest.optionalDependencies?.[packageName])
|
|
46
|
+
return undefined;
|
|
47
|
+
const manifestFile = resolveManifest(packageName);
|
|
48
|
+
if (!manifestFile) return undefined;
|
|
49
|
+
const manifest = require(manifestFile);
|
|
50
|
+
if (
|
|
51
|
+
manifest.name !== packageName ||
|
|
52
|
+
manifest.version !== rootManifest.version
|
|
53
|
+
)
|
|
54
|
+
throw new Error(`Invalid or mismatched installation of ${packageName}`);
|
|
55
|
+
const directory = dirname(manifestFile);
|
|
56
|
+
const command = join(
|
|
57
|
+
directory,
|
|
58
|
+
process.platform === "win32" ? "ast-mcp-bytecode.exe" : "ast-mcp-bytecode",
|
|
59
|
+
);
|
|
60
|
+
try {
|
|
61
|
+
const metadata = statSync(command);
|
|
62
|
+
if (
|
|
63
|
+
!metadata.isFile() ||
|
|
64
|
+
(process.platform !== "win32" && (metadata.mode & 0o111) === 0) ||
|
|
65
|
+
!statSync(join(directory, "runtime")).isDirectory()
|
|
66
|
+
)
|
|
67
|
+
throw new Error("Missing executable or runtime assets");
|
|
68
|
+
} catch (cause) {
|
|
69
|
+
throw new Error(`Broken installation of ${packageName}: ${cause.message}`);
|
|
70
|
+
}
|
|
71
|
+
return command;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function reportError(error) {
|
|
75
|
+
process.stderr.write(`ast-mcp: ${error.message}\n`);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function launch(command, args, missingBun) {
|
|
80
|
+
const child = spawn(command, args, { stdio: "inherit", windowsHide: true });
|
|
81
|
+
const signals =
|
|
82
|
+
process.platform === "win32"
|
|
83
|
+
? ["SIGINT", "SIGTERM"]
|
|
84
|
+
: ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
85
|
+
const handlers = new Map(
|
|
86
|
+
signals.map((signal) => [signal, () => child.kill(signal)]),
|
|
87
|
+
);
|
|
88
|
+
for (const [signal, handler] of handlers) process.on(signal, handler);
|
|
89
|
+
const removeHandlers = () => {
|
|
90
|
+
for (const [signal, handler] of handlers) process.off(signal, handler);
|
|
91
|
+
};
|
|
92
|
+
child.once("error", (error) => {
|
|
93
|
+
removeHandlers();
|
|
94
|
+
reportError(
|
|
95
|
+
missingBun && error.code === "ENOENT"
|
|
96
|
+
? new Error(
|
|
97
|
+
"No native executable is installed for this platform. Install Bun to run the bundled CLI.",
|
|
98
|
+
)
|
|
99
|
+
: error,
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
child.once("exit", (code, signal) => {
|
|
103
|
+
removeHandlers();
|
|
104
|
+
if (signal && process.platform !== "win32")
|
|
105
|
+
process.kill(process.pid, signal);
|
|
106
|
+
else process.exitCode = code ?? 1;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const args = process.argv.slice(2);
|
|
112
|
+
const command = nativeCommand(require("../package.json"));
|
|
113
|
+
if (command) launch(command, args, false);
|
|
114
|
+
else {
|
|
115
|
+
const runningWithBun = Boolean(process.versions.bun);
|
|
116
|
+
launch(
|
|
117
|
+
runningWithBun ? process.execPath : "bun",
|
|
118
|
+
[join(__dirname, "ast-mcp.js"), ...args],
|
|
119
|
+
!runningWithBun,
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
} catch (error) {
|
|
123
|
+
reportError(error);
|
|
124
|
+
}
|