mirror of https://github.com/garrytan/gstack.git
fix: replace find-browse with direct path in SKILL.md setup blocks
Agents were skipping the find-browse binary and guessing bin/browse
(wrong path). Now the setup block explicitly checks browse/dist/browse
with workspace-local priority, global fallback.
Also adds || true to update check to prevent misleading exit code 1.
Adds {{UPDATE_CHECK}} and {{BROWSE_SETUP}} template placeholders to
gen-skill-docs.ts so all skills share a single source of truth.
This commit is contained in:
parent
6b69c46a27
commit
f4a298551a
11
SKILL.md
11
SKILL.md
|
|
@ -20,7 +20,7 @@ allowed-tools:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
||||||
[ -n "$_UPD" ] && echo "$_UPD"
|
[ -n "$_UPD" ] && echo "$_UPD" || true
|
||||||
```
|
```
|
||||||
|
|
||||||
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
||||||
|
|
@ -33,8 +33,11 @@ Auto-shuts down after 30 min idle. State persists between calls (cookies, tabs,
|
||||||
## SETUP (run this check BEFORE any browse command)
|
## SETUP (run this check BEFORE any browse command)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
B=$(browse/bin/find-browse 2>/dev/null || ~/.claude/skills/gstack/browse/bin/find-browse 2>/dev/null)
|
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||||
if [ -n "$B" ]; then
|
B=""
|
||||||
|
[ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
|
||||||
|
[ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
|
||||||
|
if [ -x "$B" ]; then
|
||||||
echo "READY: $B"
|
echo "READY: $B"
|
||||||
else
|
else
|
||||||
echo "NEEDS_SETUP"
|
echo "NEEDS_SETUP"
|
||||||
|
|
@ -58,8 +61,6 @@ If `NEEDS_SETUP`:
|
||||||
### Test a user flow (login, signup, checkout, etc.)
|
### Test a user flow (login, signup, checkout, etc.)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
B=~/.claude/skills/gstack/browse/dist/browse
|
|
||||||
|
|
||||||
# 1. Go to the page
|
# 1. Go to the page
|
||||||
$B goto https://app.example.com/login
|
$B goto https://app.example.com/login
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,35 +14,14 @@ allowed-tools:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Update Check (run first)
|
{{UPDATE_CHECK}}
|
||||||
|
|
||||||
```bash
|
|
||||||
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
|
||||||
[ -n "$_UPD" ] && echo "$_UPD"
|
|
||||||
```
|
|
||||||
|
|
||||||
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
|
||||||
|
|
||||||
# gstack browse: QA Testing & Dogfooding
|
# gstack browse: QA Testing & Dogfooding
|
||||||
|
|
||||||
Persistent headless Chromium. First call auto-starts (~3s), then ~100-200ms per command.
|
Persistent headless Chromium. First call auto-starts (~3s), then ~100-200ms per command.
|
||||||
Auto-shuts down after 30 min idle. State persists between calls (cookies, tabs, sessions).
|
Auto-shuts down after 30 min idle. State persists between calls (cookies, tabs, sessions).
|
||||||
|
|
||||||
## SETUP (run this check BEFORE any browse command)
|
{{BROWSE_SETUP}}
|
||||||
|
|
||||||
```bash
|
|
||||||
B=$(browse/bin/find-browse 2>/dev/null || ~/.claude/skills/gstack/browse/bin/find-browse 2>/dev/null)
|
|
||||||
if [ -n "$B" ]; then
|
|
||||||
echo "READY: $B"
|
|
||||||
else
|
|
||||||
echo "NEEDS_SETUP"
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
If `NEEDS_SETUP`:
|
|
||||||
1. Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
|
|
||||||
2. Run: `cd <SKILL_DIR> && ./setup`
|
|
||||||
3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
|
|
||||||
|
|
||||||
## IMPORTANT
|
## IMPORTANT
|
||||||
|
|
||||||
|
|
@ -56,8 +35,6 @@ If `NEEDS_SETUP`:
|
||||||
### Test a user flow (login, signup, checkout, etc.)
|
### Test a user flow (login, signup, checkout, etc.)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
B=~/.claude/skills/gstack/browse/dist/browse
|
|
||||||
|
|
||||||
# 1. Go to the page
|
# 1. Go to the page
|
||||||
$B goto https://app.example.com/login
|
$B goto https://app.example.com/login
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ allowed-tools:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
||||||
[ -n "$_UPD" ] && echo "$_UPD"
|
[ -n "$_UPD" ] && echo "$_UPD" || true
|
||||||
```
|
```
|
||||||
|
|
||||||
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
||||||
|
|
@ -30,6 +30,25 @@ If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/g
|
||||||
Persistent headless Chromium. First call auto-starts (~3s), then ~100ms per command.
|
Persistent headless Chromium. First call auto-starts (~3s), then ~100ms per command.
|
||||||
State persists between calls (cookies, tabs, login sessions).
|
State persists between calls (cookies, tabs, login sessions).
|
||||||
|
|
||||||
|
## SETUP (run this check BEFORE any browse command)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||||
|
B=""
|
||||||
|
[ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
|
||||||
|
[ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
|
||||||
|
if [ -x "$B" ]; then
|
||||||
|
echo "READY: $B"
|
||||||
|
else
|
||||||
|
echo "NEEDS_SETUP"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
If `NEEDS_SETUP`:
|
||||||
|
1. Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
|
||||||
|
2. Run: `cd <SKILL_DIR> && ./setup`
|
||||||
|
3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
|
||||||
|
|
||||||
## Core QA Patterns
|
## Core QA Patterns
|
||||||
|
|
||||||
### 1. Verify a page loads correctly
|
### 1. Verify a page loads correctly
|
||||||
|
|
|
||||||
|
|
@ -14,20 +14,15 @@ allowed-tools:
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Update Check (run first)
|
{{UPDATE_CHECK}}
|
||||||
|
|
||||||
```bash
|
|
||||||
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
|
||||||
[ -n "$_UPD" ] && echo "$_UPD"
|
|
||||||
```
|
|
||||||
|
|
||||||
If output shows `UPGRADE_AVAILABLE <old> <new>`: read `~/.claude/skills/gstack/gstack-upgrade/SKILL.md` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, `touch ~/.gstack/last-update-check` if no). If `JUST_UPGRADED <from> <to>`: tell user "Running gstack v{to} (just updated!)" and continue.
|
|
||||||
|
|
||||||
# browse: QA Testing & Dogfooding
|
# browse: QA Testing & Dogfooding
|
||||||
|
|
||||||
Persistent headless Chromium. First call auto-starts (~3s), then ~100ms per command.
|
Persistent headless Chromium. First call auto-starts (~3s), then ~100ms per command.
|
||||||
State persists between calls (cookies, tabs, login sessions).
|
State persists between calls (cookies, tabs, login sessions).
|
||||||
|
|
||||||
|
{{BROWSE_SETUP}}
|
||||||
|
|
||||||
## Core QA Patterns
|
## Core QA Patterns
|
||||||
|
|
||||||
### 1. Verify a page loads correctly
|
### 1. Verify a page loads correctly
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,43 @@ function generateSnapshotFlags(): string {
|
||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function generateUpdateCheck(): string {
|
||||||
|
return `## Update Check (run first)
|
||||||
|
|
||||||
|
\`\`\`bash
|
||||||
|
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
|
||||||
|
[ -n "$_UPD" ] && echo "$_UPD" || true
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
If output shows \`UPGRADE_AVAILABLE <old> <new>\`: read \`~/.claude/skills/gstack/gstack-upgrade/SKILL.md\` and follow the "Inline upgrade flow" (AskUserQuestion → upgrade if yes, \`touch ~/.gstack/last-update-check\` if no). If \`JUST_UPGRADED <from> <to>\`: tell user "Running gstack v{to} (just updated!)" and continue.`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateBrowseSetup(): string {
|
||||||
|
return `## SETUP (run this check BEFORE any browse command)
|
||||||
|
|
||||||
|
\`\`\`bash
|
||||||
|
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
|
||||||
|
B=""
|
||||||
|
[ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/gstack/browse/dist/browse" ] && B="$_ROOT/.claude/skills/gstack/browse/dist/browse"
|
||||||
|
[ -z "$B" ] && B=~/.claude/skills/gstack/browse/dist/browse
|
||||||
|
if [ -x "$B" ]; then
|
||||||
|
echo "READY: $B"
|
||||||
|
else
|
||||||
|
echo "NEEDS_SETUP"
|
||||||
|
fi
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
If \`NEEDS_SETUP\`:
|
||||||
|
1. Tell the user: "gstack browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
|
||||||
|
2. Run: \`cd <SKILL_DIR> && ./setup\`
|
||||||
|
3. If \`bun\` is not installed: \`curl -fsSL https://bun.sh/install | bash\``;
|
||||||
|
}
|
||||||
|
|
||||||
const RESOLVERS: Record<string, () => string> = {
|
const RESOLVERS: Record<string, () => string> = {
|
||||||
COMMAND_REFERENCE: generateCommandReference,
|
COMMAND_REFERENCE: generateCommandReference,
|
||||||
SNAPSHOT_FLAGS: generateSnapshotFlags,
|
SNAPSHOT_FLAGS: generateSnapshotFlags,
|
||||||
|
UPDATE_CHECK: generateUpdateCheck,
|
||||||
|
BROWSE_SETUP: generateBrowseSetup,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ─── Template Processing ────────────────────────────────────
|
// ─── Template Processing ────────────────────────────────────
|
||||||
|
|
@ -141,6 +175,8 @@ function findTemplates(): string[] {
|
||||||
const candidates = [
|
const candidates = [
|
||||||
path.join(ROOT, 'SKILL.md.tmpl'),
|
path.join(ROOT, 'SKILL.md.tmpl'),
|
||||||
path.join(ROOT, 'browse', 'SKILL.md.tmpl'),
|
path.join(ROOT, 'browse', 'SKILL.md.tmpl'),
|
||||||
|
path.join(ROOT, 'qa', 'SKILL.md.tmpl'),
|
||||||
|
path.join(ROOT, 'setup-browser-cookies', 'SKILL.md.tmpl'),
|
||||||
];
|
];
|
||||||
for (const p of candidates) {
|
for (const p of candidates) {
|
||||||
if (fs.existsSync(p)) templates.push(p);
|
if (fs.existsSync(p)) templates.push(p);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue