@mwillbanks/ast-mcp 0.2.2 → 0.4.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 +13 -0
- package/README.md +18 -16
- package/dist/ast-mcp.js +209 -147
- package/dist/ast-mcp.js.map +70 -50
- package/package.json +21 -15
- package/src/ast-bro/capability.ts +20 -10
- package/src/ast-bro/client.ts +12 -6
- package/src/ast-bro/result.ts +79 -0
- package/src/ast-bro/tools.json +29 -4
- package/src/cli.ts +10 -7
- package/src/config-cli.ts +166 -19
- package/src/config-edit.ts +236 -0
- package/src/config-migrate.ts +206 -0
- package/src/config-registry.ts +329 -0
- package/src/config-schema-common.ts +88 -0
- package/src/config-v2-schema.ts +109 -0
- package/src/config.ts +523 -170
- package/src/helpers/ast-bro.ts +1 -7
- package/src/helpers/config.ts +16 -3
- package/src/helpers/installer.ts +8 -0
- package/src/helpers/mcp-schema.ts +98 -4
- package/src/host-smoke.ts +182 -0
- package/src/http.ts +8 -3
- package/src/installer-transport.ts +6 -4
- package/src/installer.ts +242 -54
- package/src/patch/engine.ts +575 -280
- package/src/patch/languages.ts +9 -0
- package/src/patch/strategy/aiderBlock.ts +110 -0
- package/src/patch/strategy/ast.ts +170 -0
- package/src/patch/strategy.ts +61 -0
- package/src/runtime/approval.ts +438 -0
- package/src/runtime/config-write.ts +327 -0
- package/src/runtime/dependencies.ts +14 -78
- package/src/runtime/document-inspection.ts +78 -0
- package/src/runtime/file-capabilities.ts +250 -0
- package/src/runtime/file-delete.ts +110 -37
- package/src/runtime/file-read.ts +134 -15
- package/src/runtime/file-rename.ts +5 -2
- package/src/runtime/format.ts +90 -30
- package/src/runtime/git-worktrees.ts +179 -0
- package/src/runtime/path-policy.ts +643 -0
- package/src/runtime/path-utils.ts +80 -0
- package/src/runtime/paths.ts +171 -47
- package/src/server.ts +2 -1
- package/src/tools/ast-bro.ts +294 -75
- package/src/tools/configuration.ts +668 -0
- package/src/tools/configured.ts +49 -21
- package/src/tools/files.ts +169 -62
- package/src/tools/index.ts +2 -0
- package/src/tools/lifecycle.ts +82 -38
- package/templates/AGENTS.md +17 -15
- package/templates/skills/ast-mcp/SKILL.md +57 -20
- package/templates/skills/ast-mcp/evals/evals.json +319 -9
- package/templates/skills/ast-mcp/evals/score.ts +80 -0
- package/templates/skills/ast-mcp/evals/semantic.ts +3 -1
- package/templates/skills/ast-mcp/references/installation.md +12 -12
- package/templates/skills/ast-mcp/references/patch-state-machine.md +15 -14
- package/templates/skills/ast-mcp/references/tool-catalog.md +18 -8
- package/templates/skills/ast-mcp/scripts/binary-resolution.ts +112 -0
- package/templates/skills/ast-mcp/scripts/check-install.ts +165 -51
- package/templates/skills/ast-mcp/scripts/managed-hook.ts +34 -2
- package/src/ast-bro/rewrite-capability.ts +0 -9
package/CONTRIBUTING.md
CHANGED
|
@@ -5,6 +5,7 @@ Thanks for helping improve ast-mcp. Changes should preserve its core promise: re
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
7
|
- Bun 1.3 or newer
|
|
8
|
+
- Node.js 22.19 or newer when running MCP Inspector commands
|
|
8
9
|
- the pinned `ast-bro` and `dprint` binaries installed by `bun install`
|
|
9
10
|
- a checkout with no unrelated changes in files you plan to edit
|
|
10
11
|
|
|
@@ -47,6 +48,18 @@ bun pm pack --dry-run
|
|
|
47
48
|
|
|
48
49
|
The formatter command intentionally applies Biome's safe and unsafe fixes and treats every remaining warning as a failure.
|
|
49
50
|
|
|
51
|
+
### Optional live host smoke checks
|
|
52
|
+
|
|
53
|
+
Live model-host checks are disabled by default. `bun run smoke:hosts` does not spawn Codex, Claude, Copilot, or any other host unless an environment variable named `AST_MCP_HOST_SMOKE_<NAME>` is present. These checks are deliberately separate from `bun run check`, CI, and release workflows.
|
|
54
|
+
|
|
55
|
+
The variable value is a JSON object with a shell-free `command` argument array, optional `expect` marker or marker array, and optional `timeoutMs`. The suffix is arbitrary, so every host uses the same opt-in contract without ast-mcp assuming a particular CLI is installed or authenticated. Independent enabled checks run concurrently.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
AST_MCP_HOST_SMOKE_MY_HOST='{"command":["my-host","--non-interactive","run an ast-mcp config_status smoke check"],"expect":["config_status","generation"]}' bun run smoke:hosts
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The default timeout is 60 seconds. Set `AST_MCP_HOST_SMOKE_TIMEOUT_MS` to change it for every enabled check, or use `timeoutMs` in one host definition. A configured host failure fails this optional command, while an unconfigured host is always skipped.
|
|
62
|
+
|
|
50
63
|
## Pull requests
|
|
51
64
|
|
|
52
65
|
- Keep changes focused and explain the user-visible or boundary-level behavior.
|
package/README.md
CHANGED
|
@@ -69,8 +69,7 @@ bun pm trust @ast-bro/cli dprint
|
|
|
69
69
|
```bash
|
|
70
70
|
./node_modules/.bin/ast-mcp install \
|
|
71
71
|
--scope local \
|
|
72
|
-
--target all
|
|
73
|
-
--root "$PWD"
|
|
72
|
+
--target all
|
|
74
73
|
```
|
|
75
74
|
|
|
76
75
|
Stdio remains the default. To generate Streamable HTTP entries instead, select HTTP and an endpoint:
|
|
@@ -79,7 +78,6 @@ Stdio remains the default. To generate Streamable HTTP entries instead, select H
|
|
|
79
78
|
./node_modules/.bin/ast-mcp install \
|
|
80
79
|
--scope local \
|
|
81
80
|
--target all \
|
|
82
|
-
--root "$PWD" \
|
|
83
81
|
--transport http \
|
|
84
82
|
--host 127.0.0.1 \
|
|
85
83
|
--port 3768
|
|
@@ -89,14 +87,14 @@ Add `--service` to create and start a macOS LaunchAgent or Linux systemd user un
|
|
|
89
87
|
|
|
90
88
|
Bun blocks transitive lifecycle scripts by default, so the explicit trust step runs the pinned ast-bro and dprint installers before the MCP starts. If another package manager blocks dependency build scripts, approve `@ast-bro/cli` and `dprint` through that manager before configuring a host. npm, pnpm, Yarn Classic, and Yarn 2+ project installations are supported. The runtime resolves binaries from ancestor package bins, package metadata, package-manager global bins, and then `PATH`.
|
|
91
89
|
|
|
92
|
-
Targets are `codex`, `claude`, `copilot`, or `all`.
|
|
90
|
+
Targets are `codex`, `claude`, `copilot`, or `all`. Local surfaces always use `./node_modules/.bin/ast-mcp`; global surfaces use a recognized Bun, npm, pnpm, or Yarn global-bin alias. The installer creates version 2 configuration and omits MCP environment fields. Uninstall preserves configuration.
|
|
93
91
|
|
|
94
92
|
### ast-bro platform support
|
|
95
93
|
|
|
96
|
-
`@ast-bro/cli@
|
|
94
|
+
`@ast-bro/cli@4.2.0` currently publishes a precompiled binary only for macOS Apple Silicon. The ast-mcp installer verifies that the pinned binary can execute before writing host configuration. On Linux, Windows, or macOS Intel, install it through Cargo and set `AST_BRO_BINARY` to the resulting executable before rerunning the installer:
|
|
97
95
|
|
|
98
96
|
```bash
|
|
99
|
-
cargo install ast-bro --version
|
|
97
|
+
cargo install ast-bro --version 4.2.0 --locked
|
|
100
98
|
export AST_BRO_BINARY="$HOME/.cargo/bin/ast-bro"
|
|
101
99
|
printf '%s\n' 'export AST_BRO_BINARY="$HOME/.cargo/bin/ast-bro"' >> "$HOME/.profile"
|
|
102
100
|
```
|
|
@@ -104,7 +102,7 @@ printf '%s\n' 'export AST_BRO_BINARY="$HOME/.cargo/bin/ast-bro"' >> "$HOME/.prof
|
|
|
104
102
|
For Windows PowerShell:
|
|
105
103
|
|
|
106
104
|
```powershell
|
|
107
|
-
cargo install ast-bro --version
|
|
105
|
+
cargo install ast-bro --version 4.2.0 --locked
|
|
108
106
|
$env:AST_BRO_BINARY = "$HOME\.cargo\bin\ast-bro.exe"
|
|
109
107
|
[Environment]::SetEnvironmentVariable("AST_BRO_BINARY", "$HOME\.cargo\bin\ast-bro.exe", "User")
|
|
110
108
|
```
|
|
@@ -116,26 +114,30 @@ From a source checkout:
|
|
|
116
114
|
```bash
|
|
117
115
|
bun install
|
|
118
116
|
bun run build
|
|
119
|
-
bun run bin/ast-mcp.ts install --scope local --target all
|
|
117
|
+
bun run bin/ast-mcp.ts install --scope local --target all
|
|
120
118
|
```
|
|
121
119
|
|
|
122
120
|
## Configuration
|
|
123
121
|
|
|
124
|
-
|
|
122
|
+
Install or update ast-mcp to create `ast-mcp.toml`. The installer migrates version 1 files and preserves version 2 files.
|
|
125
123
|
|
|
126
124
|
```toml
|
|
127
|
-
version =
|
|
125
|
+
version = 2
|
|
128
126
|
|
|
129
127
|
[workspace]
|
|
130
128
|
roots = ["."]
|
|
131
129
|
|
|
132
130
|
[safety]
|
|
133
|
-
allow_any_path = false
|
|
134
|
-
allow_external_roots = false
|
|
135
|
-
allow_temp_directory = true
|
|
136
|
-
follow_symlinks = false
|
|
137
131
|
require_hash = true
|
|
138
132
|
|
|
133
|
+
[[paths]]
|
|
134
|
+
id = "workspace"
|
|
135
|
+
path = "."
|
|
136
|
+
policies = { read = "allow", write = "allow", delete = "deny" }
|
|
137
|
+
follow_symlinks = false
|
|
138
|
+
includes = ["**/*"]
|
|
139
|
+
excludes = [".git/**"]
|
|
140
|
+
|
|
139
141
|
[safety.hook]
|
|
140
142
|
enabled = true
|
|
141
143
|
|
|
@@ -155,13 +157,13 @@ port = 3768
|
|
|
155
157
|
|
|
156
158
|
Resolution is deterministic: environment overrides, project `ast-mcp.toml`, the platform global `ast-mcp/ast-mcp.toml`, then built-in defaults. The server uses MCP client workspace roots when available, so one global installation automatically selects the connected project. Existing environment variables remain supported as explicit overrides.
|
|
157
159
|
|
|
158
|
-
Formatting uses dprint by default
|
|
160
|
+
Formatting uses dprint by default and supports shell-free external formatters. Mutation tools expose a declared `files` batch. Version 2 requires explicit `[[paths]]` rules outside the host baseline, including temporary paths. Path rules control symlinks, hashes, and hook policy.
|
|
159
161
|
|
|
160
162
|
Inspect the result with `ast-mcp config validate` and `ast-mcp config show`. See the [configuration reference](https://mwillbanks.github.io/ast-mcp/docs/reference/configuration/) for the full schema, discovery rules, cache behavior, formatter contract, safety semantics, and migration guidance.
|
|
161
163
|
|
|
162
164
|
## MCP configuration
|
|
163
165
|
|
|
164
|
-
A
|
|
166
|
+
A stdio definition contains the stable local or package-manager global executable alias and `mcp` subcommand. Generated definitions omit environment fields. Project configuration supplies local roots. Select `--transport http` during install to generate native URL entries for Codex, Claude Code, Copilot CLI, and VS Code.
|
|
165
167
|
|
|
166
168
|
Start HTTP manually with `ast-mcp mcp --transport http [--host <address>] [--port <number>]`, or install a user service with `--service`. CLI flags override environment variables, project TOML, global TOML, and built-in defaults. The endpoint is `/mcp`; wildcard bind addresses generate loopback client URLs, while explicit non-loopback addresses deliberately expose the server. MCP session IDs correlate requests and are not authentication; stdio remains the trusted default transport. HTTP uses SSE by default and emits one event per request; JSON-array responses require `enableJsonResponse`.
|
|
167
169
|
|