@eldrforge/kodrdriv 0.0.47 → 0.0.49

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 CHANGED
@@ -73,7 +73,6 @@ kodrdriv --check-config
73
73
  - **[audio-review](docs/public/commands/audio-review.md)** - Record audio for review analysis
74
74
  - **[release](docs/public/commands/release.md)** - Generate comprehensive release notes
75
75
  - **[publish](docs/public/commands/publish.md)** - Automate the entire release process
76
- - **[publish-tree](docs/public/commands/publish-tree.md)** - Manage multi-package workspace publishing
77
76
  - **[link](docs/public/commands/link.md)** - Link local packages for development
78
77
  - **[unlink](docs/public/commands/unlink.md)** - Remove workspace links
79
78
  - **[clean](docs/public/commands/clean.md)** - Clean generated files
@@ -2,18 +2,17 @@ import * as Cardigantime from '@theunwalked/cardigantime';
2
2
  import 'dotenv/config';
3
3
  import { configure } from './arguments.js';
4
4
  import { execute as execute$1 } from './commands/audio-commit.js';
5
- import { execute as execute$8 } from './commands/audio-review.js';
6
- import { execute as execute$9 } from './commands/clean.js';
5
+ import { execute as execute$7 } from './commands/audio-review.js';
6
+ import { execute as execute$8 } from './commands/clean.js';
7
7
  import { execute } from './commands/commit.js';
8
- import { execute as execute$6 } from './commands/link.js';
8
+ import { execute as execute$5 } from './commands/link.js';
9
9
  import { execute as execute$3 } from './commands/publish.js';
10
- import { execute as execute$4 } from './commands/publish-tree.js';
11
- import { execute as execute$5 } from './commands/commit-tree.js';
10
+ import { execute as execute$4 } from './commands/tree.js';
12
11
  import { execute as execute$2 } from './commands/release.js';
13
- import { execute as execute$a } from './commands/review.js';
14
- import { execute as execute$b } from './commands/select-audio.js';
15
- import { execute as execute$7 } from './commands/unlink.js';
16
- import { DEFAULT_CONFIG_DIR, COMMAND_CHECK_CONFIG, COMMAND_INIT_CONFIG, COMMAND_COMMIT, COMMAND_AUDIO_COMMIT, COMMAND_RELEASE, COMMAND_PUBLISH, COMMAND_PUBLISH_TREE, COMMAND_COMMIT_TREE, COMMAND_LINK, COMMAND_UNLINK, COMMAND_AUDIO_REVIEW, COMMAND_CLEAN, COMMAND_REVIEW, COMMAND_SELECT_AUDIO } from './constants.js';
12
+ import { execute as execute$9 } from './commands/review.js';
13
+ import { execute as execute$a } from './commands/select-audio.js';
14
+ import { execute as execute$6 } from './commands/unlink.js';
15
+ import { DEFAULT_CONFIG_DIR, COMMAND_CHECK_CONFIG, COMMAND_INIT_CONFIG, COMMAND_COMMIT, COMMAND_AUDIO_COMMIT, COMMAND_RELEASE, COMMAND_PUBLISH, COMMAND_TREE, COMMAND_LINK, COMMAND_UNLINK, COMMAND_AUDIO_REVIEW, COMMAND_CLEAN, COMMAND_REVIEW, COMMAND_SELECT_AUDIO } from './constants.js';
17
16
  import { getLogger, setLogLevel } from './logging.js';
18
17
  import { ConfigSchema } from './types.js';
19
18
  import { UserCancellationError } from './error/CommandErrors.js';
@@ -87,8 +86,23 @@ async function runApplication() {
87
86
  // Get the command from Commander
88
87
  const command = process.argv[2];
89
88
  let commandName = commandConfig.commandName;
90
- // If we have a specific command argument, use that
91
- if (command === 'commit' || command === 'audio-commit' || command === 'release' || command === 'publish' || command === 'publish-tree' || command === 'commit-tree' || command === 'link' || command === 'unlink' || command === 'audio-review' || command === 'clean' || command === 'review' || command === 'select-audio') {
89
+ // Handle special case for tree command with built-in command argument
90
+ if (command === 'tree' && process.argv[3]) {
91
+ const treeBuiltInCommand = process.argv[3];
92
+ const supportedBuiltInCommands = [
93
+ 'commit',
94
+ 'publish',
95
+ 'link',
96
+ 'unlink'
97
+ ];
98
+ if (supportedBuiltInCommands.includes(treeBuiltInCommand)) {
99
+ // This is a tree command with built-in command, keep commandName as 'tree'
100
+ commandName = 'tree';
101
+ } else {
102
+ // Unknown tree argument, let it fail naturally in tree.ts
103
+ commandName = 'tree';
104
+ }
105
+ } else if (command === 'commit' || command === 'audio-commit' || command === 'release' || command === 'publish' || command === 'tree' || command === 'link' || command === 'unlink' || command === 'audio-review' || command === 'clean' || command === 'review' || command === 'select-audio') {
92
106
  commandName = command;
93
107
  }
94
108
  let summary = '';
@@ -102,45 +116,34 @@ async function runApplication() {
102
116
  summary = `${releaseSummary.title}\n\n${releaseSummary.body}`;
103
117
  } else if (commandName === COMMAND_PUBLISH) {
104
118
  await execute$3(runConfig);
105
- } else if (commandName === COMMAND_PUBLISH_TREE) {
106
- var _runConfig_audioReview, _runConfig_publishTree, _runConfig_publishTree1;
107
- // Handle publishTree directory mapping from command-specific arguments
108
- if (((_runConfig_audioReview = runConfig.audioReview) === null || _runConfig_audioReview === void 0 ? void 0 : _runConfig_audioReview.directory) && !((_runConfig_publishTree = runConfig.publishTree) === null || _runConfig_publishTree === void 0 ? void 0 : _runConfig_publishTree.directory)) {
109
- runConfig.publishTree = runConfig.publishTree || {};
110
- runConfig.publishTree.directory = runConfig.audioReview.directory;
119
+ } else if (commandName === COMMAND_TREE) {
120
+ var _runConfig_audioReview, _runConfig_tree, _runConfig_tree1;
121
+ // Handle tree directories mapping from command-specific arguments
122
+ if (((_runConfig_audioReview = runConfig.audioReview) === null || _runConfig_audioReview === void 0 ? void 0 : _runConfig_audioReview.directory) && !((_runConfig_tree = runConfig.tree) === null || _runConfig_tree === void 0 ? void 0 : _runConfig_tree.directories)) {
123
+ runConfig.tree = runConfig.tree || {};
124
+ runConfig.tree.directories = [
125
+ runConfig.audioReview.directory
126
+ ];
111
127
  }
112
- // Handle publishTree exclusion patterns - use global excludedPatterns for publish-tree
113
- if (runConfig.excludedPatterns && !((_runConfig_publishTree1 = runConfig.publishTree) === null || _runConfig_publishTree1 === void 0 ? void 0 : _runConfig_publishTree1.excludedPatterns)) {
114
- runConfig.publishTree = runConfig.publishTree || {};
115
- runConfig.publishTree.excludedPatterns = runConfig.excludedPatterns;
128
+ // Handle tree exclusion patterns - use global excludedPatterns for tree
129
+ if (runConfig.excludedPatterns && !((_runConfig_tree1 = runConfig.tree) === null || _runConfig_tree1 === void 0 ? void 0 : _runConfig_tree1.excludedPatterns)) {
130
+ runConfig.tree = runConfig.tree || {};
131
+ runConfig.tree.excludedPatterns = runConfig.excludedPatterns;
116
132
  }
117
133
  summary = await execute$4(runConfig);
118
- } else if (commandName === COMMAND_COMMIT_TREE) {
119
- var _runConfig_audioReview1, _runConfig_commitTree, _runConfig_commitTree1;
120
- // Handle commitTree directory mapping from command-specific arguments
121
- if (((_runConfig_audioReview1 = runConfig.audioReview) === null || _runConfig_audioReview1 === void 0 ? void 0 : _runConfig_audioReview1.directory) && !((_runConfig_commitTree = runConfig.commitTree) === null || _runConfig_commitTree === void 0 ? void 0 : _runConfig_commitTree.directory)) {
122
- runConfig.commitTree = runConfig.commitTree || {};
123
- runConfig.commitTree.directory = runConfig.audioReview.directory;
124
- }
125
- // Handle commitTree exclusion patterns - use global excludedPatterns for commit-tree
126
- if (runConfig.excludedPatterns && !((_runConfig_commitTree1 = runConfig.commitTree) === null || _runConfig_commitTree1 === void 0 ? void 0 : _runConfig_commitTree1.excludedPatterns)) {
127
- runConfig.commitTree = runConfig.commitTree || {};
128
- runConfig.commitTree.excludedPatterns = runConfig.excludedPatterns;
129
- }
130
- summary = await execute$5(runConfig);
131
134
  } else if (commandName === COMMAND_LINK) {
132
- summary = await execute$6(runConfig);
135
+ summary = await execute$5(runConfig);
133
136
  } else if (commandName === COMMAND_UNLINK) {
134
- summary = await execute$7(runConfig);
137
+ summary = await execute$6(runConfig);
135
138
  } else if (commandName === COMMAND_AUDIO_REVIEW) {
136
- summary = await execute$8(runConfig);
139
+ summary = await execute$7(runConfig);
137
140
  } else if (commandName === COMMAND_CLEAN) {
138
- await execute$9(runConfig);
141
+ await execute$8(runConfig);
139
142
  summary = 'Output directory cleaned successfully.';
140
143
  } else if (commandName === COMMAND_REVIEW) {
141
- summary = await execute$a(runConfig);
144
+ summary = await execute$9(runConfig);
142
145
  } else if (commandName === COMMAND_SELECT_AUDIO) {
143
- await execute$b(runConfig);
146
+ await execute$a(runConfig);
144
147
  summary = 'Audio selection completed successfully.';
145
148
  }
146
149
  // eslint-disable-next-line no-console
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sources":["../src/application.ts"],"sourcesContent":["import * as Cardigantime from '@theunwalked/cardigantime';\nimport 'dotenv/config';\nimport { CommandConfig } from 'types';\nimport * as Arguments from './arguments';\nimport * as AudioCommit from './commands/audio-commit';\nimport * as AudioReview from './commands/audio-review';\nimport * as Clean from './commands/clean';\nimport * as Commit from './commands/commit';\nimport * as Link from './commands/link';\nimport * as Publish from './commands/publish';\nimport * as PublishTree from './commands/publish-tree';\nimport * as CommitTree from './commands/commit-tree';\nimport * as Release from './commands/release';\nimport * as Review from './commands/review';\nimport * as SelectAudio from './commands/select-audio';\nimport * as Unlink from './commands/unlink';\nimport { COMMAND_AUDIO_COMMIT, COMMAND_AUDIO_REVIEW, COMMAND_CHECK_CONFIG, COMMAND_CLEAN, COMMAND_COMMIT, COMMAND_COMMIT_TREE, COMMAND_INIT_CONFIG, COMMAND_LINK, COMMAND_PUBLISH, COMMAND_PUBLISH_TREE, COMMAND_RELEASE, COMMAND_REVIEW, COMMAND_SELECT_AUDIO, COMMAND_UNLINK, DEFAULT_CONFIG_DIR } from './constants';\nimport { getLogger, setLogLevel } from './logging';\nimport { Config, ConfigSchema, SecureConfig } from './types';\nimport { UserCancellationError } from './error/CommandErrors';\n\n/**\n * Configure early logging based on command line flags.\n *\n * Hey we need this because we need to be able to debug CardiganTime.\n * This method checks for --verbose and --debug flags early in the process\n * before CardiganTime is configured, allowing us to capture debug output\n * from the CardiganTime initialization itself.\n */\nexport function configureEarlyLogging(): void {\n const hasVerbose = process.argv.includes('--verbose');\n const hasDebug = process.argv.includes('--debug');\n\n // Set log level based on early flag detection\n if (hasDebug) {\n setLogLevel('debug');\n } else if (hasVerbose) {\n setLogLevel('verbose');\n }\n}\n\nexport async function runApplication(): Promise<void> {\n // Configure logging early, before CardiganTime initialization\n configureEarlyLogging();\n\n // Cast create to `any` to avoid excessive type instantiation issues in TS compiler\n const createCardigantime: any = (Cardigantime as unknown as { create: unknown }).create as any;\n\n const cardigantime = createCardigantime({\n defaults: {\n configDirectory: DEFAULT_CONFIG_DIR,\n // Move pathResolution INSIDE defaults\n pathResolution: {\n resolvePathArray: ['contextDirectories'], // Resolve contextDirectories array elements as paths\n },\n // Use fieldOverlaps instead of mergeStrategy, INSIDE defaults\n fieldOverlaps: {\n 'contextDirectories': 'prepend', // Use prepend strategy for contextDirectories array\n // Add other field overlap configurations as needed\n },\n },\n features: ['config', 'hierarchical'],\n configShape: ConfigSchema.shape, // No need for 'as any' now\n logger: getLogger(),\n }); // No need for 'as any' at the end\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [runConfig, secureConfig, commandConfig]: [Config, SecureConfig, CommandConfig] = await Arguments.configure(cardigantime); // Pass cardigantime instance\n\n // Set log level based on verbose flag\n if (runConfig.verbose) {\n setLogLevel('verbose');\n }\n if (runConfig.debug) {\n setLogLevel('debug');\n }\n\n const logger = getLogger();\n cardigantime.setLogger(logger);\n\n // Handle check-config command first\n if (commandConfig.commandName === COMMAND_CHECK_CONFIG) {\n // CardiganTime's checkConfig has already been called in Arguments.configure()\n // No additional processing needed here\n return;\n }\n\n // Handle init-config command\n if (commandConfig.commandName === COMMAND_INIT_CONFIG) {\n // CardiganTime's initConfig has already been called in Arguments.configure()\n // No additional processing needed here\n return;\n }\n\n // Get the command from Commander\n const command = process.argv[2];\n let commandName = commandConfig.commandName;\n\n // If we have a specific command argument, use that\n if (command === 'commit' || command === 'audio-commit' || command === 'release' || command === 'publish' || command === 'publish-tree' || command === 'commit-tree' || command === 'link' || command === 'unlink' || command === 'audio-review' || command === 'clean' || command === 'review' || command === 'select-audio') {\n commandName = command;\n }\n\n let summary: string = '';\n\n try {\n if (commandName === COMMAND_COMMIT) {\n summary = await Commit.execute(runConfig);\n } else if (commandName === COMMAND_AUDIO_COMMIT) {\n summary = await AudioCommit.execute(runConfig);\n } else if (commandName === COMMAND_RELEASE) {\n const releaseSummary = await Release.execute(runConfig);\n summary = `${releaseSummary.title}\\n\\n${releaseSummary.body}`;\n } else if (commandName === COMMAND_PUBLISH) {\n await Publish.execute(runConfig);\n } else if (commandName === COMMAND_PUBLISH_TREE) {\n // Handle publishTree directory mapping from command-specific arguments\n if (runConfig.audioReview?.directory && !runConfig.publishTree?.directory) {\n runConfig.publishTree = runConfig.publishTree || {};\n runConfig.publishTree.directory = runConfig.audioReview.directory;\n }\n // Handle publishTree exclusion patterns - use global excludedPatterns for publish-tree\n if (runConfig.excludedPatterns && !runConfig.publishTree?.excludedPatterns) {\n runConfig.publishTree = runConfig.publishTree || {};\n runConfig.publishTree.excludedPatterns = runConfig.excludedPatterns;\n }\n summary = await PublishTree.execute(runConfig);\n } else if (commandName === COMMAND_COMMIT_TREE) {\n // Handle commitTree directory mapping from command-specific arguments\n if (runConfig.audioReview?.directory && !runConfig.commitTree?.directory) {\n runConfig.commitTree = runConfig.commitTree || {};\n runConfig.commitTree.directory = runConfig.audioReview.directory;\n }\n // Handle commitTree exclusion patterns - use global excludedPatterns for commit-tree\n if (runConfig.excludedPatterns && !runConfig.commitTree?.excludedPatterns) {\n runConfig.commitTree = runConfig.commitTree || {};\n runConfig.commitTree.excludedPatterns = runConfig.excludedPatterns;\n }\n summary = await CommitTree.execute(runConfig);\n } else if (commandName === COMMAND_LINK) {\n summary = await Link.execute(runConfig);\n } else if (commandName === COMMAND_UNLINK) {\n summary = await Unlink.execute(runConfig);\n } else if (commandName === COMMAND_AUDIO_REVIEW) {\n summary = await AudioReview.execute(runConfig);\n } else if (commandName === COMMAND_CLEAN) {\n await Clean.execute(runConfig);\n summary = 'Output directory cleaned successfully.';\n } else if (commandName === COMMAND_REVIEW) {\n summary = await Review.execute(runConfig);\n } else if (commandName === COMMAND_SELECT_AUDIO) {\n await SelectAudio.execute(runConfig);\n summary = 'Audio selection completed successfully.';\n }\n\n // eslint-disable-next-line no-console\n console.log(`\\n\\n${summary}\\n\\n`);\n } catch (error: any) {\n // Handle user cancellation gracefully\n if (error instanceof UserCancellationError) {\n logger.info(error.message);\n process.exit(0);\n }\n\n // Re-throw other errors to be handled by main.ts\n throw error;\n }\n}\n"],"names":["configureEarlyLogging","hasVerbose","process","argv","includes","hasDebug","setLogLevel","runApplication","createCardigantime","Cardigantime","create","cardigantime","defaults","configDirectory","DEFAULT_CONFIG_DIR","pathResolution","resolvePathArray","fieldOverlaps","features","configShape","ConfigSchema","shape","logger","getLogger","runConfig","secureConfig","commandConfig","Arguments","verbose","debug","setLogger","commandName","COMMAND_CHECK_CONFIG","COMMAND_INIT_CONFIG","command","summary","COMMAND_COMMIT","Commit","COMMAND_AUDIO_COMMIT","AudioCommit","COMMAND_RELEASE","releaseSummary","Release","title","body","COMMAND_PUBLISH","Publish","COMMAND_PUBLISH_TREE","audioReview","directory","publishTree","excludedPatterns","PublishTree","COMMAND_COMMIT_TREE","commitTree","CommitTree","COMMAND_LINK","Link","COMMAND_UNLINK","Unlink","COMMAND_AUDIO_REVIEW","AudioReview","COMMAND_CLEAN","Clean","COMMAND_REVIEW","Review","COMMAND_SELECT_AUDIO","SelectAudio","console","log","error","UserCancellationError","info","message","exit"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA;;;;;;;AAOC,IACM,SAASA,qBAAAA,GAAAA;AACZ,IAAA,MAAMC,UAAAA,GAAaC,OAAAA,CAAQC,IAAI,CAACC,QAAQ,CAAC,WAAA,CAAA;AACzC,IAAA,MAAMC,QAAAA,GAAWH,OAAAA,CAAQC,IAAI,CAACC,QAAQ,CAAC,SAAA,CAAA;;AAGvC,IAAA,IAAIC,QAAAA,EAAU;QACVC,WAAAA,CAAY,OAAA,CAAA;AAChB,IAAA,CAAA,MAAO,IAAIL,UAAAA,EAAY;QACnBK,WAAAA,CAAY,SAAA,CAAA;AAChB,IAAA;AACJ;AAEO,eAAeC,cAAAA,GAAAA;;AAElBP,IAAAA,qBAAAA,EAAAA;;IAGA,MAAMQ,kBAAAA,GAA0B,YAACC,CAAgDC,MAAM;AAEvF,IAAA,MAAMC,eAAeH,kBAA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ACzBvE,YAAAA,OAAAA,CAAQwE,IAAI,CAAC,CAAA,CAAA;AACjB,QAAA;;QAGA,MAAMJ,KAAAA;AACV,IAAA;AACJ;;;;"}
1
+ {"version":3,"file":"application.js","sources":["../src/application.ts"],"sourcesContent":["import * as Cardigantime from '@theunwalked/cardigantime';\nimport 'dotenv/config';\nimport { CommandConfig } from 'types';\nimport * as Arguments from './arguments';\nimport * as AudioCommit from './commands/audio-commit';\nimport * as AudioReview from './commands/audio-review';\nimport * as Clean from './commands/clean';\nimport * as Commit from './commands/commit';\nimport * as Link from './commands/link';\nimport * as Publish from './commands/publish';\nimport * as Tree from './commands/tree';\nimport * as Release from './commands/release';\nimport * as Review from './commands/review';\nimport * as SelectAudio from './commands/select-audio';\nimport * as Unlink from './commands/unlink';\nimport { COMMAND_AUDIO_COMMIT, COMMAND_AUDIO_REVIEW, COMMAND_CHECK_CONFIG, COMMAND_CLEAN, COMMAND_COMMIT, COMMAND_INIT_CONFIG, COMMAND_LINK, COMMAND_PUBLISH, COMMAND_TREE, COMMAND_RELEASE, COMMAND_REVIEW, COMMAND_SELECT_AUDIO, COMMAND_UNLINK, DEFAULT_CONFIG_DIR } from './constants';\nimport { getLogger, setLogLevel } from './logging';\nimport { Config, ConfigSchema, SecureConfig } from './types';\nimport { UserCancellationError } from './error/CommandErrors';\n\n/**\n * Configure early logging based on command line flags.\n *\n * Hey we need this because we need to be able to debug CardiganTime.\n * This method checks for --verbose and --debug flags early in the process\n * before CardiganTime is configured, allowing us to capture debug output\n * from the CardiganTime initialization itself.\n */\nexport function configureEarlyLogging(): void {\n const hasVerbose = process.argv.includes('--verbose');\n const hasDebug = process.argv.includes('--debug');\n\n // Set log level based on early flag detection\n if (hasDebug) {\n setLogLevel('debug');\n } else if (hasVerbose) {\n setLogLevel('verbose');\n }\n}\n\nexport async function runApplication(): Promise<void> {\n // Configure logging early, before CardiganTime initialization\n configureEarlyLogging();\n\n // Cast create to `any` to avoid excessive type instantiation issues in TS compiler\n const createCardigantime: any = (Cardigantime as unknown as { create: unknown }).create as any;\n\n const cardigantime = createCardigantime({\n defaults: {\n configDirectory: DEFAULT_CONFIG_DIR,\n // Move pathResolution INSIDE defaults\n pathResolution: {\n resolvePathArray: ['contextDirectories'], // Resolve contextDirectories array elements as paths\n },\n // Use fieldOverlaps instead of mergeStrategy, INSIDE defaults\n fieldOverlaps: {\n 'contextDirectories': 'prepend', // Use prepend strategy for contextDirectories array\n // Add other field overlap configurations as needed\n },\n },\n features: ['config', 'hierarchical'],\n configShape: ConfigSchema.shape, // No need for 'as any' now\n logger: getLogger(),\n }); // No need for 'as any' at the end\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [runConfig, secureConfig, commandConfig]: [Config, SecureConfig, CommandConfig] = await Arguments.configure(cardigantime); // Pass cardigantime instance\n\n // Set log level based on verbose flag\n if (runConfig.verbose) {\n setLogLevel('verbose');\n }\n if (runConfig.debug) {\n setLogLevel('debug');\n }\n\n const logger = getLogger();\n cardigantime.setLogger(logger);\n\n // Handle check-config command first\n if (commandConfig.commandName === COMMAND_CHECK_CONFIG) {\n // CardiganTime's checkConfig has already been called in Arguments.configure()\n // No additional processing needed here\n return;\n }\n\n // Handle init-config command\n if (commandConfig.commandName === COMMAND_INIT_CONFIG) {\n // CardiganTime's initConfig has already been called in Arguments.configure()\n // No additional processing needed here\n return;\n }\n\n // Get the command from Commander\n const command = process.argv[2];\n let commandName = commandConfig.commandName;\n\n // Handle special case for tree command with built-in command argument\n if (command === 'tree' && process.argv[3]) {\n const treeBuiltInCommand = process.argv[3];\n const supportedBuiltInCommands = ['commit', 'publish', 'link', 'unlink'];\n if (supportedBuiltInCommands.includes(treeBuiltInCommand)) {\n // This is a tree command with built-in command, keep commandName as 'tree'\n commandName = 'tree';\n } else {\n // Unknown tree argument, let it fail naturally in tree.ts\n commandName = 'tree';\n }\n }\n // If we have a specific command argument, use that\n else if (command === 'commit' || command === 'audio-commit' || command === 'release' || command === 'publish' || command === 'tree' || command === 'link' || command === 'unlink' || command === 'audio-review' || command === 'clean' || command === 'review' || command === 'select-audio') {\n commandName = command;\n }\n\n let summary: string = '';\n\n try {\n if (commandName === COMMAND_COMMIT) {\n summary = await Commit.execute(runConfig);\n } else if (commandName === COMMAND_AUDIO_COMMIT) {\n summary = await AudioCommit.execute(runConfig);\n } else if (commandName === COMMAND_RELEASE) {\n const releaseSummary = await Release.execute(runConfig);\n summary = `${releaseSummary.title}\\n\\n${releaseSummary.body}`;\n } else if (commandName === COMMAND_PUBLISH) {\n await Publish.execute(runConfig);\n } else if (commandName === COMMAND_TREE) {\n // Handle tree directories mapping from command-specific arguments\n if (runConfig.audioReview?.directory && !runConfig.tree?.directories) {\n runConfig.tree = runConfig.tree || {};\n runConfig.tree.directories = [runConfig.audioReview.directory];\n }\n // Handle tree exclusion patterns - use global excludedPatterns for tree\n if (runConfig.excludedPatterns && !runConfig.tree?.excludedPatterns) {\n runConfig.tree = runConfig.tree || {};\n runConfig.tree.excludedPatterns = runConfig.excludedPatterns;\n }\n summary = await Tree.execute(runConfig);\n } else if (commandName === COMMAND_LINK) {\n summary = await Link.execute(runConfig);\n } else if (commandName === COMMAND_UNLINK) {\n summary = await Unlink.execute(runConfig);\n } else if (commandName === COMMAND_AUDIO_REVIEW) {\n summary = await AudioReview.execute(runConfig);\n } else if (commandName === COMMAND_CLEAN) {\n await Clean.execute(runConfig);\n summary = 'Output directory cleaned successfully.';\n } else if (commandName === COMMAND_REVIEW) {\n summary = await Review.execute(runConfig);\n } else if (commandName === COMMAND_SELECT_AUDIO) {\n await SelectAudio.execute(runConfig);\n summary = 'Audio selection completed successfully.';\n }\n\n // eslint-disable-next-line no-console\n console.log(`\\n\\n${summary}\\n\\n`);\n } catch (error: any) {\n // Handle user cancellation gracefully\n if (error instanceof UserCancellationError) {\n logger.info(error.message);\n process.exit(0);\n }\n\n // Re-throw other errors to be handled by main.ts\n throw error;\n }\n}\n"],"names":["configureEarlyLogging","hasVerbose","process","argv","includes","hasDebug","setLogLevel","runApplication","createCardigantime","Cardigantime","create","cardigantime","defaults","configDirectory","DEFAULT_CONFIG_DIR","pathResolution","resolvePathArray","fieldOverlaps","features","configShape","ConfigSchema","shape","logger","getLogger","runConfig","secureConfig","commandConfig","Arguments","verbose","debug","setLogger","commandName","COMMAND_CHECK_CONFIG","COMMAND_INIT_CONFIG","command","treeBuiltInCommand","supportedBuiltInCommands","summary","COMMAND_COMMIT","Commit","COMMAND_AUDIO_COMMIT","AudioCommit","COMMAND_RELEASE","releaseSummary","Release","title","body","COMMAND_PUBLISH","Publish","COMMAND_TREE","audioReview","directory","tree","directories","excludedPatterns","Tree","COMMAND_LINK","Link","COMMAND_UNLINK","Unlink","COMMAND_AUDIO_REVIEW","AudioReview","COMMAND_CLEAN","Clean","COMMAND_REVIEW","Review","COMMAND_SELECT_AUDIO","SelectAudio","console","log","error","UserCancellationError","info","message","exit"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA;;;;;;;AAOC,IACM,SAASA,qBAAAA,GAAAA;AACZ,IAAA,MAAMC,UAAAA,GAAaC,OAAAA,CAAQC,IAAI,CAACC,QAAQ,CAAC,WAAA,CAAA;AACzC,IAAA,MAAMC,QAAAA,GAAWH,OAAAA,CAAQC,IAAI,CAACC,QAAQ,CAAC,SAAA,CAAA;;AAGvC,IAAA,IAAIC,QAAAA,EAAU;QACVC,WAAAA,CAAY,OAAA,CAAA;AAChB,IAAA,CAAA,MAAO,IAAIL,UAAAA,EAAY;QACnBK,WAAAA,CAAY,SAAA,CAAA;AAChB,IAAA;AACJ;AAEO,eAAeC,cAAAA,GAAAA;;AAElBP,IAAAA,qBAAAA,EAAAA;;IAGA,MAAMQ,kBAAAA,GAA0B,YAACC,CAAgDC,MAAM;AAEvF,IAAA,MAAMC,eAAeH,kBAAAA,CAAmB;QACpCI,QAAAA,EAAU;YACNC,eAAAA,EAAiBC,kBAAAA;;YAEjBC,cAAAA,EAAgB;gBACZC,gBAAAA,EAAkB;AAAC,oBAAA;AAAqB;AAC5C,a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,CAAA,MAAO,IAAIN,gBAAgBiC,cAAAA,EAAgB;YACvC3B,OAAAA,GAAU,MAAM4B,SAAc,CAACzC,SAAAA,CAAAA;QACnC,CAAA,MAAO,IAAIO,gBAAgBmC,oBAAAA,EAAsB;YAC7C,MAAMC,SAAmB,CAAC3C,SAAAA,CAAAA;YAC1Ba,OAAAA,GAAU,yCAAA;AACd,QAAA;;AAGA+B,QAAAA,OAAAA,CAAQC,GAAG,CAAC,CAAC,IAAI,EAAEhC,OAAAA,CAAQ,IAAI,CAAC,CAAA;AACpC,IAAA,CAAA,CAAE,OAAOiC,KAAAA,EAAY;;AAEjB,QAAA,IAAIA,iBAAiBC,qBAAAA,EAAuB;YACxCjD,MAAAA,CAAOkD,IAAI,CAACF,KAAAA,CAAMG,OAAO,CAAA;AACzBvE,YAAAA,OAAAA,CAAQwE,IAAI,CAAC,CAAA,CAAA;AACjB,QAAA;;QAGA,MAAMJ,KAAAA;AACV,IAAA;AACJ;;;;"}
package/dist/arguments.js CHANGED
@@ -51,6 +51,7 @@ z.object({
51
51
  githubIssuesLimit: z.number().optional(),
52
52
  file: z.string().optional(),
53
53
  directory: z.string().optional(),
54
+ directories: z.array(z.string()).optional(),
54
55
  keepTemp: z.boolean().optional()
55
56
  });
56
57
  // Function to transform flat CLI args into nested Config structure
@@ -110,8 +111,8 @@ const transformCliArgs = (finalCliArgs, commandName)=>{
110
111
  }
111
112
  }
112
113
  }
113
- // Nested mappings for 'audio-review' options
114
- 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.directory !== undefined || finalCliArgs.keepTemp !== undefined) {
114
+ // Nested mappings for 'audio-review' options (only when it's not a tree command)
115
+ if (commandName !== 'tree' && (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.directories !== undefined || finalCliArgs.keepTemp !== undefined)) {
115
116
  transformedCliArgs.audioReview = {};
116
117
  if (finalCliArgs.includeCommitHistory !== undefined) transformedCliArgs.audioReview.includeCommitHistory = finalCliArgs.includeCommitHistory;
117
118
  if (finalCliArgs.includeRecentDiffs !== undefined) transformedCliArgs.audioReview.includeRecentDiffs = finalCliArgs.includeRecentDiffs;
@@ -143,29 +144,21 @@ const transformCliArgs = (finalCliArgs, commandName)=>{
143
144
  if (finalCliArgs.context !== undefined) transformedCliArgs.review.context = finalCliArgs.context;
144
145
  if (finalCliArgs.sendit !== undefined) transformedCliArgs.review.sendit = finalCliArgs.sendit;
145
146
  }
146
- // Nested mappings for 'publishTree' options (add when relevant args present, unless we're specifically doing commit-tree)
147
- if (commandName !== 'commit-tree') {
148
- const publishTreeExcludedPatterns = finalCliArgs.excludedPatterns || finalCliArgs.excludedPaths;
149
- if (finalCliArgs.directory !== undefined || publishTreeExcludedPatterns !== undefined || finalCliArgs.startFrom !== undefined || finalCliArgs.script !== undefined || finalCliArgs.cmd !== undefined || finalCliArgs.publish !== undefined || finalCliArgs.parallel !== undefined) {
150
- transformedCliArgs.publishTree = {};
151
- if (finalCliArgs.directory !== undefined) transformedCliArgs.publishTree.directory = finalCliArgs.directory;
152
- if (publishTreeExcludedPatterns !== undefined) transformedCliArgs.publishTree.excludedPatterns = publishTreeExcludedPatterns;
153
- if (finalCliArgs.startFrom !== undefined) transformedCliArgs.publishTree.startFrom = finalCliArgs.startFrom;
154
- if (finalCliArgs.script !== undefined) transformedCliArgs.publishTree.script = finalCliArgs.script;
155
- if (finalCliArgs.cmd !== undefined) transformedCliArgs.publishTree.cmd = finalCliArgs.cmd;
156
- if (finalCliArgs.publish !== undefined) transformedCliArgs.publishTree.publish = finalCliArgs.publish;
157
- if (finalCliArgs.parallel !== undefined) transformedCliArgs.publishTree.parallel = finalCliArgs.parallel;
158
- }
159
- }
160
- // Nested mappings for 'commitTree' options (only when the command is actually commit-tree)
161
- if (commandName === 'commit-tree') {
162
- const commitTreeExcludedPatterns = finalCliArgs.excludedPatterns || finalCliArgs.excludedPaths;
163
- if (finalCliArgs.directory !== undefined || commitTreeExcludedPatterns !== undefined || finalCliArgs.startFrom !== undefined || finalCliArgs.parallel !== undefined) {
164
- transformedCliArgs.commitTree = {};
165
- if (finalCliArgs.directory !== undefined) transformedCliArgs.commitTree.directory = finalCliArgs.directory;
166
- if (commitTreeExcludedPatterns !== undefined) transformedCliArgs.commitTree.excludedPatterns = commitTreeExcludedPatterns;
167
- if (finalCliArgs.startFrom !== undefined) transformedCliArgs.commitTree.startFrom = finalCliArgs.startFrom;
168
- if (finalCliArgs.parallel !== undefined) transformedCliArgs.commitTree.parallel = finalCliArgs.parallel;
147
+ // Nested mappings for 'tree' options (add when relevant args present)
148
+ if (commandName === 'tree') {
149
+ const treeExcludedPatterns = finalCliArgs.excludedPatterns || finalCliArgs.excludedPaths;
150
+ const builtInCommand = finalCliArgs.builtInCommand;
151
+ if (finalCliArgs.directory !== undefined || finalCliArgs.directories !== undefined || treeExcludedPatterns !== undefined || finalCliArgs.startFrom !== undefined || finalCliArgs.cmd !== undefined || finalCliArgs.parallel !== undefined || builtInCommand !== undefined) {
152
+ transformedCliArgs.tree = {};
153
+ if (finalCliArgs.directories !== undefined) transformedCliArgs.tree.directories = finalCliArgs.directories;
154
+ else if (finalCliArgs.directory !== undefined) transformedCliArgs.tree.directories = [
155
+ finalCliArgs.directory
156
+ ];
157
+ if (treeExcludedPatterns !== undefined) transformedCliArgs.tree.excludedPatterns = treeExcludedPatterns;
158
+ if (finalCliArgs.startFrom !== undefined) transformedCliArgs.tree.startFrom = finalCliArgs.startFrom;
159
+ if (finalCliArgs.cmd !== undefined) transformedCliArgs.tree.cmd = finalCliArgs.cmd;
160
+ if (finalCliArgs.parallel !== undefined) transformedCliArgs.tree.parallel = finalCliArgs.parallel;
161
+ if (builtInCommand !== undefined) transformedCliArgs.tree.builtInCommand = builtInCommand;
169
162
  }
170
163
  }
171
164
  // Handle excluded patterns (Commander.js converts --excluded-paths to excludedPaths)
@@ -365,10 +358,8 @@ async function getCliConfig(program) {
365
358
  addSharedOptions(releaseCommand);
366
359
  const publishCommand = program.command('publish').option('--merge-method <method>', 'method to merge PR (merge, squash, rebase)', 'squash').option('--sendit', 'skip all confirmation prompts and proceed automatically').description('Publish a release');
367
360
  addSharedOptions(publishCommand);
368
- const publishTreeCommand = program.command('publish-tree').option('--directory <directory>', 'target directory containing multiple packages (defaults to current directory)').option('--start-from <startFrom>', 'resume build order from this package directory name (useful for restarting failed builds)').option('--script <script>', 'script command to execute in each package directory (e.g., "npm run build")').option('--cmd <cmd>', 'shell command to execute in each package directory (e.g., "git add -A")').option('--publish', 'execute kodrdriv publish command in each package directory').option('--parallel', 'execute packages in parallel when dependencies allow (packages with no interdependencies run simultaneously)').option('--excluded-patterns [excludedPatterns...]', 'patterns to exclude packages from processing (e.g., "**/node_modules/**", "dist/*")').description('Analyze package dependencies in workspace and determine publish order');
369
- addSharedOptions(publishTreeCommand);
370
- const commitTreeCommand = program.command('commit-tree').option('--directory <directory>', 'target directory containing multiple packages (defaults to current directory)').option('--start-from <startFrom>', 'resume commit order from this package directory name (useful for restarting failed commits)').option('--parallel', 'execute packages in parallel when dependencies allow (packages with no interdependencies run simultaneously)').option('--excluded-patterns [excludedPatterns...]', 'patterns to exclude packages from processing (e.g., "**/node_modules/**", "dist/*")').description('Analyze package dependencies in workspace and run commit operations (git add -A + kodrdriv commit) in dependency order');
371
- addSharedOptions(commitTreeCommand);
361
+ const treeCommand = program.command('tree [command]').option('--directory <directory>', 'target directory containing multiple packages (defaults to current directory)').option('--directories [directories...]', 'target directories containing multiple packages (defaults to current directory)').option('--start-from <startFrom>', 'resume execution from this package directory name (useful for restarting failed builds)').option('--cmd <cmd>', 'shell command to execute in each package directory (e.g., "npm install", "git status")').option('--parallel', 'execute packages in parallel when dependencies allow (packages with no interdependencies run simultaneously)').option('--excluded-patterns [excludedPatterns...]', 'patterns to exclude packages from processing (e.g., "**/node_modules/**", "dist/*")').description('Analyze package dependencies in workspace and execute commands in dependency order. Supports built-in commands: commit, publish, link, unlink');
362
+ addSharedOptions(treeCommand);
372
363
  const linkCommand = program.command('link').option('--scope-roots <scopeRoots>', 'JSON mapping of scopes to root directories (e.g., \'{"@company": "../"}\')').description('Create npm file: dependencies for local development');
373
364
  addSharedOptions(linkCommand);
374
365
  const unlinkCommand = program.command('unlink').option('--scope-roots <scopeRoots>', 'JSON mapping of scopes to root directories (e.g., \'{"@company": "../"}\')').description('Restore original dependencies and rebuild node_modules');
@@ -531,10 +522,14 @@ async function getCliConfig(program) {
531
522
  commandOptions = releaseCommand.opts();
532
523
  } else if (commandName === 'publish' && publishCommand.opts) {
533
524
  commandOptions = publishCommand.opts();
534
- } else if (commandName === 'publish-tree' && publishTreeCommand.opts) {
535
- commandOptions = publishTreeCommand.opts();
536
- } else if (commandName === 'commit-tree' && commitTreeCommand.opts) {
537
- commandOptions = commitTreeCommand.opts();
525
+ } else if (commandName === 'tree' && treeCommand.opts) {
526
+ commandOptions = treeCommand.opts();
527
+ // Handle positional argument for built-in command
528
+ const args = treeCommand.args;
529
+ if (args && args.length > 0 && args[0]) {
530
+ // Store the built-in command for later processing
531
+ commandOptions.builtInCommand = args[0];
532
+ }
538
533
  } else if (commandName === 'link' && linkCommand.opts) {
539
534
  commandOptions = linkCommand.opts();
540
535
  } else if (commandName === 'unlink' && unlinkCommand.opts) {
@@ -588,10 +583,10 @@ async function validateAndProcessSecureOptions() {
588
583
  }
589
584
  // Renamed validation function to reflect its broader role
590
585
  async function validateAndProcessOptions(options) {
591
- var _options_commit, _options_commit1, _options_commit2, _options_commit3, _options_commit4, _options_commit5, _options_commit6, _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_audioReview14, _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_publish5, _options_link, _options_link1, _options_publishTree, _options_publishTree1, _options_publishTree2, _options_publishTree3, _options_publishTree4, _options_publishTree5, _options_publishTree6, _options_commitTree, _options_commitTree1, _options_commitTree2, _options_commitTree3;
586
+ var _options_commit, _options_commit1, _options_commit2, _options_commit3, _options_commit4, _options_commit5, _options_commit6, _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_audioReview14, _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_publish5, _options_link, _options_link1, _options_tree, _options_tree1, _options_tree2, _options_tree3, _options_tree4, _options_tree5;
592
587
  const contextDirectories = await validateContextDirectories(options.contextDirectories || KODRDRIV_DEFAULTS.contextDirectories);
593
588
  const configDir = options.configDirectory || KODRDRIV_DEFAULTS.configDirectory;
594
- var _options_dryRun, _options_verbose, _options_debug, _options_overrides, _options_model, _options_outputDirectory, _options_preferencesDirectory, _options_discoveredConfigDirs, _options_resolvedConfigDirs, _options_commit_add, _options_commit_cached, _options_commit_sendit, _options_commit_messageLimit, _options_commit_skipFileCheck, _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_publish_sendit, _options_link_scopeRoots, _options_link_dryRun, _options_publishTree_directory, _options_publishTree_excludedPatterns, _options_publishTree_startFrom, _options_publishTree_script, _options_publishTree_cmd, _options_publishTree_publish, _options_publishTree_parallel, _options_commitTree_directory, _options_commitTree_excludedPatterns, _options_commitTree_startFrom, _options_commitTree_parallel, _options_excludedPatterns;
589
+ var _options_dryRun, _options_verbose, _options_debug, _options_overrides, _options_model, _options_outputDirectory, _options_preferencesDirectory, _options_discoveredConfigDirs, _options_resolvedConfigDirs, _options_commit_add, _options_commit_cached, _options_commit_sendit, _options_commit_messageLimit, _options_commit_skipFileCheck, _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_publish_sendit, _options_link_scopeRoots, _options_link_dryRun, _options_tree_directories, _options_tree_excludedPatterns, _options_tree_startFrom, _options_tree_cmd, _options_tree_parallel, _options_tree_builtInCommand, _options_excludedPatterns;
595
590
  // Skip config directory validation since Cardigantime handles hierarchical lookup
596
591
  // Ensure all required fields are present and have correct types after merging
597
592
  const finalConfig = {
@@ -671,20 +666,13 @@ async function validateAndProcessOptions(options) {
671
666
  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,
672
667
  dryRun: (_options_link_dryRun = (_options_link1 = options.link) === null || _options_link1 === void 0 ? void 0 : _options_link1.dryRun) !== null && _options_link_dryRun !== void 0 ? _options_link_dryRun : KODRDRIV_DEFAULTS.link.dryRun
673
668
  },
674
- publishTree: {
675
- directory: (_options_publishTree_directory = (_options_publishTree = options.publishTree) === null || _options_publishTree === void 0 ? void 0 : _options_publishTree.directory) !== null && _options_publishTree_directory !== void 0 ? _options_publishTree_directory : KODRDRIV_DEFAULTS.publishTree.directory,
676
- excludedPatterns: (_options_publishTree_excludedPatterns = (_options_publishTree1 = options.publishTree) === null || _options_publishTree1 === void 0 ? void 0 : _options_publishTree1.excludedPatterns) !== null && _options_publishTree_excludedPatterns !== void 0 ? _options_publishTree_excludedPatterns : KODRDRIV_DEFAULTS.publishTree.excludedPatterns,
677
- startFrom: (_options_publishTree_startFrom = (_options_publishTree2 = options.publishTree) === null || _options_publishTree2 === void 0 ? void 0 : _options_publishTree2.startFrom) !== null && _options_publishTree_startFrom !== void 0 ? _options_publishTree_startFrom : KODRDRIV_DEFAULTS.publishTree.startFrom,
678
- script: (_options_publishTree_script = (_options_publishTree3 = options.publishTree) === null || _options_publishTree3 === void 0 ? void 0 : _options_publishTree3.script) !== null && _options_publishTree_script !== void 0 ? _options_publishTree_script : KODRDRIV_DEFAULTS.publishTree.script,
679
- cmd: (_options_publishTree_cmd = (_options_publishTree4 = options.publishTree) === null || _options_publishTree4 === void 0 ? void 0 : _options_publishTree4.cmd) !== null && _options_publishTree_cmd !== void 0 ? _options_publishTree_cmd : KODRDRIV_DEFAULTS.publishTree.cmd,
680
- publish: (_options_publishTree_publish = (_options_publishTree5 = options.publishTree) === null || _options_publishTree5 === void 0 ? void 0 : _options_publishTree5.publish) !== null && _options_publishTree_publish !== void 0 ? _options_publishTree_publish : KODRDRIV_DEFAULTS.publishTree.publish,
681
- parallel: (_options_publishTree_parallel = (_options_publishTree6 = options.publishTree) === null || _options_publishTree6 === void 0 ? void 0 : _options_publishTree6.parallel) !== null && _options_publishTree_parallel !== void 0 ? _options_publishTree_parallel : KODRDRIV_DEFAULTS.publishTree.parallel
682
- },
683
- commitTree: {
684
- directory: (_options_commitTree_directory = (_options_commitTree = options.commitTree) === null || _options_commitTree === void 0 ? void 0 : _options_commitTree.directory) !== null && _options_commitTree_directory !== void 0 ? _options_commitTree_directory : KODRDRIV_DEFAULTS.commitTree.directory,
685
- excludedPatterns: (_options_commitTree_excludedPatterns = (_options_commitTree1 = options.commitTree) === null || _options_commitTree1 === void 0 ? void 0 : _options_commitTree1.excludedPatterns) !== null && _options_commitTree_excludedPatterns !== void 0 ? _options_commitTree_excludedPatterns : KODRDRIV_DEFAULTS.commitTree.excludedPatterns,
686
- startFrom: (_options_commitTree_startFrom = (_options_commitTree2 = options.commitTree) === null || _options_commitTree2 === void 0 ? void 0 : _options_commitTree2.startFrom) !== null && _options_commitTree_startFrom !== void 0 ? _options_commitTree_startFrom : KODRDRIV_DEFAULTS.commitTree.startFrom,
687
- parallel: (_options_commitTree_parallel = (_options_commitTree3 = options.commitTree) === null || _options_commitTree3 === void 0 ? void 0 : _options_commitTree3.parallel) !== null && _options_commitTree_parallel !== void 0 ? _options_commitTree_parallel : KODRDRIV_DEFAULTS.commitTree.parallel
669
+ tree: {
670
+ directories: (_options_tree_directories = (_options_tree = options.tree) === null || _options_tree === void 0 ? void 0 : _options_tree.directories) !== null && _options_tree_directories !== void 0 ? _options_tree_directories : KODRDRIV_DEFAULTS.tree.directories,
671
+ excludedPatterns: (_options_tree_excludedPatterns = (_options_tree1 = options.tree) === null || _options_tree1 === void 0 ? void 0 : _options_tree1.excludedPatterns) !== null && _options_tree_excludedPatterns !== void 0 ? _options_tree_excludedPatterns : KODRDRIV_DEFAULTS.tree.excludedPatterns,
672
+ startFrom: (_options_tree_startFrom = (_options_tree2 = options.tree) === null || _options_tree2 === void 0 ? void 0 : _options_tree2.startFrom) !== null && _options_tree_startFrom !== void 0 ? _options_tree_startFrom : KODRDRIV_DEFAULTS.tree.startFrom,
673
+ cmd: (_options_tree_cmd = (_options_tree3 = options.tree) === null || _options_tree3 === void 0 ? void 0 : _options_tree3.cmd) !== null && _options_tree_cmd !== void 0 ? _options_tree_cmd : KODRDRIV_DEFAULTS.tree.cmd,
674
+ parallel: (_options_tree_parallel = (_options_tree4 = options.tree) === null || _options_tree4 === void 0 ? void 0 : _options_tree4.parallel) !== null && _options_tree_parallel !== void 0 ? _options_tree_parallel : KODRDRIV_DEFAULTS.tree.parallel,
675
+ builtInCommand: (_options_tree_builtInCommand = (_options_tree5 = options.tree) === null || _options_tree5 === void 0 ? void 0 : _options_tree5.builtInCommand) !== null && _options_tree_builtInCommand !== void 0 ? _options_tree_builtInCommand : KODRDRIV_DEFAULTS.tree.builtInCommand
688
676
  },
689
677
  excludedPatterns: (_options_excludedPatterns = options.excludedPatterns) !== null && _options_excludedPatterns !== void 0 ? _options_excludedPatterns : KODRDRIV_DEFAULTS.excludedPatterns
690
678
  };