@dedesfr/prompter 0.8.23 → 1.0.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/CHANGELOG.md +70 -0
- package/README.md +105 -77
- package/dist/cli/index.js +25 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -7
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +60 -299
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts +4 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +56 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +4 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +14 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +31 -41
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/whoami.d.ts +4 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +42 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/core/auth-store.d.ts +10 -0
- package/dist/core/auth-store.d.ts.map +1 -0
- package/dist/core/auth-store.js +39 -0
- package/dist/core/auth-store.js.map +1 -0
- package/dist/core/configurators/slash/antigravity.d.ts +2 -5
- package/dist/core/configurators/slash/antigravity.d.ts.map +1 -1
- package/dist/core/configurators/slash/antigravity.js +2 -57
- package/dist/core/configurators/slash/antigravity.js.map +1 -1
- package/dist/core/configurators/slash/base.d.ts +6 -18
- package/dist/core/configurators/slash/base.d.ts.map +1 -1
- package/dist/core/configurators/slash/base.js +8 -77
- package/dist/core/configurators/slash/base.js.map +1 -1
- package/dist/core/configurators/slash/claude.d.ts +2 -5
- package/dist/core/configurators/slash/claude.d.ts.map +1 -1
- package/dist/core/configurators/slash/claude.js +2 -57
- package/dist/core/configurators/slash/claude.js.map +1 -1
- package/dist/core/configurators/slash/codex.d.ts +2 -5
- package/dist/core/configurators/slash/codex.d.ts.map +1 -1
- package/dist/core/configurators/slash/codex.js +2 -57
- package/dist/core/configurators/slash/codex.js.map +1 -1
- package/dist/core/configurators/slash/droid.d.ts +2 -5
- package/dist/core/configurators/slash/droid.d.ts.map +1 -1
- package/dist/core/configurators/slash/droid.js +2 -32
- package/dist/core/configurators/slash/droid.js.map +1 -1
- package/dist/core/configurators/slash/forge.d.ts +2 -5
- package/dist/core/configurators/slash/forge.d.ts.map +1 -1
- package/dist/core/configurators/slash/forge.js +2 -32
- package/dist/core/configurators/slash/forge.js.map +1 -1
- package/dist/core/configurators/slash/github-copilot.d.ts +2 -7
- package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -1
- package/dist/core/configurators/slash/github-copilot.js +2 -96
- package/dist/core/configurators/slash/github-copilot.js.map +1 -1
- package/dist/core/configurators/slash/index.d.ts +1 -1
- package/dist/core/configurators/slash/index.d.ts.map +1 -1
- package/dist/core/configurators/slash/index.js +1 -1
- package/dist/core/configurators/slash/index.js.map +1 -1
- package/dist/core/configurators/slash/kilocode.d.ts +2 -5
- package/dist/core/configurators/slash/kilocode.d.ts.map +1 -1
- package/dist/core/configurators/slash/kilocode.js +2 -57
- package/dist/core/configurators/slash/kilocode.js.map +1 -1
- package/dist/core/configurators/slash/opencode.d.ts +2 -5
- package/dist/core/configurators/slash/opencode.d.ts.map +1 -1
- package/dist/core/configurators/slash/opencode.js +2 -57
- package/dist/core/configurators/slash/opencode.js.map +1 -1
- package/dist/core/configurators/slash/registry.d.ts +4 -4
- package/dist/core/configurators/slash/registry.d.ts.map +1 -1
- package/dist/core/configurators/slash/registry.js.map +1 -1
- package/dist/core/registry.d.ts +18 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +94 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/templates/index.d.ts +0 -1
- package/dist/core/templates/index.d.ts.map +1 -1
- package/dist/core/templates/index.js +0 -1
- package/dist/core/templates/index.js.map +1 -1
- package/package.json +7 -1
- package/AGENTS.md +0 -123
- package/CLAUDE.md +0 -17
- package/build.js +0 -20
- package/convex-setup.md +0 -403
- package/dist/core/templates/slash-command-templates.d.ts +0 -7
- package/dist/core/templates/slash-command-templates.d.ts.map +0 -1
- package/dist/core/templates/slash-command-templates.js +0 -1041
- package/dist/core/templates/slash-command-templates.js.map +0 -1
- package/prompt/ai-humanizer.md +0 -45
- package/prompt/api-contract-generator.md +0 -234
- package/prompt/apply.md +0 -17
- package/prompt/archive.md +0 -21
- package/prompt/design-system.md +0 -210
- package/prompt/document-explainer.md +0 -149
- package/prompt/epic-generator.md +0 -198
- package/prompt/epic-single.md +0 -47
- package/prompt/erd-generator.md +0 -130
- package/prompt/fsd-generator.md +0 -157
- package/prompt/prd-agent-generator.md +0 -147
- package/prompt/prd-generator.md +0 -195
- package/prompt/product-brief.md +0 -289
- package/prompt/proposal.md +0 -22
- package/prompt/qa-test-scenario.md +0 -133
- package/prompt/skill-creator.md +0 -350
- package/prompt/story-generator.md +0 -278
- package/prompt/story-single.md +0 -70
- package/prompt/tdd-generator.md +0 -294
- package/prompt/tdd-lite-generator.md +0 -224
- package/prompt/wireframe-generator.md +0 -219
- package/skills/ai-context-generator/SKILL.md +0 -54
- package/skills/ai-context-generator/references/AGENTS.template.md +0 -83
- package/skills/ai-context-generator/references/CLAUDE.template.md +0 -39
- package/skills/ai-context-generator/references/behavioral-guidelines.md +0 -71
- package/skills/ai-context-generator/references/discovery-checklist.md +0 -40
- package/skills/ai-context-generator/references/examples/AGENTS.good.md +0 -103
- package/skills/ai-context-generator/references/extraction-checklist.md +0 -23
- package/skills/ai-context-generator/references/overlays/laravel.md +0 -44
- package/skills/cerebro/SKILL.md +0 -187
- package/skills/cerebro/references/agents.md +0 -213
- package/skills/code-review/SKILL.md +0 -373
- package/skills/code-review/assets/report-template-agent.md +0 -212
- package/skills/code-review/assets/report-template-compact.md +0 -81
- package/skills/code-review/assets/report-template-full.md +0 -264
- package/skills/code-review/assets/report-template-human.md +0 -168
- package/skills/code-review/references/universal-patterns.md +0 -495
- package/skills/design-md/README.md +0 -34
- package/skills/design-md/SKILL.md +0 -172
- package/skills/design-md/examples/DESIGN.md +0 -154
- package/skills/design-system-generator/SKILL.md +0 -324
- package/skills/design-system-generator/assets/design-system-template.md +0 -348
- package/skills/design-system-generator/references/extraction-patterns.md +0 -321
- package/skills/doc-builder/SKILL.md +0 -115
- package/skills/doc-builder/references/ui-patterns.md +0 -394
- package/skills/document-translator/SKILL.md +0 -58
- package/skills/enhance-prompt/README.md +0 -34
- package/skills/enhance-prompt/SKILL.md +0 -204
- package/skills/enhance-prompt/references/KEYWORDS.md +0 -114
- package/skills/feature-planner/SKILL.md +0 -305
- package/skills/feature-planner/assets/implementation-plan-template.md +0 -85
- package/skills/frontend-design/LICENSE.txt +0 -177
- package/skills/frontend-design/SKILL.md +0 -42
- package/skills/gamma-builder/SKILL.md +0 -134
- package/skills/laravel-code-review/SKILL.md +0 -383
- package/skills/laravel-code-review/assets/report-template-agent.md +0 -195
- package/skills/laravel-code-review/assets/report-template-compact.md +0 -79
- package/skills/laravel-code-review/assets/report-template-full.md +0 -253
- package/skills/laravel-code-review/assets/report-template-human.md +0 -159
- package/skills/laravel-code-review/references/laravel-patterns.md +0 -571
- package/skills/laravel-code-review/references/php84-features.md +0 -442
- package/skills/mcp-builder/LICENSE.txt +0 -202
- package/skills/mcp-builder/SKILL.md +0 -236
- package/skills/mcp-builder/reference/evaluation.md +0 -602
- package/skills/mcp-builder/reference/mcp_best_practices.md +0 -249
- package/skills/mcp-builder/reference/node_mcp_server.md +0 -970
- package/skills/mcp-builder/reference/python_mcp_server.md +0 -719
- package/skills/mcp-builder/scripts/connections.py +0 -151
- package/skills/mcp-builder/scripts/evaluation.py +0 -373
- package/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
- package/skills/mcp-builder/scripts/requirements.txt +0 -2
- package/skills/meeting-notes/SKILL.md +0 -159
- package/skills/meeting-notes/evals/evals.json +0 -23
- package/skills/project-orchestrator/SKILL.md +0 -487
- package/skills/project-orchestrator/assets/caddy-vps-setup.md +0 -180
- package/skills/project-orchestrator/assets/plan-summary-template.md +0 -159
- package/skills/prompter-specs/SKILL.md +0 -115
- package/skills/prompter-workflow/SKILL.md +0 -166
- package/skills/prompter-workflow/evals/evals.json +0 -89
- package/skills/sph-generator/SKILL.md +0 -488
- package/skills/ui-ux-pro/SKILL.md +0 -199
- package/skills/ui-ux-pro/assets/design-spec-template.md +0 -173
- package/skills/ui-ux-pro/references/component-patterns.md +0 -255
- package/skills/ui-ux-pro/references/design-principles.md +0 -167
- package/src/cli/index.ts +0 -223
- package/src/commands/archive.ts +0 -302
- package/src/commands/change.ts +0 -292
- package/src/commands/config.ts +0 -233
- package/src/commands/guide.ts +0 -50
- package/src/commands/init.ts +0 -899
- package/src/commands/list.ts +0 -194
- package/src/commands/show.ts +0 -138
- package/src/commands/spec.ts +0 -251
- package/src/commands/update.ts +0 -156
- package/src/commands/upgrade.ts +0 -30
- package/src/commands/validate.ts +0 -326
- package/src/core/artifact-graph/graph.ts +0 -167
- package/src/core/artifact-graph/index.ts +0 -44
- package/src/core/artifact-graph/instruction-loader.ts +0 -302
- package/src/core/artifact-graph/resolver.ts +0 -226
- package/src/core/artifact-graph/schema.ts +0 -124
- package/src/core/artifact-graph/state.ts +0 -64
- package/src/core/artifact-graph/types.ts +0 -65
- package/src/core/completions/command-registry.ts +0 -382
- package/src/core/completions/completion-provider.ts +0 -128
- package/src/core/completions/generators/bash-generator.ts +0 -191
- package/src/core/completions/generators/fish-generator.ts +0 -188
- package/src/core/completions/generators/powershell-generator.ts +0 -223
- package/src/core/completions/generators/zsh-generator.ts +0 -281
- package/src/core/completions/templates/bash-templates.ts +0 -24
- package/src/core/completions/templates/fish-templates.ts +0 -40
- package/src/core/completions/templates/powershell-templates.ts +0 -25
- package/src/core/completions/templates/zsh-templates.ts +0 -36
- package/src/core/completions/types.ts +0 -90
- package/src/core/config-schema.ts +0 -230
- package/src/core/config.ts +0 -181
- package/src/core/configurators/slash/antigravity.ts +0 -70
- package/src/core/configurators/slash/base.ts +0 -203
- package/src/core/configurators/slash/claude.ts +0 -70
- package/src/core/configurators/slash/codex.ts +0 -70
- package/src/core/configurators/slash/droid.ts +0 -44
- package/src/core/configurators/slash/forge.ts +0 -44
- package/src/core/configurators/slash/github-copilot.ts +0 -114
- package/src/core/configurators/slash/index.ts +0 -10
- package/src/core/configurators/slash/kilocode.ts +0 -70
- package/src/core/configurators/slash/opencode.ts +0 -70
- package/src/core/configurators/slash/registry.ts +0 -51
- package/src/core/converters/json-converter.ts +0 -62
- package/src/core/global-config.ts +0 -136
- package/src/core/parsers/change-parser.ts +0 -234
- package/src/core/parsers/markdown-parser.ts +0 -237
- package/src/core/parsers/requirement-blocks.ts +0 -234
- package/src/core/prompt-templates.ts +0 -3504
- package/src/core/schemas/base.schema.ts +0 -20
- package/src/core/schemas/change.schema.ts +0 -42
- package/src/core/schemas/index.ts +0 -20
- package/src/core/schemas/spec.schema.ts +0 -17
- package/src/core/skill-discovery.ts +0 -68
- package/src/core/specs-apply.ts +0 -483
- package/src/core/styles/palette.ts +0 -8
- package/src/core/templates/agents-template.ts +0 -459
- package/src/core/templates/claude-template.ts +0 -2
- package/src/core/templates/index.ts +0 -4
- package/src/core/templates/project-template.ts +0 -32
- package/src/core/templates/slash-command-templates.ts +0 -1068
- package/src/core/validation/constants.ts +0 -48
- package/src/core/validation/types.ts +0 -19
- package/src/core/validation/validator.ts +0 -449
- package/src/core/view.ts +0 -219
- package/src/index.ts +0 -1
- package/src/utils/change-metadata.ts +0 -171
- package/src/utils/change-utils.ts +0 -131
- package/src/utils/file-system.ts +0 -252
- package/src/utils/index.ts +0 -12
- package/src/utils/interactive.ts +0 -29
- package/src/utils/item-discovery.ts +0 -66
- package/src/utils/match.ts +0 -26
- package/src/utils/shell-detection.ts +0 -62
- package/src/utils/task-progress.ts +0 -43
- package/tsconfig.json +0 -28
package/src/core/view.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { getTaskProgressForChange, formatTaskStatus } from '../utils/task-progress.js';
|
|
5
|
-
import { MarkdownParser } from './parsers/markdown-parser.js';
|
|
6
|
-
|
|
7
|
-
export class ViewCommand {
|
|
8
|
-
async execute(targetPath: string = '.'): Promise<void> {
|
|
9
|
-
const prompterDir = path.join(targetPath, 'prompter');
|
|
10
|
-
|
|
11
|
-
if (!fs.existsSync(prompterDir)) {
|
|
12
|
-
console.error(chalk.red('No prompter directory found'));
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
console.log(chalk.bold('\nPrompter Dashboard\n'));
|
|
17
|
-
console.log('═'.repeat(60));
|
|
18
|
-
|
|
19
|
-
// Get changes and specs data
|
|
20
|
-
const changesData = await this.getChangesData(prompterDir);
|
|
21
|
-
const specsData = await this.getSpecsData(prompterDir);
|
|
22
|
-
|
|
23
|
-
// Display summary metrics
|
|
24
|
-
this.displaySummary(changesData, specsData);
|
|
25
|
-
|
|
26
|
-
// Display draft changes
|
|
27
|
-
if (changesData.draft.length > 0) {
|
|
28
|
-
console.log(chalk.bold.gray('\nDraft Changes'));
|
|
29
|
-
console.log('─'.repeat(60));
|
|
30
|
-
changesData.draft.forEach((change) => {
|
|
31
|
-
console.log(` ${chalk.gray('○')} ${change.name}`);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Display active changes
|
|
36
|
-
if (changesData.active.length > 0) {
|
|
37
|
-
console.log(chalk.bold.cyan('\nActive Changes'));
|
|
38
|
-
console.log('─'.repeat(60));
|
|
39
|
-
changesData.active.forEach((change) => {
|
|
40
|
-
const progressBar = this.createProgressBar(change.progress.completed, change.progress.total);
|
|
41
|
-
const percentage =
|
|
42
|
-
change.progress.total > 0
|
|
43
|
-
? Math.round((change.progress.completed / change.progress.total) * 100)
|
|
44
|
-
: 0;
|
|
45
|
-
|
|
46
|
-
console.log(
|
|
47
|
-
` ${chalk.yellow('◉')} ${chalk.bold(change.name.padEnd(30))} ${progressBar} ${chalk.dim(`${percentage}%`)}`
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Display completed changes
|
|
53
|
-
if (changesData.completed.length > 0) {
|
|
54
|
-
console.log(chalk.bold.green('\nCompleted Changes'));
|
|
55
|
-
console.log('─'.repeat(60));
|
|
56
|
-
changesData.completed.forEach((change) => {
|
|
57
|
-
console.log(` ${chalk.green('✓')} ${change.name}`);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Display specifications
|
|
62
|
-
if (specsData.length > 0) {
|
|
63
|
-
console.log(chalk.bold.blue('\nSpecifications'));
|
|
64
|
-
console.log('─'.repeat(60));
|
|
65
|
-
|
|
66
|
-
// Sort specs by requirement count (descending)
|
|
67
|
-
specsData.sort((a, b) => b.requirementCount - a.requirementCount);
|
|
68
|
-
|
|
69
|
-
specsData.forEach(spec => {
|
|
70
|
-
const reqLabel = spec.requirementCount === 1 ? 'requirement' : 'requirements';
|
|
71
|
-
console.log(
|
|
72
|
-
` ${chalk.blue('▪')} ${chalk.bold(spec.name.padEnd(30))} ${chalk.dim(`${spec.requirementCount} ${reqLabel}`)}`
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
console.log('\n' + '═'.repeat(60));
|
|
78
|
-
console.log(chalk.dim(`\nUse ${chalk.white('prompter list --changes')} or ${chalk.white('prompter list --specs')} for detailed views`));
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private async getChangesData(prompterDir: string): Promise<{
|
|
82
|
-
draft: Array<{ name: string }>;
|
|
83
|
-
active: Array<{ name: string; progress: { total: number; completed: number } }>;
|
|
84
|
-
completed: Array<{ name: string }>;
|
|
85
|
-
}> {
|
|
86
|
-
const changesDir = path.join(prompterDir, 'changes');
|
|
87
|
-
|
|
88
|
-
if (!fs.existsSync(changesDir)) {
|
|
89
|
-
return { draft: [], active: [], completed: [] };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const draft: Array<{ name: string }> = [];
|
|
93
|
-
const active: Array<{ name: string; progress: { total: number; completed: number } }> = [];
|
|
94
|
-
const completed: Array<{ name: string }> = [];
|
|
95
|
-
|
|
96
|
-
const entries = fs.readdirSync(changesDir, { withFileTypes: true });
|
|
97
|
-
|
|
98
|
-
for (const entry of entries) {
|
|
99
|
-
if (entry.isDirectory() && entry.name !== 'archive') {
|
|
100
|
-
const progress = await getTaskProgressForChange(changesDir, entry.name);
|
|
101
|
-
|
|
102
|
-
if (progress.total === 0) {
|
|
103
|
-
// No tasks defined yet - still in planning/draft phase
|
|
104
|
-
draft.push({ name: entry.name });
|
|
105
|
-
} else if (progress.completed === progress.total) {
|
|
106
|
-
// All tasks complete
|
|
107
|
-
completed.push({ name: entry.name });
|
|
108
|
-
} else {
|
|
109
|
-
// Has tasks but not all complete
|
|
110
|
-
active.push({ name: entry.name, progress });
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Sort all categories by name for deterministic ordering
|
|
116
|
-
draft.sort((a, b) => a.name.localeCompare(b.name));
|
|
117
|
-
|
|
118
|
-
// Sort active changes by completion percentage (ascending) and then by name
|
|
119
|
-
active.sort((a, b) => {
|
|
120
|
-
const percentageA = a.progress.total > 0 ? a.progress.completed / a.progress.total : 0;
|
|
121
|
-
const percentageB = b.progress.total > 0 ? b.progress.completed / b.progress.total : 0;
|
|
122
|
-
|
|
123
|
-
if (percentageA < percentageB) return -1;
|
|
124
|
-
if (percentageA > percentageB) return 1;
|
|
125
|
-
return a.name.localeCompare(b.name);
|
|
126
|
-
});
|
|
127
|
-
completed.sort((a, b) => a.name.localeCompare(b.name));
|
|
128
|
-
|
|
129
|
-
return { draft, active, completed };
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
private async getSpecsData(prompterDir: string): Promise<Array<{ name: string; requirementCount: number }>> {
|
|
133
|
-
const specsDir = path.join(prompterDir, 'specs');
|
|
134
|
-
|
|
135
|
-
if (!fs.existsSync(specsDir)) {
|
|
136
|
-
return [];
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const specs: Array<{ name: string; requirementCount: number }> = [];
|
|
140
|
-
const entries = fs.readdirSync(specsDir, { withFileTypes: true });
|
|
141
|
-
|
|
142
|
-
for (const entry of entries) {
|
|
143
|
-
if (entry.isDirectory()) {
|
|
144
|
-
const specFile = path.join(specsDir, entry.name, 'spec.md');
|
|
145
|
-
|
|
146
|
-
if (fs.existsSync(specFile)) {
|
|
147
|
-
try {
|
|
148
|
-
const content = fs.readFileSync(specFile, 'utf-8');
|
|
149
|
-
const parser = new MarkdownParser(content);
|
|
150
|
-
const spec = parser.parseSpec(entry.name);
|
|
151
|
-
const requirementCount = spec.requirements.length;
|
|
152
|
-
specs.push({ name: entry.name, requirementCount });
|
|
153
|
-
} catch (error) {
|
|
154
|
-
// If spec cannot be parsed, include with 0 count
|
|
155
|
-
specs.push({ name: entry.name, requirementCount: 0 });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return specs;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
private displaySummary(
|
|
165
|
-
changesData: { draft: any[]; active: any[]; completed: any[] },
|
|
166
|
-
specsData: any[]
|
|
167
|
-
): void {
|
|
168
|
-
const totalChanges =
|
|
169
|
-
changesData.draft.length + changesData.active.length + changesData.completed.length;
|
|
170
|
-
const totalSpecs = specsData.length;
|
|
171
|
-
const totalRequirements = specsData.reduce((sum, spec) => sum + spec.requirementCount, 0);
|
|
172
|
-
|
|
173
|
-
// Calculate total task progress
|
|
174
|
-
let totalTasks = 0;
|
|
175
|
-
let completedTasks = 0;
|
|
176
|
-
|
|
177
|
-
changesData.active.forEach((change) => {
|
|
178
|
-
totalTasks += change.progress.total;
|
|
179
|
-
completedTasks += change.progress.completed;
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
changesData.completed.forEach(() => {
|
|
183
|
-
// Completed changes count as 100% done (we don't know exact task count)
|
|
184
|
-
// This is a simplification
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
console.log(chalk.bold('Summary:'));
|
|
188
|
-
console.log(
|
|
189
|
-
` ${chalk.cyan('●')} Specifications: ${chalk.bold(totalSpecs)} specs, ${chalk.bold(totalRequirements)} requirements`
|
|
190
|
-
);
|
|
191
|
-
if (changesData.draft.length > 0) {
|
|
192
|
-
console.log(` ${chalk.gray('●')} Draft Changes: ${chalk.bold(changesData.draft.length)}`);
|
|
193
|
-
}
|
|
194
|
-
console.log(
|
|
195
|
-
` ${chalk.yellow('●')} Active Changes: ${chalk.bold(changesData.active.length)} in progress`
|
|
196
|
-
);
|
|
197
|
-
console.log(` ${chalk.green('●')} Completed Changes: ${chalk.bold(changesData.completed.length)}`);
|
|
198
|
-
|
|
199
|
-
if (totalTasks > 0) {
|
|
200
|
-
const overallProgress = Math.round((completedTasks / totalTasks) * 100);
|
|
201
|
-
console.log(
|
|
202
|
-
` ${chalk.magenta('●')} Task Progress: ${chalk.bold(`${completedTasks}/${totalTasks}`)} (${overallProgress}% complete)`
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
private createProgressBar(completed: number, total: number, width: number = 20): string {
|
|
208
|
-
if (total === 0) return chalk.dim('─'.repeat(width));
|
|
209
|
-
|
|
210
|
-
const percentage = completed / total;
|
|
211
|
-
const filled = Math.round(percentage * width);
|
|
212
|
-
const empty = width - filled;
|
|
213
|
-
|
|
214
|
-
const filledBar = chalk.green('█'.repeat(filled));
|
|
215
|
-
const emptyBar = chalk.dim('░'.repeat(empty));
|
|
216
|
-
|
|
217
|
-
return `[${filledBar}${emptyBar}]`;
|
|
218
|
-
}
|
|
219
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { PrompterConfig } from './core/config.js';
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import * as yaml from 'yaml';
|
|
4
|
-
import { ChangeMetadataSchema, type ChangeMetadata } from '../core/artifact-graph/types.js';
|
|
5
|
-
import { listSchemas } from '../core/artifact-graph/resolver.js';
|
|
6
|
-
|
|
7
|
-
const METADATA_FILENAME = '.prompter.yaml';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Error thrown when change metadata validation fails.
|
|
11
|
-
*/
|
|
12
|
-
export class ChangeMetadataError extends Error {
|
|
13
|
-
constructor(
|
|
14
|
-
message: string,
|
|
15
|
-
public readonly metadataPath: string,
|
|
16
|
-
public readonly cause?: Error
|
|
17
|
-
) {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = 'ChangeMetadataError';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Validates that a schema name is valid (exists in available schemas).
|
|
25
|
-
*
|
|
26
|
-
* @param schemaName - The schema name to validate
|
|
27
|
-
* @returns The validated schema name
|
|
28
|
-
* @throws Error if schema is not found
|
|
29
|
-
*/
|
|
30
|
-
export function validateSchemaName(schemaName: string): string {
|
|
31
|
-
const availableSchemas = listSchemas();
|
|
32
|
-
if (!availableSchemas.includes(schemaName)) {
|
|
33
|
-
throw new Error(
|
|
34
|
-
`Unknown schema '${schemaName}'. Available: ${availableSchemas.join(', ')}`
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
return schemaName;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Writes change metadata to .prompter.yaml in the change directory.
|
|
42
|
-
*
|
|
43
|
-
* @param changeDir - The path to the change directory
|
|
44
|
-
* @param metadata - The metadata to write
|
|
45
|
-
* @throws ChangeMetadataError if validation fails or write fails
|
|
46
|
-
*/
|
|
47
|
-
export function writeChangeMetadata(
|
|
48
|
-
changeDir: string,
|
|
49
|
-
metadata: ChangeMetadata
|
|
50
|
-
): void {
|
|
51
|
-
const metaPath = path.join(changeDir, METADATA_FILENAME);
|
|
52
|
-
|
|
53
|
-
// Validate schema exists
|
|
54
|
-
validateSchemaName(metadata.schema);
|
|
55
|
-
|
|
56
|
-
// Validate with Zod
|
|
57
|
-
const parseResult = ChangeMetadataSchema.safeParse(metadata);
|
|
58
|
-
if (!parseResult.success) {
|
|
59
|
-
throw new ChangeMetadataError(
|
|
60
|
-
`Invalid metadata: ${parseResult.error.message}`,
|
|
61
|
-
metaPath
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Write YAML file
|
|
66
|
-
const content = yaml.stringify(parseResult.data);
|
|
67
|
-
try {
|
|
68
|
-
fs.writeFileSync(metaPath, content, 'utf-8');
|
|
69
|
-
} catch (err) {
|
|
70
|
-
const ioError = err instanceof Error ? err : new Error(String(err));
|
|
71
|
-
throw new ChangeMetadataError(
|
|
72
|
-
`Failed to write metadata: ${ioError.message}`,
|
|
73
|
-
metaPath,
|
|
74
|
-
ioError
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Reads change metadata from .prompter.yaml in the change directory.
|
|
81
|
-
*
|
|
82
|
-
* @param changeDir - The path to the change directory
|
|
83
|
-
* @returns The validated metadata, or null if no metadata file exists
|
|
84
|
-
* @throws ChangeMetadataError if the file exists but is invalid
|
|
85
|
-
*/
|
|
86
|
-
export function readChangeMetadata(changeDir: string): ChangeMetadata | null {
|
|
87
|
-
const metaPath = path.join(changeDir, METADATA_FILENAME);
|
|
88
|
-
|
|
89
|
-
if (!fs.existsSync(metaPath)) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
let content: string;
|
|
94
|
-
try {
|
|
95
|
-
content = fs.readFileSync(metaPath, 'utf-8');
|
|
96
|
-
} catch (err) {
|
|
97
|
-
const ioError = err instanceof Error ? err : new Error(String(err));
|
|
98
|
-
throw new ChangeMetadataError(
|
|
99
|
-
`Failed to read metadata: ${ioError.message}`,
|
|
100
|
-
metaPath,
|
|
101
|
-
ioError
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let parsed: unknown;
|
|
106
|
-
try {
|
|
107
|
-
parsed = yaml.parse(content);
|
|
108
|
-
} catch (err) {
|
|
109
|
-
const parseError = err instanceof Error ? err : new Error(String(err));
|
|
110
|
-
throw new ChangeMetadataError(
|
|
111
|
-
`Invalid YAML in metadata file: ${parseError.message}`,
|
|
112
|
-
metaPath,
|
|
113
|
-
parseError
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Validate with Zod
|
|
118
|
-
const parseResult = ChangeMetadataSchema.safeParse(parsed);
|
|
119
|
-
if (!parseResult.success) {
|
|
120
|
-
throw new ChangeMetadataError(
|
|
121
|
-
`Invalid metadata: ${parseResult.error.message}`,
|
|
122
|
-
metaPath
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Validate that the schema exists
|
|
127
|
-
const availableSchemas = listSchemas();
|
|
128
|
-
if (!availableSchemas.includes(parseResult.data.schema)) {
|
|
129
|
-
throw new ChangeMetadataError(
|
|
130
|
-
`Unknown schema '${parseResult.data.schema}'. Available: ${availableSchemas.join(', ')}`,
|
|
131
|
-
metaPath
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
return parseResult.data;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Resolves the schema for a change, with explicit override taking precedence.
|
|
140
|
-
*
|
|
141
|
-
* Resolution order:
|
|
142
|
-
* 1. Explicit schema (if provided)
|
|
143
|
-
* 2. Schema from .prompter.yaml metadata (if exists)
|
|
144
|
-
* 3. Default 'spec-driven'
|
|
145
|
-
*
|
|
146
|
-
* @param changeDir - The path to the change directory
|
|
147
|
-
* @param explicitSchema - Optional explicit schema override
|
|
148
|
-
* @returns The resolved schema name
|
|
149
|
-
*/
|
|
150
|
-
export function resolveSchemaForChange(
|
|
151
|
-
changeDir: string,
|
|
152
|
-
explicitSchema?: string
|
|
153
|
-
): string {
|
|
154
|
-
// 1. Explicit override wins
|
|
155
|
-
if (explicitSchema) {
|
|
156
|
-
return explicitSchema;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// 2. Try reading from metadata
|
|
160
|
-
try {
|
|
161
|
-
const metadata = readChangeMetadata(changeDir);
|
|
162
|
-
if (metadata?.schema) {
|
|
163
|
-
return metadata.schema;
|
|
164
|
-
}
|
|
165
|
-
} catch {
|
|
166
|
-
// If metadata read fails, fall back to default
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// 3. Default
|
|
170
|
-
return 'spec-driven';
|
|
171
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { FileSystemUtils } from './file-system.js';
|
|
3
|
-
import { writeChangeMetadata, validateSchemaName } from './change-metadata.js';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_SCHEMA = 'spec-driven';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Options for creating a change.
|
|
9
|
-
*/
|
|
10
|
-
export interface CreateChangeOptions {
|
|
11
|
-
/** The workflow schema to use (default: 'spec-driven') */
|
|
12
|
-
schema?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Result of validating a change name.
|
|
17
|
-
*/
|
|
18
|
-
export interface ValidationResult {
|
|
19
|
-
valid: boolean;
|
|
20
|
-
error?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Validates that a change name follows kebab-case conventions.
|
|
25
|
-
*
|
|
26
|
-
* Valid names:
|
|
27
|
-
* - Start with a lowercase letter
|
|
28
|
-
* - Contain only lowercase letters, numbers, and hyphens
|
|
29
|
-
* - Do not start or end with a hyphen
|
|
30
|
-
* - Do not contain consecutive hyphens
|
|
31
|
-
*
|
|
32
|
-
* @param name - The change name to validate
|
|
33
|
-
* @returns Validation result with `valid: true` or `valid: false` with an error message
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* validateChangeName('add-auth') // { valid: true }
|
|
37
|
-
* validateChangeName('Add-Auth') // { valid: false, error: '...' }
|
|
38
|
-
*/
|
|
39
|
-
export function validateChangeName(name: string): ValidationResult {
|
|
40
|
-
// Pattern: starts with lowercase letter, followed by lowercase letters/numbers,
|
|
41
|
-
// optionally followed by hyphen + lowercase letters/numbers (repeatable)
|
|
42
|
-
const kebabCasePattern = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
43
|
-
|
|
44
|
-
if (!name) {
|
|
45
|
-
return { valid: false, error: 'Change name cannot be empty' };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!kebabCasePattern.test(name)) {
|
|
49
|
-
// Provide specific error messages for common mistakes
|
|
50
|
-
if (/[A-Z]/.test(name)) {
|
|
51
|
-
return { valid: false, error: 'Change name must be lowercase (use kebab-case)' };
|
|
52
|
-
}
|
|
53
|
-
if (/\s/.test(name)) {
|
|
54
|
-
return { valid: false, error: 'Change name cannot contain spaces (use hyphens instead)' };
|
|
55
|
-
}
|
|
56
|
-
if (/_/.test(name)) {
|
|
57
|
-
return { valid: false, error: 'Change name cannot contain underscores (use hyphens instead)' };
|
|
58
|
-
}
|
|
59
|
-
if (name.startsWith('-')) {
|
|
60
|
-
return { valid: false, error: 'Change name cannot start with a hyphen' };
|
|
61
|
-
}
|
|
62
|
-
if (name.endsWith('-')) {
|
|
63
|
-
return { valid: false, error: 'Change name cannot end with a hyphen' };
|
|
64
|
-
}
|
|
65
|
-
if (/--/.test(name)) {
|
|
66
|
-
return { valid: false, error: 'Change name cannot contain consecutive hyphens' };
|
|
67
|
-
}
|
|
68
|
-
if (/[^a-z0-9-]/.test(name)) {
|
|
69
|
-
return { valid: false, error: 'Change name can only contain lowercase letters, numbers, and hyphens' };
|
|
70
|
-
}
|
|
71
|
-
if (/^[0-9]/.test(name)) {
|
|
72
|
-
return { valid: false, error: 'Change name must start with a letter' };
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return { valid: false, error: 'Change name must follow kebab-case convention (e.g., add-auth, refactor-db)' };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return { valid: true };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Creates a new change directory with metadata file.
|
|
83
|
-
*
|
|
84
|
-
* @param projectRoot - The root directory of the project (where `prompter/` lives)
|
|
85
|
-
* @param name - The change name (must be valid kebab-case)
|
|
86
|
-
* @param options - Optional settings for the change
|
|
87
|
-
* @throws Error if the change name is invalid
|
|
88
|
-
* @throws Error if the schema name is invalid
|
|
89
|
-
* @throws Error if the change directory already exists
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* // Creates prompter/changes/add-auth/ with default schema
|
|
93
|
-
* await createChange('/path/to/project', 'add-auth')
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* // Creates prompter/changes/add-auth/ with TDD schema
|
|
97
|
-
* await createChange('/path/to/project', 'add-auth', { schema: 'tdd' })
|
|
98
|
-
*/
|
|
99
|
-
export async function createChange(
|
|
100
|
-
projectRoot: string,
|
|
101
|
-
name: string,
|
|
102
|
-
options: CreateChangeOptions = {}
|
|
103
|
-
): Promise<void> {
|
|
104
|
-
// Validate the name first
|
|
105
|
-
const validation = validateChangeName(name);
|
|
106
|
-
if (!validation.valid) {
|
|
107
|
-
throw new Error(validation.error);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Determine schema (validate if provided)
|
|
111
|
-
const schemaName = options.schema ?? DEFAULT_SCHEMA;
|
|
112
|
-
validateSchemaName(schemaName);
|
|
113
|
-
|
|
114
|
-
// Build the change directory path
|
|
115
|
-
const changeDir = path.join(projectRoot, 'prompter', 'changes', name);
|
|
116
|
-
|
|
117
|
-
// Check if change already exists
|
|
118
|
-
if (await FileSystemUtils.directoryExists(changeDir)) {
|
|
119
|
-
throw new Error(`Change '${name}' already exists at ${changeDir}`);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Create the directory (including parent directories if needed)
|
|
123
|
-
await FileSystemUtils.createDirectory(changeDir);
|
|
124
|
-
|
|
125
|
-
// Write metadata file with schema and creation date
|
|
126
|
-
const today = new Date().toISOString().split('T')[0];
|
|
127
|
-
writeChangeMetadata(changeDir, {
|
|
128
|
-
schema: schemaName,
|
|
129
|
-
created: today,
|
|
130
|
-
});
|
|
131
|
-
}
|