@theglitchking/babel-fish 2.0.0 → 2.0.2

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.
@@ -456,7 +456,6 @@ CLAUDEMD
456
456
  # ║ MAIN FLOW ║
457
457
  # ╚══════════════════════════════════════════════════════════════════════════╝
458
458
 
459
- clear
460
459
  printf '%b\n' "
461
460
  ${CYAN}${BOLD}
462
461
  ╔══════════════════════════════════════════╗
@@ -13,7 +13,6 @@ import ast
13
13
  import argparse
14
14
  import hashlib
15
15
  import json
16
- import os
17
16
  import re
18
17
  import subprocess
19
18
  import sys
@@ -565,7 +564,6 @@ class MigrationParser:
565
564
  source = f.read_text(encoding='utf-8', errors='replace')
566
565
  rev = re.search(r'revision\s*=\s*[\'"]([^\'"]+)[\'"]', source)
567
566
  down = re.search(r'down_revision\s*=\s*[\'"]?([^\'")\n]+)[\'"]?', source)
568
- msg = re.search(r'Create Date.*\n.*"""(.+?)"""', source, re.DOTALL)
569
567
  tables = re.findall(r'op\.(?:create_table|drop_table|add_column)\s*\(\s*[\'"]([^\'"]+)[\'"]', source)
570
568
  migrations.append({
571
569
  'revision': rev.group(1) if rev else f.stem,
@@ -603,19 +601,32 @@ class FrontendScanner:
603
601
  FEATURE_DIRS = {'features', 'pages', 'views', 'screens', 'modules', 'app'}
604
602
  COMPONENT_EXTS = {'.tsx', '.jsx'}
605
603
  HOOK_PATTERN = re.compile(r'^use[A-Z]')
604
+ # Candidate bases to search for the FEATURE_DIRS, relative to PROJECT_ROOT.
605
+ # Covers repo-root and src/ layouts plus monorepos where the frontend is a
606
+ # subpackage (e.g. frontend/src/features), not just at the repo root.
607
+ SEARCH_PREFIXES = ('', 'src', 'frontend', 'frontend/src',
608
+ 'web', 'web/src', 'client', 'client/src', 'ui', 'ui/src')
606
609
 
607
610
  def scan(self) -> list[dict]:
608
- features = []
609
- for feat_dir_name in self.FEATURE_DIRS:
610
- feat_dir = PROJECT_ROOT / feat_dir_name
611
- if not feat_dir.exists():
612
- # try nested src/
613
- feat_dir = PROJECT_ROOT / 'src' / feat_dir_name
614
- if not feat_dir.is_dir():
615
- continue
616
- for entry in sorted(feat_dir.iterdir()):
617
- if entry.is_dir() and not entry.name.startswith('.'):
611
+ features, seen = [], set()
612
+ for prefix in self.SEARCH_PREFIXES:
613
+ base = PROJECT_ROOT / prefix if prefix else PROJECT_ROOT
614
+ for feat_dir_name in self.FEATURE_DIRS:
615
+ feat_dir = base / feat_dir_name
616
+ if not feat_dir.is_dir():
617
+ continue
618
+ for entry in sorted(feat_dir.iterdir()):
619
+ if not (entry.is_dir() and not entry.name.startswith('.')):
620
+ continue
621
+ rp = entry.resolve()
622
+ if rp in seen:
623
+ continue # already counted via another prefix
618
624
  stats = self._scan_feature_dir(entry)
625
+ # Only emit dirs that actually contain frontend components, so a
626
+ # backend package named e.g. 'app/' is not misread as a feature.
627
+ if stats['component_count'] + stats['hook_count'] == 0:
628
+ continue
629
+ seen.add(rp)
619
630
  stats['name'] = entry.name
620
631
  stats['path'] = str(entry.relative_to(PROJECT_ROOT))
621
632
  features.append(stats)
@@ -1200,7 +1211,7 @@ def build_auth_section(auth_info: dict) -> str:
1200
1211
 
1201
1212
  def build_infra_section(stack: dict, services: list[dict]) -> str:
1202
1213
  lines = ["# Section 16 — Infrastructure Profile\n\n",
1203
- f"| Property | Value |",
1214
+ "| Property | Value |",
1204
1215
  "|----------|-------|",
1205
1216
  f"| **Language** | {stack.get('language','?')} |",
1206
1217
  f"| **Framework** | {stack.get('framework','?')} |",
@@ -1289,14 +1300,13 @@ def build_project_map(
1289
1300
  ) -> str:
1290
1301
  now = datetime.now().strftime('%Y-%m-%d %H:%M')
1291
1302
  name = stack.get('name', PROJECT_ROOT.name)
1292
- slug = stack.get('slug', name)
1293
1303
 
1294
1304
  lines = [
1295
1305
  f"# {name} — Project Map\n",
1296
1306
  f"> Auto-generated by `generate.py` on {now}. Do not edit manually.\n\n",
1297
- f"## Stats\n",
1298
- f"| Metric | Count |",
1299
- f"|--------|-------|",
1307
+ "## Stats\n",
1308
+ "| Metric | Count |",
1309
+ "|--------|-------|",
1300
1310
  f"| API Routes | {len(routes)} |",
1301
1311
  f"| Data Models | {len(models)} |",
1302
1312
  f"| Schemas/DTOs | {len(schemas)} |",
@@ -1354,7 +1364,7 @@ def build_project_map(
1354
1364
  "| Background jobs | 08 |",
1355
1365
  "| Migration history | 11 |",
1356
1366
  "",
1357
- f"## Regenerate\n",
1367
+ "## Regenerate\n",
1358
1368
  "```bash",
1359
1369
  "python .claude/project-map/generate.py # skip if unchanged",
1360
1370
  "python .claude/project-map/generate.py --force # always regenerate",
@@ -0,0 +1,6 @@
1
+ {
2
+ "enabledMcpjsonServers": [
3
+ "semantic-vault"
4
+ ],
5
+ "enableAllProjectMcpServers": true
6
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.0.2] - 2026-06-08
6
+
7
+ ### Fixed
8
+
9
+ - Internal lint cleanup in `generate.py`: removed an unused `os` import and
10
+ two unused local variables, and dropped the `f` prefix from five
11
+ placeholder-less f-strings (ruff F401/F841/F541). No behavior change.
12
+
13
+ ## [2.0.1] - 2026-06-08
14
+
15
+ ### Fixed
16
+
17
+ - **Frontend feature scanner now detects monorepo layouts.** `FrontendScanner`
18
+ previously looked for `features/`, `pages/`, `views/`, etc. only at the repo
19
+ root or under a top-level `src/`. Projects that keep the frontend in a
20
+ subpackage (e.g. `frontend/src/features/`, the common React/Vite plus Python
21
+ backend split) were reported as "No frontend feature directories detected,"
22
+ leaving project-map sections 09 (Frontend Features) and 13 (Frontend to
23
+ Backend Map) empty. The scanner now searches `frontend/`, `web/`, `client/`,
24
+ and `ui/` (each with an optional `src/`) in addition to the repo root and
25
+ `src/`, dedupes by resolved path, and only emits directories that actually
26
+ contain `.jsx`/`.tsx` files so a backend package named `app/` is not
27
+ misclassified as a frontend feature.
28
+
5
29
  ## [2.0.0] — 2026-04-19
6
30
 
7
31
  ### Breaking changes
package/README.md CHANGED
@@ -8,6 +8,9 @@
8
8
  [![Status: Production Ready](https://img.shields.io/badge/Status-Production%20Ready-green.svg)]()
9
9
  [![GitHub: TheGlitchKing/babel-fish](https://img.shields.io/badge/GitHub-TheGlitchKing%2Fbabel--fish-blue)](https://github.com/TheGlitchKing/babel-fish)
10
10
 
11
+ > [!NOTE]
12
+ > **Pairs with [`semantic-memory`](https://github.com/TheGlitchKing/semantic-sidekick) (formerly `semantic-sidekick`).** When both are installed, semantic-memory consumes babel-fish's auto-generated `.babel-fish/` output as a `project-map` corpus AND extracts `01-vocabulary.md` into a structured `glossary.json` side-channel. That gives your AI a deterministic `translate("deals page") → "features/deal-pipeline/DealPipeline.tsx"` MCP verb instead of relying on semantic-search-luck. See [`docs/glossary-contract.md`](./docs/glossary-contract.md) for the producer/consumer data contract and [`docs/integration-with-semantic-memory.md`](./docs/integration-with-semantic-memory.md) for the setup walkthrough. babel-fish standalone behavior is unchanged — semantic-memory is purely additive.
13
+
11
14
  ---
12
15
 
13
16
  ## What Does This Do?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theglitchking/babel-fish",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Gives your AI coding assistant instant, accurate knowledge of every route, model, service, feature, and infrastructure element in your codebase.",
5
5
  "type": "module",
6
6
  "bin": {