mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 11:45:20 +02:00
b805aa0113
* feat: add Confusion Protocol to preamble resolver Injects a high-stakes ambiguity gate at preamble tier >= 2 so all workflow skills get it. Fires when Claude encounters architectural decisions, data model changes, destructive operations, or contradictory requirements. Does NOT fire on routine coding. Addresses Karpathy failure mode #1 (wrong assumptions) with an inline STOP gate instead of relying on workflow skill invocation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add Hermes and GBrain host configs Hermes: tool rewrites for terminal/read_file/patch/delegate_task, paths to ~/.hermes/skills/gstack, AGENTS.md config file. GBrain: coding skills become brain-aware when GBrain mod is installed. Same tool rewrites as OpenClaw (agents spawn Claude Code via ACP). GBRAIN_CONTEXT_LOAD and GBRAIN_SAVE_RESULTS NOT suppressed on gbrain host, enabling brain-first lookup and save-to-brain behavior. Both registered in hosts/index.ts with setup script redirect messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: GBrain resolver — brain-first lookup and save-to-brain New scripts/resolvers/gbrain.ts with two resolver functions: - GBRAIN_CONTEXT_LOAD: search brain for context before skill starts - GBRAIN_SAVE_RESULTS: save skill output to brain after completion Placeholders added to 4 thinking skill templates (office-hours, investigate, plan-ceo-review, retro). Resolves to empty string on all hosts except gbrain via suppressedResolvers. GBRAIN suppression added to all 9 non-gbrain host configs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: wire slop:diff into /review as advisory diagnostic Adds Step 3.5 to the review template: runs bun run slop:diff against the base branch to catch AI code quality issues (empty catches, redundant return await, overcomplicated abstractions). Advisory only, never blocking. Skips silently if slop-scan is not installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: add Karpathy compatibility note to README Positions gstack as the workflow enforcement layer for Karpathy-style CLAUDE.md rules (17K stars). Links to forrestchang/andrej-karpathy-skills. Maps each Karpathy failure mode to the gstack skill that addresses it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: improve native OpenClaw thinking skills office-hours: add design doc path visibility message after writing ceo-review: add HARD GATE reminder at review section transitions retro: add non-git context support (check memory for meeting notes) Mirrors template improvements to hand-crafted native skills. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: update tests and golden fixtures for new hosts - Host count: 8 → 10 (hermes, gbrain) - OpenClaw adapter test: expects undefined (dead code removed) - Golden ship fixtures: updated with Confusion Protocol + vendoring Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: regenerate all SKILL.md files Regenerated from templates after Confusion Protocol, GBrain resolver placeholders, slop:diff in review, HARD GATE reminders, investigation learnings, design doc visibility, and retro non-git context changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: update project documentation for v0.18.0.0 - CHANGELOG: add v0.18.0.0 entry (Confusion Protocol, Hermes, GBrain, slop in review, Karpathy note, skill improvements) - CLAUDE.md: add hermes.ts and gbrain.ts to hosts listing - README.md: update agent count 8→10, add Hermes + GBrain to table - VERSION: bump to 0.18.0.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: sync package.json version to 0.18.0.0 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: extract Step 0 from review SKILL.md in E2E test The review-base-branch E2E test was copying the full 1493-line review/SKILL.md into the test fixture. The agent spent 8+ turns reading it in chunks, leaving only 7 turns for actual work, causing error_max_turns on every attempt. Now extracts only Step 0 (base branch detection, ~50 lines) which is all the test actually needs. Follows the CLAUDE.md rule: "NEVER copy a full SKILL.md file into an E2E test fixture." Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: update GBrain and Hermes host configs for v0.10.0 integration GBrain: add 'triggers' to keepFields so generated skills pass checkResolvable() validation. Add version compat comment. Hermes: un-suppress GBRAIN_CONTEXT_LOAD and GBRAIN_SAVE_RESULTS. The resolvers handle GBrain-not-installed gracefully, so Hermes agents with GBrain as a mod get brain features automatically. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: GBrain resolver DX improvements and preamble health check Resolver changes: - gbrain query → gbrain search (fast keyword search, not expensive hybrid) - Add keyword extraction guidance for agents - Show explicit gbrain put_page syntax with --title, --tags, heredoc - Add entity enrichment with false-positive filter - Name throttle error patterns (exit code 1, stderr keywords) - Add data-research routing for investigate skill - Expand skillSaveMap from 4 to 8 entries - Add brain operation telemetry summary Preamble changes: - Add gbrain doctor --fast --json health check for gbrain/hermes hosts - Parse check failures/warnings count - Show failing check details when score < 50 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve keepFields in allowlist frontmatter mode The allowlist mode hard-coded name + description reconstruction but never iterated keepFields for additional fields. Adding 'triggers' to keepFields was a no-op because the field was silently stripped. Now iterates keepFields and preserves any field beyond name/description from the source template frontmatter, including YAML arrays. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add triggers to all 38 skill templates Multi-word, skill-specific trigger keywords for GBrain's RESOLVER.md router. Each skill gets 3-6 triggers derived from its "Use when asked to..." description text. Avoids single generic words that would collide across skills (e.g., "debug this" not "debug"). These are distinct from voice-triggers (speech-to-text aliases) and serve GBrain's checkResolvable() validation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: regenerate all SKILL.md files and update golden fixtures Regenerated from updated templates (triggers, brain placeholders, resolver DX improvements, preamble health check). Golden fixtures updated to match. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: settings-hook remove exits 1 when nothing to remove gstack-settings-hook remove was exiting 0 when settings.json didn't exist, causing gstack-uninstall to report "SessionStart hook" as removed on clean systems where nothing was installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * docs: update project documentation for GBrain v0.10.0 integration ARCHITECTURE.md: added GBRAIN_CONTEXT_LOAD and GBRAIN_SAVE_RESULTS to resolver table. CHANGELOG.md: expanded v0.18.0.0 entry with GBrain v0.10.0 integration details (triggers, expanded brain-awareness, DX improvements, Hermes brain support), updated date. CLAUDE.md: added gbrain to resolvers/ directory comment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: routing E2E stops writing to user's ~/.claude/skills/ installSkills() was copying SKILL.md files to both project-level (.claude/skills/ in tmpDir) and user-level (~/.claude/skills/). Writing to the user's real install fails when symlinks point to different worktrees or dangling targets (ENOENT on copyFileSync). Now installs to project-level only. The test already sets cwd to the tmpDir, so project-level discovery works. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: scale Gemini E2E back to smoke test Gemini CLI gets lost in worktrees on complex tasks (review times out at 600s, discover-skill hits exit 124). Nobody uses Gemini for gstack skill execution. Replace the two failing tests (gemini-discover-skill and gemini-review-findings) with a single smoke test that verifies Gemini can start and read the README. 90s timeout, no skill invocation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
226 lines
7.6 KiB
Cheetah
226 lines
7.6 KiB
Cheetah
---
|
|
name: setup-deploy
|
|
preamble-tier: 2
|
|
version: 1.0.0
|
|
description: |
|
|
Configure deployment settings for /land-and-deploy. Detects your deploy
|
|
platform (Fly.io, Render, Vercel, Netlify, Heroku, GitHub Actions, custom),
|
|
production URL, health check endpoints, and deploy status commands. Writes
|
|
the configuration to CLAUDE.md so all future deploys are automatic.
|
|
Use when: "setup deploy", "configure deployment", "set up land-and-deploy",
|
|
"how do I deploy with gstack", "add deploy config".
|
|
triggers:
|
|
- configure deploy
|
|
- setup deployment
|
|
- set deploy platform
|
|
allowed-tools:
|
|
- Bash
|
|
- Read
|
|
- Write
|
|
- Edit
|
|
- Glob
|
|
- Grep
|
|
- AskUserQuestion
|
|
---
|
|
|
|
{{PREAMBLE}}
|
|
|
|
# /setup-deploy — Configure Deployment for gstack
|
|
|
|
You are helping the user configure their deployment so `/land-and-deploy` works
|
|
automatically. Your job is to detect the deploy platform, production URL, health
|
|
checks, and deploy status commands — then persist everything to CLAUDE.md.
|
|
|
|
After this runs once, `/land-and-deploy` reads CLAUDE.md and skips detection entirely.
|
|
|
|
## User-invocable
|
|
When the user types `/setup-deploy`, run this skill.
|
|
|
|
## Instructions
|
|
|
|
### Step 1: Check existing configuration
|
|
|
|
```bash
|
|
grep -A 20 "## Deploy Configuration" CLAUDE.md 2>/dev/null || echo "NO_CONFIG"
|
|
```
|
|
|
|
If configuration already exists, show it and ask:
|
|
|
|
- **Context:** Deploy configuration already exists in CLAUDE.md.
|
|
- **RECOMMENDATION:** Choose A to update if your setup changed.
|
|
- A) Reconfigure from scratch (overwrite existing)
|
|
- B) Edit specific fields (show current config, let me change one thing)
|
|
- C) Done — configuration looks correct
|
|
|
|
If the user picks C, stop.
|
|
|
|
### Step 2: Detect platform
|
|
|
|
Run the platform detection from the deploy bootstrap:
|
|
|
|
```bash
|
|
# Platform config files
|
|
[ -f fly.toml ] && echo "PLATFORM:fly" && cat fly.toml
|
|
[ -f render.yaml ] && echo "PLATFORM:render" && cat render.yaml
|
|
[ -f vercel.json ] || [ -d .vercel ] && echo "PLATFORM:vercel"
|
|
[ -f netlify.toml ] && echo "PLATFORM:netlify" && cat netlify.toml
|
|
[ -f Procfile ] && echo "PLATFORM:heroku"
|
|
[ -f railway.json ] || [ -f railway.toml ] && echo "PLATFORM:railway"
|
|
|
|
# GitHub Actions deploy workflows
|
|
for f in $(find .github/workflows -maxdepth 1 \( -name '*.yml' -o -name '*.yaml' \) 2>/dev/null); do
|
|
[ -f "$f" ] && grep -qiE "deploy|release|production|staging|cd" "$f" 2>/dev/null && echo "DEPLOY_WORKFLOW:$f"
|
|
done
|
|
|
|
# Project type
|
|
[ -f package.json ] && grep -q '"bin"' package.json 2>/dev/null && echo "PROJECT_TYPE:cli"
|
|
find . -maxdepth 1 -name '*.gemspec' 2>/dev/null | grep -q . && echo "PROJECT_TYPE:library"
|
|
```
|
|
|
|
### Step 3: Platform-specific setup
|
|
|
|
Based on what was detected, guide the user through platform-specific configuration.
|
|
|
|
#### Fly.io
|
|
|
|
If `fly.toml` detected:
|
|
|
|
1. Extract app name: `grep -m1 "^app" fly.toml | sed 's/app = "\(.*\)"/\1/'`
|
|
2. Check if `fly` CLI is installed: `which fly 2>/dev/null`
|
|
3. If installed, verify: `fly status --app {app} 2>/dev/null`
|
|
4. Infer URL: `https://{app}.fly.dev`
|
|
5. Set deploy status command: `fly status --app {app}`
|
|
6. Set health check: `https://{app}.fly.dev` (or `/health` if the app has one)
|
|
|
|
Ask the user to confirm the production URL. Some Fly apps use custom domains.
|
|
|
|
#### Render
|
|
|
|
If `render.yaml` detected:
|
|
|
|
1. Extract service name and type from render.yaml
|
|
2. Check for Render API key: `echo $RENDER_API_KEY | head -c 4` (don't expose the full key)
|
|
3. Infer URL: `https://{service-name}.onrender.com`
|
|
4. Render deploys automatically on push to the connected branch — no deploy workflow needed
|
|
5. Set health check: the inferred URL
|
|
|
|
Ask the user to confirm. Render uses auto-deploy from the connected git branch — after
|
|
merge to main, Render picks it up automatically. The "deploy wait" in /land-and-deploy
|
|
should poll the Render URL until it responds with the new version.
|
|
|
|
#### Vercel
|
|
|
|
If vercel.json or .vercel detected:
|
|
|
|
1. Check for `vercel` CLI: `which vercel 2>/dev/null`
|
|
2. If installed: `vercel ls --prod 2>/dev/null | head -3`
|
|
3. Vercel deploys automatically on push — preview on PR, production on merge to main
|
|
4. Set health check: the production URL from vercel project settings
|
|
|
|
#### Netlify
|
|
|
|
If netlify.toml detected:
|
|
|
|
1. Extract site info from netlify.toml
|
|
2. Netlify deploys automatically on push
|
|
3. Set health check: the production URL
|
|
|
|
#### GitHub Actions only
|
|
|
|
If deploy workflows detected but no platform config:
|
|
|
|
1. Read the workflow file to understand what it does
|
|
2. Extract the deploy target (if mentioned)
|
|
3. Ask the user for the production URL
|
|
|
|
#### Custom / Manual
|
|
|
|
If nothing detected:
|
|
|
|
Use AskUserQuestion to gather the information:
|
|
|
|
1. **How are deploys triggered?**
|
|
- A) Automatically on push to main (Fly, Render, Vercel, Netlify, etc.)
|
|
- B) Via GitHub Actions workflow
|
|
- C) Via a deploy script or CLI command (describe it)
|
|
- D) Manually (SSH, dashboard, etc.)
|
|
- E) This project doesn't deploy (library, CLI, tool)
|
|
|
|
2. **What's the production URL?** (Free text — the URL where the app runs)
|
|
|
|
3. **How can gstack check if a deploy succeeded?**
|
|
- A) HTTP health check at a specific URL (e.g., /health, /api/status)
|
|
- B) CLI command (e.g., `fly status`, `kubectl rollout status`)
|
|
- C) Check the GitHub Actions workflow status
|
|
- D) No automated way — just check the URL loads
|
|
|
|
4. **Any pre-merge or post-merge hooks?**
|
|
- Commands to run before merging (e.g., `bun run build`)
|
|
- Commands to run after merge but before deploy verification
|
|
|
|
### Step 4: Write configuration
|
|
|
|
Read CLAUDE.md (or create it). Find and replace the `## Deploy Configuration` section
|
|
if it exists, or append it at the end.
|
|
|
|
```markdown
|
|
## Deploy Configuration (configured by /setup-deploy)
|
|
- Platform: {platform}
|
|
- Production URL: {url}
|
|
- Deploy workflow: {workflow file or "auto-deploy on push"}
|
|
- Deploy status command: {command or "HTTP health check"}
|
|
- Merge method: {squash/merge/rebase}
|
|
- Project type: {web app / API / CLI / library}
|
|
- Post-deploy health check: {health check URL or command}
|
|
|
|
### Custom deploy hooks
|
|
- Pre-merge: {command or "none"}
|
|
- Deploy trigger: {command or "automatic on push to main"}
|
|
- Deploy status: {command or "poll production URL"}
|
|
- Health check: {URL or command}
|
|
```
|
|
|
|
### Step 5: Verify
|
|
|
|
After writing, verify the configuration works:
|
|
|
|
1. If a health check URL was configured, try it:
|
|
```bash
|
|
curl -sf "{health-check-url}" -o /dev/null -w "%{http_code}" 2>/dev/null || echo "UNREACHABLE"
|
|
```
|
|
|
|
2. If a deploy status command was configured, try it:
|
|
```bash
|
|
{deploy-status-command} 2>/dev/null | head -5 || echo "COMMAND_FAILED"
|
|
```
|
|
|
|
Report results. If anything failed, note it but don't block — the config is still
|
|
useful even if the health check is temporarily unreachable.
|
|
|
|
### Step 6: Summary
|
|
|
|
```
|
|
DEPLOY CONFIGURATION — COMPLETE
|
|
════════════════════════════════
|
|
Platform: {platform}
|
|
URL: {url}
|
|
Health check: {health check}
|
|
Status cmd: {status command}
|
|
Merge method: {merge method}
|
|
|
|
Saved to CLAUDE.md. /land-and-deploy will use these settings automatically.
|
|
|
|
Next steps:
|
|
- Run /land-and-deploy to merge and deploy your current PR
|
|
- Edit the "## Deploy Configuration" section in CLAUDE.md to change settings
|
|
- Run /setup-deploy again to reconfigure
|
|
```
|
|
|
|
## Important Rules
|
|
|
|
- **Never expose secrets.** Don't print full API keys, tokens, or passwords.
|
|
- **Confirm with the user.** Always show the detected config and ask for confirmation before writing.
|
|
- **CLAUDE.md is the source of truth.** All configuration lives there — not in a separate config file.
|
|
- **Idempotent.** Running /setup-deploy multiple times overwrites the previous config cleanly.
|
|
- **Platform CLIs are optional.** If `fly` or `vercel` CLI isn't installed, fall back to URL-based health checks.
|