prjct-cli 0.25.2 → 0.28.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +233 -0
  2. package/CLAUDE.md +117 -110
  3. package/core/infrastructure/command-installer.ts +27 -0
  4. package/core/infrastructure/setup.ts +99 -0
  5. package/dist/bin/prjct.mjs +525 -267
  6. package/package.json +1 -1
  7. package/templates/agentic/agents/uxui.md +8 -0
  8. package/templates/agentic/skill-integration.md +311 -0
  9. package/templates/agentic/subagent-generation.md +28 -12
  10. package/templates/commands/bug.md +72 -17
  11. package/templates/commands/cleanup.md +74 -10
  12. package/templates/commands/done.md +158 -8
  13. package/templates/commands/git.md +21 -5
  14. package/templates/commands/merge.md +202 -0
  15. package/templates/commands/p.md +32 -0
  16. package/templates/commands/pause.md +40 -7
  17. package/templates/commands/resume.md +113 -33
  18. package/templates/commands/review.md +276 -0
  19. package/templates/commands/ship.md +193 -17
  20. package/templates/commands/sync.md +442 -47
  21. package/templates/commands/task.md +168 -542
  22. package/templates/commands/test.md +75 -3
  23. package/templates/commands/verify.md +204 -0
  24. package/templates/config/skill-mappings.json +87 -0
  25. package/templates/global/CLAUDE.md +38 -52
  26. package/templates/global/docs/commands.md +29 -31
  27. package/templates/hooks/prjct-session-start.sh +50 -0
  28. package/templates/skills/prjct-done/SKILL.md +97 -0
  29. package/templates/skills/prjct-ship/SKILL.md +150 -0
  30. package/templates/skills/prjct-sync/SKILL.md +108 -0
  31. package/templates/skills/prjct-task/SKILL.md +101 -0
  32. package/templates/subagents/domain/backend.md +1 -0
  33. package/templates/subagents/domain/devops.md +1 -0
  34. package/templates/subagents/domain/frontend.md +1 -0
  35. package/templates/subagents/domain/testing.md +1 -0
  36. package/templates/subagents/workflow/prjct-planner.md +1 -0
  37. package/templates/subagents/workflow/prjct-shipper.md +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,238 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.28.0] - 2026-01-10
4
+
5
+ ### Feature: Claude Code Native Integration
6
+
7
+ **Skills as First-Class Citizens**: prjct commands are now installed as Claude Code Skills for automatic discovery.
8
+
9
+ - **SessionStart Hook**: Injects fresh project context at session start via `~/.claude/hooks/prjct-session-start.sh`
10
+ - **Skills Auto-Install**: 4 skills installed to `~/.claude/skills/` during `npm install`:
11
+ - `prjct-task` - Start tasks with classification
12
+ - `prjct-sync` - Analyze codebase, generate agents
13
+ - `prjct-done` - Complete current subtask
14
+ - `prjct-ship` - Ship with PR + version bump
15
+ - **Setup Integration**: `core/infrastructure/setup.ts` now installs hooks and skills automatically
16
+ - **Simplified CLAUDE.md**: Reduced global template from 221 to ~50 lines - hooks handle fresh context
17
+
18
+ **Upgrade Impact**: Run `npm install -g prjct-cli` to install hooks and skills.
19
+
20
+ ---
21
+
22
+ ## [0.27.0] - 2026-01-08
23
+
24
+ ### Fix: prjct Commit Signature (CRITICAL)
25
+
26
+ **Problem:** Commits were only showing Claude's Co-Authored-By, missing the prjct signature.
27
+
28
+ **Solution:** Made prjct signature NON-NEGOTIABLE in all commit-related templates:
29
+ - `templates/commands/ship.md` - Updated commit format with HEREDOC
30
+ - `templates/commands/git.md` - Updated commit message format
31
+ - `CLAUDE.md` and `templates/global/CLAUDE.md` - Made footer CRITICAL
32
+
33
+ **Correct commit format:**
34
+ ```
35
+ feat: description
36
+
37
+ 🤖 Generated with [p/](https://www.prjct.app/)
38
+ Designed for [Claude](https://www.anthropic.com/claude)
39
+
40
+ ```
41
+
42
+ The `🤖 Generated with [p/]` line MUST appear in ALL prjct commits.
43
+
44
+ ---
45
+
46
+ ### Feature: Claude Code Skill Integration (AGENTIC)
47
+
48
+ Agents are now linked to Claude Code skills from claude-plugins.dev. **Skills are discovered and installed AGENTICALLY** - Claude searches the marketplace dynamically to find the best matching skill for each agent.
49
+
50
+ **New Capabilities:**
51
+
52
+ 1. **Agentic Skill Discovery** (`p. sync` Step 7.5)
53
+ - Searches `https://claude-plugins.dev/skills?q={searchTerm}` for each agent
54
+ - Analyzes results: prefers @anthropics, high downloads, recent updates
55
+ - Downloads skill content from GitHub source
56
+ - Installs to `~/.claude/skills/{name}.md`
57
+ - Creates custom skill if no marketplace match found
58
+ - Updates agent frontmatter with discovered skill name
59
+
60
+ 2. **Skill Invocation in Tasks** (`p. task`)
61
+ - Phase 2 (Exploration): Invokes skills based on task type
62
+ - Phase 4 (Design): Loads agent skills for domain expertise
63
+ - Example: UI tasks automatically use `/frontend-design`
64
+
65
+ 3. **Agent → Skill Mapping**
66
+
67
+ | Agent | Skill | Source |
68
+ |-------|-------|--------|
69
+ | `frontend.md` | `frontend-design` | @anthropics/claude-code-plugins |
70
+ | `uxui.md` | `frontend-design` | @anthropics/claude-code-plugins |
71
+ | `backend.md` | `javascript-typescript` | @wshobson/claude-code-workflows |
72
+ | `testing.md` | `developer-kit` | @claudebase/marketplace |
73
+ | `devops.md` | `developer-kit` | @claudebase/marketplace |
74
+ | `prjct-planner.md` | `feature-dev` | @anthropics/claude-code-plugins |
75
+ | `prjct-shipper.md` | `code-review` | @anthropics/claude-code-plugins |
76
+
77
+ **New Files:**
78
+
79
+ - `templates/config/skill-mappings.json` - Maps agents to skills
80
+ - `templates/agentic/skill-integration.md` - Integration guide
81
+
82
+ **Updated Files:**
83
+
84
+ - `templates/commands/sync.md` - Added Step 7.5 for skill installation
85
+ - `templates/commands/task.md` - Added skill invocation in Phase 2 & 4
86
+ - `templates/agentic/subagent-generation.md` - Added skills to agent format
87
+ - All subagent templates - Added `skills` field to frontmatter
88
+ - `templates/global/CLAUDE.md` - Added skill integration section
89
+ - `CLAUDE.md` - Added skill integration docs
90
+
91
+ **Why This Matters:**
92
+
93
+ - `frontend-design` provides anti-AI-slop patterns (no Inter + purple gradients)
94
+ - `code-review` ensures quality before shipping
95
+ - `javascript-typescript` provides Node.js/TypeScript best practices
96
+ - `developer-kit` provides testing and DevOps automation
97
+
98
+ **Usage:**
99
+
100
+ ```bash
101
+ p. sync # Installs skills automatically
102
+ p. task "create login form" # Uses frontend-design skill
103
+ p. ship "auth" # Uses code-review skill
104
+ ```
105
+
106
+ ---
107
+
108
+ ## [0.26.1] - 2026-01-08
109
+
110
+ ### Fix: Claude Context Efficiency (Critical)
111
+
112
+ **Problem:** After v0.26.0, Claude was losing context, not analyzing properly, not applying skills, and making poor decisions across ALL commands.
113
+
114
+ **Root Cause:**
115
+ 1. Templates were too long and procedural (~7000 lines total)
116
+ 2. `task.md` had 791 lines of pseudo-code scripts
117
+ 3. CLAUDE.md only referenced docs but Claude didn't read them proactively
118
+ 4. 11-phase workflow created too much cognitive overhead
119
+ 5. `context/CLAUDE.md` generated by sync only had stats, no behavioral rules
120
+
121
+ **Solution:**
122
+
123
+ 1. **Simplified `task.md`**: 791 → 277 lines (65% reduction)
124
+ - Removed procedural bloat
125
+ - Focus on GUIDANCE not SCRIPTS
126
+ - Claude uses intelligence to adapt, not follow rigidly
127
+
128
+ 2. **Enhanced `templates/global/CLAUDE.md`**: 75 → 177 lines
129
+ - Added "HOW TO USE PRJCT" section
130
+ - Included architecture inline (not just references)
131
+ - Added "INTELLIGENT BEHAVIOR" section
132
+ - Key insight: "Templates are GUIDANCE, not scripts"
133
+
134
+ 3. **Rich `context/CLAUDE.md` on sync**: Complete rewrite
135
+ - Added "MANDATORY RULES (DO NOT IGNORE)" section
136
+ - Added "DO vs DON'T" table for clear behavior
137
+ - Added "HOW TO USE PRJCT" with command reference
138
+ - Added "EXPECTED BEHAVIOR" guidelines
139
+ - Includes current state, available agents
140
+ - **ALWAYS OVERWRITE on sync** to ensure latest rules
141
+
142
+ 4. **Reduced workflow complexity**: 11 → 5 phases for `p. task`
143
+ - Discovery → Exploration → Questions → Design → Implementation
144
+ - Simpler mental model, less overhead
145
+
146
+ **Key Changes:**
147
+ - `p. sync` now overwrites `context/CLAUDE.md` with rich behavioral context
148
+ - Rules are NON-NEGOTIABLE and clearly marked
149
+ - Claude gets explicit DO/DON'T guidance
150
+ - All commands benefit from consistent context
151
+
152
+ 5. **TRULY Agentic Project Analysis (NEW)**
153
+ - Detects ecosystem: Ruby, Python, Go, Rust, Node.js, PHP, Java, .NET, Elixir, etc.
154
+ - Detects project type: Rails, Django, Next.js, Go API, etc.
155
+ - Analyzes ACTUAL files to determine commands
156
+ - No hardcoded rules - Claude REASONS about what it finds
157
+ - Saves to `analysis/repo-analysis.json`
158
+
159
+ 6. **Contextual CLAUDE.md (Ecosystem-Aware)**
160
+ - Shows correct commands for THIS ecosystem
161
+ - Rails: `bundle install`, `rails s`, `rspec`
162
+ - Python: `poetry install`, `pytest`
163
+ - Go: `go build`, `go test ./...`
164
+ - Node/bun: `bun install`, `bun test`
165
+ - Project-specific DO/DON'T table based on analysis
166
+
167
+ **Example: Rails project generates:**
168
+ ```
169
+ Ecosystem: Ruby | Type: Rails
170
+ Commands:
171
+ - Install: bundle install
172
+ - Dev server: rails s
173
+ - Tests: rspec
174
+ - Migrations: rails db:migrate
175
+ ```
176
+
177
+ **Example: Go project generates:**
178
+ ```
179
+ Ecosystem: Go | Type: Go API
180
+ Commands:
181
+ - Build: go build
182
+ - Tests: go test ./...
183
+ - Run: go run .
184
+ ```
185
+
186
+ **Files Changed:**
187
+ - `templates/global/CLAUDE.md` - Rich context, intelligent guidance
188
+ - `templates/commands/task.md` - Simplified, agentic approach
189
+ - `templates/commands/sync.md` - Agentic analysis + contextual CLAUDE.md
190
+ - `CLAUDE.md` - Updated project docs
191
+ - `package.json` - Version bump
192
+
193
+ ## [0.26.0] - 2026-01-01
194
+
195
+ ### Complete Development Cycle with Workflow Integrity
196
+
197
+ Major feature: 11-phase workflow system that ensures all development steps are completed. No more skipped version bumps, missing changelogs, or untracked ships.
198
+
199
+ **New Commands:**
200
+ - `p. test` - Run tests, advance from implement → test phase
201
+ - `p. review` - MCP code review + GitHub approvals, advance test → review
202
+ - `p. merge` - Merge PR to main, advance review → merge
203
+ - `p. verify` - Validate all 11 checkpoints complete, close workflow
204
+
205
+ **Workflow Phases:**
206
+ ```
207
+ p. task → (implement) → p. test → p. review → p. merge → p. ship → p. verify
208
+ ```
209
+
210
+ | Phase | Command | Action |
211
+ |-------|---------|--------|
212
+ | 1. analyze | p. task | PM agent breakdown |
213
+ | 2. branch | p. task | Create feature branch |
214
+ | 3. implement | (manual) | Write code |
215
+ | 4. test | p. test | Run tests |
216
+ | 5. review | p. review | MCP + GitHub approvals |
217
+ | 6. merge | p. merge | Merge PR |
218
+ | 7-10. ship | p. ship | Tag, release, deploy, register |
219
+ | 11. verify | p. verify | Validate & close |
220
+
221
+ **Phase Validation:**
222
+ Each command validates the workflow phase before executing. Cannot skip steps.
223
+
224
+ **Checkpoint Tracking:**
225
+ - All phases tracked in `state.json` with timestamps
226
+ - Events logged to `memory/events.jsonl`
227
+ - Full audit trail for every workflow
228
+
229
+ **Updated Commands:**
230
+ - `task.md` - Initializes workflow with 11 checkpoints
231
+ - `ship.md` - Validates merge phase, sets 4 checkpoints atomically
232
+ - `done.md` - Clarified as subtask completion
233
+ - `pause.md` - Preserves workflow state
234
+ - `resume.md` - Shows workflow phase on resume
235
+
3
236
  ## [0.25.1] - 2026-01-01
4
237
 
5
238
  ### Bug Fix: npm install symlink resolution
package/CLAUDE.md CHANGED
@@ -4,155 +4,125 @@ This file provides guidance to Claude Code when working with prjct-cli.
4
4
 
5
5
  ## Project Overview
6
6
 
7
- **prjct-cli** is a developer momentum tool. Track progress through slash commands without meetings or traditional PM overhead.
7
+ **prjct-cli** is a developer momentum tool. Track progress through natural language commands (`p. <command>`) without meetings or traditional PM overhead.
8
+
9
+ ## HOW PRJCT WORKS
10
+
11
+ When user types `p. <command>`, load the template from `templates/commands/{command}.md` and execute it **intelligently** - templates are GUIDANCE, not rigid scripts.
12
+
13
+ ```
14
+ p. sync → Analyze project, generate domain agents
15
+ p. task X → Start task with classification + breakdown
16
+ p. done → Complete current subtask
17
+ p. ship X → Ship feature with PR + version bump
18
+ ```
19
+
20
+ ---
8
21
 
9
22
  ## CRITICAL RULES
10
23
 
11
- ### 1. Path Resolution
24
+ ### 1. Path Resolution (MOST IMPORTANT)
12
25
  **ALL writes go to global storage**: `~/.prjct-cli/projects/{projectId}/`
13
- - NEVER write to `.prjct/` (config only)
14
- - NEVER write to `./` (current directory)
26
+ - **NEVER** write to `.prjct/` (config only, read-only)
27
+ - **NEVER** write to `./` (current directory)
15
28
 
16
- ### 2. Timestamps
17
- ```bash
18
- # Prefer bun, fallback to node
19
- bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
29
+ ### 2. Before Any Command
30
+ ```
31
+ 1. Read .prjct/prjct.config.json get projectId
32
+ 2. Set globalPath = ~/.prjct-cli/projects/{projectId}
33
+ 3. Execute using globalPath for all writes
34
+ 4. Log to {globalPath}/memory/events.jsonl
20
35
  ```
21
- - Result: `"2025-12-20T10:30:00.000Z"`
22
- - NEVER hardcode dates or times
23
36
 
24
- ### 3. UUIDs
37
+ ### 3. Timestamps & UUIDs
25
38
  ```bash
39
+ # Timestamp (NEVER hardcode)
40
+ bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
41
+
42
+ # UUID
26
43
  bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
27
44
  ```
28
45
 
29
- ### 4. Git Commit Footer
46
+ ### 4. Git Commit Footer (CRITICAL - ALWAYS INCLUDE)
47
+
48
+ **Every commit MUST include the prjct signature:**
49
+
30
50
  ```
31
51
  🤖 Generated with [p/](https://www.prjct.app/)
32
52
  Designed for [Claude](https://www.anthropic.com/claude)
53
+
33
54
  ```
34
55
 
35
- ## Architecture: Write-Through Pattern
56
+ **NON-NEGOTIABLE: The `🤖 Generated with [p/]` line identifies prjct-powered commits.**
57
+
58
+ ---
59
+
60
+ ## ARCHITECTURE: Write-Through Pattern
36
61
 
37
62
  ```
38
63
  User Action → Storage (JSON) → Context (MD) → Sync Events
39
64
  ```
40
65
 
41
- ### Layer System (10 layers)
42
-
43
66
  | Layer | Path | Purpose |
44
67
  |-------|------|---------|
45
- | **Storage** | `storage/*.json` | Source of truth (state, queue, shipped) |
46
- | **Context** | `context/*.md` | Claude-readable generated files |
47
- | **Core** | `core/` | Current task data |
48
- | **Progress** | `progress/` | Historical progress tracking |
49
- | **Planning** | `planning/` | Ideas, roadmap, specs, tasks |
50
- | **Analysis** | `analysis/` | Repo analysis, tech stack |
51
- | **Memory** | `memory/` | Events, patterns, semantic memories |
52
- | **Agents** | `agents/` | Domain specialists (auto-generated) |
53
- | **Sessions** | `sessions/YYYY/MM/DD/` | Daily session logs |
54
- | **Sync** | `sync/` | Backend sync events |
68
+ | **Storage** | `storage/*.json` | Source of truth |
69
+ | **Context** | `context/*.md` | Claude-readable summaries |
70
+ | **Memory** | `memory/events.jsonl` | Audit trail (append-only) |
71
+ | **Agents** | `agents/*.md` | Domain specialists |
55
72
 
56
73
  ### File Structure
57
74
  ```
58
75
  ~/.prjct-cli/projects/{projectId}/
59
- ├── project.json # Project config (authors, version)
60
76
  ├── storage/
61
- │ ├── state.json # Current task (source of truth)
62
- │ ├── queue.json # Priority queue
63
- │ └── shipped.json # Shipped features
77
+ │ ├── state.json # Current task (SOURCE OF TRUTH)
78
+ │ ├── queue.json # Task queue
79
+ │ └── shipped.json # Shipped features
64
80
  ├── context/
65
- │ ├── now.md # Generated from state.json
66
- ├── next.md # Generated from queue.json
67
- │ └── shipped.md # Generated from shipped.json
68
- ├── core/ # Current task context
69
- ├── progress/ # Historical metrics
70
- ├── planning/
71
- │ ├── ideas.json # Captured ideas
72
- │ ├── roadmap.json # Feature roadmap
73
- │ └── tasks/ # Task breakdowns
74
- ├── analysis/
75
- │ └── repo-analysis.json # Tech stack, patterns
81
+ │ ├── now.md # Current task (generated)
82
+ └── next.md # Queue (generated)
76
83
  ├── memory/
77
- ├── events.jsonl # Audit trail
78
- │ └── context.jsonl # Semantic memories
79
- ├── agents/ # Auto-generated domain specialists
80
- ├── sessions/ # Daily session logs (YYYY/MM/DD/)
84
+ └── events.jsonl # Audit trail
85
+ ├── agents/ # Domain specialists
81
86
  └── sync/
82
- ├── pending.json # Events pending sync
83
- └── last-sync.json # Last sync timestamp
87
+ └── pending.json # Backend events
84
88
  ```
85
89
 
86
- ## Core Workflow
90
+ ---
87
91
 
88
- ```
89
- /p:sync → /p:task "description" → [work] → /p:done → /p:ship
90
- ```
92
+ ## COMMANDS
91
93
 
92
- ## Commands
93
-
94
- ### Core Commands
95
- | Command | Purpose |
96
- |---------|---------|
97
- | `/p:init` | Initialize project with deep analysis |
98
- | `/p:idea` | Transform ideas into architectures |
99
- | `/p:task` | Start task with agentic classification + 7-phase workflow |
100
- | `/p:spec` | Create detailed specifications |
101
- | `/p:pause` | Pause active task |
102
- | `/p:resume` | Resume paused task |
103
- | `/p:next` | Show priority queue |
104
- | `/p:done` | Complete current task |
105
- | `/p:ship` | Ship with quality checks |
106
- | `/p:bug` | Report bug with auto-priority |
107
- | `/p:dash` | Unified dashboard |
108
- | `/p:sync` | Analyze repo, generate agents |
109
- | `/p:suggest` | Context-aware recommendations |
110
-
111
- ### Deprecated Commands
112
- | Command | Migration |
113
- |---------|-----------|
114
- | `/p:now` | Use `/p:task` instead |
115
- | `/p:feature` | Use `/p:task` instead |
116
- | `/p:work` | Use `/p:task` instead |
117
-
118
- ### Optional Commands
119
- | Command | Purpose |
94
+ | Trigger | Purpose |
120
95
  |---------|---------|
121
- | `/p:design` | System architecture design |
122
- | `/p:cleanup` | Clean temp files |
123
- | `/p:analyze` | Deep repo analysis |
124
- | `/p:undo` / `/p:redo` | Snapshot management |
125
- | `/p:git` | Smart git operations |
126
- | `/p:test` | Run tests with auto-fix |
96
+ | `p. init` | Initialize project with deep analysis |
97
+ | `p. sync` | Analyze repo, generate agents |
98
+ | `p. task <desc>` | Start task with agentic classification |
99
+ | `p. done` | Complete current subtask |
100
+ | `p. ship [name]` | Ship with PR + version bump |
101
+ | `p. pause` | Pause active task |
102
+ | `p. resume` | Resume paused task |
103
+ | `p. bug <desc>` | Report bug with auto-priority |
127
104
 
128
- ## Natural Language Trigger
129
-
130
- Messages starting with `p.` trigger commands:
105
+ ### Workflow
131
106
  ```
132
- p. task add auth/p:task "add auth"
133
- p. task fix login → /p:task "fix login"
134
- p. done → /p:done
135
- p. ship login → /p:ship "login"
107
+ p. sync → p. task "description" [work] → p. done → p. ship
136
108
  ```
137
109
 
138
- ## Template-Driven Execution
110
+ ---
139
111
 
140
- Templates define command behavior:
141
- ```
142
- templates/commands/{command}.md
143
- ```
112
+ ## INTELLIGENT BEHAVIOR
144
113
 
145
- Claude reads template executes flow → generates response.
114
+ Templates provide guidance. Use your intelligence to:
146
115
 
147
- ## Key Rules
116
+ 1. **Read before write** - Always read existing files first
117
+ 2. **Explore before coding** - Use Task(Explore) to understand codebase
118
+ 3. **Ask when uncertain** - Use AskUserQuestion to clarify
119
+ 4. **Load agents** - Read from `{globalPath}/agents/` for domain expertise
120
+ 5. **Adapt templates** - They're guidance, not rigid scripts
121
+ 6. **Log everything** - Append to memory/events.jsonl
148
122
 
149
- 1. **Read files before editing** - Never assume structure
150
- 2. **Use node commands for timestamps** - Never hardcode dates
151
- 3. **Follow template instructions** - Templates are source of truth
152
- 4. **Log to memory** - Append to `memory/events.jsonl`
153
- 5. **Suggest next actions** - Maintain user momentum
123
+ ---
154
124
 
155
- ## Output Format
125
+ ## OUTPUT FORMAT
156
126
 
157
127
  Concise responses (< 4 lines):
158
128
  ```
@@ -162,10 +132,47 @@ Concise responses (< 4 lines):
162
132
  Next: [suggested action]
163
133
  ```
164
134
 
165
- ## Documentation
135
+ ---
136
+
137
+ ## KEY RULES
138
+
139
+ 1. **Read files before editing** - Never assume structure
140
+ 2. **Use node/bun for timestamps** - Never hardcode dates
141
+ 3. **Follow template guidance** - But adapt intelligently
142
+ 4. **Log to memory** - Append to `memory/events.jsonl`
143
+ 5. **Suggest next actions** - Maintain user momentum
144
+ 6. **Use linked skills** - Agents have skills in frontmatter
145
+
146
+ ---
147
+
148
+ ## CLAUDE CODE INTEGRATION (v0.28)
149
+
150
+ prjct-cli uses Claude Code's native features for robust integration:
151
+
152
+ ### SessionStart Hook
153
+
154
+ A hook runs at the start of every Claude Code session to inject fresh context:
155
+ - Located at: `~/.claude/hooks/prjct-session-start.sh`
156
+ - Automatically reads project state and injects into session
157
+ - Bypasses CLAUDE.md caching issues
158
+
159
+ ### Skills (Auto-Discovery)
160
+
161
+ Skills are auto-discovered by Claude Code when relevant:
162
+
163
+ | Skill | Trigger |
164
+ |-------|---------|
165
+ | `prjct-task` | "p. task", starting work, features/bugs |
166
+ | `prjct-sync` | "p. sync", analyze codebase |
167
+ | `prjct-done` | "p. done", completing work |
168
+ | `prjct-ship` | "p. ship", releasing features |
169
+
170
+ Skills location: `~/.claude/skills/prjct-*/SKILL.md`
171
+
172
+ ### Setup
166
173
 
167
- For detailed information:
168
- - Architecture: `~/.prjct-cli/docs/architecture.md`
169
- - Commands: `~/.prjct-cli/docs/commands.md`
170
- - Validation: `~/.prjct-cli/docs/validation.md`
171
- - Agents: `~/.prjct-cli/docs/agents.md`
174
+ All integration is installed automatically via `npm install -g prjct-cli`:
175
+ 1. SessionStart hook → `~/.claude/hooks/`
176
+ 2. Skills `~/.claude/skills/`
177
+ 3. Commands `~/.claude/commands/p/`
178
+ 4. Settings `~/.claude/settings.json`
@@ -163,6 +163,9 @@ export class CommandInstaller {
163
163
 
164
164
  constructor() {
165
165
  this.homeDir = os.homedir()
166
+ // Commands are stored in p/ subdirectory, accessed via p. trigger
167
+ // Note: Claude Code bug #2422 prevents native slash command discovery
168
+ // We use the p.md router in commands/ root instead
166
169
  this.claudeCommandsPath = path.join(this.homeDir, '.claude', 'commands', 'p')
167
170
  this.claudeConfigPath = path.join(this.homeDir, '.claude')
168
171
  this.templatesDir = path.join(__dirname, '..', '..', 'templates', 'commands')
@@ -227,6 +230,9 @@ export class CommandInstaller {
227
230
  }
228
231
 
229
232
  try {
233
+ // Install the p.md router to enable "p. task" trigger
234
+ await this.installRouter()
235
+
230
236
  // Ensure commands directory exists
231
237
  await fs.mkdir(this.claudeCommandsPath, { recursive: true })
232
238
 
@@ -378,6 +384,24 @@ export class CommandInstaller {
378
384
  }
379
385
  }
380
386
 
387
+ /**
388
+ * Install the p.md router to ~/.claude/commands/
389
+ * This enables the "p. task" natural language trigger
390
+ * Claude Code bug #2422 prevents subdirectory slash command discovery
391
+ */
392
+ async installRouter(): Promise<boolean> {
393
+ try {
394
+ const routerSource = path.join(this.templatesDir, 'p.md')
395
+ const routerDest = path.join(this.homeDir, '.claude', 'commands', 'p.md')
396
+
397
+ const content = await fs.readFile(routerSource, 'utf-8')
398
+ await fs.writeFile(routerDest, content, 'utf-8')
399
+ return true
400
+ } catch {
401
+ return false
402
+ }
403
+ }
404
+
381
405
  /**
382
406
  * Sync commands - intelligent update that detects and removes orphans
383
407
  */
@@ -395,6 +419,9 @@ export class CommandInstaller {
395
419
  }
396
420
 
397
421
  try {
422
+ // Install the p.md router to enable "p. task" trigger
423
+ await this.installRouter()
424
+
398
425
  // Ensure commands directory exists
399
426
  await fs.mkdir(this.claudeCommandsPath, { recursive: true })
400
427
 
@@ -112,6 +112,12 @@ export async function run(): Promise<SetupResults> {
112
112
 
113
113
  // Step 4c: Install status line with version check
114
114
  await installStatusLine()
115
+
116
+ // Step 4d: Install SessionStart hook for fresh context injection
117
+ await installSessionHook()
118
+
119
+ // Step 4e: Install Skills for auto-discovery
120
+ await installSkills()
115
121
  }
116
122
 
117
123
  // Step 5: Save version in editors-config
@@ -272,6 +278,99 @@ echo "⚡ prjct"
272
278
  }
273
279
  }
274
280
 
281
+ /**
282
+ * Install SessionStart hook for fresh context injection
283
+ * This hook runs at the start of every Claude Code session
284
+ */
285
+ async function installSessionHook(): Promise<void> {
286
+ try {
287
+ const claudeDir = path.join(os.homedir(), '.claude')
288
+ const hooksDir = path.join(claudeDir, 'hooks')
289
+ const hookPath = path.join(hooksDir, 'prjct-session-start.sh')
290
+ const settingsPath = path.join(claudeDir, 'settings.json')
291
+
292
+ // Ensure hooks directory exists
293
+ if (!fs.existsSync(hooksDir)) {
294
+ fs.mkdirSync(hooksDir, { recursive: true })
295
+ }
296
+
297
+ // Copy hook from templates
298
+ const templateHookPath = path.join(__dirname, '../../templates/hooks/prjct-session-start.sh')
299
+ if (fs.existsSync(templateHookPath)) {
300
+ const hookContent = fs.readFileSync(templateHookPath, 'utf8')
301
+ fs.writeFileSync(hookPath, hookContent, { mode: 0o755 })
302
+ }
303
+
304
+ // Update settings.json to include SessionStart hook
305
+ let settings: Record<string, unknown> = {}
306
+ if (fs.existsSync(settingsPath)) {
307
+ try {
308
+ settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'))
309
+ } catch {
310
+ // Invalid JSON, start fresh
311
+ }
312
+ }
313
+
314
+ // Add or update hooks configuration
315
+ const hooks = (settings.hooks as Record<string, unknown[]>) || {}
316
+ hooks.SessionStart = [
317
+ {
318
+ matcher: 'startup',
319
+ hooks: [
320
+ {
321
+ type: 'command',
322
+ command: hookPath
323
+ }
324
+ ]
325
+ }
326
+ ]
327
+ settings.hooks = hooks
328
+
329
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2))
330
+ console.log(` ${GREEN}✓${NC} SessionStart hook installed`)
331
+ } catch {
332
+ // Silently fail - hook is optional but recommended
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Install Skills for Claude Code auto-discovery
338
+ * Skills are loaded automatically when relevant to user's request
339
+ */
340
+ async function installSkills(): Promise<void> {
341
+ try {
342
+ const claudeDir = path.join(os.homedir(), '.claude')
343
+ const skillsDir = path.join(claudeDir, 'skills')
344
+ const templateSkillsDir = path.join(__dirname, '../../templates/skills')
345
+
346
+ const skillNames = ['prjct-task', 'prjct-sync', 'prjct-done', 'prjct-ship']
347
+ let installed = 0
348
+
349
+ for (const skillName of skillNames) {
350
+ const destDir = path.join(skillsDir, skillName)
351
+ const templatePath = path.join(templateSkillsDir, skillName, 'SKILL.md')
352
+
353
+ if (fs.existsSync(templatePath)) {
354
+ // Ensure skill directory exists
355
+ if (!fs.existsSync(destDir)) {
356
+ fs.mkdirSync(destDir, { recursive: true })
357
+ }
358
+
359
+ // Copy SKILL.md
360
+ const skillContent = fs.readFileSync(templatePath, 'utf8')
361
+ fs.writeFileSync(path.join(destDir, 'SKILL.md'), skillContent)
362
+ installed++
363
+ }
364
+ }
365
+
366
+ if (installed > 0) {
367
+ console.log(` ${GREEN}✓${NC} ${installed} Skills installed`)
368
+ }
369
+ } catch {
370
+ // Silently fail - skills are optional but recommended
371
+ }
372
+ }
373
+
275
374
  /**
276
375
  * Show setup results
277
376
  */