From 0bcc38cb3efc1c5977ab39e9d40e286a87975834 Mon Sep 17 00:00:00 2001 From: Tyrone Robb Date: Sat, 14 Mar 2026 14:14:12 +0000 Subject: [PATCH 1/3] feat(plan): add pre-flight check for duplicate upstream PRs and Issues --- bin/gstack-check-duplicates | 16 ++++++++++++++++ plan-ceo-review/SKILL.md | 3 ++- plan-eng-review/SKILL.md | 7 +++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 bin/gstack-check-duplicates diff --git a/bin/gstack-check-duplicates b/bin/gstack-check-duplicates new file mode 100755 index 0000000..06b22da --- /dev/null +++ b/bin/gstack-check-duplicates @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +echo "=== Recent Open Pull Requests ===" +if command -v gh >/dev/null 2>&1; then + gh pr list --state open --limit 10 || echo "(Failed to fetch PRs. Are you logged in with 'gh auth login'?)" +else + echo "(GitHub CLI 'gh' not installed. Skipping PR check.)" +fi + +echo "" +echo "=== Recent Open Issues ===" +if command -v gh >/dev/null 2>&1; then + gh issue list --state open --limit 10 || echo "(Failed to fetch Issues. Are you logged in with 'gh auth login'?)" +else + echo "(GitHub CLI 'gh' not installed. Skipping Issue check.)" +fi diff --git a/plan-ceo-review/SKILL.md b/plan-ceo-review/SKILL.md index 441eee1..9f08e03 100644 --- a/plan-ceo-review/SKILL.md +++ b/plan-ceo-review/SKILL.md @@ -65,11 +65,12 @@ Never skip Step 0, the system audit, the error/rescue map, or the failure modes ## PRE-REVIEW SYSTEM AUDIT (before Step 0) Before doing anything else, run a system audit. This is not the plan review — it is the context you need to review the plan intelligently. Run the following commands: -``` +```bash git log --oneline -30 # Recent history git diff main --stat # What's already changed git stash list # Any stashed work grep -r "TODO\|FIXME\|HACK\|XXX" --include="*.rb" --include="*.js" -l +~/.claude/skills/gstack/bin/gstack-check-duplicates # Check for existing PRs and Issues find . -name "*.rb" -newer Gemfile.lock | head -20 # Recently touched files ``` Then read CLAUDE.md, TODOS.md, and any existing architecture docs. Map: diff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.md index 0a3fa59..4525667 100644 --- a/plan-eng-review/SKILL.md +++ b/plan-eng-review/SKILL.md @@ -44,6 +44,13 @@ If you are running low on context or the user asks you to compress: Step 0 > Tes ## BEFORE YOU START: +### PRE-REVIEW SYSTEM AUDIT (before Step 0) +Run this command to check for existing Pull Requests and Issues: +```bash +~/.claude/skills/gstack/bin/gstack-check-duplicates +``` +Check the output to ensure this plan does not duplicate work that is already being handled elsewhere. + ### Step 0: Scope Challenge Before reviewing anything, answer these questions: 1. **What existing code already partially or fully solves each sub-problem?** Can we capture outputs from existing flows rather than building parallel ones? From e8c69af798a3f970d236cc18085db684c396c8ed Mon Sep 17 00:00:00 2001 From: Tyrone Robb Date: Sat, 14 Mar 2026 15:56:48 +0000 Subject: [PATCH 2/3] feat(review): add universal default review checklist This checklist acts as a fallback for projects that have not yet defined their own .claude/skills/review/checklist.md. It covers universal concerns such as SQL injection, trust boundaries, error handling, concurrency, and secrets. --- review/checklists/default.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 review/checklists/default.md diff --git a/review/checklists/default.md b/review/checklists/default.md new file mode 100644 index 0000000..360b908 --- /dev/null +++ b/review/checklists/default.md @@ -0,0 +1,25 @@ +# Default Review Checklist + +This project hasn't yet defined a custom checklist. These are the default universal safety and quality checks applied to all projects. Feel free to modify this file to capture project-specific context. + +## Pass 1: Critical Issues + +Please verify the following critically. Any issues found here MUST result in blocking the review and a change request. + +- **SQL Injection**: Parameterized queries must be used. No string formatting into SQL. +- **Trust Boundaries**: Inputs from users or external APIs must be validated and sanitized. +- **Error Handling**: No uncaught exceptions. Critical paths must return or throw explicitly handling the error. +- **Concurrency**: Operations on shared state must be protected (e.g., race conditions, TOCTOU). +- **Secrets**: No hardcoded credentials or API keys; must use environment variables. + +## Pass 2: Informational Issues + +These issues are worth raising, but typically are not blocking (unless egregious). + +- **Dead Code**: Remove any dead code, unused imports, or lingering debug statements (`console.log`, `print()`, etc.). +- **Consistency**: The code matches the surrounding style and idioms of the project. +- **Test Gaps**: Note missing coverage for significantly complex logic. + +## Suppressions + +If there is a valid reason to bypass a check (e.g., an explicit disable comment), do not flag it. From 11d69ed1d5276fa71cfa5ae4cafa266bca4a8400 Mon Sep 17 00:00:00 2001 From: Tyrone Robb Date: Sat, 14 Mar 2026 15:56:56 +0000 Subject: [PATCH 3/3] feat(init): add /gstack init command for brownfield onboarding The new init skill auto-detects a project's stack (e.g. Node.js, Ruby/Rails, Go, Rust, Python) by inspecting project files like package.json, Gemfile, etc., and extracts test/build commands. It scaffolds a .gstack.json and provides a default review checklist if none exists, enabling a one-command onboarding for any existing project. --- init/SKILL.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 init/SKILL.md diff --git a/init/SKILL.md b/init/SKILL.md new file mode 100644 index 0000000..d2854d5 --- /dev/null +++ b/init/SKILL.md @@ -0,0 +1,48 @@ +--- +description: Onboard an existing project to gstack in one command. +--- + +# /gstack init + +You are the `init` skill for gstack. Your job is to onboard an existing project (Greenfield or Brownfield) by auto-detecting its stack, inspecting build/test/CI configuration to find the correct commands, generating a `.gstack.json` file, and scaffolding a default review checklist if one is missing. + +Follow these steps precisely: + +1. **Pre-flight Checks** + - Check if you are currently executing inside a gstack installation directory itself (e.g., if `./setup` and `browse/src/cli.ts` exist relative to the root). If you are, abort and tell the user they cannot run `/gstack init` on gstack itself. + - Look for an existing `.gstack.json` in the current project root directory. If it exists, use the `AskUserQuestion` tool to ask the user if they want to overwrite it or partially update it. If they decline, abort. + +2. **Auto-detect Stack from Project Files** + - Look at the files in the current root directory (`package.json`, `Gemfile`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `build.gradle`, etc.). + - Identify the primary language and framework. For monorepos, multiple stacks can match; pick the root or dominant one. + +3. **Inspect Actual Commands** + - Examine the configuration files from the detected stack to determine the correct test and build/eval commands. + - For Node.js/TypeScript: Check `package.json` for `scripts.test`, `scripts.build`, etc. + - For Ruby on Rails: Look for `bin/test` or `rspec` in `Gemfile`. + - For Go: Assume `go test ./...` if `go.mod` is present. + - For Rust: Assume `cargo test` if `Cargo.toml` is present. + - For Python: Look at `pyproject.toml` or `tox.ini` for `pytest` or `tox`. + - **Crucial step**: Search for CI configuration files (e.g., `.github/workflows/*.yml` or `.gitlab-ci.yml`) to see exactly how tests are run in CI. Extract those commands if they are robust, as CI is the ground truth. + +4. **Generate `.gstack.json`** + - Present the detected test and eval commands to the user using the `AskUserQuestion` tool to confirm before writing them. + - Once confirmed (or adjusted by the user), generate the `.gstack.json` file in the current root directory using the following schema (include `evalCommand` as `null` if none, and an empty array for `evalPatterns` if none): + ```json + { + "testCommand": "", + "evalCommand": "", + "evalPatterns": [], + "reviewChecklist": ".claude/skills/review/checklist.md" + } + ``` + +5. **Scaffold Review Checklist if Missing** + - Check if `.claude/skills/review/checklist.md` exists in the current project. + - If it does NOT exist, create the directory `.claude/skills/review/` if necessary. + - Read the universal default checklist from the gstack installation at `.claude/skills/gstack/review/checklists/default.md`. + - Write the exact contents of that file to `.claude/skills/review/checklist.md` in the current project. + +6. **Summary Output** + - Output a short, helpful summary of what was detected and created (e.g., ".gstack.json created", "checklist.md scaffolded"). + - Conclude by telling the user: "You are now ready to use gstack! Use `/review` to review your code, and `/ship` to ship it."