clavix 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +199 -31
  2. package/dist/cli/commands/deep.d.ts +6 -0
  3. package/dist/cli/commands/deep.d.ts.map +1 -1
  4. package/dist/cli/commands/deep.js +243 -83
  5. package/dist/cli/commands/deep.js.map +1 -1
  6. package/dist/cli/commands/fast.d.ts +6 -0
  7. package/dist/cli/commands/fast.d.ts.map +1 -1
  8. package/dist/cli/commands/fast.js +293 -91
  9. package/dist/cli/commands/fast.js.map +1 -1
  10. package/dist/cli/commands/implement.d.ts +13 -0
  11. package/dist/cli/commands/implement.d.ts.map +1 -0
  12. package/dist/cli/commands/implement.js +222 -0
  13. package/dist/cli/commands/implement.js.map +1 -0
  14. package/dist/cli/commands/init.js +3 -3
  15. package/dist/cli/commands/init.js.map +1 -1
  16. package/dist/cli/commands/plan.d.ts +13 -0
  17. package/dist/cli/commands/plan.d.ts.map +1 -0
  18. package/dist/cli/commands/plan.js +147 -0
  19. package/dist/cli/commands/plan.js.map +1 -0
  20. package/dist/cli/commands/prd.d.ts +6 -0
  21. package/dist/cli/commands/prd.d.ts.map +1 -1
  22. package/dist/cli/commands/prd.js +98 -0
  23. package/dist/cli/commands/prd.js.map +1 -1
  24. package/dist/cli/commands/summarize.d.ts +6 -0
  25. package/dist/cli/commands/summarize.d.ts.map +1 -1
  26. package/dist/cli/commands/summarize.js +97 -1
  27. package/dist/cli/commands/summarize.js.map +1 -1
  28. package/dist/cli/commands/version.js +1 -1
  29. package/dist/cli/commands/version.js.map +1 -1
  30. package/dist/core/agent-manager.d.ts.map +1 -1
  31. package/dist/core/conversation-analyzer.d.ts.map +1 -1
  32. package/dist/core/git-manager.d.ts +100 -0
  33. package/dist/core/git-manager.d.ts.map +1 -0
  34. package/dist/core/git-manager.js +214 -0
  35. package/dist/core/git-manager.js.map +1 -0
  36. package/dist/core/prompt-optimizer.d.ts +125 -1
  37. package/dist/core/prompt-optimizer.d.ts.map +1 -1
  38. package/dist/core/prompt-optimizer.js +537 -5
  39. package/dist/core/prompt-optimizer.js.map +1 -1
  40. package/dist/core/session-manager.d.ts.map +1 -1
  41. package/dist/core/session-manager.js +4 -3
  42. package/dist/core/session-manager.js.map +1 -1
  43. package/dist/core/task-manager.d.ts +142 -0
  44. package/dist/core/task-manager.d.ts.map +1 -0
  45. package/dist/core/task-manager.js +504 -0
  46. package/dist/core/task-manager.js.map +1 -0
  47. package/dist/templates/slash-commands/claude-code/deep.md +58 -48
  48. package/dist/templates/slash-commands/claude-code/fast.md +73 -44
  49. package/dist/templates/slash-commands/claude-code/prd.md +20 -4
  50. package/dist/templates/slash-commands/claude-code/start.md +13 -4
  51. package/dist/templates/slash-commands/claude-code/summarize.md +25 -6
  52. package/dist/utils/file-system.js +3 -3
  53. package/dist/utils/file-system.js.map +1 -1
  54. package/package.json +2 -2
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Clavix
2
2
 
3
3
  > AI prompt improvement and PRD generation CLI tool for developers
4
+ >
5
+ > **Built on the CLEAR Framework** - Academically-validated prompt engineering methodology
4
6
 
5
- Clavix helps developers create better prompts and structured Product Requirements Documents (PRDs) for AI-assisted development tools like Claude Code. Through Socratic questioning and rule-based analysis, Clavix ensures your requirements are clear, complete, and actionable.
7
+ Clavix helps developers create better prompts and structured Product Requirements Documents (PRDs) for AI-assisted development tools like Claude Code. Using the CLEAR Framework (Concise, Logical, Explicit, Adaptive, Reflective) and Socratic questioning, Clavix ensures your requirements are clear, complete, and actionable.
6
8
 
7
9
  ## Why Clavix?
8
10
 
@@ -13,23 +15,90 @@ AI-assisted development tools produce better code when given better prompts. How
13
15
  - **Integrating seamlessly** with your AI development workflow
14
16
  - **Working offline** - no API calls, fully local operation
15
17
 
18
+ ## Why CLEAR?
19
+
20
+ **CLEAR Framework** is an academically-validated methodology for prompt engineering developed by **Dr. Leo Lo**, Dean of Libraries at the University of New Mexico, and published in the *Journal of Academic Librarianship* (July 2023).
21
+
22
+ **The five CLEAR components:**
23
+ - **[C] Concise** - Eliminate verbosity, remove pleasantries, focus on essentials
24
+ - **[L] Logical** - Ensure coherent sequencing (context → requirements → constraints → output)
25
+ - **[E] Explicit** - Specify persona, output format, tone, and success criteria
26
+ - **[A] Adaptive** - Provide alternative approaches, flexibility, and customization
27
+ - **[R] Reflective** - Enable validation, edge case analysis, and quality checks
28
+
29
+ **Benefits:** Research-backed methodology, proven effectiveness, modern approach to AI interaction, educational feedback on prompt improvements.
30
+
31
+ **Academic Citation:**
32
+ Lo, L. S. (2023). "The CLEAR Path: A Framework for Enhancing Information Literacy through Prompt Engineering." *Journal of Academic Librarianship*, 49(4). [Framework Guide](https://guides.library.tamucc.edu/prompt-engineering/clear)
33
+
16
34
  ## Features
17
35
 
18
- ### Phase 1 (MVP) Complete
36
+ ### 🎯 CLEAR Framework Prompt Engineering
37
+
38
+ - **Fast Mode** - CLEAR-guided quick improvements (C, L, E components) with smart triage
39
+ - **Deep Mode** - Full CLEAR framework analysis (C, L, E, A, R) with comprehensive validation
40
+ - **CLEAR Assessment** - Score each component (0-100), overall rating, educational feedback with labeled improvements
41
+
42
+ ### 📋 CLEAR-Validated PRD Generation
43
+
44
+ - **Interactive Workflow** - Guided Socratic questioning with sequential and conditional flows
45
+ - **CLEAR Validation** - Generated PRDs are analyzed for AI consumption quality (C, L, E components)
46
+ - **Dual Output Format** - Comprehensive team PRD (`full-prd.md`) + CLEAR-optimized AI-ready version (`quick-prd.md`)
47
+ - **Handlebars Templates** - Fully customizable PRD formats with template override support
48
+
49
+ ### 🚀 PRD-to-Implementation Workflow
50
+
51
+ - **Task Planning** - Auto-generate implementation task breakdown from PRD with CLEAR-optimized atomic tasks
52
+ - **Session Resume** - Stateful task tracking via markdown checkboxes, resume from last incomplete task
53
+ - **Git Auto-Commit** - Optional automatic commits (per-task, per-5-tasks, per-phase) with descriptive messages
54
+ - **AI-Assisted Execution** - Seamless handoff from strategic planning (PRD) to tactical implementation
55
+
56
+ ### 💬 CLEAR-Optimized Conversational Mode
57
+
58
+ - **Session Management** - Track conversations with UUID-based sessions, metadata, tags, and status tracking
59
+ - **Message History** - Complete conversation logs with user/assistant role tracking
60
+ - **CLEAR Extraction** - Extract and optimize prompts using CLEAR framework, display both raw and CLEAR-enhanced versions
61
+ - **Search & Filter** - Find sessions by project, agent, status, tags, keywords, or date range
19
62
 
20
- - **Global CLI tool** - Install once, use everywhere
21
- - ✅ **Prompt improvement** - Analyze and enhance prompts directly
22
- - ✅ **Claude Code integration** - Slash commands in your AI agent
23
- - ✅ **Managed documentation** - Auto-inject into AGENTS.md and CLAUDE.md
24
- - ✅ **Template system** - Customizable templates for your workflow
63
+ ### 🤖 AI Agent Integration
25
64
 
26
- ### Phase 2 (Core Workflows) Complete
65
+ - **Claude Code Support** - Slash commands (`/clavix:fast`, `/clavix:deep`, `/clavix:prd`, `/clavix:plan`, `/clavix:implement`, `/clavix:start`, `/clavix:summarize`) with auto-detection
66
+ - **Managed Documentation** - Auto-inject and update instructions in `AGENTS.md` and `CLAUDE.md` with safe managed blocks
67
+ - **Extensible Architecture** - Adapter pattern ready for future Cursor, Windsurf, and other agent integrations
27
68
 
28
- - **PRD generation** - Guided Socratic questioning workflow
29
- - ✅ **Conversational mode** - Iterative prompt development
30
- - **Session management** - Track and organize conversations
31
- - **Analysis tools** - Extract optimized prompts from conversations
32
- - **Additional commands** - list, show, config, update
69
+ ### ⚙️ Configuration & Management
70
+
71
+ - **Project Configuration** - Customize templates, output paths, agent selection, and preferences via `.clavix/config.json`
72
+ - **Interactive CLI** - View current config, change settings, edit preferences, or reset to defaults
73
+ - **Template System** - Override built-in templates with custom versions in `.clavix/templates/`
74
+ - **Atomic File Operations** - Safe writes and updates prevent data corruption
75
+
76
+ ### 📚 Documentation Management
77
+
78
+ - **Managed Blocks** - Auto-inject instructions with `<!-- CLAVIX:START -->` `<!-- CLAVIX:END -->` markers
79
+ - **Update Command** - Keep slash commands and documentation synchronized across updates
80
+ - **Safe Updates** - Preserve manual content while refreshing managed sections
81
+ - **Migration Support** - Automatic cleanup of old command structures
82
+
83
+ ### 🔧 CLI Commands
84
+
85
+ - `clavix init` - Initialize Clavix in your project with agent selection
86
+ - `clavix fast <prompt>` - CLEAR-guided quick improvements (C, L, E components)
87
+ - `--clear-only` - Show only CLEAR scores without improved prompt
88
+ - `--framework-info` - Display CLEAR framework information
89
+ - `clavix deep <prompt>` - Full CLEAR framework analysis (C, L, E, A, R)
90
+ - `--clear-only` - Show only CLEAR scores without improved prompt
91
+ - `--framework-info` - Display CLEAR framework information
92
+ - `clavix prd` - Generate CLEAR-validated PRD through Socratic questions
93
+ - `clavix plan` - Generate implementation task breakdown from PRD
94
+ - `clavix implement` - Execute tasks from the implementation plan with AI assistance
95
+ - `clavix start` - Begin conversational session for iterative development
96
+ - `clavix summarize [session-id]` - Extract and CLEAR-optimize prompts from conversation
97
+ - `clavix list` - List sessions and outputs with filtering options
98
+ - `clavix show [session-id]` - View detailed session/output information
99
+ - `clavix config` - Manage configuration (get/set/edit/reset)
100
+ - `clavix update` - Update managed blocks and slash commands
101
+ - `clavix version` - Display version information
33
102
 
34
103
  ## Installation
35
104
 
@@ -37,6 +106,11 @@ AI-assisted development tools produce better code when given better prompts. How
37
106
  npm install -g clavix
38
107
  ```
39
108
 
109
+ **Troubleshooting:**
110
+ - If you encounter permission errors, use `sudo npm install -g clavix` (macOS/Linux)
111
+ - On Windows, run your terminal as Administrator
112
+ - Verify installation with `clavix version`
113
+
40
114
  ## Quick Start
41
115
 
42
116
  ### 1. Initialize in Your Project
@@ -51,34 +125,42 @@ This will:
51
125
  - Generate slash commands for your AI agent
52
126
  - Inject managed blocks into AGENTS.md and CLAUDE.md
53
127
 
54
- ### 2. Improve a Prompt
128
+ ### 2. Improve a Prompt with CLEAR Framework
55
129
 
56
- **Fast mode** (quick improvements):
130
+ **Fast mode** (C, L, E components):
57
131
  ```bash
58
132
  clavix fast "Create a login page"
59
133
  ```
60
134
 
61
- **Deep mode** (comprehensive analysis):
135
+ **Deep mode** (full CLEAR - C, L, E, A, R):
62
136
  ```bash
63
137
  clavix deep "Create a login page"
64
138
  ```
65
139
 
140
+ **Framework info:**
141
+ ```bash
142
+ clavix fast --framework-info
143
+ ```
144
+
66
145
  Output:
67
- - Analysis of gaps and ambiguities
68
- - Structured prompt with clear sections
69
- - Changes made summary
70
- - Smart triage recommendations (fast mode)
71
- - Alternative phrasings, edge cases, examples (deep mode)
146
+ - **CLEAR Assessment** - Component scores (Conciseness, Logic, Explicitness + Adaptive & Reflective in deep mode)
147
+ - **CLEAR-Optimized Prompt** - Improved version applying all CLEAR principles
148
+ - **CLEAR Changes Made** - Educational feedback labeled with [C], [L], [E], [A], [R] components
149
+ - **Smart Triage** - CLEAR-aware recommendations for when to use deep mode
150
+ - **Adaptive Variations** - Alternative phrasings and structures (deep mode)
151
+ - **Reflection Checklist** - Validation steps and edge cases (deep mode)
72
152
 
73
153
  ### 3. Use Slash Commands (Claude Code)
74
154
 
75
- After initialization, use these commands in Claude Code:
155
+ After initialization, use these CLEAR-enhanced commands in Claude Code:
76
156
 
77
- - `/clavix:fast [prompt]` - Quick prompt improvements
78
- - `/clavix:deep [prompt]` - Comprehensive prompt analysis
79
- - `/clavix:prd` - Generate a PRD
157
+ - `/clavix:fast [prompt]` - CLEAR-guided quick improvements (C, L, E)
158
+ - `/clavix:deep [prompt]` - Full CLEAR framework analysis (C, L, E, A, R)
159
+ - `/clavix:prd` - Generate CLEAR-validated PRD
160
+ - `/clavix:plan` - Generate task breakdown from PRD
161
+ - `/clavix:implement` - Execute tasks with AI assistance
80
162
  - `/clavix:start` - Start conversational mode
81
- - `/clavix:summarize` - Analyze conversation
163
+ - `/clavix:summarize` - Extract and CLEAR-optimize from conversation
82
164
 
83
165
  ## Commands
84
166
 
@@ -153,6 +235,84 @@ Creates two files:
153
235
  - `full-prd.md` - Comprehensive document for team alignment
154
236
  - `quick-prd.md` - Condensed version for AI consumption
155
237
 
238
+ ### `clavix plan`
239
+
240
+ Generate implementation task breakdown from PRD.
241
+
242
+ ```bash
243
+ clavix plan
244
+ ```
245
+
246
+ **Features:**
247
+ - Analyzes PRD and generates `tasks.md` with CLEAR-optimized tasks
248
+ - Organizes tasks into logical phases/sections
249
+ - Creates markdown checkbox format for progress tracking
250
+ - Each task is atomic and independently implementable
251
+ - Tasks reference specific PRD sections for context
252
+
253
+ **Options:**
254
+ ```bash
255
+ clavix plan --project my-app # Specify PRD project
256
+ clavix plan --prd-path .clavix/outputs/my-project # Direct path
257
+ clavix plan --overwrite # Regenerate existing tasks.md
258
+ ```
259
+
260
+ **Output format:**
261
+ ```markdown
262
+ ## Phase 1: Authentication
263
+ - [ ] Implement user registration endpoint
264
+ - [ ] Add password hashing with bcrypt
265
+ - [ ] Create JWT token generation
266
+
267
+ ## Phase 2: Authorization
268
+ - [ ] Implement role-based access control
269
+ - [ ] Add middleware for protected routes
270
+ ```
271
+
272
+ ### `clavix implement`
273
+
274
+ Execute tasks from the implementation plan with AI assistance.
275
+
276
+ ```bash
277
+ clavix implement
278
+ ```
279
+
280
+ **Workflow:**
281
+ 1. Reads `tasks.md` and finds first incomplete task
282
+ 2. Shows current progress (completed/total)
283
+ 3. Prompts for git auto-commit preferences
284
+ 4. Creates configuration for AI agent
285
+ 5. AI agent implements tasks sequentially
286
+ 6. Marks completed tasks: `[ ]` → `[x]`
287
+ 7. Creates commits based on strategy
288
+ 8. Resumes from last checkpoint in new sessions
289
+
290
+ **Git Auto-Commit Strategies:**
291
+ - **Per phase** - Commit when all tasks in a phase complete
292
+ - **Per 5 tasks** - Commit after every 5 tasks
293
+ - **Per task** - Commit after each individual task
294
+ - **None** - Manual git management
295
+
296
+ **Options:**
297
+ ```bash
298
+ clavix implement --project my-app # Specify PRD project
299
+ clavix implement --no-git # Skip git setup
300
+ clavix implement --commit-strategy per-task # Set commit strategy
301
+ ```
302
+
303
+ **Example commit message:**
304
+ ```
305
+ clavix: Implement user authentication
306
+
307
+ Completed tasks:
308
+ - Implement user registration endpoint
309
+ - Add password hashing with bcrypt
310
+ - Create JWT token generation
311
+
312
+ Project: my-app
313
+ Generated by Clavix /clavix:implement
314
+ ```
315
+
156
316
  ### `clavix start`
157
317
 
158
318
  Enter conversational mode for iterative requirement gathering.
@@ -264,15 +424,23 @@ your-project/
264
424
  │ ├── INSTRUCTIONS.md # Usage guide
265
425
  │ ├── sessions/ # Conversational mode sessions
266
426
  │ ├── outputs/ # Generated PRDs and prompts
427
+ │ │ └── project-name/
428
+ │ │ ├── PRD.md # Full PRD
429
+ │ │ ├── PRD-quick.md # Quick PRD
430
+ │ │ ├── tasks.md # Implementation tasks
431
+ │ │ └── .clavix-implement-config.json # Implementation config
267
432
  │ └── templates/ # Custom templates (optional)
268
433
  ├── AGENTS.md # Updated with Clavix block
269
434
  ├── CLAUDE.md # Updated with Clavix block (if Claude Code)
270
435
  └── .claude/commands/ # Generated slash commands (if Claude Code)
271
- ├── clavix:fast.md
272
- ├── clavix:deep.md
273
- ├── clavix:prd.md
274
- ├── clavix:start.md
275
- └── clavix:summarize.md
436
+ ├── clavix/
437
+ ├── fast.md
438
+ ├── deep.md
439
+ ├── prd.md
440
+ │ ├── plan.md
441
+ │ ├── implement.md
442
+ │ ├── start.md
443
+ │ └── summarize.md
276
444
  ```
277
445
 
278
446
  ## Configuration
@@ -2,10 +2,16 @@ import { Command } from '@oclif/core';
2
2
  export default class Deep extends Command {
3
3
  static description: string;
4
4
  static examples: string[];
5
+ static flags: {
6
+ 'clear-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'framework-info': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
+ };
5
9
  static args: {
6
10
  prompt: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
11
  };
8
12
  run(): Promise<void>;
9
13
  private displayOutput;
14
+ private displayCLEAROnlyAnalysis;
15
+ private displayFrameworkInfo;
10
16
  }
11
17
  //# sourceMappingURL=deep.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAAqD;IAEvE,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB1B,OAAO,CAAC,aAAa;CAsHtB"}
1
+ {"version":3,"file":"deep.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AAInD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACvC,MAAM,CAAC,WAAW,SAAuH;IAEzI,MAAM,CAAC,QAAQ,WAGb;IAEF,MAAM,CAAC,KAAK;;;MASV;IAEF,MAAM,CAAC,IAAI;;MAKT;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC1B,OAAO,CAAC,aAAa;IAwIrB,OAAO,CAAC,wBAAwB;IA8EhC,OAAO,CAAC,oBAAoB;CAwD7B"}