Add resilient setup script with pnpm auto-install

- scripts/setup.sh: Checks for pnpm, installs via corepack/npm if missing
- package.json: Updated to call bash script instead of node directly
- README.md: Updated with better quick start and troubleshooting
This commit is contained in:
shokollm
2026-04-18 12:38:16 +00:00
parent 3f12cd1072
commit d9bc27cb4a
3 changed files with 199 additions and 24 deletions

114
README.md
View File

@@ -4,11 +4,25 @@ A portable, file-based issue tracking and development workflow for teams.
## Quick Start
1. **Clone this repo** into your new project
2. **Install dependencies**: `pnpm install` (or npm, yarn)
3. **Run setup**: `pnpm run setup` (installs pre-commit hook)
4. **Read the docs**: See `docs/workflow/INDEX.md`
5. **Start working**: See `docs/workflow/WORKFLOW.md`
```bash
# Clone this repo into your new project
git clone https://git.fbrns.co/shoko/workflow.git my-new-project
cd my-new-project
# Remove git history (optional, for a fresh start)
rm -rf .git
# Initialize git
git init
# Setup (installs pnpm if missing, dependencies, and pre-commit hook)
pnpm run setup
# Remove this README (it's the template's README)
rm README.md
```
**That's it.** The setup script handles everything.
## What This Is
@@ -18,6 +32,14 @@ A portable, file-based issue tracking and development workflow for teams.
- **Humans approve reasoning**, not code line-by-line
- **Pre-commit hooks enforce** issue format before any commit
## Requirements
- **Node.js** (recommended: https://nodejs.org)
- If you don't have Node.js, the setup script will install `pnpm` using `corepack` or `npm`
- **Git**
No other dependencies required for the workflow itself.
## File Structure
```
@@ -32,30 +54,44 @@ A portable, file-based issue tracking and development workflow for teams.
│ └── example/ # Example issues
├── .hooks/ # Pre-commit validators
│ └── issue-linter.js # Issue format validator
── package.json # Setup scripts
── scripts/
│ └── setup.sh # Setup script
└── package.json # Setup commands
```
## Setup
## Setup Command
```bash
# Clone this repo into your new project
git clone https://git.fbrns.co/shoko/workflow.git my-new-project
cd my-new-project
pnpm run setup
```
# Remove git history (optional, for a fresh start)
rm -rf .git
This will:
1. Check for `pnpm`, install it if missing (via corepack or npm)
2. Install dependencies
3. Install the pre-commit hook in `.git/hooks/`
# Initialize git
git init
If Node.js isn't installed, the script will tell you to install it first.
# Install dependencies
## Manual Setup (Without pnpm)
If you prefer not to use pnpm:
```bash
# 1. Install Node.js from https://nodejs.org
# 2. Install pnpm
npm install -g pnpm
# 3. Install dependencies
pnpm install
# Setup pre-commit hook
pnpm run setup
# Remove this README (it's the template's README)
rm README.md
# 4. Manually install pre-commit hook
mkdir -p .git/hooks
cat > .git/hooks/pre-commit << 'EOF'
#!/bin/bash
node .hooks/issue-linter.js
EOF
chmod +x .git/hooks/pre-commit
```
## For Teams
@@ -73,6 +109,44 @@ To update the template for all projects:
- [Step-by-Step Workflow](docs/workflow/WORKFLOW.md)
- [Agent Prompts](docs/workflow/AGENT-PROMPTS.md)
## Troubleshooting
### "pnpm not found" during setup
The setup script tries to install pnpm automatically. If it fails:
```bash
# Install Node.js first
# Then enable pnpm via corepack
corepack enable
corepack prepare pnpm@latest --activate
# Or install via npm
npm install -g pnpm
# Re-run setup
pnpm run setup
```
### Pre-commit hook not running
```bash
# Make sure the hook is executable
chmod +x .git/hooks/pre-commit
# Test the hook manually
node .hooks/issue-linter.js
```
### "git commit rejected" errors
The pre-commit hook is rejecting your commit because:
- Code changed without a corresponding issue file
- Issue file is missing required fields
- Issue has `done` status but is incomplete
Fix the issue file and try again. Run `node .hooks/issue-linter.js` for details.
## License
Internal use. See https://git.fbrns.co/shoko/workflow