@eldrforge/kodrdriv 0.0.41 → 0.0.43
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/application.js +28 -14
- package/dist/application.js.map +1 -1
- package/dist/arguments.js +38 -15
- package/dist/arguments.js.map +1 -1
- package/dist/commands/commit-tree.js +490 -0
- package/dist/commands/commit-tree.js.map +1 -0
- package/dist/commands/commit.js +36 -14
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/publish-tree.js +197 -1
- package/dist/commands/publish-tree.js.map +1 -1
- package/dist/constants.js +10 -2
- package/dist/constants.js.map +1 -1
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -1
- package/dist/util/github.js +15 -65
- package/dist/util/github.js.map +1 -1
- package/package.json +2 -2
package/dist/application.js
CHANGED
|
@@ -2,17 +2,18 @@ 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$
|
|
6
|
-
import { execute as execute$
|
|
5
|
+
import { execute as execute$8 } from './commands/audio-review.js';
|
|
6
|
+
import { execute as execute$9 } from './commands/clean.js';
|
|
7
7
|
import { execute } from './commands/commit.js';
|
|
8
|
-
import { execute as execute$
|
|
8
|
+
import { execute as execute$6 } from './commands/link.js';
|
|
9
9
|
import { execute as execute$3 } from './commands/publish.js';
|
|
10
10
|
import { execute as execute$4 } from './commands/publish-tree.js';
|
|
11
|
+
import { execute as execute$5 } from './commands/commit-tree.js';
|
|
11
12
|
import { execute as execute$2 } from './commands/release.js';
|
|
12
|
-
import { execute as execute$
|
|
13
|
-
import { execute as execute$
|
|
14
|
-
import { execute as execute$
|
|
15
|
-
import { DEFAULT_CONFIG_DIR, COMMAND_CHECK_CONFIG, COMMAND_INIT_CONFIG, COMMAND_COMMIT, COMMAND_AUDIO_COMMIT, COMMAND_RELEASE, COMMAND_PUBLISH, COMMAND_PUBLISH_TREE, COMMAND_LINK, COMMAND_UNLINK, COMMAND_AUDIO_REVIEW, COMMAND_CLEAN, COMMAND_REVIEW, COMMAND_SELECT_AUDIO } from './constants.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';
|
|
16
17
|
import { getLogger, setLogLevel } from './logging.js';
|
|
17
18
|
import { ConfigSchema } from './types.js';
|
|
18
19
|
import { UserCancellationError } from './error/CommandErrors.js';
|
|
@@ -87,7 +88,7 @@ async function runApplication() {
|
|
|
87
88
|
const command = process.argv[2];
|
|
88
89
|
let commandName = commandConfig.commandName;
|
|
89
90
|
// If we have a specific command argument, use that
|
|
90
|
-
if (command === 'commit' || command === 'audio-commit' || command === 'release' || command === 'publish' || command === 'publish-tree' || command === 'link' || command === 'unlink' || command === 'audio-review' || command === 'clean' || command === 'review' || command === 'select-audio') {
|
|
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') {
|
|
91
92
|
commandName = command;
|
|
92
93
|
}
|
|
93
94
|
let summary = '';
|
|
@@ -114,19 +115,32 @@ async function runApplication() {
|
|
|
114
115
|
runConfig.publishTree.excludedPatterns = runConfig.excludedPatterns;
|
|
115
116
|
}
|
|
116
117
|
summary = await execute$4(runConfig);
|
|
117
|
-
} else if (commandName ===
|
|
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
|
+
}
|
|
118
130
|
summary = await execute$5(runConfig);
|
|
119
|
-
} else if (commandName ===
|
|
131
|
+
} else if (commandName === COMMAND_LINK) {
|
|
120
132
|
summary = await execute$6(runConfig);
|
|
121
|
-
} else if (commandName ===
|
|
133
|
+
} else if (commandName === COMMAND_UNLINK) {
|
|
122
134
|
summary = await execute$7(runConfig);
|
|
135
|
+
} else if (commandName === COMMAND_AUDIO_REVIEW) {
|
|
136
|
+
summary = await execute$8(runConfig);
|
|
123
137
|
} else if (commandName === COMMAND_CLEAN) {
|
|
124
|
-
await execute$
|
|
138
|
+
await execute$9(runConfig);
|
|
125
139
|
summary = 'Output directory cleaned successfully.';
|
|
126
140
|
} else if (commandName === COMMAND_REVIEW) {
|
|
127
|
-
summary = await execute$
|
|
141
|
+
summary = await execute$a(runConfig);
|
|
128
142
|
} else if (commandName === COMMAND_SELECT_AUDIO) {
|
|
129
|
-
await execute$
|
|
143
|
+
await execute$b(runConfig);
|
|
130
144
|
summary = 'Audio selection completed successfully.';
|
|
131
145
|
}
|
|
132
146
|
// eslint-disable-next-line no-console
|
package/dist/application.js.map
CHANGED
|
@@ -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 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_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 === '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_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_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,aAAA;;YAEAC,aAAAA,EAAe;gBACX,oBAAA,EAAsB;AAE1B;AACJ,SAAA;QACAC,QAAAA,EAAU;AAAC,YAAA,QAAA;AAAU,YAAA;AAAe,SAAA;A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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 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,kB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;AACzBvE,YAAAA,OAAAA,CAAQwE,IAAI,CAAC,CAAA,CAAA;AACjB,QAAA;;QAGA,MAAMJ,KAAAA;AACV,IAAA;AACJ;;;;"}
|
package/dist/arguments.js
CHANGED
|
@@ -54,7 +54,7 @@ z.object({
|
|
|
54
54
|
keepTemp: z.boolean().optional()
|
|
55
55
|
});
|
|
56
56
|
// Function to transform flat CLI args into nested Config structure
|
|
57
|
-
const transformCliArgs = (finalCliArgs)=>{
|
|
57
|
+
const transformCliArgs = (finalCliArgs, commandName)=>{
|
|
58
58
|
const transformedCliArgs = {};
|
|
59
59
|
// Direct mappings from Input to Config
|
|
60
60
|
if (finalCliArgs.dryRun !== undefined) transformedCliArgs.dryRun = finalCliArgs.dryRun;
|
|
@@ -143,17 +143,30 @@ const transformCliArgs = (finalCliArgs)=>{
|
|
|
143
143
|
if (finalCliArgs.context !== undefined) transformedCliArgs.review.context = finalCliArgs.context;
|
|
144
144
|
if (finalCliArgs.sendit !== undefined) transformedCliArgs.review.sendit = finalCliArgs.sendit;
|
|
145
145
|
}
|
|
146
|
-
// Nested mappings for 'publishTree' options
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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;
|
|
169
|
+
}
|
|
157
170
|
}
|
|
158
171
|
// Handle excluded patterns (Commander.js converts --excluded-paths to excludedPaths)
|
|
159
172
|
const excludedPatterns = finalCliArgs.excludedPatterns || finalCliArgs.excludedPaths;
|
|
@@ -217,7 +230,7 @@ const configure = async (cardigantime)=>{
|
|
|
217
230
|
const [finalCliArgs, commandConfig] = await getCliConfig(program);
|
|
218
231
|
logger.silly('Loaded Command Line Options: %s', JSON.stringify(finalCliArgs, null, 2));
|
|
219
232
|
// Transform the flat CLI args using the new function
|
|
220
|
-
const transformedCliArgs = transformCliArgs(finalCliArgs);
|
|
233
|
+
const transformedCliArgs = transformCliArgs(finalCliArgs, commandConfig.commandName);
|
|
221
234
|
logger.silly('Transformed CLI Args for merging: %s', JSON.stringify(transformedCliArgs, null, 2));
|
|
222
235
|
// Get values from config file using Cardigantime's hierarchical configuration
|
|
223
236
|
const fileValues = await cardigantime.read(transformedCliArgs);
|
|
@@ -354,6 +367,8 @@ async function getCliConfig(program) {
|
|
|
354
367
|
addSharedOptions(publishCommand);
|
|
355
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');
|
|
356
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);
|
|
357
372
|
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');
|
|
358
373
|
addSharedOptions(linkCommand);
|
|
359
374
|
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');
|
|
@@ -518,6 +533,8 @@ async function getCliConfig(program) {
|
|
|
518
533
|
commandOptions = publishCommand.opts();
|
|
519
534
|
} else if (commandName === 'publish-tree' && publishTreeCommand.opts) {
|
|
520
535
|
commandOptions = publishTreeCommand.opts();
|
|
536
|
+
} else if (commandName === 'commit-tree' && commitTreeCommand.opts) {
|
|
537
|
+
commandOptions = commitTreeCommand.opts();
|
|
521
538
|
} else if (commandName === 'link' && linkCommand.opts) {
|
|
522
539
|
commandOptions = linkCommand.opts();
|
|
523
540
|
} else if (commandName === 'unlink' && unlinkCommand.opts) {
|
|
@@ -571,10 +588,10 @@ async function validateAndProcessSecureOptions() {
|
|
|
571
588
|
}
|
|
572
589
|
// Renamed validation function to reflect its broader role
|
|
573
590
|
async function validateAndProcessOptions(options) {
|
|
574
|
-
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;
|
|
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;
|
|
575
592
|
const contextDirectories = await validateContextDirectories(options.contextDirectories || KODRDRIV_DEFAULTS.contextDirectories);
|
|
576
593
|
const configDir = options.configDirectory || KODRDRIV_DEFAULTS.configDirectory;
|
|
577
|
-
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_excludedPatterns;
|
|
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;
|
|
578
595
|
// Skip config directory validation since Cardigantime handles hierarchical lookup
|
|
579
596
|
// Ensure all required fields are present and have correct types after merging
|
|
580
597
|
const finalConfig = {
|
|
@@ -663,6 +680,12 @@ async function validateAndProcessOptions(options) {
|
|
|
663
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,
|
|
664
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
|
|
665
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
|
|
688
|
+
},
|
|
666
689
|
excludedPatterns: (_options_excludedPatterns = options.excludedPatterns) !== null && _options_excludedPatterns !== void 0 ? _options_excludedPatterns : KODRDRIV_DEFAULTS.excludedPatterns
|
|
667
690
|
};
|
|
668
691
|
// Final validation against the MainConfig shape (optional, cardigantime might handle it)
|