prjct-cli 1.1.1 → 1.2.0
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/CHANGELOG.md +56 -1
- package/bin/prjct.ts +6 -0
- package/core/commands/planning.ts +1 -0
- package/core/index.ts +1 -0
- package/core/services/hooks-service.ts +676 -0
- package/core/utils/help.ts +6 -0
- package/dist/bin/prjct.mjs +1299 -807
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,67 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0] - 2026-02-06
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- git hooks integration for auto-sync (PRJ-128) (#112)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [1.2.0] - 2026-02-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Git hooks integration (PRJ-128)**: New `prjct hooks` command for auto-syncing context on commit and branch checkout
|
|
15
|
+
|
|
16
|
+
### Implementation Details
|
|
17
|
+
|
|
18
|
+
New `prjct hooks` CLI subcommand with three operations:
|
|
19
|
+
- `prjct hooks install` — auto-detects hook manager (lefthook > husky > direct `.git/hooks/`) and installs post-commit + post-checkout hooks
|
|
20
|
+
- `prjct hooks uninstall` — cleanly removes only prjct hooks, preserving existing hooks
|
|
21
|
+
- `prjct hooks status` — shows active hooks, strategy, and available managers
|
|
22
|
+
|
|
23
|
+
Hook scripts feature:
|
|
24
|
+
- **Rate limiting** — 30-second lockfile prevents over-syncing on rapid commits
|
|
25
|
+
- **Background execution** — hooks run `prjct sync` in background, never blocking git
|
|
26
|
+
- **Branch-only checkout** — post-checkout only fires on branch switch, not file checkout
|
|
27
|
+
- **Cross-platform** — handles macOS/Linux differences in `stat` and `md5` commands
|
|
28
|
+
|
|
29
|
+
Supports three installation strategies:
|
|
30
|
+
- **Lefthook** — adds `prjct-sync-*` commands to existing `lefthook.yml`
|
|
31
|
+
- **Husky** — appends to existing `.husky/` hook scripts
|
|
32
|
+
- **Direct** — writes to `.git/hooks/` as fallback
|
|
33
|
+
|
|
34
|
+
Hook configuration saved to `project.json` for persistence across sessions.
|
|
35
|
+
|
|
36
|
+
### Learnings
|
|
37
|
+
|
|
38
|
+
- Strategy pattern works well for hook manager abstraction (detect → select → install)
|
|
39
|
+
- `stat -f%m` (macOS) vs `stat -c%Y` (Linux) for file modification time
|
|
40
|
+
- Lefthook section merging needs careful regex to avoid duplicates
|
|
41
|
+
- `$3` parameter in post-checkout distinguishes branch checkout (1) from file checkout (0)
|
|
42
|
+
|
|
43
|
+
### Test Plan
|
|
44
|
+
|
|
45
|
+
#### For QA
|
|
46
|
+
1. Run `prjct hooks status` — verify shows "Not installed" with available managers
|
|
47
|
+
2. Run `prjct hooks install` — verify detects manager and installs hooks
|
|
48
|
+
3. Run `prjct hooks status` — verify shows "Active"
|
|
49
|
+
4. Make a git commit — verify sync runs in background
|
|
50
|
+
5. Switch branches — verify post-checkout triggers sync
|
|
51
|
+
6. Run `prjct hooks uninstall` — verify clean removal
|
|
52
|
+
7. Run `bun run build && bun run typecheck` — zero errors
|
|
53
|
+
|
|
54
|
+
#### For Users
|
|
55
|
+
**What changed:** New `prjct hooks` command for automatic context syncing
|
|
56
|
+
**How to use:** Run `prjct hooks install` in any prjct project
|
|
57
|
+
**Breaking changes:** None
|
|
58
|
+
|
|
3
59
|
## [1.1.1] - 2026-02-06
|
|
4
60
|
|
|
5
61
|
### Bug Fixes
|
|
6
62
|
|
|
7
63
|
- visual grouping with boxes and tables for structured output (PRJ-134) (#110)
|
|
8
64
|
|
|
9
|
-
|
|
10
65
|
## [1.1.1] - 2026-02-05
|
|
11
66
|
|
|
12
67
|
### Improved
|
package/bin/prjct.ts
CHANGED
|
@@ -108,6 +108,12 @@ if (args[0] === 'start' || args[0] === 'setup') {
|
|
|
108
108
|
console.log(JSON.stringify(result, null, 2))
|
|
109
109
|
process.exitCode = result.tool === 'error' ? 1 : 0
|
|
110
110
|
}
|
|
111
|
+
} else if (args[0] === 'hooks') {
|
|
112
|
+
// Git hooks management
|
|
113
|
+
const { hooksService } = await import('../core/services/hooks-service')
|
|
114
|
+
const subcommand = args[1] || 'status'
|
|
115
|
+
const exitCode = await hooksService.run(process.cwd(), subcommand)
|
|
116
|
+
process.exitCode = exitCode
|
|
111
117
|
} else if (args[0] === 'doctor') {
|
|
112
118
|
// Health check command
|
|
113
119
|
const { doctorService } = await import('../core/services/doctor-service')
|
|
@@ -207,6 +207,7 @@ export class PlanningCommands extends PrjctCommandsBase {
|
|
|
207
207
|
console.log(' Quick start:')
|
|
208
208
|
console.log(' prjct sync Update context after changes')
|
|
209
209
|
console.log(' prjct task Start working on a task')
|
|
210
|
+
console.log(' prjct hooks Auto-sync on commit/checkout')
|
|
210
211
|
console.log('')
|
|
211
212
|
|
|
212
213
|
if (wizardResult) {
|
package/core/index.ts
CHANGED
|
@@ -306,6 +306,7 @@ TERMINAL COMMANDS (this CLI)
|
|
|
306
306
|
prjct setup Reconfigure installations
|
|
307
307
|
prjct sync Sync project state
|
|
308
308
|
prjct watch Auto-sync on file changes (Ctrl+C to stop)
|
|
309
|
+
prjct hooks Manage git hooks for auto-sync
|
|
309
310
|
prjct doctor Check system health and dependencies
|
|
310
311
|
|
|
311
312
|
EXAMPLES
|