@raftlabs/raftstack 1.7.2 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # RaftStack
2
2
 
3
- A CLI tool for setting up Git hooks, commit conventions, and GitHub integration in your projects.
3
+ CLI tool for setting up Git hooks, commit conventions, and GitHub integration in your projects.
4
+
5
+ [![npm version](https://badge.fury.io/js/%40raftlabs%2Fraftstack.svg)](https://www.npmjs.com/package/@raftlabs/raftstack)
6
+
7
+ ## What It Does
8
+
9
+ RaftStack automates development best practices:
4
10
 
5
- RaftStack automates the setup of development best practices including:
6
11
  - **Git hooks** with Husky (pre-commit, commit-msg, pre-push)
7
12
  - **Commit conventions** with Commitlint and cz-git
8
13
  - **Code formatting** with lint-staged and Prettier
@@ -10,6 +15,7 @@ RaftStack automates the setup of development best practices including:
10
15
  - **GitHub workflows** for PR checks
11
16
  - **CODEOWNERS** for automatic reviewer assignment
12
17
  - **AI code review** integration (CodeRabbit, GitHub Copilot)
18
+ - **Claude Code skills** for AI-assisted development
13
19
 
14
20
  ## Installation
15
21
 
@@ -40,397 +46,73 @@ The wizard will:
40
46
  4. Set up CODEOWNERS for automatic PR reviewers
41
47
  5. Generate all configuration files
42
48
 
43
- ## Getting Started
44
-
45
- After installing RaftStack in your project, follow these steps:
46
-
47
- ### 1. Initialize RaftStack
48
-
49
- ```bash
50
- # Run the interactive setup wizard
51
- pnpm dlx @raftlabs/raftstack init
52
- # or
53
- npx @raftlabs/raftstack init
54
- ```
55
-
56
- ### 2. Initialize Claude Code (Optional)
57
-
58
- If you use [Claude Code](https://claude.ai/code), initialize it to enable the bundled AI development skills:
59
-
49
+ After setup:
60
50
  ```bash
61
- claude /init
51
+ pnpm install # Install dependencies
52
+ pnpm commit # Make commits using interactive wizard
62
53
  ```
63
54
 
64
- This creates a `CLAUDE.md` file and enables the [Claude Code Skills](#claude-code-skills) that were copied to `.claude/skills/`.
65
-
66
- ### 3. Clean Up Before Committing
67
-
68
- RaftStack creates `.backup` files for any existing configs it modifies. Remove these before your first commit:
69
-
70
- ```bash
71
- # Find and review backup files
72
- find . -name "*.backup" -type f
73
-
74
- # Remove backup files after reviewing
75
- find . -name "*.backup" -type f -delete
76
- ```
77
-
78
- ### 4. Install Dependencies and Commit
79
-
80
- ```bash
81
- # Install new dependencies added by RaftStack
82
- pnpm install # or npm install / yarn
83
-
84
- # Stage all changes
85
- git add .
86
-
87
- # Use the interactive commit wizard
88
- pnpm commit
89
- ```
90
-
91
- ## What Gets Generated
92
-
93
- ### Git Hooks (via Husky)
94
-
95
- | Hook | Purpose |
96
- |------|---------|
97
- | `pre-commit` | Runs lint-staged to format and lint staged files |
98
- | `commit-msg` | Validates commit messages with Commitlint |
99
- | `pre-push` | Validates branch naming conventions |
100
-
101
- ### Configuration Files
102
-
103
- | File | Purpose |
104
- |------|---------|
105
- | `.husky/*` | Git hooks |
106
- | `commitlint.config.js` | Commit message validation rules |
107
- | `.czrc` + `cz.config.js` | Interactive commit wizard configuration |
108
- | `.lintstagedrc.js` | Pre-commit file processing rules |
109
- | `.prettierrc` | Code formatting rules (if not already configured) |
110
- | `.prettierignore` | Files to exclude from formatting |
111
-
112
- ### GitHub Integration
113
-
114
- | File | Purpose |
115
- |------|---------|
116
- | `.github/PULL_REQUEST_TEMPLATE.md` | PR template with checklist |
117
- | `.github/workflows/pr-checks.yml` | CI workflow for PR validation |
118
- | `.github/CODEOWNERS` | Automatic reviewer assignment |
119
- | `.github/BRANCH_PROTECTION_SETUP.md` | Branch protection setup guide |
120
-
121
- ### Documentation
122
-
123
- | File | Purpose |
124
- |------|---------|
125
- | `CONTRIBUTING.md` | Developer contribution guide |
126
- | `.github/QUICK_REFERENCE.md` | One-page workflow cheat sheet for developers |
127
-
128
- ## Package Manager Support
129
-
130
- RaftStack automatically detects and adapts to your package manager of choice:
131
-
132
- | Package Manager | Detection Method | Lockfile |
133
- |----------------|------------------|----------|
134
- | **npm** | `package-lock.json` | `package-lock.json` |
135
- | **pnpm** | `pnpm-lock.yaml` | `pnpm-lock.yaml` |
136
- | **Yarn Classic (1.x)** | `yarn.lock` | `yarn.lock` |
137
- | **Yarn Berry (2+)** | `yarn.lock` + `packageManager` field | `yarn.lock` |
138
-
139
- **Auto-Detection:**
140
- - RaftStack scans for lockfiles in your project root
141
- - Priority order: pnpm > Yarn > npm
142
- - For Yarn, the version is determined from the `packageManager` field in `package.json`
143
- - If no lockfile is found, you'll be prompted to select your preferred package manager
144
-
145
- **What Gets Customized:**
146
- - All generated hooks use the correct package manager commands (`npx` vs `pnpm dlx` vs `yarn dlx`)
147
- - GitHub workflows use appropriate install commands (`npm ci` vs `pnpm install --frozen-lockfile` vs `yarn install --immutable`)
148
- - pnpm projects automatically include the `pnpm/action-setup` action in CI workflows
149
- - Documentation shows the right commands for your package manager
150
-
151
55
  ## Commands
152
56
 
153
- ### `raftstack init`
154
-
155
- Interactive setup wizard that configures all tools.
156
-
157
- ```bash
158
- raftstack init
159
- ```
160
-
161
- ### `raftstack setup-protection`
162
-
163
- Configure GitHub branch protection rules via the GitHub API.
164
-
165
- ```bash
166
- raftstack setup-protection
167
- ```
168
-
169
- **Requirements:**
170
- - GitHub CLI (`gh`) installed and authenticated
171
- - Admin access to the repository
172
-
173
- ### `raftstack metrics`
57
+ | Command | Description |
58
+ |---------|-------------|
59
+ | `raftstack init` | Interactive setup wizard |
60
+ | `raftstack setup-protection` | Configure GitHub branch protection via API |
61
+ | `raftstack metrics` | Check repository compliance |
174
62
 
175
- Analyze repository compliance with RaftStack conventions.
63
+ ## Documentation
176
64
 
177
- ```bash
178
- raftstack metrics
179
- ```
180
-
181
- This command checks:
182
- - **Commit compliance** - Percentage of commits with task links
183
- - **Branch naming** - Percentage following naming conventions
184
- - **Overall compliance score** - Combined metrics
185
-
186
- Use during pilot rollout or ongoing maintenance to track team adoption.
187
-
188
- ## After Setup
65
+ 📖 **[Full User Guide](docs/USER_GUIDE.md)** — Complete reference including:
66
+ - All features explained in detail
67
+ - Claude Code skills and slash commands
68
+ - Daily development workflow
69
+ - Troubleshooting guide
70
+ - Files generated
189
71
 
190
- See [Getting Started](#getting-started) for the complete setup workflow. Once configured:
72
+ ## Commit & Branch Conventions
191
73
 
192
- - **Make commits** using `pnpm commit` for the interactive wizard
193
- - **Set up branch protection** on GitHub (see `.github/BRANCH_PROTECTION_SETUP.md`)
194
- - **Review generated configs** and customize as needed
195
-
196
- ## Commit Convention
74
+ ### Commit Types
197
75
 
198
- RaftStack enforces [Conventional Commits](https://www.conventionalcommits.org/):
76
+ Use `pnpm commit` for the interactive wizard, or follow this format:
199
77
 
200
78
  ```
201
79
  <type>(<scope>): <subject>
202
-
203
- <body>
204
-
205
- <footer>
206
80
  ```
207
81
 
208
- ### Commit Types
209
-
210
- | Type | Description |
211
- |------|-------------|
212
- | `feat` | New feature |
213
- | `fix` | Bug fix |
214
- | `docs` | Documentation changes |
215
- | `style` | Code style changes (formatting) |
216
- | `refactor` | Code refactoring |
217
- | `perf` | Performance improvements |
218
- | `test` | Adding or updating tests |
219
- | `build` | Build system changes |
220
- | `ci` | CI configuration changes |
221
- | `chore` | Other changes |
222
- | `revert` | Reverting changes |
223
-
224
- ### Example Commits
225
-
226
- ```bash
227
- # Feature
228
- feat(auth): add social login support
82
+ Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
229
83
 
230
- # Bug fix
231
- fix(api): handle null response from server
84
+ ### Branch Naming
232
85
 
233
- # With Asana link (if configured)
234
- feat(dashboard): add usage analytics widget
235
-
236
- Implements real-time usage tracking for the dashboard.
237
-
238
- Asana: https://app.asana.com/0/workspace/task-id
239
86
  ```
240
-
241
- ## Branch Naming Convention
242
-
243
- RaftStack validates branch names on push:
244
-
245
- | Pattern | Example |
246
- |---------|---------|
247
- | `feature/*` | `feature/user-authentication` |
248
- | `fix/*` | `fix/login-validation` |
249
- | `hotfix/*` | `hotfix/security-patch` |
250
- | `bugfix/*` | `bugfix/form-submission` |
251
- | `release/*` | `release/v1.2.0` |
252
- | `chore/*` | `chore/update-dependencies` |
253
- | `docs/*` | `docs/api-reference` |
254
- | `refactor/*` | `refactor/auth-module` |
255
- | `test/*` | `test/user-service` |
256
- | `ci/*` | `ci/github-actions` |
257
-
258
- Protected branches: `main`, `master`, `develop`, `staging`, `production`
259
-
260
- ## Project Type Detection
261
-
262
- RaftStack automatically detects your project structure:
263
-
264
- | Type | Detection |
265
- |------|-----------|
266
- | NX Monorepo | `nx.json` present |
267
- | Turborepo | `turbo.json` present |
268
- | pnpm Workspace | `pnpm-workspace.yaml` present |
269
- | Single Package | Default when no monorepo config found |
270
-
271
- ## Asana Integration
272
-
273
- If you enable Asana integration, RaftStack will:
274
- - Add Asana task link prompts to the commit wizard
275
- - Include an Asana section in the PR template
276
- - Show warnings (not errors) for commits without task links
277
-
278
- **Note:** Task link validation is set to warning level by default. To make it required, edit `commitlint.config.js` and change the rule level from `1` to `2`.
279
-
280
- ## AI Code Review
281
-
282
- RaftStack supports optional AI code review integration:
283
-
284
- - **CodeRabbit**: Generates `.coderabbit.yaml` configuration
285
- - **GitHub Copilot**: Adds workflow for Copilot code review
286
-
287
- ## Claude Code Skills
288
-
289
- RaftStack bundles AI-assisted development skills for Claude Code. When initialized, these skills are copied to `.claude/skills/`:
290
-
291
- | Skill | Purpose |
292
- |-------|---------|
293
- | `react` | React 19+ patterns, SOLID components, performance optimization |
294
- | `backend` | Clean architecture for serverless/Hono/Express backends |
295
- | `database` | PostgreSQL/Drizzle ORM schema design and indexing |
296
- | `seo` | Technical SEO for Next.js/React applications |
297
- | `code-quality` | Universal readability rules (30-line functions, naming, etc.) |
298
-
299
- These skills automatically apply best practices when using Claude Code for development.
300
-
301
- ## ESLint Configuration (Optional)
302
-
303
- RaftStack can generate ESLint 9 flat config for projects without existing ESLint setup:
304
-
305
- - **TypeScript support** with `typescript-eslint`
306
- - **React support** auto-detected and configured
307
- - **Modern flat config** format (ESLint 9+)
308
- - **Skips** if ESLint is already configured
309
-
310
- To add ESLint to the init flow, the generator automatically detects if ESLint is needed.
311
-
312
- ## Requirements
313
-
314
- - Node.js >= 18
315
- - Git repository initialized
316
- - Package manager: pnpm, npm, or yarn
87
+ feature/description fix/description hotfix/description
88
+ release/v1.0.0 chore/task-name docs/update
89
+ ```
317
90
 
318
91
  ## Troubleshooting
319
92
 
320
- ### Husky hooks not running
321
-
93
+ ### Hooks not running
322
94
  ```bash
323
- # Reinstall husky
324
95
  pnpm exec husky
325
-
326
- # Make hooks executable
327
96
  chmod +x .husky/*
328
97
  ```
329
98
 
330
99
  ### Commit validation failing
331
-
332
- Check your commit message format:
333
- ```bash
334
- # Use the interactive wizard
335
- pnpm commit
336
-
337
- # Or ensure format: type(scope): subject
338
- git commit -m "feat(auth): add login page"
339
- ```
340
-
341
- ### Branch name validation failing
342
-
343
- Ensure your branch follows the naming convention:
344
100
  ```bash
345
- # Correct
346
- git checkout -b feature/my-feature
347
-
348
- # Incorrect
349
- git checkout -b my-feature # Missing prefix
350
- ```
351
-
352
- ### Permission denied on hooks
353
-
354
- ```bash
355
- chmod +x .husky/pre-commit
356
- chmod +x .husky/commit-msg
357
- chmod +x .husky/pre-push
101
+ pnpm commit # Use interactive wizard
358
102
  ```
359
103
 
360
- ### Files not being formatted
361
-
362
- Check your `.lintstagedrc.js` configuration and ensure the file patterns match your project structure.
363
-
364
- ## Organization Rollout
365
-
366
- For deploying RaftStack across multiple projects in your organization, use the deployment helper script:
367
-
368
- ```bash
369
- # Download and run
370
- curl -fsSL https://raw.githubusercontent.com/Raft-Labs/raftstack/main/scripts/deploy-to-project.sh -o deploy.sh
371
- chmod +x deploy.sh
372
-
373
- # Deploy to a project
374
- ./deploy.sh /path/to/project https://app.asana.com/0/project/task
375
- ```
376
-
377
- The script:
378
- 1. Creates a `chore/setup-raftstack` branch
379
- 2. Runs `raftstack init`
380
- 3. Commits with proper message format
381
- 4. Pushes and creates a PR (if `gh` CLI is available)
382
-
383
- ## Versioning and Releases
384
-
385
- This project uses [Semantic Versioning](https://semver.org/) and automated releases.
386
-
387
- ### Version Bumping
388
-
389
- Use npm scripts to bump versions locally:
390
-
104
+ ### Branch name rejected
391
105
  ```bash
392
- # Patch release (1.0.0 -> 1.0.1) - bug fixes
393
- pnpm release:patch
394
-
395
- # Minor release (1.0.0 -> 1.1.0) - new features, backwards compatible
396
- pnpm release:minor
397
-
398
- # Major release (1.0.0 -> 2.0.0) - breaking changes
399
- pnpm release:major
400
-
401
- # Automatic bump based on conventional commits
402
- pnpm release
106
+ git branch -m old-name feature/new-name
403
107
  ```
404
108
 
405
- ### Automated Releases
406
-
407
- Releases are automated via GitHub Actions:
408
-
409
- 1. **Push to main** triggers the release workflow
410
- 2. Workflow runs tests, bumps version, generates changelog
411
- 3. Creates and pushes git tag
412
- 4. Creates GitHub release
413
- 5. Publishes to npm
414
-
415
- ### Commit Convention
416
-
417
- Follow [Conventional Commits](https://www.conventionalcommits.org/):
418
-
419
- - `feat: add new feature` → minor version bump
420
- - `fix: bug fix` → patch version bump
421
- - `feat!: breaking change` or `BREAKING CHANGE:` in footer → major version bump
422
- - `docs:`, `chore:`, `style:`, `refactor:`, `test:` → no version bump
109
+ See [docs/USER_GUIDE.md](docs/USER_GUIDE.md#troubleshooting) for more solutions.
423
110
 
424
- ### Manual Publishing
425
-
426
- To publish manually (emergency only):
427
-
428
- ```bash
429
- npm version patch|minor|major
430
- git push --follow-tags
431
- ```
111
+ ## Requirements
432
112
 
433
- The publish workflow will trigger automatically on tag push.
113
+ - Node.js >= 18
114
+ - Git repository initialized
115
+ - Package manager: pnpm, npm, or yarn
434
116
 
435
117
  ## Contributing
436
118
 
package/README.npm.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  CLI tool for setting up Git hooks, commit conventions, and GitHub integration.
4
4
 
5
+ ## Features
6
+
7
+ - Git hooks (pre-commit, commit-msg, pre-push) via Husky
8
+ - Commit message validation with Commitlint
9
+ - Interactive commit wizard with cz-git
10
+ - Code formatting with Prettier and lint-staged
11
+ - Branch naming validation
12
+ - GitHub PR workflows and CODEOWNERS
13
+ - Claude Code skills for AI-assisted development
14
+
5
15
  ## Installation
6
16
 
7
17
  ```bash
@@ -18,20 +28,20 @@ Run the interactive setup wizard in your project:
18
28
  raftstack init
19
29
  ```
20
30
 
21
- This will configure:
22
- - Git hooks (pre-commit, commit-msg, pre-push)
23
- - Commit message validation
24
- - Code formatting with Prettier
25
- - Branch naming validation
26
- - GitHub PR workflows and CODEOWNERS
31
+ This configures Git hooks, commit conventions, code formatting, and GitHub integration.
27
32
 
28
- ## Other Commands
33
+ ## Commands
29
34
 
30
35
  ```bash
36
+ raftstack init # Interactive setup wizard
31
37
  raftstack setup-protection # Configure GitHub branch protection
32
38
  raftstack metrics # Check repository compliance
33
39
  ```
34
40
 
35
41
  ## Documentation
36
42
 
37
- Full documentation: [github.com/Raft-Labs/raftstack](https://github.com/Raft-Labs/raftstack)
43
+ Full documentation and user guide: [github.com/Raft-Labs/raftstack](https://github.com/Raft-Labs/raftstack)
44
+
45
+ ## License
46
+
47
+ MIT