Skip to main content

scripts/worktree-feature/run.sh

Ghost doc — This is the real launcher script found at scripts/worktree-feature/run.sh in the Smithers repository.

Source

#!/usr/bin/env bash
# Run the Worktree+MergeQueue feature workflow
# Usage: ./run.sh

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/../../../.." && pwd)"

cd "$SCRIPT_DIR"

export USE_CLI_AGENTS=1
export SMITHERS_DEBUG=1
export SMITHERS_UNSAFE=1
unset ANTHROPIC_API_KEY

SMITHERS_CLI="${SMITHERS_CLI:-./node_modules/.bin/smithers}"

echo "Starting Worktree+MergeQueue feature workflow"
echo "Root directory: $ROOT_DIR"
echo "Press Ctrl+C to stop."
echo ""

bun "$SMITHERS_CLI" run workflow.tsx --input '{}' --root "$ROOT_DIR"

package.json

{
  "name": "worktree-feature-workflow",
  "type": "module",
  "scripts": {
    "start": "bun run workflow.tsx",
    "resume": "smithers resume workflow.tsx",
    "typecheck": "tsc --noEmit"
  },
  "dependencies": {
    "@ai-sdk/anthropic": "^3.0.36",
    "@ai-sdk/openai": "^2.0.0",
    "ai": "^6.0.69",
    "smithers-orchestrator": "file:../../",
    "zod": "^4.3.6"
  }
}

config.ts

// scripts/worktree-feature/config.ts

/** Maximum review->fix rounds before the validation loop gives up. */
export const MAX_REVIEW_ROUNDS = 3;

/** Steps per review round (implement + validate + review + reviewfix). */
export const STEPS_PER_ROUND = 4;

preload.ts

// scripts/worktree-feature/preload.ts
import { mdxPlugin } from "smithers-orchestrator/mdx-plugin";

mdxPlugin();

What This Demonstrates

  • Environment-driven agent selectionUSE_CLI_AGENTS=1 selects CLI agents (Claude Code / Codex CLI) over API agents. SMITHERS_UNSAFE=1 enables dangerouslySkipPermissions for unattended execution.
  • Local dependency"smithers-orchestrator": "file:../../" links to the local package, useful for developing workflows alongside the framework.
  • MDX plugin preloadpreload.ts registers the MDX plugin, enabling .mdx imports as JSX components.
  • --root flag — Passes the repository root to the Smithers CLI so agents can access the full codebase, not just the workflow directory.
  • Resume supportsmithers resume workflow.tsx resumes a previously interrupted workflow from its last checkpoint.