@theglitchking/babel-fish 1.0.1
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-plugin/marketplace.json +44 -0
- package/.claude-plugin/plugin.json +20 -0
- package/LICENSE +21 -0
- package/README.md +267 -0
- package/bin/babel-fish.js +94 -0
- package/checksums.json +4 -0
- package/install.sh +86 -0
- package/package.json +43 -0
- package/skills/babel-fish-developer-skill/SKILL.md +51 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "babel-fish-marketplace",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "TheGlitchKing",
|
|
5
|
+
"email": "theglitchking@users.noreply.github.com"
|
|
6
|
+
},
|
|
7
|
+
"metadata": {
|
|
8
|
+
"description": "Official marketplace for babel-fish - Codebase introspection and vocabulary translation for AI coding assistants",
|
|
9
|
+
"version": "1.0.1"
|
|
10
|
+
},
|
|
11
|
+
"plugins": [
|
|
12
|
+
{
|
|
13
|
+
"name": "babel-fish",
|
|
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": "1.0.1",
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "TheGlitchKing"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/TheGlitchKing/babel-fish",
|
|
20
|
+
"repository": "https://github.com/TheGlitchKing/babel-fish.git",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"codebase-context",
|
|
24
|
+
"project-map",
|
|
25
|
+
"vocabulary",
|
|
26
|
+
"developer-skill",
|
|
27
|
+
"introspection",
|
|
28
|
+
"drift-management",
|
|
29
|
+
"claude-code"
|
|
30
|
+
],
|
|
31
|
+
"category": "developer-tools",
|
|
32
|
+
"tags": [
|
|
33
|
+
"codebase-context",
|
|
34
|
+
"introspection",
|
|
35
|
+
"project-map"
|
|
36
|
+
],
|
|
37
|
+
"source": {
|
|
38
|
+
"source": "npm",
|
|
39
|
+
"package": "@theglitchking/babel-fish"
|
|
40
|
+
},
|
|
41
|
+
"strict": true
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "babel-fish",
|
|
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": "1.0.1",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "TheGlitchKing",
|
|
7
|
+
"email": "theglitchking@users.noreply.github.com"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/TheGlitchKing/babel-fish",
|
|
11
|
+
"repository": "https://github.com/TheGlitchKing/babel-fish",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"codebase-context",
|
|
14
|
+
"project-map",
|
|
15
|
+
"vocabulary",
|
|
16
|
+
"developer-skill",
|
|
17
|
+
"introspection",
|
|
18
|
+
"drift-management"
|
|
19
|
+
]
|
|
20
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 TheGlitchKing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# babel-fish
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
**Gives your AI coding assistant instant, accurate knowledge of every route, model, service, feature, and infrastructure element in your codebase.**
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[]()
|
|
9
|
+
[](https://github.com/TheGlitchKing/babel-fish)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What Does This Do?
|
|
14
|
+
|
|
15
|
+
Babel Fish creates a translation layer between a human and an LLM. It provides a natural feature-based conversation for the human, and a direct mapping to tools, targets, models, and file paths for the AI. Babel Fish auto-generates a living project map for your codebase and teaches your AI assistant your vocabulary — so you spend zero time re-explaining your project every session.
|
|
16
|
+
|
|
17
|
+
| Without Babel Fish | With Babel Fish |
|
|
18
|
+
|-------------------|-----------------|
|
|
19
|
+
| "The deals page is at `features/deal-pipeline/DealPipeline.tsx`" | *Already mapped* |
|
|
20
|
+
| AI scans 200 files to find a route | *Loads 1 section, 5KB* |
|
|
21
|
+
| Stale context after a refactor | *Pre-commit hook auto-regenerates* |
|
|
22
|
+
| Re-explain your stack every session | *Vocabulary auto-loaded on start* |
|
|
23
|
+
| "Where is the background job for invoices?" | *Checks section 08 directly* |
|
|
24
|
+
|
|
25
|
+
**In short:** Your AI assistant knows your codebase cold from the first message.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## What Gets Generated
|
|
30
|
+
|
|
31
|
+
A 19-section project map, split into focused files so the AI loads only what's relevant per task:
|
|
32
|
+
|
|
33
|
+
| Section | What It Contains |
|
|
34
|
+
|---------|-----------------|
|
|
35
|
+
| `01-vocabulary.md` | Plain-English → exact file path mapping |
|
|
36
|
+
| `02-service-topology.md` | How your services connect |
|
|
37
|
+
| `03-environment.md` | Env vars (secrets redacted) |
|
|
38
|
+
| `04-api-routes.md` | Every route with method, path, handler |
|
|
39
|
+
| `05-data-models.md` | Models and their fields |
|
|
40
|
+
| `06-schemas.md` | Validation schemas (Pydantic, Zod, etc.) |
|
|
41
|
+
| `07-services.md` | Business logic layer |
|
|
42
|
+
| `08-background-jobs.md` | Queues, workers, cron tasks |
|
|
43
|
+
| `09-frontend-features.md` | Components and pages |
|
|
44
|
+
| `10-tools-commands.md` | CLI commands and scripts |
|
|
45
|
+
| `11-migrations.md` | Database migration history |
|
|
46
|
+
| `12-import-chains.md` | Key import dependency trees |
|
|
47
|
+
| `13-frontend-backend-map.md` | Which frontend calls which API |
|
|
48
|
+
| `14-reverse-proxy.md` | Nginx/Caddy routing config |
|
|
49
|
+
| `15-auth-config.md` | Auth strategy and guards |
|
|
50
|
+
| `16-infra-profile.md` | Docker, Terraform, cloud config |
|
|
51
|
+
| `17-learned-vocabulary.md` | Aliases mined from your sessions |
|
|
52
|
+
| `18-dead-code.md` | Unused exports and orphaned files |
|
|
53
|
+
| `19-doc-pointers.md` | Links to external docs |
|
|
54
|
+
|
|
55
|
+
Plus:
|
|
56
|
+
- **`PROJECT_MAP.md`** — TOC and quick routing guide (always loaded first)
|
|
57
|
+
- **`project-vocabulary.md`** — auto-loaded every session
|
|
58
|
+
- **`operational-runbook.md`** — gotchas and deploy procedures, grows over time
|
|
59
|
+
- **Developer skill** — loads only the 2-3 sections relevant to your current task
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Install
|
|
64
|
+
|
|
65
|
+
### Option 1: npx (recommended — no curl, verified by npm registry)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Preview all changes before applying (nothing is modified)
|
|
69
|
+
npx @theglitchking/babel-fish dry-run
|
|
70
|
+
|
|
71
|
+
# Install
|
|
72
|
+
npx @theglitchking/babel-fish init
|
|
73
|
+
|
|
74
|
+
# Or target a specific project
|
|
75
|
+
npx @theglitchking/babel-fish init /path/to/your/project
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Option 2: Curl one-liner (checksum-verified)
|
|
81
|
+
|
|
82
|
+
Always preview before running anything from the internet:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Preview first — shows every file that will be created, nothing is modified
|
|
86
|
+
curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash -s -- --dry-run
|
|
87
|
+
|
|
88
|
+
# Install
|
|
89
|
+
curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash
|
|
90
|
+
|
|
91
|
+
# Or target a specific path
|
|
92
|
+
curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash -s -- /path/to/your/project
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The remote installer verifies a SHA256 checksum against `checksums.json` before executing anything. If the file has been tampered with in transit, the installer aborts.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### Option 3: Via Glitch Kingdom Marketplace (Claude Code)
|
|
100
|
+
|
|
101
|
+
Run these inside a Claude Code session:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
/plugin marketplace add TheGlitchKing/glitch-kingdom-of-plugins
|
|
105
|
+
/plugin install TheGlitchKing/babel-fish
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> The first command registers the Glitch Kingdom marketplace. You only need to run it once — after that, `/plugin install` works for all Glitch Kingdom plugins.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Option 4: Clone and run
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git clone https://github.com/TheGlitchKing/babel-fish.git
|
|
116
|
+
bash babel-fish/.claude/install.sh --dry-run /path/to/your/project # preview first
|
|
117
|
+
bash babel-fish/.claude/install.sh /path/to/your/project
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## What the Installer Does
|
|
123
|
+
|
|
124
|
+
1. Checks for Python ≥ 3.8 (installs if missing)
|
|
125
|
+
2. Detects your stack (language, framework, database, ORM, auth, infra)
|
|
126
|
+
3. Runs `generate.py` → grades with `grader.py` (iterates up to 3× until 90%+ quality)
|
|
127
|
+
4. Renders your developer skill and rules files
|
|
128
|
+
5. Installs the pre-commit hook (auto-regenerates map on source file changes)
|
|
129
|
+
6. Updates `CLAUDE.md` with a project map pointer
|
|
130
|
+
7. Prints a full quality report
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Quality Grading
|
|
135
|
+
|
|
136
|
+
Every install is graded 0–100% across 7 categories. Must score ≥ 90% to pass (up to 3 iterations):
|
|
137
|
+
|
|
138
|
+
| Category | Weight | What It Checks |
|
|
139
|
+
|----------|--------|----------------|
|
|
140
|
+
| Section completeness | 25% | All 19 sections generated |
|
|
141
|
+
| Vocabulary accuracy | 20% | Entries map to real files |
|
|
142
|
+
| Import chain validity | 15% | Chains trace to real modules |
|
|
143
|
+
| Secret safety | 15% | No API keys, passwords, or tokens leaked |
|
|
144
|
+
| Section size bounds | 10% | Each section 0.1–50KB |
|
|
145
|
+
| Structural integrity | 10% | Valid markdown, working TOC links |
|
|
146
|
+
| Checksum functionality | 5% | Re-run skips when nothing changed |
|
|
147
|
+
|
|
148
|
+
A full report is written to `.claude/project-map/reports/install-report.md`.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Using the Developer Skill
|
|
153
|
+
|
|
154
|
+
After install, a skill is available:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
/<your-project-slug>-developer
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
It reads `PROJECT_MAP.md` and uses the Quick Routing table to load only the 2-3 sections relevant to your current task — typically 5–20KB of context instead of 100KB+.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Keeping the Map Current
|
|
165
|
+
|
|
166
|
+
The pre-commit hook regenerates the map automatically whenever source files change. To force a manual regeneration:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
python .claude/project-map/generate.py --force
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
To re-grade the current output:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
python .claude/project-map/grader.py
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Learned Vocabulary
|
|
181
|
+
|
|
182
|
+
Every AI session is mined for vocabulary. When you say "the numbers page" and the AI opens `DealAnalyzerV2.tsx`, that alias is recorded with a score (frequency × recency). Aliases with a score ≥ 5 appear in `17-learned-vocabulary.md` automatically.
|
|
183
|
+
|
|
184
|
+
Run the miner manually:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
python .claude/project-map/mine-sessions.py
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Operational Runbook
|
|
193
|
+
|
|
194
|
+
`.claude/rules/operational-runbook.md` is loaded every session and grows over time. When you encounter a non-obvious operational issue, the developer skill prompts:
|
|
195
|
+
|
|
196
|
+
> "This looks like operational knowledge worth documenting. Want me to add it to the runbook? (Y/n)"
|
|
197
|
+
|
|
198
|
+
Entries follow a simple format: symptom → cause → fix. This is the anti-drift mechanism — knowledge that can't be derived from code lives here.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## File Structure
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
.claude/
|
|
206
|
+
├── project-map/
|
|
207
|
+
│ ├── generate.py # Introspection script
|
|
208
|
+
│ ├── grader.py # Quality grader
|
|
209
|
+
│ ├── mine-sessions.py # Session vocabulary miner
|
|
210
|
+
│ ├── PROJECT_MAP.md # TOC + quick routing guide
|
|
211
|
+
│ ├── sections/ # 19 focused section files
|
|
212
|
+
│ ├── reports/ # Install and iteration reports
|
|
213
|
+
│ ├── checksums.json # Skip regeneration if unchanged
|
|
214
|
+
│ └── learned-vocabulary.json # Persisted session aliases
|
|
215
|
+
├── rules/
|
|
216
|
+
│ ├── project-vocabulary.md # Auto-loaded every session
|
|
217
|
+
│ └── operational-runbook.md # Auto-loaded every session
|
|
218
|
+
└── skills/
|
|
219
|
+
└── <project>-developer-skill/
|
|
220
|
+
└── SKILL.md
|
|
221
|
+
.githooks/
|
|
222
|
+
├── pre-commit # Auto-regenerates map on commit
|
|
223
|
+
└── install.sh # Register hooks: bash .githooks/install.sh
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Supported Stacks
|
|
229
|
+
|
|
230
|
+
| Language | Frameworks |
|
|
231
|
+
|----------|-----------|
|
|
232
|
+
| Python | FastAPI, Django, Flask |
|
|
233
|
+
| TypeScript / JavaScript | Next.js, NestJS, Express, React, Vue, Svelte |
|
|
234
|
+
| Go | Gin, Echo, Chi, stdlib |
|
|
235
|
+
| Java | Spring Boot |
|
|
236
|
+
| Any | docker-compose, nginx, Caddy, Terraform, Prisma, SQLAlchemy, TypeORM |
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Requirements
|
|
241
|
+
|
|
242
|
+
- AI coding assistant (Claude Code, Cursor, or compatible)
|
|
243
|
+
- Python ≥ 3.8 (auto-installed if missing)
|
|
244
|
+
- Bash
|
|
245
|
+
- Optional: `pip install pyyaml` for docker-compose YAML parsing (regex fallback included)
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Commands
|
|
250
|
+
|
|
251
|
+
| Command | What It Does |
|
|
252
|
+
|---------|-------------|
|
|
253
|
+
| `python .claude/project-map/generate.py --force` | Force-regenerate project map |
|
|
254
|
+
| `python .claude/project-map/grader.py` | Grade map quality (0–100%) |
|
|
255
|
+
| `python .claude/project-map/mine-sessions.py` | Mine session vocabulary |
|
|
256
|
+
| `bash .githooks/install.sh` | (Re)install git hooks |
|
|
257
|
+
| `bash .claude/install.sh` | Re-run full plugin installer |
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## License
|
|
262
|
+
|
|
263
|
+
MIT — see [LICENSE](LICENSE)
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
**Made by [TheGlitchKing](https://github.com/TheGlitchKing)**
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { execSync, spawnSync } = require('child_process');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const INSTALL_SH = path.join(__dirname, '..', '.claude', 'install.sh');
|
|
9
|
+
const args = process.argv.slice(2);
|
|
10
|
+
const command = args[0] || 'init';
|
|
11
|
+
|
|
12
|
+
const helpText = `
|
|
13
|
+
babel-fish — gives your AI assistant instant codebase context
|
|
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
|
+
`;
|
|
31
|
+
|
|
32
|
+
function requireBash() {
|
|
33
|
+
const result = spawnSync('bash', ['--version'], { stdio: 'ignore' });
|
|
34
|
+
if (result.status !== 0) {
|
|
35
|
+
console.error(' ✗ bash is required but not found.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function run(bashArgs, opts = {}) {
|
|
41
|
+
requireBash();
|
|
42
|
+
const result = spawnSync('bash', bashArgs, {
|
|
43
|
+
stdio: 'inherit',
|
|
44
|
+
...opts,
|
|
45
|
+
});
|
|
46
|
+
if (result.status !== 0) process.exit(result.status);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
switch (command) {
|
|
50
|
+
case 'init':
|
|
51
|
+
case '--auto': {
|
|
52
|
+
const target = args[1] || process.cwd();
|
|
53
|
+
console.log(`\n babel-fish init → ${target}\n`);
|
|
54
|
+
run([INSTALL_SH, target]);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
case 'dry-run': {
|
|
59
|
+
const target = args[1] || process.cwd();
|
|
60
|
+
run([INSTALL_SH, '--dry-run', target]);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case 'regen': {
|
|
65
|
+
const generatePy = path.join(process.cwd(), '.claude', 'project-map', 'generate.py');
|
|
66
|
+
if (!fs.existsSync(generatePy)) {
|
|
67
|
+
console.error(' ✗ .claude/project-map/generate.py not found. Run `babel-fish init` first.');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
run(['python3', generatePy, '--force'], { shell: false });
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
case 'grade': {
|
|
75
|
+
const graderPy = path.join(process.cwd(), '.claude', 'project-map', 'grader.py');
|
|
76
|
+
if (!fs.existsSync(graderPy)) {
|
|
77
|
+
console.error(' ✗ .claude/project-map/grader.py not found. Run `babel-fish init` first.');
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
spawnSync('python3', [graderPy], { stdio: 'inherit' });
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
case 'help':
|
|
85
|
+
case '--help':
|
|
86
|
+
case '-h':
|
|
87
|
+
console.log(helpText);
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
default:
|
|
91
|
+
console.error(` Unknown command: ${command}`);
|
|
92
|
+
console.log(helpText);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
package/checksums.json
ADDED
package/install.sh
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Babel Fish — Remote Installer
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash
|
|
6
|
+
# curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash -s -- /path/to/project
|
|
7
|
+
# curl -sSL https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/install.sh | bash -s -- --dry-run
|
|
8
|
+
#
|
|
9
|
+
# What this script does (readable before you run it):
|
|
10
|
+
# 1. Creates a temp dir
|
|
11
|
+
# 2. git clone --depth=1 https://github.com/TheGlitchKing/babel-fish.git into it
|
|
12
|
+
# 3. Runs .claude/install.sh <target> from the cloned copy
|
|
13
|
+
# 4. Deletes the temp dir on exit
|
|
14
|
+
#
|
|
15
|
+
# Nothing is written outside of <target>/.claude/ and <target>/.githooks/
|
|
16
|
+
# Run with --dry-run to preview all changes without applying them.
|
|
17
|
+
|
|
18
|
+
set -euo pipefail
|
|
19
|
+
|
|
20
|
+
REPO="https://github.com/TheGlitchKing/babel-fish.git"
|
|
21
|
+
CHECKSUM_URL="https://raw.githubusercontent.com/TheGlitchKing/babel-fish/main/checksums.json"
|
|
22
|
+
TMP_DIR="$(mktemp -d)"
|
|
23
|
+
TARGET=""
|
|
24
|
+
DRY_RUN_FLAG=""
|
|
25
|
+
|
|
26
|
+
# Parse args
|
|
27
|
+
for arg in "$@"; do
|
|
28
|
+
case "$arg" in
|
|
29
|
+
--dry-run) DRY_RUN_FLAG="--dry-run" ;;
|
|
30
|
+
-*) ;;
|
|
31
|
+
*) TARGET="$arg" ;;
|
|
32
|
+
esac
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
TARGET="${TARGET:-$(pwd)}"
|
|
36
|
+
|
|
37
|
+
cleanup() { rm -rf "$TMP_DIR"; }
|
|
38
|
+
trap cleanup EXIT
|
|
39
|
+
|
|
40
|
+
echo ""
|
|
41
|
+
echo " Babel Fish — Remote Installer"
|
|
42
|
+
echo " Repository: $REPO"
|
|
43
|
+
echo " Target: $TARGET"
|
|
44
|
+
if [ -n "$DRY_RUN_FLAG" ]; then
|
|
45
|
+
echo " Mode: DRY RUN (preview only, nothing will be modified)"
|
|
46
|
+
fi
|
|
47
|
+
echo ""
|
|
48
|
+
|
|
49
|
+
# Verify checksum if sha256sum is available
|
|
50
|
+
if command -v sha256sum >/dev/null 2>&1 && command -v curl >/dev/null 2>&1; then
|
|
51
|
+
echo " Fetching checksum manifest..."
|
|
52
|
+
CHECKSUMS_JSON="$(curl -sSL "$CHECKSUM_URL" 2>/dev/null || echo "")"
|
|
53
|
+
if [ -n "$CHECKSUMS_JSON" ]; then
|
|
54
|
+
EXPECTED_SHA="$(echo "$CHECKSUMS_JSON" | grep -o '"install_sh": *"[^"]*"' | grep -o '[a-f0-9]\{64\}' || echo "")"
|
|
55
|
+
if [ -n "$EXPECTED_SHA" ]; then
|
|
56
|
+
# Clone and verify
|
|
57
|
+
echo " Cloning plugin source..."
|
|
58
|
+
git clone --depth=1 --quiet "$REPO" "$TMP_DIR/babel-fish"
|
|
59
|
+
ACTUAL_SHA="$(sha256sum "$TMP_DIR/babel-fish/.claude/install.sh" | cut -d' ' -f1)"
|
|
60
|
+
if [ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]; then
|
|
61
|
+
echo ""
|
|
62
|
+
echo " ✗ CHECKSUM MISMATCH — aborting for your safety."
|
|
63
|
+
echo " Expected: $EXPECTED_SHA"
|
|
64
|
+
echo " Got: $ACTUAL_SHA"
|
|
65
|
+
echo ""
|
|
66
|
+
echo " This may indicate the file was tampered with in transit."
|
|
67
|
+
echo " Please report this at https://github.com/TheGlitchKing/babel-fish/issues"
|
|
68
|
+
exit 1
|
|
69
|
+
fi
|
|
70
|
+
echo " ✓ Checksum verified"
|
|
71
|
+
else
|
|
72
|
+
echo " Cloning plugin source..."
|
|
73
|
+
git clone --depth=1 --quiet "$REPO" "$TMP_DIR/babel-fish"
|
|
74
|
+
fi
|
|
75
|
+
else
|
|
76
|
+
echo " Cloning plugin source..."
|
|
77
|
+
git clone --depth=1 --quiet "$REPO" "$TMP_DIR/babel-fish"
|
|
78
|
+
fi
|
|
79
|
+
else
|
|
80
|
+
echo " Cloning plugin source..."
|
|
81
|
+
git clone --depth=1 --quiet "$REPO" "$TMP_DIR/babel-fish"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
echo " Running installer..."
|
|
85
|
+
echo ""
|
|
86
|
+
bash "$TMP_DIR/babel-fish/.claude/install.sh" $DRY_RUN_FLAG "$TARGET"
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theglitchking/babel-fish",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Gives your AI coding assistant instant, accurate knowledge of every route, model, service, feature, and infrastructure element in your codebase.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"babel-fish": "bin/babel-fish.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node bin/babel-fish.js init --auto"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
".claude-plugin/",
|
|
14
|
+
"skills/",
|
|
15
|
+
"install.sh",
|
|
16
|
+
"checksums.json",
|
|
17
|
+
"LICENSE",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"codebase-context",
|
|
22
|
+
"project-map",
|
|
23
|
+
"vocabulary",
|
|
24
|
+
"developer-skill",
|
|
25
|
+
"ai",
|
|
26
|
+
"llm",
|
|
27
|
+
"ai-coding",
|
|
28
|
+
"context-management"
|
|
29
|
+
],
|
|
30
|
+
"author": "TheGlitchKing",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/TheGlitchKing/babel-fish.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/TheGlitchKing/babel-fish",
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=16.0.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: babel-fish-developer-skill
|
|
3
|
+
description: |
|
|
4
|
+
Full-stack developer context for any project with Babel Fish installed.
|
|
5
|
+
Provides instant access to project map, vocabulary translation, and infrastructure details.
|
|
6
|
+
Invoke when working on any feature, bug, or infrastructure task.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /babel-fish-developer — Developer Context
|
|
10
|
+
|
|
11
|
+
You are a developer working on this project. This skill gives you complete
|
|
12
|
+
knowledge of every route, model, service, feature, and infrastructure component
|
|
13
|
+
via an auto-generated project map.
|
|
14
|
+
|
|
15
|
+
## On Trigger — Load Only What You Need
|
|
16
|
+
|
|
17
|
+
The project map is split into section files at `.claude/project-map/sections/`.
|
|
18
|
+
Do NOT read them all. Start with:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Read: .claude/project-map/PROJECT_MAP.md
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use the Quick Routing table to pick which 2-3 sections to load.
|
|
25
|
+
|
|
26
|
+
## Section Routing
|
|
27
|
+
|
|
28
|
+
| Task | Read These Sections |
|
|
29
|
+
|------|-------------------|
|
|
30
|
+
| Feature / UX work | 01-vocabulary → 09-frontend → 04-routes |
|
|
31
|
+
| Add a model or field | 05-models → 06-schemas → 12-import-chains |
|
|
32
|
+
| Troubleshoot error | 02-topology → 03-environment → 14-proxy |
|
|
33
|
+
| Infrastructure / scaling | 16-infra-profile → 02-topology |
|
|
34
|
+
| Auth / security | 15-auth-config → 19-doc-pointers |
|
|
35
|
+
| What tools exist | 10-tools-commands |
|
|
36
|
+
| Background jobs | 08-background-jobs |
|
|
37
|
+
|
|
38
|
+
## Keeping the Map Current
|
|
39
|
+
|
|
40
|
+
Regenerates automatically via pre-commit hook.
|
|
41
|
+
Force: `python .claude/project-map/generate.py --force`
|
|
42
|
+
|
|
43
|
+
## Growing the Runbook
|
|
44
|
+
|
|
45
|
+
When you encounter a non-obvious operational issue, suggest adding it:
|
|
46
|
+
|
|
47
|
+
> "This looks like operational knowledge worth documenting. Want me to add it
|
|
48
|
+
> to the runbook? (Y/n)"
|
|
49
|
+
|
|
50
|
+
If agreed, append a concise entry (symptom → cause → fix) to
|
|
51
|
+
`.claude/rules/operational-runbook.md`.
|