prjct-cli 0.28.2 → 0.28.4

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 (33) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/core/agentic/index.ts +11 -1
  3. package/core/agentic/memory-system.ts +44 -5
  4. package/core/agentic/smart-context.ts +36 -64
  5. package/core/agentic/token-estimator.ts +264 -0
  6. package/core/infrastructure/path-manager.ts +7 -7
  7. package/core/infrastructure/setup.ts +28 -0
  8. package/core/infrastructure/slash-command-registry.ts +176 -0
  9. package/core/types/integrations.ts +28 -1
  10. package/package.json +1 -1
  11. package/templates/agentic/subagent-generation.md +237 -90
  12. package/templates/commands/bug.md +51 -392
  13. package/templates/commands/done.md +53 -232
  14. package/templates/commands/setup-statusline.md +138 -0
  15. package/templates/commands/ship.md +86 -668
  16. package/templates/commands/sync.md +189 -552
  17. package/templates/commands/task.md +50 -276
  18. package/templates/global/CLAUDE.md +101 -161
  19. package/templates/guides/agent-generation.md +164 -0
  20. package/templates/guides/claude-code-ux.md +232 -0
  21. package/templates/guides/integrations.md +149 -0
  22. package/templates/mcp-config.json +23 -18
  23. package/templates/shared/git-operations.md +68 -0
  24. package/templates/shared/io-patterns.md +72 -0
  25. package/templates/shared/standard.md +70 -0
  26. package/templates/shared/validation.md +75 -0
  27. package/CLAUDE.md +0 -204
  28. package/templates/agentic/agents/uxui.md +0 -218
  29. package/templates/subagents/domain/backend.md +0 -106
  30. package/templates/subagents/domain/database.md +0 -118
  31. package/templates/subagents/domain/devops.md +0 -149
  32. package/templates/subagents/domain/frontend.md +0 -100
  33. package/templates/subagents/domain/testing.md +0 -166
@@ -1,232 +1,172 @@
1
1
  <!-- prjct:start - DO NOT REMOVE THIS MARKER -->
2
2
  # prjct-cli
3
3
 
4
- **Developer momentum tool** - Track progress through natural language commands without PM overhead.
4
+ **Developer momentum tool** - Track progress through natural language commands.
5
5
 
6
- ## HOW TO USE PRJCT (Read This First)
7
-
8
- When user types `p. <command>`, load the template from `templates/commands/{command}.md` and execute it intelligently.
6
+ ## Command Resolution
9
7
 
10
8
  ```
11
- p. sync templates/commands/sync.md
12
- p. task X → templates/commands/task.md
13
- p. done → templates/commands/done.md
14
- p. ship X → templates/commands/ship.md
9
+ p. <command> 1. ~/.prjct-cli/commands/{command}.md (user)
10
+ → 2. templates/commands/{command}.md (built-in)
15
11
  ```
16
12
 
17
- **Key Insight**: Templates are GUIDANCE, not scripts. Use your intelligence to adapt them to the situation.
13
+ Templates are GUIDANCE, not scripts. Adapt to the situation.
18
14
 
19
15
  ---
20
16
 
21
- ## CRITICAL RULES
17
+ ## Quick Commands (User-Defined)
22
18
 
23
- ### 1. Path Resolution (MOST IMPORTANT)
24
- **ALL writes go to global storage**: `~/.prjct-cli/projects/{projectId}/`
19
+ Create custom commands in `~/.prjct-cli/commands/`:
25
20
 
26
- - **NEVER** write to `.prjct/` (config only, read-only)
27
- - **NEVER** write to `./` (current directory)
28
- - **ALWAYS** resolve projectId first from `.prjct/prjct.config.json`
21
+ ```yaml
22
+ ---
23
+ description: Brief explanation
24
+ agent: testing # Optional: which agent
25
+ model: sonnet # Optional: sonnet | opus | haiku
26
+ ---
29
27
 
30
- ### 2. Before Any Command
31
- ```
32
- 1. Read .prjct/prjct.config.json → get projectId
33
- 2. Set globalPath = ~/.prjct-cli/projects/{projectId}
34
- 3. Execute command using globalPath for all writes
35
- 4. Log to {globalPath}/memory/events.jsonl
28
+ {Prompt with $ARGUMENTS, $1, $2...}
29
+ !`shell command` # Shell injection
30
+ @filepath # File inclusion
36
31
  ```
37
32
 
38
- ### 3. Timestamps & UUIDs
39
- ```bash
40
- # Timestamp (NEVER hardcode)
41
- bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
42
-
43
- # UUID
44
- bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
45
- ```
33
+ ---
46
34
 
47
- ### 4. Git Commit Footer (CRITICAL - ALWAYS INCLUDE)
35
+ ## Critical Rules
48
36
 
49
- **Every commit made with prjct MUST include this footer:**
37
+ ### Path Resolution
38
+ **ALL writes**: `~/.prjct-cli/projects/{projectId}/`
39
+ - NEVER write to `.prjct/` (read-only config)
40
+ - NEVER write to `./` for prjct data
50
41
 
42
+ ### Before Any Command
43
+ ```
44
+ 1. Read .prjct/prjct.config.json → projectId
45
+ 2. globalPath = ~/.prjct-cli/projects/{projectId}
46
+ 3. Execute using globalPath for writes
51
47
  ```
52
- 🤖 Generated with [p/](https://www.prjct.app/)
53
- Designed for [Claude](https://www.anthropic.com/claude)
54
48
 
49
+ ### Timestamps & UUIDs
50
+ ```bash
51
+ node -e "console.log(new Date().toISOString())"
52
+ node -e "console.log(require('crypto').randomUUID())"
55
53
  ```
56
54
 
57
- **This is NON-NEGOTIABLE. The prjct signature (`🤖 Generated with [p/]`) must appear in ALL commits.**
55
+ ### Git Commit Footer (REQUIRED)
56
+ ```
57
+ 🤖 Generated with [p/](https://www.prjct.app/)
58
+ ```
58
59
 
59
60
  ---
60
61
 
61
- ## CORE WORKFLOW
62
+ ## Core Workflow
62
63
 
63
64
  ```
64
- p. sync p. task "description" [work] p. done p. ship
65
- │ │ │ │
66
- │ └─ Creates branch, breaks down │ │
67
- │ task, starts tracking │ │
68
- │ │ │
69
- └─ Analyzes project, generates agents │ │
70
- │ │
71
- Completes subtask ─────┘ │
72
-
73
- Ships feature, PR, tag ───┘
65
+ p. sync p. task "desc" [work] p. done p. ship
74
66
  ```
75
67
 
76
- ### Quick Reference
77
-
78
- | Trigger | What It Does |
79
- |---------|--------------|
80
- | `p. sync` | Analyze project, generate domain agents |
81
- | `p. task <desc>` | Start task with auto-classification |
82
- | `p. done` | Complete current subtask |
83
- | `p. ship [name]` | Ship feature with PR + version bump |
84
- | `p. pause` | Pause current task |
85
- | `p. resume` | Resume paused task |
86
- | `p. bug <desc>` | Report bug with auto-priority |
68
+ | Command | Action |
69
+ |---------|--------|
70
+ | `p. sync` | Analyze project, generate agents |
71
+ | `p. task` | Start task with classification |
72
+ | `p. done` | Complete subtask |
73
+ | `p. ship` | Ship with PR + version bump |
74
+ | `p. bug` | Report bug with auto-priority |
87
75
 
88
76
  ---
89
77
 
90
- ## ARCHITECTURE: Write-Through Pattern
78
+ ## Architecture
91
79
 
92
80
  ```
93
- User Action → Storage (JSON) → Context (MD) → Sync Events
81
+ Action → Storage (JSON) → Context (MD) → Sync Events
94
82
  ```
95
83
 
96
- | Layer | Path | Purpose |
97
- |-------|------|---------|
98
- | **Storage** | `storage/*.json` | Source of truth |
99
- | **Context** | `context/*.md` | Claude-readable summaries |
100
- | **Memory** | `memory/events.jsonl` | Audit trail (append-only) |
101
- | **Agents** | `agents/*.md` | Domain specialists |
102
- | **Sync** | `sync/pending.json` | Backend sync queue |
103
-
104
- ### File Structure
105
84
  ```
106
85
  ~/.prjct-cli/projects/{projectId}/
107
- ├── storage/
108
- ├── state.json # Current task (SOURCE OF TRUTH)
109
- ├── queue.json # Task queue
110
- │ └── shipped.json # Shipped features
111
- ├── context/
112
- │ ├── now.md # Current task (generated)
113
- │ └── next.md # Queue (generated)
114
- ├── config/
115
- │ └── skills.json # Agent-to-skill mappings (NEW)
116
- ├── memory/
117
- │ └── events.jsonl # Audit trail
118
- ├── agents/ # Domain specialists (auto-generated)
119
- └── sync/
120
- └── pending.json # Events for backend
86
+ ├── storage/ # state.json, queue.json (SOURCE OF TRUTH)
87
+ ├── context/ # now.md, next.md (generated)
88
+ ├── agents/ # Domain specialists
89
+ ├── memory/ # events.jsonl
90
+ └── sync/ # pending.json
121
91
  ```
122
92
 
123
93
  ---
124
94
 
125
- ## INTELLIGENT BEHAVIOR
126
-
127
- ### When Starting Tasks (`p. task`)
128
- 1. **Analyze** - Understand what user wants to achieve
129
- 2. **Classify** - Determine type: feature, bug, improvement, refactor, chore
130
- 3. **Explore** - Find similar code, patterns, affected files
131
- 4. **Ask** - Clarify ambiguities (use AskUserQuestion)
132
- 5. **Design** - Propose 2-3 approaches, get approval
133
- 6. **Break down** - Create actionable subtasks
134
- 7. **Track** - Update storage/state.json
135
-
136
- ### When Completing Tasks (`p. done`)
137
- 1. Check if there are more subtasks
138
- 2. If yes, advance to next subtask
139
- 3. If no, task is complete
140
- 4. Update storage, generate context
141
-
142
- ### When Shipping (`p. ship`)
143
- 1. Run tests (if configured)
144
- 2. Create PR (if on feature branch)
145
- 3. Bump version
146
- 4. Update CHANGELOG
147
- 5. Create git tag
148
-
149
- ### Key Intelligence Rules
150
- - **Read before write** - Always read existing files before modifying
151
- - **Explore before coding** - Use Task(Explore) to understand codebase
152
- - **Ask when uncertain** - Use AskUserQuestion to clarify
153
- - **Adapt templates** - Templates are guidance, not rigid scripts
154
- - **Log everything** - Append to memory/events.jsonl
95
+ ## Intelligent Behavior
96
+
97
+ | Action | Steps |
98
+ |--------|-------|
99
+ | `p. task` | Analyze → Classify Explore Ask Design Breakdown |
100
+ | `p. done` | Check subtasks Advance/Complete Update storage |
101
+ | `p. ship` | Tests PR → Version bump → CHANGELOG → Tag |
102
+
103
+ **Rules:**
104
+ - Read before write
105
+ - Use Task(Explore) before coding
106
+ - AskUserQuestion when uncertain
107
+ - Log to memory/events.jsonl
155
108
 
156
109
  ---
157
110
 
158
- ## OUTPUT FORMAT
111
+ ## Domain Agents
159
112
 
160
- Concise responses (< 4 lines):
161
- ```
162
- [What was done]
113
+ Load from `{globalPath}/agents/`:
114
+ - `frontend.md`, `backend.md`, `database.md`
115
+ - `uxui.md`, `testing.md`, `devops.md`
163
116
 
164
- [Key metrics]
165
- Next: [suggested action]
166
- ```
117
+ Agents contain project-specific patterns. **USE THEM**.
167
118
 
168
119
  ---
169
120
 
170
- ## LOADING DOMAIN AGENTS
121
+ ## Output Format
171
122
 
172
- When working on tasks, load relevant agents from `{globalPath}/agents/`:
173
- - `frontend.md` - Frontend patterns, components
174
- - `backend.md` - Backend patterns, APIs
175
- - `database.md` - Database patterns, queries
176
- - `uxui.md` - UX/UI guidelines
177
- - `testing.md` - Testing patterns
178
- - `devops.md` - CI/CD, containers
123
+ ```
124
+ [Action]
125
+ [Metrics]
126
+ Next: [suggestion]
127
+ ```
179
128
 
180
- These agents contain project-specific patterns. **USE THEM**.
129
+ Keep output < 4 lines.
181
130
 
182
131
  ---
183
132
 
184
- ## SKILL INTEGRATION (NEW in v0.27 - AGENTIC)
185
-
186
- Agents are linked to Claude Code skills from claude-plugins.dev.
133
+ ## Claude Code UX Enhancements
187
134
 
188
- **Skills are discovered AGENTICALLY** - Claude searches the marketplace dynamically.
135
+ ### Status Line
189
136
 
190
- ### How Skills Work
137
+ prjct provides a custom status line showing:
138
+ - ⚡ Current prjct task
139
+ - Git branch with dirty indicator
140
+ - +/- Lines changed this session
141
+ - Context usage bar
142
+ - Model icon (🎭/📝/🍃)
191
143
 
192
- 1. **During `p. sync`**: Search claude-plugins.dev, install best matches
193
- 2. **During `p. task`**: Skills are auto-invoked for domain expertise
194
- 3. **Agent frontmatter** has `skills: [discovered-skill-name]` field
144
+ **Setup:** `p. setup-statusline`
195
145
 
196
- ### Agentic Discovery Process
197
-
198
- ```
199
- FOR EACH generated agent:
200
- 1. Read search hints from templates/config/skill-mappings.json
201
- 2. Search: https://claude-plugins.dev/skills?q={searchTerm}
202
- 3. Analyze results (prefer @anthropics, high downloads)
203
- 4. Download skill markdown from GitHub
204
- 5. Write to ~/.claude/skills/{name}.md
205
- 6. Update agent frontmatter
206
- ```
146
+ ### Themes
207
147
 
208
- ### Search Terms by Agent
148
+ Available at `~/.prjct-cli/statusline/themes/`:
149
+ - `default.json` - prjct brand (cyan/purple)
150
+ - `gentleman.json` - Elegant blues/golds
151
+ - `minimal.json` - Clean grayscale
209
152
 
210
- | Agent | Search Terms |
211
- |-------|-------------|
212
- | `frontend.md` | "frontend-design", "react", "ui components" |
213
- | `uxui.md` | "ux-designer", "frontend-design", "ui ux" |
214
- | `backend.md` | "{ecosystem} backend", "api design" |
215
- | `testing.md` | "testing automation", "test patterns" |
216
- | `devops.md` | "devops", "ci cd", "docker kubernetes" |
217
- | `prjct-planner.md` | "architecture patterns", "feature development" |
218
- | `prjct-shipper.md` | "code review", "pr review" |
153
+ ### Output Styles
219
154
 
220
- ### Skill Location
155
+ Available at `~/.prjct-cli/output-styles/`:
156
+ - `prjct.md` - Concise, actionable (default)
157
+ - `verbose.md` - Detailed explanations
158
+ - `ship-fast.md` - Minimum output, max velocity
221
159
 
222
- Skills are markdown files in `~/.claude/skills/`
160
+ **Use:** `/output-style prjct`
223
161
 
224
- ### Skill Configuration
162
+ ### Hooks
225
163
 
226
- After sync: `{globalPath}/config/skills.json` contains discovered mappings.
164
+ Metrics tracked automatically:
165
+ - `update-metrics.sh` - Tracks tool usage
166
+ - `session-summary.sh` - Shows session stats on stop
227
167
 
228
168
  ---
229
169
 
230
- **Auto-managed by prjct-cli** | https://prjct.app | v0.27.0
170
+ **prjct-cli** | https://prjct.app | v0.28.3
231
171
 
232
172
  <!-- prjct:end - DO NOT REMOVE THIS MARKER -->
@@ -0,0 +1,164 @@
1
+ # Agent Generation Guide
2
+
3
+ Complete guide for generating domain-specific agents. Referenced by `/p:sync`.
4
+
5
+ ## Overview
6
+
7
+ Agents are generated from **REAL analysis** of the repository, not templates. You must:
8
+ 1. **ANALYZE** the actual codebase deeply
9
+ 2. **EXTRACT** real patterns, conventions, and examples
10
+ 3. **GENERATE** agents that enforce those exact patterns
11
+
12
+ ---
13
+
14
+ ## Step 1: Find Representative Files
15
+
16
+ ```bash
17
+ # Frontend: Component files
18
+ find . -type f \( -name "*.tsx" -o -name "*.vue" -o -name "*.svelte" \) -not -path "*/node_modules/*" | head -10
19
+
20
+ # Backend: API/route files
21
+ find . -type f -name "*.ts" -path "*/api/*" -o -path "*/routes/*" | head -10
22
+
23
+ # Database: Schema/model files
24
+ find . -type f \( -name "schema.prisma" -o -name "*.model.ts" \) | head -5
25
+
26
+ # Tests: Test files
27
+ find . -type f \( -name "*.test.ts" -o -name "*.spec.ts" \) | head -10
28
+ ```
29
+
30
+ ---
31
+
32
+ ## Step 2: Analyze Actual Code
33
+
34
+ ```
35
+ FOR EACH domain detected:
36
+ 1. READ 3-5 representative files
37
+ 2. EXTRACT patterns:
38
+ - File structure
39
+ - Naming conventions
40
+ - Import patterns
41
+ - Code style
42
+ - Architecture patterns
43
+ - Error handling
44
+ - Type patterns
45
+ 3. IDENTIFY project-specific conventions
46
+ ```
47
+
48
+ Check existing style guides:
49
+ ```bash
50
+ ls -la .eslintrc* .prettierrc* tsconfig.json biome.json 2>/dev/null
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Step 3: Agent Frontmatter Format
56
+
57
+ ```yaml
58
+ ---
59
+ name: {domain}
60
+ agentId: p.agent.{domain}
61
+ description: {Domain} specialist for {stack}. Use PROACTIVELY for {triggers}.
62
+ model: sonnet
63
+ temperature: {0.0-1.0}
64
+ maxSteps: {50-100}
65
+ tools:
66
+ Read: true
67
+ Write: true
68
+ Edit: true
69
+ Bash: true
70
+ Glob: true
71
+ Grep: true
72
+ permissions:
73
+ Read: allow
74
+ Write: allow
75
+ Edit: allow
76
+ Bash:
77
+ "git *": allow
78
+ "{test command}": allow
79
+ "rm -rf *": deny
80
+ skills: [{detected-skill}]
81
+ mcp: [{detected-mcp}]
82
+ generatedAt: {timestamp}
83
+ ---
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Step 4: Agent Body Structure
89
+
90
+ ```markdown
91
+ # {Domain} Agent for {ProjectName}
92
+
93
+ ## Stack Detected
94
+ {List EXACT technologies: "React 18, TypeScript 5.3, Tailwind 3.4"}
95
+
96
+ ## Project Structure
97
+ {ACTUAL directory structure}
98
+
99
+ ## Code Patterns (MUST FOLLOW)
100
+
101
+ ### File Naming
102
+ {EXACT convention: "PascalCase for components"}
103
+
104
+ ### Component/Module Structure
105
+ {ACTUAL example from codebase}
106
+
107
+ ### Import Patterns
108
+ {ACTUAL import style}
109
+
110
+ ### Error Handling
111
+ {ACTUAL error pattern}
112
+
113
+ ## Quality Checklist
114
+ - [ ] Follows naming convention
115
+ - [ ] Uses correct import style
116
+ - [ ] Matches existing structure
117
+
118
+ ## Commands
119
+ | Action | Command |
120
+ |--------|---------|
121
+ | Dev | `{actual command}` |
122
+ | Test | `{actual command}` |
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Configuration Values
128
+
129
+ **Temperature** (by domain):
130
+ - `0.1` - Database, migrations (precise)
131
+ - `0.2` - Backend, testing (deterministic)
132
+ - `0.3` - Frontend (some creativity)
133
+ - `0.4` - UX/UI (creative)
134
+
135
+ **maxSteps** (by complexity):
136
+ - `50` - Single file changes
137
+ - `75` - Multi-file features
138
+ - `100` - Complex refactors
139
+
140
+ ---
141
+
142
+ ## Domain Detection Table
143
+
144
+ | If You Find | Generate | Key Files |
145
+ |-------------|----------|-----------|
146
+ | React/Vue/Svelte | `frontend.md` | Components, hooks |
147
+ | Express/Fastify/Hono | `backend.md` | Routes, services |
148
+ | Prisma/Drizzle/SQL | `database.md` | Schema, migrations |
149
+ | Docker/K8s/Actions | `devops.md` | Dockerfile, workflows |
150
+ | Jest/Vitest/Pytest | `testing.md` | Test files |
151
+ | UI + design system | `uxui.md` | Design tokens |
152
+
153
+ Generate agents for **any domain present** - not limited to this list.
154
+
155
+ ---
156
+
157
+ ## Output Format
158
+
159
+ ```
160
+ 🤖 Generated: {agent}.md
161
+ Stack: {technologies}
162
+ Patterns: {count} from {files}
163
+ Path: {globalPath}/agents/{agent}.md
164
+ ```