Skip to content

Add Forge Code as a gstack host#1367

Closed
edbienes wants to merge 6 commits intogarrytan:mainfrom
edbienes:add-forgecode-host
Closed

Add Forge Code as a gstack host#1367
edbienes wants to merge 6 commits intogarrytan:mainfrom
edbienes:add-forgecode-host

Conversation

@edbienes
Copy link
Copy Markdown

@edbienes edbienes commented May 8, 2026

Summary

Add Forge Code (CLI: forge) as a first-class gstack host so users can install generated gstack skills with ./setup --host forgecode and bun run gen:skill-docs --host forgecode.

Context

The host system is declarative: each supported coding agent is defined by a typed HostConfig, then registered in hosts/index.ts. This follows docs/ADDING_A_HOST.md without adding generator, setup, or installer-specific logic.

Changes

  • Add hosts/forgecode.ts with Forge Code paths, frontmatter handling, tool/path rewrites, suppressed resolvers, runtime assets, install behavior, and co-author trailer.
  • Register Forge Code in the host registry and re-export list.
  • Ignore generated .forgecode/ skill output.
  • Update host config and generated-doc tests for the 11th host.
  • Document Forge Code install and uninstall paths in the README.
  • Add ./setup --host forgecode support, including auto detection via forge, generation, runtime-root setup, and generated skill linking.
  • Make skill:check respect primary-host skipped skills so Claude-only skipped templates do not fail health checks.

Key Implementation Details

Forge Code does not need a custom adapter module. String rewrites cover the relevant semantics: Claude paths are rewritten to .forgecode/skills/gstack, CLAUDE.md references become AGENTS.md, and Claude tool prose is mapped to Forge Code-style tools such as shell, patch, fs_search, and sage.

Testing

  • bun run gen:skill-docs --host forgecode
  • bun run scripts/host-config-export.ts validateAll 11 configs valid
  • bun test test/host-config.test.ts → 73 pass
  • bun test test/gen-skill-docs.test.ts → 387 pass
  • bun run build → passes

Known Notes

Earlier full-suite runs exceeded the 5-minute command window in this environment. The Forge-related host, generator, setup, and build validation pass.

Out of Scope

If Forge Code's tool model diverges further later, a follow-up can add a dedicated scripts/host-adapters/forgecode-adapter.ts per docs/ADDING_A_HOST.md.


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

edbienes and others added 2 commits May 8, 2026 08:56
Co-Authored-By: Forge Code <noreply@forgecode.dev>
Co-Authored-By: Forge Code <noreply@forgecode.dev>
@edbienes
Copy link
Copy Markdown
Author

edbienes commented May 8, 2026

Pre-landing review

Ran a full review (Claude structured + specialist subagents + Claude adversarial + Codex adversarial). Three fixes applied and pushed:

Fixed:

  • setup:167command -v forgeforge agent --help >/dev/null 2>&1. forge is also Foundry's Ethereum toolkit binary name; the subcommand check is unambiguous.
  • hosts/forgecode.ts — removed two identity no-op tool rewrites ('use the Read tool': 'use the Read tool' etc.).
  • VERSION bumped 1.27.1.0 → 1.27.2.0, package.json synced, CHANGELOG entry written.

No critical issues found beyond the forge detection fix. Pass 1 (SQL, race conditions, LLM trust, shell injection, enum completeness) — clean. Slop scan — no new findings.

Informational only (not blocking):

  • Testing specialist found 8 missing assertions (forgecode cliAlias, suppressedResolvers, toolRewrites, coAuthorTrailer, CLAUDE.md→AGENTS.md rewrite, symlinks test, runtime root body test, sidecar-skip guard test) — all mirror patterns that other hosts have in test/host-config.test.ts.
  • create_forgecode_runtime_root and link_forgecode_skill_dirs are near-copies of the opencode equivalents — established per-host pattern, low urgency to extract.
  • return 1 under set -e in the linking functions is pre-existing in opencode/factory; copied faithfully here.

785 tests pass post-fix.

…sion bump

- Change forge auto-detect from `command -v forge` to `forge agent --help`
  to distinguish Forge Code from Foundry's forge (same binary name)
- Remove identity no-op tool rewrites from hosts/forgecode.ts
- Bump VERSION/package.json 1.27.1.0 → 1.27.2.0
- Write CHANGELOG entry for this branch
- Update test to assert forge agent --help detection pattern
@edbienes edbienes force-pushed the add-forgecode-host branch from f31ffb0 to fb1fbac Compare May 8, 2026 03:11
edbienes added 3 commits May 8, 2026 11:23
CHANGELOG.md, VERSION, and package.json conflicted because upstream
landed v1.28.0.0 (browse --proxy/--headed/--navigate + llms.txt)
while this branch held v1.27.2.0. Resolution: keep both entries,
bump Forge Code to v1.29.0.0 (new host = MINOR bump on top of main).
…covers them

Forge Code 2.x discovers user skills from ~/.agents/skills/, not
~/.forgecode/skills/ where 1.29.0.0 installed them. `forge list skill`
reported only the 4 built-in skills even after a clean install.

Two bugs fixed:

1. Wrong install path. setup now writes to $HOME/.agents/skills/ and
   hosts/forgecode.ts globalRoot + pathRewrites bake the correct
   ~/.agents/skills/gstack path into generated SKILL.md files.

2. Symlinked directories aren't discovered. Forge only picks up real
   top-level directories whose immediate child is SKILL.md.
   link_forgecode_skill_dirs now mirrors the Claude install pattern:
   real dir + symlinked SKILL.md inside.

Existing installs at the legacy ~/.forgecode/skills/ location are
migrated (cleaned up) on the next `./setup --host forgecode` run.

Verified: `forge list skill --porcelain | wc -l` went from 6 to 51
(header + 4 builtins + gstack root + 46 gstack-* skills).

Bumps to 1.29.1.0.
Other harnesses that share ~/.agents/skills/ (notably pi-coding-agent)
reject SKILL.md when the `name:` frontmatter doesn't match the parent
directory. With our prefixed install (gstack-autoplan/, gstack-qa/,
etc.), every gstack skill triggered a 'Skill conflicts' warning at
startup.

The install now copies (rather than symlinks) SKILL.md into
~/.agents/skills/gstack-X/ and patches the `name:` field in the copy
to match the prefixed parent directory. The build output under
.forgecode/skills/ is left untouched so the dry-run freshness check
keeps passing.

Also: bin/gstack-patch-names now passes --color=never to grep so
colorized aliases don't poison the parsed name field on machines
where grep aliases color output.

Verified:
- pi conflict warnings cleared (47 entries fixed)
- forge list skill still finds all 47 (gstack-* names, runtime root, builtins)
- find-skills (sibling skill) untouched
- bun run scripts/gen-skill-docs.ts --host forgecode --dry-run passes
- bun test test/gen-skill-docs.test.ts test/host-config.test.ts: 460 pass
@garrytan
Copy link
Copy Markdown
Owner

Thanks @edbienes — closing as deferred. New host integration (Forge Code) needs focused review separate from a wave. Happy to revisit as a focused PR with the host-add checklist.

@garrytan garrytan closed this May 10, 2026
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