prjct-cli 0.10.5 → 0.10.8
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 +83 -0
- package/core/__tests__/agentic/prompt-builder.test.js +244 -0
- package/core/__tests__/utils/output.test.js +163 -0
- package/core/agentic/agent-router.js +45 -173
- package/core/agentic/context-builder.js +20 -11
- package/core/agentic/context-filter.js +118 -313
- package/core/agentic/prompt-builder.js +79 -46
- package/core/commands.js +121 -637
- package/core/domain/agent-generator.js +55 -4
- package/core/domain/analyzer.js +122 -0
- package/core/domain/context-estimator.js +32 -53
- package/core/domain/smart-cache.js +2 -1
- package/core/domain/task-analyzer.js +75 -146
- package/core/domain/task-stack.js +2 -1
- package/core/utils/logger.js +64 -0
- package/core/utils/output.js +54 -0
- package/package.json +1 -1
- package/templates/agentic/agent-routing.md +78 -0
- package/templates/agentic/context-filtering.md +77 -0
- package/templates/analysis/project-analysis.md +78 -0
- package/templates/global/CLAUDE.md +137 -135
- package/core/domain/tech-detector.js +0 -365
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: [Read, Glob, Bash]
|
|
3
|
+
description: 'Analyze project technology stack - Claude reads and decides'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Analysis Instructions
|
|
7
|
+
|
|
8
|
+
## Objective
|
|
9
|
+
|
|
10
|
+
Determine the technology stack by READING actual files, not assuming.
|
|
11
|
+
|
|
12
|
+
## Step 1: Read Dependency Files
|
|
13
|
+
|
|
14
|
+
Read these files if they exist:
|
|
15
|
+
|
|
16
|
+
- `package.json` → Node.js/JavaScript/TypeScript project
|
|
17
|
+
- `Cargo.toml` → Rust project
|
|
18
|
+
- `go.mod` → Go project
|
|
19
|
+
- `requirements.txt` or `pyproject.toml` → Python project
|
|
20
|
+
- `Gemfile` → Ruby project
|
|
21
|
+
- `mix.exs` → Elixir project
|
|
22
|
+
- `pom.xml` or `build.gradle` → Java project
|
|
23
|
+
- `composer.json` → PHP project
|
|
24
|
+
|
|
25
|
+
**Extract actual dependencies** - don't guess frameworks.
|
|
26
|
+
|
|
27
|
+
## Step 2: Examine Directory Structure
|
|
28
|
+
|
|
29
|
+
List the root directory to identify:
|
|
30
|
+
|
|
31
|
+
- Source directories (src/, lib/, app/, cmd/)
|
|
32
|
+
- Test directories (tests/, spec/, __tests__/)
|
|
33
|
+
- Config directories (.github/, .gitlab/, .vscode/)
|
|
34
|
+
- Build outputs (dist/, build/, target/)
|
|
35
|
+
|
|
36
|
+
## Step 3: Check Configuration Files
|
|
37
|
+
|
|
38
|
+
Look for:
|
|
39
|
+
|
|
40
|
+
- `tsconfig.json` → TypeScript configuration
|
|
41
|
+
- `Dockerfile` → Docker usage
|
|
42
|
+
- `docker-compose.yml` → Multi-container setup
|
|
43
|
+
- `.eslintrc`, `.prettierrc` → Linting/formatting
|
|
44
|
+
- `jest.config.js`, `vitest.config.ts` → Testing setup
|
|
45
|
+
- `.env*` files → Environment configuration
|
|
46
|
+
|
|
47
|
+
## Step 4: Determine Stack
|
|
48
|
+
|
|
49
|
+
Based on what you READ (not assumed):
|
|
50
|
+
|
|
51
|
+
1. **Languages**: Identify from file extensions and configs
|
|
52
|
+
2. **Frameworks**: Extract from actual dependencies
|
|
53
|
+
3. **Tools**: Identify from config files present
|
|
54
|
+
4. **Databases**: Look for DB clients in dependencies
|
|
55
|
+
5. **Testing**: Identify test frameworks from configs/deps
|
|
56
|
+
|
|
57
|
+
## Output Format
|
|
58
|
+
|
|
59
|
+
Provide analysis in this structure:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"languages": ["actual languages found"],
|
|
64
|
+
"frameworks": ["actual frameworks from deps"],
|
|
65
|
+
"tools": ["tools with config files present"],
|
|
66
|
+
"databases": ["database clients in deps"],
|
|
67
|
+
"testing": ["test frameworks found"],
|
|
68
|
+
"notes": "any observations about the project"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Rules
|
|
73
|
+
|
|
74
|
+
- **NO hardcoded assumptions** - React doesn't mean "frontend"
|
|
75
|
+
- **READ before deciding** - Don't guess based on filenames
|
|
76
|
+
- **Any stack works** - Elixir, Rust, Go, Python, etc.
|
|
77
|
+
- **Be specific** - Include versions when available
|
|
78
|
+
- **Note uncertainty** - If unclear, say so
|
|
@@ -5,22 +5,92 @@ This section provides global context for all `/p:*` commands across any prjct pr
|
|
|
5
5
|
|
|
6
6
|
**Auto-managed by prjct-cli** - This section is automatically updated when you install or update prjct.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## 🚀 Quick Command Reference
|
|
9
|
+
|
|
10
|
+
| Command | Purpose | Example |
|
|
11
|
+
|---------|---------|---------|
|
|
12
|
+
| `/p:sync` | Analyze project & generate agents | Run first in any project |
|
|
13
|
+
| `/p:now [task]` | Set current focus | `/p:now "implement auth"` |
|
|
14
|
+
| `/p:done` | Complete current task | After finishing work |
|
|
15
|
+
| `/p:next` | Show priority queue | See what's pending |
|
|
16
|
+
| `/p:ship [feature]` | Ship & celebrate | `/p:ship "user login"` |
|
|
17
|
+
| `/p:feature [desc]` | Add feature to roadmap | `/p:feature "dark mode"` |
|
|
18
|
+
| `/p:idea [text]` | Quick idea capture | `/p:idea "add caching"` |
|
|
19
|
+
| `/p:recap` | Project overview | Status check |
|
|
20
|
+
| `/p:progress` | Show metrics | Weekly/monthly stats |
|
|
21
|
+
|
|
22
|
+
## 🎯 Recommended Workflow
|
|
9
23
|
|
|
10
|
-
|
|
24
|
+
```
|
|
25
|
+
1. /p:sync → Analyze project, generate agents
|
|
26
|
+
2. /p:feature → Plan what to build
|
|
27
|
+
3. /p:now → Start working
|
|
28
|
+
4. [code...] → Do the actual work
|
|
29
|
+
5. /p:done → Mark complete
|
|
30
|
+
6. /p:ship → Celebrate & commit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 🤖 Project Context (CRITICAL)
|
|
34
|
+
|
|
35
|
+
**BEFORE working on any prjct project, READ the project context:**
|
|
36
|
+
|
|
37
|
+
1. Read `.prjct/prjct.config.json` → get `projectId`
|
|
38
|
+
2. Read `~/.prjct-cli/projects/{projectId}/CLAUDE.md` → dynamic project context
|
|
39
|
+
|
|
40
|
+
The project CLAUDE.md contains:
|
|
41
|
+
- Tech stack (languages, frameworks, dependencies)
|
|
42
|
+
- Project structure (directories)
|
|
43
|
+
- Available agents with their expertise
|
|
44
|
+
- Current task and priority queue
|
|
45
|
+
- Recent git activity
|
|
46
|
+
- Active roadmap features
|
|
47
|
+
|
|
48
|
+
**If CLAUDE.md doesn't exist**: Suggest running `/p:sync` to generate it.
|
|
49
|
+
|
|
50
|
+
## 📋 Common Usage Patterns
|
|
51
|
+
|
|
52
|
+
### Starting Work on a Project
|
|
53
|
+
```
|
|
54
|
+
User: "p. sync"
|
|
55
|
+
→ Analyze repo, generate agents, create context
|
|
56
|
+
→ Now Claude knows: stack, structure, agents available
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Adding a New Feature
|
|
60
|
+
```
|
|
61
|
+
User: "p. feature add user authentication"
|
|
62
|
+
→ Creates roadmap entry with tasks
|
|
63
|
+
→ Analyzes impact and effort
|
|
64
|
+
→ Suggests starting first task
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Daily Development Flow
|
|
68
|
+
```
|
|
69
|
+
User: "p. now implement login form"
|
|
70
|
+
→ Sets current focus
|
|
71
|
+
→ [User works on code]
|
|
72
|
+
User: "p. done"
|
|
73
|
+
→ Marks complete, suggests next task
|
|
74
|
+
User: "p. ship authentication"
|
|
75
|
+
→ Commits, celebrates, updates metrics
|
|
76
|
+
```
|
|
11
77
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
78
|
+
### Quick Idea Capture
|
|
79
|
+
```
|
|
80
|
+
User: "p. idea we should add dark mode later"
|
|
81
|
+
→ Saves to ideas.md
|
|
82
|
+
→ Doesn't interrupt current work
|
|
83
|
+
```
|
|
15
84
|
|
|
16
|
-
|
|
17
|
-
- Stack detectado del proyecto
|
|
18
|
-
- Agentes disponibles (varían por proyecto)
|
|
19
|
-
- Tarea actual
|
|
20
|
-
- Cola de prioridades
|
|
21
|
-
- Rutas a documentación detallada
|
|
85
|
+
## ⚠️ Anti-Patterns (What NOT to Do)
|
|
22
86
|
|
|
23
|
-
|
|
87
|
+
| ❌ Don't | ✅ Do Instead |
|
|
88
|
+
|----------|---------------|
|
|
89
|
+
| Write to `.prjct/` folder | Write to `~/.prjct-cli/projects/{id}/` |
|
|
90
|
+
| Skip reading project context | Always read CLAUDE.md first |
|
|
91
|
+
| Execute without projectId | Check `.prjct/prjct.config.json` exists |
|
|
92
|
+
| Hardcode file paths | Use projectId to construct paths |
|
|
93
|
+
| Ignore agents | Use specialized agents for their domains |
|
|
24
94
|
|
|
25
95
|
## 🎯 Path Resolution for ALL /p:* Commands
|
|
26
96
|
|
|
@@ -28,10 +98,10 @@ El archivo `CLAUDE.md` del proyecto contiene:
|
|
|
28
98
|
|
|
29
99
|
### Resolution Steps:
|
|
30
100
|
|
|
31
|
-
1. **Detect prjct project**: Check if `.prjct/prjct.config.json` exists
|
|
32
|
-
2. **Read config**: Extract `projectId` from
|
|
101
|
+
1. **Detect prjct project**: Check if `.prjct/prjct.config.json` exists
|
|
102
|
+
2. **Read config**: Extract `projectId` from config
|
|
33
103
|
3. **Construct base path**: `~/.prjct-cli/projects/{projectId}/`
|
|
34
|
-
4. **Resolve all file operations**:
|
|
104
|
+
4. **Resolve all file operations**: Paths are relative to base path
|
|
35
105
|
|
|
36
106
|
### Examples:
|
|
37
107
|
|
|
@@ -41,75 +111,61 @@ Actual path: ~/.prjct-cli/projects/{projectId}/core/now.md
|
|
|
41
111
|
|
|
42
112
|
Template says: "Read: memory/context.jsonl"
|
|
43
113
|
Actual path: ~/.prjct-cli/projects/{projectId}/memory/context.jsonl
|
|
44
|
-
|
|
45
|
-
Template says: "Update: progress/shipped.md"
|
|
46
|
-
Actual path: ~/.prjct-cli/projects/{projectId}/progress/shipped.md
|
|
47
114
|
```
|
|
48
115
|
|
|
49
116
|
### Validation Rules:
|
|
50
117
|
|
|
51
118
|
- ❌ **NEVER** write to `.prjct/core/now.md` (local project directory)
|
|
52
119
|
- ❌ **NEVER** write to `./core/now.md` (current working directory)
|
|
53
|
-
- ✅ **ALWAYS** write to `~/.prjct-cli/projects/{projectId}/core/now.md`
|
|
120
|
+
- ✅ **ALWAYS** write to `~/.prjct-cli/projects/{projectId}/core/now.md`
|
|
54
121
|
|
|
55
122
|
### When NOT in prjct Project:
|
|
56
123
|
|
|
57
|
-
If `.prjct/prjct.config.json` doesn't exist
|
|
124
|
+
If `.prjct/prjct.config.json` doesn't exist:
|
|
58
125
|
- Respond: "No prjct project detected. Initialize first with `/p:init`"
|
|
59
126
|
- Do NOT execute the command
|
|
60
127
|
- Do NOT create files
|
|
61
128
|
|
|
62
129
|
## 📁 File Structure
|
|
63
130
|
|
|
64
|
-
All prjct data lives in global storage
|
|
131
|
+
All prjct data lives in global storage:
|
|
65
132
|
|
|
66
133
|
```
|
|
67
134
|
~/.prjct-cli/projects/{projectId}/
|
|
68
|
-
├──
|
|
69
|
-
|
|
70
|
-
│ ├──
|
|
71
|
-
│ └──
|
|
72
|
-
├── progress/
|
|
73
|
-
│ ├── shipped.md
|
|
74
|
-
│
|
|
75
|
-
|
|
76
|
-
│
|
|
77
|
-
│
|
|
78
|
-
|
|
79
|
-
│
|
|
80
|
-
├──
|
|
81
|
-
│
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Session Format (JSONL):
|
|
105
|
-
|
|
106
|
-
One JSON object per line, append-only:
|
|
107
|
-
|
|
108
|
-
```jsonl
|
|
109
|
-
{"ts":"2025-10-05T14:30:00Z","type":"feature_add","name":"auth","tasks":5,"impact":"high","effort":"6h"}
|
|
110
|
-
{"ts":"2025-10-05T15:00:00Z","type":"task_start","task":"JWT middleware","agent":"be","estimate":"2h"}
|
|
111
|
-
{"ts":"2025-10-05T17:15:00Z","type":"task_complete","task":"JWT middleware","duration":"2h15m"}
|
|
112
|
-
{"ts":"2025-10-05T18:00:00Z","type":"feature_ship","name":"auth","tasks_done":5,"total_time":"6h"}
|
|
135
|
+
├── CLAUDE.md # ⭐ READ THIS FIRST - Rich project context
|
|
136
|
+
├── core/ # Current focus
|
|
137
|
+
│ ├── now.md # Single current task
|
|
138
|
+
│ └── next.md # Priority queue
|
|
139
|
+
├── progress/ # Completed work
|
|
140
|
+
│ ├── shipped.md # Recent ships
|
|
141
|
+
│ └── metrics.md # Aggregated metrics
|
|
142
|
+
├── planning/ # Future planning
|
|
143
|
+
│ ├── ideas.md # Quick ideas
|
|
144
|
+
│ └── roadmap.md # Feature roadmap
|
|
145
|
+
├── analysis/ # Technical analysis
|
|
146
|
+
│ └── repo-summary.md # Full repo analysis
|
|
147
|
+
├── memory/ # Decision history
|
|
148
|
+
│ └── context.jsonl # Append-only log
|
|
149
|
+
└── agents/ # ⭐ Specialized AI agents
|
|
150
|
+
├── fe.md # Frontend specialist
|
|
151
|
+
├── be.md # Backend specialist
|
|
152
|
+
└── ... # More based on stack
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## 🤖 Using Agents Effectively
|
|
156
|
+
|
|
157
|
+
When project has specialized agents:
|
|
158
|
+
|
|
159
|
+
1. **Read agent file** before working in that domain
|
|
160
|
+
2. **Follow agent patterns** for code style and architecture
|
|
161
|
+
3. **Agent expertise** is in CLAUDE.md summary
|
|
162
|
+
|
|
163
|
+
Example:
|
|
164
|
+
```
|
|
165
|
+
Task: "implement React component"
|
|
166
|
+
→ Check CLAUDE.md for frontend agent
|
|
167
|
+
→ Read agents/fe.md for React patterns
|
|
168
|
+
→ Follow detected conventions
|
|
113
169
|
```
|
|
114
170
|
|
|
115
171
|
## 🤖 Git Commit Format
|
|
@@ -125,107 +181,53 @@ Designed for [Claude](https://www.anthropic.com/claude)
|
|
|
125
181
|
- ❌ "Generated with Claude Code"
|
|
126
182
|
- ❌ "Co-Authored-By: Claude"
|
|
127
183
|
|
|
128
|
-
**Always use:**
|
|
129
|
-
- ✅ The prjct footer format above
|
|
130
|
-
|
|
131
|
-
## 👤 Author Detection
|
|
132
|
-
|
|
133
|
-
All operations include author information. Detection order:
|
|
134
|
-
|
|
135
|
-
1. **GitHub CLI**: `gh api user` (preferred)
|
|
136
|
-
- Provides: name, email, username, avatarUrl
|
|
137
|
-
2. **Git Config**: Fallback if GitHub CLI not available
|
|
138
|
-
- `git config user.name`
|
|
139
|
-
- `git config user.email`
|
|
140
|
-
3. **Default**: If both fail
|
|
141
|
-
- name: "Unknown"
|
|
142
|
-
- email: "unknown@localhost"
|
|
143
|
-
|
|
144
|
-
Every log entry in `memory/context.jsonl` includes author field.
|
|
145
|
-
|
|
146
184
|
## ⚠️ Common Validation Patterns
|
|
147
185
|
|
|
148
|
-
### Before
|
|
186
|
+
### Before /p:done:
|
|
149
187
|
```javascript
|
|
150
|
-
// Check if there's an active task
|
|
151
188
|
const nowContent = await Read('~/.prjct-cli/projects/{projectId}/core/now.md')
|
|
152
189
|
if (!nowContent || nowContent.trim() === '') {
|
|
153
190
|
return "Not working on anything. Use /p:now to start a task."
|
|
154
191
|
}
|
|
155
192
|
```
|
|
156
193
|
|
|
157
|
-
### Before
|
|
194
|
+
### Before /p:ship:
|
|
158
195
|
```javascript
|
|
159
|
-
// Check if there's something to ship
|
|
160
|
-
const shippedContent = await Read('~/.prjct-cli/projects/{projectId}/progress/shipped.md')
|
|
161
196
|
const nowContent = await Read('~/.prjct-cli/projects/{projectId}/core/now.md')
|
|
162
|
-
if (
|
|
163
|
-
(!shippedContent || shippedContent.trim() === '')) {
|
|
197
|
+
if (!nowContent || nowContent.trim() === '') {
|
|
164
198
|
return "Nothing to ship yet. Build something first with /p:now."
|
|
165
199
|
}
|
|
166
200
|
```
|
|
167
201
|
|
|
168
|
-
### Reading Project Config:
|
|
169
|
-
```javascript
|
|
170
|
-
// Always read config first
|
|
171
|
-
const configPath = '.prjct/prjct.config.json'
|
|
172
|
-
const configContent = await Read(configPath)
|
|
173
|
-
const config = JSON.parse(configContent)
|
|
174
|
-
const projectId = config.projectId
|
|
175
|
-
const basePath = `~/.prjct-cli/projects/${projectId}/`
|
|
176
|
-
```
|
|
177
|
-
|
|
178
202
|
## 🔧 Error Handling
|
|
179
203
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
- If config file is corrupted → suggest running `/p:init` again
|
|
187
|
-
- Log error to `memory/context.jsonl` for debugging
|
|
188
|
-
|
|
189
|
-
### Permission Issues:
|
|
190
|
-
- If can't write to `~/.prjct-cli/` → check directory permissions
|
|
191
|
-
- Suggest: `chmod -R u+w ~/.prjct-cli/`
|
|
192
|
-
|
|
193
|
-
## 📊 Performance Guidelines
|
|
194
|
-
|
|
195
|
-
### Archive Rules:
|
|
196
|
-
- Index files (roadmap.md, shipped.md) keep only last 30 days
|
|
197
|
-
- Sessions older than 30 days → automatically moved to archive/
|
|
198
|
-
- When querying across time: read relevant session files from archive/
|
|
199
|
-
- Commands only read current index + today's session for performance
|
|
200
|
-
|
|
201
|
-
### File Size Limits:
|
|
202
|
-
- `core/now.md`: Single task only (< 1KB)
|
|
203
|
-
- `core/next.md`: Max 100 tasks (< 50KB)
|
|
204
|
-
- `progress/shipped.md`: Last 30 days only (auto-archive older)
|
|
205
|
-
- Session files: One file per day, JSONL format for efficient appending
|
|
204
|
+
| Error | Solution |
|
|
205
|
+
|-------|----------|
|
|
206
|
+
| File not found | Return empty state, don't fail |
|
|
207
|
+
| Invalid JSON config | Suggest `/p:init` again |
|
|
208
|
+
| Permission denied | Suggest `chmod -R u+w ~/.prjct-cli/` |
|
|
209
|
+
| No project detected | Suggest `/p:init` |
|
|
206
210
|
|
|
207
211
|
## 🎯 Command Execution Flow
|
|
208
212
|
|
|
209
213
|
Standard pattern for all `/p:*` commands:
|
|
210
214
|
|
|
211
|
-
1. **Validate
|
|
215
|
+
1. **Validate**: Check `.prjct/prjct.config.json` exists
|
|
212
216
|
2. **Read config**: Extract projectId
|
|
213
|
-
3. **
|
|
214
|
-
4. **Execute
|
|
215
|
-
5. **Log
|
|
216
|
-
6. **
|
|
217
|
+
3. **Read context**: Load `~/.prjct-cli/projects/{id}/CLAUDE.md`
|
|
218
|
+
4. **Execute**: Read/write files in global storage
|
|
219
|
+
5. **Log**: Append to `memory/context.jsonl`
|
|
220
|
+
6. **Respond**: Formatted response with next action suggestions
|
|
217
221
|
|
|
218
222
|
## 📚 Additional Context
|
|
219
223
|
|
|
220
224
|
- **Website**: https://prjct.app
|
|
221
225
|
- **Documentation**: https://prjct.app/docs
|
|
222
|
-
- **Repository**: Private (proprietary software)
|
|
223
226
|
- **Support**: jlopezlira@gmail.com
|
|
224
|
-
- **Version**: Auto-updated with prjct-cli
|
|
225
227
|
|
|
226
228
|
---
|
|
227
229
|
|
|
228
230
|
**Last updated**: Auto-managed by prjct-cli
|
|
229
|
-
**Config version**: 0.
|
|
231
|
+
**Config version**: 0.10.5
|
|
230
232
|
|
|
231
233
|
<!-- prjct:end - DO NOT REMOVE THIS MARKER -->
|