@actions-json/bridge 0.1.119 → 0.1.121

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 CHANGED
@@ -1,44 +1,38 @@
1
1
  # @actions-json/bridge
2
2
 
3
3
  Run the [actions.json](https://yaniv256.github.io/actions.json/) MCP bridge with
4
- `npx` — no Rust toolchain required. On first run this downloads the prebuilt
5
- `actions-json-mcp` binary for your platform from the GitHub release, caches it,
6
- and runs it with the arguments you pass.
4
+ `npx` — no Rust toolchain, no setup. On first run it downloads the prebuilt
5
+ `actions-json-mcp` binary for your platform, bundles the primitive dictionary
6
+ (so you don't pass `--actions`), and scaffolds a storage workspace at
7
+ `~/.actions-json/storage` (so you don't pass `--storage-root`).
7
8
 
8
9
  ## Usage
9
10
 
10
11
  ```bash
11
- npx @actions-json/bridge mcp \
12
- --bind 0.0.0.0:17345 \
13
- --actions /abs/path/to/overlay.actions.json \
14
- --storage-root /abs/path/to/actions.json.storage
12
+ npx @actions-json/bridge mcp
15
13
  ```
16
14
 
17
- Register it with a coding agent the same way for Claude Code:
15
+ Register it with a coding agent — Claude Code:
18
16
 
19
17
  ```bash
20
- claude mcp add actions-json -- \
21
- npx -y @actions-json/bridge mcp \
22
- --bind 0.0.0.0:17345 \
23
- --actions /abs/path/to/overlay.actions.json \
24
- --storage-root /abs/path/to/actions.json.storage
18
+ claude mcp add actions-json -- npx -y @actions-json/bridge mcp
25
19
  ```
26
20
 
27
- For Codex (`~/.codex/config.toml`):
28
-
29
- ```toml
30
- [mcp_servers.actions-json]
31
- command = "npx"
32
- args = [
33
- "-y", "@actions-json/bridge", "mcp",
34
- "--bind", "0.0.0.0:17345",
35
- "--actions", "/abs/path/to/overlay.actions.json",
36
- "--storage-root", "/abs/path/to/actions.json.storage",
37
- ]
21
+ Codex:
22
+
23
+ ```bash
24
+ codex mcp add actions-json -- npx -y @actions-json/bridge mcp
38
25
  ```
39
26
 
40
- All arguments after the binary are passed straight through to `actions-json-mcp`.
41
- See [Getting Started](https://yaniv256.github.io/actions.json/getting-started.html).
27
+ Overrides (the defaults are skipped when you pass your own):
28
+
29
+ - `--storage-root <dir>` — use a different storage workspace. Or set
30
+ `ACTIONS_JSON_STORAGE`.
31
+ - `--actions <file>` — use a custom primitive dictionary instead of the bundled
32
+ one.
33
+
34
+ All arguments after the binary pass straight through to `actions-json-mcp`. See
35
+ [Getting Started](https://yaniv256.github.io/actions.json/getting-started.html).
42
36
 
43
37
  ## Platforms
44
38
 
package/bin/cli.js CHANGED
@@ -4,10 +4,40 @@
4
4
  // Thin launcher: ensure the prebuilt actions-json-mcp binary is present
5
5
  // (downloading it on first run), then exec it with whatever args were passed.
6
6
  // Example:
7
- // npx @actions-json/bridge mcp --bind 0.0.0.0:17345 --actions ... --storage-root ...
7
+ // npx @actions-json/bridge mcp --storage-root .storage
8
8
 
9
+ const path = require('node:path');
9
10
  const { spawn } = require('node:child_process');
10
11
  const { ensureBinary } = require('../lib/install');
12
+ const { ensureStorageRoot } = require('../lib/storage');
13
+
14
+ // The primitive dictionary (browser-control tool catalog) ships with this
15
+ // package — it's a fixed runtime file, not user config. When the caller runs a
16
+ // subcommand that needs it and didn't pass --actions, default to the bundled
17
+ // copy so users don't have to know its path.
18
+ const BUNDLED_ACTIONS = path.join(__dirname, '..', 'dictionary', 'overlay.actions.json');
19
+ const SUBCOMMANDS_NEEDING_ACTIONS = new Set(['mcp', 'serve']);
20
+
21
+ function isRunSubcommand(args) {
22
+ return SUBCOMMANDS_NEEDING_ACTIONS.has(args[0]) &&
23
+ !args.includes('--help') && !args.includes('-h');
24
+ }
25
+
26
+ // Inject defaults the user shouldn't have to specify: the bundled primitive
27
+ // dictionary (--actions) and a scaffolded storage root (--storage-root). Both
28
+ // are skipped if the user passed their own.
29
+ function withDefaults(args) {
30
+ if (!isRunSubcommand(args)) return args;
31
+ const out = [args[0]];
32
+ if (!args.includes('--actions')) {
33
+ out.push('--actions', BUNDLED_ACTIONS);
34
+ }
35
+ if (!args.includes('--storage-root')) {
36
+ out.push('--storage-root', ensureStorageRoot());
37
+ }
38
+ out.push(...args.slice(1));
39
+ return out;
40
+ }
11
41
 
12
42
  async function main() {
13
43
  let bin;
@@ -19,7 +49,7 @@ async function main() {
19
49
  return;
20
50
  }
21
51
 
22
- const args = process.argv.slice(2);
52
+ const args = withDefaults(process.argv.slice(2));
23
53
  const child = spawn(bin, args, { stdio: 'inherit' });
24
54
 
25
55
  // Forward termination signals so the bridge shuts down cleanly.