@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.
Files changed (247) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +105 -77
  3. package/dist/cli/index.js +25 -1
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/commands/init.d.ts +1 -7
  6. package/dist/commands/init.d.ts.map +1 -1
  7. package/dist/commands/init.js +60 -299
  8. package/dist/commands/init.js.map +1 -1
  9. package/dist/commands/login.d.ts +4 -0
  10. package/dist/commands/login.d.ts.map +1 -0
  11. package/dist/commands/login.js +56 -0
  12. package/dist/commands/login.js.map +1 -0
  13. package/dist/commands/logout.d.ts +4 -0
  14. package/dist/commands/logout.d.ts.map +1 -0
  15. package/dist/commands/logout.js +14 -0
  16. package/dist/commands/logout.js.map +1 -0
  17. package/dist/commands/update.d.ts.map +1 -1
  18. package/dist/commands/update.js +31 -41
  19. package/dist/commands/update.js.map +1 -1
  20. package/dist/commands/whoami.d.ts +4 -0
  21. package/dist/commands/whoami.d.ts.map +1 -0
  22. package/dist/commands/whoami.js +42 -0
  23. package/dist/commands/whoami.js.map +1 -0
  24. package/dist/core/auth-store.d.ts +10 -0
  25. package/dist/core/auth-store.d.ts.map +1 -0
  26. package/dist/core/auth-store.js +39 -0
  27. package/dist/core/auth-store.js.map +1 -0
  28. package/dist/core/configurators/slash/antigravity.d.ts +2 -5
  29. package/dist/core/configurators/slash/antigravity.d.ts.map +1 -1
  30. package/dist/core/configurators/slash/antigravity.js +2 -57
  31. package/dist/core/configurators/slash/antigravity.js.map +1 -1
  32. package/dist/core/configurators/slash/base.d.ts +6 -18
  33. package/dist/core/configurators/slash/base.d.ts.map +1 -1
  34. package/dist/core/configurators/slash/base.js +8 -77
  35. package/dist/core/configurators/slash/base.js.map +1 -1
  36. package/dist/core/configurators/slash/claude.d.ts +2 -5
  37. package/dist/core/configurators/slash/claude.d.ts.map +1 -1
  38. package/dist/core/configurators/slash/claude.js +2 -57
  39. package/dist/core/configurators/slash/claude.js.map +1 -1
  40. package/dist/core/configurators/slash/codex.d.ts +2 -5
  41. package/dist/core/configurators/slash/codex.d.ts.map +1 -1
  42. package/dist/core/configurators/slash/codex.js +2 -57
  43. package/dist/core/configurators/slash/codex.js.map +1 -1
  44. package/dist/core/configurators/slash/droid.d.ts +2 -5
  45. package/dist/core/configurators/slash/droid.d.ts.map +1 -1
  46. package/dist/core/configurators/slash/droid.js +2 -32
  47. package/dist/core/configurators/slash/droid.js.map +1 -1
  48. package/dist/core/configurators/slash/forge.d.ts +2 -5
  49. package/dist/core/configurators/slash/forge.d.ts.map +1 -1
  50. package/dist/core/configurators/slash/forge.js +2 -32
  51. package/dist/core/configurators/slash/forge.js.map +1 -1
  52. package/dist/core/configurators/slash/github-copilot.d.ts +2 -7
  53. package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -1
  54. package/dist/core/configurators/slash/github-copilot.js +2 -96
  55. package/dist/core/configurators/slash/github-copilot.js.map +1 -1
  56. package/dist/core/configurators/slash/index.d.ts +1 -1
  57. package/dist/core/configurators/slash/index.d.ts.map +1 -1
  58. package/dist/core/configurators/slash/index.js +1 -1
  59. package/dist/core/configurators/slash/index.js.map +1 -1
  60. package/dist/core/configurators/slash/kilocode.d.ts +2 -5
  61. package/dist/core/configurators/slash/kilocode.d.ts.map +1 -1
  62. package/dist/core/configurators/slash/kilocode.js +2 -57
  63. package/dist/core/configurators/slash/kilocode.js.map +1 -1
  64. package/dist/core/configurators/slash/opencode.d.ts +2 -5
  65. package/dist/core/configurators/slash/opencode.d.ts.map +1 -1
  66. package/dist/core/configurators/slash/opencode.js +2 -57
  67. package/dist/core/configurators/slash/opencode.js.map +1 -1
  68. package/dist/core/configurators/slash/registry.d.ts +4 -4
  69. package/dist/core/configurators/slash/registry.d.ts.map +1 -1
  70. package/dist/core/configurators/slash/registry.js.map +1 -1
  71. package/dist/core/registry.d.ts +18 -0
  72. package/dist/core/registry.d.ts.map +1 -0
  73. package/dist/core/registry.js +94 -0
  74. package/dist/core/registry.js.map +1 -0
  75. package/dist/core/templates/index.d.ts +0 -1
  76. package/dist/core/templates/index.d.ts.map +1 -1
  77. package/dist/core/templates/index.js +0 -1
  78. package/dist/core/templates/index.js.map +1 -1
  79. package/package.json +7 -1
  80. package/AGENTS.md +0 -123
  81. package/CLAUDE.md +0 -17
  82. package/build.js +0 -20
  83. package/convex-setup.md +0 -403
  84. package/dist/core/templates/slash-command-templates.d.ts +0 -7
  85. package/dist/core/templates/slash-command-templates.d.ts.map +0 -1
  86. package/dist/core/templates/slash-command-templates.js +0 -1041
  87. package/dist/core/templates/slash-command-templates.js.map +0 -1
  88. package/prompt/ai-humanizer.md +0 -45
  89. package/prompt/api-contract-generator.md +0 -234
  90. package/prompt/apply.md +0 -17
  91. package/prompt/archive.md +0 -21
  92. package/prompt/design-system.md +0 -210
  93. package/prompt/document-explainer.md +0 -149
  94. package/prompt/epic-generator.md +0 -198
  95. package/prompt/epic-single.md +0 -47
  96. package/prompt/erd-generator.md +0 -130
  97. package/prompt/fsd-generator.md +0 -157
  98. package/prompt/prd-agent-generator.md +0 -147
  99. package/prompt/prd-generator.md +0 -195
  100. package/prompt/product-brief.md +0 -289
  101. package/prompt/proposal.md +0 -22
  102. package/prompt/qa-test-scenario.md +0 -133
  103. package/prompt/skill-creator.md +0 -350
  104. package/prompt/story-generator.md +0 -278
  105. package/prompt/story-single.md +0 -70
  106. package/prompt/tdd-generator.md +0 -294
  107. package/prompt/tdd-lite-generator.md +0 -224
  108. package/prompt/wireframe-generator.md +0 -219
  109. package/skills/ai-context-generator/SKILL.md +0 -54
  110. package/skills/ai-context-generator/references/AGENTS.template.md +0 -83
  111. package/skills/ai-context-generator/references/CLAUDE.template.md +0 -39
  112. package/skills/ai-context-generator/references/behavioral-guidelines.md +0 -71
  113. package/skills/ai-context-generator/references/discovery-checklist.md +0 -40
  114. package/skills/ai-context-generator/references/examples/AGENTS.good.md +0 -103
  115. package/skills/ai-context-generator/references/extraction-checklist.md +0 -23
  116. package/skills/ai-context-generator/references/overlays/laravel.md +0 -44
  117. package/skills/cerebro/SKILL.md +0 -187
  118. package/skills/cerebro/references/agents.md +0 -213
  119. package/skills/code-review/SKILL.md +0 -373
  120. package/skills/code-review/assets/report-template-agent.md +0 -212
  121. package/skills/code-review/assets/report-template-compact.md +0 -81
  122. package/skills/code-review/assets/report-template-full.md +0 -264
  123. package/skills/code-review/assets/report-template-human.md +0 -168
  124. package/skills/code-review/references/universal-patterns.md +0 -495
  125. package/skills/design-md/README.md +0 -34
  126. package/skills/design-md/SKILL.md +0 -172
  127. package/skills/design-md/examples/DESIGN.md +0 -154
  128. package/skills/design-system-generator/SKILL.md +0 -324
  129. package/skills/design-system-generator/assets/design-system-template.md +0 -348
  130. package/skills/design-system-generator/references/extraction-patterns.md +0 -321
  131. package/skills/doc-builder/SKILL.md +0 -115
  132. package/skills/doc-builder/references/ui-patterns.md +0 -394
  133. package/skills/document-translator/SKILL.md +0 -58
  134. package/skills/enhance-prompt/README.md +0 -34
  135. package/skills/enhance-prompt/SKILL.md +0 -204
  136. package/skills/enhance-prompt/references/KEYWORDS.md +0 -114
  137. package/skills/feature-planner/SKILL.md +0 -305
  138. package/skills/feature-planner/assets/implementation-plan-template.md +0 -85
  139. package/skills/frontend-design/LICENSE.txt +0 -177
  140. package/skills/frontend-design/SKILL.md +0 -42
  141. package/skills/gamma-builder/SKILL.md +0 -134
  142. package/skills/laravel-code-review/SKILL.md +0 -383
  143. package/skills/laravel-code-review/assets/report-template-agent.md +0 -195
  144. package/skills/laravel-code-review/assets/report-template-compact.md +0 -79
  145. package/skills/laravel-code-review/assets/report-template-full.md +0 -253
  146. package/skills/laravel-code-review/assets/report-template-human.md +0 -159
  147. package/skills/laravel-code-review/references/laravel-patterns.md +0 -571
  148. package/skills/laravel-code-review/references/php84-features.md +0 -442
  149. package/skills/mcp-builder/LICENSE.txt +0 -202
  150. package/skills/mcp-builder/SKILL.md +0 -236
  151. package/skills/mcp-builder/reference/evaluation.md +0 -602
  152. package/skills/mcp-builder/reference/mcp_best_practices.md +0 -249
  153. package/skills/mcp-builder/reference/node_mcp_server.md +0 -970
  154. package/skills/mcp-builder/reference/python_mcp_server.md +0 -719
  155. package/skills/mcp-builder/scripts/connections.py +0 -151
  156. package/skills/mcp-builder/scripts/evaluation.py +0 -373
  157. package/skills/mcp-builder/scripts/example_evaluation.xml +0 -22
  158. package/skills/mcp-builder/scripts/requirements.txt +0 -2
  159. package/skills/meeting-notes/SKILL.md +0 -159
  160. package/skills/meeting-notes/evals/evals.json +0 -23
  161. package/skills/project-orchestrator/SKILL.md +0 -487
  162. package/skills/project-orchestrator/assets/caddy-vps-setup.md +0 -180
  163. package/skills/project-orchestrator/assets/plan-summary-template.md +0 -159
  164. package/skills/prompter-specs/SKILL.md +0 -115
  165. package/skills/prompter-workflow/SKILL.md +0 -166
  166. package/skills/prompter-workflow/evals/evals.json +0 -89
  167. package/skills/sph-generator/SKILL.md +0 -488
  168. package/skills/ui-ux-pro/SKILL.md +0 -199
  169. package/skills/ui-ux-pro/assets/design-spec-template.md +0 -173
  170. package/skills/ui-ux-pro/references/component-patterns.md +0 -255
  171. package/skills/ui-ux-pro/references/design-principles.md +0 -167
  172. package/src/cli/index.ts +0 -223
  173. package/src/commands/archive.ts +0 -302
  174. package/src/commands/change.ts +0 -292
  175. package/src/commands/config.ts +0 -233
  176. package/src/commands/guide.ts +0 -50
  177. package/src/commands/init.ts +0 -899
  178. package/src/commands/list.ts +0 -194
  179. package/src/commands/show.ts +0 -138
  180. package/src/commands/spec.ts +0 -251
  181. package/src/commands/update.ts +0 -156
  182. package/src/commands/upgrade.ts +0 -30
  183. package/src/commands/validate.ts +0 -326
  184. package/src/core/artifact-graph/graph.ts +0 -167
  185. package/src/core/artifact-graph/index.ts +0 -44
  186. package/src/core/artifact-graph/instruction-loader.ts +0 -302
  187. package/src/core/artifact-graph/resolver.ts +0 -226
  188. package/src/core/artifact-graph/schema.ts +0 -124
  189. package/src/core/artifact-graph/state.ts +0 -64
  190. package/src/core/artifact-graph/types.ts +0 -65
  191. package/src/core/completions/command-registry.ts +0 -382
  192. package/src/core/completions/completion-provider.ts +0 -128
  193. package/src/core/completions/generators/bash-generator.ts +0 -191
  194. package/src/core/completions/generators/fish-generator.ts +0 -188
  195. package/src/core/completions/generators/powershell-generator.ts +0 -223
  196. package/src/core/completions/generators/zsh-generator.ts +0 -281
  197. package/src/core/completions/templates/bash-templates.ts +0 -24
  198. package/src/core/completions/templates/fish-templates.ts +0 -40
  199. package/src/core/completions/templates/powershell-templates.ts +0 -25
  200. package/src/core/completions/templates/zsh-templates.ts +0 -36
  201. package/src/core/completions/types.ts +0 -90
  202. package/src/core/config-schema.ts +0 -230
  203. package/src/core/config.ts +0 -181
  204. package/src/core/configurators/slash/antigravity.ts +0 -70
  205. package/src/core/configurators/slash/base.ts +0 -203
  206. package/src/core/configurators/slash/claude.ts +0 -70
  207. package/src/core/configurators/slash/codex.ts +0 -70
  208. package/src/core/configurators/slash/droid.ts +0 -44
  209. package/src/core/configurators/slash/forge.ts +0 -44
  210. package/src/core/configurators/slash/github-copilot.ts +0 -114
  211. package/src/core/configurators/slash/index.ts +0 -10
  212. package/src/core/configurators/slash/kilocode.ts +0 -70
  213. package/src/core/configurators/slash/opencode.ts +0 -70
  214. package/src/core/configurators/slash/registry.ts +0 -51
  215. package/src/core/converters/json-converter.ts +0 -62
  216. package/src/core/global-config.ts +0 -136
  217. package/src/core/parsers/change-parser.ts +0 -234
  218. package/src/core/parsers/markdown-parser.ts +0 -237
  219. package/src/core/parsers/requirement-blocks.ts +0 -234
  220. package/src/core/prompt-templates.ts +0 -3504
  221. package/src/core/schemas/base.schema.ts +0 -20
  222. package/src/core/schemas/change.schema.ts +0 -42
  223. package/src/core/schemas/index.ts +0 -20
  224. package/src/core/schemas/spec.schema.ts +0 -17
  225. package/src/core/skill-discovery.ts +0 -68
  226. package/src/core/specs-apply.ts +0 -483
  227. package/src/core/styles/palette.ts +0 -8
  228. package/src/core/templates/agents-template.ts +0 -459
  229. package/src/core/templates/claude-template.ts +0 -2
  230. package/src/core/templates/index.ts +0 -4
  231. package/src/core/templates/project-template.ts +0 -32
  232. package/src/core/templates/slash-command-templates.ts +0 -1068
  233. package/src/core/validation/constants.ts +0 -48
  234. package/src/core/validation/types.ts +0 -19
  235. package/src/core/validation/validator.ts +0 -449
  236. package/src/core/view.ts +0 -219
  237. package/src/index.ts +0 -1
  238. package/src/utils/change-metadata.ts +0 -171
  239. package/src/utils/change-utils.ts +0 -131
  240. package/src/utils/file-system.ts +0 -252
  241. package/src/utils/index.ts +0 -12
  242. package/src/utils/interactive.ts +0 -29
  243. package/src/utils/item-discovery.ts +0 -66
  244. package/src/utils/match.ts +0 -26
  245. package/src/utils/shell-detection.ts +0 -62
  246. package/src/utils/task-progress.ts +0 -43
  247. package/tsconfig.json +0 -28
@@ -1,64 +0,0 @@
1
- import * as fs from 'node:fs';
2
- import * as path from 'node:path';
3
- import fg from 'fast-glob';
4
- import type { CompletedSet } from './types.js';
5
- import type { ArtifactGraph } from './graph.js';
6
- import { FileSystemUtils } from '../../utils/file-system.js';
7
-
8
- /**
9
- * Detects which artifacts are completed by checking file existence in the change directory.
10
- * Returns a Set of completed artifact IDs.
11
- *
12
- * @param graph - The artifact graph to check
13
- * @param changeDir - The change directory to scan for files
14
- * @returns Set of artifact IDs whose generated files exist
15
- */
16
- export function detectCompleted(graph: ArtifactGraph, changeDir: string): CompletedSet {
17
- const completed = new Set<string>();
18
-
19
- // Handle missing change directory gracefully
20
- if (!fs.existsSync(changeDir)) {
21
- return completed;
22
- }
23
-
24
- for (const artifact of graph.getAllArtifacts()) {
25
- if (isArtifactComplete(artifact.generates, changeDir)) {
26
- completed.add(artifact.id);
27
- }
28
- }
29
-
30
- return completed;
31
- }
32
-
33
- /**
34
- * Checks if an artifact is complete by checking if its generated file(s) exist.
35
- * Supports both simple paths and glob patterns.
36
- */
37
- function isArtifactComplete(generates: string, changeDir: string): boolean {
38
- const fullPattern = path.join(changeDir, generates);
39
-
40
- // Check if it's a glob pattern
41
- if (isGlobPattern(generates)) {
42
- return hasGlobMatches(fullPattern);
43
- }
44
-
45
- // Simple file path - check if file exists
46
- return fs.existsSync(fullPattern);
47
- }
48
-
49
- /**
50
- * Checks if a path contains glob pattern characters.
51
- */
52
- function isGlobPattern(pattern: string): boolean {
53
- return pattern.includes('*') || pattern.includes('?') || pattern.includes('[');
54
- }
55
-
56
- /**
57
- * Checks if a glob pattern has any matches.
58
- * Normalizes Windows backslashes to forward slashes for cross-platform glob compatibility.
59
- */
60
- function hasGlobMatches(pattern: string): boolean {
61
- const normalizedPattern = FileSystemUtils.toPosixPath(pattern);
62
- const matches = fg.sync(normalizedPattern, { onlyFiles: true });
63
- return matches.length > 0;
64
- }
@@ -1,65 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- // Artifact definition schema
4
- export const ArtifactSchema = z.object({
5
- id: z.string().min(1, { error: 'Artifact ID is required' }),
6
- generates: z.string().min(1, { error: 'generates field is required' }),
7
- description: z.string(),
8
- template: z.string().min(1, { error: 'template field is required' }),
9
- instruction: z.string().optional(),
10
- requires: z.array(z.string()).default([]),
11
- });
12
-
13
- // Apply phase configuration for schema-aware apply instructions
14
- export const ApplyPhaseSchema = z.object({
15
- // Artifact IDs that must exist before apply is available
16
- requires: z.array(z.string()).min(1, { error: 'At least one required artifact' }),
17
- // Path to file with checkboxes for progress (relative to change dir), or null if no tracking
18
- tracks: z.string().nullable().optional(),
19
- // Custom guidance for the apply phase
20
- instruction: z.string().optional(),
21
- });
22
-
23
- // Full schema YAML structure
24
- export const SchemaYamlSchema = z.object({
25
- name: z.string().min(1, { error: 'Schema name is required' }),
26
- version: z.number().int().positive({ error: 'Version must be a positive integer' }),
27
- description: z.string().optional(),
28
- artifacts: z.array(ArtifactSchema).min(1, { error: 'At least one artifact required' }),
29
- // Optional apply phase configuration (for schema-aware apply instructions)
30
- apply: ApplyPhaseSchema.optional(),
31
- });
32
-
33
- // Derived TypeScript types
34
- export type Artifact = z.infer<typeof ArtifactSchema>;
35
- export type ApplyPhase = z.infer<typeof ApplyPhaseSchema>;
36
- export type SchemaYaml = z.infer<typeof SchemaYamlSchema>;
37
-
38
- // Per-change metadata schema
39
- // Note: schema field is validated at parse time against available schemas
40
- // using a lazy import to avoid circular dependencies
41
- export const ChangeMetadataSchema = z.object({
42
- // Required: which workflow schema this change uses
43
- schema: z.string().min(1, { message: 'schema is required' }),
44
-
45
- // Optional: creation timestamp (ISO date string)
46
- created: z
47
- .string()
48
- .regex(/^\d{4}-\d{2}-\d{2}$/, {
49
- message: 'created must be YYYY-MM-DD format',
50
- })
51
- .optional(),
52
- });
53
-
54
- export type ChangeMetadata = z.infer<typeof ChangeMetadataSchema>;
55
-
56
- // Runtime state types (not Zod - internal only)
57
-
58
- // Slice 1: Simple completion tracking via filesystem
59
- export type CompletedSet = Set<string>;
60
-
61
- // Return type for blocked query
62
- export interface BlockedArtifacts {
63
- [artifactId: string]: string[];
64
- }
65
-
@@ -1,382 +0,0 @@
1
- import { CommandDefinition, FlagDefinition } from './types.js';
2
-
3
- /**
4
- * Common flags used across multiple commands
5
- */
6
- const COMMON_FLAGS = {
7
- json: {
8
- name: 'json',
9
- description: 'Output as JSON',
10
- } as FlagDefinition,
11
- jsonValidation: {
12
- name: 'json',
13
- description: 'Output validation results as JSON',
14
- } as FlagDefinition,
15
- strict: {
16
- name: 'strict',
17
- description: 'Enable strict validation mode',
18
- } as FlagDefinition,
19
- noInteractive: {
20
- name: 'no-interactive',
21
- description: 'Disable interactive prompts',
22
- } as FlagDefinition,
23
- type: {
24
- name: 'type',
25
- description: 'Specify item type when ambiguous',
26
- takesValue: true,
27
- values: ['change', 'spec'],
28
- } as FlagDefinition,
29
- } as const;
30
-
31
- /**
32
- * Registry of all Prompter CLI commands with their flags and metadata.
33
- * This registry is used to generate shell completion scripts.
34
- */
35
- export const COMMAND_REGISTRY: CommandDefinition[] = [
36
- {
37
- name: 'init',
38
- description: 'Initialize Prompter in your project',
39
- acceptsPositional: true,
40
- positionalType: 'path',
41
- flags: [
42
- {
43
- name: 'tools',
44
- description: 'Configure AI tools non-interactively (e.g., "all", "none", or comma-separated tool IDs)',
45
- takesValue: true,
46
- },
47
- ],
48
- },
49
- {
50
- name: 'update',
51
- description: 'Update Prompter instruction files',
52
- acceptsPositional: true,
53
- positionalType: 'path',
54
- flags: [],
55
- },
56
- {
57
- name: 'list',
58
- description: 'List items (changes by default, or specs with --specs)',
59
- flags: [
60
- {
61
- name: 'specs',
62
- description: 'List specs instead of changes',
63
- },
64
- {
65
- name: 'changes',
66
- description: 'List changes explicitly (default)',
67
- },
68
- ],
69
- },
70
- {
71
- name: 'view',
72
- description: 'Display an interactive dashboard of specs and changes',
73
- flags: [],
74
- },
75
- {
76
- name: 'validate',
77
- description: 'Validate changes and specs',
78
- acceptsPositional: true,
79
- positionalType: 'change-or-spec-id',
80
- flags: [
81
- {
82
- name: 'all',
83
- description: 'Validate all changes and specs',
84
- },
85
- {
86
- name: 'changes',
87
- description: 'Validate all changes',
88
- },
89
- {
90
- name: 'specs',
91
- description: 'Validate all specs',
92
- },
93
- COMMON_FLAGS.type,
94
- COMMON_FLAGS.strict,
95
- COMMON_FLAGS.jsonValidation,
96
- {
97
- name: 'concurrency',
98
- description: 'Max concurrent validations (defaults to env PROMPTER_CONCURRENCY or 6)',
99
- takesValue: true,
100
- },
101
- COMMON_FLAGS.noInteractive,
102
- ],
103
- },
104
- {
105
- name: 'show',
106
- description: 'Show a change or spec',
107
- acceptsPositional: true,
108
- positionalType: 'change-or-spec-id',
109
- flags: [
110
- COMMON_FLAGS.json,
111
- COMMON_FLAGS.type,
112
- COMMON_FLAGS.noInteractive,
113
- {
114
- name: 'deltas-only',
115
- description: 'Show only deltas (JSON only, change-specific)',
116
- },
117
- {
118
- name: 'requirements-only',
119
- description: 'Alias for --deltas-only (deprecated, change-specific)',
120
- },
121
- {
122
- name: 'requirements',
123
- description: 'Show only requirements, exclude scenarios (JSON only, spec-specific)',
124
- },
125
- {
126
- name: 'no-scenarios',
127
- description: 'Exclude scenario content (JSON only, spec-specific)',
128
- },
129
- {
130
- name: 'requirement',
131
- short: 'r',
132
- description: 'Show specific requirement by ID (JSON only, spec-specific)',
133
- takesValue: true,
134
- },
135
- ],
136
- },
137
- {
138
- name: 'archive',
139
- description: 'Archive a completed change and update main specs',
140
- acceptsPositional: true,
141
- positionalType: 'change-id',
142
- flags: [
143
- {
144
- name: 'yes',
145
- short: 'y',
146
- description: 'Skip confirmation prompts',
147
- },
148
- {
149
- name: 'skip-specs',
150
- description: 'Skip spec update operations',
151
- },
152
- {
153
- name: 'no-validate',
154
- description: 'Skip validation (not recommended)',
155
- },
156
- ],
157
- },
158
- {
159
- name: 'feedback',
160
- description: 'Submit feedback about Prompter',
161
- acceptsPositional: true,
162
- flags: [
163
- {
164
- name: 'body',
165
- description: 'Detailed description for the feedback',
166
- takesValue: true,
167
- },
168
- ],
169
- },
170
- {
171
- name: 'change',
172
- description: 'Manage Prompter change proposals (deprecated)',
173
- flags: [],
174
- subcommands: [
175
- {
176
- name: 'show',
177
- description: 'Show a change proposal',
178
- acceptsPositional: true,
179
- positionalType: 'change-id',
180
- flags: [
181
- COMMON_FLAGS.json,
182
- {
183
- name: 'deltas-only',
184
- description: 'Show only deltas (JSON only)',
185
- },
186
- {
187
- name: 'requirements-only',
188
- description: 'Alias for --deltas-only (deprecated)',
189
- },
190
- COMMON_FLAGS.noInteractive,
191
- ],
192
- },
193
- {
194
- name: 'list',
195
- description: 'List all active changes (deprecated)',
196
- flags: [
197
- COMMON_FLAGS.json,
198
- {
199
- name: 'long',
200
- description: 'Show id and title with counts',
201
- },
202
- ],
203
- },
204
- {
205
- name: 'validate',
206
- description: 'Validate a change proposal',
207
- acceptsPositional: true,
208
- positionalType: 'change-id',
209
- flags: [
210
- COMMON_FLAGS.strict,
211
- COMMON_FLAGS.jsonValidation,
212
- COMMON_FLAGS.noInteractive,
213
- ],
214
- },
215
- ],
216
- },
217
- {
218
- name: 'spec',
219
- description: 'Manage Prompter specifications',
220
- flags: [],
221
- subcommands: [
222
- {
223
- name: 'show',
224
- description: 'Show a specification',
225
- acceptsPositional: true,
226
- positionalType: 'spec-id',
227
- flags: [
228
- COMMON_FLAGS.json,
229
- {
230
- name: 'requirements',
231
- description: 'Show only requirements, exclude scenarios (JSON only)',
232
- },
233
- {
234
- name: 'no-scenarios',
235
- description: 'Exclude scenario content (JSON only)',
236
- },
237
- {
238
- name: 'requirement',
239
- short: 'r',
240
- description: 'Show specific requirement by ID (JSON only)',
241
- takesValue: true,
242
- },
243
- COMMON_FLAGS.noInteractive,
244
- ],
245
- },
246
- {
247
- name: 'list',
248
- description: 'List all specifications',
249
- flags: [
250
- COMMON_FLAGS.json,
251
- {
252
- name: 'long',
253
- description: 'Show id and title with counts',
254
- },
255
- ],
256
- },
257
- {
258
- name: 'validate',
259
- description: 'Validate a specification',
260
- acceptsPositional: true,
261
- positionalType: 'spec-id',
262
- flags: [
263
- COMMON_FLAGS.strict,
264
- COMMON_FLAGS.jsonValidation,
265
- COMMON_FLAGS.noInteractive,
266
- ],
267
- },
268
- ],
269
- },
270
- {
271
- name: 'completion',
272
- description: 'Manage shell completions for Prompter CLI',
273
- flags: [],
274
- subcommands: [
275
- {
276
- name: 'generate',
277
- description: 'Generate completion script for a shell (outputs to stdout)',
278
- acceptsPositional: true,
279
- positionalType: 'shell',
280
- flags: [],
281
- },
282
- {
283
- name: 'install',
284
- description: 'Install completion script for a shell',
285
- acceptsPositional: true,
286
- positionalType: 'shell',
287
- flags: [
288
- {
289
- name: 'verbose',
290
- description: 'Show detailed installation output',
291
- },
292
- ],
293
- },
294
- {
295
- name: 'uninstall',
296
- description: 'Uninstall completion script for a shell',
297
- acceptsPositional: true,
298
- positionalType: 'shell',
299
- flags: [
300
- {
301
- name: 'yes',
302
- short: 'y',
303
- description: 'Skip confirmation prompts',
304
- },
305
- ],
306
- },
307
- ],
308
- },
309
- {
310
- name: 'config',
311
- description: 'View and modify global Prompter configuration',
312
- flags: [
313
- {
314
- name: 'scope',
315
- description: 'Config scope (only "global" supported currently)',
316
- takesValue: true,
317
- values: ['global'],
318
- },
319
- ],
320
- subcommands: [
321
- {
322
- name: 'path',
323
- description: 'Show config file location',
324
- flags: [],
325
- },
326
- {
327
- name: 'list',
328
- description: 'Show all current settings',
329
- flags: [
330
- COMMON_FLAGS.json,
331
- ],
332
- },
333
- {
334
- name: 'get',
335
- description: 'Get a specific value (raw, scriptable)',
336
- acceptsPositional: true,
337
- flags: [],
338
- },
339
- {
340
- name: 'set',
341
- description: 'Set a value (auto-coerce types)',
342
- acceptsPositional: true,
343
- flags: [
344
- {
345
- name: 'string',
346
- description: 'Force value to be stored as string',
347
- },
348
- {
349
- name: 'allow-unknown',
350
- description: 'Allow setting unknown keys',
351
- },
352
- ],
353
- },
354
- {
355
- name: 'unset',
356
- description: 'Remove a key (revert to default)',
357
- acceptsPositional: true,
358
- flags: [],
359
- },
360
- {
361
- name: 'reset',
362
- description: 'Reset configuration to defaults',
363
- flags: [
364
- {
365
- name: 'all',
366
- description: 'Reset all configuration (required)',
367
- },
368
- {
369
- name: 'yes',
370
- short: 'y',
371
- description: 'Skip confirmation prompts',
372
- },
373
- ],
374
- },
375
- {
376
- name: 'edit',
377
- description: 'Open config in $EDITOR',
378
- flags: [],
379
- },
380
- ],
381
- },
382
- ];
@@ -1,128 +0,0 @@
1
- import { getActiveChangeIds, getSpecIds } from '../../utils/item-discovery.js';
2
-
3
- /**
4
- * Cache entry for completion data
5
- */
6
- interface CacheEntry<T> {
7
- data: T;
8
- timestamp: number;
9
- }
10
-
11
- /**
12
- * Provides dynamic completion suggestions for Prompter items (changes and specs).
13
- * Implements a 2-second cache to avoid excessive file system operations during
14
- * tab completion.
15
- */
16
- export class CompletionProvider {
17
- private readonly cacheTTL: number;
18
- private changeCache: CacheEntry<string[]> | null = null;
19
- private specCache: CacheEntry<string[]> | null = null;
20
-
21
- /**
22
- * Creates a new completion provider
23
- *
24
- * @param cacheTTLMs - Cache time-to-live in milliseconds (default: 2000ms)
25
- * @param projectRoot - Project root directory (default: process.cwd())
26
- */
27
- constructor(
28
- private readonly cacheTTLMs: number = 2000,
29
- private readonly projectRoot: string = process.cwd()
30
- ) {
31
- this.cacheTTL = cacheTTLMs;
32
- }
33
-
34
- /**
35
- * Get all active change IDs for completion
36
- *
37
- * @returns Array of change IDs
38
- */
39
- async getChangeIds(): Promise<string[]> {
40
- const now = Date.now();
41
-
42
- // Check if cache is valid
43
- if (this.changeCache && now - this.changeCache.timestamp < this.cacheTTL) {
44
- return this.changeCache.data;
45
- }
46
-
47
- // Fetch fresh data
48
- const changeIds = await getActiveChangeIds(this.projectRoot);
49
-
50
- // Update cache
51
- this.changeCache = {
52
- data: changeIds,
53
- timestamp: now,
54
- };
55
-
56
- return changeIds;
57
- }
58
-
59
- /**
60
- * Get all spec IDs for completion
61
- *
62
- * @returns Array of spec IDs
63
- */
64
- async getSpecIds(): Promise<string[]> {
65
- const now = Date.now();
66
-
67
- // Check if cache is valid
68
- if (this.specCache && now - this.specCache.timestamp < this.cacheTTL) {
69
- return this.specCache.data;
70
- }
71
-
72
- // Fetch fresh data
73
- const specIds = await getSpecIds(this.projectRoot);
74
-
75
- // Update cache
76
- this.specCache = {
77
- data: specIds,
78
- timestamp: now,
79
- };
80
-
81
- return specIds;
82
- }
83
-
84
- /**
85
- * Get both change and spec IDs for completion
86
- *
87
- * @returns Object with changeIds and specIds arrays
88
- */
89
- async getAllIds(): Promise<{ changeIds: string[]; specIds: string[] }> {
90
- const [changeIds, specIds] = await Promise.all([
91
- this.getChangeIds(),
92
- this.getSpecIds(),
93
- ]);
94
-
95
- return { changeIds, specIds };
96
- }
97
-
98
- /**
99
- * Clear all cached data
100
- */
101
- clearCache(): void {
102
- this.changeCache = null;
103
- this.specCache = null;
104
- }
105
-
106
- /**
107
- * Get cache statistics for debugging
108
- *
109
- * @returns Cache status information
110
- */
111
- getCacheStats(): {
112
- changeCache: { valid: boolean; age?: number };
113
- specCache: { valid: boolean; age?: number };
114
- } {
115
- const now = Date.now();
116
-
117
- return {
118
- changeCache: {
119
- valid: this.changeCache !== null && now - this.changeCache.timestamp < this.cacheTTL,
120
- age: this.changeCache ? now - this.changeCache.timestamp : undefined,
121
- },
122
- specCache: {
123
- valid: this.specCache !== null && now - this.specCache.timestamp < this.cacheTTL,
124
- age: this.specCache ? now - this.specCache.timestamp : undefined,
125
- },
126
- };
127
- }
128
- }