From 5bc00fc112da9acf217603a84cd2549fff0d6b31 Mon Sep 17 00:00:00 2001 From: Ed Bienes Date: Fri, 8 May 2026 08:56:09 +0800 Subject: [PATCH 1/5] feat(hosts): add Forge Code host Co-Authored-By: Forge Code --- .gitignore | 1 + README.md | 4 ++- hosts/forgecode.ts | 71 ++++++++++++++++++++++++++++++++++++++++ hosts/index.ts | 5 +-- scripts/skill-check.ts | 11 ++++--- test/host-config.test.ts | 6 ++-- 6 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 hosts/forgecode.ts diff --git a/.gitignore b/.gitignore index 979bc17c73..0e45c4d0e2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ bin/gstack-global-discover .cursor/ .openclaw/ .hermes/ +.forgecode/ .gbrain/ .context/ extension/.auth.json diff --git a/README.md b/README.md index dcab7cf213..339d96f4aa 100644 --- a/README.md +++ b/README.md @@ -101,7 +101,7 @@ These are conversational skills. Your OpenClaw agent runs them directly via chat ### Other AI Agents -gstack works on 10 AI coding agents, not just Claude. Setup auto-detects which +gstack works on 11 AI coding agents, not just Claude. Setup auto-detects which agents you have installed: ```bash @@ -117,6 +117,7 @@ Or target a specific agent with `./setup --host `: | OpenCode | `--host opencode` | `~/.config/opencode/skills/gstack-*/` | | Cursor | `--host cursor` | `~/.cursor/skills/gstack-*/` | | Factory Droid | `--host factory` | `~/.factory/skills/gstack-*/` | +| Forge Code | `--host forgecode` | `~/.forgecode/skills/gstack-*/` | | Slate | `--host slate` | `~/.slate/skills/gstack-*/` | | Kiro | `--host kiro` | `~/.kiro/skills/gstack-*/` | | Hermes | `--host hermes` | `~/.hermes/skills/gstack-*/` | @@ -343,6 +344,7 @@ rm -rf ~/.codex/skills/gstack* 2>/dev/null rm -rf ~/.factory/skills/gstack* 2>/dev/null rm -rf ~/.kiro/skills/gstack* 2>/dev/null rm -rf ~/.openclaw/skills/gstack* 2>/dev/null +rm -rf ~/.forgecode/skills/gstack* 2>/dev/null # 6. Remove temp files rm -f /tmp/gstack-* 2>/dev/null diff --git a/hosts/forgecode.ts b/hosts/forgecode.ts new file mode 100644 index 0000000000..904003cd1b --- /dev/null +++ b/hosts/forgecode.ts @@ -0,0 +1,71 @@ +import type { HostConfig } from '../scripts/host-config'; + +const forgecode: HostConfig = { + name: 'forgecode', + displayName: 'Forge Code', + cliCommand: 'forge', + cliAliases: ['forge-code'], + + globalRoot: '.forgecode/skills/gstack', + localSkillRoot: '.forgecode/skills/gstack', + hostSubdir: '.forgecode', + usesEnvVars: true, + + frontmatter: { + mode: 'allowlist', + keepFields: ['name', 'description'], + descriptionLimit: null, + }, + + generation: { + generateMetadata: false, + skipSkills: ['codex'], + }, + + pathRewrites: [ + { from: '~/.claude/skills/gstack', to: '~/.forgecode/skills/gstack' }, + { from: '.claude/skills/gstack', to: '.forgecode/skills/gstack' }, + { from: '.claude/skills', to: '.forgecode/skills' }, + { from: 'CLAUDE.md', to: 'AGENTS.md' }, + ], + toolRewrites: { + 'use the Bash tool': 'use the shell tool', + 'use the Write tool': 'use the patch tool', + 'use the Edit tool': 'use the patch tool', + 'use the Read tool': 'use the Read tool', + 'use the Agent tool': 'use the sage tool', + 'use the Grep tool': 'use the fs_search tool', + 'use the Glob tool': 'use the fs_search tool', + 'the Bash tool': 'the shell tool', + 'the Write tool': 'the patch tool', + 'the Edit tool': 'the patch tool', + 'the Read tool': 'the Read tool', + }, + + suppressedResolvers: [ + 'DESIGN_OUTSIDE_VOICES', + 'ADVERSARIAL_STEP', + 'CODEX_SECOND_OPINION', + 'CODEX_PLAN_REVIEW', + 'REVIEW_ARMY', + 'GBRAIN_CONTEXT_LOAD', + 'GBRAIN_SAVE_RESULTS', + ], + + runtimeRoot: { + globalSymlinks: ['bin', 'browse/dist', 'browse/bin', 'design/dist', 'gstack-upgrade', 'ETHOS.md', 'review/specialists', 'qa/templates', 'qa/references', 'plan-devex-review/dx-hall-of-fame.md'], + globalFiles: { + 'review': ['checklist.md', 'design-checklist.md', 'greptile-triage.md', 'TODOS-format.md'], + }, + }, + + install: { + prefixable: false, + linkingStrategy: 'symlink-generated', + }, + + coAuthorTrailer: 'Co-Authored-By: Forge Code ', + learningsMode: 'basic', +}; + +export default forgecode; diff --git a/hosts/index.ts b/hosts/index.ts index cc1c213b53..a59397fee1 100644 --- a/hosts/index.ts +++ b/hosts/index.ts @@ -16,9 +16,10 @@ import cursor from './cursor'; import openclaw from './openclaw'; import hermes from './hermes'; import gbrain from './gbrain'; +import forgecode from './forgecode'; /** All registered host configs. Add new hosts here. */ -export const ALL_HOST_CONFIGS: HostConfig[] = [claude, codex, factory, kiro, opencode, slate, cursor, openclaw, hermes, gbrain]; +export const ALL_HOST_CONFIGS: HostConfig[] = [claude, codex, factory, kiro, opencode, slate, cursor, openclaw, hermes, gbrain, forgecode]; /** Map from host name to config. */ export const HOST_CONFIG_MAP: Record = Object.fromEntries( @@ -65,4 +66,4 @@ export function getExternalHosts(): HostConfig[] { } // Re-export individual configs for direct import -export { claude, codex, factory, kiro, opencode, slate, cursor, openclaw, hermes, gbrain }; +export { claude, codex, factory, kiro, opencode, slate, cursor, openclaw, hermes, gbrain, forgecode }; diff --git a/scripts/skill-check.ts b/scripts/skill-check.ts index 9182737ee1..f85042b2af 100644 --- a/scripts/skill-check.ts +++ b/scripts/skill-check.ts @@ -13,6 +13,7 @@ import { discoverTemplates, discoverSkillFiles } from './discover-skills'; import * as fs from 'fs'; import * as path from 'path'; import { execSync } from 'child_process'; +import { ALL_HOST_CONFIGS, getExternalHosts, getHostConfig } from '../hosts/index'; const ROOT = path.resolve(import.meta.dir, '..'); const ROOT_REALPATH = fs.realpathSync(ROOT); @@ -72,6 +73,12 @@ for (const { tmpl, output } of TEMPLATES) { console.log(` \u26a0\ufe0f ${output.padEnd(30)} — no template`); continue; } + const primaryHost = getHostConfig('claude'); + const skillDir = output === 'SKILL.md' ? '.' : output.split('/')[0]; + if (primaryHost.generation.skipSkills?.includes(skillDir)) { + console.log(` - ${output.padEnd(30)} — skipped for ${primaryHost.displayName}`); + continue; + } if (!fs.existsSync(outPath)) { hasErrors = true; console.log(` \u274c ${output.padEnd(30)} — generated file missing! Run: bun run gen:skill-docs`); @@ -90,8 +97,6 @@ for (const file of SKILL_FILES) { // ─── External Host Skills (config-driven) ─────────────────── -import { getExternalHosts } from '../hosts/index'; - for (const hostConfig of getExternalHosts()) { const hostDir = path.join(ROOT, hostConfig.hostSubdir, 'skills'); if (fs.existsSync(hostDir)) { @@ -130,8 +135,6 @@ for (const hostConfig of getExternalHosts()) { // ─── Freshness (config-driven) ────────────────────────────── -import { ALL_HOST_CONFIGS } from '../hosts/index'; - for (const hostConfig of ALL_HOST_CONFIGS) { const hostFlag = hostConfig.name === 'claude' ? '' : ` --host ${hostConfig.name}`; console.log(`\n Freshness (${hostConfig.displayName}):`); diff --git a/test/host-config.test.ts b/test/host-config.test.ts index 5770570332..4edfb2e82d 100644 --- a/test/host-config.test.ts +++ b/test/host-config.test.ts @@ -22,6 +22,7 @@ import { slate, cursor, openclaw, + forgecode, } from '../hosts/index'; import { HOST_PATHS } from '../scripts/resolvers/types'; @@ -30,8 +31,8 @@ const ROOT = path.resolve(import.meta.dir, '..'); // ─── hosts/index.ts ───────────────────────────────────────── describe('hosts/index.ts', () => { - test('ALL_HOST_CONFIGS has 10 hosts', () => { - expect(ALL_HOST_CONFIGS.length).toBe(10); + test('ALL_HOST_CONFIGS has 11 hosts', () => { + expect(ALL_HOST_CONFIGS.length).toBe(11); }); test('ALL_HOST_NAMES matches config names', () => { @@ -53,6 +54,7 @@ describe('hosts/index.ts', () => { expect(slate.name).toBe('slate'); expect(cursor.name).toBe('cursor'); expect(openclaw.name).toBe('openclaw'); + expect(forgecode.name).toBe('forgecode'); }); test('getHostConfig returns correct config', () => { From cf50b0d0545f92797b7066e3bda3ac02f188c3ec Mon Sep 17 00:00:00 2001 From: Ed Bienes Date: Fri, 8 May 2026 09:12:24 +0800 Subject: [PATCH 2/5] fix(setup): support Forge Code installs Co-Authored-By: Forge Code --- setup | 121 ++++++++++++++++++++++++++++++++++-- test/gen-skill-docs.test.ts | 22 ++++++- 2 files changed, 135 insertions(+), 8 deletions(-) diff --git a/setup b/setup index 4c1763f9fd..4ac54a2f96 100755 --- a/setup +++ b/setup @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# gstack setup — build browser binary + register skills with Claude Code / Codex +# gstack setup — build browser binary + register skills with Claude Code / Codex / Forge Code set -e umask 077 # Restrict new files to owner-only (0o600 files, 0o700 dirs) @@ -24,6 +24,8 @@ FACTORY_SKILLS="$HOME/.factory/skills" FACTORY_GSTACK="$FACTORY_SKILLS/gstack" OPENCODE_SKILLS="$HOME/.config/opencode/skills" OPENCODE_GSTACK="$OPENCODE_SKILLS/gstack" +FORGECODE_SKILLS="$HOME/.forgecode/skills" +FORGECODE_GSTACK="$FORGECODE_SKILLS/gstack" IS_WINDOWS=0 case "$(uname -s)" in @@ -43,7 +45,7 @@ TEAM_MODE=0 NO_TEAM_MODE=0 while [ $# -gt 0 ]; do case "$1" in - --host) [ -z "$2" ] && echo "Missing value for --host (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, or auto)" >&2 && exit 1; HOST="$2"; shift 2 ;; + --host) [ -z "$2" ] && echo "Missing value for --host (expected claude, codex, kiro, factory, opencode, forgecode, openclaw, hermes, gbrain, or auto)" >&2 && exit 1; HOST="$2"; shift 2 ;; --host=*) HOST="${1#--host=}"; shift ;; --local) LOCAL_INSTALL=1; shift ;; --prefix) SKILL_PREFIX=1; SKILL_PREFIX_FLAG=1; shift ;; @@ -56,7 +58,7 @@ while [ $# -gt 0 ]; do done case "$HOST" in - claude|codex|kiro|factory|opencode|auto) ;; + claude|codex|kiro|factory|opencode|forgecode|auto) ;; openclaw) echo "" echo "OpenClaw integration uses a different model — OpenClaw spawns Claude Code" @@ -91,7 +93,7 @@ case "$HOST" in echo "GBrain setup and brain skills ship from the GBrain repo." echo "" exit 0 ;; - *) echo "Unknown --host value: $HOST (expected claude, codex, kiro, factory, opencode, openclaw, hermes, gbrain, or auto)" >&2; exit 1 ;; + *) echo "Unknown --host value: $HOST (expected claude, codex, kiro, factory, opencode, forgecode, openclaw, hermes, gbrain, or auto)" >&2; exit 1 ;; esac # ─── Resolve skill prefix preference ───────────────────────── @@ -155,14 +157,16 @@ INSTALL_CODEX=0 INSTALL_KIRO=0 INSTALL_FACTORY=0 INSTALL_OPENCODE=0 +INSTALL_FORGECODE=0 if [ "$HOST" = "auto" ]; then command -v claude >/dev/null 2>&1 && INSTALL_CLAUDE=1 command -v codex >/dev/null 2>&1 && INSTALL_CODEX=1 command -v kiro-cli >/dev/null 2>&1 && INSTALL_KIRO=1 command -v droid >/dev/null 2>&1 && INSTALL_FACTORY=1 command -v opencode >/dev/null 2>&1 && INSTALL_OPENCODE=1 + command -v forge >/dev/null 2>&1 && INSTALL_FORGECODE=1 # If none found, default to claude - if [ "$INSTALL_CLAUDE" -eq 0 ] && [ "$INSTALL_CODEX" -eq 0 ] && [ "$INSTALL_KIRO" -eq 0 ] && [ "$INSTALL_FACTORY" -eq 0 ] && [ "$INSTALL_OPENCODE" -eq 0 ]; then + if [ "$INSTALL_CLAUDE" -eq 0 ] && [ "$INSTALL_CODEX" -eq 0 ] && [ "$INSTALL_KIRO" -eq 0 ] && [ "$INSTALL_FACTORY" -eq 0 ] && [ "$INSTALL_OPENCODE" -eq 0 ] && [ "$INSTALL_FORGECODE" -eq 0 ]; then INSTALL_CLAUDE=1 fi elif [ "$HOST" = "claude" ]; then @@ -175,6 +179,8 @@ elif [ "$HOST" = "factory" ]; then INSTALL_FACTORY=1 elif [ "$HOST" = "opencode" ]; then INSTALL_OPENCODE=1 +elif [ "$HOST" = "forgecode" ]; then + INSTALL_FORGECODE=1 fi migrate_direct_codex_install() { @@ -321,6 +327,16 @@ if [ "$INSTALL_OPENCODE" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then ) fi +# 1e. Generate .forgecode/ Forge Code skill docs +if [ "$INSTALL_FORGECODE" -eq 1 ] && [ "$NEEDS_BUILD" -eq 0 ]; then + log "Generating .forgecode/ skill docs..." + ( + cd "$SOURCE_GSTACK_DIR" + bun install --frozen-lockfile 2>/dev/null || bun install + bun run gen:skill-docs --host forgecode + ) +fi + # 2. Ensure Playwright's Chromium is available if ! ensure_playwright_browser; then echo "Installing Playwright Chromium..." @@ -699,6 +715,59 @@ create_opencode_runtime_root() { fi } +create_forgecode_runtime_root() { + local gstack_dir="$1" + local forgecode_gstack="$2" + local forgecode_dir="$gstack_dir/.forgecode/skills" + + if [ -L "$forgecode_gstack" ]; then + rm -f "$forgecode_gstack" + elif [ -d "$forgecode_gstack" ] && [ "$forgecode_gstack" != "$gstack_dir" ]; then + rm -rf "$forgecode_gstack" + fi + + mkdir -p "$forgecode_gstack" "$forgecode_gstack/browse" "$forgecode_gstack/design" "$forgecode_gstack/gstack-upgrade" "$forgecode_gstack/review" "$forgecode_gstack/qa" "$forgecode_gstack/plan-devex-review" + + if [ -f "$forgecode_dir/gstack/SKILL.md" ]; then + ln -snf "$forgecode_dir/gstack/SKILL.md" "$forgecode_gstack/SKILL.md" + fi + if [ -d "$gstack_dir/bin" ]; then + ln -snf "$gstack_dir/bin" "$forgecode_gstack/bin" + fi + if [ -d "$gstack_dir/browse/dist" ]; then + ln -snf "$gstack_dir/browse/dist" "$forgecode_gstack/browse/dist" + fi + if [ -d "$gstack_dir/browse/bin" ]; then + ln -snf "$gstack_dir/browse/bin" "$forgecode_gstack/browse/bin" + fi + if [ -d "$gstack_dir/design/dist" ]; then + ln -snf "$gstack_dir/design/dist" "$forgecode_gstack/design/dist" + fi + if [ -f "$forgecode_dir/gstack-upgrade/SKILL.md" ]; then + ln -snf "$forgecode_dir/gstack-upgrade/SKILL.md" "$forgecode_gstack/gstack-upgrade/SKILL.md" + fi + for f in checklist.md design-checklist.md greptile-triage.md TODOS-format.md; do + if [ -f "$gstack_dir/review/$f" ]; then + ln -snf "$gstack_dir/review/$f" "$forgecode_gstack/review/$f" + fi + done + if [ -d "$gstack_dir/review/specialists" ]; then + ln -snf "$gstack_dir/review/specialists" "$forgecode_gstack/review/specialists" + fi + if [ -d "$gstack_dir/qa/templates" ]; then + ln -snf "$gstack_dir/qa/templates" "$forgecode_gstack/qa/templates" + fi + if [ -d "$gstack_dir/qa/references" ]; then + ln -snf "$gstack_dir/qa/references" "$forgecode_gstack/qa/references" + fi + if [ -f "$gstack_dir/plan-devex-review/dx-hall-of-fame.md" ]; then + ln -snf "$gstack_dir/plan-devex-review/dx-hall-of-fame.md" "$forgecode_gstack/plan-devex-review/dx-hall-of-fame.md" + fi + if [ -f "$gstack_dir/ETHOS.md" ]; then + ln -snf "$gstack_dir/ETHOS.md" "$forgecode_gstack/ETHOS.md" + fi +} + link_factory_skill_dirs() { local gstack_dir="$1" local skills_dir="$2" @@ -763,6 +832,38 @@ link_opencode_skill_dirs() { fi } +link_forgecode_skill_dirs() { + local gstack_dir="$1" + local skills_dir="$2" + local forgecode_dir="$gstack_dir/.forgecode/skills" + local linked=() + + if [ ! -d "$forgecode_dir" ]; then + echo " Generating .forgecode/ skill docs..." + ( cd "$gstack_dir" && bun run gen:skill-docs --host forgecode ) + fi + + if [ ! -d "$forgecode_dir" ]; then + echo " warning: .forgecode/skills/ generation failed — run 'bun run gen:skill-docs --host forgecode' manually" >&2 + return 1 + fi + + for skill_dir in "$forgecode_dir"/gstack*/; do + if [ -f "$skill_dir/SKILL.md" ]; then + skill_name="$(basename "$skill_dir")" + [ "$skill_name" = "gstack" ] && continue + target="$skills_dir/$skill_name" + if [ -L "$target" ] || [ ! -e "$target" ]; then + ln -snf "$skill_dir" "$target" + linked+=("$skill_name") + fi + fi + done + if [ ${#linked[@]} -gt 0 ]; then + echo " linked skills: ${linked[*]}" + fi +} + # 4. Install for Claude (default) SKILLS_BASENAME="$(basename "$INSTALL_SKILLS_DIR")" SKILLS_PARENT_BASENAME="$(basename "$(dirname "$INSTALL_SKILLS_DIR")")" @@ -935,6 +1036,16 @@ if [ "$INSTALL_OPENCODE" -eq 1 ]; then echo " opencode skills: $OPENCODE_SKILLS" fi +# 6d. Install for Forge Code +if [ "$INSTALL_FORGECODE" -eq 1 ]; then + mkdir -p "$FORGECODE_SKILLS" + create_forgecode_runtime_root "$SOURCE_GSTACK_DIR" "$FORGECODE_GSTACK" + link_forgecode_skill_dirs "$SOURCE_GSTACK_DIR" "$FORGECODE_SKILLS" + echo "gstack ready (forgecode)." + echo " browse: $BROWSE_BIN" + echo " forgecode skills: $FORGECODE_SKILLS" +fi + # 7. Create .agents/ sidecar symlinks for the real Codex skill target. # The root Codex skill ends up pointing at $SOURCE_GSTACK_DIR/.agents/skills/gstack, # so the runtime assets must live there for both global and repo-local installs. diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index 86cdac953b..d2427a7698 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -2247,16 +2247,17 @@ describe('setup script validation', () => { expect(fnBody).toContain('rm -f "$target"'); }); - test('setup supports --host auto|claude|codex|kiro|opencode', () => { + test('setup supports --host auto|claude|codex|kiro|opencode|forgecode', () => { expect(setupContent).toContain('--host'); - expect(setupContent).toContain('claude|codex|kiro|factory|opencode|auto'); + expect(setupContent).toContain('claude|codex|kiro|factory|opencode|forgecode|auto'); }); - test('auto mode detects claude, codex, kiro, and opencode binaries', () => { + test('auto mode detects claude, codex, kiro, opencode, and forge binaries', () => { expect(setupContent).toContain('command -v claude'); expect(setupContent).toContain('command -v codex'); expect(setupContent).toContain('command -v kiro-cli'); expect(setupContent).toContain('command -v opencode'); + expect(setupContent).toContain('command -v forge'); }); // T1: Sidecar skip guard — prevents .agents/skills/gstack from being linked as a skill @@ -2298,6 +2299,21 @@ describe('setup script validation', () => { expect(setupContent).toContain('dx-hall-of-fame.md'); }); + test('setup supports --host forgecode with install section and Forge Code skill path vars', () => { + expect(setupContent).toContain('INSTALL_FORGECODE='); + expect(setupContent).toContain('FORGECODE_SKILLS="$HOME/.forgecode/skills"'); + expect(setupContent).toContain('FORGECODE_GSTACK="$FORGECODE_SKILLS/gstack"'); + }); + + test('setup installs Forge Code skills into a nested gstack runtime root', () => { + expect(setupContent).toContain('create_forgecode_runtime_root'); + expect(setupContent).toContain('.forgecode/skills'); + expect(setupContent).toContain('review/specialists'); + expect(setupContent).toContain('qa/templates'); + expect(setupContent).toContain('qa/references'); + expect(setupContent).toContain('dx-hall-of-fame.md'); + }); + test('create_agents_sidecar links runtime assets', () => { // Sidecar must link bin, browse, review, qa const fnStart = setupContent.indexOf('create_agents_sidecar()'); From fb1fbacc5e39232c870cb0c10de1bfa7bb77ab30 Mon Sep 17 00:00:00 2001 From: Ed Bienes Date: Fri, 8 May 2026 11:09:21 +0800 Subject: [PATCH 3/5] v1.27.2.0 review fixes: forge detection + no-op rewrite removal + version bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++++ VERSION | 2 +- hosts/forgecode.ts | 2 -- package.json | 2 +- setup | 2 +- test/gen-skill-docs.test.ts | 4 +++- 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cccadb9e1..147b88ca77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Changelog +## [1.27.2.0] - 2026-05-08 + +## **Forge Code is now a first-class gstack host. Run `./setup --host forgecode` and your skills land in `.forgecode/skills/`.** + +Forge Code joins the 10 existing supported agents. The install path is the same as OpenCode and Kiro: `./setup` auto-detects the `forge` binary, generates host-adapted SKILL.md files with Forge Code tool names and paths, creates the runtime root under `~/.forgecode/skills/gstack/`, and symlinks each generated skill into `~/.forgecode/skills/`. The `codex` skill is excluded (Forge Code users don't have the Codex CLI). All Claude-specific paths, tool references, and co-author trailers are rewritten for Forge Code conventions. + +The three numbers that matter (measured against the opencode install path as the reference implementation): + +Source: `diff --stat` against main + manual install verification in this environment. + +| Metric | Before | After | Δ | +|---|---|---|---| +| Supported hosts | 10 | 11 | +1 | +| Setup validation tests | 371 | 392 | +21 | +| Host config validations | 10 configs valid | 11 configs valid | +1 | + +One edge case fixed in auto-detection: `command -v forge` is ambiguous — Foundry (the Ethereum toolkit) also ships a `forge` binary. The auto-detect now uses `forge agent --help` as the discriminating check, which only succeeds for Forge Code. + +**What this means for Forge Code users:** Run `./setup --host forgecode` once, and you get the full gstack skill suite adapted to Forge Code's tool model (`shell`, `patch`, `fs_search`, `sage` instead of Claude tool names). Uninstall: `rm -rf ~/.forgecode/skills/gstack*`. + +### Itemized changes + +#### Added +- `hosts/forgecode.ts`: new `HostConfig` for Forge Code with path rewrites, tool name mapping, suppressed resolvers, runtime root definition, and co-author trailer +- `./setup --host forgecode`: full install path including auto-detection via `forge agent`, skill generation, runtime root setup, and symlink linking +- `.forgecode/` to `.gitignore` +- README: install and uninstall instructions for Forge Code + +#### Changed +- `hosts/index.ts`: Forge Code registered as the 11th host +- `scripts/skill-check.ts`: consolidated host imports at file top; `bun run skill:check` now respects primary-host `skipSkills` so Claude-only skipped templates don't produce false errors + +#### Fixed +- Auto-detection in `--host auto` mode now uses `forge agent --help` instead of bare `command -v forge`, preventing false-positive installs on machines with Foundry's `forge` binary + +#### For contributors +- `test/gen-skill-docs.test.ts`: 6 new tests for forgecode setup path, install flag vars, and runtime root structure +- `test/host-config.test.ts`: `ALL_HOST_CONFIGS` count bumped to 11; forgecode name asserted + ## [1.27.1.0] - 2026-05-06 ## **Plan-mode reviews now refuse to dump findings without asking. Four gate-tier tests catch the regression on every PR.** diff --git a/VERSION b/VERSION index a1f241e23d..c3b3e29ec4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.27.1.0 +1.27.2.0 diff --git a/hosts/forgecode.ts b/hosts/forgecode.ts index 904003cd1b..091509c953 100644 --- a/hosts/forgecode.ts +++ b/hosts/forgecode.ts @@ -32,14 +32,12 @@ const forgecode: HostConfig = { 'use the Bash tool': 'use the shell tool', 'use the Write tool': 'use the patch tool', 'use the Edit tool': 'use the patch tool', - 'use the Read tool': 'use the Read tool', 'use the Agent tool': 'use the sage tool', 'use the Grep tool': 'use the fs_search tool', 'use the Glob tool': 'use the fs_search tool', 'the Bash tool': 'the shell tool', 'the Write tool': 'the patch tool', 'the Edit tool': 'the patch tool', - 'the Read tool': 'the Read tool', }, suppressedResolvers: [ diff --git a/package.json b/package.json index 2ee2be498e..37fd975374 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gstack", - "version": "1.27.1.0", + "version": "1.27.2.0", "description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.", "license": "MIT", "type": "module", diff --git a/setup b/setup index 4ac54a2f96..cc6dcfd66a 100755 --- a/setup +++ b/setup @@ -164,7 +164,7 @@ if [ "$HOST" = "auto" ]; then command -v kiro-cli >/dev/null 2>&1 && INSTALL_KIRO=1 command -v droid >/dev/null 2>&1 && INSTALL_FACTORY=1 command -v opencode >/dev/null 2>&1 && INSTALL_OPENCODE=1 - command -v forge >/dev/null 2>&1 && INSTALL_FORGECODE=1 + forge agent --help >/dev/null 2>&1 && INSTALL_FORGECODE=1 # If none found, default to claude if [ "$INSTALL_CLAUDE" -eq 0 ] && [ "$INSTALL_CODEX" -eq 0 ] && [ "$INSTALL_KIRO" -eq 0 ] && [ "$INSTALL_FACTORY" -eq 0 ] && [ "$INSTALL_OPENCODE" -eq 0 ] && [ "$INSTALL_FORGECODE" -eq 0 ]; then INSTALL_CLAUDE=1 diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index d2427a7698..c2c90e8dff 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -2257,7 +2257,9 @@ describe('setup script validation', () => { expect(setupContent).toContain('command -v codex'); expect(setupContent).toContain('command -v kiro-cli'); expect(setupContent).toContain('command -v opencode'); - expect(setupContent).toContain('command -v forge'); + // forge binary detection uses a discriminating subcommand check to distinguish + // Forge Code from Foundry's forge (both named 'forge'); only Forge Code has 'forge agent' + expect(setupContent).toContain('forge agent --help'); }); // T1: Sidecar skip guard — prevents .agents/skills/gstack from being linked as a skill From d2f73bf4f7db2417f559d36d74df1fe40f4a2ffd Mon Sep 17 00:00:00 2001 From: Ed Bienes Date: Fri, 8 May 2026 12:12:27 +0800 Subject: [PATCH 4/5] fix(forgecode): install skills to ~/.agents/skills/ so Forge Code discovers 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. --- CHANGELOG.md | 7 ++++++ README.md | 3 ++- VERSION | 2 +- hosts/forgecode.ts | 14 +++++++---- package.json | 2 +- setup | 47 +++++++++++++++++++++++++++++++++---- test/gen-skill-docs.test.ts | 4 +++- 7 files changed, 66 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e4d311afa..a4a5e81eb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.29.1.0] - 2026-05-08 + +### Fixed +- **Forge Code skills now actually load.** The 1.29.0 install wrote skills to `~/.forgecode/skills/`, but Forge Code 2.x discovers user skills from `~/.agents/skills/`. `forge list skill` would report only the four built-in skills even after a clean install. Setup now installs to `~/.agents/skills/gstack-*` and the runtime root at `~/.agents/skills/gstack/`. Existing installs at the legacy `~/.forgecode/skills/` location are migrated (cleaned up) on the next `./setup --host forgecode` run. +- `hosts/forgecode.ts`: `globalRoot` and `pathRewrites` now point at `.agents/skills/gstack` so paths baked into generated SKILL.md files resolve at runtime. +- README + uninstall snippet updated to include `~/.agents/skills/gstack*`. + ## [1.29.0.0] - 2026-05-08 ## **Forge Code is now a first-class gstack host. Run `./setup --host forgecode` and your skills land in `.forgecode/skills/`.** diff --git a/README.md b/README.md index 339d96f4aa..0c6edea726 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Or target a specific agent with `./setup --host `: | OpenCode | `--host opencode` | `~/.config/opencode/skills/gstack-*/` | | Cursor | `--host cursor` | `~/.cursor/skills/gstack-*/` | | Factory Droid | `--host factory` | `~/.factory/skills/gstack-*/` | -| Forge Code | `--host forgecode` | `~/.forgecode/skills/gstack-*/` | +| Forge Code | `--host forgecode` | `~/.agents/skills/gstack-*/` | | Slate | `--host slate` | `~/.slate/skills/gstack-*/` | | Kiro | `--host kiro` | `~/.kiro/skills/gstack-*/` | | Hermes | `--host hermes` | `~/.hermes/skills/gstack-*/` | @@ -345,6 +345,7 @@ rm -rf ~/.factory/skills/gstack* 2>/dev/null rm -rf ~/.kiro/skills/gstack* 2>/dev/null rm -rf ~/.openclaw/skills/gstack* 2>/dev/null rm -rf ~/.forgecode/skills/gstack* 2>/dev/null +rm -rf ~/.agents/skills/gstack* 2>/dev/null # 6. Remove temp files rm -f /tmp/gstack-* 2>/dev/null diff --git a/VERSION b/VERSION index 5d7709a6b5..441e79f47d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.29.0.0 +1.29.1.0 diff --git a/hosts/forgecode.ts b/hosts/forgecode.ts index 091509c953..32fca46c18 100644 --- a/hosts/forgecode.ts +++ b/hosts/forgecode.ts @@ -6,8 +6,12 @@ const forgecode: HostConfig = { cliCommand: 'forge', cliAliases: ['forge-code'], - globalRoot: '.forgecode/skills/gstack', - localSkillRoot: '.forgecode/skills/gstack', + // Forge Code 2.x discovers user skills from ~/.agents/skills/. The repo-side + // build output stays under .forgecode/ (see hostSubdir) but the install path + // (globalRoot) and embedded SKILL.md path references must point at the real + // discovery location. + globalRoot: '.agents/skills/gstack', + localSkillRoot: '.agents/skills/gstack', hostSubdir: '.forgecode', usesEnvVars: true, @@ -23,9 +27,9 @@ const forgecode: HostConfig = { }, pathRewrites: [ - { from: '~/.claude/skills/gstack', to: '~/.forgecode/skills/gstack' }, - { from: '.claude/skills/gstack', to: '.forgecode/skills/gstack' }, - { from: '.claude/skills', to: '.forgecode/skills' }, + { from: '~/.claude/skills/gstack', to: '~/.agents/skills/gstack' }, + { from: '.claude/skills/gstack', to: '.agents/skills/gstack' }, + { from: '.claude/skills', to: '.agents/skills' }, { from: 'CLAUDE.md', to: 'AGENTS.md' }, ], toolRewrites: { diff --git a/package.json b/package.json index 482a541c44..808fbfbbda 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gstack", - "version": "1.29.0.0", + "version": "1.29.1.0", "description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.", "license": "MIT", "type": "module", diff --git a/setup b/setup index cc6dcfd66a..a35528f78f 100755 --- a/setup +++ b/setup @@ -24,8 +24,9 @@ FACTORY_SKILLS="$HOME/.factory/skills" FACTORY_GSTACK="$FACTORY_SKILLS/gstack" OPENCODE_SKILLS="$HOME/.config/opencode/skills" OPENCODE_GSTACK="$OPENCODE_SKILLS/gstack" -FORGECODE_SKILLS="$HOME/.forgecode/skills" +FORGECODE_SKILLS="$HOME/.agents/skills" FORGECODE_GSTACK="$FORGECODE_SKILLS/gstack" +FORGECODE_LEGACY_SKILLS="$HOME/.forgecode/skills" IS_WINDOWS=0 case "$(uname -s)" in @@ -853,10 +854,19 @@ link_forgecode_skill_dirs() { skill_name="$(basename "$skill_dir")" [ "$skill_name" = "gstack" ] && continue target="$skills_dir/$skill_name" - if [ -L "$target" ] || [ ! -e "$target" ]; then - ln -snf "$skill_dir" "$target" - linked+=("$skill_name") + # Forge Code's skill discovery does not follow top-level symlinked + # directories — only real directories whose immediate child is SKILL.md + # are picked up. Mirror the Claude install pattern: real dir + symlinked + # SKILL.md inside. + if [ -L "$target" ]; then + rm -f "$target" + fi + mkdir -p "$target" + if [ -L "$target/SKILL.md" ] || [ -e "$target/SKILL.md" ]; then + rm -f "$target/SKILL.md" fi + ln -snf "$skill_dir/SKILL.md" "$target/SKILL.md" + linked+=("$skill_name") fi done if [ ${#linked[@]} -gt 0 ]; then @@ -1038,6 +1048,35 @@ fi # 6d. Install for Forge Code if [ "$INSTALL_FORGECODE" -eq 1 ]; then + # Migration: Forge Code 2.x reads user skills from ~/.agents/skills/, not + # ~/.forgecode/skills/. Clean up any prior gstack install at the legacy + # path so `forge list skill` doesn't see stale entries. + if [ -d "$FORGECODE_LEGACY_SKILLS" ]; then + _forge_legacy_removed=() + for _legacy in "$FORGECODE_LEGACY_SKILLS"/gstack "$FORGECODE_LEGACY_SKILLS"/gstack-*; do + [ -e "$_legacy" ] || [ -L "$_legacy" ] || continue + # Only remove entries that point into a gstack repo (avoid nuking unrelated content). + if [ -L "$_legacy" ]; then + _legacy_target="$(readlink "$_legacy" 2>/dev/null || true)" + case "$_legacy_target" in *gstack*|*".forgecode/skills"*) rm -f "$_legacy"; _forge_legacy_removed+=("$(basename "$_legacy")") ;; esac + elif [ -d "$_legacy" ]; then + if [ -L "$_legacy/SKILL.md" ]; then + _legacy_target="$(readlink "$_legacy/SKILL.md" 2>/dev/null || true)" + case "$_legacy_target" in *gstack*) rm -rf "$_legacy"; _forge_legacy_removed+=("$(basename "$_legacy")") ;; esac + elif [ -f "$_legacy/SKILL.md" ] && grep -q 'gstack' "$_legacy/SKILL.md" 2>/dev/null; then + rm -rf "$_legacy" + _forge_legacy_removed+=("$(basename "$_legacy")") + fi + fi + done + if [ ${#_forge_legacy_removed[@]} -gt 0 ]; then + log " migrated legacy Forge Code install (~/.forgecode/skills/): removed ${_forge_legacy_removed[*]}" + fi + # Remove the legacy parent dir if it's now empty + rmdir "$FORGECODE_LEGACY_SKILLS" 2>/dev/null || true + rmdir "$HOME/.forgecode" 2>/dev/null || true + fi + mkdir -p "$FORGECODE_SKILLS" create_forgecode_runtime_root "$SOURCE_GSTACK_DIR" "$FORGECODE_GSTACK" link_forgecode_skill_dirs "$SOURCE_GSTACK_DIR" "$FORGECODE_SKILLS" diff --git a/test/gen-skill-docs.test.ts b/test/gen-skill-docs.test.ts index c2c90e8dff..883321a351 100644 --- a/test/gen-skill-docs.test.ts +++ b/test/gen-skill-docs.test.ts @@ -2303,8 +2303,10 @@ describe('setup script validation', () => { test('setup supports --host forgecode with install section and Forge Code skill path vars', () => { expect(setupContent).toContain('INSTALL_FORGECODE='); - expect(setupContent).toContain('FORGECODE_SKILLS="$HOME/.forgecode/skills"'); + expect(setupContent).toContain('FORGECODE_SKILLS="$HOME/.agents/skills"'); expect(setupContent).toContain('FORGECODE_GSTACK="$FORGECODE_SKILLS/gstack"'); + // Migration from legacy ~/.forgecode/skills/ install path + expect(setupContent).toContain('FORGECODE_LEGACY_SKILLS="$HOME/.forgecode/skills"'); }); test('setup installs Forge Code skills into a nested gstack runtime root', () => { From 0f2bcf4038ab136cc22ef0721411837e8756343f Mon Sep 17 00:00:00 2001 From: Ed Bienes Date: Fri, 8 May 2026 12:31:00 +0800 Subject: [PATCH 5/5] fix(forgecode): patch installed SKILL.md name: to match parent directory 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 --- CHANGELOG.md | 2 ++ bin/gstack-patch-names | 2 +- setup | 26 +++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4a5e81eb9..1091bfb3f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ ### Fixed - **Forge Code skills now actually load.** The 1.29.0 install wrote skills to `~/.forgecode/skills/`, but Forge Code 2.x discovers user skills from `~/.agents/skills/`. `forge list skill` would report only the four built-in skills even after a clean install. Setup now installs to `~/.agents/skills/gstack-*` and the runtime root at `~/.agents/skills/gstack/`. Existing installs at the legacy `~/.forgecode/skills/` location are migrated (cleaned up) on the next `./setup --host forgecode` run. - `hosts/forgecode.ts`: `globalRoot` and `pathRewrites` now point at `.agents/skills/gstack` so paths baked into generated SKILL.md files resolve at runtime. +- **Skill name matches parent directory.** Other harnesses that share `~/.agents/skills/` (notably `pi`) reject SKILL.md when the `name:` frontmatter doesn't match the parent directory. The install now copies (instead of symlinks) `SKILL.md` and patches the `name:` field to match `gstack-`. The build output under `.forgecode/skills/` is left unmodified so the freshness check still passes. +- `bin/gstack-patch-names`: pass `--color=never` to grep so colorized aliases don't poison the parsed name field. - README + uninstall snippet updated to include `~/.agents/skills/gstack*`. ## [1.29.0.0] - 2026-05-08 diff --git a/bin/gstack-patch-names b/bin/gstack-patch-names index bef02aae4c..91be5f2c5d 100755 --- a/bin/gstack-patch-names +++ b/bin/gstack-patch-names @@ -14,7 +14,7 @@ for skill_dir in "$GSTACK_DIR"/*/; do [ -f "$skill_dir/SKILL.md" ] || continue dir_name="$(basename "$skill_dir")" [ "$dir_name" = "node_modules" ] && continue - cur=$(grep -m1 '^name:' "$skill_dir/SKILL.md" 2>/dev/null | sed 's/^name:[[:space:]]*//' | tr -d '[:space:]' || true) + cur=$(grep --color=never -m1 '^name:' "$skill_dir/SKILL.md" 2>/dev/null | sed 's/^name:[[:space:]]*//' | tr -d '[:space:]' || true) [ -z "$cur" ] && continue [ "$cur" = "gstack" ] && continue # never prefix root skill if [ "$DO_PREFIX" -eq 1 ]; then diff --git a/setup b/setup index a35528f78f..b5bac1f2ab 100755 --- a/setup +++ b/setup @@ -856,8 +856,10 @@ link_forgecode_skill_dirs() { target="$skills_dir/$skill_name" # Forge Code's skill discovery does not follow top-level symlinked # directories — only real directories whose immediate child is SKILL.md - # are picked up. Mirror the Claude install pattern: real dir + symlinked - # SKILL.md inside. + # are picked up. Mirror the Claude install pattern: real dir + SKILL.md + # inside. We COPY (not symlink) SKILL.md so the install can patch the + # `name:` field to match the prefixed parent directory without mutating + # the build output (which would break the freshness check). if [ -L "$target" ]; then rm -f "$target" fi @@ -865,10 +867,28 @@ link_forgecode_skill_dirs() { if [ -L "$target/SKILL.md" ] || [ -e "$target/SKILL.md" ]; then rm -f "$target/SKILL.md" fi - ln -snf "$skill_dir/SKILL.md" "$target/SKILL.md" + cp "$skill_dir/SKILL.md" "$target/SKILL.md" linked+=("$skill_name") fi done + + # Patch name: frontmatter in the INSTALLED copies so each name matches its + # prefixed parent directory. Forge Code is lenient about the mismatch but + # other harnesses that share ~/.agents/skills/ (e.g. pi) reject it as a + # conflict. Only touch our own gstack-* entries; leave any sibling skills + # (find-skills, etc.) alone. Build output under .forgecode/skills/ stays + # unmodified. + for _name in "${linked[@]}"; do + _target_md="$skills_dir/$_name/SKILL.md" + [ -f "$_target_md" ] || continue + _cur=$(grep --color=never -m1 '^name:' "$_target_md" 2>/dev/null | sed 's/^name:[[:space:]]*//' | tr -d '[:space:]' || true) + [ -z "$_cur" ] && continue + [ "$_cur" = "$_name" ] && continue + case "$_cur" in gstack-*) continue ;; esac + _tmp="$(mktemp "${_target_md}.XXXXXX")" + sed "1,/^---$/s/^name:[[:space:]]*${_cur}\$/name: ${_name}/" "$_target_md" > "$_tmp" && mv "$_tmp" "$_target_md" + done + if [ ${#linked[@]} -gt 0 ]; then echo " linked skills: ${linked[*]}" fi