clavix 1.1.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 (103) hide show
  1. package/README.md +422 -0
  2. package/bin/clavix.js +8 -0
  3. package/dist/cli/commands/config.d.ts +28 -0
  4. package/dist/cli/commands/config.d.ts.map +1 -0
  5. package/dist/cli/commands/config.js +319 -0
  6. package/dist/cli/commands/config.js.map +1 -0
  7. package/dist/cli/commands/deep.d.ts +11 -0
  8. package/dist/cli/commands/deep.d.ts.map +1 -0
  9. package/dist/cli/commands/deep.js +133 -0
  10. package/dist/cli/commands/deep.js.map +1 -0
  11. package/dist/cli/commands/fast.d.ts +12 -0
  12. package/dist/cli/commands/fast.d.ts.map +1 -0
  13. package/dist/cli/commands/fast.js +166 -0
  14. package/dist/cli/commands/fast.js.map +1 -0
  15. package/dist/cli/commands/init.d.ts +14 -0
  16. package/dist/cli/commands/init.d.ts.map +1 -0
  17. package/dist/cli/commands/init.js +240 -0
  18. package/dist/cli/commands/init.js.map +1 -0
  19. package/dist/cli/commands/list.d.ts +15 -0
  20. package/dist/cli/commands/list.d.ts.map +1 -0
  21. package/dist/cli/commands/list.js +195 -0
  22. package/dist/cli/commands/list.js.map +1 -0
  23. package/dist/cli/commands/prd.d.ts +12 -0
  24. package/dist/cli/commands/prd.d.ts.map +1 -0
  25. package/dist/cli/commands/prd.js +185 -0
  26. package/dist/cli/commands/prd.js.map +1 -0
  27. package/dist/cli/commands/show.d.ts +21 -0
  28. package/dist/cli/commands/show.d.ts.map +1 -0
  29. package/dist/cli/commands/show.js +230 -0
  30. package/dist/cli/commands/show.js.map +1 -0
  31. package/dist/cli/commands/start.d.ts +40 -0
  32. package/dist/cli/commands/start.d.ts.map +1 -0
  33. package/dist/cli/commands/start.js +253 -0
  34. package/dist/cli/commands/start.js.map +1 -0
  35. package/dist/cli/commands/summarize.d.ts +22 -0
  36. package/dist/cli/commands/summarize.d.ts.map +1 -0
  37. package/dist/cli/commands/summarize.js +208 -0
  38. package/dist/cli/commands/summarize.js.map +1 -0
  39. package/dist/cli/commands/update.d.ts +17 -0
  40. package/dist/cli/commands/update.d.ts.map +1 -0
  41. package/dist/cli/commands/update.js +239 -0
  42. package/dist/cli/commands/update.js.map +1 -0
  43. package/dist/cli/commands/version.d.ts +7 -0
  44. package/dist/cli/commands/version.d.ts.map +1 -0
  45. package/dist/cli/commands/version.js +58 -0
  46. package/dist/cli/commands/version.js.map +1 -0
  47. package/dist/core/adapters/claude-code-adapter.d.ts +33 -0
  48. package/dist/core/adapters/claude-code-adapter.d.ts.map +1 -0
  49. package/dist/core/adapters/claude-code-adapter.js +130 -0
  50. package/dist/core/adapters/claude-code-adapter.js.map +1 -0
  51. package/dist/core/agent-manager.d.ts +37 -0
  52. package/dist/core/agent-manager.d.ts.map +1 -0
  53. package/dist/core/agent-manager.js +69 -0
  54. package/dist/core/agent-manager.js.map +1 -0
  55. package/dist/core/conversation-analyzer.d.ts +86 -0
  56. package/dist/core/conversation-analyzer.d.ts.map +1 -0
  57. package/dist/core/conversation-analyzer.js +391 -0
  58. package/dist/core/conversation-analyzer.js.map +1 -0
  59. package/dist/core/doc-injector.d.ts +51 -0
  60. package/dist/core/doc-injector.d.ts.map +1 -0
  61. package/dist/core/doc-injector.js +236 -0
  62. package/dist/core/doc-injector.js.map +1 -0
  63. package/dist/core/prd-generator.d.ts +76 -0
  64. package/dist/core/prd-generator.d.ts.map +1 -0
  65. package/dist/core/prd-generator.js +211 -0
  66. package/dist/core/prd-generator.js.map +1 -0
  67. package/dist/core/prompt-optimizer.d.ts +144 -0
  68. package/dist/core/prompt-optimizer.d.ts.map +1 -0
  69. package/dist/core/prompt-optimizer.js +431 -0
  70. package/dist/core/prompt-optimizer.js.map +1 -0
  71. package/dist/core/question-engine.d.ts +167 -0
  72. package/dist/core/question-engine.d.ts.map +1 -0
  73. package/dist/core/question-engine.js +395 -0
  74. package/dist/core/question-engine.js.map +1 -0
  75. package/dist/core/session-manager.d.ts +139 -0
  76. package/dist/core/session-manager.d.ts.map +1 -0
  77. package/dist/core/session-manager.js +402 -0
  78. package/dist/core/session-manager.js.map +1 -0
  79. package/dist/index.d.ts +3 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +16 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/types/agent.d.ts +24 -0
  84. package/dist/types/agent.d.ts.map +1 -0
  85. package/dist/types/agent.js +6 -0
  86. package/dist/types/agent.js.map +1 -0
  87. package/dist/types/config.d.ts +27 -0
  88. package/dist/types/config.d.ts.map +1 -0
  89. package/dist/types/config.js +25 -0
  90. package/dist/types/config.js.map +1 -0
  91. package/dist/types/errors.d.ts +21 -0
  92. package/dist/types/errors.d.ts.map +1 -0
  93. package/dist/types/errors.js +45 -0
  94. package/dist/types/errors.js.map +1 -0
  95. package/dist/types/session.d.ts +78 -0
  96. package/dist/types/session.d.ts.map +1 -0
  97. package/dist/types/session.js +9 -0
  98. package/dist/types/session.js.map +1 -0
  99. package/dist/utils/file-system.d.ts +50 -0
  100. package/dist/utils/file-system.d.ts.map +1 -0
  101. package/dist/utils/file-system.js +232 -0
  102. package/dist/utils/file-system.js.map +1 -0
  103. package/package.json +87 -0
package/README.md ADDED
@@ -0,0 +1,422 @@
1
+ # Clavix
2
+
3
+ > AI prompt improvement and PRD generation CLI tool for developers
4
+
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.
6
+
7
+ ## Why Clavix?
8
+
9
+ AI-assisted development tools produce better code when given better prompts. However, developers often struggle to write comprehensive, structured prompts that clearly communicate requirements, constraints, and success criteria. Clavix solves this by:
10
+
11
+ - **Analyzing prompts** to identify gaps, ambiguities, and missing details
12
+ - **Generating structured PRDs** through guided Socratic questioning
13
+ - **Integrating seamlessly** with your AI development workflow
14
+ - **Working offline** - no API calls, fully local operation
15
+
16
+ ## Features
17
+
18
+ ### Phase 1 (MVP) ✅ Complete
19
+
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
25
+
26
+ ### Phase 2 (Core Workflows) ✅ Complete
27
+
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
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ npm install -g clavix
38
+ ```
39
+
40
+ ## Quick Start
41
+
42
+ ### 1. Initialize in Your Project
43
+
44
+ ```bash
45
+ cd your-project
46
+ clavix init
47
+ ```
48
+
49
+ This will:
50
+ - Create `.clavix/` directory with configuration
51
+ - Generate slash commands for your AI agent
52
+ - Inject managed blocks into AGENTS.md and CLAUDE.md
53
+
54
+ ### 2. Improve a Prompt
55
+
56
+ **Fast mode** (quick improvements):
57
+ ```bash
58
+ clavix fast "Create a login page"
59
+ ```
60
+
61
+ **Deep mode** (comprehensive analysis):
62
+ ```bash
63
+ clavix deep "Create a login page"
64
+ ```
65
+
66
+ 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)
72
+
73
+ ### 3. Use Slash Commands (Claude Code)
74
+
75
+ After initialization, use these commands in Claude Code:
76
+
77
+ - `/clavix:fast [prompt]` - Quick prompt improvements
78
+ - `/clavix:deep [prompt]` - Comprehensive prompt analysis
79
+ - `/clavix:prd` - Generate a PRD
80
+ - `/clavix:start` - Start conversational mode
81
+ - `/clavix:summarize` - Analyze conversation
82
+
83
+ ## Commands
84
+
85
+ ### `clavix init`
86
+
87
+ Initialize Clavix in the current project.
88
+
89
+ ```bash
90
+ clavix init
91
+ ```
92
+
93
+ Interactive prompts guide you through:
94
+ - Agent selection (Claude Code, more coming soon)
95
+ - Directory structure creation
96
+ - Slash command generation
97
+ - Documentation injection
98
+
99
+ ### `clavix fast <prompt>`
100
+
101
+ Quick prompt improvements with smart triage.
102
+
103
+ ```bash
104
+ clavix fast "Build an API for user management"
105
+ ```
106
+
107
+ **Features:**
108
+ - Fast analysis of gaps, ambiguities, strengths
109
+ - Smart triage: recommends deep mode for complex prompts
110
+ - "Already good" assessment for quality prompts
111
+ - Changes made summary (educational)
112
+ - Single structured improved prompt
113
+
114
+ **Smart triage checks:**
115
+ - Prompts < 20 characters
116
+ - Missing 3+ critical elements
117
+ - Vague scope words without context
118
+
119
+ ### `clavix deep <prompt>`
120
+
121
+ Comprehensive prompt analysis.
122
+
123
+ ```bash
124
+ clavix deep "Build an API for user management"
125
+ ```
126
+
127
+ **Everything from fast mode PLUS:**
128
+ - Alternative phrasings of requirements
129
+ - Edge cases in requirements
130
+ - Good/bad implementation examples
131
+ - Multiple prompt structuring approaches
132
+ - "What could go wrong" analysis
133
+ - More thorough clarifying questions
134
+
135
+ **Output:**
136
+ - Structured prompt with sections:
137
+ - Objective
138
+ - Requirements
139
+ - Technical Constraints
140
+ - Expected Output
141
+ - Success Criteria
142
+ - Plus all deep mode analysis sections
143
+
144
+ ### `clavix prd`
145
+
146
+ Generate a comprehensive PRD through guided Socratic questioning.
147
+
148
+ ```bash
149
+ clavix prd
150
+ ```
151
+
152
+ Creates two files:
153
+ - `full-prd.md` - Comprehensive document for team alignment
154
+ - `quick-prd.md` - Condensed version for AI consumption
155
+
156
+ ### `clavix start`
157
+
158
+ Enter conversational mode for iterative requirement gathering.
159
+
160
+ ```bash
161
+ clavix start
162
+ ```
163
+
164
+ Start a natural conversation to develop requirements. Use `/clavix:summarize` later to extract structured output.
165
+
166
+ ### `clavix summarize [session-id]`
167
+
168
+ Analyze a conversation and extract requirements.
169
+
170
+ ```bash
171
+ # Summarize current session
172
+ clavix summarize
173
+
174
+ # Summarize specific session
175
+ clavix summarize abc-123-def
176
+ ```
177
+
178
+ Generates:
179
+ - `mini-prd.md` - Concise requirements
180
+ - `optimized-prompt.md` - AI-ready prompt
181
+
182
+ ### `clavix list`
183
+
184
+ List all sessions and outputs.
185
+
186
+ ```bash
187
+ # List everything
188
+ clavix list
189
+
190
+ # List only sessions
191
+ clavix list --sessions
192
+
193
+ # Filter by project
194
+ clavix list --project auth
195
+ ```
196
+
197
+ ### `clavix show [session-id]`
198
+
199
+ Show detailed session information.
200
+
201
+ ```bash
202
+ # Show most recent session
203
+ clavix show
204
+
205
+ # Show specific session with full history
206
+ clavix show abc-123-def --full
207
+
208
+ # Show output directory
209
+ clavix show --output project-name
210
+ ```
211
+
212
+ ### `clavix config`
213
+
214
+ Manage configuration.
215
+
216
+ ```bash
217
+ # Interactive menu
218
+ clavix config
219
+
220
+ # Get/set values
221
+ clavix config get agent
222
+ clavix config set preferences.verboseLogging true
223
+ ```
224
+
225
+ ### `clavix update`
226
+
227
+ Update managed blocks and slash commands.
228
+
229
+ ```bash
230
+ # Update everything
231
+ clavix update
232
+
233
+ # Update specific components
234
+ clavix update --docs-only
235
+ clavix update --commands-only
236
+ ```
237
+
238
+ ### `clavix version`
239
+
240
+ Display the current version of Clavix.
241
+
242
+ ```bash
243
+ clavix version
244
+ ```
245
+
246
+ ### `clavix --help`
247
+
248
+ Display help information for all commands.
249
+
250
+ ```bash
251
+ clavix --help
252
+ clavix improve --help
253
+ ```
254
+
255
+ ## Project Structure
256
+
257
+ After initialization, your project will have:
258
+
259
+ ```
260
+ your-project/
261
+ ├── .clavix/
262
+ │ ├── config.json # Clavix configuration
263
+ │ ├── INSTRUCTIONS.md # Usage guide
264
+ │ ├── sessions/ # Conversational mode sessions
265
+ │ ├── outputs/ # Generated PRDs and prompts
266
+ │ └── templates/ # Custom templates (optional)
267
+ ├── AGENTS.md # Updated with Clavix block
268
+ ├── CLAUDE.md # Updated with Clavix block (if Claude Code)
269
+ └── .claude/commands/ # Generated slash commands (if Claude Code)
270
+ ├── clavix:fast.md
271
+ ├── clavix:deep.md
272
+ ├── clavix:prd.md
273
+ ├── clavix:start.md
274
+ └── clavix:summarize.md
275
+ ```
276
+
277
+ ## Configuration
278
+
279
+ Clavix stores configuration in `.clavix/config.json`:
280
+
281
+ ```json5
282
+ {
283
+ version: "1.0.0",
284
+ agent: "claude-code",
285
+ templates: {
286
+ prdQuestions: "default",
287
+ fullPrd: "default",
288
+ quickPrd: "default"
289
+ },
290
+ outputs: {
291
+ path: ".clavix/outputs",
292
+ format: "markdown"
293
+ },
294
+ preferences: {
295
+ autoOpenOutputs: false,
296
+ verboseLogging: false,
297
+ preserveSessions: true
298
+ }
299
+ }
300
+ ```
301
+
302
+ ## Customization
303
+
304
+ ### Custom Templates
305
+
306
+ Override default templates by adding files to `.clavix/templates/`:
307
+
308
+ - `prd-questions.md` - Custom PRD questions
309
+ - `full-prd-template.hbs` - Full PRD format
310
+ - `quick-prd-template.hbs` - Quick PRD format
311
+
312
+ Templates use Handlebars syntax.
313
+
314
+ ## Examples
315
+
316
+ ### Example 1: Minimal to Comprehensive
317
+
318
+ **Original:**
319
+ ```
320
+ Create a login page
321
+ ```
322
+
323
+ **Improved:**
324
+ ```markdown
325
+ # Objective
326
+ Build a secure user authentication login page
327
+
328
+ # Requirements
329
+ - Email and password input fields with validation
330
+ - "Remember me" checkbox
331
+ - "Forgot password" link
332
+ - Show clear error messages for invalid credentials
333
+ - Responsive design for mobile and desktop
334
+
335
+ # Technical Constraints
336
+ - Use React with TypeScript
337
+ - Integrate with existing JWT authentication API
338
+ - Follow WCAG 2.1 AA accessibility standards
339
+ - Support password managers
340
+
341
+ # Expected Output
342
+ - Fully functional login component
343
+ - Unit tests with >80% coverage
344
+ - Integration with auth context
345
+
346
+ # Success Criteria
347
+ - Users can log in successfully
348
+ - Invalid credentials show appropriate errors
349
+ - Page is accessible via keyboard navigation
350
+ - Loads in < 2 seconds
351
+ ```
352
+
353
+ ### Example 2: Slash Command Usage
354
+
355
+ In Claude Code:
356
+
357
+ ```
358
+ /clavix:fast Create a dashboard for analytics
359
+ ```
360
+
361
+ Claude will:
362
+ 1. Analyze your prompt
363
+ 2. Check if deep analysis is needed (smart triage)
364
+ 3. Identify gaps, ambiguities, and strengths
365
+ 4. Show changes made summary
366
+ 5. Generate a structured, improved prompt
367
+ 6. Display it ready for immediate use
368
+
369
+ For comprehensive analysis:
370
+
371
+ ```
372
+ /clavix:deep Create a dashboard for analytics
373
+ ```
374
+
375
+ Provides all fast mode features plus alternative phrasings, edge cases, implementation examples, and more.
376
+
377
+ ### Example 3: When to Use Which Mode
378
+
379
+ **Use Fast Mode when:**
380
+ - You have a simple, straightforward prompt
381
+ - You need quick cleanup and structure
382
+ - Time is a priority
383
+
384
+ **Use Deep Mode when:**
385
+ - Requirements are complex or ambiguous
386
+ - You want to explore alternative approaches
387
+ - You need to think through edge cases
388
+ - You're planning a significant feature
389
+
390
+ **Use PRD Mode when:**
391
+ - You need strategic planning
392
+ - Architecture decisions are required
393
+ - Business impact and scalability matter
394
+
395
+ ## Roadmap
396
+
397
+ - [x] Phase 1: MVP (CLI, prompt improvement, Claude Code integration)
398
+ - [x] Phase 2: Core workflows (PRD generation, conversational mode, sessions, config management)
399
+ - [ ] Phase 3: Advanced features (team collaboration, more agents, AI-powered analysis, PDF export)
400
+
401
+ ## Requirements
402
+
403
+ - Node.js >= 18.0.0
404
+ - npm or yarn
405
+
406
+ ## Contributing
407
+
408
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
409
+
410
+ ## License
411
+
412
+ MIT
413
+
414
+ ## Links
415
+
416
+ - [GitHub Repository](https://github.com/Bob5k/Clavix)
417
+ - [Issue Tracker](https://github.com/Bob5k/Clavix/issues)
418
+ - [Changelog](CHANGELOG.md)
419
+
420
+ ---
421
+
422
+ **Made for vibecoders, by vibecoders** 🚀
package/bin/clavix.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/index.js')
4
+ .run()
5
+ .catch((error) => {
6
+ console.error(error);
7
+ process.exit(1);
8
+ });
@@ -0,0 +1,28 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Config extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ action: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
7
+ key: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
8
+ value: import("@oclif/core/lib/interfaces").Arg<string | undefined, Record<string, unknown>>;
9
+ };
10
+ static flags: {
11
+ global: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ };
13
+ run(): Promise<void>;
14
+ private showInteractiveMenu;
15
+ private getConfig;
16
+ private setConfig;
17
+ private editConfig;
18
+ private resetConfig;
19
+ private changeAgent;
20
+ private editPreferences;
21
+ private loadConfig;
22
+ private saveConfig;
23
+ private displayConfig;
24
+ private getNestedValue;
25
+ private setNestedValue;
26
+ private getDefaultConfig;
27
+ }
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AA2BnD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAO;IACzC,MAAM,CAAC,WAAW,SAAiC;IAEnD,MAAM,CAAC,QAAQ,WAKb;IAEF,MAAM,CAAC,IAAI;;;;MAcT;IAEF,MAAM,CAAC,KAAK;;MAMV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YA4CZ,mBAAmB;YAuCnB,SAAS;YAkBT,SAAS;YAqBT,UAAU;YAKV,WAAW;YAsBX,WAAW;YAiCX,eAAe;IA8B7B,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,gBAAgB;CAqBzB"}