@dedesfr/prompter 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/AGENTS.md +105 -0
  2. package/LICENSE +21 -0
  3. package/README.md +66 -0
  4. package/bin/prompter.js +3 -0
  5. package/build.js +20 -0
  6. package/dist/cli/index.d.ts +2 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +35 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/commands/init.d.ts +10 -0
  11. package/dist/commands/init.d.ts.map +1 -0
  12. package/dist/commands/init.js +92 -0
  13. package/dist/commands/init.js.map +1 -0
  14. package/dist/commands/list.d.ts +9 -0
  15. package/dist/commands/list.d.ts.map +1 -0
  16. package/dist/commands/list.js +65 -0
  17. package/dist/commands/list.js.map +1 -0
  18. package/dist/commands/update.d.ts +4 -0
  19. package/dist/commands/update.d.ts.map +1 -0
  20. package/dist/commands/update.js +38 -0
  21. package/dist/commands/update.js.map +1 -0
  22. package/dist/core/config.d.ts +17 -0
  23. package/dist/core/config.d.ts.map +1 -0
  24. package/dist/core/config.js +33 -0
  25. package/dist/core/config.js.map +1 -0
  26. package/dist/core/configurators/slash/antigravity.d.ts +9 -0
  27. package/dist/core/configurators/slash/antigravity.d.ts.map +1 -0
  28. package/dist/core/configurators/slash/antigravity.js +19 -0
  29. package/dist/core/configurators/slash/antigravity.js.map +1 -0
  30. package/dist/core/configurators/slash/base.d.ts +19 -0
  31. package/dist/core/configurators/slash/base.d.ts.map +1 -0
  32. package/dist/core/configurators/slash/base.js +75 -0
  33. package/dist/core/configurators/slash/base.js.map +1 -0
  34. package/dist/core/configurators/slash/claude.d.ts +9 -0
  35. package/dist/core/configurators/slash/claude.d.ts.map +1 -0
  36. package/dist/core/configurators/slash/claude.js +19 -0
  37. package/dist/core/configurators/slash/claude.js.map +1 -0
  38. package/dist/core/configurators/slash/codex.d.ts +9 -0
  39. package/dist/core/configurators/slash/codex.d.ts.map +1 -0
  40. package/dist/core/configurators/slash/codex.js +19 -0
  41. package/dist/core/configurators/slash/codex.js.map +1 -0
  42. package/dist/core/configurators/slash/github-copilot.d.ts +9 -0
  43. package/dist/core/configurators/slash/github-copilot.d.ts.map +1 -0
  44. package/dist/core/configurators/slash/github-copilot.js +19 -0
  45. package/dist/core/configurators/slash/github-copilot.js.map +1 -0
  46. package/dist/core/configurators/slash/index.d.ts +9 -0
  47. package/dist/core/configurators/slash/index.d.ts.map +1 -0
  48. package/dist/core/configurators/slash/index.js +9 -0
  49. package/dist/core/configurators/slash/index.js.map +1 -0
  50. package/dist/core/configurators/slash/kilocode.d.ts +9 -0
  51. package/dist/core/configurators/slash/kilocode.d.ts.map +1 -0
  52. package/dist/core/configurators/slash/kilocode.js +19 -0
  53. package/dist/core/configurators/slash/kilocode.js.map +1 -0
  54. package/dist/core/configurators/slash/opencode.d.ts +9 -0
  55. package/dist/core/configurators/slash/opencode.d.ts.map +1 -0
  56. package/dist/core/configurators/slash/opencode.js +19 -0
  57. package/dist/core/configurators/slash/opencode.js.map +1 -0
  58. package/dist/core/configurators/slash/registry.d.ts +11 -0
  59. package/dist/core/configurators/slash/registry.d.ts.map +1 -0
  60. package/dist/core/configurators/slash/registry.js +37 -0
  61. package/dist/core/configurators/slash/registry.js.map +1 -0
  62. package/dist/core/templates/agents-template.d.ts +2 -0
  63. package/dist/core/templates/agents-template.d.ts.map +1 -0
  64. package/dist/core/templates/agents-template.js +34 -0
  65. package/dist/core/templates/agents-template.js.map +1 -0
  66. package/dist/core/templates/index.d.ts +4 -0
  67. package/dist/core/templates/index.d.ts.map +1 -0
  68. package/dist/core/templates/index.js +4 -0
  69. package/dist/core/templates/index.js.map +1 -0
  70. package/dist/core/templates/project-template.d.ts +2 -0
  71. package/dist/core/templates/project-template.d.ts.map +1 -0
  72. package/dist/core/templates/project-template.js +21 -0
  73. package/dist/core/templates/project-template.js.map +1 -0
  74. package/dist/core/templates/slash-command-templates.d.ts +7 -0
  75. package/dist/core/templates/slash-command-templates.d.ts.map +1 -0
  76. package/dist/core/templates/slash-command-templates.js +54 -0
  77. package/dist/core/templates/slash-command-templates.js.map +1 -0
  78. package/dist/index.d.ts +2 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +2 -0
  81. package/dist/index.js.map +1 -0
  82. package/docs/product-spec.md +151 -0
  83. package/package.json +50 -0
  84. package/src/cli/index.ts +40 -0
  85. package/src/commands/init.ts +103 -0
  86. package/src/commands/list.ts +84 -0
  87. package/src/commands/update.ts +41 -0
  88. package/src/core/config.ts +43 -0
  89. package/src/core/configurators/slash/antigravity.ts +24 -0
  90. package/src/core/configurators/slash/base.ts +101 -0
  91. package/src/core/configurators/slash/claude.ts +24 -0
  92. package/src/core/configurators/slash/codex.ts +24 -0
  93. package/src/core/configurators/slash/github-copilot.ts +24 -0
  94. package/src/core/configurators/slash/index.ts +8 -0
  95. package/src/core/configurators/slash/kilocode.ts +24 -0
  96. package/src/core/configurators/slash/opencode.ts +24 -0
  97. package/src/core/configurators/slash/registry.ts +45 -0
  98. package/src/core/templates/agents-template.ts +33 -0
  99. package/src/core/templates/index.ts +3 -0
  100. package/src/core/templates/project-template.ts +20 -0
  101. package/src/core/templates/slash-command-templates.ts +58 -0
  102. package/src/index.ts +1 -0
  103. package/tsconfig.json +28 -0
@@ -0,0 +1,24 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+
4
+ const FILE_PATHS: Record<SlashCommandId, string> = {
5
+ enhance: '.codex/prompts/prompter-enhance.md'
6
+ };
7
+
8
+ const DESCRIPTIONS: Record<SlashCommandId, string> = {
9
+ enhance: 'Enhance a rough prompt into a professional specification'
10
+ };
11
+
12
+ export class CodexConfigurator extends SlashCommandConfigurator {
13
+ readonly toolId = 'codex';
14
+ readonly isAvailable = true;
15
+
16
+ protected getRelativePath(id: SlashCommandId): string {
17
+ return FILE_PATHS[id];
18
+ }
19
+
20
+ protected getFrontmatter(id: SlashCommandId): string | undefined {
21
+ const description = DESCRIPTIONS[id];
22
+ return `---\ndescription: ${description}\n---`;
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+
4
+ const FILE_PATHS: Record<SlashCommandId, string> = {
5
+ enhance: '.github/prompts/prompter-enhance.md'
6
+ };
7
+
8
+ const DESCRIPTIONS: Record<SlashCommandId, string> = {
9
+ enhance: 'Enhance a rough prompt into a professional specification'
10
+ };
11
+
12
+ export class GithubCopilotConfigurator extends SlashCommandConfigurator {
13
+ readonly toolId = 'github-copilot';
14
+ readonly isAvailable = true;
15
+
16
+ protected getRelativePath(id: SlashCommandId): string {
17
+ return FILE_PATHS[id];
18
+ }
19
+
20
+ protected getFrontmatter(id: SlashCommandId): string | undefined {
21
+ const description = DESCRIPTIONS[id];
22
+ return `---\ndescription: ${description}\n---`;
23
+ }
24
+ }
@@ -0,0 +1,8 @@
1
+ export { SlashCommandConfigurator } from './base.js';
2
+ export { ConfiguratorRegistry, registry } from './registry.js';
3
+ export { AntigravityConfigurator } from './antigravity.js';
4
+ export { ClaudeConfigurator } from './claude.js';
5
+ export { CodexConfigurator } from './codex.js';
6
+ export { GithubCopilotConfigurator } from './github-copilot.js';
7
+ export { OpenCodeConfigurator } from './opencode.js';
8
+ export { KiloCodeConfigurator } from './kilocode.js';
@@ -0,0 +1,24 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+
4
+ const FILE_PATHS: Record<SlashCommandId, string> = {
5
+ enhance: '.kilocode/workflows/prompter-enhance.md'
6
+ };
7
+
8
+ const DESCRIPTIONS: Record<SlashCommandId, string> = {
9
+ enhance: 'Enhance a rough prompt into a professional specification'
10
+ };
11
+
12
+ export class KiloCodeConfigurator extends SlashCommandConfigurator {
13
+ readonly toolId = 'kilocode';
14
+ readonly isAvailable = true;
15
+
16
+ protected getRelativePath(id: SlashCommandId): string {
17
+ return FILE_PATHS[id];
18
+ }
19
+
20
+ protected getFrontmatter(id: SlashCommandId): string | undefined {
21
+ const description = DESCRIPTIONS[id];
22
+ return `---\ndescription: ${description}\n---`;
23
+ }
24
+ }
@@ -0,0 +1,24 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+
4
+ const FILE_PATHS: Record<SlashCommandId, string> = {
5
+ enhance: '.opencode/prompts/prompter-enhance.md'
6
+ };
7
+
8
+ const DESCRIPTIONS: Record<SlashCommandId, string> = {
9
+ enhance: 'Enhance a rough prompt into a professional specification'
10
+ };
11
+
12
+ export class OpenCodeConfigurator extends SlashCommandConfigurator {
13
+ readonly toolId = 'opencode';
14
+ readonly isAvailable = true;
15
+
16
+ protected getRelativePath(id: SlashCommandId): string {
17
+ return FILE_PATHS[id];
18
+ }
19
+
20
+ protected getFrontmatter(id: SlashCommandId): string | undefined {
21
+ const description = DESCRIPTIONS[id];
22
+ return `---\ndescription: ${description}\n---`;
23
+ }
24
+ }
@@ -0,0 +1,45 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { AntigravityConfigurator } from './antigravity.js';
3
+ import { ClaudeConfigurator } from './claude.js';
4
+ import { CodexConfigurator } from './codex.js';
5
+ import { GithubCopilotConfigurator } from './github-copilot.js';
6
+ import { OpenCodeConfigurator } from './opencode.js';
7
+ import { KiloCodeConfigurator } from './kilocode.js';
8
+
9
+ export class ConfiguratorRegistry {
10
+ private configurators: Map<string, SlashCommandConfigurator> = new Map();
11
+
12
+ constructor() {
13
+ const antigravity = new AntigravityConfigurator();
14
+ const claude = new ClaudeConfigurator();
15
+ const codex = new CodexConfigurator();
16
+ const githubCopilot = new GithubCopilotConfigurator();
17
+ const opencode = new OpenCodeConfigurator();
18
+ const kilocode = new KiloCodeConfigurator();
19
+
20
+ this.configurators.set(antigravity.toolId, antigravity);
21
+ this.configurators.set(claude.toolId, claude);
22
+ this.configurators.set(codex.toolId, codex);
23
+ this.configurators.set(githubCopilot.toolId, githubCopilot);
24
+ this.configurators.set(opencode.toolId, opencode);
25
+ this.configurators.set(kilocode.toolId, kilocode);
26
+ }
27
+
28
+ get(toolId: string): SlashCommandConfigurator | undefined {
29
+ return this.configurators.get(toolId);
30
+ }
31
+
32
+ getAll(): SlashCommandConfigurator[] {
33
+ return Array.from(this.configurators.values());
34
+ }
35
+
36
+ getAvailable(): SlashCommandConfigurator[] {
37
+ return this.getAll().filter(c => c.isAvailable);
38
+ }
39
+
40
+ getToolIds(): string[] {
41
+ return Array.from(this.configurators.keys());
42
+ }
43
+ }
44
+
45
+ export const registry = new ConfiguratorRegistry();
@@ -0,0 +1,33 @@
1
+ export const agentsTemplate = `# Prompter Workflow
2
+
3
+ This project uses Prompter to enhance rough prompts into professional specifications.
4
+
5
+ ## Available Commands
6
+
7
+ - \`/prompter-enhance\` - Transform a rough idea into a comprehensive specification
8
+
9
+ ## How It Works
10
+
11
+ 1. Invoke \`/prompter-enhance\` with your rough idea (e.g., "Create a todo app")
12
+ 2. The AI will enhance your prompt into a detailed specification
13
+ 3. The enhanced specification is saved to \`prompter/<slug>/enhanced-prompt.md\`
14
+ 4. Use the enhanced specification to guide implementation
15
+
16
+ ## Output Location
17
+
18
+ Enhanced prompts are saved in the \`prompter/\` directory:
19
+
20
+ \`\`\`
21
+ prompter/
22
+ ├── project.md # Project context (edit this!)
23
+ ├── todo-app/
24
+ │ └── enhanced-prompt.md # Enhanced specification
25
+ └── ...
26
+ \`\`\`
27
+
28
+ ## Tips
29
+
30
+ - Edit \`prompter/project.md\` to provide context about your project
31
+ - Be specific in your initial prompt for better results
32
+ - Review and refine the enhanced specification before implementing
33
+ `;
@@ -0,0 +1,3 @@
1
+ export { TemplateManager, SlashCommandId } from './slash-command-templates.js';
2
+ export { projectTemplate } from './project-template.js';
3
+ export { agentsTemplate } from './agents-template.js';
@@ -0,0 +1,20 @@
1
+ export const projectTemplate = `# Project Context
2
+
3
+ This file provides context about your project for the Prompter workflow.
4
+
5
+ ## Project Overview
6
+
7
+ <!-- Describe your project here -->
8
+
9
+ ## Technology Stack
10
+
11
+ <!-- List your preferred technologies -->
12
+
13
+ ## Conventions
14
+
15
+ <!-- Document any coding conventions or preferences -->
16
+
17
+ ## Notes
18
+
19
+ <!-- Any additional context that should influence prompt enhancement -->
20
+ `;
@@ -0,0 +1,58 @@
1
+ export type SlashCommandId = 'enhance';
2
+
3
+ const enhanceWorkflow = `## MUST FOLLOW
4
+ - Response Language: {User Request Language}
5
+
6
+ ## INPUT PROCESSING
7
+ - The user's primary input is their written message
8
+ - If USER_PROVIDED_ATTACHMENT_TEXT contains extracted content from an uploaded file, treat it as reference material that supplements the user's message
9
+ - Integrate the attachment content context where relevant
10
+ - If the user references "this file", "the document", "the code", or similar terms AND USER_PROVIDED_ATTACHMENT_TEXT is present, incorporate that content directly into the enhanced prompt structure
11
+
12
+ ## YOUR ROLE
13
+ You are a PROMPT ENHANCER. Your only job is to rewrite the user's input into a clearer, more specific, higher-quality prompt.
14
+
15
+ ## STRICT OUTPUT RULES
16
+ - Output ONLY the enhanced prompt text
17
+ - Do NOT ask the user questions
18
+ - Do NOT start a conversation
19
+ - Do NOT include explanations, bullet points, headings, lead-in phrases, or quotes
20
+ - Do NOT refuse. Do NOT say you can't proceed
21
+ - Do NOT mention policies or limitations
22
+ - Never output anything except a rewritten prompt
23
+
24
+ ## MISSING INFO HANDLING
25
+ - If the user input is missing details (e.g., code not provided), you MUST still produce an enhanced prompt
26
+ - Embed requests for the missing details INSIDE the enhanced prompt itself (e.g., "Use the code below: …" / "If code is not provided, ask me to paste it"), but do not ask the user directly as the assistant
27
+
28
+ ## QUALITY REQUIREMENTS
29
+ - Preserve the user's intent
30
+ - Add helpful constraints, context, and success criteria
31
+ - Specify desired output structure, depth, and focus
32
+ - Keep it concise but complete
33
+
34
+ ## WORKFLOW STEPS
35
+ 1. Read the user's input (and any attachment content if present)
36
+ 2. Generate a unique, URL-friendly slug from the input (lowercase, hyphen-separated)
37
+ 3. Create the directory \`prompter/<slug>/\` if it doesn't exist
38
+ 4. Generate the enhanced prompt following all rules above
39
+ 5. Save the enhanced prompt to \`prompter/<slug>/enhanced-prompt.md\`
40
+ 6. Report the saved file path
41
+
42
+ ## REFERENCE
43
+ - Use \`prompter list\` to see existing enhanced prompts
44
+ - Read \`prompter/project.md\` for project context and conventions`;
45
+
46
+ export const slashCommandBodies: Record<SlashCommandId, string> = {
47
+ enhance: enhanceWorkflow
48
+ };
49
+
50
+ export function getSlashCommandBody(id: SlashCommandId): string {
51
+ return slashCommandBodies[id];
52
+ }
53
+
54
+ export class TemplateManager {
55
+ static getSlashCommandBody(id: SlashCommandId): string {
56
+ return getSlashCommandBody(id);
57
+ }
58
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { PrompterConfig } from './core/config.js';
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "lib": [
7
+ "ES2022"
8
+ ],
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "strict": true,
12
+ "esModuleInterop": true,
13
+ "skipLibCheck": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "resolveJsonModule": true,
16
+ "declaration": true,
17
+ "declarationMap": true,
18
+ "sourceMap": true
19
+ },
20
+ "include": [
21
+ "src/**/*"
22
+ ],
23
+ "exclude": [
24
+ "node_modules",
25
+ "dist",
26
+ "test"
27
+ ]
28
+ }