mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 22:14:25 +01:00
* Fix spaced-out terminal text on Windows: put a Latin monospace before the CJK fallbacks On Windows none of the Mac/Linux monospace fonts in the stack are installed, so the first font that resolves is Malgun Gothic (the Windows Korean UI font). xterm.js sizes its character cell from that font's advance width, and Malgun Gothic advances Latin glyphs in a full-width CJK cell — doubling every cell and rendering the whole terminal (and the sidepanel mono UI) as spaced-out text. Insert Consolas (present on every Windows install) and the Cascadia faces ahead of the CJK fonts in both the xterm fontFamily and the --font-mono CSS var. The CJK fonts stay last for actual CJK coverage. No bundled font, no user install needed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GKj8Nr8T4GvryTcWBJRMyC * fix(windows): every compiled binary answers --version before any side effect browse --version started a server and exited 1, pdf printed usage and exited 1, gstack-global-discover rejected the flag, and find-browse ran discovery. A launch probe for Smart App Control (#2595) needs one side-effect-free command that exits 0 on a healthy build, so browse, find-browse, make-pdf and gstack-global-discover now answer --version first (design already did). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(extension): pin Consolas ahead of the CJK fallbacks in both mono stacks (#2287) Regression test for @tomfluff's fix: the xterm fontFamily and --font-mono must list Consolas before Noto Sans Mono CJK KR and Malgun Gothic, or Windows renders the sidebar terminal double-width. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(cso): record each CSO build's outcome and stop arming the parent trap across the native publisher exec (#3071) scripts/build-cso.sh now writes bin/.gstack-cso-build-result: result, failed stage (build or publish), reason, this revision, the revision of the generation still installed, whether its launcher is usable, and the diagnostic log. An 'interrupted' entry is written before each stage so a killed run is visible. A failed publish that restores the old generation records it as still installed. Before exec'ing the native publisher, the parent re-checks the locker, clears its EXIT trap and enables execfail: the locked child's own trap owns the stage. On Git Bash an exec of a native program may not replace the shell, so the parent's trap could otherwise delete the stage under the running child (the vanishing files in #3071; root cause unproven). If the exec itself fails the parent cleans the stage and records it. The Windows build prefers PowerShell 7 (pwsh) over Windows PowerShell 5.1, which crashed outright on the reporter's machine. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(setup): an optional CSO build or publish failure no longer aborts setup (#3071) CSO was optional at probe time but fatal at build time: scripts/build.sh ran build-cso.sh under set -e before the browse server bundle and the completion stamp, and setup exited when the CSO artifact set was incomplete. A failed CSO step now prints 'CSO unavailable: the <stage> step failed' with its log (bin/.gstack-cso-build.log) and retry, and the build and setup finish. GSTACK_STRICT_BUILD=1 keeps it fatal; the free-tests, make-pdf-gate and windows-setup-e2e builds set it, so regressions still fail CI. setup's summary reads the build-result record instead of the pre-build availability flag: probe failures keep their prerequisite instruction; build and publish failures name the stage, the diagnostic and 'bun run build:cso && ./setup', and a restored earlier helper is reported as 'previous CSO kept: <revision>'. setup records probe failures in the same file. The Windows prerequisite probe prefers pwsh, and a probe that fails for any reason other than a missing toolchain or a compile error keeps its exit status and first output line (windows-toolchain-probe) instead of being labeled windows-msvc-toolchain. Reported and diagnosed by @dviolante. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * feat(windows): detect Smart App Control-blocked binaries in setup and gstack-doctor (#2595, #2124) Smart App Control refuses the five unsigned binaries gstack compiles locally, and Git Bash reports it as 'Permission denied', so setup's [ -x ] gate passed and skills failed later. bin/gstack-launch-probe.sh runs each binary's side-effect-free --version and classifies it: native, blocked (spawn error, exit 126/127, or an application-control message), broken (launched, exited non-zero) or missing. It shows the raw first output line, since the exact Windows text is unverified. On Windows, setup names each blocked binary and the skills that need it, cites #2595, says which shell ran setup and whether WSL is installed, gives today's workarounds (WSL, or turning Smart App Control off), how to undo, and the new troubleshooting section. gstack-doctor's browse row now says 'blocked at launch' instead of passing, a binaries row covers the other four, and a cso row reads the build-result record. windows-setup-e2e builds with GSTACK_STRICT_BUILD=1, checks all five binaries answer --version, and adds two forced CSO failures: fatal under strict mode, and a completed setup that reports the failure and a doctor cso warning under GSTACK_STRICT_BUILD=0. No shim or launcher: it could not be called from PowerShell and would load the caller's project .env/bunfig. Signing is the follow-up in TODOS.md. Diagnosis credit: @knetics9000 (#2595, #2596), @smartjelic-sys (#2595), @pstilwell90 (#2124), @cko32002 (#2265), @salluexez (#2127). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * docs: Windows Smart App Control known issue, optional CSO failures, doctor rows README's Windows section says /cso failures no longer stop setup (GSTACK_STRICT_BUILD=1 keeps them fatal), documents Smart App Control as a known issue with today's workarounds (WSL, or turning it off) and the Consolas fix. troubleshooting.md gains a Windows section for blocked binaries and an entry for CSO build/publish failures. TODOS.md replaces the Node CLI lane item with Windows code signing (needs a signing account), the #3071 root-cause follow-up and SAC text verification. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(setup): never write the CSO build record into a source checkout that needed no build Setup wrote bin/.gstack-cso-build-result for every probe-stage outcome, so a run that built nothing still changed the source checkout's bin/ (caught by setup-codex-scope's unchanged-source checks). A missing prerequisite now comes from the run's own probe, as before, and setup only removes a stale record alongside the removed helper. scripts/build-cso.sh remains the only writer. The doctor's cso row reports 'native helper not built' with no record. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(extension): move the Consolas font-stack check into sidebar-ux (#2287) The standalone file read extension sources without importing product code, which the test-of-test ratchet rejects; sidebar-ux already owns the sidepanel.css structural checks. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.43.0 fix(windows): setup degrades instead of dying on a CSO failure, detects Smart App Control, Consolas terminal font Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(setup): every env-var runtime root carries the files its skills read as $GSTACK_ROOT/<path> (#1077 residue) Codex, Factory, Kiro, OpenCode, Cursor and Copilot runtime roots linked bin/, lib/ and the compiled tools but not the files the generated skills read on demand: the preamble's jargon list and question registry, the AskUserQuestion split and CJK docs, the DX Hall of Fame, the test-value bar, the review checklists and specialists, design-html's vendored pretext.js, VERSION and plan-design-review/SKILL.md. The reads failed silently on every non-Claude host. _link_runtime_dists now links the shared list for every root, and _copy_runtime_skill_refs copies the host-rendered office-hours and plan-design-review SKILL.md (the #2449 pattern) into each root. The per-root review loops it replaces had drifted (Cursor shipped two of four checklists, only OpenCode had specialists). hosts/define-host.ts mirrors the list in sharedRuntimeRoot(). test/runtime-root-assets.test.ts renders every host, builds each root with setup's own functions and checks every $GSTACK_ROOT literal on disk; it fails on the previous setup for all five roots. scripts/ship-measure.ts stays deferred (it needs the eval harness). Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(build): an install renders skills only for the hosts installed from it (#1694) ./setup ran gen:skill-docs --host all inside the install, so a global Claude install at ~/.claude/skills/gstack carried 632 SKILL.md files (34.7 MB) where 56 are its own; Claude Code and Cursor-agent scan that tree, and Cursor-agent freezes above roughly 11 MB. setup now keeps an additive record of the hosts it installs from a checkout (.gstack-installed-hosts, owned by bin/gstack-host-renders.sh), seeded from installs that predate it: registry rows, install roots that resolve to the checkout, host skills that link into its renders, and legacy skill copies with no runtime root. scripts/build.sh renders claude plus the recorded hosts and prints which hosts and why. A checkout with no record (development) or GSTACK_RENDER_HOSTS=all renders every host. The Codex .agents/ render runs only when Codex is installed or recorded; bin/dev-setup records Codex because it serves the repo's .agents/. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(setup): prune skill renders for hosts a checkout does not serve, without losing a file (#1694) Every ./setup now removes the render dirs of hosts missing from the installed-hosts record, so an install that rendered every host (632 SKILL.md, 34.7 MB under ~/.claude/skills/gstack) converges on its own hosts. It runs per install, so two installs sharing one state root are both cleaned, and never touches a recorded host, so ./setup --host codex keeps a --host factory render. The rules follow bin/gstack-relink: a symlink into the checkout (STRONG) is removed; a file proven generated (WEAK: gen-skill-docs' banner, the generator's exact openai.yaml shape, byte identity with the checkout, or setup's runtime pointers naming it) is moved to $GSTACK_STATE_ROOT/backups/host-renders/<ts>-<id>/; any other file, including a link outside the checkout or bin/dev-setup's link to the checkout itself, stays where it is. Only directories left empty are removed. setup prints each kept path and a per-host summary, and prune.log in the backup lists every path. A tree with nothing left to remove is silent, so reruns print nothing. gstack-upgrade/migrations/v1.91.50.0.sh records the hosts an existing install serves and runs the same prune; a checkout no install points at is left alone. The Hermes, OpenClaw and GBrain hints say to add the host to the record before rendering it by hand. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * fix(build): name the installed-hosts record in the build's host line 'Rendering skills for: claude codex (recorded in <checkout>/.gstack-installed-hosts; GSTACK_RENDER_HOSTS=all renders every host)' instead of a nested parenthesis. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * v1.91.50.0 fix(install): skills only for the agents you installed, every runtime-root file their skills read (#1694, #1077) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * test(team-mode): copy bin/gstack-host-renders.sh into the setup fixture setup sources the new helper (#1694); team-mode's hand-picked fixture file list lacked it, so its two setup runs exited 1 ('gstack-host-renders.sh is missing'). Found by the final full free suite on 9b39cc6; product code is unchanged. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> * chore(release): re-slot C2 to v1.91.61.0 (merge queue); migration renamed to match VERSION Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --------- Co-authored-by: Yotam <yotsurfing@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
140 lines
6.5 KiB
Bash
Executable File
140 lines
6.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Set up gstack for local development — test skills from within this repo.
|
|
#
|
|
# Creates .claude/skills/gstack → (symlink to repo root) so Claude Code
|
|
# discovers skills from your working tree. Changes take effect immediately.
|
|
#
|
|
# Also copies .env from the main worktree if this is a Conductor workspace
|
|
# or git worktree (so API keys carry over automatically).
|
|
#
|
|
# Usage: bin/dev-setup # set up
|
|
# bin/dev-teardown # clean up
|
|
set -e
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
# 1. Copy .env from main worktree (if we're a worktree and don't have one)
|
|
if [ ! -f "$REPO_ROOT/.env" ]; then
|
|
MAIN_WORKTREE="$(git -C "$REPO_ROOT" worktree list --porcelain 2>/dev/null | head -1 | sed 's/^worktree //')"
|
|
if [ -n "$MAIN_WORKTREE" ] && [ "$MAIN_WORKTREE" != "$REPO_ROOT" ] && [ -f "$MAIN_WORKTREE/.env" ]; then
|
|
cp "$MAIN_WORKTREE/.env" "$REPO_ROOT/.env"
|
|
echo "Copied .env from main worktree ($MAIN_WORKTREE)"
|
|
fi
|
|
fi
|
|
|
|
# 2. Install dependencies
|
|
if [ ! -d "$REPO_ROOT/node_modules" ]; then
|
|
echo "Installing dependencies..."
|
|
(cd "$REPO_ROOT" && bun install)
|
|
fi
|
|
|
|
# 3. Create .claude/skills/ inside the repo
|
|
mkdir -p "$REPO_ROOT/.claude/skills"
|
|
|
|
# 4. Symlink .claude/skills/gstack → repo root
|
|
# This makes setup think it's inside a real .claude/skills/ directory
|
|
GSTACK_LINK="$REPO_ROOT/.claude/skills/gstack"
|
|
if [ -L "$GSTACK_LINK" ]; then
|
|
echo "Updating existing symlink..."
|
|
rm "$GSTACK_LINK"
|
|
elif [ -d "$GSTACK_LINK" ]; then
|
|
echo "Error: .claude/skills/gstack is a real directory, not a symlink." >&2
|
|
echo "Remove it manually if you want to use dev mode." >&2
|
|
exit 1
|
|
fi
|
|
ln -s "$REPO_ROOT" "$GSTACK_LINK"
|
|
|
|
# 5. Create .agents/skills/gstack → repo root (for Codex/Gemini/Cursor)
|
|
mkdir -p "$REPO_ROOT/.agents/skills"
|
|
AGENTS_LINK="$REPO_ROOT/.agents/skills/gstack"
|
|
if [ -L "$AGENTS_LINK" ]; then
|
|
rm "$AGENTS_LINK"
|
|
elif [ -d "$AGENTS_LINK" ]; then
|
|
echo "Warning: .agents/skills/gstack is a real directory, skipping." >&2
|
|
fi
|
|
if [ ! -e "$AGENTS_LINK" ]; then
|
|
ln -s "$REPO_ROOT" "$AGENTS_LINK"
|
|
fi
|
|
|
|
# 5b. Record Codex as a host this checkout serves (bin/gstack-host-renders.sh),
|
|
# so setup and `bun run build` keep rendering .agents/ for it (#1694).
|
|
. "$REPO_ROOT/bin/gstack-host-renders.sh"
|
|
gstack_render_hosts_add "$REPO_ROOT" codex
|
|
|
|
# 6. Run setup via the symlink so it detects .claude/skills/ as its parent.
|
|
#
|
|
# Workspace/dev setup MUST be non-interactive: Conductor runs this under a
|
|
# forwarded pty, so any `read` in setup (skill-prefix prompt, plan-tune hook
|
|
# consent) would hang the workspace forever. Detaching stdin makes every setup
|
|
# prompt take its smart non-interactive default (flat skill names, etc.).
|
|
#
|
|
# `--plan-tune-hooks=prompt` is load-bearing, not redundant: stdin alone only
|
|
# suppresses the *prompt* branch. A saved `plan_tune_hooks: yes` or an exported
|
|
# GSTACK_PLAN_TUNE_HOOKS=yes would still resolve to "install" and rewrite the
|
|
# user's global ~/.claude/settings.json to point at THIS ephemeral worktree —
|
|
# which breaks once the workspace is deleted. The flag has highest precedence,
|
|
# so it pins resolution to "prompt" (setup's PT_EXPLICIT provenance keeps the
|
|
# Conductor auto-opt-in from overriding an explicit flag), and closed stdin
|
|
# then makes prompt-mode a no-op skip (no install, no decline marker).
|
|
#
|
|
# A dev workspace never ADDS hooks to global settings.json. One stated repair
|
|
# exception: setup's heal-first pass may PRUNE dead gstack hook entries and
|
|
# RE-POINT existing ones at the stable ~/.claude/skills/gstack install —
|
|
# strictly convergent repair, never a new registration, and hook registration
|
|
# itself is canonical-only (an ephemeral tree path can never be baked in).
|
|
# To install the hooks, run `./setup --plan-tune-hooks` directly (outside
|
|
# dev-setup). Saved prefix/other config preferences still apply.
|
|
#
|
|
# GSTACK_SKIP_GBRAIN_REGEN=1 is passed INLINE (not exported) so it scopes to
|
|
# exactly this nested setup call and can't leak into any other setup path. It
|
|
# tells setup NOT to regenerate the gbrain :user variant into the tracked
|
|
# worktree (that would dirty checked-in source). We render it into an untracked
|
|
# per-workspace dir below instead.
|
|
GSTACK_SKIP_GBRAIN_REGEN=1 "$GSTACK_LINK/setup" --plan-tune-hooks=prompt </dev/null
|
|
|
|
# 7. Brain-aware (gbrain) blocks — render into an untracked workspace dir.
|
|
#
|
|
# The worktree's SKILL.md files stay canonical (the guard above). If gbrain is
|
|
# installed, render the :user variant (with GBRAIN_CONTEXT_LOAD +
|
|
# GBRAIN_SAVE_RESULTS) into .claude/gstack-rendered (gitignored, per-workspace)
|
|
# and repoint the workspace's SKILL.md symlinks at it. gen-skill-docs --out-dir
|
|
# also rewrites the section-base path so section reads resolve to the render, not
|
|
# the global install. Result: this workspace gets the full gbrain experience
|
|
# while git stays clean. Other projects pick up blocks via `gstack-config
|
|
# gbrain-refresh` (printed below).
|
|
GBRAIN_DETECT="$REPO_ROOT/bin/gstack-gbrain-detect"
|
|
RENDER_DIR="$REPO_ROOT/.claude/gstack-rendered"
|
|
if [ -x "$GBRAIN_DETECT" ] && "$GBRAIN_DETECT" --is-ok 2>/dev/null; then
|
|
echo ""
|
|
echo "gbrain detected — rendering brain-aware skills into .claude/gstack-rendered (workspace-only, untracked)..."
|
|
rm -rf "$RENDER_DIR"
|
|
if ( cd "$REPO_ROOT" && bun run gen:skill-docs:user --host claude --out-dir "$RENDER_DIR" >/dev/null 2>&1 ); then
|
|
# Repoint each project-local SKILL.md symlink whose worktree target has a
|
|
# rendered counterpart. The skill DIRECTORY name (basename of the symlink
|
|
# target's dir) maps to RENDER_DIR/<dir>/SKILL.md, which is robust to
|
|
# frontmatter renames and the gstack- prefix on the link name.
|
|
repointed=0
|
|
for skill_link in "$REPO_ROOT"/.claude/skills/*/SKILL.md; do
|
|
[ -L "$skill_link" ] || continue
|
|
target="$(readlink "$skill_link")"
|
|
skilldir="$(basename "$(dirname "$target")")"
|
|
rendered="$RENDER_DIR/$skilldir/SKILL.md"
|
|
if [ -f "$rendered" ]; then ln -snf "$rendered" "$skill_link"; repointed=$((repointed + 1)); fi
|
|
done
|
|
echo " $repointed workspace skills now serve brain-aware blocks (worktree stays canonical)."
|
|
else
|
|
echo " warning: brain-aware render failed — workspace uses canonical skills."
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo "Dev mode active. Skills resolve from this working tree."
|
|
echo " .claude/skills/gstack → $REPO_ROOT"
|
|
echo " .agents/skills/gstack → $REPO_ROOT"
|
|
echo "Edit any SKILL.md and test immediately — no copy/deploy needed."
|
|
echo ""
|
|
echo "To make brain-aware blocks live across your OTHER projects too, run:"
|
|
echo " gstack-config gbrain-refresh"
|
|
echo ""
|
|
echo "To tear down: bin/dev-teardown"
|