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.
- package/CHANGELOG.md +105 -0
- package/core/agentic/index.ts +11 -1
- package/core/agentic/memory-system.ts +44 -5
- package/core/agentic/smart-context.ts +36 -64
- package/core/agentic/token-estimator.ts +264 -0
- package/core/infrastructure/path-manager.ts +7 -7
- package/core/infrastructure/setup.ts +28 -0
- package/core/infrastructure/slash-command-registry.ts +176 -0
- package/core/types/integrations.ts +28 -1
- package/package.json +1 -1
- package/templates/agentic/subagent-generation.md +237 -90
- package/templates/commands/bug.md +51 -392
- package/templates/commands/done.md +53 -232
- package/templates/commands/setup-statusline.md +138 -0
- package/templates/commands/ship.md +86 -668
- package/templates/commands/sync.md +189 -552
- package/templates/commands/task.md +50 -276
- package/templates/global/CLAUDE.md +101 -161
- package/templates/guides/agent-generation.md +164 -0
- package/templates/guides/claude-code-ux.md +232 -0
- package/templates/guides/integrations.md +149 -0
- package/templates/mcp-config.json +23 -18
- package/templates/shared/git-operations.md +68 -0
- package/templates/shared/io-patterns.md +72 -0
- package/templates/shared/standard.md +70 -0
- package/templates/shared/validation.md +75 -0
- package/CLAUDE.md +0 -204
- package/templates/agentic/agents/uxui.md +0 -218
- package/templates/subagents/domain/backend.md +0 -106
- package/templates/subagents/domain/database.md +0 -118
- package/templates/subagents/domain/devops.md +0 -149
- package/templates/subagents/domain/frontend.md +0 -100
- package/templates/subagents/domain/testing.md +0 -166
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Claude Code UX Enhancements
|
|
2
|
+
|
|
3
|
+
prjct provides rich terminal UX improvements for Claude Code while staying 100% compatible with Anthropic's Terms of Service.
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run the setup command
|
|
9
|
+
p. setup-statusline
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Or manually configure:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
// ~/.claude/settings.json
|
|
16
|
+
{
|
|
17
|
+
"statusLine": {
|
|
18
|
+
"command": "~/.prjct-cli/statusline/statusline.sh"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
### 1. Status Line
|
|
28
|
+
|
|
29
|
+
Displays real-time information in Claude Code's status area:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
⚡ Current Task │ directory │ branch* │ +42 -15 │ ctx [████░░░░░░] 40% │ 🎭
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| Segment | Description |
|
|
36
|
+
|---------|-------------|
|
|
37
|
+
| ⚡ Task | Current prjct task (from state.json) |
|
|
38
|
+
| Dir | Current working directory |
|
|
39
|
+
| Branch | Git branch with dirty indicator (*) |
|
|
40
|
+
| +/- | Lines added/removed this session |
|
|
41
|
+
| ctx Bar | Context window usage (color-coded) |
|
|
42
|
+
| Icon | Model: 🎭 Opus, 📝 Sonnet, 🍃 Haiku |
|
|
43
|
+
|
|
44
|
+
**Context Bar Colors:**
|
|
45
|
+
- 🟢 Green: < 50% usage
|
|
46
|
+
- 🟡 Yellow: 50-80% usage
|
|
47
|
+
- 🔴 Red: > 80% usage (warning!)
|
|
48
|
+
|
|
49
|
+
### 2. Themes
|
|
50
|
+
|
|
51
|
+
Three built-in themes at `~/.prjct-cli/statusline/themes/`:
|
|
52
|
+
|
|
53
|
+
| Theme | File | Description |
|
|
54
|
+
|-------|------|-------------|
|
|
55
|
+
| **prjct** | `default.json` | Cyan and purple - matches prjct branding |
|
|
56
|
+
| **Gentleman** | `gentleman.json` | Elegant blues and golds (inspired by GentlemanClaude) |
|
|
57
|
+
| **Minimal** | `minimal.json` | Clean grayscale with accent colors |
|
|
58
|
+
|
|
59
|
+
**Switch themes:**
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"env": {
|
|
63
|
+
"PRJCT_STATUSLINE_THEME": "~/.prjct-cli/statusline/themes/gentleman.json"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 3. Output Styles
|
|
69
|
+
|
|
70
|
+
Custom output formatting at `~/.prjct-cli/output-styles/`:
|
|
71
|
+
|
|
72
|
+
| Style | Use Case |
|
|
73
|
+
|-------|----------|
|
|
74
|
+
| `prjct.md` | Default - concise, actionable |
|
|
75
|
+
| `verbose.md` | Learning - detailed explanations |
|
|
76
|
+
| `ship-fast.md` | Maximum velocity - minimal output |
|
|
77
|
+
|
|
78
|
+
**Activate:**
|
|
79
|
+
```
|
|
80
|
+
/output-style ~/.prjct-cli/output-styles/prjct.md
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 4. Hooks
|
|
84
|
+
|
|
85
|
+
Automatic metrics tracking:
|
|
86
|
+
|
|
87
|
+
| Hook | Event | Purpose |
|
|
88
|
+
|------|-------|---------|
|
|
89
|
+
| `update-metrics.sh` | PostToolUse | Tracks file changes and commands |
|
|
90
|
+
| `session-summary.sh` | Stop | Shows session statistics |
|
|
91
|
+
|
|
92
|
+
**Enable hooks:**
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"hooks": [
|
|
96
|
+
{
|
|
97
|
+
"event": "PostToolUse",
|
|
98
|
+
"command": "~/.prjct-cli/hooks/update-metrics.sh",
|
|
99
|
+
"matcher": { "tool": "Write" }
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"event": "Stop",
|
|
103
|
+
"command": "~/.prjct-cli/hooks/session-summary.sh"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 5. Visual Theme (tweakcc)
|
|
110
|
+
|
|
111
|
+
Full Claude Code visual theme at `~/.prjct-cli/tweakcc-theme.json`:
|
|
112
|
+
|
|
113
|
+
- Custom color palette
|
|
114
|
+
- Spanish thinking verbs
|
|
115
|
+
- Diff highlighting
|
|
116
|
+
- Shimmer effects
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## File Locations
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
~/.prjct-cli/
|
|
124
|
+
├── statusline/
|
|
125
|
+
│ ├── statusline.sh # Main script
|
|
126
|
+
│ └── themes/
|
|
127
|
+
│ ├── default.json # prjct theme
|
|
128
|
+
│ ├── gentleman.json # Elegant theme
|
|
129
|
+
│ └── minimal.json # Clean theme
|
|
130
|
+
├── hooks/
|
|
131
|
+
│ ├── update-metrics.sh # Track tool usage
|
|
132
|
+
│ └── session-summary.sh # Session stats
|
|
133
|
+
├── output-styles/
|
|
134
|
+
│ ├── prjct.md # Concise output
|
|
135
|
+
│ ├── verbose.md # Detailed output
|
|
136
|
+
│ └── ship-fast.md # Minimal output
|
|
137
|
+
├── tweakcc-theme.json # Visual theme
|
|
138
|
+
└── settings.template.json # Full config template
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## ToS Compliance
|
|
144
|
+
|
|
145
|
+
All features use **officially documented** Claude Code APIs:
|
|
146
|
+
|
|
147
|
+
| Feature | API Used | Documentation |
|
|
148
|
+
|---------|----------|---------------|
|
|
149
|
+
| Status Line | `statusLine.command` | code.claude.com/docs/en/statusline |
|
|
150
|
+
| Hooks | `hooks` array | code.claude.com/docs/en/hooks-guide |
|
|
151
|
+
| Output Styles | Custom markdown | code.claude.com/docs/en/output-styles |
|
|
152
|
+
| Themes | Environment vars | code.claude.com/docs/en/settings |
|
|
153
|
+
|
|
154
|
+
**What we DON'T do:**
|
|
155
|
+
- ❌ Modify Claude Code internals
|
|
156
|
+
- ❌ Bypass rate limits
|
|
157
|
+
- ❌ Reverse engineer protocols
|
|
158
|
+
- ❌ Access unauthorized data
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Troubleshooting
|
|
163
|
+
|
|
164
|
+
### Status line not showing
|
|
165
|
+
|
|
166
|
+
1. Check `jq` is installed: `which jq`
|
|
167
|
+
2. Verify script is executable: `ls -la ~/.prjct-cli/statusline/statusline.sh`
|
|
168
|
+
3. Test manually:
|
|
169
|
+
```bash
|
|
170
|
+
echo '{"model":{"display_name":"Claude Sonnet"}}' | ~/.prjct-cli/statusline/statusline.sh
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Theme not loading
|
|
174
|
+
|
|
175
|
+
1. Check file exists: `ls ~/.prjct-cli/statusline/themes/`
|
|
176
|
+
2. Verify JSON is valid: `jq . ~/.prjct-cli/statusline/themes/default.json`
|
|
177
|
+
3. Check env var is set in settings.json
|
|
178
|
+
|
|
179
|
+
### Hooks not firing
|
|
180
|
+
|
|
181
|
+
1. Verify hook scripts are executable
|
|
182
|
+
2. Check Claude Code logs for errors
|
|
183
|
+
3. Test hook manually:
|
|
184
|
+
```bash
|
|
185
|
+
echo '{"tool":"Write"}' | ~/.prjct-cli/hooks/update-metrics.sh
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Customization
|
|
191
|
+
|
|
192
|
+
### Create Custom Theme
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
// ~/.prjct-cli/statusline/themes/my-theme.json
|
|
196
|
+
{
|
|
197
|
+
"name": "My Theme",
|
|
198
|
+
"colors": {
|
|
199
|
+
"primary": "39", // ANSI 256 color code
|
|
200
|
+
"accent": "208",
|
|
201
|
+
"success": "82",
|
|
202
|
+
"error": "196"
|
|
203
|
+
},
|
|
204
|
+
"icons": {
|
|
205
|
+
"brand": "🚀",
|
|
206
|
+
"branch": ""
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Create Custom Output Style
|
|
212
|
+
|
|
213
|
+
```markdown
|
|
214
|
+
<!-- ~/.prjct-cli/output-styles/my-style.md -->
|
|
215
|
+
---
|
|
216
|
+
name: My Style
|
|
217
|
+
description: Custom output formatting
|
|
218
|
+
keep-coding-instructions: true
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
# My Custom Instructions
|
|
222
|
+
|
|
223
|
+
[Your formatting rules here]
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Credits
|
|
229
|
+
|
|
230
|
+
Inspired by [GentlemanClaude](https://github.com/Gentleman-Programming/Gentleman.Dots/tree/main/GentlemanClaude) by Gentleman Programming.
|
|
231
|
+
|
|
232
|
+
**prjct-cli** | https://prjct.app
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Integrations Guide
|
|
2
|
+
|
|
3
|
+
Skills and MCP server integration for prjct agents.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Skills Integration
|
|
8
|
+
|
|
9
|
+
### Overview
|
|
10
|
+
|
|
11
|
+
Skills are Claude Code extensions from `claude-plugins.dev` that provide domain expertise.
|
|
12
|
+
|
|
13
|
+
### How Skills Work
|
|
14
|
+
|
|
15
|
+
1. **Discovery** (`/p:sync`): Search marketplace, install matches
|
|
16
|
+
2. **Linking**: Agent frontmatter has `skills: [skill-name]`
|
|
17
|
+
3. **Invocation** (`/p:task`): Skills auto-invoked when agent loads
|
|
18
|
+
|
|
19
|
+
### Skill Flow
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
p. task @frontend add button
|
|
23
|
+
↓
|
|
24
|
+
Load frontend.md (skills: [frontend-design])
|
|
25
|
+
↓
|
|
26
|
+
Auto-invoke: Skill("frontend-design")
|
|
27
|
+
↓
|
|
28
|
+
Skill context active for design decisions
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Skill Location
|
|
32
|
+
|
|
33
|
+
- Installed: `~/.claude/skills/`
|
|
34
|
+
- Mapping: `{globalPath}/config/skills.json`
|
|
35
|
+
|
|
36
|
+
### Search Terms by Agent
|
|
37
|
+
|
|
38
|
+
| Agent | Search Terms |
|
|
39
|
+
|-------|-------------|
|
|
40
|
+
| frontend | "frontend-design", "react", "ui" |
|
|
41
|
+
| backend | "{ecosystem} backend", "api" |
|
|
42
|
+
| uxui | "ux-designer", "ui ux" |
|
|
43
|
+
| testing | "testing", "test patterns" |
|
|
44
|
+
| devops | "devops", "ci cd" |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## MCP Server Integration
|
|
49
|
+
|
|
50
|
+
### Overview
|
|
51
|
+
|
|
52
|
+
MCP (Model Context Protocol) servers provide external capabilities like documentation lookup.
|
|
53
|
+
|
|
54
|
+
### How MCP Works
|
|
55
|
+
|
|
56
|
+
1. **Configuration** (`/p:sync`): Analyze deps, configure servers
|
|
57
|
+
2. **Linking**: Agent frontmatter has `mcp: [server-name]`
|
|
58
|
+
3. **Usage** (`/p:task`): Agents auto-query MCP for docs
|
|
59
|
+
|
|
60
|
+
### MCP Flow
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
p. task @backend add API endpoint
|
|
64
|
+
↓
|
|
65
|
+
Load backend.md (mcp: [context7])
|
|
66
|
+
↓
|
|
67
|
+
Auto-query: context7 for Hono/Express docs
|
|
68
|
+
↓
|
|
69
|
+
Documentation context available
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Available Servers
|
|
73
|
+
|
|
74
|
+
| Server | Purpose | Tools |
|
|
75
|
+
|--------|---------|-------|
|
|
76
|
+
| context7 | Library docs | resolve-library-id, query-docs |
|
|
77
|
+
|
|
78
|
+
### Per-Project Configuration
|
|
79
|
+
|
|
80
|
+
Path: `{globalPath}/config/mcp-servers.json`
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"servers": {
|
|
85
|
+
"context7": {
|
|
86
|
+
"command": "npx",
|
|
87
|
+
"args": ["-y", "@upstash/context7-mcp@latest"],
|
|
88
|
+
"enabled": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"agentMcpMap": {
|
|
92
|
+
"frontend": ["context7"],
|
|
93
|
+
"backend": ["context7"],
|
|
94
|
+
"database": ["context7"]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Agent-MCP Guidelines
|
|
100
|
+
|
|
101
|
+
| Agent | Needs MCP? | Reason |
|
|
102
|
+
|-------|------------|--------|
|
|
103
|
+
| frontend | Yes | Component library docs |
|
|
104
|
+
| backend | Yes | Framework docs |
|
|
105
|
+
| database | Yes | ORM docs |
|
|
106
|
+
| devops | Rarely | Uses bash commands |
|
|
107
|
+
| prjct-* | Sometimes | Framework planning |
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Combined Pipeline
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Task Input
|
|
115
|
+
↓
|
|
116
|
+
Load Agent (frontmatter)
|
|
117
|
+
├── skills: [skill1, skill2]
|
|
118
|
+
└── mcp: [context7]
|
|
119
|
+
↓
|
|
120
|
+
Auto-Invoke Skills
|
|
121
|
+
↓
|
|
122
|
+
Auto-Query MCP Docs
|
|
123
|
+
↓
|
|
124
|
+
Execute with Full Context
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Configuration During Sync
|
|
130
|
+
|
|
131
|
+
### Skills Configuration
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
FOR EACH agent generated:
|
|
135
|
+
1. Determine search terms
|
|
136
|
+
2. Search claude-plugins.dev
|
|
137
|
+
3. Install matching skills
|
|
138
|
+
4. Update agent frontmatter
|
|
139
|
+
5. Save to config/skills.json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### MCP Configuration
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
FOR EACH agent generated:
|
|
146
|
+
1. Check if uses external libraries
|
|
147
|
+
2. If yes, add context7 to mcp
|
|
148
|
+
3. Save to config/mcp-servers.json
|
|
149
|
+
```
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"_comment": "REFERENCE ONLY - MCP config is generated agentically per-project in ~/.prjct-cli/projects/{id}/config/mcp-servers.json",
|
|
3
|
+
"knownServers": {
|
|
3
4
|
"context7": {
|
|
5
|
+
"name": "context7",
|
|
6
|
+
"description": "Upstash Context7 - Library/framework documentation lookup",
|
|
4
7
|
"command": "npx",
|
|
5
8
|
"args": ["-y", "@upstash/context7-mcp@latest"],
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"context7": {
|
|
11
|
-
"when": [
|
|
12
|
-
"Looking up official documentation for any library/framework",
|
|
13
|
-
"Implementing features using specific libraries (React, Next.js, etc)",
|
|
14
|
-
"Checking API references and best practices",
|
|
15
|
-
"Troubleshooting library-specific issues"
|
|
9
|
+
"useWhen": [
|
|
10
|
+
"Project uses external libraries/frameworks",
|
|
11
|
+
"Agents need to look up API documentation",
|
|
12
|
+
"Working with React, Vue, Next.js, Express, Prisma, etc."
|
|
16
13
|
],
|
|
17
14
|
"tools": [
|
|
18
|
-
"resolve-library-id: Find library ID from name
|
|
19
|
-
"
|
|
20
|
-
],
|
|
21
|
-
"examples": [
|
|
22
|
-
"resolve-library-id('nextjs') → get-library-docs('/vercel/next.js', 'app router')",
|
|
23
|
-
"resolve-library-id('tailwindcss') → get-library-docs('/tailwindlabs/tailwindcss', 'configuration')"
|
|
15
|
+
"resolve-library-id: Find library ID from name",
|
|
16
|
+
"query-docs: Fetch documentation for a library"
|
|
24
17
|
]
|
|
25
18
|
}
|
|
26
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"agentMcpGuidelines": {
|
|
21
|
+
"frontend": "Usually needs context7 for component library docs",
|
|
22
|
+
"backend": "Usually needs context7 for framework docs",
|
|
23
|
+
"database": "Usually needs context7 for ORM docs",
|
|
24
|
+
"uxui": "Usually needs context7 for UI library docs",
|
|
25
|
+
"testing": "May need context7 for testing library docs",
|
|
26
|
+
"devops": "Rarely needs MCP, uses bash commands",
|
|
27
|
+
"prjct-planner": "May need context7 for framework planning",
|
|
28
|
+
"prjct-shipper": "Rarely needs MCP",
|
|
29
|
+
"prjct-workflow": "Never needs MCP"
|
|
30
|
+
},
|
|
31
|
+
"discoveryInstructions": "When generating MCP config, analyze the project's package.json/dependencies to determine which MCP servers would be useful. Don't blindly apply all servers - only add what the project actually needs."
|
|
27
32
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Git Operations (Batched)
|
|
2
|
+
|
|
3
|
+
## Quick Status (Single Call)
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git status --porcelain && git branch --show-current && git rev-list --count HEAD 2>/dev/null
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Returns:
|
|
10
|
+
- Uncommitted changes (first lines)
|
|
11
|
+
- Current branch
|
|
12
|
+
- Commit count
|
|
13
|
+
|
|
14
|
+
## Full Analysis (Single Call)
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git status --porcelain && \
|
|
18
|
+
git log --oneline -10 --pretty=format:"%h|%s" && \
|
|
19
|
+
git branch --show-current && \
|
|
20
|
+
git rev-list --count HEAD && \
|
|
21
|
+
git diff --stat HEAD~1 2>/dev/null
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Branch Operations
|
|
25
|
+
|
|
26
|
+
### Create Feature Branch
|
|
27
|
+
```bash
|
|
28
|
+
git checkout -b {branchName} && git push -u origin {branchName}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Check Branch State
|
|
32
|
+
```bash
|
|
33
|
+
git log main..HEAD --oneline 2>/dev/null | wc -l
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Stash Operations (for interrupts)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Save work
|
|
40
|
+
git stash push -m "prjct: {reason}" --include-untracked
|
|
41
|
+
|
|
42
|
+
# Restore work
|
|
43
|
+
git stash pop
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Diff Analysis
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Files changed
|
|
50
|
+
git diff --name-only HEAD~{N}
|
|
51
|
+
|
|
52
|
+
# Stats
|
|
53
|
+
git diff --stat HEAD~{N}
|
|
54
|
+
|
|
55
|
+
# Full diff for review
|
|
56
|
+
git diff HEAD~{N}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Commit (with prjct footer)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git add -A && git commit -m "$(cat <<'EOF'
|
|
63
|
+
{message}
|
|
64
|
+
|
|
65
|
+
🤖 Generated with [p/](https://www.prjct.app/)
|
|
66
|
+
EOF
|
|
67
|
+
)"
|
|
68
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# I/O Patterns (Performance)
|
|
2
|
+
|
|
3
|
+
## Parallel Reads
|
|
4
|
+
|
|
5
|
+
**ALWAYS** read multiple files in single tool call batch:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
READ (parallel):
|
|
9
|
+
- {globalPath}/storage/state.json → {state}
|
|
10
|
+
- {globalPath}/storage/queue.json → {queue}
|
|
11
|
+
- {globalPath}/storage/ideas.json → {ideas}
|
|
12
|
+
- {globalPath}/storage/shipped.json → {shipped}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parallel Writes
|
|
16
|
+
|
|
17
|
+
**ALWAYS** write independent files in single batch:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
WRITE (parallel):
|
|
21
|
+
- {globalPath}/context/now.md
|
|
22
|
+
- {globalPath}/context/next.md
|
|
23
|
+
- {globalPath}/storage/state.json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Conditional Writes
|
|
27
|
+
|
|
28
|
+
Only write if content changed:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
IF {newContent} != {existingContent}:
|
|
32
|
+
WRITE file
|
|
33
|
+
ELSE:
|
|
34
|
+
SKIP (no-op)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## File Count (Use Glob, NOT find)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
GLOB: **/*.{ts,tsx,js,jsx} (exclude node_modules)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Never use `find` - Glob is 10x faster.
|
|
44
|
+
|
|
45
|
+
## Package.json (Single Read)
|
|
46
|
+
|
|
47
|
+
Read once, extract all:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
READ: package.json → {pkg}
|
|
51
|
+
|
|
52
|
+
{projectName} = pkg.name
|
|
53
|
+
{version} = pkg.version
|
|
54
|
+
{scripts} = pkg.scripts
|
|
55
|
+
{deps} = {...pkg.dependencies, ...pkg.devDependencies}
|
|
56
|
+
{techStack} = detect from deps (react, vue, express, etc.)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Ecosystem Detection (Single ls)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ls package.json bun.lockb pnpm-lock.yaml yarn.lock Cargo.toml go.mod 2>/dev/null
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
| Found | Package Manager |
|
|
66
|
+
|-------|-----------------|
|
|
67
|
+
| bun.lockb | bun |
|
|
68
|
+
| pnpm-lock.yaml | pnpm |
|
|
69
|
+
| yarn.lock | yarn |
|
|
70
|
+
| package-lock.json | npm |
|
|
71
|
+
| Cargo.toml | cargo |
|
|
72
|
+
| go.mod | go |
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Standard Practices (Reference Only)
|
|
2
|
+
|
|
3
|
+
All prjct commands inherit these patterns. Do NOT repeat in individual templates.
|
|
4
|
+
|
|
5
|
+
## Context Variables
|
|
6
|
+
|
|
7
|
+
| Variable | Source | Example |
|
|
8
|
+
|----------|--------|---------|
|
|
9
|
+
| `{projectId}` | `.prjct/prjct.config.json` | `bc401c41-c8b9-...` |
|
|
10
|
+
| `{globalPath}` | `~/.prjct-cli/projects/{projectId}` | Full path |
|
|
11
|
+
| `{cwd}` | Current directory | Repo root |
|
|
12
|
+
|
|
13
|
+
## Architecture: Write-Through
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Action → Storage (JSON) → Context (MD) → Sync Events
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- **Source of Truth**: `{globalPath}/storage/*.json`
|
|
20
|
+
- **Claude Context**: `{globalPath}/context/*.md`
|
|
21
|
+
- **Sync Queue**: `{globalPath}/sync/pending.json`
|
|
22
|
+
|
|
23
|
+
## Timestamps & UUIDs
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Timestamp (NEVER hardcode)
|
|
27
|
+
node -e "console.log(new Date().toISOString())"
|
|
28
|
+
|
|
29
|
+
# UUID
|
|
30
|
+
node -e "console.log(require('crypto').randomUUID())"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Path Resolution (CRITICAL)
|
|
34
|
+
|
|
35
|
+
**ALL writes**: `~/.prjct-cli/projects/{projectId}/`
|
|
36
|
+
|
|
37
|
+
- NEVER write to `.prjct/` (read-only config)
|
|
38
|
+
- NEVER write to `./` for prjct data
|
|
39
|
+
|
|
40
|
+
## Error Handling
|
|
41
|
+
|
|
42
|
+
| Error | Response |
|
|
43
|
+
|-------|----------|
|
|
44
|
+
| No config | "No prjct project. Run p. init" → STOP |
|
|
45
|
+
| Not git repo | WARN, continue without git |
|
|
46
|
+
| File not found | Skip, continue |
|
|
47
|
+
|
|
48
|
+
## Git Commit Footer (REQUIRED)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
🤖 Generated with [p/](https://www.prjct.app/)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Parallel Operations
|
|
55
|
+
|
|
56
|
+
**ALWAYS batch** when operations are independent:
|
|
57
|
+
- Multiple READs → single parallel batch
|
|
58
|
+
- Multiple WRITEs → single parallel batch
|
|
59
|
+
- Git commands → chain with `&&`
|
|
60
|
+
|
|
61
|
+
## Output Format
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
✅ [Action completed]
|
|
65
|
+
|
|
66
|
+
[Key metrics]
|
|
67
|
+
Next: [suggested action]
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Keep output under 4 lines unless errors occur.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Standard Project Validation
|
|
2
|
+
|
|
3
|
+
Reusable validation patterns for prjct commands.
|
|
4
|
+
|
|
5
|
+
## Project Config Validation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
READ: .prjct/prjct.config.json
|
|
9
|
+
EXTRACT: projectId
|
|
10
|
+
|
|
11
|
+
IF file not found OR projectId missing:
|
|
12
|
+
OUTPUT: "No prjct project. Run /p:init first."
|
|
13
|
+
STOP
|
|
14
|
+
|
|
15
|
+
SET: {globalPath} = ~/.prjct-cli/projects/{projectId}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Git Repository Check
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
BASH: git rev-parse --git-dir 2>/dev/null
|
|
22
|
+
|
|
23
|
+
IF fails:
|
|
24
|
+
SET: {isGitRepo} = false
|
|
25
|
+
# Continue without git features
|
|
26
|
+
ELSE:
|
|
27
|
+
SET: {isGitRepo} = true
|
|
28
|
+
BASH: git branch --show-current
|
|
29
|
+
SET: {currentBranch} = result
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Current Task Check
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
READ: {globalPath}/storage/state.json
|
|
36
|
+
|
|
37
|
+
IF currentTask exists AND status == "active":
|
|
38
|
+
SET: {hasActiveTask} = true
|
|
39
|
+
SET: {activeTaskDescription} = currentTask.description
|
|
40
|
+
SET: {elapsedTime} = now - currentTask.startedAt
|
|
41
|
+
ELSE:
|
|
42
|
+
SET: {hasActiveTask} = false
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Protected Branch Check
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
IF {currentBranch} == "main" OR {currentBranch} == "master":
|
|
49
|
+
OUTPUT: "Cannot execute on protected branch: {currentBranch}"
|
|
50
|
+
STOP
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Uncommitted Changes Check
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
BASH: git status --porcelain
|
|
57
|
+
|
|
58
|
+
IF not empty:
|
|
59
|
+
SET: {hasUncommittedChanges} = true
|
|
60
|
+
SET: {modifiedFiles} = parse result
|
|
61
|
+
ELSE:
|
|
62
|
+
SET: {hasUncommittedChanges} = false
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Timestamp Generation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## UUID Generation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
|
|
75
|
+
```
|