@theglitchking/babel-fish 1.0.2 → 2.0.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/.claude/install.sh +666 -0
- package/.claude/project-map/PROJECT_MAP.md +61 -0
- package/.claude/project-map/checksums.json +6 -0
- package/.claude/project-map/generate.py +1481 -0
- package/.claude/project-map/grader.py +583 -0
- package/.claude/project-map/learned-vocabulary.json +1 -0
- package/.claude/project-map/mine-sessions.py +419 -0
- package/.claude/project-map/reports/install-report.md +54 -0
- package/.claude/project-map/reports/iteration-01-report.md +54 -0
- package/.claude/project-map/reports/iteration-01-score.json +7 -0
- package/.claude/project-map/sections/01-vocabulary.md +8 -0
- package/.claude/project-map/sections/02-service-topology.md +6 -0
- package/.claude/project-map/sections/03-environment.md +6 -0
- package/.claude/project-map/sections/04-api-routes.md +6 -0
- package/.claude/project-map/sections/05-data-models.md +4 -0
- package/.claude/project-map/sections/06-schemas.md +4 -0
- package/.claude/project-map/sections/07-services.md +6 -0
- package/.claude/project-map/sections/08-background-jobs.md +5 -0
- package/.claude/project-map/sections/09-frontend-features.md +4 -0
- package/.claude/project-map/sections/10-tools-commands.md +8 -0
- package/.claude/project-map/sections/11-migrations.md +4 -0
- package/.claude/project-map/sections/12-import-chains.md +7 -0
- package/.claude/project-map/sections/13-frontend-backend-map.md +8 -0
- package/.claude/project-map/sections/14-reverse-proxy.md +4 -0
- package/.claude/project-map/sections/15-auth-config.md +6 -0
- package/.claude/project-map/sections/16-infra-profile.md +13 -0
- package/.claude/project-map/sections/17-learned-vocabulary.md +7 -0
- package/.claude/project-map/sections/18-dead-code.md +9 -0
- package/.claude/project-map/sections/19-doc-pointers.md +5 -0
- package/.claude/project-map/stack.json +12 -0
- package/.claude/rules/operational-runbook.md +40 -0
- package/.claude/rules/project-vocabulary.md +25 -0
- package/.claude/scripts/detect-stack.sh +222 -0
- package/.claude/scripts/ensure-python.sh +100 -0
- package/.claude/scripts/statusline.sh +27 -0
- package/.claude/scripts/validate.sh +59 -0
- package/.claude/settings.json +6 -0
- package/.claude/skills/babel-fish-developer-skill/SKILL.md +56 -0
- package/.claude/templates/SKILL.md.template +56 -0
- package/.claude/templates/operational-runbook.md.template +40 -0
- package/.claude/templates/project-vocabulary.md.template +25 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.githooks/install.sh +4 -0
- package/.githooks/pre-commit +22 -0
- package/CHANGELOG.md +72 -0
- package/README.md +18 -0
- package/bin/babel-fish.js +78 -71
- package/commands/policy.md +16 -0
- package/commands/relink.md +6 -0
- package/commands/status.md +6 -0
- package/commands/update.md +6 -0
- package/hooks/hooks.json +15 -0
- package/hooks/session-start.js +11 -0
- package/package.json +19 -3
- package/scripts/link-skills.js +31 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# {{PROJECT_NAME}} — Operational Runbook
|
|
2
|
+
|
|
3
|
+
> Auto-loaded every session. Contains operational knowledge that cannot be derived from code.
|
|
4
|
+
> This file grows over time as the team discovers gotchas, quirks, and procedures.
|
|
5
|
+
> **Edit this file manually** — it is NOT overwritten on regeneration.
|
|
6
|
+
|
|
7
|
+
## Environment Differences
|
|
8
|
+
|
|
9
|
+
<!-- TODO: Document how dev/staging/prod differ (DB, deploy method, secrets, URLs) -->
|
|
10
|
+
|
|
11
|
+
| | Dev | Staging | Production |
|
|
12
|
+
|---|---|---|---|
|
|
13
|
+
| **URL** | | | |
|
|
14
|
+
| **Database** | | | |
|
|
15
|
+
| **Deploy** | | | |
|
|
16
|
+
| **Secrets** | | | |
|
|
17
|
+
|
|
18
|
+
## Known Issues & Workarounds
|
|
19
|
+
|
|
20
|
+
<!-- This section fills in naturally. When you hit a non-obvious issue, add it here. -->
|
|
21
|
+
<!-- Examples: "HMR doesn't work on WSL2", "port 6543 breaks migrations" -->
|
|
22
|
+
|
|
23
|
+
_No known issues documented yet. When you encounter a non-obvious problem and its solution, add it here so future sessions don't re-discover it._
|
|
24
|
+
|
|
25
|
+
## Deploy Procedures
|
|
26
|
+
|
|
27
|
+
<!-- TODO: Document how to deploy to each environment -->
|
|
28
|
+
|
|
29
|
+
## Key Commands
|
|
30
|
+
|
|
31
|
+
| Command | What It Does |
|
|
32
|
+
|---------|-------------|
|
|
33
|
+
| `python .claude/project-map/generate.py --force` | Force-regenerate project map |
|
|
34
|
+
| `python .claude/project-map/grader.py` | Grade map quality (0-100%) |
|
|
35
|
+
| `bash .githooks/install.sh` | (Re)install git hooks |
|
|
36
|
+
| `bash .claude/install.sh` | Re-run full plugin installer |
|
|
37
|
+
|
|
38
|
+
## Dev Credentials
|
|
39
|
+
|
|
40
|
+
<!-- Add test/dev credentials here (NEVER production secrets) -->
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# {{PROJECT_NAME}} — Project Vocabulary
|
|
2
|
+
|
|
3
|
+
> Auto-loaded every session. Maps human language to exact code locations.
|
|
4
|
+
> Regenerated automatically via pre-commit hook. Do not edit the auto-generated rows.
|
|
5
|
+
|
|
6
|
+
## Feature → Code Location
|
|
7
|
+
|
|
8
|
+
| You Say | Frontend | Backend | Model/Table |
|
|
9
|
+
|---------|----------|---------|-------------|
|
|
10
|
+
| _(vocabulary populates as source code is added)_ | | | |
|
|
11
|
+
|
|
12
|
+
## Infrastructure Vocabulary
|
|
13
|
+
|
|
14
|
+
| You Say | What It Is | Key Details |
|
|
15
|
+
|---------|-----------|-------------|
|
|
16
|
+
| project | {{PROJECT_NAME}} | {{LANGUAGE}} / {{FRAMEWORK}} stack |
|
|
17
|
+
|
|
18
|
+
## Quick Actions
|
|
19
|
+
|
|
20
|
+
| You Say | What To Do |
|
|
21
|
+
|---------|-----------|
|
|
22
|
+
| regenerate map | `python .claude/project-map/generate.py --force` |
|
|
23
|
+
| grade map | `python .claude/project-map/grader.py` |
|
|
24
|
+
| view project map | `cat .claude/project-map/PROJECT_MAP.md` |
|
|
25
|
+
| install hooks | `bash .githooks/install.sh` |
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Official marketplace for babel-fish - Codebase introspection and vocabulary translation for AI coding assistants",
|
|
9
|
-
"version": "
|
|
9
|
+
"version": "2.0.0"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "babel-fish",
|
|
14
14
|
"description": "Auto-generates a project map, vocabulary translation layer, and developer skill for any codebase. Introspects routes, models, services, features, infrastructure, and session history to give Claude instant full-stack context. Self-updates via pre-commit hook.",
|
|
15
|
-
"version": "
|
|
15
|
+
"version": "2.0.0",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "TheGlitchKing"
|
|
18
18
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babel-fish",
|
|
3
3
|
"description": "Auto-generates a project map, vocabulary translation layer, and developer skill for any codebase. Introspects routes, models, services, features, infrastructure, and session history to give Claude instant full-stack context. Self-updates via pre-commit hook.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "TheGlitchKing",
|
|
7
7
|
"email": "theglitchking@users.noreply.github.com"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# ── Codebase Mapper: regenerate project map on relevant changes ──
|
|
3
|
+
STAGED_FILES=$(git diff --cached --name-only 2>/dev/null || true)
|
|
4
|
+
EXTENSIONS_PATTERN='\.(py|ts|tsx|js|jsx|go|java|yaml|yml)$|docker-compose|package\.json|Cargo\.toml|go\.mod'
|
|
5
|
+
if echo "$STAGED_FILES" | grep -qE "$EXTENSIONS_PATTERN" 2>/dev/null; then
|
|
6
|
+
MAP_SCRIPT=".claude/project-map/generate.py"
|
|
7
|
+
if [ -f "$MAP_SCRIPT" ]; then
|
|
8
|
+
PYTHON=""
|
|
9
|
+
if [ -f ".venv/bin/python3" ]; then PYTHON=".venv/bin/python3"
|
|
10
|
+
elif command -v python3 &>/dev/null; then PYTHON="python3"
|
|
11
|
+
elif command -v python &>/dev/null; then PYTHON="python"
|
|
12
|
+
fi
|
|
13
|
+
if [ -n "$PYTHON" ]; then
|
|
14
|
+
echo "[codebase-mapper] Regenerating project map..."
|
|
15
|
+
if $PYTHON "$MAP_SCRIPT" 2>/dev/null; then
|
|
16
|
+
git add .claude/project-map/PROJECT_MAP.md .claude/project-map/checksums.json \
|
|
17
|
+
.claude/project-map/sections/*.md .claude/project-map/learned-vocabulary.json 2>/dev/null || true
|
|
18
|
+
fi
|
|
19
|
+
fi
|
|
20
|
+
fi
|
|
21
|
+
fi
|
|
22
|
+
# ── End Codebase Mapper ──────────────────────────────────────────────────────
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [2.0.0] — 2026-04-19
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
- **Package is now ESM (`"type": "module"`).** If anything imports from
|
|
10
|
+
`@theglitchking/babel-fish` via `require()` (the package has no `main`,
|
|
11
|
+
so this is unlikely), you'll need to switch to `import`. The CLI
|
|
12
|
+
(`npx @theglitchking/babel-fish <cmd>`) is unaffected.
|
|
13
|
+
- **Node >= 20** (was >= 16). Matches the rest of the Glitch Kingdom
|
|
14
|
+
plugin ecosystem and the runtime.
|
|
15
|
+
- CLI is now `commander`-based. Subcommands, flags, and arguments
|
|
16
|
+
behave the same as before — `init`, `dry-run`, `regen`, `grade`, and
|
|
17
|
+
`help` all work identically — but you now also get `--help` and
|
|
18
|
+
`--version` on every subcommand.
|
|
19
|
+
|
|
20
|
+
### Migration
|
|
21
|
+
|
|
22
|
+
No user-facing code changes required — just:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @theglitchking/babel-fish@latest
|
|
26
|
+
|
|
27
|
+
# Or if you used the curl|bash installer (unaffected):
|
|
28
|
+
curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Your existing `.claude/project-map/` infrastructure and `.githooks/pre-commit`
|
|
32
|
+
keep working — this release doesn't touch them. The only net-new files
|
|
33
|
+
added to your project are `.claude/babel-fish.json` (update policy —
|
|
34
|
+
defaults to `nudge`) and a SessionStart hook entry in
|
|
35
|
+
`.claude/settings.json` (only if that file exists and the plugin
|
|
36
|
+
marketplace version isn't already handling it).
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Adopts
|
|
41
|
+
[`@theglitchking/claude-plugin-runtime`](https://github.com/TheGlitchKing/claude-plugin-runtime)
|
|
42
|
+
(`^0.1.0`) for standardized update management and postinstall wiring.
|
|
43
|
+
- **Postinstall** (`scripts/link-skills.js`) symlinks
|
|
44
|
+
`skills/babel-fish-developer-skill/` into `<project>/.claude/skills/`
|
|
45
|
+
so Claude Code picks it up automatically. If you later run
|
|
46
|
+
`npx @theglitchking/babel-fish init`, the install script's `cp`
|
|
47
|
+
replaces the symlink with a regular copy — either way the skill is
|
|
48
|
+
discoverable.
|
|
49
|
+
- **SessionStart hook** (`hooks/session-start.js`) checks npm for a
|
|
50
|
+
newer version at session start and acts per policy (off / nudge /
|
|
51
|
+
auto). Default is `nudge` — a one-liner notification, no automatic
|
|
52
|
+
changes.
|
|
53
|
+
- **Slash + CLI subcommands:**
|
|
54
|
+
- `/babel-fish:update` / `babel-fish update`
|
|
55
|
+
- `/babel-fish:policy [auto|nudge|off]` / `babel-fish policy`
|
|
56
|
+
- `/babel-fish:status` / `babel-fish status`
|
|
57
|
+
- `/babel-fish:relink` / `babel-fish relink`
|
|
58
|
+
|
|
59
|
+
### Opt-outs
|
|
60
|
+
|
|
61
|
+
| Variable | Effect |
|
|
62
|
+
|---|---|
|
|
63
|
+
| `BABEL_FISH_UPDATE_POLICY` | One-shot policy override |
|
|
64
|
+
| `BABEL_FISH_SKIP_LINK=1` | Skip skill symlinking in postinstall |
|
|
65
|
+
| `BABEL_FISH_SKIP_HOOK_REGISTER=1` | Skip writing the SessionStart hook into `.claude/settings.json` |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## [1.0.2] and earlier
|
|
70
|
+
|
|
71
|
+
See git history:
|
|
72
|
+
https://github.com/TheGlitchKing/babel-fish/commits/main
|
package/README.md
CHANGED
|
@@ -119,6 +119,24 @@ bash babel-fish/.claude/install.sh /path/to/your/project
|
|
|
119
119
|
|
|
120
120
|
---
|
|
121
121
|
|
|
122
|
+
## Update management *(2.0.0+)*
|
|
123
|
+
|
|
124
|
+
Every install ships with an update policy controlling what happens at session start when a newer version is available on npm. Default is `nudge` (one-liner notification, no automatic changes).
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
babel-fish status # installed / latest / policy / hook state
|
|
128
|
+
babel-fish policy auto # auto-update on session start
|
|
129
|
+
babel-fish policy nudge # one-liner nudge only (default)
|
|
130
|
+
babel-fish policy off # silent
|
|
131
|
+
babel-fish update # update now
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Slash-command parity: `/babel-fish:status`, `/babel-fish:policy <mode>`, `/babel-fish:update`, `/babel-fish:relink`.
|
|
135
|
+
|
|
136
|
+
See [CHANGELOG.md](./CHANGELOG.md) for the full 2.0.0 release notes, breaking-change details, and env-var opt-outs.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
122
140
|
## What the Installer Does
|
|
123
141
|
|
|
124
142
|
1. Checks for Python ≥ 3.8 (installs if missing)
|
package/bin/babel-fish.js
CHANGED
|
@@ -1,94 +1,101 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { program } from "commander";
|
|
4
|
+
import { registerUpdateCommands } from "@theglitchking/claude-plugin-runtime";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { dirname, join, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
7
10
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const command = args[0] || 'init';
|
|
11
|
+
const require_ = createRequire(import.meta.url);
|
|
12
|
+
const { version } = require_("../package.json");
|
|
11
13
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Usage:
|
|
16
|
-
npx @theglitchking/babel-fish [command] [options]
|
|
17
|
-
|
|
18
|
-
Commands:
|
|
19
|
-
init [path] Install babel-fish into a project (default: current dir)
|
|
20
|
-
dry-run [path] Preview all changes without applying them
|
|
21
|
-
regen Force-regenerate the project map
|
|
22
|
-
grade Grade the current project map quality
|
|
23
|
-
help Show this help
|
|
24
|
-
|
|
25
|
-
Examples:
|
|
26
|
-
npx @theglitchking/babel-fish init
|
|
27
|
-
npx @theglitchking/babel-fish init /path/to/project
|
|
28
|
-
npx @theglitchking/babel-fish dry-run
|
|
29
|
-
npx @theglitchking/babel-fish regen
|
|
30
|
-
`;
|
|
14
|
+
const PKG = "@theglitchking/babel-fish";
|
|
15
|
+
const PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
16
|
+
const INSTALL_SH = join(PACKAGE_ROOT, ".claude", "install.sh");
|
|
31
17
|
|
|
32
18
|
function requireBash() {
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
console.error(
|
|
19
|
+
const r = spawnSync("bash", ["--version"], { stdio: "ignore" });
|
|
20
|
+
if (r.status !== 0) {
|
|
21
|
+
console.error(" ✗ bash is required but not found.");
|
|
36
22
|
process.exit(1);
|
|
37
23
|
}
|
|
38
24
|
}
|
|
39
25
|
|
|
40
|
-
function
|
|
26
|
+
function runBash(bashArgs, opts = {}) {
|
|
41
27
|
requireBash();
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
const r = spawnSync("bash", bashArgs, { stdio: "inherit", ...opts });
|
|
29
|
+
if (r.status !== 0) process.exit(r.status ?? 1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function runRelink(cwd) {
|
|
33
|
+
const linker = join(cwd, "node_modules", "@theglitchking", "babel-fish", "scripts", "link-skills.js");
|
|
34
|
+
const script = existsSync(linker) ? linker : resolve(PACKAGE_ROOT, "scripts", "link-skills.js");
|
|
35
|
+
if (!existsSync(script)) {
|
|
36
|
+
console.error("link-skills.js not found — is the package installed?");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
spawnSync(process.execPath, [script], {
|
|
40
|
+
cwd,
|
|
41
|
+
env: { ...process.env, INIT_CWD: cwd },
|
|
42
|
+
stdio: "inherit",
|
|
45
43
|
});
|
|
46
|
-
if (result.status !== 0) process.exit(result.status);
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
program
|
|
47
|
+
.name("babel-fish")
|
|
48
|
+
.description("babel-fish — gives your AI assistant instant codebase context")
|
|
49
|
+
.version(version);
|
|
50
|
+
|
|
51
|
+
registerUpdateCommands(program, {
|
|
52
|
+
packageName: PKG,
|
|
53
|
+
pluginName: "babel-fish",
|
|
54
|
+
configFile: "babel-fish.json",
|
|
55
|
+
onAfterUpdate: (cwd) => runRelink(cwd),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
program
|
|
59
|
+
.command("init [path]")
|
|
60
|
+
.description("Install babel-fish into a project (default: current dir)")
|
|
61
|
+
.action((path) => {
|
|
62
|
+
const target = path || process.cwd();
|
|
53
63
|
console.log(`\n babel-fish init → ${target}\n`);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
64
|
+
runBash([INSTALL_SH, target]);
|
|
65
|
+
});
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
program
|
|
68
|
+
.command("dry-run [path]")
|
|
69
|
+
.description("Preview all changes without applying them")
|
|
70
|
+
.action((path) => {
|
|
71
|
+
const target = path || process.cwd();
|
|
72
|
+
runBash([INSTALL_SH, "--dry-run", target]);
|
|
73
|
+
});
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
75
|
+
program
|
|
76
|
+
.command("regen")
|
|
77
|
+
.description("Force-regenerate the project map")
|
|
78
|
+
.action(() => {
|
|
79
|
+
const generatePy = join(process.cwd(), ".claude", "project-map", "generate.py");
|
|
80
|
+
if (!existsSync(generatePy)) {
|
|
81
|
+
console.error(" ✗ .claude/project-map/generate.py not found. Run `babel-fish init` first.");
|
|
68
82
|
process.exit(1);
|
|
69
83
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
84
|
+
const r = spawnSync("python3", [generatePy, "--force"], { stdio: "inherit" });
|
|
85
|
+
process.exit(r.status ?? 0);
|
|
86
|
+
});
|
|
73
87
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
program
|
|
89
|
+
.command("grade")
|
|
90
|
+
.description("Grade the current project map quality")
|
|
91
|
+
.action(() => {
|
|
92
|
+
const graderPy = join(process.cwd(), ".claude", "project-map", "grader.py");
|
|
93
|
+
if (!existsSync(graderPy)) {
|
|
94
|
+
console.error(" ✗ .claude/project-map/grader.py not found. Run `babel-fish init` first.");
|
|
78
95
|
process.exit(1);
|
|
79
96
|
}
|
|
80
|
-
spawnSync(
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
case 'help':
|
|
85
|
-
case '--help':
|
|
86
|
-
case '-h':
|
|
87
|
-
console.log(helpText);
|
|
88
|
-
break;
|
|
97
|
+
const r = spawnSync("python3", [graderPy], { stdio: "inherit" });
|
|
98
|
+
process.exit(r.status ?? 0);
|
|
99
|
+
});
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
console.error(` Unknown command: ${command}`);
|
|
92
|
-
console.log(helpText);
|
|
93
|
-
process.exit(1);
|
|
94
|
-
}
|
|
101
|
+
program.parse();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Get or set the babel-fish update policy (auto | nudge | off)
|
|
3
|
+
allowed-tools: Bash(npx:*)
|
|
4
|
+
argument-hint: "[auto|nudge|off]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Arguments: $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
- If `$ARGUMENTS` is empty, run `npx --no @theglitchking/babel-fish policy` and report the current policy and config path.
|
|
10
|
+
- If `$ARGUMENTS` is one of `auto`, `nudge`, `off`, run `npx --no @theglitchking/babel-fish policy $ARGUMENTS` and confirm the new setting to the user.
|
|
11
|
+
- If `$ARGUMENTS` is anything else, tell the user the valid values are `auto`, `nudge`, `off`.
|
|
12
|
+
|
|
13
|
+
Policies:
|
|
14
|
+
- `auto` — auto-run `npm update @theglitchking/babel-fish` at session start when a newer version is available.
|
|
15
|
+
- `nudge` — print a one-liner when a newer version is available (default).
|
|
16
|
+
- `off` — do not check for updates.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Update babel-fish to the latest version (runs npm update + re-links skills)
|
|
3
|
+
allowed-tools: Bash(npx:*)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Run `npx --no @theglitchking/babel-fish update` and report the before/after versions to the user. If the project doesn't have a local install, fall back to `npx -y @theglitchking/babel-fish update` and note that in your summary.
|
package/hooks/hooks.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "babel-fish SessionStart hook — nudges/auto-updates per policy.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.js\""
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// babel-fish SessionStart hook. Runs the runtime's update check per
|
|
3
|
+
// policy (off / nudge / auto). No plugin-specific .mcp.json reconcile.
|
|
4
|
+
|
|
5
|
+
import { runSessionStart } from "@theglitchking/claude-plugin-runtime";
|
|
6
|
+
|
|
7
|
+
await runSessionStart({
|
|
8
|
+
packageName: "@theglitchking/babel-fish",
|
|
9
|
+
pluginName: "babel-fish",
|
|
10
|
+
configFile: "babel-fish.json",
|
|
11
|
+
});
|
package/package.json
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theglitchking/babel-fish",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Gives your AI coding assistant instant, accurate knowledge of every route, model, service, feature, and infrastructure element in your codebase.",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"bin": {
|
|
6
7
|
"babel-fish": "bin/babel-fish.js"
|
|
7
8
|
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node scripts/link-skills.js"
|
|
11
|
+
},
|
|
8
12
|
"files": [
|
|
9
13
|
"bin/",
|
|
14
|
+
"commands/",
|
|
15
|
+
"hooks/",
|
|
16
|
+
"scripts/link-skills.js",
|
|
10
17
|
".claude-plugin/",
|
|
18
|
+
".claude/",
|
|
19
|
+
".githooks/",
|
|
11
20
|
"skills/",
|
|
12
21
|
"install.sh",
|
|
13
22
|
"checksums.json",
|
|
14
23
|
"LICENSE",
|
|
15
|
-
"README.md"
|
|
24
|
+
"README.md",
|
|
25
|
+
"CHANGELOG.md"
|
|
16
26
|
],
|
|
17
27
|
"keywords": [
|
|
28
|
+
"claude-code",
|
|
29
|
+
"plugin",
|
|
18
30
|
"codebase-context",
|
|
19
31
|
"project-map",
|
|
20
32
|
"vocabulary",
|
|
@@ -35,6 +47,10 @@
|
|
|
35
47
|
"access": "public"
|
|
36
48
|
},
|
|
37
49
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
50
|
+
"node": ">=20.0.0"
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"@theglitchking/claude-plugin-runtime": "^0.1.0",
|
|
54
|
+
"commander": "^14.0.0"
|
|
39
55
|
}
|
|
40
56
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Postinstall — delegates to @theglitchking/claude-plugin-runtime.
|
|
3
|
+
// babel-fish ships one skill (skills/babel-fish-developer-skill/) which
|
|
4
|
+
// the runtime symlinks into <project>/.claude/skills/ so Claude Code
|
|
5
|
+
// can discover it. Runtime also writes the default update-policy config
|
|
6
|
+
// and registers the SessionStart hook (with plugin-vs-npm dedup).
|
|
7
|
+
//
|
|
8
|
+
// NOTE: npm install only handles the skill + update policy. To get the
|
|
9
|
+
// full project-map infra (.claude/project-map/generate.py, the
|
|
10
|
+
// pre-commit hook, rules files), users still run:
|
|
11
|
+
// npx @theglitchking/babel-fish init
|
|
12
|
+
|
|
13
|
+
import { runPostinstall } from "@theglitchking/claude-plugin-runtime";
|
|
14
|
+
import { dirname, resolve } from "node:path";
|
|
15
|
+
import { fileURLToPath } from "node:url";
|
|
16
|
+
|
|
17
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
runPostinstall({
|
|
21
|
+
packageName: "@theglitchking/babel-fish",
|
|
22
|
+
pluginName: "babel-fish",
|
|
23
|
+
configFile: "babel-fish.json",
|
|
24
|
+
skillsDir: "skills",
|
|
25
|
+
packageRoot,
|
|
26
|
+
hookCommand:
|
|
27
|
+
"node ./node_modules/@theglitchking/babel-fish/hooks/session-start.js",
|
|
28
|
+
});
|
|
29
|
+
} catch (err) {
|
|
30
|
+
console.warn(`[babel-fish] postinstall failed: ${err?.message || err}`);
|
|
31
|
+
}
|