pupt 1.4.0 → 2.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 (152) hide show
  1. package/dist/cli.js +124 -38
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/add.d.ts.map +1 -1
  4. package/dist/commands/add.js +15 -49
  5. package/dist/commands/add.js.map +1 -1
  6. package/dist/commands/config.d.ts +9 -0
  7. package/dist/commands/config.d.ts.map +1 -0
  8. package/dist/commands/config.js +120 -0
  9. package/dist/commands/config.js.map +1 -0
  10. package/dist/commands/edit.d.ts.map +1 -1
  11. package/dist/commands/edit.js +4 -3
  12. package/dist/commands/edit.js.map +1 -1
  13. package/dist/commands/history.d.ts.map +1 -1
  14. package/dist/commands/history.js +14 -15
  15. package/dist/commands/history.js.map +1 -1
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +20 -45
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/install.d.ts +6 -0
  20. package/dist/commands/install.d.ts.map +1 -1
  21. package/dist/commands/install.js +52 -6
  22. package/dist/commands/install.js.map +1 -1
  23. package/dist/commands/migrate.d.ts +22 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +92 -0
  26. package/dist/commands/migrate.js.map +1 -0
  27. package/dist/commands/run.d.ts.map +1 -1
  28. package/dist/commands/run.js +13 -77
  29. package/dist/commands/run.js.map +1 -1
  30. package/dist/config/config-manager.d.ts +9 -0
  31. package/dist/config/config-manager.d.ts.map +1 -1
  32. package/dist/config/config-manager.js +70 -64
  33. package/dist/config/config-manager.js.map +1 -1
  34. package/dist/config/migration.d.ts.map +1 -1
  35. package/dist/config/migration.js +52 -16
  36. package/dist/config/migration.js.map +1 -1
  37. package/dist/history/history-manager.js +1 -1
  38. package/dist/history/history-manager.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +2 -2
  42. package/dist/index.js.map +1 -1
  43. package/dist/schemas/config-schema.d.ts +522 -260
  44. package/dist/schemas/config-schema.d.ts.map +1 -1
  45. package/dist/schemas/config-schema.js +38 -22
  46. package/dist/schemas/config-schema.js.map +1 -1
  47. package/dist/schemas/prompt-schema.d.ts +115 -115
  48. package/dist/search/search-engine.d.ts.map +1 -1
  49. package/dist/search/search-engine.js +2 -1
  50. package/dist/search/search-engine.js.map +1 -1
  51. package/dist/services/input-collector.d.ts +9 -0
  52. package/dist/services/input-collector.d.ts.map +1 -0
  53. package/dist/services/input-collector.js +154 -0
  54. package/dist/services/input-collector.js.map +1 -0
  55. package/dist/services/prompt-converter.d.ts +27 -0
  56. package/dist/services/prompt-converter.d.ts.map +1 -0
  57. package/dist/services/prompt-converter.js +383 -0
  58. package/dist/services/prompt-converter.js.map +1 -0
  59. package/dist/services/prompt-resolver.d.ts +32 -0
  60. package/dist/services/prompt-resolver.d.ts.map +1 -0
  61. package/dist/services/prompt-resolver.js +71 -0
  62. package/dist/services/prompt-resolver.js.map +1 -0
  63. package/dist/services/pupt-service.d.ts +47 -0
  64. package/dist/services/pupt-service.d.ts.map +1 -0
  65. package/dist/services/pupt-service.js +252 -0
  66. package/dist/services/pupt-service.js.map +1 -0
  67. package/dist/services/review-data-builder.d.ts +1 -1
  68. package/dist/services/review-data-builder.d.ts.map +1 -1
  69. package/dist/services/review-data-builder.js +13 -9
  70. package/dist/services/review-data-builder.js.map +1 -1
  71. package/dist/types/config.d.ts +62 -12
  72. package/dist/types/config.d.ts.map +1 -1
  73. package/dist/types/config.js +1 -7
  74. package/dist/types/config.js.map +1 -1
  75. package/dist/types/prompt.d.ts +6 -0
  76. package/dist/types/prompt.d.ts.map +1 -1
  77. package/dist/types/prompt.js +23 -1
  78. package/dist/types/prompt.js.map +1 -1
  79. package/dist/utils/errors.js +1 -1
  80. package/dist/utils/errors.js.map +1 -1
  81. package/dist/utils/path-utils.d.ts +42 -0
  82. package/dist/utils/path-utils.d.ts.map +1 -0
  83. package/dist/utils/path-utils.js +139 -0
  84. package/dist/utils/path-utils.js.map +1 -0
  85. package/dist/utils/prompt-format.d.ts +27 -0
  86. package/dist/utils/prompt-format.d.ts.map +1 -0
  87. package/dist/utils/prompt-format.js +28 -0
  88. package/dist/utils/prompt-format.js.map +1 -0
  89. package/package.json +3 -3
  90. package/prompts/ad-hoc-long.prompt +60 -0
  91. package/prompts/ad-hoc.prompt +32 -0
  92. package/prompts/add-summary.prompt +48 -0
  93. package/prompts/code-review.prompt +103 -0
  94. package/prompts/debugging-error-message.prompt +81 -0
  95. package/prompts/fix-github-actions.prompt +60 -0
  96. package/prompts/fix-test-errors.prompt +71 -0
  97. package/prompts/git-commit-comment.prompt +59 -0
  98. package/prompts/implementation-phase.prompt +57 -0
  99. package/prompts/implementation-plan.prompt +105 -0
  100. package/prompts/new-feature.prompt +93 -0
  101. package/prompts/new-project.prompt +9 -0
  102. package/prompts/one-shot-change.prompt +77 -0
  103. package/prompts/pupt-prompt-improvement.prompt +265 -0
  104. package/prompts/simple-test.prompt +8 -0
  105. package/prompts/update-design.prompt +75 -0
  106. package/prompts/update-documentation.prompt +6 -0
  107. package/dist/prompts/prompt-manager.d.ts +0 -12
  108. package/dist/prompts/prompt-manager.d.ts.map +0 -1
  109. package/dist/prompts/prompt-manager.js +0 -102
  110. package/dist/prompts/prompt-manager.js.map +0 -1
  111. package/dist/services/auto-annotation-service.d.ts +0 -40
  112. package/dist/services/auto-annotation-service.d.ts.map +0 -1
  113. package/dist/services/auto-annotation-service.js +0 -439
  114. package/dist/services/auto-annotation-service.js.map +0 -1
  115. package/dist/services/prompt-service.d.ts +0 -31
  116. package/dist/services/prompt-service.d.ts.map +0 -1
  117. package/dist/services/prompt-service.js +0 -278
  118. package/dist/services/prompt-service.js.map +0 -1
  119. package/dist/template/helpers/index.d.ts +0 -4
  120. package/dist/template/helpers/index.d.ts.map +0 -1
  121. package/dist/template/helpers/index.js +0 -156
  122. package/dist/template/helpers/index.js.map +0 -1
  123. package/dist/template/template-context.d.ts +0 -32
  124. package/dist/template/template-context.d.ts.map +0 -1
  125. package/dist/template/template-context.js +0 -81
  126. package/dist/template/template-context.js.map +0 -1
  127. package/dist/template/template-engine.d.ts +0 -14
  128. package/dist/template/template-engine.d.ts.map +0 -1
  129. package/dist/template/template-engine.js +0 -85
  130. package/dist/template/template-engine.js.map +0 -1
  131. package/dist/utils/handlebars-extensions.d.ts +0 -4
  132. package/dist/utils/handlebars-extensions.d.ts.map +0 -1
  133. package/dist/utils/handlebars-extensions.js +0 -87
  134. package/dist/utils/handlebars-extensions.js.map +0 -1
  135. package/prompts/ad-hoc-long.md +0 -52
  136. package/prompts/ad-hoc.md +0 -23
  137. package/prompts/add-summary.md +0 -42
  138. package/prompts/analyze-execution.md +0 -181
  139. package/prompts/code-review.md +0 -97
  140. package/prompts/debugging-error-message.md +0 -75
  141. package/prompts/fix-github-actions.md +0 -55
  142. package/prompts/fix-test-errors.md +0 -66
  143. package/prompts/git-commit-comment.md +0 -54
  144. package/prompts/implementation-phase.md +0 -46
  145. package/prompts/implementation-plan.md +0 -89
  146. package/prompts/new-feature.md +0 -80
  147. package/prompts/new-project.md +0 -11
  148. package/prompts/one-shot-change.md +0 -71
  149. package/prompts/pupt-prompt-improvement.md +0 -264
  150. package/prompts/simple-test.md +0 -11
  151. package/prompts/update-design.md +0 -68
  152. package/prompts/update-documentation.md +0 -8
@@ -1,85 +0,0 @@
1
- import Handlebars from 'handlebars';
2
- import { TemplateContext } from './template-context.js';
3
- import { registerHelpers } from './helpers/index.js';
4
- import { loadHandlebarsExtensions } from '../utils/handlebars-extensions.js';
5
- export class TemplateEngine {
6
- handlebars;
7
- context;
8
- config;
9
- configDir;
10
- noInteractive;
11
- constructor(config, configDir, noInteractive = false) {
12
- this.handlebars = Handlebars.create();
13
- this.context = new TemplateContext();
14
- this.config = config;
15
- this.configDir = configDir;
16
- this.noInteractive = noInteractive;
17
- }
18
- async processTemplate(template, prompt) {
19
- // Create new context with variable definitions
20
- this.context = new TemplateContext(prompt.variables, this.noInteractive);
21
- // Create a special Handlebars instance that has access to the context
22
- this.handlebars = Handlebars.create();
23
- // Load Handlebars extensions from config
24
- if (this.config?.handlebarsExtensions) {
25
- await loadHandlebarsExtensions(this.handlebars, this.config.handlebarsExtensions, this.configDir);
26
- }
27
- // Register helpers with context
28
- registerHelpers(this.handlebars, this.context);
29
- // Pre-process template to extract and protect raw blocks
30
- const rawBlocks = [];
31
- let rawIndex = 0;
32
- // Extract content from {{#raw}}...{{/raw}} blocks before Handlebars processes them
33
- template = template.replace(/{{#raw}}([\s\S]*?){{\/raw}}/g, (match, content) => {
34
- const placeholder = `__RAW_BLOCK_${rawIndex++}__`;
35
- rawBlocks.push({ placeholder, content });
36
- return placeholder;
37
- });
38
- // Phase 1: Replace variable references with temporary placeholders
39
- // to prevent them from being processed before values are available
40
- const varPattern = /\{\{([^{}\s]+)\}\}/g;
41
- const inputHelperPattern = /\{\{(input|select|multiselect|confirm|editor|password)\s+[^}]+\}\}/g;
42
- // Store variable references to restore later
43
- const variableRefs = [];
44
- let tempTemplate = template;
45
- let varIndex = 0;
46
- // Replace non-helper variable references with placeholders
47
- tempTemplate = tempTemplate.replace(varPattern, (match, varName) => {
48
- // Check if this is a helper call
49
- if (match.match(inputHelperPattern)) {
50
- return match; // Keep helper calls as-is
51
- }
52
- const placeholder = `__VAR_${varIndex++}__`;
53
- variableRefs.push({ placeholder, variable: varName });
54
- return placeholder;
55
- });
56
- // Phase 2: Process helpers with the temporary template
57
- const compiled = this.handlebars.compile(tempTemplate, { noEscape: true });
58
- let result = compiled({});
59
- // Process async operations (input helpers)
60
- result = await this.context.processAsyncOperations(result);
61
- // Phase 3: Restore variable references
62
- for (const ref of variableRefs) {
63
- result = result.replace(ref.placeholder, `{{${ref.variable}}}`);
64
- }
65
- // Phase 4: Final compilation with all values available
66
- const finalCompiled = this.handlebars.compile(result, { noEscape: true });
67
- const contextData = {};
68
- // Add all collected values to context data
69
- for (const [key, value] of this.context.getAllValues()) {
70
- contextData[key] = value;
71
- }
72
- let finalResult = finalCompiled(contextData);
73
- // Restore raw blocks
74
- for (const block of rawBlocks) {
75
- finalResult = finalResult.replace(block.placeholder, block.content);
76
- }
77
- // Restore escaped Handlebars syntax from user input
78
- finalResult = finalResult.replace(/__ESCAPED_OPEN__/g, '{{').replace(/__ESCAPED_CLOSE__/g, '}}');
79
- return finalResult;
80
- }
81
- getContext() {
82
- return this.context;
83
- }
84
- }
85
- //# sourceMappingURL=template-engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-engine.js","sourceRoot":"","sources":["../../src/template/template-engine.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,MAAM,OAAO,cAAc;IACjB,UAAU,CAAoB;IAC9B,OAAO,CAAkB;IACzB,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,aAAa,CAAU;IAE/B,YAAY,MAAe,EAAE,SAAkB,EAAE,aAAa,GAAG,KAAK;QACpE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,QAAgB,EAAE,MAAuB;QAC7D,+CAA+C;QAC/C,IAAI,CAAC,OAAO,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAEzE,sEAAsE;QACtE,IAAI,CAAC,UAAU,GAA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mBAAmB,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;QAEjG,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
@@ -1,4 +0,0 @@
1
- import type { HandlebarsExtensionConfig } from '../types/config.js';
2
- import type Handlebars from 'handlebars';
3
- export declare function loadHandlebarsExtensions(handlebars: typeof Handlebars, extensions: HandlebarsExtensionConfig[], configDir?: string): Promise<void>;
4
- //# sourceMappingURL=handlebars-extensions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlebars-extensions.d.ts","sourceRoot":"","sources":["../../src/utils/handlebars-extensions.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,YAAY,CAAC;AAEzC,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,OAAO,UAAU,EAC7B,UAAU,EAAE,yBAAyB,EAAE,EACvC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -1,87 +0,0 @@
1
- import * as vm from 'node:vm';
2
- import * as path from 'node:path';
3
- import { promises as fs } from 'node:fs';
4
- export async function loadHandlebarsExtensions(handlebars, extensions, configDir) {
5
- for (const extension of extensions) {
6
- await loadSingleExtension(handlebars, extension, configDir);
7
- }
8
- }
9
- async function loadSingleExtension(handlebars, config, configDir) {
10
- if (config.type === 'inline') {
11
- await loadInlineExtension(handlebars, config);
12
- }
13
- else if (config.type === 'file') {
14
- await loadFileExtension(handlebars, config, configDir);
15
- }
16
- else {
17
- throw new Error(`Invalid extension type: ${config.type || 'unknown'}`);
18
- }
19
- }
20
- async function loadInlineExtension(handlebars, config) {
21
- if (!config.value) {
22
- throw new Error('Inline extension value is required');
23
- }
24
- // Create a sandboxed context for executing the inline code
25
- const sandbox = {
26
- Handlebars: handlebars,
27
- console: console, // Allow console for debugging
28
- require: createSafeRequire()
29
- };
30
- try {
31
- // Create a new context for the sandbox
32
- const context = vm.createContext(sandbox);
33
- // Run the code with a timeout
34
- vm.runInContext(config.value, context, {
35
- timeout: 5000, // 5 second timeout
36
- displayErrors: true
37
- });
38
- }
39
- catch (error) {
40
- const message = error instanceof Error ? error.message : String(error);
41
- throw new Error(`Failed to load inline Handlebars extension: ${message}`);
42
- }
43
- }
44
- // Create a safe require function that blocks dangerous modules
45
- function createSafeRequire() {
46
- return (id) => {
47
- const blockedModules = ['fs', 'child_process', 'net', 'http', 'https', 'os', 'path', 'crypto'];
48
- if (blockedModules.includes(id)) {
49
- throw new Error(`Module '${id}' is not allowed in inline extensions`);
50
- }
51
- throw new Error(`require() is not available in inline extensions`);
52
- };
53
- }
54
- async function loadFileExtension(handlebars, config, configDir) {
55
- if (!config.path) {
56
- throw new Error('File extension path is required');
57
- }
58
- // Resolve path relative to config directory if provided
59
- const extensionPath = configDir
60
- ? path.resolve(configDir, config.path)
61
- : path.resolve(config.path);
62
- try {
63
- // Check if file exists
64
- await fs.access(extensionPath);
65
- }
66
- catch {
67
- throw new Error(`Extension file not found: ${extensionPath}`);
68
- }
69
- try {
70
- // Use dynamic import for ESM compatibility
71
- const extensionModule = await import(extensionPath);
72
- const extension = extensionModule.default || extensionModule;
73
- if (typeof extension !== 'function') {
74
- throw new Error(`Extension file must export a function, got ${typeof extension}`);
75
- }
76
- // Call the extension function with Handlebars instance
77
- await extension(handlebars);
78
- }
79
- catch (error) {
80
- if (error instanceof Error && error.message.includes('Extension file must export')) {
81
- throw error;
82
- }
83
- const message = error instanceof Error ? error.message : String(error);
84
- throw new Error(`Failed to load file Handlebars extension: ${message}`);
85
- }
86
- }
87
- //# sourceMappingURL=handlebars-extensions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlebars-extensions.js","sourceRoot":"","sources":["../../src/utils/handlebars-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,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AM,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,6BAA6B,aAAa,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,CAAC;QACH,2CAA2C;QAC3C,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACpD,MAAM,SAAS,GAAG,eAAe,CAAC,OAAO,IAAI,eAAe,CAAC;QAE7D,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,8CAA8C,OAAO,SAAS,EAAE,CAAC,CAAC;QACpF,CAAC;QAED,uDAAuD;QACvD,MAAM,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,CAAC;YACnF,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,6CAA6C,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC"}
@@ -1,52 +0,0 @@
1
- ---
2
- title: Ad Hoc (Long)
3
- author: Adam Powers <apowers@ato.ms>
4
- creationDate: 20250816
5
- tags: []
6
- ---
7
-
8
- **Role & Context**: You are a versatile expert assistant capable of handling complex, multi-part requests that require detailed analysis, planning, or implementation.
9
-
10
- **Objective**: Address the comprehensive request below with appropriate depth and thoroughness.
11
-
12
- **Specific Requirements**:
13
- - Read the entire request before beginning response
14
- - Identify all sub-tasks and requirements
15
- - Create a prioritized task list focusing on the MAIN objective
16
- - For debugging tasks:
17
- - Stay focused on the specific issue reported
18
- - Follow a systematic process without getting sidetracked
19
- - Fix the reported issue FIRST before exploring related problems
20
- - Verify the fix resolves the original issue
21
- - Organize response to address each part clearly
22
- - Use appropriate formatting and structure
23
- - Provide comprehensive solutions
24
-
25
- **Format & Structure**: Organize response based on request type:
26
- - For multi-part questions: Address each part with clear sections
27
- - For analysis tasks: Use structured findings and recommendations
28
- - For implementation tasks: Provide step-by-step approach
29
- - For debugging:
30
- 1. State the specific issue to be fixed
31
- 2. Reproduce the issue exactly as described
32
- 3. Identify root cause through systematic investigation
33
- 4. Apply targeted fix for that specific issue
34
- 5. Verify the original issue is resolved
35
- 6. Only then address related issues if requested
36
-
37
- **Complex Request**:
38
- {{editor "prompt"}}
39
-
40
- **Examples**: N/A (varies by request type)
41
-
42
- **Constraints**:
43
- - Maintain focus on the specific request
44
- - Balance thoroughness with clarity
45
- - Use examples and code samples where helpful
46
- - Flag any assumptions or uncertainties
47
-
48
- **Success Criteria**:
49
- - All parts of the request are addressed
50
- - Response is well-organized and easy to follow
51
- - Solutions are practical and implementable
52
- - Any edge cases or considerations are noted
package/prompts/ad-hoc.md DELETED
@@ -1,23 +0,0 @@
1
- ---
2
- title: Ad Hoc
3
- author: Adam Powers <apowers@ato.ms>
4
- creationDate: 20250814
5
- tags: []
6
- ---
7
-
8
- **Role & Context**: You are a versatile AI assistant capable of handling various technical and non-technical tasks. Adapt your expertise based on the specific request.
9
-
10
- **Objective**: {{input "prompt"}}
11
-
12
- **Specific Requirements**:
13
- - Provide accurate, helpful, and actionable responses
14
- - If the task is ambiguous, ask clarifying questions before proceeding
15
- - Use appropriate formatting (code blocks, lists, tables) based on content type
16
-
17
- **Format & Structure**: Match the response format to the task type - use structured output for technical tasks, narrative for explanations, and step-by-step instructions for procedures.
18
-
19
- **Examples**: N/A (varies by request)
20
-
21
- **Constraints**: Stay focused on the specific request without adding unnecessary information unless it directly supports the main objective.
22
-
23
- **Success Criteria**: The response directly addresses the user's request with appropriate depth and format for the task at hand.
@@ -1,42 +0,0 @@
1
- ---
2
- title: Update Prompt Summary
3
- summary: Update summary field in {{file "prompt"}} for better history display
4
- variables:
5
- - name: prompt
6
- type: file
7
- message: "Select the prompt file to update"
8
- filter: "*.md"
9
- basePath: "."
10
- ---
11
-
12
- **Role & Context**: You are an expert at creating concise, informative summaries for prompt templates. You understand YAML frontmatter and Handlebars templating.
13
-
14
- **Objective**: Add or update the summary field for the following prompt file to improve its display in `pt history`.
15
-
16
- ## Current Prompt File:
17
- {{file "prompt"}}
18
-
19
- **Specific Requirements**:
20
- - Create a single-line summary that clearly describes what the prompt does
21
- - Use Handlebars syntax to reference variables from the prompt (e.g., `{{file "design"}}`, `{{reviewFile "output"}}`)
22
- - Keep the summary under 80 characters for optimal display
23
- - Focus on the action/outcome rather than implementation details
24
- - Preserve all existing frontmatter fields when updating
25
-
26
- **Format & Structure**:
27
- - If the file already has a `summary:` field, replace it with the new one
28
- - If the file has frontmatter but no summary, add the `summary:` field to it
29
- - If the file lacks frontmatter, create a minimal frontmatter section with at least title and summary
30
- - Output the complete updated file content that can be directly saved
31
-
32
- **Examples**:
33
- - `summary: Create React component {{input "name"}} with tests`
34
- - `summary: Review {{file "code"}} and suggest improvements`
35
- - `summary: Generate API client for {{select "service"}} using {{select "language"}}`
36
-
37
- **Constraints**:
38
- - Maintain the exact formatting and structure of the existing file
39
- - Only modify the frontmatter section
40
- - Ensure the summary accurately reflects the prompt's purpose
41
-
42
- **Success Criteria**: The updated prompt file should have a clear, concise summary that will be displayed in `pt history` output.
@@ -1,181 +0,0 @@
1
- ---
2
- title: Analyze Prompt Execution
3
- description: Automatically analyze prompt execution output to extract structured annotation data
4
- author: AI Analysis System
5
- tags: [auto-annotation, analysis]
6
- ---
7
-
8
- **Role & Context**: You are an expert AI conversation analyst specializing in intent extraction and alignment validation. You analyze AI execution transcripts to determine if the AI truly understood and fulfilled the user's intent, not just completed surface-level tasks.
9
-
10
- **Objective**: Extract the user's true intent from their prompt, then analyze whether the AI's execution aligned with that intent, regardless of technical success metrics.
11
-
12
- **Critical First Step - Intent Extraction**:
13
-
14
- Carefully analyze the user's prompt to extract:
15
-
16
- 1. **Explicit Goals**: What the user directly asked for
17
- 2. **Contextual Requirements**: HOW they want it done (look for phrases like "make sure", "important", "before doing X")
18
- 3. **Constraints**: What NOT to do (look for "never", "don't", "avoid", "instead of")
19
- 4. **Underlying Problem**: What problem is the user actually trying to solve?
20
- 5. **Implicit Expectations**: What would a human understand from context that isn't explicitly stated?
21
-
22
- Pay special attention to:
23
- - "IMPORTANT", "CRITICAL", "MANDATORY" - these signal key requirements
24
- - Conditional instructions ("if X then Y")
25
- - Context about recent changes or intentional modifications
26
- - The difference between fixing symptoms vs root causes
27
-
28
- **Second Step - AI Understanding Analysis**:
29
-
30
- Examine the AI's responses for evidence it understood the intent:
31
- - Did it acknowledge the context and constraints?
32
- - Did it explain its understanding of the task?
33
- - Did it mention why it chose a particular approach?
34
- - Did it recognize conditional requirements?
35
-
36
- Red flags for misunderstanding:
37
- - Jumping straight to implementation without acknowledging context
38
- - No mention of constraints or special requirements
39
- - Treating all instructions as equally important
40
- - Missing the "why" behind the request
41
-
42
- **Third Step - Intent Alignment Validation**:
43
-
44
- Compare the AI's actions against extracted intent:
45
-
46
- **ALIGNED**:
47
- - AI's approach matches user's intended method
48
- - Constraints and requirements were respected
49
- - The underlying problem was addressed, not just symptoms
50
- - Context was properly considered
51
-
52
- **MISALIGNED**:
53
- - AI solved a different problem than intended
54
- - Explicit constraints were violated
55
- - The approach contradicts the user's context
56
- - Technical success but semantic failure
57
-
58
- **Success Criteria (Intent-Based)**:
59
-
60
- - **SUCCESS**: AI understood and fulfilled the user's actual intent
61
- - **PARTIAL**: AI partially understood but missed some aspects of intent
62
- - **FAILURE**: AI misunderstood intent or violated key constraints
63
-
64
- **Analysis Process**:
65
-
66
- 1. **Extract Intent** - What did the user REALLY want?
67
- 2. **Analyze Understanding** - Did the AI grasp the intent?
68
- 3. **Validate Alignment** - Did actions match intent?
69
- 4. **Identify Gaps** - Where did alignment fail?
70
- 5. **Assess Severity** - How badly did it miss the mark?
71
- 6. **Detect user redirects and off-track execution**
72
-
73
- **User Redirect Detection Patterns**:
74
-
75
- Look for these phrases from users that indicate redirection:
76
- - "No, I meant..." / "Actually, I meant..."
77
- - "Wait, why are you..." / "What are you doing?"
78
- - "Not that, I want..." / "That's not what I asked for"
79
- - Multiple rapid user inputs (indicates confusion)
80
- - "Wrong [file/folder/approach]"
81
- - "Stop" / "Hold on" / "Let me clarify"
82
-
83
- **Off-Track Execution Patterns**:
84
-
85
- Look for AI behaviors that indicate deviation:
86
- - Analyzing unrelated systems when asked about specific components
87
- - Implementing different technology than requested
88
- - Working in wrong directories or files
89
- - Performing extensive analysis when asked for simple tasks
90
- - User having to repeat or rephrase instructions
91
-
92
- **Issue Categories** (in order of severity):
93
-
94
- 1. **intent_not_understood**: AI fundamentally misunderstood what user wanted
95
- - Evidence: AI does opposite of request, ignores core requirement
96
-
97
- 2. **constraint_violated**: AI understood goal but violated explicit constraints
98
- - Evidence: User said "don't do X" but AI did X
99
-
100
- 3. **wrong_approach**: AI understood goal but used inappropriate method
101
- - Evidence: User wanted tests updated, AI changed implementation
102
-
103
- 4. **context_ignored**: AI missed critical contextual information
104
- - Evidence: User mentioned "feature was removed" but AI reimplemented it
105
-
106
- 5. **partial_intent**: Only part of the user's intent was addressed
107
- - Evidence: Multiple requirements but only some fulfilled
108
-
109
- 6. **assumption_mismatch**: AI made assumptions that conflicted with user's intent
110
- - Evidence: AI assumed user wanted one thing when context indicated another
111
-
112
- 7. **verification_gap**: Missing tests/verification (DEVELOPMENT TASKS ONLY)
113
- - Evidence: No verification after code changes
114
-
115
- 8. **user_redirect**: User had to correct or redirect the AI's approach
116
- - Evidence: User intervention required to get back on track
117
-
118
- 9. **off_track_execution**: AI deviated without correction
119
- - Evidence: Working on wrong files/systems
120
-
121
- **Output Format**: Return ONLY this JSON structure:
122
-
123
- ```json
124
- {
125
- "status": "success|partial|failure",
126
- "intent_summary": "What the user actually wanted to achieve",
127
- "alignment_assessment": "Brief explanation of whether AI met the intent",
128
- "structured_outcome": {
129
- "explicit_goals_met": <number>,
130
- "explicit_goals_total": <number>,
131
- "constraints_respected": <boolean>,
132
- "context_considered": <boolean>,
133
- "approach_aligned": <boolean>,
134
- "execution_time": "<duration>"
135
- },
136
- "issues_identified": [
137
- {
138
- "category": "intent_not_understood|constraint_violated|wrong_approach|context_ignored|partial_intent|assumption_mismatch|verification_gap|user_redirect|off_track_execution",
139
- "severity": "low|medium|high|critical",
140
- "description": "How the AI's actions diverged from user intent",
141
- "evidence": "Specific quote showing the misalignment"
142
- }
143
- ]
144
- }
145
- ```
146
-
147
- **Example Analysis**:
148
-
149
- User prompt: "Fix all test errors. IMPORTANT: Check if tests are failing because features were intentionally removed - if so, update the tests, don't reimplement the features."
150
-
151
- AI action: Reimplemented removed features to make tests pass
152
-
153
- Analysis:
154
- ```json
155
- {
156
- "status": "failure",
157
- "intent_summary": "Fix test errors by updating tests to match intentionally removed features, not by reimplementing features",
158
- "alignment_assessment": "AI completely violated the core constraint by reimplementing removed features instead of updating tests",
159
- "structured_outcome": {
160
- "explicit_goals_met": 1,
161
- "explicit_goals_total": 1,
162
- "constraints_respected": false,
163
- "context_considered": false,
164
- "approach_aligned": false,
165
- "execution_time": "487s"
166
- },
167
- "issues_identified": [{
168
- "category": "constraint_violated",
169
- "severity": "critical",
170
- "description": "AI reimplemented removed features despite explicit instruction to update tests instead",
171
- "evidence": "Removed .txt file creation from OutputCaptureService - Now only creates JSON files"
172
- }]
173
- }
174
- ```
175
-
176
- **CRITICAL RULES**:
177
- - Focus on INTENT, not just task completion
178
- - Technical success with intent failure = FAILURE
179
- - Always extract implicit requirements from context
180
- - A perfectly executing AI that solves the wrong problem has failed
181
- - Return ONLY the JSON, no other text
@@ -1,97 +0,0 @@
1
- ---
2
- title: Code Review
3
- author: Adam Powers <apowers@ato.ms>
4
- creationDate: 20250815
5
- tags: []
6
- ---
7
-
8
- **Role & Context**: You are a meticulous code reviewer with expertise in identifying both human and AI-generated code issues, focusing on maintainability, correctness, and common LLM coding mistakes.
9
-
10
- **Objective**: Perform a comprehensive multi-pass code review identifying issues and improvement opportunities. Write the code review to {{reviewFile "outputFile"}}.
11
-
12
- **Specific Requirements**:
13
- - **Pass 1 - Critical Issues**: Security, correctness, data loss risks
14
- - **Pass 2 - Code Quality**:
15
- {{editor "codeReviewConcerns"}}
16
- - **Pass 3 - LLM-Specific Issues**:
17
- - Hallucinated APIs or methods that don't exist
18
- - Incorrect error handling patterns
19
- - Overly complex solutions to simple problems
20
- - Inconsistent code style within same file
21
- - Copy-paste errors and duplicated logic
22
- - Missing edge case handling
23
-
24
- - Create file inventory first, categorizing files as:
25
- - Production code (src/)
26
- - Test code (test/, *.test.*, *.spec.*)
27
- - Configuration (config files, build scripts)
28
- - Apply different standards based on file type:
29
- - Production code: Strict type safety, no 'any' types
30
- - Test code: 'any' types acceptable for mocks, relaxed standards
31
- - Configuration: Focus on security and correctness
32
- - For each issue found:
33
- - Verify it's a real issue considering the file context
34
- - Assess actual impact on system
35
- - Provide specific fix with code example
36
- - Group similar issues for batch remediation
37
-
38
- **Format & Structure**:
39
- ```markdown
40
- # Code Review Report - {{date}}
41
-
42
- ## Executive Summary
43
- - Files reviewed: X
44
- - Critical issues: X
45
- - High priority issues: X
46
- - Medium priority issues: X
47
- - Low priority issues: X
48
-
49
- ## Critical Issues (Fix Immediately)
50
- ### 1. [Issue Title]
51
- - **Files**: [List affected files]
52
- - **Description**: [What and why it's critical]
53
- - **Example**: `path/to/file.js:123`
54
- ```javascript
55
- // Problem code
56
- ```
57
- - **Fix**:
58
- ```javascript
59
- // Corrected code
60
- ```
61
-
62
- ## High Priority Issues (Fix Soon)
63
- [Same format as critical]
64
-
65
- ## Medium Priority Issues (Technical Debt)
66
- [Same format, grouped by theme]
67
-
68
- ## Low Priority Issues (Nice to Have)
69
- [Brief list with file references]
70
-
71
- ## Positive Findings
72
- - [Good patterns to replicate elsewhere]
73
-
74
- ## Recommendations
75
- 1. [Highest impact improvement]
76
- 2. [Next priority]
77
- ...
78
- ```
79
-
80
- **Examples**: Included in format above
81
-
82
- **Constraints**:
83
- - Don't flag test utilities for production code issues
84
- - Test files have different standards: 'any' types, mocks, and test helpers are acceptable
85
- - Consider project conventions before suggesting changes
86
- - Check if the issue is actually problematic in its context
87
- - Focus on measurable improvements
88
- - Distinguish must-fix from nice-to-have
89
- - CRITICAL: Don't recommend unnecessary libraries - check if existing solutions work first
90
-
91
- **Success Criteria**:
92
- - All significant issues caught and correctly prioritized
93
- - Fixes are specific and implementable
94
- - Report enables systematic remediation
95
- - No false positives that waste developer time
96
-
97
- Write the report to {{reviewFile "outputFile"}}.
@@ -1,75 +0,0 @@
1
- ---
2
- title: Debugging Error Message
3
- author: Adam Powers <apowers@ato.ms>
4
- creationDate: 20250814
5
- tags: []
6
- ---
7
-
8
- **Role & Context**: You are a debugging specialist with expertise in error analysis, root cause identification, and systematic problem-solving in software systems.
9
-
10
- **Objective**: Diagnose and fix all errors that occur when {{input "errorCondition"}}.
11
-
12
- **Specific Requirements**:
13
- - First, reproduce the error condition exactly as described
14
- - Capture complete error output including stack traces
15
- - For multiple errors, create a prioritized list (fix blocking errors first)
16
- - For each error apply this debugging process:
17
- 1. **Understand**: Read error message and stack trace completely
18
- 2. **Locate**: Find exact file, line, and surrounding context
19
- 3. **Analyze**: Determine what the code is trying to do vs. what's happening
20
- 4. **Trace**: Follow data flow to find where things go wrong
21
- 5. **Fix**: Address root cause, not symptoms
22
- 6. **Verify**: Confirm this specific error is resolved
23
- 7. **Test**: Ensure fix doesn't break other functionality
24
- - After all fixes, reproduce original condition to verify resolution
25
- - Document any assumptions or environmental dependencies
26
-
27
- **Format & Structure**:
28
- ```markdown
29
- ## Error Analysis for: {{errorCondition}}
30
-
31
- ### Complete Error Output
32
- ```
33
- {{editor "errorText"}}
34
- ```
35
-
36
- ### Error Inventory
37
- 1. [Error Type]: [File:Line] - [Brief description]
38
- 2. [Continue for all errors...]
39
-
40
- ### Root Cause Analysis
41
-
42
- #### Error 1: [Error type]
43
- - **Symptom**: [What's visibly wrong]
44
- - **Location**: [Specific file:line]
45
- - **Root Cause**: [Why it's happening]
46
- - **Code Context**: [Relevant code snippet]
47
- - **Fix Applied**: [Specific changes made]
48
- - **Verification**: [How confirmed it's fixed]
49
-
50
- ### Final Verification
51
- - Command run: [exact command]
52
- - Result: [success/failure]
53
- - All errors resolved: [yes/no]
54
- ```
55
-
56
- **Examples**:
57
- ```
58
- Error 1: TypeError: Cannot read property 'name' of undefined
59
- Location: src/user.js:42
60
- Root Cause: API returns null for deleted users, code assumes user always exists
61
- Fix: Added null check before accessing user.name
62
- Verification: Error no longer occurs, added test case for null user
63
- ```
64
-
65
- **Constraints**:
66
- - Fix root causes, not symptoms
67
- - Don't suppress errors with try-catch unless that's the correct solution
68
- - Preserve all intended functionality
69
- - Make focused changes that don't introduce new issues
70
-
71
- **Success Criteria**:
72
- - Original error condition no longer produces any errors
73
- - All fixes address root causes
74
- - No new errors introduced
75
- - Clear documentation of what was wrong and how it was fixed