@eldrforge/kodrdriv 1.2.20 → 1.2.21

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/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import os__default from 'os';
2
2
  import path__default from 'path';
3
3
 
4
- const VERSION = '1.2.20 (HEAD/d02d99f T:v1.2.20 2025-11-11 00:07:27 -0800) linux x64 v22.21.1';
4
+ const VERSION = '1.2.21 (HEAD/2ac5464 T:v1.2.21 2025-11-13 01:20:14 -0800) linux x64 v22.21.1';
5
5
  const PROGRAM_NAME = 'kodrdriv';
6
6
  const DEFAULT_OVERRIDES = false;
7
7
  const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = 'YYYY-MM-DD-HHmmss.SSS';
@@ -58,70 +58,6 @@ class CommandError extends Error {
58
58
  this.name = 'FileOperationError';
59
59
  }
60
60
  }
61
- /**
62
- * Pull request check failures with detailed information
63
- */ class PullRequestCheckError extends CommandError {
64
- /**
65
- * Get specific instructions based on the type of failures
66
- */ getRecoveryInstructions() {
67
- const instructions = [];
68
- const branchName = this.currentBranch || 'your current branch';
69
- // Analyze failure types for specific guidance
70
- const testFailures = this.failedChecks.filter((check)=>{
71
- var _check_output_title, _check_output;
72
- return check.name.toLowerCase().includes('test') || check.name.toLowerCase().includes('ci') || ((_check_output = check.output) === null || _check_output === void 0 ? void 0 : (_check_output_title = _check_output.title) === null || _check_output_title === void 0 ? void 0 : _check_output_title.toLowerCase().includes('test'));
73
- });
74
- const lintFailures = this.failedChecks.filter((check)=>{
75
- var _check_output_title, _check_output;
76
- return check.name.toLowerCase().includes('lint') || check.name.toLowerCase().includes('style') || ((_check_output = check.output) === null || _check_output === void 0 ? void 0 : (_check_output_title = _check_output.title) === null || _check_output_title === void 0 ? void 0 : _check_output_title.toLowerCase().includes('lint'));
77
- });
78
- const buildFailures = this.failedChecks.filter((check)=>{
79
- var _check_output_title, _check_output;
80
- return check.name.toLowerCase().includes('build') || check.name.toLowerCase().includes('compile') || ((_check_output = check.output) === null || _check_output === void 0 ? void 0 : (_check_output_title = _check_output.title) === null || _check_output_title === void 0 ? void 0 : _check_output_title.toLowerCase().includes('build'));
81
- });
82
- instructions.push('šŸ”§ To fix these failures:');
83
- instructions.push('');
84
- // Specific instructions based on failure types
85
- if (testFailures.length > 0) {
86
- instructions.push('šŸ“‹ Test Failures:');
87
- instructions.push(' • Run tests locally: `npm test` or `yarn test`');
88
- instructions.push(' • Fix failing tests or update test expectations');
89
- instructions.push(' • Consider running specific test files if identified in the failure details');
90
- instructions.push('');
91
- }
92
- if (lintFailures.length > 0) {
93
- instructions.push('šŸŽØ Linting/Style Failures:');
94
- instructions.push(' • Run linter locally: `npm run lint` or `yarn lint`');
95
- instructions.push(' • Auto-fix where possible: `npm run lint:fix` or `yarn lint:fix`');
96
- instructions.push(' • Check code formatting: `npm run format` or `yarn format`');
97
- instructions.push('');
98
- }
99
- if (buildFailures.length > 0) {
100
- instructions.push('šŸ—ļø Build Failures:');
101
- instructions.push(' • Run build locally: `npm run build` or `yarn build`');
102
- instructions.push(' • Check for TypeScript errors: `npx tsc --noEmit`');
103
- instructions.push(' • Review dependency issues and import paths');
104
- instructions.push('');
105
- }
106
- // General workflow instructions
107
- instructions.push('šŸ“¤ After fixing the issues:');
108
- instructions.push(` 1. Stage your changes: \`git add .\``);
109
- instructions.push(` 2. Commit your fixes: \`git commit -m "fix: resolve PR check failures"\``);
110
- instructions.push(` 3. Push to ${branchName}: \`git push origin ${branchName}\``);
111
- instructions.push(` 4. The PR checks will automatically re-run`);
112
- instructions.push('');
113
- instructions.push('šŸ”„ Re-running this command:');
114
- instructions.push(' • The kodrdriv publish command will automatically detect the existing PR');
115
- instructions.push(' • Simply run the same command again after pushing your fixes');
116
- instructions.push(' • You can also manually trigger checks by pushing an empty commit:');
117
- instructions.push(` \`git commit --allow-empty -m "trigger checks" && git push origin ${branchName}\``);
118
- return instructions;
119
- }
120
- constructor(message, prNumber, failedChecks, prUrl, currentBranch){
121
- super(message, 'PR_CHECK_FAILED', true), _define_property(this, "prNumber", void 0), _define_property(this, "failedChecks", void 0), _define_property(this, "prUrl", void 0), _define_property(this, "currentBranch", void 0), this.prNumber = prNumber, this.failedChecks = failedChecks, this.prUrl = prUrl, this.currentBranch = currentBranch;
122
- this.name = 'PullRequestCheckError';
123
- }
124
- }
125
61
 
126
- export { CommandError, ExternalDependencyError, FileOperationError, PullRequestCheckError, UserCancellationError, ValidationError };
62
+ export { CommandError, ExternalDependencyError, FileOperationError, UserCancellationError, ValidationError };
127
63
  //# sourceMappingURL=CommandErrors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommandErrors.js","sources":["../../src/error/CommandErrors.ts"],"sourcesContent":["/**\n * Base class for all command-related errors\n */\nexport class CommandError extends Error {\n public readonly code: string;\n public readonly recoverable: boolean;\n public readonly originalCause?: Error;\n\n constructor(\n message: string,\n code: string,\n recoverable: boolean = false,\n cause?: Error\n ) {\n super(message);\n this.name = 'CommandError';\n this.code = code;\n this.recoverable = recoverable;\n this.originalCause = cause;\n // Also set the standard cause property for compatibility\n if (cause) {\n (this as any).cause = cause;\n }\n }\n}\n\n/**\n * Configuration-related errors (missing config, invalid settings, etc.)\n */\nexport class ConfigurationError extends CommandError {\n constructor(message: string, cause?: Error) {\n super(message, 'CONFIG_ERROR', false, cause);\n this.name = 'ConfigurationError';\n }\n}\n\n/**\n * Validation errors (invalid arguments, missing required data, etc.)\n */\nexport class ValidationError extends CommandError {\n constructor(message: string, cause?: Error) {\n super(message, 'VALIDATION_ERROR', false, cause);\n this.name = 'ValidationError';\n }\n}\n\n/**\n * User cancellation errors (user cancelled operation)\n */\nexport class UserCancellationError extends CommandError {\n constructor(message: string = 'Operation cancelled by user') {\n super(message, 'USER_CANCELLED', true);\n this.name = 'UserCancellationError';\n }\n}\n\n/**\n * External dependency errors (Git, NPM, file system, etc.)\n */\nexport class ExternalDependencyError extends CommandError {\n constructor(message: string, dependency: string, cause?: Error) {\n super(`${dependency}: ${message}`, 'EXTERNAL_DEPENDENCY_ERROR', false, cause);\n this.name = 'ExternalDependencyError';\n }\n}\n\n/**\n * File operation errors (read, write, permissions, etc.)\n */\nexport class FileOperationError extends CommandError {\n constructor(message: string, filePath: string, cause?: Error) {\n super(`File operation failed on ${filePath}: ${message}`, 'FILE_OPERATION_ERROR', false, cause);\n this.name = 'FileOperationError';\n }\n}\n\n/**\n * Pull request check failures with detailed information\n */\nexport class PullRequestCheckError extends CommandError {\n constructor(\n message: string,\n public readonly prNumber: number,\n public readonly failedChecks: Array<{\n name: string;\n conclusion: string;\n detailsUrl?: string;\n summary?: string;\n output?: {\n title?: string;\n summary?: string;\n text?: string;\n };\n }>,\n public readonly prUrl: string,\n public readonly currentBranch?: string\n ) {\n super(message, 'PR_CHECK_FAILED', true);\n this.name = 'PullRequestCheckError';\n }\n\n /**\n * Get specific instructions based on the type of failures\n */\n getRecoveryInstructions(): string[] {\n const instructions: string[] = [];\n const branchName = this.currentBranch || 'your current branch';\n\n // Analyze failure types for specific guidance\n const testFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('test') ||\n check.name.toLowerCase().includes('ci') ||\n check.output?.title?.toLowerCase().includes('test')\n );\n\n const lintFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('lint') ||\n check.name.toLowerCase().includes('style') ||\n check.output?.title?.toLowerCase().includes('lint')\n );\n\n const buildFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('build') ||\n check.name.toLowerCase().includes('compile') ||\n check.output?.title?.toLowerCase().includes('build')\n );\n\n instructions.push('šŸ”§ To fix these failures:');\n instructions.push('');\n\n // Specific instructions based on failure types\n if (testFailures.length > 0) {\n instructions.push('šŸ“‹ Test Failures:');\n instructions.push(' • Run tests locally: `npm test` or `yarn test`');\n instructions.push(' • Fix failing tests or update test expectations');\n instructions.push(' • Consider running specific test files if identified in the failure details');\n instructions.push('');\n }\n\n if (lintFailures.length > 0) {\n instructions.push('šŸŽØ Linting/Style Failures:');\n instructions.push(' • Run linter locally: `npm run lint` or `yarn lint`');\n instructions.push(' • Auto-fix where possible: `npm run lint:fix` or `yarn lint:fix`');\n instructions.push(' • Check code formatting: `npm run format` or `yarn format`');\n instructions.push('');\n }\n\n if (buildFailures.length > 0) {\n instructions.push('šŸ—ļø Build Failures:');\n instructions.push(' • Run build locally: `npm run build` or `yarn build`');\n instructions.push(' • Check for TypeScript errors: `npx tsc --noEmit`');\n instructions.push(' • Review dependency issues and import paths');\n instructions.push('');\n }\n\n // General workflow instructions\n instructions.push('šŸ“¤ After fixing the issues:');\n instructions.push(` 1. Stage your changes: \\`git add .\\``);\n instructions.push(` 2. Commit your fixes: \\`git commit -m \"fix: resolve PR check failures\"\\``);\n instructions.push(` 3. Push to ${branchName}: \\`git push origin ${branchName}\\``);\n instructions.push(` 4. The PR checks will automatically re-run`);\n instructions.push('');\n\n instructions.push('šŸ”„ Re-running this command:');\n instructions.push(' • The kodrdriv publish command will automatically detect the existing PR');\n instructions.push(' • Simply run the same command again after pushing your fixes');\n instructions.push(' • You can also manually trigger checks by pushing an empty commit:');\n instructions.push(` \\`git commit --allow-empty -m \"trigger checks\" && git push origin ${branchName}\\``);\n\n return instructions;\n }\n}\n"],"names":["CommandError","Error","message","code","recoverable","cause","originalCause","name","ValidationError","UserCancellationError","ExternalDependencyError","dependency","FileOperationError","filePath","PullRequestCheckError","getRecoveryInstructions","instructions","branchName","currentBranch","testFailures","failedChecks","filter","check","toLowerCase","includes","output","title","lintFailures","buildFailures","push","length","prNumber","prUrl"],"mappings":"AAAA;;AAEC,IAAA,SAAA,gBAAA,CAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAA;;;;;;;;;;;;;AACM,MAAMA,YAAAA,SAAqBC,KAAAA,CAAAA;IAK9B,WAAA,CACIC,OAAe,EACfC,IAAY,EACZC,cAAuB,KAAK,EAC5BC,KAAa,CACf;AACE,QAAA,KAAK,CAACH,OAAAA,CAAAA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A,YAAAA,CAAaa,IAAI,CAAC,6BAAA,CAAA;AAClBb,QAAAA,YAAAA,CAAaa,IAAI,CAAC,6EAAA,CAAA;AAClBb,QAAAA,YAAAA,CAAaa,IAAI,CAAC,iEAAA,CAAA;AAClBb,QAAAA,YAAAA,CAAaa,IAAI,CAAC,uEAAA,CAAA;AAClBb,QAAAA,YAAAA,CAAaa,IAAI,CAAC,CAAC,uEAAuE,EAAEZ,UAAAA,CAAW,EAAE,CAAC,CAAA;QAE1G,OAAOD,YAAAA;AACX,IAAA;AA1FA,IAAA,WAAA,CACId,OAAe,EACf,QAAgC,EAChBkB,YAUd,EACF,KAA6B,EACbF,aAAsB,CACxC;QACE,KAAK,CAAChB,OAAAA,EAAS,iBAAA,EAAmB,IAAA,CAAA,EAAA,gBAAA,CAAA,IAAA,EAAA,UAAA,EAAA,MAAA,CAAA,EAAA,gBAAA,CAAA,IAAA,EAAA,cAAA,EAAA,MAAA,CAAA,EAAA,gBAAA,CAAA,IAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAAA,gBAAA,CAAA,IAAA,EAAA,eAAA,EAAA,MAAA,CAAA,EAAA,IAAA,CAflB6B,QAAAA,GAAAA,eACAX,YAAAA,GAAAA,YAAAA,EAAAA,IAAAA,CAWAY,KAAAA,GAAAA,KAAAA,EAAAA,IAAAA,CACAd,aAAAA,GAAAA,aAAAA;QAGhB,IAAI,CAACX,IAAI,GAAG,uBAAA;AAChB,IAAA;AAwEJ;;;;"}
1
+ {"version":3,"file":"CommandErrors.js","sources":["../../src/error/CommandErrors.ts"],"sourcesContent":["/**\n * Base class for all command-related errors\n */\nexport class CommandError extends Error {\n public readonly code: string;\n public readonly recoverable: boolean;\n public readonly originalCause?: Error;\n\n constructor(\n message: string,\n code: string,\n recoverable: boolean = false,\n cause?: Error\n ) {\n super(message);\n this.name = 'CommandError';\n this.code = code;\n this.recoverable = recoverable;\n this.originalCause = cause;\n // Also set the standard cause property for compatibility\n if (cause) {\n (this as any).cause = cause;\n }\n }\n}\n\n/**\n * Configuration-related errors (missing config, invalid settings, etc.)\n */\nexport class ConfigurationError extends CommandError {\n constructor(message: string, cause?: Error) {\n super(message, 'CONFIG_ERROR', false, cause);\n this.name = 'ConfigurationError';\n }\n}\n\n/**\n * Validation errors (invalid arguments, missing required data, etc.)\n */\nexport class ValidationError extends CommandError {\n constructor(message: string, cause?: Error) {\n super(message, 'VALIDATION_ERROR', false, cause);\n this.name = 'ValidationError';\n }\n}\n\n/**\n * User cancellation errors (user cancelled operation)\n */\nexport class UserCancellationError extends CommandError {\n constructor(message: string = 'Operation cancelled by user') {\n super(message, 'USER_CANCELLED', true);\n this.name = 'UserCancellationError';\n }\n}\n\n/**\n * External dependency errors (Git, NPM, file system, etc.)\n */\nexport class ExternalDependencyError extends CommandError {\n constructor(message: string, dependency: string, cause?: Error) {\n super(`${dependency}: ${message}`, 'EXTERNAL_DEPENDENCY_ERROR', false, cause);\n this.name = 'ExternalDependencyError';\n }\n}\n\n/**\n * File operation errors (read, write, permissions, etc.)\n */\nexport class FileOperationError extends CommandError {\n constructor(message: string, filePath: string, cause?: Error) {\n super(`File operation failed on ${filePath}: ${message}`, 'FILE_OPERATION_ERROR', false, cause);\n this.name = 'FileOperationError';\n }\n}\n\n/**\n * Pull request check failures with detailed information\n */\nexport class PullRequestCheckError extends CommandError {\n constructor(\n message: string,\n public readonly prNumber: number,\n public readonly failedChecks: Array<{\n name: string;\n conclusion: string;\n detailsUrl?: string;\n summary?: string;\n output?: {\n title?: string;\n summary?: string;\n text?: string;\n };\n }>,\n public readonly prUrl: string,\n public readonly currentBranch?: string\n ) {\n super(message, 'PR_CHECK_FAILED', true);\n this.name = 'PullRequestCheckError';\n }\n\n /**\n * Get specific instructions based on the type of failures\n */\n getRecoveryInstructions(): string[] {\n const instructions: string[] = [];\n const branchName = this.currentBranch || 'your current branch';\n\n // Analyze failure types for specific guidance\n const testFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('test') ||\n check.name.toLowerCase().includes('ci') ||\n check.output?.title?.toLowerCase().includes('test')\n );\n\n const lintFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('lint') ||\n check.name.toLowerCase().includes('style') ||\n check.output?.title?.toLowerCase().includes('lint')\n );\n\n const buildFailures = this.failedChecks.filter(check =>\n check.name.toLowerCase().includes('build') ||\n check.name.toLowerCase().includes('compile') ||\n check.output?.title?.toLowerCase().includes('build')\n );\n\n instructions.push('šŸ”§ To fix these failures:');\n instructions.push('');\n\n // Specific instructions based on failure types\n if (testFailures.length > 0) {\n instructions.push('šŸ“‹ Test Failures:');\n instructions.push(' • Run tests locally: `npm test` or `yarn test`');\n instructions.push(' • Fix failing tests or update test expectations');\n instructions.push(' • Consider running specific test files if identified in the failure details');\n instructions.push('');\n }\n\n if (lintFailures.length > 0) {\n instructions.push('šŸŽØ Linting/Style Failures:');\n instructions.push(' • Run linter locally: `npm run lint` or `yarn lint`');\n instructions.push(' • Auto-fix where possible: `npm run lint:fix` or `yarn lint:fix`');\n instructions.push(' • Check code formatting: `npm run format` or `yarn format`');\n instructions.push('');\n }\n\n if (buildFailures.length > 0) {\n instructions.push('šŸ—ļø Build Failures:');\n instructions.push(' • Run build locally: `npm run build` or `yarn build`');\n instructions.push(' • Check for TypeScript errors: `npx tsc --noEmit`');\n instructions.push(' • Review dependency issues and import paths');\n instructions.push('');\n }\n\n // General workflow instructions\n instructions.push('šŸ“¤ After fixing the issues:');\n instructions.push(` 1. Stage your changes: \\`git add .\\``);\n instructions.push(` 2. Commit your fixes: \\`git commit -m \"fix: resolve PR check failures\"\\``);\n instructions.push(` 3. Push to ${branchName}: \\`git push origin ${branchName}\\``);\n instructions.push(` 4. The PR checks will automatically re-run`);\n instructions.push('');\n\n instructions.push('šŸ”„ Re-running this command:');\n instructions.push(' • The kodrdriv publish command will automatically detect the existing PR');\n instructions.push(' • Simply run the same command again after pushing your fixes');\n instructions.push(' • You can also manually trigger checks by pushing an empty commit:');\n instructions.push(` \\`git commit --allow-empty -m \"trigger checks\" && git push origin ${branchName}\\``);\n\n return instructions;\n }\n}\n"],"names":["CommandError","Error","message","code","recoverable","cause","originalCause","name","ValidationError","UserCancellationError","ExternalDependencyError","dependency","FileOperationError","filePath"],"mappings":"AAAA;;AAEC,IAAA,SAAA,gBAAA,CAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAA;;;;;;;;;;;;;AACM,MAAMA,YAAAA,SAAqBC,KAAAA,CAAAA;IAK9B,WAAA,CACIC,OAAe,EACfC,IAAY,EACZC,cAAuB,KAAK,EAC5BC,KAAa,CACf;AACE,QAAA,KAAK,CAACH,OAAAA,CAAAA,EAVV,gBAAA,CAAA,IAAA,EAAgBC,MAAAA,EAAhB,MAAA,CAAA,EACA,gBAAA,CAAA,IAAA,EAAgBC,aAAAA,EAAhB,MAAA,CAAA,EACA,gBAAA,CAAA,IAAA,EAAgBE,eAAAA,EAAhB,MAAA,CAAA;QASI,IAAI,CAACC,IAAI,GAAG,cAAA;QACZ,IAAI,CAACJ,IAAI,GAAGA,IAAAA;QACZ,IAAI,CAACC,WAAW,GAAGA,WAAAA;QACnB,IAAI,CAACE,aAAa,GAAGD,KAAAA;;AAErB,QAAA,IAAIA,KAAAA,EAAO;YACP,IAAK,CAASA,KAAK,GAAGA,KAAAA;AAC1B,QAAA;AACJ,IAAA;AACJ;AAYA;;IAGO,MAAMG,eAAAA,SAAwBR,YAAAA,CAAAA;IACjC,WAAA,CAAYE,OAAe,EAAEG,KAAa,CAAE;QACxC,KAAK,CAACH,OAAAA,EAAS,kBAAA,EAAoB,KAAA,EAAOG,KAAAA,CAAAA;QAC1C,IAAI,CAACE,IAAI,GAAG,iBAAA;AAChB,IAAA;AACJ;AAEA;;IAGO,MAAME,qBAAAA,SAA8BT,YAAAA,CAAAA;IACvC,WAAA,CAAYE,OAAAA,GAAkB,6BAA6B,CAAE;QACzD,KAAK,CAACA,SAAS,gBAAA,EAAkB,IAAA,CAAA;QACjC,IAAI,CAACK,IAAI,GAAG,uBAAA;AAChB,IAAA;AACJ;AAEA;;IAGO,MAAMG,uBAAAA,SAAgCV,YAAAA,CAAAA;AACzC,IAAA,WAAA,CAAYE,OAAe,EAAES,UAAkB,EAAEN,KAAa,CAAE;QAC5D,KAAK,CAAC,GAAGM,UAAAA,CAAW,EAAE,EAAET,OAAAA,CAAAA,CAAS,EAAE,6BAA6B,KAAA,EAAOG,KAAAA,CAAAA;QACvE,IAAI,CAACE,IAAI,GAAG,yBAAA;AAChB,IAAA;AACJ;AAEA;;IAGO,MAAMK,kBAAAA,SAA2BZ,YAAAA,CAAAA;AACpC,IAAA,WAAA,CAAYE,OAAe,EAAEW,QAAgB,EAAER,KAAa,CAAE;QAC1D,KAAK,CAAC,CAAC,yBAAyB,EAAEQ,QAAAA,CAAS,EAAE,EAAEX,OAAAA,CAAAA,CAAS,EAAE,sBAAA,EAAwB,KAAA,EAAOG,KAAAA,CAAAA;QACzF,IAAI,CAACE,IAAI,GAAG,oBAAA;AAChB,IAAA;AACJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrforge/kodrdriv",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "description": "Create Intelligent Release Notes or Change Logs from Git",
5
5
  "main": "dist/main.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "url": "git+https://github.com/calenvarek/kodrdriv.git"
13
13
  },
14
14
  "scripts": {
15
- "build": "npm run lint && tsc --noEmit && vite build && copyfiles -u 1 \"src/**/*.md\" dist && chmod 755 ./dist/main.js",
15
+ "build": "npm run lint && tsc --noEmit && vite build && copyfiles -u 1 \"src/**/*.md\" dist && chmod 755 ./dist/main.js 2>/dev/null || chmod 755 ./dist/kodrdriv/src/main.js",
16
16
  "start": "dist/main.js",
17
17
  "dev": "vite",
18
18
  "watch": "vite build --watch",
@@ -38,7 +38,8 @@
38
38
  "author": "Calen Varek <calenvarek@gmail.com>",
39
39
  "license": "Apache-2.0",
40
40
  "dependencies": {
41
- "@eldrforge/git-tools": "^0.1.1",
41
+ "@eldrforge/git-tools": "^0.1.3",
42
+ "@eldrforge/github-tools": "^0.1.4",
42
43
  "@octokit/rest": "^22.0.0",
43
44
  "@riotprompt/riotprompt": "^0.0.8",
44
45
  "@theunwalked/cardigantime": "^0.0.16",
package/test_output.txt CHANGED
@@ -3,7 +3,7 @@
3
3
  > vitest run --coverage tests/commands/tree.test.ts
4
4
 
5
5
 
6
- RUN v3.2.4 /Users/tobrien/gitw/calenvarek/kodrdriv
6
+ RUN v3.2.4 kodrdriv
7
7
  Coverage enabled with v8
8
8
 
9
9
  āÆ tests/commands/tree.test.ts (60 tests | 6 failed) 57ms
@@ -105,12 +105,12 @@ Error: Failed to analyze workspace: Command failed in package package-a
105
105
  FAIL tests/commands/tree.test.ts > tree > built-in command execution > should propagate global options to built-in commands
106
106
  AssertionError: expected "spy" to be called at least once
107
107
  āÆ tests/commands/tree.test.ts:1105:37
108
- 1103|
108
+ 1103|
109
109
  1104| // Verify the command was executed (basic check)
110
110
  1105| expect(mockExecPromise).toHaveBeenCalled();
111
111
  | ^
112
112
  1106| });
113
- 1107|
113
+ 1107|
114
114
 
115
115
  āŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆāŽÆ[3/6]āŽÆ
116
116
 
@@ -1,331 +0,0 @@
1
- import { getLogger } from '../logging.js';
2
- import { getUserChoice as getUserChoice$1 } from '../util/interactive.js';
3
- import { createIssue, getOpenIssues } from '../util/github.js';
4
- import path__default from 'path';
5
- import os__default from 'os';
6
- import { spawnSync } from 'child_process';
7
- import fs__default from 'fs/promises';
8
-
9
- // Get GitHub issues content
10
- const get = async (options = {})=>{
11
- const logger = getLogger();
12
- const { limit = 20 } = options;
13
- try {
14
- logger.debug('Fetching open GitHub issues...');
15
- const issuesLimit = Math.min(limit, 20); // Cap at 20
16
- const githubIssues = await getOpenIssues(issuesLimit);
17
- if (githubIssues.trim()) {
18
- logger.debug('Added GitHub issues to context (%d characters)', githubIssues.length);
19
- return githubIssues;
20
- } else {
21
- logger.debug('No open GitHub issues found');
22
- return '';
23
- }
24
- } catch (error) {
25
- logger.warn('Failed to fetch GitHub issues: %s', error.message);
26
- return '';
27
- }
28
- };
29
- // Helper function to get user choice interactively
30
- async function getUserChoice(prompt, choices) {
31
- return await getUserChoice$1(prompt, choices);
32
- }
33
- // Helper function to serialize issue to structured text format
34
- function serializeIssue(issue) {
35
- const lines = [
36
- '# Issue Editor',
37
- '',
38
- '# Edit the issue details below. Lines starting with "#" are comments and will be ignored.',
39
- '# Valid priorities: low, medium, high',
40
- '# Valid categories: ui, content, functionality, accessibility, performance, other',
41
- '# Suggestions should be one per line, preceded by a "-" or "•"',
42
- '',
43
- `Title: ${issue.title}`,
44
- '',
45
- `Priority: ${issue.priority}`,
46
- '',
47
- `Category: ${issue.category}`,
48
- '',
49
- 'Description:',
50
- issue.description,
51
- '',
52
- 'Suggestions:'
53
- ];
54
- if (issue.suggestions && issue.suggestions.length > 0) {
55
- issue.suggestions.forEach((suggestion)=>{
56
- lines.push(`- ${suggestion}`);
57
- });
58
- } else {
59
- lines.push('# Add suggestions here, one per line with "-" or "•"');
60
- }
61
- return lines.join('\n');
62
- }
63
- // Helper function to deserialize issue from structured text format
64
- function deserializeIssue(content) {
65
- const lines = content.split('\n');
66
- // Parse the structured format
67
- let title = '';
68
- let priority = 'medium';
69
- let category = 'other';
70
- let description = '';
71
- const suggestions = [];
72
- let currentSection = '';
73
- let descriptionLines = [];
74
- for(let i = 0; i < lines.length; i++){
75
- const line = lines[i].trim();
76
- // Skip comment lines
77
- if (line.startsWith('#')) {
78
- continue;
79
- }
80
- // Parse field lines
81
- if (line.startsWith('Title:')) {
82
- title = line.substring(6).trim();
83
- } else if (line.startsWith('Priority:')) {
84
- const priorityValue = line.substring(9).trim().toLowerCase();
85
- if (priorityValue === 'low' || priorityValue === 'medium' || priorityValue === 'high') {
86
- priority = priorityValue;
87
- }
88
- } else if (line.startsWith('Category:')) {
89
- const categoryValue = line.substring(9).trim().toLowerCase();
90
- if ([
91
- 'ui',
92
- 'content',
93
- 'functionality',
94
- 'accessibility',
95
- 'performance',
96
- 'other'
97
- ].includes(categoryValue)) {
98
- category = categoryValue;
99
- }
100
- } else if (line === 'Description:') {
101
- currentSection = 'description';
102
- descriptionLines = [];
103
- } else if (line === 'Suggestions:') {
104
- currentSection = 'suggestions';
105
- // Process accumulated description lines
106
- description = descriptionLines.join('\n').trim();
107
- } else if (currentSection === 'description' && line !== '') {
108
- descriptionLines.push(lines[i]); // Keep original line with spacing
109
- } else if (currentSection === 'suggestions' && line !== '') {
110
- // Parse suggestion line
111
- const suggestionLine = line.replace(/^[-•]\s*/, '').trim();
112
- if (suggestionLine) {
113
- suggestions.push(suggestionLine);
114
- }
115
- }
116
- }
117
- // If we didn't encounter suggestions section, description might still be accumulating
118
- if (currentSection === 'description') {
119
- description = descriptionLines.join('\n').trim();
120
- }
121
- return {
122
- title: title || 'Untitled Issue',
123
- priority,
124
- category,
125
- description: description || 'No description provided',
126
- suggestions: suggestions.length > 0 ? suggestions : undefined
127
- };
128
- }
129
- // Helper function to edit issue using editor
130
- async function editIssueInteractively(issue) {
131
- const logger = getLogger();
132
- const editor = process.env.EDITOR || process.env.VISUAL || 'vi';
133
- // Create a temporary file for the user to edit
134
- const tmpDir = os__default.tmpdir();
135
- const tmpFilePath = path__default.join(tmpDir, `kodrdriv_issue_${Date.now()}.txt`);
136
- // Serialize the issue to structured text format
137
- const issueContent = serializeIssue(issue);
138
- await fs__default.writeFile(tmpFilePath, issueContent, 'utf8');
139
- logger.info(`šŸ“ Opening ${editor} to edit issue...`);
140
- // Open the editor synchronously so execution resumes after the user closes it
141
- const result = spawnSync(editor, [
142
- tmpFilePath
143
- ], {
144
- stdio: 'inherit'
145
- });
146
- if (result.error) {
147
- throw new Error(`Failed to launch editor '${editor}': ${result.error.message}`);
148
- }
149
- // Read the file back and deserialize it
150
- const editedContent = await fs__default.readFile(tmpFilePath, 'utf8');
151
- // Clean up the temporary file with proper error handling
152
- try {
153
- await fs__default.unlink(tmpFilePath);
154
- } catch (error) {
155
- // Only log if it's not a "file not found" error
156
- if (error.code !== 'ENOENT') {
157
- logger.warn(`Failed to cleanup temporary file ${tmpFilePath}: ${error.message}`);
158
- }
159
- }
160
- // Deserialize the edited content back to an Issue object
161
- const editedIssue = deserializeIssue(editedContent);
162
- logger.info('āœ… Issue updated successfully');
163
- logger.debug('Updated issue: %s', JSON.stringify(editedIssue, null, 2));
164
- return editedIssue;
165
- }
166
- // Helper function to format issue body for GitHub
167
- function formatIssueBody(issue) {
168
- let body = `## Description\n\n${issue.description}\n\n`;
169
- body += `## Details\n\n`;
170
- body += `- **Priority:** ${issue.priority}\n`;
171
- body += `- **Category:** ${issue.category}\n`;
172
- body += `- **Source:** Review\n\n`;
173
- if (issue.suggestions && issue.suggestions.length > 0) {
174
- body += `## Suggestions\n\n`;
175
- issue.suggestions.forEach((suggestion)=>{
176
- body += `- ${suggestion}\n`;
177
- });
178
- body += '\n';
179
- }
180
- body += `---\n\n`;
181
- body += `*This issue was automatically created from a review session.*`;
182
- return body;
183
- }
184
- // Helper function to format results with created GitHub issues
185
- function formatReviewResultsWithIssues(result, createdIssues) {
186
- let output = `šŸ“ Review Results\n\n`;
187
- output += `šŸ“‹ Summary: ${result.summary}\n`;
188
- output += `šŸ“Š Total Issues Found: ${result.totalIssues}\n`;
189
- output += `šŸš€ GitHub Issues Created: ${createdIssues.length}\n\n`;
190
- if (result.issues && result.issues.length > 0) {
191
- output += `šŸ“ Issues Identified:\n\n`;
192
- result.issues.forEach((issue, index)=>{
193
- const priorityEmoji = issue.priority === 'high' ? 'šŸ”“' : issue.priority === 'medium' ? '🟔' : '🟢';
194
- const categoryEmoji = issue.category === 'ui' ? 'šŸŽØ' : issue.category === 'content' ? 'šŸ“' : issue.category === 'functionality' ? 'āš™ļø' : issue.category === 'accessibility' ? '♿' : issue.category === 'performance' ? '⚔' : 'šŸ”§';
195
- output += `${index + 1}. ${priorityEmoji} ${issue.title}\n`;
196
- output += ` ${categoryEmoji} Category: ${issue.category} | Priority: ${issue.priority}\n`;
197
- output += ` šŸ“– Description: ${issue.description}\n`;
198
- // Check if this issue was created as a GitHub issue
199
- const createdIssue = createdIssues.find((ci)=>ci.issue === issue);
200
- if (createdIssue) {
201
- output += ` šŸ”— GitHub Issue: #${createdIssue.number} - ${createdIssue.githubUrl}\n`;
202
- }
203
- if (issue.suggestions && issue.suggestions.length > 0) {
204
- output += ` šŸ’” Suggestions:\n`;
205
- issue.suggestions.forEach((suggestion)=>{
206
- output += ` • ${suggestion}\n`;
207
- });
208
- }
209
- output += `\n`;
210
- });
211
- } else {
212
- output += `āœ… No specific issues identified from the review.\n\n`;
213
- }
214
- if (createdIssues.length > 0) {
215
- output += `\nšŸŽÆ Created GitHub Issues:\n`;
216
- createdIssues.forEach((createdIssue)=>{
217
- output += `• #${createdIssue.number}: ${createdIssue.issue.title} - ${createdIssue.githubUrl}\n`;
218
- });
219
- output += `\n`;
220
- }
221
- output += `šŸš€ Next Steps: Review the created GitHub issues and prioritize them in your development workflow.`;
222
- return output;
223
- }
224
- function formatReviewResults(result) {
225
- let output = `šŸ“ Review Results\n\n`;
226
- output += `šŸ“‹ Summary: ${result.summary}\n`;
227
- output += `šŸ“Š Total Issues Found: ${result.totalIssues}\n\n`;
228
- if (result.issues && result.issues.length > 0) {
229
- output += `šŸ“ Issues Identified:\n\n`;
230
- result.issues.forEach((issue, index)=>{
231
- const priorityEmoji = issue.priority === 'high' ? 'šŸ”“' : issue.priority === 'medium' ? '🟔' : '🟢';
232
- const categoryEmoji = issue.category === 'ui' ? 'šŸŽØ' : issue.category === 'content' ? 'šŸ“' : issue.category === 'functionality' ? 'āš™ļø' : issue.category === 'accessibility' ? '♿' : issue.category === 'performance' ? '⚔' : 'šŸ”§';
233
- output += `${index + 1}. ${priorityEmoji} ${issue.title}\n`;
234
- output += ` ${categoryEmoji} Category: ${issue.category} | Priority: ${issue.priority}\n`;
235
- output += ` šŸ“– Description: ${issue.description}\n`;
236
- if (issue.suggestions && issue.suggestions.length > 0) {
237
- output += ` šŸ’” Suggestions:\n`;
238
- issue.suggestions.forEach((suggestion)=>{
239
- output += ` • ${suggestion}\n`;
240
- });
241
- }
242
- output += `\n`;
243
- });
244
- } else {
245
- output += `āœ… No specific issues identified from the review.\n\n`;
246
- }
247
- output += `šŸš€ Next Steps: Review the identified issues and prioritize them for your development workflow.`;
248
- return output;
249
- }
250
- // Handle GitHub issue creation workflow
251
- const handleIssueCreation = async (result, senditMode = false)=>{
252
- const logger = getLogger();
253
- const createdIssues = [];
254
- if (!result.issues || result.issues.length === 0) {
255
- return formatReviewResults(result);
256
- }
257
- logger.info(`šŸ” Found ${result.issues.length} issues to potentially create as GitHub issues`);
258
- for(let i = 0; i < result.issues.length; i++){
259
- let issue = result.issues[i];
260
- let shouldCreateIssue = senditMode;
261
- if (!senditMode) {
262
- // Interactive confirmation for each issue - keep looping until user decides
263
- let userChoice = '';
264
- while(userChoice !== 'c' && userChoice !== 's'){
265
- // Display issue details
266
- logger.info(`\nšŸ“‹ Issue ${i + 1} of ${result.issues.length}:`);
267
- logger.info(` Title: ${issue.title}`);
268
- logger.info(` Priority: ${issue.priority} | Category: ${issue.category}`);
269
- logger.info(` Description: ${issue.description}`);
270
- if (issue.suggestions && issue.suggestions.length > 0) {
271
- logger.info(` Suggestions: ${issue.suggestions.join(', ')}`);
272
- }
273
- // Get user choice
274
- userChoice = await getUserChoice('\nWhat would you like to do with this issue?', [
275
- {
276
- key: 'c',
277
- label: 'Create GitHub issue'
278
- },
279
- {
280
- key: 's',
281
- label: 'Skip this issue'
282
- },
283
- {
284
- key: 'e',
285
- label: 'Edit issue details'
286
- }
287
- ]);
288
- if (userChoice === 'c') {
289
- shouldCreateIssue = true;
290
- } else if (userChoice === 'e') {
291
- // Allow user to edit the issue
292
- issue = await editIssueInteractively(issue);
293
- result.issues[i] = issue; // Update the issue in the result
294
- // Continue the loop to show the updated issue and ask again
295
- }
296
- // If choice is 's', loop will exit and shouldCreateIssue remains false
297
- }
298
- }
299
- if (shouldCreateIssue) {
300
- try {
301
- logger.info(`šŸš€ Creating GitHub issue: "${issue.title}"`);
302
- // Format issue body with additional details
303
- const issueBody = formatIssueBody(issue);
304
- // Create labels based on priority and category
305
- const labels = [
306
- `priority-${issue.priority}`,
307
- `category-${issue.category}`,
308
- 'review'
309
- ];
310
- const createdIssue = await createIssue(issue.title, issueBody, labels);
311
- createdIssues.push({
312
- issue,
313
- githubUrl: createdIssue.html_url,
314
- number: createdIssue.number
315
- });
316
- logger.info(`āœ… Created GitHub issue #${createdIssue.number}: ${createdIssue.html_url}`);
317
- } catch (error) {
318
- logger.error(`āŒ Failed to create GitHub issue for "${issue.title}": ${error.message}`);
319
- }
320
- }
321
- }
322
- // Return formatted results
323
- if (createdIssues.length > 0) {
324
- return formatReviewResultsWithIssues(result, createdIssues);
325
- } else {
326
- return formatReviewResults(result);
327
- }
328
- };
329
-
330
- export { get, handleIssueCreation };
331
- //# sourceMappingURL=issues.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"issues.js","sources":["../../src/content/issues.ts"],"sourcesContent":["import { getLogger } from '../logging';\nimport { getUserChoice as getUserChoiceInteractive } from '../util/interactive';\nimport { getOpenIssues, createIssue } from '../util/github';\nimport path from 'path';\nimport os from 'os';\nimport { spawnSync } from 'child_process';\nimport fs from 'fs/promises';\n\nexport interface Issue {\n title: string;\n description: string;\n priority: 'low' | 'medium' | 'high';\n category: 'ui' | 'content' | 'functionality' | 'accessibility' | 'performance' | 'other';\n suggestions?: string[];\n}\n\nexport interface ReviewResult {\n summary: string;\n totalIssues: number;\n issues: Issue[];\n}\n\n// Get GitHub issues content\nexport const get = async (options: { limit?: number } = {}): Promise<string> => {\n const logger = getLogger();\n const { limit = 20 } = options;\n\n try {\n logger.debug('Fetching open GitHub issues...');\n const issuesLimit = Math.min(limit, 20); // Cap at 20\n const githubIssues = await getOpenIssues(issuesLimit);\n\n if (githubIssues.trim()) {\n logger.debug('Added GitHub issues to context (%d characters)', githubIssues.length);\n return githubIssues;\n } else {\n logger.debug('No open GitHub issues found');\n return '';\n }\n } catch (error: any) {\n logger.warn('Failed to fetch GitHub issues: %s', error.message);\n return '';\n }\n};\n\n// Helper function to get user choice interactively\nasync function getUserChoice(prompt: string, choices: Array<{ key: string, label: string }>): Promise<string> {\n return await getUserChoiceInteractive(prompt, choices);\n}\n\n// Helper function to serialize issue to structured text format\nfunction serializeIssue(issue: Issue): string {\n const lines = [\n '# Issue Editor',\n '',\n '# Edit the issue details below. Lines starting with \"#\" are comments and will be ignored.',\n '# Valid priorities: low, medium, high',\n '# Valid categories: ui, content, functionality, accessibility, performance, other',\n '# Suggestions should be one per line, preceded by a \"-\" or \"•\"',\n '',\n `Title: ${issue.title}`,\n '',\n `Priority: ${issue.priority}`,\n '',\n `Category: ${issue.category}`,\n '',\n 'Description:',\n issue.description,\n '',\n 'Suggestions:',\n ];\n\n if (issue.suggestions && issue.suggestions.length > 0) {\n issue.suggestions.forEach(suggestion => {\n lines.push(`- ${suggestion}`);\n });\n } else {\n lines.push('# Add suggestions here, one per line with \"-\" or \"•\"');\n }\n\n return lines.join('\\n');\n}\n\n// Helper function to deserialize issue from structured text format\nfunction deserializeIssue(content: string): Issue {\n const lines = content.split('\\n');\n\n // Parse the structured format\n let title = '';\n let priority: 'low' | 'medium' | 'high' = 'medium';\n let category: 'ui' | 'content' | 'functionality' | 'accessibility' | 'performance' | 'other' = 'other';\n let description = '';\n const suggestions: string[] = [];\n\n let currentSection = '';\n let descriptionLines: string[] = [];\n\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trim();\n\n // Skip comment lines\n if (line.startsWith('#')) {\n continue;\n }\n\n // Parse field lines\n if (line.startsWith('Title:')) {\n title = line.substring(6).trim();\n } else if (line.startsWith('Priority:')) {\n const priorityValue = line.substring(9).trim().toLowerCase();\n if (priorityValue === 'low' || priorityValue === 'medium' || priorityValue === 'high') {\n priority = priorityValue;\n }\n } else if (line.startsWith('Category:')) {\n const categoryValue = line.substring(9).trim().toLowerCase();\n if (['ui', 'content', 'functionality', 'accessibility', 'performance', 'other'].includes(categoryValue)) {\n category = categoryValue as any;\n }\n } else if (line === 'Description:') {\n currentSection = 'description';\n descriptionLines = [];\n } else if (line === 'Suggestions:') {\n currentSection = 'suggestions';\n // Process accumulated description lines\n description = descriptionLines.join('\\n').trim();\n } else if (currentSection === 'description' && line !== '') {\n descriptionLines.push(lines[i]); // Keep original line with spacing\n } else if (currentSection === 'suggestions' && line !== '') {\n // Parse suggestion line\n const suggestionLine = line.replace(/^[-•]\\s*/, '').trim();\n if (suggestionLine) {\n suggestions.push(suggestionLine);\n }\n }\n }\n\n // If we didn't encounter suggestions section, description might still be accumulating\n if (currentSection === 'description') {\n description = descriptionLines.join('\\n').trim();\n }\n\n return {\n title: title || 'Untitled Issue',\n priority,\n category,\n description: description || 'No description provided',\n suggestions: suggestions.length > 0 ? suggestions : undefined\n };\n}\n\n// Helper function to edit issue using editor\nasync function editIssueInteractively(issue: Issue): Promise<Issue> {\n const logger = getLogger();\n const editor = process.env.EDITOR || process.env.VISUAL || 'vi';\n\n // Create a temporary file for the user to edit\n const tmpDir = os.tmpdir();\n const tmpFilePath = path.join(tmpDir, `kodrdriv_issue_${Date.now()}.txt`);\n\n // Serialize the issue to structured text format\n const issueContent = serializeIssue(issue);\n\n await fs.writeFile(tmpFilePath, issueContent, 'utf8');\n\n logger.info(`šŸ“ Opening ${editor} to edit issue...`);\n\n // Open the editor synchronously so execution resumes after the user closes it\n const result = spawnSync(editor, [tmpFilePath], { stdio: 'inherit' });\n\n if (result.error) {\n throw new Error(`Failed to launch editor '${editor}': ${result.error.message}`);\n }\n\n // Read the file back and deserialize it\n const editedContent = await fs.readFile(tmpFilePath, 'utf8');\n\n // Clean up the temporary file with proper error handling\n try {\n await fs.unlink(tmpFilePath);\n } catch (error: any) {\n // Only log if it's not a \"file not found\" error\n if (error.code !== 'ENOENT') {\n logger.warn(`Failed to cleanup temporary file ${tmpFilePath}: ${error.message}`);\n }\n }\n\n // Deserialize the edited content back to an Issue object\n const editedIssue = deserializeIssue(editedContent);\n\n logger.info('āœ… Issue updated successfully');\n logger.debug('Updated issue: %s', JSON.stringify(editedIssue, null, 2));\n\n return editedIssue;\n}\n\n// Helper function to format issue body for GitHub\nfunction formatIssueBody(issue: Issue): string {\n let body = `## Description\\n\\n${issue.description}\\n\\n`;\n\n body += `## Details\\n\\n`;\n body += `- **Priority:** ${issue.priority}\\n`;\n body += `- **Category:** ${issue.category}\\n`;\n body += `- **Source:** Review\\n\\n`;\n\n if (issue.suggestions && issue.suggestions.length > 0) {\n body += `## Suggestions\\n\\n`;\n issue.suggestions.forEach(suggestion => {\n body += `- ${suggestion}\\n`;\n });\n body += '\\n';\n }\n\n body += `---\\n\\n`;\n body += `*This issue was automatically created from a review session.*`;\n\n return body;\n}\n\n// Helper function to format results with created GitHub issues\nfunction formatReviewResultsWithIssues(\n result: ReviewResult,\n createdIssues: Array<{ issue: Issue, githubUrl: string, number: number }>\n): string {\n let output = `šŸ“ Review Results\\n\\n`;\n output += `šŸ“‹ Summary: ${result.summary}\\n`;\n output += `šŸ“Š Total Issues Found: ${result.totalIssues}\\n`;\n output += `šŸš€ GitHub Issues Created: ${createdIssues.length}\\n\\n`;\n\n if (result.issues && result.issues.length > 0) {\n output += `šŸ“ Issues Identified:\\n\\n`;\n\n result.issues.forEach((issue, index) => {\n const priorityEmoji = issue.priority === 'high' ? 'šŸ”“' :\n issue.priority === 'medium' ? '🟔' : '🟢';\n const categoryEmoji = issue.category === 'ui' ? 'šŸŽØ' :\n issue.category === 'content' ? 'šŸ“' :\n issue.category === 'functionality' ? 'āš™ļø' :\n issue.category === 'accessibility' ? '♿' :\n issue.category === 'performance' ? '⚔' : 'šŸ”§';\n\n output += `${index + 1}. ${priorityEmoji} ${issue.title}\\n`;\n output += ` ${categoryEmoji} Category: ${issue.category} | Priority: ${issue.priority}\\n`;\n output += ` šŸ“– Description: ${issue.description}\\n`;\n\n // Check if this issue was created as a GitHub issue\n const createdIssue = createdIssues.find(ci => ci.issue === issue);\n if (createdIssue) {\n output += ` šŸ”— GitHub Issue: #${createdIssue.number} - ${createdIssue.githubUrl}\\n`;\n }\n\n if (issue.suggestions && issue.suggestions.length > 0) {\n output += ` šŸ’” Suggestions:\\n`;\n issue.suggestions.forEach(suggestion => {\n output += ` • ${suggestion}\\n`;\n });\n }\n output += `\\n`;\n });\n } else {\n output += `āœ… No specific issues identified from the review.\\n\\n`;\n }\n\n if (createdIssues.length > 0) {\n output += `\\nšŸŽÆ Created GitHub Issues:\\n`;\n createdIssues.forEach(createdIssue => {\n output += `• #${createdIssue.number}: ${createdIssue.issue.title} - ${createdIssue.githubUrl}\\n`;\n });\n output += `\\n`;\n }\n\n output += `šŸš€ Next Steps: Review the created GitHub issues and prioritize them in your development workflow.`;\n\n return output;\n}\n\nfunction formatReviewResults(result: ReviewResult): string {\n let output = `šŸ“ Review Results\\n\\n`;\n output += `šŸ“‹ Summary: ${result.summary}\\n`;\n output += `šŸ“Š Total Issues Found: ${result.totalIssues}\\n\\n`;\n\n if (result.issues && result.issues.length > 0) {\n output += `šŸ“ Issues Identified:\\n\\n`;\n\n result.issues.forEach((issue, index) => {\n const priorityEmoji = issue.priority === 'high' ? 'šŸ”“' :\n issue.priority === 'medium' ? '🟔' : '🟢';\n const categoryEmoji = issue.category === 'ui' ? 'šŸŽØ' :\n issue.category === 'content' ? 'šŸ“' :\n issue.category === 'functionality' ? 'āš™ļø' :\n issue.category === 'accessibility' ? '♿' :\n issue.category === 'performance' ? '⚔' : 'šŸ”§';\n\n output += `${index + 1}. ${priorityEmoji} ${issue.title}\\n`;\n output += ` ${categoryEmoji} Category: ${issue.category} | Priority: ${issue.priority}\\n`;\n output += ` šŸ“– Description: ${issue.description}\\n`;\n\n if (issue.suggestions && issue.suggestions.length > 0) {\n output += ` šŸ’” Suggestions:\\n`;\n issue.suggestions.forEach(suggestion => {\n output += ` • ${suggestion}\\n`;\n });\n }\n output += `\\n`;\n });\n } else {\n output += `āœ… No specific issues identified from the review.\\n\\n`;\n }\n\n output += `šŸš€ Next Steps: Review the identified issues and prioritize them for your development workflow.`;\n\n return output;\n}\n\n// Handle GitHub issue creation workflow\nexport const handleIssueCreation = async (\n result: ReviewResult,\n senditMode: boolean = false\n): Promise<string> => {\n const logger = getLogger();\n const createdIssues: Array<{ issue: Issue, githubUrl: string, number: number }> = [];\n\n if (!result.issues || result.issues.length === 0) {\n return formatReviewResults(result);\n }\n\n logger.info(`šŸ” Found ${result.issues.length} issues to potentially create as GitHub issues`);\n\n for (let i = 0; i < result.issues.length; i++) {\n let issue = result.issues[i];\n let shouldCreateIssue = senditMode;\n\n if (!senditMode) {\n // Interactive confirmation for each issue - keep looping until user decides\n let userChoice = '';\n while (userChoice !== 'c' && userChoice !== 's') {\n // Display issue details\n logger.info(`\\nšŸ“‹ Issue ${i + 1} of ${result.issues.length}:`);\n logger.info(` Title: ${issue.title}`);\n logger.info(` Priority: ${issue.priority} | Category: ${issue.category}`);\n logger.info(` Description: ${issue.description}`);\n if (issue.suggestions && issue.suggestions.length > 0) {\n logger.info(` Suggestions: ${issue.suggestions.join(', ')}`);\n }\n\n // Get user choice\n userChoice = await getUserChoice('\\nWhat would you like to do with this issue?', [\n { key: 'c', label: 'Create GitHub issue' },\n { key: 's', label: 'Skip this issue' },\n { key: 'e', label: 'Edit issue details' }\n ]);\n\n if (userChoice === 'c') {\n shouldCreateIssue = true;\n } else if (userChoice === 'e') {\n // Allow user to edit the issue\n issue = await editIssueInteractively(issue);\n result.issues[i] = issue; // Update the issue in the result\n // Continue the loop to show the updated issue and ask again\n }\n // If choice is 's', loop will exit and shouldCreateIssue remains false\n }\n }\n\n if (shouldCreateIssue) {\n try {\n logger.info(`šŸš€ Creating GitHub issue: \"${issue.title}\"`);\n\n // Format issue body with additional details\n const issueBody = formatIssueBody(issue);\n\n // Create labels based on priority and category\n const labels = [\n `priority-${issue.priority}`,\n `category-${issue.category}`,\n 'review'\n ];\n\n const createdIssue = await createIssue(issue.title, issueBody, labels);\n createdIssues.push({\n issue,\n githubUrl: createdIssue.html_url,\n number: createdIssue.number\n });\n\n logger.info(`āœ… Created GitHub issue #${createdIssue.number}: ${createdIssue.html_url}`);\n } catch (error: any) {\n logger.error(`āŒ Failed to create GitHub issue for \"${issue.title}\": ${error.message}`);\n }\n }\n }\n\n // Return formatted results\n if (createdIssues.length > 0) {\n return formatReviewResultsWithIssues(result, createdIssues);\n } else {\n return formatReviewResults(result);\n }\n};\n"],"names":["get","options","logger","getLogger","limit","debug","issuesLimit","Math","min","githubIssues","getOpenIssues","trim","length","error","warn","message","getUserChoice","prompt","choices","getUserChoiceInteractive","serializeIssue","issue","lines","title","priority","category","description","suggestions","forEach","suggestion","push","join","deserializeIssue","content","split","currentSection","descriptionLines","i","line","startsWith","substring","priorityValue","toLowerCase","categoryValue","includes","suggestionLine","replace","undefined","editIssueInteractively","editor","process","env","EDITOR","VISUAL","tmpDir","os","tmpdir","tmpFilePath","path","Date","now","issueContent","fs","writeFile","info","result","spawnSync","stdio","Error","editedContent","readFile","unlink","code","editedIssue","JSON","stringify","formatIssueBody","body","formatReviewResultsWithIssues","createdIssues","output","summary","totalIssues","issues","index","priorityEmoji","categoryEmoji","createdIssue","find","ci","number","githubUrl","formatReviewResults","handleIssueCreation","senditMode","shouldCreateIssue","userChoice","key","label","issueBody","labels","createIssue","html_url"],"mappings":";;;;;;;;AAsBA;AACO,MAAMA,GAAAA,GAAM,OAAOC,OAAAA,GAA8B,EAAE,GAAA;AACtD,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;AACf,IAAA,MAAM,EAAEC,KAAAA,GAAQ,EAAE,EAAE,GAAGH,OAAAA;IAEvB,IAAI;AACAC,QAAAA,MAAAA,CAAOG,KAAK,CAAC,gCAAA,CAAA;AACb,QAAA,MAAM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