clavix 2.5.0 → 2.6.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/README.md +20 -3
- package/dist/cli/commands/implement.js +4 -2
- package/dist/cli/commands/plan.js +3 -10
- package/dist/templates/slash-commands/_canonical/archive.md +171 -75
- package/dist/templates/slash-commands/_canonical/implement.md +18 -17
- package/dist/templates/slash-commands/_canonical/plan.md +191 -35
- package/dist/templates/slash-commands/_canonical/prd.md +110 -1
- package/dist/utils/agent-error-messages.d.ts +91 -0
- package/dist/utils/agent-error-messages.js +212 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,13 +25,28 @@ Clavix is built on CLEAR (Concise, Logical, Explicit, Adaptive, Reflective), an
|
|
|
25
25
|
Provider paths and argument placeholders are listed in [docs/providers.md](docs/providers.md).
|
|
26
26
|
|
|
27
27
|
## Quickstart
|
|
28
|
+
|
|
29
|
+
### For AI Agents (Recommended)
|
|
30
|
+
|
|
31
|
+
Most Clavix users work through AI coding assistants:
|
|
32
|
+
|
|
28
33
|
```bash
|
|
34
|
+
# 1. Initialize in your project
|
|
29
35
|
npm install -g clavix
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
clavix init
|
|
37
|
+
|
|
38
|
+
# 2. Use slash commands in your AI agent
|
|
39
|
+
/clavix:fast "Create a login page"
|
|
40
|
+
/clavix:deep "Build an API for user management"
|
|
41
|
+
/clavix:prd # Full PRD workflow
|
|
32
42
|
```
|
|
33
43
|
|
|
34
|
-
|
|
44
|
+
**Supported agents**: Claude Code, Cursor, Windsurf, and [20+ more providers](docs/providers.md)
|
|
45
|
+
|
|
46
|
+
### Direct CLI Usage (Alternative)
|
|
47
|
+
|
|
48
|
+
You can also use Clavix directly from the terminal:
|
|
49
|
+
|
|
35
50
|
```bash
|
|
36
51
|
clavix init
|
|
37
52
|
clavix fast "Create a login page"
|
|
@@ -39,6 +54,8 @@ clavix deep "Build an API for user management"
|
|
|
39
54
|
clavix prd
|
|
40
55
|
```
|
|
41
56
|
|
|
57
|
+
**Note**: CLI usage is primarily for initialization and state management. AI agents handle the workflow orchestration via slash commands.
|
|
58
|
+
|
|
42
59
|
## Full documentation
|
|
43
60
|
- Overview & navigation: [docs/index.md](docs/index.md)
|
|
44
61
|
- Command reference: [docs/commands/](docs/commands/README.md)
|
|
@@ -41,6 +41,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
41
41
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
42
42
|
const task_manager_1 = require("../../core/task-manager");
|
|
43
43
|
const git_manager_1 = require("../../core/git-manager");
|
|
44
|
+
const agent_error_messages_1 = require("../../utils/agent-error-messages");
|
|
44
45
|
const path = __importStar(require("path"));
|
|
45
46
|
const fs = __importStar(require("fs-extra"));
|
|
46
47
|
class Implement extends core_1.Command {
|
|
@@ -67,7 +68,8 @@ class Implement extends core_1.Command {
|
|
|
67
68
|
const prdPath = await manager.findPrdDirectory(flags.project);
|
|
68
69
|
tasksPath = path.join(prdPath, 'tasks.md');
|
|
69
70
|
if (!(await fs.pathExists(tasksPath))) {
|
|
70
|
-
|
|
71
|
+
const projectName = flags.project || path.basename(path.dirname(tasksPath));
|
|
72
|
+
this.error(agent_error_messages_1.AgentErrorMessages.noTasksFound(projectName));
|
|
71
73
|
}
|
|
72
74
|
console.log(chalk_1.default.dim(`Found: ${tasksPath}\n`));
|
|
73
75
|
}
|
|
@@ -232,7 +234,7 @@ class Implement extends core_1.Command {
|
|
|
232
234
|
}
|
|
233
235
|
// No PRD projects found
|
|
234
236
|
if (prdProjects.length === 0) {
|
|
235
|
-
this.error(
|
|
237
|
+
this.error(agent_error_messages_1.AgentErrorMessages.noPrdFound());
|
|
236
238
|
}
|
|
237
239
|
// Only one PRD - auto-select
|
|
238
240
|
if (prdProjects.length === 1) {
|
|
@@ -45,6 +45,7 @@ const task_manager_1 = require("../../core/task-manager");
|
|
|
45
45
|
const session_manager_1 = require("../../core/session-manager");
|
|
46
46
|
const conversation_analyzer_1 = require("../../core/conversation-analyzer");
|
|
47
47
|
const file_system_1 = require("../../utils/file-system");
|
|
48
|
+
const agent_error_messages_1 = require("../../utils/agent-error-messages");
|
|
48
49
|
class Plan extends core_1.Command {
|
|
49
50
|
async run() {
|
|
50
51
|
const { flags } = await this.parse(Plan);
|
|
@@ -69,11 +70,7 @@ class Plan extends core_1.Command {
|
|
|
69
70
|
if (!prdPath) {
|
|
70
71
|
selectedProject = await this.resolveProjectDirectory(manager, flags.project);
|
|
71
72
|
if (!selectedProject) {
|
|
72
|
-
this.error(
|
|
73
|
-
'Hints:\n' +
|
|
74
|
-
' • Run "clavix prd" to generate a PRD\n' +
|
|
75
|
-
' • Run "clavix summarize" to create a mini-PRD\n' +
|
|
76
|
-
' • Use "clavix plan --session <id>" to plan from a session');
|
|
73
|
+
this.error(agent_error_messages_1.AgentErrorMessages.noPrdFound());
|
|
77
74
|
}
|
|
78
75
|
prdPath = selectedProject.path;
|
|
79
76
|
projectName = selectedProject.name;
|
|
@@ -93,11 +90,7 @@ class Plan extends core_1.Command {
|
|
|
93
90
|
console.log(chalk_1.default.dim('Looking for PRD artifacts...'));
|
|
94
91
|
const availableSources = await manager.detectAvailableSources(prdPath);
|
|
95
92
|
if (availableSources.length === 0) {
|
|
96
|
-
this.error(
|
|
97
|
-
'Hints:\n' +
|
|
98
|
-
' • Generate a PRD with: clavix prd\n' +
|
|
99
|
-
' • Create a mini-PRD with: clavix summarize\n' +
|
|
100
|
-
' • Plan from a session with: clavix plan --session <id>');
|
|
93
|
+
this.error(agent_error_messages_1.AgentErrorMessages.noPrdFound());
|
|
101
94
|
}
|
|
102
95
|
if (sourcePreference !== 'auto' && !availableSources.includes(sourcePreference)) {
|
|
103
96
|
this.error(`Preferred source "${sourcePreference}" not found in ${prdPath}\n\n` +
|
|
@@ -5,49 +5,83 @@ description: Archive completed PRD projects
|
|
|
5
5
|
|
|
6
6
|
# Clavix Archive - PRD Project Archival
|
|
7
7
|
|
|
8
|
+
> **⚠️ Agent Execution Note**: This command requires CLI execution. AI agents should run `clavix archive` via Bash tool to perform archival operations. Direct file manipulation is not recommended due to state tracking complexity.
|
|
9
|
+
|
|
8
10
|
You are helping the user archive completed PRD projects to keep their workspace organized.
|
|
9
11
|
|
|
10
12
|
## Instructions
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
### Part A: Agent Execution Protocol
|
|
15
|
+
|
|
16
|
+
**As an AI agent, you should:**
|
|
17
|
+
|
|
18
|
+
1. **Run the CLI command** to handle archival operations:
|
|
19
|
+
```bash
|
|
20
|
+
clavix archive
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The CLI will:
|
|
24
|
+
- Prompt user for project selection
|
|
25
|
+
- Validate task completion status
|
|
26
|
+
- Handle file operations safely
|
|
27
|
+
- Update state tracking
|
|
17
28
|
|
|
18
|
-
2. **
|
|
29
|
+
2. **Choose the appropriate mode** based on user intent:
|
|
30
|
+
|
|
31
|
+
- **Interactive mode** (no arguments): User selects from list
|
|
32
|
+
- **Specific project**: `clavix archive [project-name]`
|
|
33
|
+
- **Force archive incomplete**: `clavix archive [project-name] --force`
|
|
34
|
+
- **Permanent delete**: `clavix archive [project-name] --delete`
|
|
35
|
+
- **List archived**: `clavix archive --list`
|
|
36
|
+
- **Restore**: `clavix archive --restore [project-name]`
|
|
37
|
+
|
|
38
|
+
3. **Before running the command**, validate:
|
|
39
|
+
- Check if `.clavix/outputs/` directory exists
|
|
40
|
+
- Verify user intent (archive vs delete vs restore)
|
|
41
|
+
- Confirm project name if specified
|
|
42
|
+
|
|
43
|
+
4. **After CLI completes**, communicate results:
|
|
44
|
+
- Confirm where project was moved
|
|
45
|
+
- Mention restoration is possible (unless deleted)
|
|
46
|
+
- Update user on next steps
|
|
47
|
+
|
|
48
|
+
### Part B: Understanding Archive Operations
|
|
49
|
+
|
|
50
|
+
**Archive Modes**:
|
|
51
|
+
|
|
52
|
+
1. **Interactive Archive Mode**:
|
|
19
53
|
```bash
|
|
20
54
|
clavix archive
|
|
21
55
|
```
|
|
22
56
|
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
57
|
+
CLI behavior:
|
|
58
|
+
- Lists all PRD projects with 100% tasks completed
|
|
59
|
+
- Allows user to select which project to archive
|
|
60
|
+
- Confirms before archiving
|
|
61
|
+
- Moves the project to archive directory
|
|
28
62
|
|
|
29
|
-
|
|
63
|
+
2. **Archive Specific Project**:
|
|
30
64
|
```bash
|
|
31
65
|
clavix archive [project-name]
|
|
32
66
|
```
|
|
33
67
|
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
68
|
+
CLI behavior:
|
|
69
|
+
- Checks task completion status
|
|
70
|
+
- Warns if tasks are incomplete
|
|
71
|
+
- Asks for confirmation
|
|
72
|
+
- Archives the specific project
|
|
39
73
|
|
|
40
|
-
|
|
74
|
+
3. **Force Archive (Incomplete Tasks)**:
|
|
41
75
|
```bash
|
|
42
76
|
clavix archive [project-name] --force
|
|
43
77
|
```
|
|
44
78
|
|
|
45
|
-
Use
|
|
79
|
+
Use when:
|
|
46
80
|
- Project scope changed and some tasks are no longer relevant
|
|
47
81
|
- User wants to archive work-in-progress
|
|
48
82
|
- Tasks are incomplete but project is done
|
|
49
83
|
|
|
50
|
-
|
|
84
|
+
4. **Delete Project (Permanent Removal)**: **DESTRUCTIVE ACTION**
|
|
51
85
|
```bash
|
|
52
86
|
clavix archive [project-name] --delete
|
|
53
87
|
```
|
|
@@ -73,7 +107,7 @@ You are helping the user archive completed PRD projects to keep their workspace
|
|
|
73
107
|
- Warns about permanent deletion
|
|
74
108
|
- Lists what will be permanently deleted
|
|
75
109
|
|
|
76
|
-
|
|
110
|
+
5. **List Archived Projects**:
|
|
77
111
|
```bash
|
|
78
112
|
clavix archive --list
|
|
79
113
|
```
|
|
@@ -184,33 +218,53 @@ Result: Project permanently deleted from .clavix/outputs/api-experiment-1/
|
|
|
184
218
|
|
|
185
219
|
When user mentions archiving or cleaning up projects:
|
|
186
220
|
|
|
187
|
-
1. **
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
|
|
192
|
-
2. **
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
|
|
197
|
-
3. **
|
|
221
|
+
1. **Validate prerequisites before running CLI**:
|
|
222
|
+
- Check if `.clavix/outputs/` directory exists
|
|
223
|
+
- If not, inform user no projects exist to archive
|
|
224
|
+
- Verify user intent (list, archive, restore, delete)
|
|
225
|
+
|
|
226
|
+
2. **Check completion status first**:
|
|
227
|
+
- Run `clavix archive` (interactive mode) to see archivable projects
|
|
228
|
+
- CLI will display projects with completion percentages
|
|
229
|
+
- Review output and communicate options to user
|
|
230
|
+
|
|
231
|
+
3. **Execute the appropriate command**:
|
|
232
|
+
- **Interactive selection**: `clavix archive` (let user pick from list)
|
|
233
|
+
- **Specific project**: `clavix archive [project-name]`
|
|
234
|
+
- **Force incomplete**: `clavix archive [project-name] --force`
|
|
235
|
+
- **List archived**: `clavix archive --list`
|
|
236
|
+
- **Restore**: `clavix archive --restore [project-name]`
|
|
237
|
+
- **Delete**: `clavix archive [project-name] --delete` (with extra caution)
|
|
238
|
+
|
|
239
|
+
4. **Confirm before archiving**:
|
|
240
|
+
- If using specific project mode, confirm project name with user
|
|
241
|
+
- Mention the archive location (`.clavix/outputs/archive/`)
|
|
242
|
+
- Explain that restoration is possible
|
|
243
|
+
|
|
244
|
+
5. **Use --force cautiously**:
|
|
198
245
|
- Only when user explicitly wants to archive incomplete work
|
|
199
|
-
-
|
|
200
|
-
-
|
|
246
|
+
- Run command and let CLI show incomplete task count
|
|
247
|
+
- CLI will ask for user confirmation
|
|
248
|
+
- Explain they won't lose data (just moving location)
|
|
201
249
|
|
|
202
|
-
|
|
203
|
-
- If user mentions old work, check archive
|
|
204
|
-
-
|
|
205
|
-
- Offer to restore if needed
|
|
250
|
+
6. **Suggest restoration when appropriate**:
|
|
251
|
+
- If user mentions old/past work, check archive first
|
|
252
|
+
- Run `clavix archive --list` to show what's archived
|
|
253
|
+
- Offer to restore if needed via `clavix archive --restore [project]`
|
|
206
254
|
|
|
207
|
-
|
|
208
|
-
- Always ask
|
|
255
|
+
7. **Handle delete requests with extreme caution**:
|
|
256
|
+
- Always ask: "Do you want to DELETE (permanent) or ARCHIVE (safe)?"
|
|
209
257
|
- Explain that delete is permanent and irreversible
|
|
210
258
|
- Suggest archive as the safer default
|
|
211
259
|
- Use decision tree to help user decide
|
|
212
|
-
- Only
|
|
213
|
-
- Double-check it's truly no-value content (failed experiments, duplicates)
|
|
260
|
+
- Only run `--delete` after clear confirmation from user
|
|
261
|
+
- Double-check it's truly no-value content (failed experiments, duplicates, test data)
|
|
262
|
+
- CLI will require typing project name to confirm - this is expected
|
|
263
|
+
|
|
264
|
+
8. **After CLI execution**:
|
|
265
|
+
- Communicate success/failure clearly
|
|
266
|
+
- Mention next steps (e.g., "Project archived, you can restore with `/clavix:archive --restore`")
|
|
267
|
+
- If error occurs, explain and suggest recovery options
|
|
214
268
|
|
|
215
269
|
## Workflow Navigation
|
|
216
270
|
|
|
@@ -238,54 +292,96 @@ When user mentions archiving or cleaning up projects:
|
|
|
238
292
|
|
|
239
293
|
### Issue: No projects available to archive
|
|
240
294
|
**Cause**: No projects in `.clavix/outputs/` OR all already archived
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
295
|
+
|
|
296
|
+
**Agent recovery**:
|
|
297
|
+
1. Check if `.clavix/outputs/` exists: `ls .clavix/outputs/`
|
|
298
|
+
2. If directory doesn't exist: "No PRD projects found. Create one with `/clavix:prd`"
|
|
299
|
+
3. If empty: Run `clavix archive --list` to show archived projects
|
|
300
|
+
4. Communicate: "All projects are already archived" or "No projects exist yet"
|
|
245
301
|
|
|
246
302
|
### Issue: Trying to archive project with incomplete tasks
|
|
247
303
|
**Cause**: User wants to archive but tasks aren't 100% done
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
-
|
|
304
|
+
|
|
305
|
+
**Agent recovery**:
|
|
306
|
+
1. CLI will warn about incomplete tasks
|
|
307
|
+
2. Ask user: "Project has X incomplete tasks. Do you want to:
|
|
308
|
+
- Complete tasks first with `/clavix:implement`
|
|
309
|
+
- Archive anyway with `--force` (tasks remain incomplete but archived)
|
|
310
|
+
- Cancel archival"
|
|
311
|
+
3. If user confirms force: Run `clavix archive [project] --force`
|
|
312
|
+
4. If scope changed: Explain `--force` is appropriate
|
|
253
313
|
|
|
254
314
|
### Issue: Cannot restore archived project (name conflict)
|
|
255
315
|
**Cause**: Project with same name already exists in active outputs
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
316
|
+
|
|
317
|
+
**Agent recovery**:
|
|
318
|
+
1. CLI will show error: "Project '[name]' already exists in active outputs"
|
|
319
|
+
2. Ask user which option:
|
|
320
|
+
- Archive the active project first, then restore old one
|
|
321
|
+
- Keep both (manual rename required)
|
|
322
|
+
- Cancel restoration
|
|
323
|
+
3. Execute user's choice
|
|
261
324
|
|
|
262
325
|
### Issue: Unsure whether to delete or archive
|
|
263
326
|
**Cause**: User wants to clean up but uncertain about permanence
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
327
|
+
|
|
328
|
+
**Agent recovery**:
|
|
329
|
+
1. Use decision tree to guide user:
|
|
330
|
+
```
|
|
331
|
+
Ask user questions:
|
|
332
|
+
- "Is this a failed experiment with no learning value?"
|
|
333
|
+
- "Might you need to reference this code later?"
|
|
334
|
+
- "Are you unsure if it's valuable?"
|
|
335
|
+
```
|
|
336
|
+
2. Default recommendation: **ARCHIVE** (safer, reversible)
|
|
337
|
+
3. Only suggest DELETE for: duplicates, failed experiments, test data with zero value
|
|
338
|
+
4. Remind: "Archive is free, disk space is cheap, regret is expensive"
|
|
339
|
+
|
|
340
|
+
### Issue: CLI command fails or hangs
|
|
341
|
+
**Cause**: File system permissions, missing directory, or process error
|
|
342
|
+
|
|
343
|
+
**Agent recovery**:
|
|
344
|
+
1. Check error output from CLI
|
|
345
|
+
2. Common fixes:
|
|
346
|
+
- Check `.clavix/outputs/` exists and is writable
|
|
347
|
+
- Verify project name is correct (no typos)
|
|
348
|
+
- Check if another process is accessing the files
|
|
349
|
+
3. Suggest: Run with full project path or retry
|
|
350
|
+
4. If persistent: Inform user to check file permissions
|
|
269
351
|
|
|
270
352
|
### Issue: Accidentally deleted project (used --delete instead of archive)
|
|
271
353
|
**Cause**: User error or misunderstanding of --delete flag
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
-
|
|
354
|
+
|
|
355
|
+
**Agent recovery**:
|
|
356
|
+
1. Acknowledge: "Project was permanently deleted via `--delete` flag"
|
|
357
|
+
2. Check recovery options:
|
|
358
|
+
- "If code was committed to git, we can recover from git history"
|
|
359
|
+
- "Check if you have local backups"
|
|
360
|
+
- "Check if IDE has local history (VS Code, JetBrains)"
|
|
361
|
+
3. Prevention: "Going forward, use ARCHIVE by default. Only DELETE when absolutely certain."
|
|
362
|
+
4. No recovery possible from Clavix itself
|
|
277
363
|
|
|
278
364
|
### Issue: Archive directory getting too large
|
|
279
365
|
**Cause**: Many archived projects accumulating
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
366
|
+
|
|
367
|
+
**Agent response**:
|
|
368
|
+
1. Explain: "Archive is designed to grow - this is normal behavior"
|
|
369
|
+
2. Archived projects don't affect active command performance
|
|
370
|
+
3. If user truly concerned:
|
|
371
|
+
- Review archive: `clavix archive --list`
|
|
372
|
+
- Identify ancient/irrelevant projects
|
|
373
|
+
- Delete only truly obsolete ones: `clavix archive [old-project] --delete`
|
|
374
|
+
- Or suggest external backup for very old projects
|
|
285
375
|
|
|
286
376
|
### Issue: Archived project but forgot what it was about
|
|
287
377
|
**Cause**: No naming convention or time passed
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
378
|
+
|
|
379
|
+
**Agent recovery**:
|
|
380
|
+
1. Read the PRD to remind user:
|
|
381
|
+
```bash
|
|
382
|
+
cat .clavix/outputs/archive/[project-name]/full-prd.md
|
|
383
|
+
```
|
|
384
|
+
2. Summarize: Problem, Goal, Features from PRD
|
|
385
|
+
3. Suggest: Better naming conventions going forward
|
|
386
|
+
- Example: `2024-01-user-auth` (date-feature format)
|
|
387
|
+
- Example: `ecommerce-checkout-v2` (project-component format)
|
|
@@ -9,23 +9,24 @@ You are helping the user implement tasks from their task plan with AI assistance
|
|
|
9
9
|
|
|
10
10
|
## Instructions
|
|
11
11
|
|
|
12
|
-
1. **Run
|
|
13
|
-
|
|
14
|
-
clavix
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
1. **First-time setup - Run CLI command if needed**:
|
|
13
|
+
|
|
14
|
+
Check if `.clavix-implement-config.json` exists in the PRD output folder.
|
|
15
|
+
|
|
16
|
+
**If config file does NOT exist** (first time running implement):
|
|
17
|
+
- Run the CLI command to initialize:
|
|
18
|
+
```bash
|
|
19
|
+
clavix implement
|
|
20
|
+
```
|
|
21
|
+
- This will:
|
|
22
|
+
- Show current progress
|
|
23
|
+
- Display the next incomplete task
|
|
24
|
+
- Prompt user for git auto-commit preferences
|
|
25
|
+
- Create `.clavix-implement-config.json` file
|
|
26
|
+
- Wait for command to complete, then proceed with step 2
|
|
27
|
+
|
|
28
|
+
**If config file already exists**:
|
|
29
|
+
- Skip to step 2 (implementation loop)
|
|
29
30
|
|
|
30
31
|
2. **As the AI agent, you should**:
|
|
31
32
|
|
|
@@ -9,14 +9,18 @@ You are helping the user generate a CLEAR-optimized implementation task breakdow
|
|
|
9
9
|
|
|
10
10
|
## Instructions
|
|
11
11
|
|
|
12
|
-
### Part A:
|
|
12
|
+
### Part A: Agent Execution Protocol
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
**As an AI agent, you have two execution options:**
|
|
15
|
+
|
|
16
|
+
#### **Option 1: Run CLI Command** (Recommended for most cases)
|
|
17
|
+
|
|
18
|
+
1. **Validate prerequisites**:
|
|
19
|
+
- Check if `.clavix/outputs/` directory exists
|
|
20
|
+
- Look for PRD artifacts: `full-prd.md`, `quick-prd.md`, `mini-prd.md`, or `optimized-prompt.md`
|
|
17
21
|
- **If not found**: Error inline - "No PRD found in `.clavix/outputs/`. Use `/clavix:prd` or `/clavix:summarize` first."
|
|
18
22
|
|
|
19
|
-
2. **Run the
|
|
23
|
+
2. **Run the CLI command**:
|
|
20
24
|
```bash
|
|
21
25
|
clavix plan
|
|
22
26
|
```
|
|
@@ -26,12 +30,27 @@ You are helping the user generate a CLEAR-optimized implementation task breakdow
|
|
|
26
30
|
clavix plan --project project-name
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
Or generate
|
|
33
|
+
Or generate from saved session (auto-creates mini-prd.md):
|
|
30
34
|
```bash
|
|
31
35
|
clavix plan --session SESSION_ID
|
|
32
36
|
```
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
3. **CLI will handle**:
|
|
39
|
+
- Project selection (if multiple)
|
|
40
|
+
- Reading PRD content
|
|
41
|
+
- Generating task breakdown
|
|
42
|
+
- Creating `tasks.md` file
|
|
43
|
+
- Formatting with proper task IDs
|
|
44
|
+
|
|
45
|
+
#### **Option 2: Generate Tasks Directly** (If agent has full PRD context)
|
|
46
|
+
|
|
47
|
+
If you have the full PRD content in memory and want to generate tasks directly:
|
|
48
|
+
|
|
49
|
+
1. **Read the PRD** from `.clavix/outputs/[project-name]/`
|
|
50
|
+
2. **Generate task breakdown** following Part B principles
|
|
51
|
+
3. **Create `tasks.md`** with format specified in "Task Format Reference" below
|
|
52
|
+
4. **Save to**: `.clavix/outputs/[project-name]/tasks.md`
|
|
53
|
+
5. **Use exact format** (task IDs, checkboxes, structure)
|
|
35
54
|
|
|
36
55
|
### Part B: Behavioral Guidance (Task Breakdown Strategy)
|
|
37
56
|
|
|
@@ -89,19 +108,103 @@ The generated `tasks.md` will look like:
|
|
|
89
108
|
---
|
|
90
109
|
|
|
91
110
|
## Phase 1: Feature Name
|
|
111
|
+
|
|
92
112
|
- [ ] Task 1 description (ref: PRD Section)
|
|
113
|
+
Task ID: phase-1-feature-name-1
|
|
114
|
+
|
|
93
115
|
- [ ] Task 2 description
|
|
116
|
+
Task ID: phase-1-feature-name-2
|
|
117
|
+
|
|
94
118
|
- [ ] Task 3 description
|
|
119
|
+
Task ID: phase-1-feature-name-3
|
|
95
120
|
|
|
96
121
|
## Phase 2: Another Feature
|
|
122
|
+
|
|
97
123
|
- [ ] Task 4 description
|
|
124
|
+
Task ID: phase-2-another-feature-1
|
|
125
|
+
|
|
98
126
|
- [ ] Task 5 description
|
|
127
|
+
Task ID: phase-2-another-feature-2
|
|
99
128
|
|
|
100
129
|
---
|
|
101
130
|
|
|
102
131
|
*Generated by Clavix /clavix:plan*
|
|
103
132
|
```
|
|
104
133
|
|
|
134
|
+
## Task Format Reference (For Agent-Direct Generation)
|
|
135
|
+
|
|
136
|
+
**If you're generating tasks directly (Option 2), follow this exact format:**
|
|
137
|
+
|
|
138
|
+
### File Structure
|
|
139
|
+
```markdown
|
|
140
|
+
# Implementation Tasks
|
|
141
|
+
|
|
142
|
+
**Project**: {project-name}
|
|
143
|
+
**Generated**: {ISO timestamp}
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Phase {number}: {Phase Name}
|
|
148
|
+
|
|
149
|
+
- [ ] {Task description} (ref: {PRD Section})
|
|
150
|
+
Task ID: {task-id}
|
|
151
|
+
|
|
152
|
+
## Phase {number}: {Next Phase}
|
|
153
|
+
|
|
154
|
+
- [ ] {Task description}
|
|
155
|
+
Task ID: {task-id}
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
*Generated by Clavix /clavix:plan*
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Task ID Format
|
|
163
|
+
|
|
164
|
+
**Pattern**: `phase-{phase-number}-{sanitized-phase-name}-{task-counter}`
|
|
165
|
+
|
|
166
|
+
**Rules**:
|
|
167
|
+
- Phase number: Sequential starting from 1
|
|
168
|
+
- Sanitized phase name: Lowercase, spaces→hyphens, remove special chars
|
|
169
|
+
- Task counter: Sequential within phase, starting from 1
|
|
170
|
+
|
|
171
|
+
**Examples**:
|
|
172
|
+
- Phase "Setup & Configuration" → Task 1 → `phase-1-setup-configuration-1`
|
|
173
|
+
- Phase "User Authentication" → Task 3 → `phase-2-user-authentication-3`
|
|
174
|
+
- Phase "API Integration" → Task 1 → `phase-3-api-integration-1`
|
|
175
|
+
|
|
176
|
+
### Checkbox Format
|
|
177
|
+
|
|
178
|
+
**Always use**: `- [ ]` for incomplete tasks (space between brackets)
|
|
179
|
+
**Completed tasks**: `- [x]` (lowercase x, no spaces)
|
|
180
|
+
|
|
181
|
+
### Task Description Format
|
|
182
|
+
|
|
183
|
+
**Basic**: `- [ ] {Clear, actionable description}`
|
|
184
|
+
**With reference**: `- [ ] {Description} (ref: {PRD Section Name})`
|
|
185
|
+
|
|
186
|
+
**Example**:
|
|
187
|
+
```markdown
|
|
188
|
+
- [ ] Create user registration API endpoint (ref: User Management)
|
|
189
|
+
Task ID: phase-1-authentication-1
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Task ID Placement
|
|
193
|
+
|
|
194
|
+
**Critical**: Task ID must be on the line immediately after the task description
|
|
195
|
+
**Format**: ` Task ID: {id}` (2 spaces indent)
|
|
196
|
+
|
|
197
|
+
### Phase Header Format
|
|
198
|
+
|
|
199
|
+
**Pattern**: `## Phase {number}: {Phase Name}`
|
|
200
|
+
**Must have**: Empty line before and after phase header
|
|
201
|
+
|
|
202
|
+
### File Save Location
|
|
203
|
+
|
|
204
|
+
**Path**: `.clavix/outputs/{project-name}/tasks.md`
|
|
205
|
+
**Create directory if not exists**: Yes
|
|
206
|
+
**Overwrite if exists**: Only with explicit user confirmation or `--overwrite` flag
|
|
207
|
+
|
|
105
208
|
## Workflow Navigation
|
|
106
209
|
|
|
107
210
|
**You are here:** Plan (Task Breakdown)
|
|
@@ -129,45 +232,98 @@ The generated `tasks.md` will look like:
|
|
|
129
232
|
|
|
130
233
|
### Issue: No PRD found in `.clavix/outputs/`
|
|
131
234
|
**Cause**: User hasn't generated a PRD yet
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
235
|
+
|
|
236
|
+
**Agent recovery**:
|
|
237
|
+
1. Check if `.clavix/outputs/` directory exists:
|
|
238
|
+
```bash
|
|
239
|
+
ls .clavix/outputs/
|
|
240
|
+
```
|
|
241
|
+
2. If directory doesn't exist or is empty:
|
|
242
|
+
- Error: "No PRD artifacts found in `.clavix/outputs/`"
|
|
243
|
+
- Suggest recovery options:
|
|
244
|
+
- "Generate PRD with `/clavix:prd` for comprehensive planning"
|
|
245
|
+
- "Extract mini-PRD from conversation with `/clavix:summarize`"
|
|
246
|
+
- "Or use `clavix plan --session <id>` if you have a saved session"
|
|
247
|
+
3. Do NOT proceed with plan generation without PRD
|
|
136
248
|
|
|
137
249
|
### Issue: Generated tasks are too granular (100+ tasks)
|
|
138
250
|
**Cause**: Over-decomposition or large project scope
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
|
|
251
|
+
|
|
252
|
+
**Agent recovery**:
|
|
253
|
+
1. Review generated tasks in `tasks.md`
|
|
254
|
+
2. Identify micro-tasks that can be combined
|
|
255
|
+
3. Options for user:
|
|
256
|
+
- **Edit manually**: Combine related micro-tasks into larger atomic tasks
|
|
257
|
+
- **Regenerate**: Use `clavix plan --overwrite` after simplifying PRD
|
|
258
|
+
- **Split project**: Break into multiple PRDs if truly massive
|
|
259
|
+
4. Guideline: Each task should be 15-60 minutes, not 5 minutes
|
|
260
|
+
5. Combine setup/configuration tasks that belong together
|
|
144
261
|
|
|
145
262
|
### Issue: Generated tasks are too high-level (only 3-4 tasks)
|
|
146
263
|
**Cause**: PRD was too vague or task breakdown too coarse
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
264
|
+
|
|
265
|
+
**Agent recovery**:
|
|
266
|
+
1. Read the PRD to assess detail level
|
|
267
|
+
2. If PRD is vague:
|
|
268
|
+
- Suggest: "Let's improve the PRD with `/clavix:deep` first"
|
|
269
|
+
- Then regenerate tasks with `clavix plan --overwrite`
|
|
270
|
+
3. If PRD is detailed but tasks are high-level:
|
|
271
|
+
- Manually break each task into 3-5 concrete sub-tasks
|
|
272
|
+
- Or regenerate with more explicit decomposition request
|
|
273
|
+
4. Each task should have clear, testable deliverable
|
|
151
274
|
|
|
152
275
|
### Issue: Tasks don't follow logical dependency order
|
|
153
|
-
**Cause**: Generator didn't detect dependencies correctly
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
276
|
+
**Cause**: Generator didn't detect dependencies correctly OR agent-generated tasks weren't ordered
|
|
277
|
+
|
|
278
|
+
**Agent recovery**:
|
|
279
|
+
1. Review task order in `tasks.md`
|
|
280
|
+
2. Identify dependency violations:
|
|
281
|
+
- Database schema should precede API endpoints
|
|
282
|
+
- API endpoints should precede UI components
|
|
283
|
+
- Authentication should precede protected features
|
|
284
|
+
3. Manually reorder tasks in `tasks.md`:
|
|
285
|
+
- Cut and paste tasks to correct order
|
|
286
|
+
- Preserve task ID format
|
|
287
|
+
- Maintain phase groupings
|
|
288
|
+
4. Follow CLEAR [L] Logic principle: ensure sequential coherence
|
|
158
289
|
|
|
159
290
|
### Issue: Tasks conflict with PRD or duplicate work
|
|
160
291
|
**Cause**: Misinterpretation of PRD or redundant task generation
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
292
|
+
|
|
293
|
+
**Agent recovery**:
|
|
294
|
+
1. Read PRD and tasks.md side-by-side
|
|
295
|
+
2. Identify conflicts or duplicates
|
|
296
|
+
3. Options:
|
|
297
|
+
- **Remove duplicates**: Delete redundant tasks from tasks.md
|
|
298
|
+
- **Align with PRD**: Edit task descriptions to match PRD requirements
|
|
299
|
+
- **Clarify PRD**: If PRD is ambiguous, update it first
|
|
300
|
+
- **Regenerate**: Use `clavix plan --overwrite` after fixing PRD
|
|
301
|
+
4. Ensure each PRD feature maps to tasks
|
|
166
302
|
|
|
167
303
|
### Issue: `tasks.md` already exists, unsure if should regenerate
|
|
168
304
|
**Cause**: Previous plan exists for this PRD
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
305
|
+
|
|
306
|
+
**Agent recovery**:
|
|
307
|
+
1. Read existing `tasks.md`
|
|
308
|
+
2. Count completed tasks (check for `[x]` checkboxes)
|
|
309
|
+
3. Decision tree:
|
|
310
|
+
- **No progress** (all `[ ]`): Safe to use `clavix plan --overwrite`
|
|
311
|
+
- **Some progress**: Ask user before overwriting
|
|
312
|
+
- "Tasks.md has {X} completed tasks. Regenerating will lose this progress. Options:
|
|
313
|
+
1. Keep existing tasks.md and edit manually
|
|
314
|
+
2. Overwrite and start fresh (progress lost)
|
|
315
|
+
3. Cancel plan generation"
|
|
316
|
+
- **Mostly complete**: Recommend NOT overwriting
|
|
317
|
+
4. If user confirms overwrite: Run `clavix plan --project {name} --overwrite`
|
|
318
|
+
|
|
319
|
+
### Issue: CLI command fails or no output
|
|
320
|
+
**Cause**: Missing dependencies, corrupted PRD file, or CLI error
|
|
321
|
+
|
|
322
|
+
**Agent recovery**:
|
|
323
|
+
1. Check CLI error output
|
|
324
|
+
2. Common fixes:
|
|
325
|
+
- Verify PRD file exists and is readable
|
|
326
|
+
- Check `.clavix/outputs/{project}/` has valid PRD
|
|
327
|
+
- Verify project name is correct (no typos)
|
|
328
|
+
3. Try with explicit project: `clavix plan --project {exact-name}`
|
|
329
|
+
4. If persistent: Inform user to check Clavix installation
|
|
@@ -97,7 +97,7 @@ You are helping the user create a Product Requirements Document (PRD) using Clav
|
|
|
97
97
|
[Out of scope and additional context from Q4+Q5]
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
3. Save both documents
|
|
100
|
+
3. **Save both documents** using the file-saving protocol below
|
|
101
101
|
|
|
102
102
|
4. **CLEAR Framework Validation** (automatic):
|
|
103
103
|
- After PRD generation, the quick-prd.md is analyzed using CLEAR framework
|
|
@@ -107,6 +107,115 @@ You are helping the user create a Product Requirements Document (PRD) using Clav
|
|
|
107
107
|
|
|
108
108
|
5. Display file paths, CLEAR validation results, and suggest next steps.
|
|
109
109
|
|
|
110
|
+
## File-Saving Protocol (For AI Agents)
|
|
111
|
+
|
|
112
|
+
**As an AI agent, follow these exact steps to save PRD files:**
|
|
113
|
+
|
|
114
|
+
### Step 1: Determine Project Name
|
|
115
|
+
- **From user input**: Use project name mentioned during Q&A
|
|
116
|
+
- **If not specified**: Derive from problem/goal (sanitize: lowercase, spaces→hyphens, remove special chars)
|
|
117
|
+
- **Example**: "Sales Manager Dashboard" → `sales-manager-dashboard`
|
|
118
|
+
|
|
119
|
+
### Step 2: Create Output Directory
|
|
120
|
+
```bash
|
|
121
|
+
mkdir -p .clavix/outputs/{sanitized-project-name}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Handle errors**:
|
|
125
|
+
- If directory creation fails: Check write permissions
|
|
126
|
+
- If `.clavix/` doesn't exist: Create it first: `mkdir -p .clavix/outputs/{project}`
|
|
127
|
+
|
|
128
|
+
### Step 3: Save Full PRD
|
|
129
|
+
**File path**: `.clavix/outputs/{project-name}/full-prd.md`
|
|
130
|
+
|
|
131
|
+
**Content structure**:
|
|
132
|
+
```markdown
|
|
133
|
+
# Product Requirements Document: {Project Name}
|
|
134
|
+
|
|
135
|
+
## Problem & Goal
|
|
136
|
+
{User's Q1 answer - problem and goal}
|
|
137
|
+
|
|
138
|
+
## Requirements
|
|
139
|
+
### Must-Have Features
|
|
140
|
+
{User's Q2 answer - expanded with details from conversation}
|
|
141
|
+
|
|
142
|
+
### Technical Requirements
|
|
143
|
+
{User's Q3 answer - tech stack, integrations, constraints}
|
|
144
|
+
|
|
145
|
+
## Out of Scope
|
|
146
|
+
{User's Q4 answer - explicit exclusions}
|
|
147
|
+
|
|
148
|
+
## Additional Context
|
|
149
|
+
{User's Q5 answer if provided, or omit section}
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
*Generated by Clavix /clavix:prd*
|
|
154
|
+
*Generated: {ISO timestamp}*
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Step 4: Save Quick PRD
|
|
158
|
+
**File path**: `.clavix/outputs/{project-name}/quick-prd.md`
|
|
159
|
+
|
|
160
|
+
**Content structure** (2-3 paragraphs, AI-optimized):
|
|
161
|
+
```markdown
|
|
162
|
+
# {Project Name} - Quick PRD
|
|
163
|
+
|
|
164
|
+
{Paragraph 1: Combine problem + goal + must-have features from Q1+Q2}
|
|
165
|
+
|
|
166
|
+
{Paragraph 2: Technical requirements and constraints from Q3}
|
|
167
|
+
|
|
168
|
+
{Paragraph 3: Out of scope and additional context from Q4+Q5}
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
*Generated by Clavix /clavix:prd*
|
|
173
|
+
*Generated: {ISO timestamp}*
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Step 5: Verify Files Were Created
|
|
177
|
+
```bash
|
|
178
|
+
ls .clavix/outputs/{project-name}/
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Expected output**:
|
|
182
|
+
- `full-prd.md`
|
|
183
|
+
- `quick-prd.md`
|
|
184
|
+
|
|
185
|
+
### Step 6: Communicate Success
|
|
186
|
+
Display to user:
|
|
187
|
+
```
|
|
188
|
+
✓ PRD generated successfully!
|
|
189
|
+
|
|
190
|
+
Files saved:
|
|
191
|
+
• Full PRD: .clavix/outputs/{project-name}/full-prd.md
|
|
192
|
+
• Quick PRD: .clavix/outputs/{project-name}/quick-prd.md
|
|
193
|
+
|
|
194
|
+
CLEAR Validation Results:
|
|
195
|
+
[C] Conciseness: {score}/10 - {feedback}
|
|
196
|
+
[L] Logic: {score}/10 - {feedback}
|
|
197
|
+
[E] Explicitness: {score}/10 - {feedback}
|
|
198
|
+
|
|
199
|
+
Next steps:
|
|
200
|
+
• Review and edit PRD files if needed
|
|
201
|
+
• Run /clavix:plan to generate implementation tasks
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Error Handling
|
|
205
|
+
|
|
206
|
+
**If file write fails**:
|
|
207
|
+
1. Check error message
|
|
208
|
+
2. Common issues:
|
|
209
|
+
- Permission denied: Inform user to check directory permissions
|
|
210
|
+
- Disk full: Inform user about disk space
|
|
211
|
+
- Path too long: Suggest shorter project name
|
|
212
|
+
3. Do NOT proceed to next steps without successful file save
|
|
213
|
+
|
|
214
|
+
**If directory already exists**:
|
|
215
|
+
- This is OK - proceed with writing files
|
|
216
|
+
- Existing files will be overwritten (user initiated PRD generation)
|
|
217
|
+
- If unsure: Ask user "Project `{name}` already exists. Overwrite PRD files?"
|
|
218
|
+
|
|
110
219
|
## CLEAR Validation
|
|
111
220
|
|
|
112
221
|
**What gets validated:**
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error messages optimized for AI agent consumption
|
|
3
|
+
*
|
|
4
|
+
* All messages follow these principles:
|
|
5
|
+
* - Programmatically actionable (no "ask user to..." language)
|
|
6
|
+
* - List recovery options explicitly
|
|
7
|
+
* - Provide context for decision-making
|
|
8
|
+
* - Avoid conversational tone in favor of structured guidance
|
|
9
|
+
*/
|
|
10
|
+
export declare class AgentErrorMessages {
|
|
11
|
+
/**
|
|
12
|
+
* Error: No PRD artifacts found in .clavix/outputs/
|
|
13
|
+
* Used by: plan.ts, implement.ts
|
|
14
|
+
*/
|
|
15
|
+
static noPrdFound(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Error: No tasks.md found for specified project
|
|
18
|
+
* Used by: implement.ts
|
|
19
|
+
*/
|
|
20
|
+
static noTasksFound(projectName: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Error: .clavix-implement-config.json not found
|
|
23
|
+
* Used by: task-complete.ts, implement workflow
|
|
24
|
+
*/
|
|
25
|
+
static configNotFound(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Error: Specified task ID not found in tasks.md
|
|
28
|
+
* Used by: task-complete.ts
|
|
29
|
+
*/
|
|
30
|
+
static taskNotFound(taskId: string, availableTasks: Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
description: string;
|
|
33
|
+
completed: boolean;
|
|
34
|
+
}>): string;
|
|
35
|
+
/**
|
|
36
|
+
* Error: Archive validation failed (prerequisites not met)
|
|
37
|
+
* Used by: archive.ts
|
|
38
|
+
*/
|
|
39
|
+
static archiveValidationFailed(reason: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Error: File operation failed (write, read, move, delete)
|
|
42
|
+
* Used by: Multiple commands performing file operations
|
|
43
|
+
*/
|
|
44
|
+
static fileOperationFailed(operation: 'read' | 'write' | 'move' | 'delete', path: string, error?: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Error: Multiple PRD projects found, need user selection
|
|
47
|
+
* Used by: plan.ts, implement.ts when --project not specified
|
|
48
|
+
*/
|
|
49
|
+
static multiplePrdsFound(projects: string[]): string;
|
|
50
|
+
/**
|
|
51
|
+
* Error: tasks.md already exists with progress
|
|
52
|
+
* Used by: plan.ts when generating tasks
|
|
53
|
+
*/
|
|
54
|
+
static tasksExistWithProgress(completedCount: number, totalCount: number): string;
|
|
55
|
+
/**
|
|
56
|
+
* Error: Git repository not initialized
|
|
57
|
+
* Used by: implement.ts, task-complete.ts when git features expected
|
|
58
|
+
*/
|
|
59
|
+
static gitNotInitialized(): string;
|
|
60
|
+
/**
|
|
61
|
+
* Error: No archivable projects found
|
|
62
|
+
* Used by: archive.ts
|
|
63
|
+
*/
|
|
64
|
+
static noArchivableProjects(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Error: Restoration failed due to name conflict
|
|
67
|
+
* Used by: archive.ts --restore
|
|
68
|
+
*/
|
|
69
|
+
static restoreConflict(projectName: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Error: CLI command execution failed
|
|
72
|
+
* Used by: When running CLI commands via Bash tool
|
|
73
|
+
*/
|
|
74
|
+
static cliExecutionFailed(command: string, exitCode: number, stderr?: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Error: Invalid task ID format
|
|
77
|
+
* Used by: task-complete.ts
|
|
78
|
+
*/
|
|
79
|
+
static invalidTaskIdFormat(taskId: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Error: Session not found
|
|
82
|
+
* Used by: Commands using --session flag
|
|
83
|
+
*/
|
|
84
|
+
static sessionNotFound(sessionId: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Warning: Task already completed
|
|
87
|
+
* Used by: task-complete.ts when marking already-done task
|
|
88
|
+
*/
|
|
89
|
+
static taskAlreadyCompleted(taskId: string): string;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=agent-error-messages.d.ts.map
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error messages optimized for AI agent consumption
|
|
4
|
+
*
|
|
5
|
+
* All messages follow these principles:
|
|
6
|
+
* - Programmatically actionable (no "ask user to..." language)
|
|
7
|
+
* - List recovery options explicitly
|
|
8
|
+
* - Provide context for decision-making
|
|
9
|
+
* - Avoid conversational tone in favor of structured guidance
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AgentErrorMessages = void 0;
|
|
13
|
+
class AgentErrorMessages {
|
|
14
|
+
/**
|
|
15
|
+
* Error: No PRD artifacts found in .clavix/outputs/
|
|
16
|
+
* Used by: plan.ts, implement.ts
|
|
17
|
+
*/
|
|
18
|
+
static noPrdFound() {
|
|
19
|
+
return ('No PRD artifacts found in .clavix/outputs/\n\n' +
|
|
20
|
+
'Agent recovery options:\n' +
|
|
21
|
+
' 1. Execute /clavix:prd to generate comprehensive PRD\n' +
|
|
22
|
+
' 2. Execute /clavix:summarize if conversation exists\n' +
|
|
23
|
+
' 3. Use clavix plan --session <id> if saved session available\n\n' +
|
|
24
|
+
'Select option and execute, then retry this command.');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Error: No tasks.md found for specified project
|
|
28
|
+
* Used by: implement.ts
|
|
29
|
+
*/
|
|
30
|
+
static noTasksFound(projectName) {
|
|
31
|
+
return (`No tasks.md found for project: ${projectName}\n\n` +
|
|
32
|
+
'Agent recovery options:\n' +
|
|
33
|
+
` 1. Execute: clavix plan --project ${projectName}\n` +
|
|
34
|
+
' 2. Or execute /clavix:plan to generate interactively\n\n' +
|
|
35
|
+
'After task generation completes, retry implementation.');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Error: .clavix-implement-config.json not found
|
|
39
|
+
* Used by: task-complete.ts, implement workflow
|
|
40
|
+
*/
|
|
41
|
+
static configNotFound() {
|
|
42
|
+
return ('Configuration file not found: .clavix-implement-config.json\n\n' +
|
|
43
|
+
'Agent recovery:\n' +
|
|
44
|
+
' 1. Run: clavix implement\n' +
|
|
45
|
+
' 2. Wait for user to select git strategy\n' +
|
|
46
|
+
' 3. Config will be created automatically\n' +
|
|
47
|
+
' 4. Then retry task completion\n\n' +
|
|
48
|
+
'This is expected on first run.');
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Error: Specified task ID not found in tasks.md
|
|
52
|
+
* Used by: task-complete.ts
|
|
53
|
+
*/
|
|
54
|
+
static taskNotFound(taskId, availableTasks) {
|
|
55
|
+
const taskList = availableTasks
|
|
56
|
+
.map(t => {
|
|
57
|
+
const status = t.completed ? '[x]' : '[ ]';
|
|
58
|
+
return ` ${status} ${t.id} - ${t.description}`;
|
|
59
|
+
})
|
|
60
|
+
.join('\n');
|
|
61
|
+
return (`Task ID not found: ${taskId}\n\n` +
|
|
62
|
+
'Available task IDs:\n' +
|
|
63
|
+
taskList + '\n\n' +
|
|
64
|
+
'Select a valid task ID from the list above and retry.');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Error: Archive validation failed (prerequisites not met)
|
|
68
|
+
* Used by: archive.ts
|
|
69
|
+
*/
|
|
70
|
+
static archiveValidationFailed(reason) {
|
|
71
|
+
return (`Archive validation failed: ${reason}\n\n` +
|
|
72
|
+
'Agent recovery options:\n' +
|
|
73
|
+
' 1. Check task completion status\n' +
|
|
74
|
+
' 2. Use --force flag if project is truly complete\n' +
|
|
75
|
+
' 3. Or complete remaining tasks first\n\n' +
|
|
76
|
+
'Ensure prerequisites are met before archiving.');
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Error: File operation failed (write, read, move, delete)
|
|
80
|
+
* Used by: Multiple commands performing file operations
|
|
81
|
+
*/
|
|
82
|
+
static fileOperationFailed(operation, path, error) {
|
|
83
|
+
const errorDetail = error ? `\nError: ${error}` : '';
|
|
84
|
+
return (`File operation failed: ${operation} at ${path}${errorDetail}\n\n` +
|
|
85
|
+
'Agent recovery options:\n' +
|
|
86
|
+
' 1. Verify path exists and is correct\n' +
|
|
87
|
+
' 2. Check file/directory permissions\n' +
|
|
88
|
+
' 3. Ensure no other process is accessing the file\n' +
|
|
89
|
+
' 4. Check available disk space\n\n' +
|
|
90
|
+
'Fix the underlying issue and retry.');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Error: Multiple PRD projects found, need user selection
|
|
94
|
+
* Used by: plan.ts, implement.ts when --project not specified
|
|
95
|
+
*/
|
|
96
|
+
static multiplePrdsFound(projects) {
|
|
97
|
+
const projectList = projects.map((p, i) => ` ${i + 1}. ${p}`).join('\n');
|
|
98
|
+
return ('Multiple PRD projects found:\n\n' +
|
|
99
|
+
projectList + '\n\n' +
|
|
100
|
+
'Agent recovery options:\n' +
|
|
101
|
+
' 1. Specify project explicitly: --project <name>\n' +
|
|
102
|
+
' 2. Or run CLI in interactive mode to let user select\n\n' +
|
|
103
|
+
'Cannot proceed without project selection.');
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Error: tasks.md already exists with progress
|
|
107
|
+
* Used by: plan.ts when generating tasks
|
|
108
|
+
*/
|
|
109
|
+
static tasksExistWithProgress(completedCount, totalCount) {
|
|
110
|
+
return (`tasks.md already exists with progress: ${completedCount}/${totalCount} tasks completed\n\n` +
|
|
111
|
+
'Agent recovery options:\n' +
|
|
112
|
+
' 1. Keep existing tasks.md and edit manually\n' +
|
|
113
|
+
' 2. Use --overwrite flag to regenerate (progress will be lost)\n' +
|
|
114
|
+
' 3. Cancel plan generation\n\n' +
|
|
115
|
+
'Ask user which option to proceed with.');
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Error: Git repository not initialized
|
|
119
|
+
* Used by: implement.ts, task-complete.ts when git features expected
|
|
120
|
+
*/
|
|
121
|
+
static gitNotInitialized() {
|
|
122
|
+
return ('Git repository not detected\n\n' +
|
|
123
|
+
'Auto-commit features are disabled.\n\n' +
|
|
124
|
+
'To enable git integration:\n' +
|
|
125
|
+
' 1. Run: git init\n' +
|
|
126
|
+
' 2. Or use --no-git flag to skip git features\n\n' +
|
|
127
|
+
'Proceeding without git auto-commit.');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Error: No archivable projects found
|
|
131
|
+
* Used by: archive.ts
|
|
132
|
+
*/
|
|
133
|
+
static noArchivableProjects() {
|
|
134
|
+
return ('No archivable projects found\n\n' +
|
|
135
|
+
'Possible reasons:\n' +
|
|
136
|
+
' • No PRD projects in .clavix/outputs/\n' +
|
|
137
|
+
' • All projects already archived\n' +
|
|
138
|
+
' • No projects with completed tasks\n\n' +
|
|
139
|
+
'Agent recovery options:\n' +
|
|
140
|
+
' 1. Run: clavix archive --list to see archived projects\n' +
|
|
141
|
+
' 2. Check: .clavix/outputs/ for active projects\n' +
|
|
142
|
+
' 3. Or create new PRD with /clavix:prd');
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Error: Restoration failed due to name conflict
|
|
146
|
+
* Used by: archive.ts --restore
|
|
147
|
+
*/
|
|
148
|
+
static restoreConflict(projectName) {
|
|
149
|
+
return (`Restoration conflict: Project "${projectName}" already exists in active outputs\n\n` +
|
|
150
|
+
'Agent recovery options:\n' +
|
|
151
|
+
' 1. Archive the active project first\n' +
|
|
152
|
+
' 2. Manually rename one of the projects\n' +
|
|
153
|
+
' 3. Cancel restoration\n\n' +
|
|
154
|
+
'Ask user which option to proceed with.');
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Error: CLI command execution failed
|
|
158
|
+
* Used by: When running CLI commands via Bash tool
|
|
159
|
+
*/
|
|
160
|
+
static cliExecutionFailed(command, exitCode, stderr) {
|
|
161
|
+
const errorDetail = stderr ? `\n\nError output:\n${stderr}` : '';
|
|
162
|
+
return (`CLI command failed: ${command}\n` +
|
|
163
|
+
`Exit code: ${exitCode}${errorDetail}\n\n` +
|
|
164
|
+
'Agent recovery options:\n' +
|
|
165
|
+
' 1. Check command syntax is correct\n' +
|
|
166
|
+
' 2. Verify Clavix is installed: clavix --version\n' +
|
|
167
|
+
' 3. Check for error details above\n' +
|
|
168
|
+
' 4. Retry with corrected parameters\n\n' +
|
|
169
|
+
'Fix the issue and retry.');
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Error: Invalid task ID format
|
|
173
|
+
* Used by: task-complete.ts
|
|
174
|
+
*/
|
|
175
|
+
static invalidTaskIdFormat(taskId) {
|
|
176
|
+
return (`Invalid task ID format: ${taskId}\n\n` +
|
|
177
|
+
'Expected format: phase-{number}-{sanitized-phase-name}-{counter}\n\n' +
|
|
178
|
+
'Examples:\n' +
|
|
179
|
+
' • phase-1-setup-1\n' +
|
|
180
|
+
' • phase-2-user-authentication-3\n' +
|
|
181
|
+
' • phase-3-api-integration-1\n\n' +
|
|
182
|
+
'Check tasks.md for correct task IDs and retry.');
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Error: Session not found
|
|
186
|
+
* Used by: Commands using --session flag
|
|
187
|
+
*/
|
|
188
|
+
static sessionNotFound(sessionId) {
|
|
189
|
+
return (`Session not found: ${sessionId}\n\n` +
|
|
190
|
+
'Agent recovery options:\n' +
|
|
191
|
+
' 1. Verify session ID is correct\n' +
|
|
192
|
+
' 2. List available sessions (if supported)\n' +
|
|
193
|
+
' 3. Use --active-session flag for current session\n' +
|
|
194
|
+
' 4. Or generate PRD without session\n\n' +
|
|
195
|
+
'Session may have expired or never existed.');
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Warning: Task already completed
|
|
199
|
+
* Used by: task-complete.ts when marking already-done task
|
|
200
|
+
*/
|
|
201
|
+
static taskAlreadyCompleted(taskId) {
|
|
202
|
+
return (`Task already completed: ${taskId}\n\n` +
|
|
203
|
+
'This task is marked as [x] in tasks.md.\n\n' +
|
|
204
|
+
'Agent options:\n' +
|
|
205
|
+
' 1. Proceed to next incomplete task\n' +
|
|
206
|
+
' 2. Use --force to mark again (updates tracking)\n' +
|
|
207
|
+
' 3. Check if this was intended\n\n' +
|
|
208
|
+
'No action needed unless forced.');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.AgentErrorMessages = AgentErrorMessages;
|
|
212
|
+
//# sourceMappingURL=agent-error-messages.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clavix",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Transform vague ideas into production-ready prompts.
|
|
3
|
+
"version": "2.6.0",
|
|
4
|
+
"description": "Transform vague ideas into production-ready prompts. AI agent tool with CLI interface using the CLEAR framework to analyze, improve, and generate PRDs for AI coding assistants (Claude Code, Cursor, Windsurf, and more)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|