@eldrforge/kodrdriv 0.0.15 → 0.0.17
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/README.md +1 -9
- package/dist/arguments.js +38 -63
- package/dist/arguments.js.map +1 -1
- package/dist/audio/devices.js +284 -0
- package/dist/audio/devices.js.map +1 -0
- package/dist/audio/index.js +31 -0
- package/dist/audio/index.js.map +1 -0
- package/dist/audio/processor.js +766 -0
- package/dist/audio/processor.js.map +1 -0
- package/dist/audio/types.js +16 -0
- package/dist/audio/types.js.map +1 -0
- package/dist/audio/validation.js +35 -0
- package/dist/audio/validation.js.map +1 -0
- package/dist/commands/audio-commit.js +59 -634
- package/dist/commands/audio-commit.js.map +1 -1
- package/dist/commands/audio-review.js +68 -632
- package/dist/commands/audio-review.js.map +1 -1
- package/dist/commands/select-audio.js +265 -0
- package/dist/commands/select-audio.js.map +1 -0
- package/dist/constants.js +15 -6
- package/dist/constants.js.map +1 -1
- package/dist/content/issues.js +16 -0
- package/dist/content/issues.js.map +1 -1
- package/dist/main.js +6 -2
- package/dist/main.js.map +1 -1
- package/dist/types.js +5 -3
- package/dist/types.js.map +1 -1
- package/dist/util/openai.js +34 -3
- package/dist/util/openai.js.map +1 -1
- package/package.json +2 -2
- package/.kodrdriv/config.yaml +0 -20
- package/.kodrdriv/context/content.md +0 -7
- package/RELEASE_NOTES.md +0 -14
- package/docs/index.html +0 -17
- package/docs/package.json +0 -36
- package/docs/pnpm-lock.yaml +0 -3441
- package/docs/public/README.md +0 -132
- package/docs/public/advanced-usage.md +0 -188
- package/docs/public/code-icon.svg +0 -4
- package/docs/public/commands.md +0 -136
- package/docs/public/configuration.md +0 -274
- package/docs/public/examples.md +0 -352
- package/docs/public/kodrdriv-logo.svg +0 -62
- package/docs/src/App.css +0 -387
- package/docs/src/App.tsx +0 -60
- package/docs/src/components/DocumentPage.tsx +0 -56
- package/docs/src/components/ErrorMessage.tsx +0 -15
- package/docs/src/components/LoadingSpinner.tsx +0 -14
- package/docs/src/components/MarkdownRenderer.tsx +0 -56
- package/docs/src/components/Navigation.css +0 -73
- package/docs/src/components/Navigation.tsx +0 -36
- package/docs/src/index.css +0 -61
- package/docs/src/main.tsx +0 -10
- package/docs/src/test/setup.ts +0 -1
- package/docs/src/vite-env.d.ts +0 -10
- package/docs/tsconfig.node.json +0 -13
- package/docs/vite.config.ts +0 -15
- package/docs/vitest.config.ts +0 -15
- package/eslint.config.mjs +0 -83
- package/nodemon.json +0 -14
- package/output/kodrdriv/250702-0552-release-notes.md +0 -3
- package/pnpm-workspace.yaml +0 -5
- package/tsconfig.tsbuildinfo +0 -1
- package/vite.config.ts +0 -90
- package/vitest.config.ts +0 -24
package/README.md
CHANGED
|
@@ -121,12 +121,4 @@ Apache-2.0 - see [LICENSE](LICENSE) file for details.
|
|
|
121
121
|
|
|
122
122
|
## About the Name
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
Like Thor's hammer, this tool smashes through your repetitive coding tasks. But unlike Mjölnir, it won't make you worthy — it'll just make you faster. Strike through commits, forge releases, and channel the lightning of AI to automate your workflow. Because sometimes you need a hammer, and sometimes you need a tool that actually works.
|
package/dist/arguments.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { PROGRAM_NAME, VERSION, KODRDRIV_DEFAULTS, ALLOWED_COMMANDS, DEFAULT_COMMAND
|
|
3
|
+
import { PROGRAM_NAME, VERSION, KODRDRIV_DEFAULTS, ALLOWED_COMMANDS, DEFAULT_COMMAND } from './constants.js';
|
|
4
4
|
import { getLogger } from './logging.js';
|
|
5
5
|
import { create } from './util/storage.js';
|
|
6
6
|
import { readStdin } from './util/stdin.js';
|
|
@@ -12,12 +12,11 @@ z.object({
|
|
|
12
12
|
overrides: z.boolean().optional(),
|
|
13
13
|
checkConfig: z.boolean().optional(),
|
|
14
14
|
initConfig: z.boolean().optional(),
|
|
15
|
-
openaiApiKey: z.string().optional(),
|
|
16
15
|
model: z.string().optional(),
|
|
17
16
|
contextDirectories: z.array(z.string()).optional(),
|
|
18
|
-
instructions: z.string().optional(),
|
|
19
17
|
configDir: z.string().optional(),
|
|
20
18
|
outputDir: z.string().optional(),
|
|
19
|
+
preferencesDir: z.string().optional(),
|
|
21
20
|
cached: z.boolean().optional(),
|
|
22
21
|
add: z.boolean().optional(),
|
|
23
22
|
sendit: z.boolean().optional(),
|
|
@@ -43,7 +42,8 @@ z.object({
|
|
|
43
42
|
diffHistoryLimit: z.number().optional(),
|
|
44
43
|
releaseNotesLimit: z.number().optional(),
|
|
45
44
|
githubIssuesLimit: z.number().optional(),
|
|
46
|
-
|
|
45
|
+
file: z.string().optional(),
|
|
46
|
+
keepTemp: z.boolean().optional()
|
|
47
47
|
});
|
|
48
48
|
// Function to transform flat CLI args into nested Config structure
|
|
49
49
|
const transformCliArgs = (finalCliArgs)=>{
|
|
@@ -55,11 +55,12 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
55
55
|
if (finalCliArgs.overrides !== undefined) transformedCliArgs.overrides = finalCliArgs.overrides;
|
|
56
56
|
if (finalCliArgs.model !== undefined) transformedCliArgs.model = finalCliArgs.model;
|
|
57
57
|
if (finalCliArgs.contextDirectories !== undefined) transformedCliArgs.contextDirectories = finalCliArgs.contextDirectories;
|
|
58
|
-
if (finalCliArgs.instructions !== undefined) transformedCliArgs.instructions = finalCliArgs.instructions;
|
|
59
58
|
// Map configDir (CLI) to configDirectory (Cardigantime standard)
|
|
60
59
|
if (finalCliArgs.configDir !== undefined) transformedCliArgs.configDirectory = finalCliArgs.configDir;
|
|
61
60
|
// Map outputDir (CLI) to outputDirectory (Config standard)
|
|
62
61
|
if (finalCliArgs.outputDir !== undefined) transformedCliArgs.outputDirectory = finalCliArgs.outputDir;
|
|
62
|
+
// Map preferencesDir (CLI) to preferencesDirectory (Config standard)
|
|
63
|
+
if (finalCliArgs.preferencesDir !== undefined) transformedCliArgs.preferencesDirectory = finalCliArgs.preferencesDir;
|
|
63
64
|
// Nested mappings for 'commit' options
|
|
64
65
|
if (finalCliArgs.cached !== undefined || finalCliArgs.sendit !== undefined || finalCliArgs.add !== undefined) {
|
|
65
66
|
transformedCliArgs.commit = {};
|
|
@@ -71,9 +72,10 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
71
72
|
if (finalCliArgs.direction !== undefined) transformedCliArgs.commit.direction = finalCliArgs.direction;
|
|
72
73
|
}
|
|
73
74
|
// Nested mappings for 'audioCommit' options
|
|
74
|
-
if (finalCliArgs.
|
|
75
|
+
if (finalCliArgs.file !== undefined || finalCliArgs.keepTemp !== undefined) {
|
|
75
76
|
transformedCliArgs.audioCommit = {};
|
|
76
|
-
transformedCliArgs.audioCommit.
|
|
77
|
+
if (finalCliArgs.file !== undefined) transformedCliArgs.audioCommit.file = finalCliArgs.file;
|
|
78
|
+
if (finalCliArgs.keepTemp !== undefined) transformedCliArgs.audioCommit.keepTemp = finalCliArgs.keepTemp;
|
|
77
79
|
}
|
|
78
80
|
// Nested mappings for 'release' options
|
|
79
81
|
if (finalCliArgs.from !== undefined || finalCliArgs.to !== undefined) {
|
|
@@ -101,7 +103,7 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
101
103
|
if (finalCliArgs.workspaceFile !== undefined) transformedCliArgs.link.workspaceFile = finalCliArgs.workspaceFile;
|
|
102
104
|
}
|
|
103
105
|
// Nested mappings for 'audio-review' options
|
|
104
|
-
if (finalCliArgs.includeCommitHistory !== undefined || finalCliArgs.includeRecentDiffs !== undefined || finalCliArgs.includeReleaseNotes !== undefined || finalCliArgs.includeGithubIssues !== undefined || finalCliArgs.commitHistoryLimit !== undefined || finalCliArgs.diffHistoryLimit !== undefined || finalCliArgs.releaseNotesLimit !== undefined || finalCliArgs.githubIssuesLimit !== undefined) {
|
|
106
|
+
if (finalCliArgs.includeCommitHistory !== undefined || finalCliArgs.includeRecentDiffs !== undefined || finalCliArgs.includeReleaseNotes !== undefined || finalCliArgs.includeGithubIssues !== undefined || finalCliArgs.commitHistoryLimit !== undefined || finalCliArgs.diffHistoryLimit !== undefined || finalCliArgs.releaseNotesLimit !== undefined || finalCliArgs.githubIssuesLimit !== undefined || finalCliArgs.file !== undefined || finalCliArgs.keepTemp !== undefined) {
|
|
105
107
|
transformedCliArgs.audioReview = {};
|
|
106
108
|
if (finalCliArgs.includeCommitHistory !== undefined) transformedCliArgs.audioReview.includeCommitHistory = finalCliArgs.includeCommitHistory;
|
|
107
109
|
if (finalCliArgs.includeRecentDiffs !== undefined) transformedCliArgs.audioReview.includeRecentDiffs = finalCliArgs.includeRecentDiffs;
|
|
@@ -111,9 +113,10 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
111
113
|
if (finalCliArgs.diffHistoryLimit !== undefined) transformedCliArgs.audioReview.diffHistoryLimit = finalCliArgs.diffHistoryLimit;
|
|
112
114
|
if (finalCliArgs.releaseNotesLimit !== undefined) transformedCliArgs.audioReview.releaseNotesLimit = finalCliArgs.releaseNotesLimit;
|
|
113
115
|
if (finalCliArgs.githubIssuesLimit !== undefined) transformedCliArgs.audioReview.githubIssuesLimit = finalCliArgs.githubIssuesLimit;
|
|
114
|
-
// Only add context and sendit if we already have an audioReview object from the specific properties above
|
|
115
116
|
if (finalCliArgs.context !== undefined) transformedCliArgs.audioReview.context = finalCliArgs.context;
|
|
116
117
|
if (finalCliArgs.sendit !== undefined) transformedCliArgs.audioReview.sendit = finalCliArgs.sendit;
|
|
118
|
+
if (finalCliArgs.file !== undefined) transformedCliArgs.audioReview.file = finalCliArgs.file;
|
|
119
|
+
if (finalCliArgs.keepTemp !== undefined) transformedCliArgs.audioReview.keepTemp = finalCliArgs.keepTemp;
|
|
117
120
|
}
|
|
118
121
|
// Nested mappings for 'review' options
|
|
119
122
|
if (finalCliArgs.includeCommitHistory !== undefined || finalCliArgs.includeRecentDiffs !== undefined || finalCliArgs.includeReleaseNotes !== undefined || finalCliArgs.includeGithubIssues !== undefined || finalCliArgs.commitHistoryLimit !== undefined || finalCliArgs.diffHistoryLimit !== undefined || finalCliArgs.releaseNotesLimit !== undefined || finalCliArgs.githubIssuesLimit !== undefined || finalCliArgs.context !== undefined || finalCliArgs.sendit !== undefined || finalCliArgs.note !== undefined) {
|
|
@@ -132,7 +135,7 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
132
135
|
if (finalCliArgs.sendit !== undefined) transformedCliArgs.review.sendit = finalCliArgs.sendit;
|
|
133
136
|
}
|
|
134
137
|
if (finalCliArgs.excludedPatterns !== undefined) transformedCliArgs.excludedPatterns = finalCliArgs.excludedPatterns;
|
|
135
|
-
// Note:
|
|
138
|
+
// Note: openaiApiKey is handled separately via environment variable only
|
|
136
139
|
return transformedCliArgs;
|
|
137
140
|
};
|
|
138
141
|
// Update configure signature to accept cardigantime
|
|
@@ -238,8 +241,8 @@ const configure = async (cardigantime)=>{
|
|
|
238
241
|
async function getCliConfig(program) {
|
|
239
242
|
const addSharedOptions = (command)=>{
|
|
240
243
|
command.option('--dry-run', 'perform a dry run without saving files') // Removed default, will be handled by merging
|
|
241
|
-
.option('--verbose', 'enable verbose logging').option('--debug', 'enable debug logging').option('--overrides', 'enable overrides').option('--model <model>', 'OpenAI model to use').option('-d, --context-directories [contextDirectories...]', 'directories to scan for context').option('
|
|
242
|
-
.option('--output-dir <outputDir>', 'output directory for generated files').option('--excluded-paths [excludedPatterns...]', 'paths to exclude from the diff');
|
|
244
|
+
.option('--verbose', 'enable verbose logging').option('--debug', 'enable debug logging').option('--overrides', 'enable overrides').option('--model <model>', 'OpenAI model to use').option('-d, --context-directories [contextDirectories...]', 'directories to scan for context').option('--config-dir <configDir>', 'configuration directory') // Keep config-dir for specifying location
|
|
245
|
+
.option('--output-dir <outputDir>', 'output directory for generated files').option('--preferences-dir <preferencesDir>', 'preferences directory for personal settings').option('--excluded-paths [excludedPatterns...]', 'paths to exclude from the diff').option('--keep-temp', 'keep temporary recording files');
|
|
243
246
|
};
|
|
244
247
|
// Add global options to the main program
|
|
245
248
|
// (cardigantime already adds most global options like --verbose, --debug, --config-dir)
|
|
@@ -300,10 +303,6 @@ async function getCliConfig(program) {
|
|
|
300
303
|
'-d, --context-directories [contextDirectories...]',
|
|
301
304
|
'directories to scan for context'
|
|
302
305
|
],
|
|
303
|
-
[
|
|
304
|
-
'-i, --instructions <file>',
|
|
305
|
-
'instructions for the AI'
|
|
306
|
-
],
|
|
307
306
|
[
|
|
308
307
|
'--config-dir <configDir>',
|
|
309
308
|
'configuration directory'
|
|
@@ -321,10 +320,10 @@ async function getCliConfig(program) {
|
|
|
321
320
|
const maxWidth = Math.max(...options.map(([flag])=>flag.length));
|
|
322
321
|
return `${title}:\n` + options.map(([flag, desc])=>` ${flag.padEnd(maxWidth + 2)} ${desc}`).join('\n') + '\n';
|
|
323
322
|
};
|
|
324
|
-
return nameAndVersion + '\n' + formatOptionsSection('Commit Message Options', commitOptions) + '\n' + formatOptionsSection('Behavioral Options', behavioralOptions) + '\n' + formatOptionsSection('Global Options', globalOptions);
|
|
323
|
+
return nameAndVersion + '\n' + formatOptionsSection('Commit Message Options', commitOptions) + '\n' + formatOptionsSection('Behavioral Options', behavioralOptions) + '\n' + formatOptionsSection('Global Options', globalOptions) + '\n' + 'Environment Variables:\n' + ' OPENAI_API_KEY OpenAI API key (required)\n';
|
|
325
324
|
}
|
|
326
325
|
});
|
|
327
|
-
const audioCommitCommand = program.command('audio-commit').option('--cached', 'use cached diff').option('--add', 'add all changes before committing').option('--sendit', 'Commit with the message generated. No review.').option('--direction <direction>', 'direction or guidance for the commit message').option('--message-limit <messageLimit>', 'limit the number of messages to generate').option('--
|
|
326
|
+
const audioCommitCommand = program.command('audio-commit').option('--cached', 'use cached diff').option('--add', 'add all changes before committing').option('--sendit', 'Commit with the message generated. No review.').option('--direction <direction>', 'direction or guidance for the commit message').option('--message-limit <messageLimit>', 'limit the number of messages to generate').option('--file <file>', 'audio file path').description('Record audio to provide context, then generate and optionally commit with AI-generated message');
|
|
328
327
|
addSharedOptions(audioCommitCommand);
|
|
329
328
|
const releaseCommand = program.command('release').option('--from <from>', 'branch to generate release notes from').option('--to <to>', 'branch to generate release notes to').option('--context <context>', 'context for the commit message').description('Generate release notes');
|
|
330
329
|
addSharedOptions(releaseCommand);
|
|
@@ -334,7 +333,7 @@ async function getCliConfig(program) {
|
|
|
334
333
|
addSharedOptions(linkCommand);
|
|
335
334
|
const unlinkCommand = program.command('unlink').option('--scope-roots <scopeRoots>', 'JSON mapping of scopes to root directories (e.g., \'{"@company": "../"}\')').option('--workspace-file <workspaceFile>', 'path to workspace file', 'pnpm-workspace.yaml').description('Remove pnpm workspace links and rebuild dependencies');
|
|
336
335
|
addSharedOptions(unlinkCommand);
|
|
337
|
-
const audioReviewCommand = program.command('audio-review').option('--include-commit-history', 'include recent commit log messages in context (default: true)').option('--no-include-commit-history', 'exclude commit log messages from context').option('--include-recent-diffs', 'include recent commit diffs in context (default: true)').option('--no-include-recent-diffs', 'exclude recent diffs from context').option('--include-release-notes', 'include recent release notes in context (default: false)').option('--no-include-release-notes', 'exclude release notes from context').option('--include-github-issues', 'include open GitHub issues in context (default: true)').option('--no-include-github-issues', 'exclude GitHub issues from context').option('--commit-history-limit <limit>', 'number of recent commits to include', parseInt).option('--diff-history-limit <limit>', 'number of recent commit diffs to include', parseInt).option('--release-notes-limit <limit>', 'number of recent release notes to include', parseInt).option('--github-issues-limit <limit>', 'number of open GitHub issues to include (max 20)', parseInt).option('--context <context>', 'additional context for the audio review').option('--
|
|
336
|
+
const audioReviewCommand = program.command('audio-review').option('--include-commit-history', 'include recent commit log messages in context (default: true)').option('--no-include-commit-history', 'exclude commit log messages from context').option('--include-recent-diffs', 'include recent commit diffs in context (default: true)').option('--no-include-recent-diffs', 'exclude recent diffs from context').option('--include-release-notes', 'include recent release notes in context (default: false)').option('--no-include-release-notes', 'exclude release notes from context').option('--include-github-issues', 'include open GitHub issues in context (default: true)').option('--no-include-github-issues', 'exclude GitHub issues from context').option('--commit-history-limit <limit>', 'number of recent commits to include', parseInt).option('--diff-history-limit <limit>', 'number of recent commit diffs to include', parseInt).option('--release-notes-limit <limit>', 'number of recent release notes to include', parseInt).option('--github-issues-limit <limit>', 'number of open GitHub issues to include (max 20)', parseInt).option('--context <context>', 'additional context for the audio review').option('--file <file>', 'audio file path').description('Record audio, transcribe with Whisper, and analyze for project issues using AI');
|
|
338
337
|
addSharedOptions(audioReviewCommand);
|
|
339
338
|
const reviewCommand = program.command('review').argument('[note]', 'review note to analyze for project issues').option('--include-commit-history', 'include recent commit log messages in context (default: true)').option('--no-include-commit-history', 'exclude commit log messages from context').option('--include-recent-diffs', 'include recent commit diffs in context (default: true)').option('--no-include-recent-diffs', 'exclude recent diffs from context').option('--include-release-notes', 'include recent release notes in context (default: false)').option('--no-include-release-notes', 'exclude release notes from context').option('--include-github-issues', 'include open GitHub issues in context (default: true)').option('--no-include-github-issues', 'exclude GitHub issues from context').option('--commit-history-limit <limit>', 'number of recent commits to include', parseInt).option('--diff-history-limit <limit>', 'number of recent commit diffs to include', parseInt).option('--release-notes-limit <limit>', 'number of recent release notes to include', parseInt).option('--github-issues-limit <limit>', 'number of open GitHub issues to include (max 20)', parseInt).option('--context <context>', 'additional context for the review').option('--sendit', 'Create GitHub issues automatically without confirmation').description('Analyze review note for project issues using AI');
|
|
340
339
|
addSharedOptions(reviewCommand);
|
|
@@ -435,10 +434,6 @@ async function getCliConfig(program) {
|
|
|
435
434
|
'-d, --context-directories [contextDirectories...]',
|
|
436
435
|
'directories to scan for context'
|
|
437
436
|
],
|
|
438
|
-
[
|
|
439
|
-
'-i, --instructions <file>',
|
|
440
|
-
'instructions for the AI'
|
|
441
|
-
],
|
|
442
437
|
[
|
|
443
438
|
'--config-dir <configDir>',
|
|
444
439
|
'configuration directory'
|
|
@@ -460,11 +455,13 @@ async function getCliConfig(program) {
|
|
|
460
455
|
const maxWidth = Math.max(...options.map(([flag])=>flag.length));
|
|
461
456
|
return `${title}:\n` + options.map(([flag, desc])=>` ${flag.padEnd(maxWidth + 2)} ${desc}`).join('\n') + '\n';
|
|
462
457
|
};
|
|
463
|
-
return nameAndVersion + '\n' + formatOptionsSection('Arguments', argumentsSection) + '\n' + formatOptionsSection('Options', reviewOptions) + '\n' + formatOptionsSection('Git Context Parameters', gitContextOptions) + '\n' + formatOptionsSection('Behavioral Options', behavioralOptions) + '\n' + formatOptionsSection('Global Options', globalOptions);
|
|
458
|
+
return nameAndVersion + '\n' + formatOptionsSection('Arguments', argumentsSection) + '\n' + formatOptionsSection('Options', reviewOptions) + '\n' + formatOptionsSection('Git Context Parameters', gitContextOptions) + '\n' + formatOptionsSection('Behavioral Options', behavioralOptions) + '\n' + formatOptionsSection('Global Options', globalOptions) + '\n' + 'Environment Variables:\n' + ' OPENAI_API_KEY OpenAI API key (required)\n';
|
|
464
459
|
}
|
|
465
460
|
});
|
|
466
461
|
const cleanCommand = program.command('clean').description('Remove the output directory and all generated files');
|
|
467
462
|
addSharedOptions(cleanCommand);
|
|
463
|
+
const selectAudioCommand = program.command('select-audio').description('Interactively select and save audio device for recording');
|
|
464
|
+
addSharedOptions(selectAudioCommand);
|
|
468
465
|
program.parse();
|
|
469
466
|
const cliArgs = program.opts(); // Get all opts initially
|
|
470
467
|
// Determine which command is being run
|
|
@@ -514,6 +511,8 @@ async function getCliConfig(program) {
|
|
|
514
511
|
}
|
|
515
512
|
} else if (commandName === 'clean' && cleanCommand.opts) {
|
|
516
513
|
commandOptions = cleanCommand.opts();
|
|
514
|
+
} else if (commandName === 'select-audio' && selectAudioCommand.opts) {
|
|
515
|
+
commandOptions = selectAudioCommand.opts();
|
|
517
516
|
}
|
|
518
517
|
}
|
|
519
518
|
// Include command name in CLI args for merging
|
|
@@ -534,7 +533,7 @@ async function validateAndProcessSecureOptions() {
|
|
|
534
533
|
const isCheckConfig = process.argv.includes('--check-config');
|
|
535
534
|
const isInitConfig = process.argv.includes('--init-config');
|
|
536
535
|
if (!process.env.OPENAI_API_KEY && !isCheckConfig && !isInitConfig) {
|
|
537
|
-
throw new Error('OpenAI API key is required
|
|
536
|
+
throw new Error('OpenAI API key is required. Please set the OPENAI_API_KEY environment variable.');
|
|
538
537
|
}
|
|
539
538
|
// Prefer CLI key if provided, otherwise use env var (might be undefined for check-config/init-config)
|
|
540
539
|
const openaiApiKey = process.env.OPENAI_API_KEY;
|
|
@@ -545,12 +544,10 @@ async function validateAndProcessSecureOptions() {
|
|
|
545
544
|
}
|
|
546
545
|
// Renamed validation function to reflect its broader role
|
|
547
546
|
async function validateAndProcessOptions(options) {
|
|
548
|
-
var _options_commit, _options_commit1, _options_commit2, _options_commit3, _options_commit4, _options_commit5, _options_audioCommit, _options_audioCommit1, _options_audioCommit2, _options_release, _options_release1, _options_release2, _options_release3, _options_audioReview, _options_audioReview1, _options_audioReview2, _options_audioReview3, _options_audioReview4, _options_audioReview5, _options_audioReview6, _options_audioReview7, _options_audioReview8, _options_audioReview9, _options_review, _options_review1, _options_review2, _options_review3, _options_review4, _options_review5, _options_review6, _options_review7, _options_review8, _options_review9, _options_review10, _options_publish, _options_publish1, _options_publish2, _options_link, _options_link1, _options_link2;
|
|
547
|
+
var _options_commit, _options_commit1, _options_commit2, _options_commit3, _options_commit4, _options_commit5, _options_audioCommit, _options_audioCommit1, _options_audioCommit2, _options_audioCommit3, _options_release, _options_release1, _options_release2, _options_release3, _options_audioReview, _options_audioReview1, _options_audioReview2, _options_audioReview3, _options_audioReview4, _options_audioReview5, _options_audioReview6, _options_audioReview7, _options_audioReview8, _options_audioReview9, _options_audioReview10, _options_audioReview11, _options_audioReview12, _options_audioReview13, _options_review, _options_review1, _options_review2, _options_review3, _options_review4, _options_review5, _options_review6, _options_review7, _options_review8, _options_review9, _options_review10, _options_publish, _options_publish1, _options_publish2, _options_publish3, _options_publish4, _options_link, _options_link1, _options_link2;
|
|
549
548
|
const contextDirectories = await validateContextDirectories(options.contextDirectories || KODRDRIV_DEFAULTS.contextDirectories);
|
|
550
|
-
const instructionsPathOrContent = options.instructions || KODRDRIV_DEFAULTS.instructions;
|
|
551
|
-
const instructions = await validateAndReadInstructions(instructionsPathOrContent);
|
|
552
549
|
const configDir = options.configDirectory || KODRDRIV_DEFAULTS.configDirectory;
|
|
553
|
-
var _options_dryRun, _options_verbose, _options_debug, _options_overrides, _options_model, _options_outputDirectory, _options_commit_add, _options_commit_cached, _options_commit_sendit, _options_commit_messageLimit, _options_audioCommit_maxRecordingTime, _options_audioCommit_audioDevice, _options_release_from, _options_release_to, _options_release_messageLimit, _options_audioReview_includeCommitHistory, _options_audioReview_includeRecentDiffs, _options_audioReview_includeReleaseNotes, _options_audioReview_includeGithubIssues, _options_audioReview_commitHistoryLimit, _options_audioReview_diffHistoryLimit, _options_audioReview_releaseNotesLimit, _options_audioReview_githubIssuesLimit, _options_audioReview_sendit, _options_review_includeCommitHistory, _options_review_includeRecentDiffs, _options_review_includeReleaseNotes, _options_review_includeGithubIssues, _options_review_commitHistoryLimit, _options_review_diffHistoryLimit, _options_review_releaseNotesLimit, _options_review_githubIssuesLimit, _options_review_sendit, _options_publish_mergeMethod, _options_publish_requiredEnvVars, _options_link_scopeRoots, _options_link_workspaceFile, _options_link_dryRun, _options_excludedPatterns;
|
|
550
|
+
var _options_dryRun, _options_verbose, _options_debug, _options_overrides, _options_model, _options_outputDirectory, _options_preferencesDirectory, _options_commit_add, _options_commit_cached, _options_commit_sendit, _options_commit_messageLimit, _options_audioCommit_maxRecordingTime, _options_audioCommit_audioDevice, _options_release_from, _options_release_to, _options_release_messageLimit, _options_audioReview_includeCommitHistory, _options_audioReview_includeRecentDiffs, _options_audioReview_includeReleaseNotes, _options_audioReview_includeGithubIssues, _options_audioReview_commitHistoryLimit, _options_audioReview_diffHistoryLimit, _options_audioReview_releaseNotesLimit, _options_audioReview_githubIssuesLimit, _options_audioReview_sendit, _options_audioReview_maxRecordingTime, _options_audioReview_audioDevice, _options_review_includeCommitHistory, _options_review_includeRecentDiffs, _options_review_includeReleaseNotes, _options_review_includeGithubIssues, _options_review_commitHistoryLimit, _options_review_diffHistoryLimit, _options_review_releaseNotesLimit, _options_review_githubIssuesLimit, _options_review_sendit, _options_publish_mergeMethod, _options_publish_requiredEnvVars, _options_publish_linkWorkspacePackages, _options_publish_unlinkWorkspacePackages, _options_link_scopeRoots, _options_link_workspaceFile, _options_link_dryRun, _options_excludedPatterns;
|
|
554
551
|
// Skip config directory validation since Cardigantime handles hierarchical lookup
|
|
555
552
|
// Ensure all required fields are present and have correct types after merging
|
|
556
553
|
const finalConfig = {
|
|
@@ -559,10 +556,10 @@ async function validateAndProcessOptions(options) {
|
|
|
559
556
|
debug: (_options_debug = options.debug) !== null && _options_debug !== void 0 ? _options_debug : KODRDRIV_DEFAULTS.debug,
|
|
560
557
|
overrides: (_options_overrides = options.overrides) !== null && _options_overrides !== void 0 ? _options_overrides : KODRDRIV_DEFAULTS.overrides,
|
|
561
558
|
model: (_options_model = options.model) !== null && _options_model !== void 0 ? _options_model : KODRDRIV_DEFAULTS.model,
|
|
562
|
-
instructions: instructions,
|
|
563
559
|
contextDirectories: contextDirectories,
|
|
564
560
|
configDirectory: configDir,
|
|
565
561
|
outputDirectory: (_options_outputDirectory = options.outputDirectory) !== null && _options_outputDirectory !== void 0 ? _options_outputDirectory : KODRDRIV_DEFAULTS.outputDirectory,
|
|
562
|
+
preferencesDirectory: (_options_preferencesDirectory = options.preferencesDirectory) !== null && _options_preferencesDirectory !== void 0 ? _options_preferencesDirectory : KODRDRIV_DEFAULTS.preferencesDirectory,
|
|
566
563
|
// Command-specific options with defaults
|
|
567
564
|
commit: {
|
|
568
565
|
add: (_options_commit_add = (_options_commit = options.commit) === null || _options_commit === void 0 ? void 0 : _options_commit.add) !== null && _options_commit_add !== void 0 ? _options_commit_add : KODRDRIV_DEFAULTS.commit.add,
|
|
@@ -575,7 +572,8 @@ async function validateAndProcessOptions(options) {
|
|
|
575
572
|
audioCommit: {
|
|
576
573
|
maxRecordingTime: (_options_audioCommit_maxRecordingTime = (_options_audioCommit = options.audioCommit) === null || _options_audioCommit === void 0 ? void 0 : _options_audioCommit.maxRecordingTime) !== null && _options_audioCommit_maxRecordingTime !== void 0 ? _options_audioCommit_maxRecordingTime : KODRDRIV_DEFAULTS.audioCommit.maxRecordingTime,
|
|
577
574
|
audioDevice: (_options_audioCommit_audioDevice = (_options_audioCommit1 = options.audioCommit) === null || _options_audioCommit1 === void 0 ? void 0 : _options_audioCommit1.audioDevice) !== null && _options_audioCommit_audioDevice !== void 0 ? _options_audioCommit_audioDevice : KODRDRIV_DEFAULTS.audioCommit.audioDevice,
|
|
578
|
-
|
|
575
|
+
file: (_options_audioCommit2 = options.audioCommit) === null || _options_audioCommit2 === void 0 ? void 0 : _options_audioCommit2.file,
|
|
576
|
+
keepTemp: (_options_audioCommit3 = options.audioCommit) === null || _options_audioCommit3 === void 0 ? void 0 : _options_audioCommit3.keepTemp
|
|
579
577
|
},
|
|
580
578
|
release: {
|
|
581
579
|
from: (_options_release_from = (_options_release = options.release) === null || _options_release === void 0 ? void 0 : _options_release.from) !== null && _options_release_from !== void 0 ? _options_release_from : KODRDRIV_DEFAULTS.release.from,
|
|
@@ -593,7 +591,11 @@ async function validateAndProcessOptions(options) {
|
|
|
593
591
|
releaseNotesLimit: (_options_audioReview_releaseNotesLimit = (_options_audioReview6 = options.audioReview) === null || _options_audioReview6 === void 0 ? void 0 : _options_audioReview6.releaseNotesLimit) !== null && _options_audioReview_releaseNotesLimit !== void 0 ? _options_audioReview_releaseNotesLimit : KODRDRIV_DEFAULTS.audioReview.releaseNotesLimit,
|
|
594
592
|
githubIssuesLimit: (_options_audioReview_githubIssuesLimit = (_options_audioReview7 = options.audioReview) === null || _options_audioReview7 === void 0 ? void 0 : _options_audioReview7.githubIssuesLimit) !== null && _options_audioReview_githubIssuesLimit !== void 0 ? _options_audioReview_githubIssuesLimit : KODRDRIV_DEFAULTS.audioReview.githubIssuesLimit,
|
|
595
593
|
context: (_options_audioReview8 = options.audioReview) === null || _options_audioReview8 === void 0 ? void 0 : _options_audioReview8.context,
|
|
596
|
-
sendit: (_options_audioReview_sendit = (_options_audioReview9 = options.audioReview) === null || _options_audioReview9 === void 0 ? void 0 : _options_audioReview9.sendit) !== null && _options_audioReview_sendit !== void 0 ? _options_audioReview_sendit : KODRDRIV_DEFAULTS.audioReview.sendit
|
|
594
|
+
sendit: (_options_audioReview_sendit = (_options_audioReview9 = options.audioReview) === null || _options_audioReview9 === void 0 ? void 0 : _options_audioReview9.sendit) !== null && _options_audioReview_sendit !== void 0 ? _options_audioReview_sendit : KODRDRIV_DEFAULTS.audioReview.sendit,
|
|
595
|
+
maxRecordingTime: (_options_audioReview_maxRecordingTime = (_options_audioReview10 = options.audioReview) === null || _options_audioReview10 === void 0 ? void 0 : _options_audioReview10.maxRecordingTime) !== null && _options_audioReview_maxRecordingTime !== void 0 ? _options_audioReview_maxRecordingTime : KODRDRIV_DEFAULTS.audioReview.maxRecordingTime,
|
|
596
|
+
audioDevice: (_options_audioReview_audioDevice = (_options_audioReview11 = options.audioReview) === null || _options_audioReview11 === void 0 ? void 0 : _options_audioReview11.audioDevice) !== null && _options_audioReview_audioDevice !== void 0 ? _options_audioReview_audioDevice : KODRDRIV_DEFAULTS.audioReview.audioDevice,
|
|
597
|
+
file: (_options_audioReview12 = options.audioReview) === null || _options_audioReview12 === void 0 ? void 0 : _options_audioReview12.file,
|
|
598
|
+
keepTemp: (_options_audioReview13 = options.audioReview) === null || _options_audioReview13 === void 0 ? void 0 : _options_audioReview13.keepTemp
|
|
597
599
|
},
|
|
598
600
|
review: {
|
|
599
601
|
includeCommitHistory: (_options_review_includeCommitHistory = (_options_review = options.review) === null || _options_review === void 0 ? void 0 : _options_review.includeCommitHistory) !== null && _options_review_includeCommitHistory !== void 0 ? _options_review_includeCommitHistory : KODRDRIV_DEFAULTS.review.includeCommitHistory,
|
|
@@ -611,7 +613,9 @@ async function validateAndProcessOptions(options) {
|
|
|
611
613
|
publish: {
|
|
612
614
|
mergeMethod: (_options_publish_mergeMethod = (_options_publish = options.publish) === null || _options_publish === void 0 ? void 0 : _options_publish.mergeMethod) !== null && _options_publish_mergeMethod !== void 0 ? _options_publish_mergeMethod : KODRDRIV_DEFAULTS.publish.mergeMethod,
|
|
613
615
|
dependencyUpdatePatterns: (_options_publish1 = options.publish) === null || _options_publish1 === void 0 ? void 0 : _options_publish1.dependencyUpdatePatterns,
|
|
614
|
-
requiredEnvVars: (_options_publish_requiredEnvVars = (_options_publish2 = options.publish) === null || _options_publish2 === void 0 ? void 0 : _options_publish2.requiredEnvVars) !== null && _options_publish_requiredEnvVars !== void 0 ? _options_publish_requiredEnvVars : KODRDRIV_DEFAULTS.publish.requiredEnvVars
|
|
616
|
+
requiredEnvVars: (_options_publish_requiredEnvVars = (_options_publish2 = options.publish) === null || _options_publish2 === void 0 ? void 0 : _options_publish2.requiredEnvVars) !== null && _options_publish_requiredEnvVars !== void 0 ? _options_publish_requiredEnvVars : KODRDRIV_DEFAULTS.publish.requiredEnvVars,
|
|
617
|
+
linkWorkspacePackages: (_options_publish_linkWorkspacePackages = (_options_publish3 = options.publish) === null || _options_publish3 === void 0 ? void 0 : _options_publish3.linkWorkspacePackages) !== null && _options_publish_linkWorkspacePackages !== void 0 ? _options_publish_linkWorkspacePackages : KODRDRIV_DEFAULTS.publish.linkWorkspacePackages,
|
|
618
|
+
unlinkWorkspacePackages: (_options_publish_unlinkWorkspacePackages = (_options_publish4 = options.publish) === null || _options_publish4 === void 0 ? void 0 : _options_publish4.unlinkWorkspacePackages) !== null && _options_publish_unlinkWorkspacePackages !== void 0 ? _options_publish_unlinkWorkspacePackages : KODRDRIV_DEFAULTS.publish.unlinkWorkspacePackages
|
|
615
619
|
},
|
|
616
620
|
link: {
|
|
617
621
|
scopeRoots: (_options_link_scopeRoots = (_options_link = options.link) === null || _options_link === void 0 ? void 0 : _options_link.scopeRoots) !== null && _options_link_scopeRoots !== void 0 ? _options_link_scopeRoots : KODRDRIV_DEFAULTS.link.scopeRoots,
|
|
@@ -652,35 +656,6 @@ async function validateContextDirectories(contextDirectories) {
|
|
|
652
656
|
}
|
|
653
657
|
return validDirectories;
|
|
654
658
|
}
|
|
655
|
-
// Updated to handle reading the file content
|
|
656
|
-
// Export for testing
|
|
657
|
-
async function validateAndReadInstructions(instructionsPath) {
|
|
658
|
-
const logger = getLogger();
|
|
659
|
-
const storage = create({
|
|
660
|
-
log: logger.info
|
|
661
|
-
});
|
|
662
|
-
try {
|
|
663
|
-
// Assume it's a file path first
|
|
664
|
-
if (await storage.isFileReadable(instructionsPath)) {
|
|
665
|
-
logger.verbose(`Reading instructions from file: ${instructionsPath}`);
|
|
666
|
-
return storage.readFile(instructionsPath, DEFAULT_CHARACTER_ENCODING);
|
|
667
|
-
} else {
|
|
668
|
-
// If not a readable file, assume it might be the content itself (e.g., from config file)
|
|
669
|
-
logger.verbose(`Using provided instructions string directly.`);
|
|
670
|
-
return instructionsPath; // Return the string as is
|
|
671
|
-
}
|
|
672
|
-
} catch (error) {
|
|
673
|
-
logger.error('Error reading instructions file %s: %s', instructionsPath, error.message);
|
|
674
|
-
// Decide how to handle error: throw, return default, etc.
|
|
675
|
-
// Returning default for now, but might need adjustment
|
|
676
|
-
logger.warn('Falling back to default instructions path due to error.');
|
|
677
|
-
// Re-read the default file path if the provided one failed
|
|
678
|
-
if (await storage.isFileReadable(DEFAULT_INSTRUCTIONS_DIR)) {
|
|
679
|
-
return storage.readFile(DEFAULT_INSTRUCTIONS_DIR, DEFAULT_CHARACTER_ENCODING);
|
|
680
|
-
}
|
|
681
|
-
throw new Error(`Failed to read instructions from ${instructionsPath} or default location.`);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
659
|
|
|
685
|
-
export { configure, getCliConfig, transformCliArgs, validateAndProcessOptions, validateAndProcessSecureOptions,
|
|
660
|
+
export { configure, getCliConfig, transformCliArgs, validateAndProcessOptions, validateAndProcessSecureOptions, validateCommand, validateContextDirectories };
|
|
686
661
|
//# sourceMappingURL=arguments.js.map
|