Skip to content

feat: usability round — dynamic stack detection, more languages, self-update, quiet CLI, self-dogfood#49

Merged
CodeWithJuber merged 2 commits into
masterfrom
claude/forge-work-system-setup-p26ka5
Jul 10, 2026
Merged

feat: usability round — dynamic stack detection, more languages, self-update, quiet CLI, self-dogfood#49
CodeWithJuber merged 2 commits into
masterfrom
claude/forge-work-system-setup-p26ka5

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

Four day-to-day usability gaps the owner hit, plus a ReDoS fix caught in review. Standing directive: dynamic & smart over static hardcoded lists.

  • Tech was limited & static. The atlas parsed only 6 language families and "stack detection" was just existsSync(package.json).
    • forge stack (src/stack.js) reads the repo's real dependency manifests (package.json, pyproject.toml, go.mod, Cargo.toml, Gemfile, composer.json, pom.xml/build.gradle, *.csproj) → languages, frameworks, package managers, and the actual test commands, which now feed the substrate's verification checklist instead of assuming npm. Data-driven (extend by a row), fail-safe on every manifest.
    • Six more atlas languages — Ruby, C#, PHP, Kotlin, Swift, C/C++ (+ Java method defs). One RULES table; the walk, completion gate, and docs sweep pick each up via CODE_EXTS.
  • No auto-update. forge update (src/update.js): --check reports commits-behind-upstream (cached hourly fetch); bare applies (git pull --ff-only for a checkout, or the npm i -g command). forge doctor shows a non-nagging notice (FORGE_NO_UPDATE_CHECK=1 silences). Fail-open on offline / non-git / detached HEAD.
  • Project name on every command. The Forge <cmd> — title line is now behind --verbose/FORGE_VERBOSE; commands emit their result first. The --help/--version banner is unchanged.
  • Repo didn't dogfood its plugin. A committed .claude/settings.json wires forgekit's own guards via ${CLAUDE_PROJECT_DIR}, so the repo runs its own completion gate / cortex / guards in local dev.

Checklist

  • npm test passes (Node 18/20/22) — 632 tests, 630 pass / 2 skipped, 12 new
  • npm run check passes (Biome lint + format)
  • New public functions have a test
  • Conventional commit message (feat:/fix:/docs: …)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency (dev deps ok) — Node built-ins only
  • Substrate/docs updated if this changes forge substrate, forge impact, router/gate, or MCP substrate tools — GUIDE (forge stack / forge update sections, env rows), ARCHITECTURE, README; forge docs check passes

Risk & rollback

  • Risk level: low — new commands are additive; forge update and the doctor notice are fail-open (offline/non-git/detached-HEAD return "unknown", never error); the quiet-CLI change is cosmetic and reversible with FORGE_VERBOSE=1.
  • ReDoS caught in review: the shared Java/C# method grammar backtracked polynomially on pathological input (public static public static …: 5.2s). Rewritten line-anchored + {0,6}-bounded → 26ms, with a regression test. These regexes run over every file in a repo, so this mattered.
  • Rollback plan: revert the branch commit; or operationally FORGE_VERBOSE=1 (restore titles), FORGE_NO_UPDATE_CHECK=1 (silence the notice), delete .claude/settings.json (un-dogfood).

Extra checks (tick if applicable)

  • npm run typecheck passes
  • Input validated at boundaries; errors handled (no swallowing) — every stack detector and update path is fail-safe by contract; refusals return typed reasons
  • Authorization/ownership checked (if it touches access) — n/a
  • Logs contain no secrets/PII — no secret-shaped output; test fixtures are synthetic
  • If AI-assisted: I understand it, verified the package APIs, and it has tests

🤖 Generated with Claude Code

https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2


Generated by Claude Code

claude added 2 commits July 10, 2026 18:02
…LI, self-dogfood

Four owner-requested improvements, plus a ReDoS fix found in review.

Tech (dynamic + broader):
- src/stack.js + `forge stack`: detect the repo's REAL stack by reading its
  manifests (package.json/pyproject/go.mod/Cargo.toml/Gemfile/composer.json/
  pom.xml·gradle/*.csproj) → languages, frameworks, package managers, and the
  actual test commands, which now feed substrate's verification checklist.
  Data-driven (add a row, not code), fail-safe on every manifest.
- atlas RULES gains Ruby, C#, PHP, Kotlin, Swift, C/C++ (and Java method defs).
  One registry; the walk, completion gate, and docs sweep pick each up via
  CODE_EXTS. The shared Java/C# method grammar is line-anchored and {0,6}-bounded
  after review caught polynomial backtracking (5.2s → 26ms on a pathological
  file); a ReDoS regression test pins it.

Auto-update:
- src/update.js + `forge update` (`--check` reports commits-behind-upstream from a
  cached hourly fetch; bare applies via ff-only pull, or hands back `npm i -g`).
  doctor surfaces a non-nagging notice (FORGE_NO_UPDATE_CHECK=1 silences).
  Fail-open on offline / non-git / detached HEAD.

Quiet CLI:
- The `Forge <cmd> —` title line is now behind `--verbose`/FORGE_VERBOSE; commands
  emit their result first. The --help/--version banner is unchanged.

Self-dogfood:
- .claude/settings.json wires forgekit's own guards via ${CLAUDE_PROJECT_DIR}, so
  the repo runs its own completion gate / cortex / guards in local dev.

Docs (README/GUIDE/ARCHITECTURE) + CHANGELOG updated; `forge docs check` green.
620 tests → 632 (12 new), biome + typecheck clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
…ix detection

Two verified findings from the review of this branch:

- HIGH: the C/C++ function regex `^[\w*\s]+?…\{` had the same ReDoS class as
  the Java/C# one — `\s` crossed newlines and the lazy run scanned the whole
  file from every line start, O(n²). A 445 KB header of prototype declarations
  took 13s (and build() runs on the Stop-hook path, so it could freeze a
  session). Rewritten line-anchored and linear: ≤4 whitespace-separated type
  tokens + name + `(args){` with args excluding `;{}` and newlines. Requiring a
  same-line brace also correctly rejects prototypes. 13s → 13ms; regression test
  added (12k-declaration header must build < 1s).
- LOW: `forge stack` never detected Remix — the scoped signature `@remix-run/`
  was matched with exact array `.includes`, which can't equal `@remix-run/react`.
  Node signatures now match exact-or-`@scope/`-prefix, which also avoids the
  `preact`→React / `next-auth`→Next.js false positives a naive substring match
  would introduce. Regression test pins both directions.

The reviewer confirmed the rest fail-open: update.js (offline/non-git/detached
HEAD/dirty-tree pull), stack.js (string/array deps, monorepo, corrupt manifest),
the quiet-CLI refactor (no command reduced to silence), and the dogfood settings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019PXuKmJp92Gdo2FudNjSx2
@CodeWithJuber CodeWithJuber marked this pull request as ready for review July 10, 2026 20:27
@CodeWithJuber CodeWithJuber merged commit 31eb862 into master Jul 10, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants