@dedesfr/prompter 0.6.0 → 0.6.2

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 (90) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/cli/index.js +58 -2
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/api-contract-generator.d.ts +11 -0
  5. package/dist/commands/api-contract-generator.d.ts.map +1 -0
  6. package/dist/commands/api-contract-generator.js +97 -0
  7. package/dist/commands/api-contract-generator.js.map +1 -0
  8. package/dist/commands/document-explainer.d.ts +11 -0
  9. package/dist/commands/document-explainer.d.ts.map +1 -0
  10. package/dist/commands/document-explainer.js +97 -0
  11. package/dist/commands/document-explainer.js.map +1 -0
  12. package/dist/commands/erd-generator.d.ts +11 -0
  13. package/dist/commands/erd-generator.d.ts.map +1 -0
  14. package/dist/commands/erd-generator.js +97 -0
  15. package/dist/commands/erd-generator.js.map +1 -0
  16. package/dist/commands/fsd-generator.d.ts +11 -0
  17. package/dist/commands/fsd-generator.d.ts.map +1 -0
  18. package/dist/commands/fsd-generator.js +97 -0
  19. package/dist/commands/fsd-generator.js.map +1 -0
  20. package/dist/commands/tdd-generator.d.ts +11 -0
  21. package/dist/commands/tdd-generator.d.ts.map +1 -0
  22. package/dist/commands/tdd-generator.js +97 -0
  23. package/dist/commands/tdd-generator.js.map +1 -0
  24. package/dist/commands/tdd-lite-generator.d.ts +11 -0
  25. package/dist/commands/tdd-lite-generator.d.ts.map +1 -0
  26. package/dist/commands/tdd-lite-generator.js +97 -0
  27. package/dist/commands/tdd-lite-generator.js.map +1 -0
  28. package/dist/commands/wireframe-generator.d.ts +11 -0
  29. package/dist/commands/wireframe-generator.d.ts.map +1 -0
  30. package/dist/commands/wireframe-generator.js +97 -0
  31. package/dist/commands/wireframe-generator.js.map +1 -0
  32. package/dist/core/config.d.ts.map +1 -1
  33. package/dist/core/config.js +42 -0
  34. package/dist/core/config.js.map +1 -1
  35. package/dist/core/configurators/slash/antigravity.d.ts.map +1 -1
  36. package/dist/core/configurators/slash/antigravity.js +16 -2
  37. package/dist/core/configurators/slash/antigravity.js.map +1 -1
  38. package/dist/core/configurators/slash/base.js +1 -1
  39. package/dist/core/configurators/slash/base.js.map +1 -1
  40. package/dist/core/configurators/slash/claude.d.ts.map +1 -1
  41. package/dist/core/configurators/slash/claude.js +16 -2
  42. package/dist/core/configurators/slash/claude.js.map +1 -1
  43. package/dist/core/configurators/slash/codex.d.ts.map +1 -1
  44. package/dist/core/configurators/slash/codex.js +16 -2
  45. package/dist/core/configurators/slash/codex.js.map +1 -1
  46. package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -1
  47. package/dist/core/configurators/slash/github-copilot.js +16 -2
  48. package/dist/core/configurators/slash/github-copilot.js.map +1 -1
  49. package/dist/core/configurators/slash/kilocode.d.ts.map +1 -1
  50. package/dist/core/configurators/slash/kilocode.js +16 -2
  51. package/dist/core/configurators/slash/kilocode.js.map +1 -1
  52. package/dist/core/configurators/slash/opencode.d.ts.map +1 -1
  53. package/dist/core/configurators/slash/opencode.js +16 -2
  54. package/dist/core/configurators/slash/opencode.js.map +1 -1
  55. package/dist/core/prompt-templates.d.ts +7 -0
  56. package/dist/core/prompt-templates.d.ts.map +1 -1
  57. package/dist/core/prompt-templates.js +1429 -1
  58. package/dist/core/prompt-templates.js.map +1 -1
  59. package/dist/core/templates/slash-command-templates.d.ts +1 -1
  60. package/dist/core/templates/slash-command-templates.d.ts.map +1 -1
  61. package/dist/core/templates/slash-command-templates.js +9 -1
  62. package/dist/core/templates/slash-command-templates.js.map +1 -1
  63. package/docs/tasks.md +3 -0
  64. package/package.json +2 -2
  65. package/prompt/api-contract-generator.md +234 -0
  66. package/prompt/document-explainer.md +149 -0
  67. package/prompt/erd-generator.md +130 -0
  68. package/prompt/fsd-generator.md +157 -0
  69. package/prompt/tdd-generator.md +294 -0
  70. package/prompt/tdd-lite-generator.md +224 -0
  71. package/prompt/wireframe-generator.md +219 -0
  72. package/src/cli/index.ts +65 -2
  73. package/src/commands/api-contract-generator.ts +118 -0
  74. package/src/commands/document-explainer.ts +118 -0
  75. package/src/commands/erd-generator.ts +118 -0
  76. package/src/commands/fsd-generator.ts +118 -0
  77. package/src/commands/tdd-generator.ts +118 -0
  78. package/src/commands/tdd-lite-generator.ts +118 -0
  79. package/src/commands/wireframe-generator.ts +118 -0
  80. package/src/core/config.ts +42 -0
  81. package/src/core/configurators/slash/antigravity.ts +16 -2
  82. package/src/core/configurators/slash/base.ts +2 -2
  83. package/src/core/configurators/slash/claude.ts +16 -2
  84. package/src/core/configurators/slash/codex.ts +16 -2
  85. package/src/core/configurators/slash/github-copilot.ts +16 -2
  86. package/src/core/configurators/slash/kilocode.ts +16 -2
  87. package/src/core/configurators/slash/opencode.ts +16 -2
  88. package/src/core/prompt-templates.ts +1442 -8
  89. package/src/core/templates/slash-command-templates.ts +19 -2
  90. package/docs/prompt-template.md +0 -3
@@ -0,0 +1,219 @@
1
+ # UI/UX Wireframe Generation Prompt
2
+
3
+ # Role & Expertise
4
+ You are a Senior UI/UX Designer and Product Designer with 15+ years of experience creating wireframes for enterprise applications, SaaS platforms, and complex data-driven systems. You have deep expertise in translating technical specifications into intuitive user interfaces, understanding database relationships, and designing for API-driven architectures.
5
+
6
+ # Context
7
+ You will be provided with technical documentation that defines a product's requirements, data structure, and system capabilities. Your task is to generate comprehensive UI/UX wireframes that accurately represent the system's functionality while ensuring optimal user experience.
8
+
9
+ # Input Documents You Will Receive
10
+ 1. **Functional Specification Document (FSD)** - Defines features, user stories, business logic
11
+ 2. **Entity Relationship Diagram (ERD)** - Shows data models, relationships, cardinality
12
+ 3. **Product Requirements Document (PRD)** - Outlines product goals, user personas, success metrics
13
+ 4. **API Contract** - Specifies endpoints, request/response structures, available data
14
+
15
+ # Primary Objective
16
+ Generate detailed, annotated wireframes that:
17
+ - Accurately represent all specified functionality
18
+ - Reflect the underlying data model and relationships
19
+ - Support all API operations (CRUD, filters, pagination, etc.)
20
+ - Align with user personas and product goals
21
+ - Follow UX best practices and accessibility standards
22
+
23
+ # Systematic Process
24
+
25
+ ## Phase 1: Document Analysis
26
+ 1. **FSD Analysis**
27
+ - Extract all user stories and acceptance criteria
28
+ - Identify primary user flows and edge cases
29
+ - Map business rules that affect UI behavior
30
+ - Note validation requirements and error states
31
+
32
+ 2. **ERD Analysis**
33
+ - Identify all entities that require UI representation
34
+ - Map relationships (1:1, 1:N, M:N) to UI patterns
35
+ - Determine required form fields from entity attributes
36
+ - Identify lookup/reference data for dropdowns/selectors
37
+
38
+ 3. **PRD Analysis**
39
+ - Extract user personas and their primary goals
40
+ - Identify key user journeys and success metrics
41
+ - Note priority features vs. nice-to-haves
42
+ - Understand product positioning and tone
43
+
44
+ 4. **API Contract Analysis**
45
+ - Map endpoints to screens/components needed
46
+ - Identify filterable/sortable fields for list views
47
+ - Determine pagination approach from API structure
48
+ - Note response data available for display
49
+ - Identify required vs. optional fields from request schemas
50
+
51
+ ## Phase 2: Information Architecture
52
+ 1. Create sitemap/navigation structure
53
+ 2. Define screen inventory
54
+ 3. Map user flows between screens
55
+ 4. Identify shared components
56
+
57
+ ## Phase 3: Wireframe Generation
58
+ For each screen, produce:
59
+ - Low-fidelity wireframe layout
60
+ - Component specifications
61
+ - Interaction annotations
62
+ - State variations (empty, loading, error, success)
63
+ - Responsive behavior notes
64
+
65
+ # Output Format
66
+
67
+ ## For Each Screen/View, Provide:
68
+
69
+ ### [Screen Name]
70
+
71
+ **Purpose:** [What this screen accomplishes]
72
+
73
+ **User Story Reference:** [Link to relevant FSD user story]
74
+
75
+ **API Dependencies:**
76
+ - `GET /endpoint` - [What it provides]
77
+ - `POST /endpoint` - [What it submits]
78
+
79
+ **Wireframe Description:**
80
+
81
+ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
82
+ │ [Header/Navigation] │
83
+ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
84
+ │ │
85
+ │ [Main Content Area - describe layout] │
86
+ │ │
87
+ │ ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │
88
+ │ │ Component │ │ Component │ │ Component │ │
89
+ │ │ Description│ │ Description│ │ Description│ │
90
+ │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ │
91
+ │ │
92
+ │ [Secondary Content / Sidebar if applicable] │
93
+ │ │
94
+ ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
95
+ │ [Footer/Actions] │
96
+ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
97
+
98
+ **Component Specifications:**
99
+
100
+ | Component | Type | Data Source (ERD/API) | Behavior |
101
+ |-----------|------|----------------------|----------|
102
+ | [Name] | [Type] | [Field/Endpoint] | [Interaction] |
103
+
104
+ **Form Fields (if applicable):**
105
+
106
+ | Field | Type | Validation | ERD Attribute | API Field |
107
+ |-------|------|------------|---------------|-----------|
108
+ | [Name] | [Input type] | [Rules] | [Entity.attribute] | [request.field] |
109
+
110
+ **States:**
111
+ - **Empty State:** [Description + messaging]
112
+ - **Loading State:** [Skeleton/spinner approach]
113
+ - **Error State:** [Error display pattern]
114
+ - **Success State:** [Confirmation pattern]
115
+
116
+ **Annotations:**
117
+ 1. [Interaction note with numbered reference]
118
+ 2. [Accessibility consideration]
119
+ 3. [Edge case handling]
120
+
121
+ **Responsive Behavior:**
122
+ - Desktop (1200px+): [Layout]
123
+ - Tablet (768-1199px): [Adjustments]
124
+ - Mobile (<768px): [Mobile-specific layout]
125
+
126
+ ---
127
+
128
+ ## Complete Deliverables Structure
129
+
130
+ ### 1. Executive Summary
131
+ - Product overview
132
+ - Key user personas summary
133
+ - Primary user journeys identified
134
+ - Screen count and complexity assessment
135
+
136
+ ### 2. Information Architecture
137
+ - Sitemap diagram (ASCII or described)
138
+ - Navigation structure
139
+ - User flow diagrams
140
+
141
+ ### 3. Screen Inventory
142
+ | Screen | Priority | Complexity | Related Entities | Key APIs |
143
+ |--------|----------|------------|------------------|----------|
144
+
145
+ ### 4. Wireframes (per screen using format above)
146
+
147
+ ### 5. Component Library
148
+ - Reusable components identified
149
+ - Pattern specifications
150
+ - Usage guidelines
151
+
152
+ ### 6. Interaction Patterns
153
+ - Navigation patterns
154
+ - Form submission flows
155
+ - Error handling patterns
156
+ - Loading state patterns
157
+
158
+ ### 7. Data Display Patterns
159
+ - List/table views (based on ERD collections)
160
+ - Detail views (based on ERD entities)
161
+ - Relationship displays (based on ERD cardinality)
162
+
163
+ ### 8. Traceability Matrix
164
+ | User Story (FSD) | Screen | ERD Entities | API Endpoints |
165
+ |------------------|--------|--------------|---------------|
166
+
167
+ # Quality Standards
168
+
169
+ - [ ] Every FSD user story has corresponding UI representation
170
+ - [ ] All ERD entities with user-facing data have display screens
171
+ - [ ] All API endpoints are utilized in appropriate screens
172
+ - [ ] PRD user personas can complete their primary journeys
173
+ - [ ] Forms include all required fields from API contracts
174
+ - [ ] Validation rules from FSD/API are reflected in form specs
175
+ - [ ] Relationships from ERD are navigable in the UI
176
+ - [ ] Empty, loading, and error states defined for all data-dependent views
177
+ - [ ] Responsive behavior specified for all screens
178
+ - [ ] Accessibility considerations noted
179
+
180
+ # Special Instructions
181
+
182
+ 1. **Data Relationship Handling:**
183
+ - 1:1 relationships → Inline display or expandable sections
184
+ - 1:N relationships → List/table with detail view
185
+ - M:N relationships → Multi-select interfaces or tagging
186
+
187
+ 2. **API-Driven Patterns:**
188
+ - Pagination → Match API pagination style (offset/cursor)
189
+ - Filtering → Create filter UI for all filterable API params
190
+ - Sorting → Enable sort for all sortable API fields
191
+ - Search → Include if API supports search endpoints
192
+
193
+ 3. **Form Generation Logic:**
194
+ - Required API fields → Required form fields with validation
195
+ - Optional API fields → Optional with clear labeling
196
+ - Enum fields → Dropdown/radio based on option count
197
+ - Reference fields (FK) → Searchable dropdown with API lookup
198
+
199
+ 4. **Error Handling:**
200
+ - Map API error responses to user-friendly messages
201
+ - Include inline validation before submission
202
+ - Provide recovery paths for all error states
203
+
204
+ 5. **Maintain Traceability:**
205
+ - Reference specific FSD section numbers
206
+ - Note ERD entity names in component specs
207
+ - Include API endpoint paths in screen documentation
208
+
209
+ ---
210
+
211
+ # Begin Analysis
212
+
213
+ First, I will analyze each provided document systematically, then generate the complete wireframe documentation following this structure.
214
+
215
+ **Please provide:**
216
+ 1. Functional Specification Document (FSD)
217
+ 2. Entity Relationship Diagram (ERD)
218
+ 3. Product Requirements Document (PRD)
219
+ 4. API Contract/Specification
package/src/cli/index.ts CHANGED
@@ -4,19 +4,26 @@ import { UpdateCommand } from '../commands/update.js';
4
4
  import { ListCommand } from '../commands/list.js';
5
5
  import { GuideCommand } from '../commands/guide.js';
6
6
  import { UpgradeCommand } from '../commands/upgrade.js';
7
+ import { ApiContractGeneratorCommand } from '../commands/api-contract-generator.js';
8
+ import { ErdGeneratorCommand } from '../commands/erd-generator.js';
9
+ import { FsdGeneratorCommand } from '../commands/fsd-generator.js';
10
+ import { TddGeneratorCommand } from '../commands/tdd-generator.js';
11
+ import { TddLiteGeneratorCommand } from '../commands/tdd-lite-generator.js';
12
+ import { WireframeGeneratorCommand } from '../commands/wireframe-generator.js';
13
+ import { DocumentExplainerCommand } from '../commands/document-explainer.js';
7
14
 
8
15
  const program = new Command();
9
16
 
10
17
  program
11
18
  .name('prompter')
12
19
  .description('Enhance prompts directly in your AI coding workflow')
13
- .version('0.6.0');
20
+ .version('0.6.2');
14
21
 
15
22
  program
16
23
  .command('init')
17
24
  .description('Initialize Prompter in your project')
18
25
  .option('--tools <tools...>', 'Specify AI tools to configure (antigravity, claude, codex, github-copilot, opencode, kilocode)')
19
- .option('--prompts <prompts...>', 'Specify prompts to install (ai-humanizer, epic-single, prd-agent-generator, prd-generator, product-brief, qa-test-scenario, skill-creator, story-single)')
26
+ .option('--prompts <prompts...>', 'Specify prompts to install (ai-humanizer, api-contract-generator, document-explainer, epic-single, erd-generator, fsd-generator, prd-agent-generator, prd-generator, product-brief, qa-test-scenario, skill-creator, story-single, tdd-generator, tdd-lite-generator, wireframe-generator)')
20
27
  .option('--no-interactive', 'Run without interactive prompts')
21
28
  .action(async (options) => {
22
29
  const initCommand = new InitCommand();
@@ -56,4 +63,60 @@ program
56
63
  await upgradeCommand.execute();
57
64
  });
58
65
 
66
+ program
67
+ .command('api-contract-generator')
68
+ .description('Generate API Contract workflow files')
69
+ .action(async () => {
70
+ const command = new ApiContractGeneratorCommand();
71
+ await command.execute();
72
+ });
73
+
74
+ program
75
+ .command('erd-generator')
76
+ .description('Generate ERD workflow files')
77
+ .action(async () => {
78
+ const command = new ErdGeneratorCommand();
79
+ await command.execute();
80
+ });
81
+
82
+ program
83
+ .command('fsd-generator')
84
+ .description('Generate FSD workflow files')
85
+ .action(async () => {
86
+ const command = new FsdGeneratorCommand();
87
+ await command.execute();
88
+ });
89
+
90
+ program
91
+ .command('tdd-generator')
92
+ .description('Generate TDD workflow files')
93
+ .action(async () => {
94
+ const command = new TddGeneratorCommand();
95
+ await command.execute();
96
+ });
97
+
98
+ program
99
+ .command('tdd-lite-generator')
100
+ .description('Generate TDD-Lite workflow files')
101
+ .action(async () => {
102
+ const command = new TddLiteGeneratorCommand();
103
+ await command.execute();
104
+ });
105
+
106
+ program
107
+ .command('wireframe-generator')
108
+ .description('Generate Wireframe workflow files')
109
+ .action(async () => {
110
+ const command = new WireframeGeneratorCommand();
111
+ await command.execute();
112
+ });
113
+
114
+ program
115
+ .command('document-explainer')
116
+ .description('Generate Document Explainer workflow files')
117
+ .action(async () => {
118
+ const command = new DocumentExplainerCommand();
119
+ await command.execute();
120
+ });
121
+
59
122
  program.parse();
@@ -0,0 +1,118 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import { PrompterConfig, PROMPTER_DIR, PROMPTER_MARKERS } from '../core/config.js';
5
+ import { registry } from '../core/configurators/slash/index.js';
6
+
7
+ interface ApiContractGeneratorOptions {
8
+ tools?: string[];
9
+ noInteractive?: boolean;
10
+ }
11
+
12
+ export class ApiContractGeneratorCommand {
13
+ async execute(options: ApiContractGeneratorOptions = {}): Promise<void> {
14
+ const projectPath = process.cwd();
15
+
16
+ // Check if initialized
17
+ if (!await PrompterConfig.prompterDirExists(projectPath)) {
18
+ console.log(chalk.red('\nāŒ Prompter is not initialized in this project.\n'));
19
+ console.log(chalk.gray(' Run `prompter init` first.\n'));
20
+ process.exitCode = 1;
21
+ return;
22
+ }
23
+
24
+ console.log(chalk.blue('\nšŸ“ Generating API Contract Generator workflow files...\n'));
25
+
26
+ // Detect currently configured tools
27
+ const configuredTools = await this.detectConfiguredTools(projectPath);
28
+
29
+ if (configuredTools.length === 0) {
30
+ console.log(chalk.yellow('āš ļø No tools configured yet.\n'));
31
+ console.log(chalk.gray(' Run `prompter init` to configure AI tools first.\n'));
32
+ process.exitCode = 1;
33
+ return;
34
+ }
35
+
36
+ // Generate api-contract-generator workflow files for all configured tools
37
+ let successCount = 0;
38
+ let failCount = 0;
39
+
40
+ for (const toolId of configuredTools) {
41
+ const configurator = registry.get(toolId);
42
+ if (configurator) {
43
+ try {
44
+ // Generate only the api-contract-generator workflow file
45
+ const body = configurator['getBody']('api-contract-generator');
46
+ const relativePath = configurator['getRelativePath']('api-contract-generator');
47
+ const filePath = path.join(projectPath, relativePath);
48
+
49
+ // Ensure directory exists
50
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
51
+
52
+ // Check if file exists
53
+ const fileExists = await this.fileExists(filePath);
54
+
55
+ if (fileExists) {
56
+ console.log(chalk.yellow('āš ļø') + ` ${chalk.cyan(relativePath)} already exists, skipping`);
57
+ continue;
58
+ }
59
+
60
+ // Get frontmatter if needed
61
+ const frontmatter = configurator['getFrontmatter']('api-contract-generator');
62
+ const sections: string[] = [];
63
+ if (frontmatter) {
64
+ sections.push(frontmatter.trim());
65
+ }
66
+ sections.push(`${PROMPTER_MARKERS.start}\n${body}\n${PROMPTER_MARKERS.end}`);
67
+ const content = sections.join('\n') + '\n';
68
+
69
+ await fs.writeFile(filePath, content, 'utf-8');
70
+ console.log(chalk.green('āœ“') + ` Created ${chalk.cyan(relativePath)}`);
71
+ successCount++;
72
+ } catch (error) {
73
+ console.log(chalk.red('āœ—') + ` Failed to create files for ${toolId}: ${error}`);
74
+ failCount++;
75
+ }
76
+ }
77
+ }
78
+
79
+ // Success message
80
+ console.log(chalk.green(`\nāœ… API Contract Generator workflow files created successfully!\n`));
81
+ console.log(chalk.blue('Next steps:'));
82
+ console.log(chalk.gray(' 1. Use /api-contract-generator in your AI tool to create API contracts'));
83
+ console.log(chalk.gray(' 2. API contracts will be saved to prompter/<slug>/api-contract.md\n'));
84
+ }
85
+
86
+ private async fileExists(filePath: string): Promise<boolean> {
87
+ try {
88
+ await fs.access(filePath);
89
+ return true;
90
+ } catch {
91
+ return false;
92
+ }
93
+ }
94
+
95
+ private async detectConfiguredTools(projectPath: string): Promise<string[]> {
96
+ const configuredTools: string[] = [];
97
+ const allConfigurators = registry.getAll();
98
+
99
+ for (const configurator of allConfigurators) {
100
+ const targets = configurator.getTargets();
101
+ let hasFiles = false;
102
+
103
+ for (const target of targets) {
104
+ const filePath = path.join(projectPath, target.path);
105
+ if (await this.fileExists(filePath)) {
106
+ hasFiles = true;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (hasFiles) {
112
+ configuredTools.push(configurator.toolId);
113
+ }
114
+ }
115
+
116
+ return configuredTools;
117
+ }
118
+ }
@@ -0,0 +1,118 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import { PrompterConfig, PROMPTER_MARKERS } from '../core/config.js';
5
+ import { registry } from '../core/configurators/slash/index.js';
6
+
7
+ interface DocumentExplainerOptions {
8
+ tools?: string[];
9
+ noInteractive?: boolean;
10
+ }
11
+
12
+ export class DocumentExplainerCommand {
13
+ async execute(options: DocumentExplainerOptions = {}): Promise<void> {
14
+ const projectPath = process.cwd();
15
+
16
+ // Check if initialized
17
+ if (!await PrompterConfig.prompterDirExists(projectPath)) {
18
+ console.log(chalk.red('\nāŒ Prompter is not initialized in this project.\n'));
19
+ console.log(chalk.gray(' Run `prompter init` first.\n'));
20
+ process.exitCode = 1;
21
+ return;
22
+ }
23
+
24
+ console.log(chalk.blue('\nšŸ“– Generating document explainer workflow files...\n'));
25
+
26
+ // Detect currently configured tools
27
+ const configuredTools = await this.detectConfiguredTools(projectPath);
28
+
29
+ if (configuredTools.length === 0) {
30
+ console.log(chalk.yellow('āš ļø No tools configured yet.\n'));
31
+ console.log(chalk.gray(' Run `prompter init` to configure AI tools first.\n'));
32
+ process.exitCode = 1;
33
+ return;
34
+ }
35
+
36
+ // Generate document-explainer workflow files for all configured tools
37
+ let successCount = 0;
38
+ let failCount = 0;
39
+
40
+ for (const toolId of configuredTools) {
41
+ const configurator = registry.get(toolId);
42
+ if (configurator) {
43
+ try {
44
+ // Generate only the document-explainer workflow file
45
+ const body = configurator['getBody']('document-explainer');
46
+ const relativePath = configurator['getRelativePath']('document-explainer');
47
+ const filePath = path.join(projectPath, relativePath);
48
+
49
+ // Ensure directory exists
50
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
51
+
52
+ // Check if file exists
53
+ const fileExists = await this.fileExists(filePath);
54
+
55
+ if (fileExists) {
56
+ console.log(chalk.yellow('āš ļø') + ` ${chalk.cyan(relativePath)} already exists, skipping`);
57
+ continue;
58
+ }
59
+
60
+ // Get frontmatter if needed
61
+ const frontmatter = configurator['getFrontmatter']('document-explainer');
62
+ const sections: string[] = [];
63
+ if (frontmatter) {
64
+ sections.push(frontmatter.trim());
65
+ }
66
+ sections.push(`${PROMPTER_MARKERS.start}\n${body}\n${PROMPTER_MARKERS.end}`);
67
+ const content = sections.join('\n') + '\n';
68
+
69
+ await fs.writeFile(filePath, content, 'utf-8');
70
+ console.log(chalk.green('āœ“') + ` Created ${chalk.cyan(relativePath)}`);
71
+ successCount++;
72
+ } catch (error) {
73
+ console.log(chalk.red('āœ—') + ` Failed to create files for ${toolId}: ${error}`);
74
+ failCount++;
75
+ }
76
+ }
77
+ }
78
+
79
+ // Success message
80
+ console.log(chalk.green(`\nāœ… Document explainer workflow files created successfully!\n`));
81
+ console.log(chalk.blue('Next steps:'));
82
+ console.log(chalk.gray(' 1. Use /document-explainer in your AI tool to analyze complex documents'));
83
+ console.log(chalk.gray(' 2. Provide your document content to get a comprehensive breakdown and insights\n'));
84
+ }
85
+
86
+ private async fileExists(filePath: string): Promise<boolean> {
87
+ try {
88
+ await fs.access(filePath);
89
+ return true;
90
+ } catch {
91
+ return false;
92
+ }
93
+ }
94
+
95
+ private async detectConfiguredTools(projectPath: string): Promise<string[]> {
96
+ const configuredTools: string[] = [];
97
+ const allConfigurators = registry.getAll();
98
+
99
+ for (const configurator of allConfigurators) {
100
+ const targets = configurator.getTargets();
101
+ let hasFiles = false;
102
+
103
+ for (const target of targets) {
104
+ const filePath = path.join(projectPath, target.path);
105
+ if (await this.fileExists(filePath)) {
106
+ hasFiles = true;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (hasFiles) {
112
+ configuredTools.push(configurator.toolId);
113
+ }
114
+ }
115
+
116
+ return configuredTools;
117
+ }
118
+ }
@@ -0,0 +1,118 @@
1
+ import { promises as fs } from 'fs';
2
+ import path from 'path';
3
+ import chalk from 'chalk';
4
+ import { PrompterConfig, PROMPTER_DIR, PROMPTER_MARKERS } from '../core/config.js';
5
+ import { registry } from '../core/configurators/slash/index.js';
6
+
7
+ interface ErdGeneratorOptions {
8
+ tools?: string[];
9
+ noInteractive?: boolean;
10
+ }
11
+
12
+ export class ErdGeneratorCommand {
13
+ async execute(options: ErdGeneratorOptions = {}): Promise<void> {
14
+ const projectPath = process.cwd();
15
+
16
+ // Check if initialized
17
+ if (!await PrompterConfig.prompterDirExists(projectPath)) {
18
+ console.log(chalk.red('\nāŒ Prompter is not initialized in this project.\n'));
19
+ console.log(chalk.gray(' Run `prompter init` first.\n'));
20
+ process.exitCode = 1;
21
+ return;
22
+ }
23
+
24
+ console.log(chalk.blue('\nšŸ“ Generating ERD Generator workflow files...\n'));
25
+
26
+ // Detect currently configured tools
27
+ const configuredTools = await this.detectConfiguredTools(projectPath);
28
+
29
+ if (configuredTools.length === 0) {
30
+ console.log(chalk.yellow('āš ļø No tools configured yet.\n'));
31
+ console.log(chalk.gray(' Run `prompter init` to configure AI tools first.\n'));
32
+ process.exitCode = 1;
33
+ return;
34
+ }
35
+
36
+ // Generate erd-generator workflow files for all configured tools
37
+ let successCount = 0;
38
+ let failCount = 0;
39
+
40
+ for (const toolId of configuredTools) {
41
+ const configurator = registry.get(toolId);
42
+ if (configurator) {
43
+ try {
44
+ // Generate only the erd-generator workflow file
45
+ const body = configurator['getBody']('erd-generator');
46
+ const relativePath = configurator['getRelativePath']('erd-generator');
47
+ const filePath = path.join(projectPath, relativePath);
48
+
49
+ // Ensure directory exists
50
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
51
+
52
+ // Check if file exists
53
+ const fileExists = await this.fileExists(filePath);
54
+
55
+ if (fileExists) {
56
+ console.log(chalk.yellow('āš ļø') + ` ${chalk.cyan(relativePath)} already exists, skipping`);
57
+ continue;
58
+ }
59
+
60
+ // Get frontmatter if needed
61
+ const frontmatter = configurator['getFrontmatter']('erd-generator');
62
+ const sections: string[] = [];
63
+ if (frontmatter) {
64
+ sections.push(frontmatter.trim());
65
+ }
66
+ sections.push(`${PROMPTER_MARKERS.start}\n${body}\n${PROMPTER_MARKERS.end}`);
67
+ const content = sections.join('\n') + '\n';
68
+
69
+ await fs.writeFile(filePath, content, 'utf-8');
70
+ console.log(chalk.green('āœ“') + ` Created ${chalk.cyan(relativePath)}`);
71
+ successCount++;
72
+ } catch (error) {
73
+ console.log(chalk.red('āœ—') + ` Failed to create files for ${toolId}: ${error}`);
74
+ failCount++;
75
+ }
76
+ }
77
+ }
78
+
79
+ // Success message
80
+ console.log(chalk.green(`\nāœ… ERD Generator workflow files created successfully!\n`));
81
+ console.log(chalk.blue('Next steps:'));
82
+ console.log(chalk.gray(' 1. Use /erd-generator in your AI tool to create ERDs'));
83
+ console.log(chalk.gray(' 2. ERDs will be saved to prompter/<slug>/erd.md\n'));
84
+ }
85
+
86
+ private async fileExists(filePath: string): Promise<boolean> {
87
+ try {
88
+ await fs.access(filePath);
89
+ return true;
90
+ } catch {
91
+ return false;
92
+ }
93
+ }
94
+
95
+ private async detectConfiguredTools(projectPath: string): Promise<string[]> {
96
+ const configuredTools: string[] = [];
97
+ const allConfigurators = registry.getAll();
98
+
99
+ for (const configurator of allConfigurators) {
100
+ const targets = configurator.getTargets();
101
+ let hasFiles = false;
102
+
103
+ for (const target of targets) {
104
+ const filePath = path.join(projectPath, target.path);
105
+ if (await this.fileExists(filePath)) {
106
+ hasFiles = true;
107
+ break;
108
+ }
109
+ }
110
+
111
+ if (hasFiles) {
112
+ configuredTools.push(configurator.toolId);
113
+ }
114
+ }
115
+
116
+ return configuredTools;
117
+ }
118
+ }