@grunnverk/kodrdriv 1.5.6 → 1.5.10

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
@@ -218,3 +218,4 @@ Like Thor's hammer, this tool smashes through your repetitive coding tasks. But
218
218
 
219
219
  <!-- Build: 2026-01-15 15:59:12 UTC -->
220
220
  TEST
221
+ TEST
@@ -1,5 +1,5 @@
1
1
  import { config } from 'dotenv';
2
- import * as Cardigantime from '@theunwalked/cardigantime';
2
+ import * as Cardigantime from '@utilarium/cardigantime';
3
3
  import { setLogger } from '@grunnverk/git-tools';
4
4
  import { setLogger as setLogger$1, setPromptFunction } from '@grunnverk/github-tools';
5
5
  import { promptConfirmation, UserCancellationError } from '@grunnverk/shared';
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sources":["../src/application.ts"],"sourcesContent":["// Load .env file if it exists, but NEVER override existing environment variables\n// This MUST be the first thing we do, before any other imports that might load dotenv\n// This ensures that shell-exported variables like OPENAI_API_KEY take precedence\nimport { config as dotenvConfig } from 'dotenv';\ndotenvConfig({ override: false, debug: false });\n\nimport * as Cardigantime from '@theunwalked/cardigantime';\nimport { setLogger as setGitLogger } from '@grunnverk/git-tools';\nimport { setLogger as setGitHubLogger, setPromptFunction } from '@grunnverk/github-tools';\nimport { promptConfirmation } from '@grunnverk/shared';\nimport { initializeTemplates } from '@grunnverk/ai-service';\nimport { CommandConfig } from 'types';\nimport * as Arguments from './arguments';\n\n// Import commands from extracted packages\nimport * as CommandsGit from '@grunnverk/commands-git';\nimport * as CommandsTree from '@grunnverk/commands-tree';\nimport * as CommandsPublish from '@grunnverk/commands-publish';\nimport * as CommandsAudio from '@grunnverk/commands-audio';\nimport { COMMAND_AUDIO_COMMIT, COMMAND_AUDIO_REVIEW, COMMAND_CHECK_CONFIG, COMMAND_CHECK_DEVELOPMENT, COMMAND_CLEAN, COMMAND_COMMIT, COMMAND_DEVELOPMENT, COMMAND_INIT_CONFIG, COMMAND_LINK, COMMAND_PRECOMMIT, COMMAND_PUBLISH, COMMAND_PULL, COMMAND_RELEASE, COMMAND_REVIEW, COMMAND_SELECT_AUDIO, COMMAND_TREE, COMMAND_UNLINK, COMMAND_UPDATES, COMMAND_VERSIONS, DEFAULT_CONFIG_DIR, VERSION, PROGRAM_NAME } from './constants';\nimport { UserCancellationError } from '@grunnverk/shared';\nimport { getLogger, setLogLevel } from './logging';\nimport { Config, SecureConfig, ConfigSchema } from './types';\n\n/**\n * Check Node.js version and exit with clear error message if version is too old.\n */\nfunction checkNodeVersion(): void {\n const requiredMajorVersion = 24;\n const currentVersion = process.version;\n const majorVersion = parseInt(currentVersion.slice(1).split('.')[0], 10);\n\n if (majorVersion < requiredMajorVersion) {\n // eslint-disable-next-line no-console\n console.error(`\\n❌ ERROR: Node.js version ${requiredMajorVersion}.0.0 or higher is required.`);\n // eslint-disable-next-line no-console\n console.error(` Current version: ${currentVersion}`);\n // eslint-disable-next-line no-console\n console.error(` Please upgrade your Node.js version to continue.\\n`);\n // eslint-disable-next-line no-console\n console.error(` This project uses Vite 7+ which requires Node.js ${requiredMajorVersion}+.\\n`);\n process.exit(1);\n }\n}\n\n/**\n * Get formatted version information.\n */\nexport function getVersionInfo(): { version: string; programName: string; fullVersion: string; formatted: string } {\n return {\n version: VERSION,\n programName: PROGRAM_NAME,\n fullVersion: `${PROGRAM_NAME} ${VERSION}`,\n formatted: `${PROGRAM_NAME} ${VERSION}`\n };\n}\n\n/**\n * Print debug information about the command being executed when debug flag is enabled.\n */\nfunction printDebugCommandInfo(commandName: string, runConfig: Config): void {\n if (runConfig.debug) {\n const logger = getLogger();\n logger.info('DEBUG_INFO_HEADER: KodrDriv debug information');\n logger.info('DEBUG_INFO_COMMAND: Command being executed | Command: %s', commandName);\n logger.info('DEBUG_INFO_VERSION: KodrDriv version | Version: %s', VERSION);\n\n // Log last 4 characters of tokens for debugging permissions issues\n const openaiToken = process.env.OPENAI_API_KEY;\n const githubToken = process.env.GITHUB_TOKEN;\n\n if (openaiToken) {\n const tokenSuffix = openaiToken.slice(-4);\n logger.info('DEBUG_INFO_TOKEN: OpenAI API Key | Suffix: ...%s', tokenSuffix);\n } else {\n logger.info('DEBUG_INFO_TOKEN: OpenAI API Key | Status: not set');\n }\n\n if (githubToken) {\n const tokenSuffix = githubToken.slice(-4);\n logger.info('DEBUG_INFO_TOKEN: GitHub Token | Suffix: ...%s', tokenSuffix);\n } else {\n logger.info('DEBUG_INFO_TOKEN: GitHub Token | Status: not set');\n }\n\n logger.info('DEBUG_INFO_FOOTER: End of debug information');\n }\n}\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 // Check Node.js version first, before doing anything else\n checkNodeVersion();\n\n // Configure logging early, before CardiganTime initialization\n configureEarlyLogging();\n\n // Initialize RiotPrompt templates for ai-service\n initializeTemplates();\n\n // Use proper typing for CardiganTime create function\n interface CardigantimeCreateParams {\n defaults?: any;\n features?: string[];\n configShape?: any;\n logger?: any;\n }\n\n interface CardigantimeInstance {\n read: (args: any) => Promise<any>;\n checkConfig: () => Promise<void>;\n generateConfig: (dir: string) => Promise<void>;\n setLogger: (logger: any) => void;\n }\n\n const cardigantimeModule = Cardigantime as any;\n const createCardigantime = cardigantimeModule.create as (params: CardigantimeCreateParams) => CardigantimeInstance;\n\n const cardigantime = createCardigantime({\n defaults: {\n configDirectory: DEFAULT_CONFIG_DIR,\n },\n configShape: ConfigSchema.shape,\n features: ['config', 'hierarchical'],\n logger: getLogger(),\n });\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 // Configure external packages to use our logger and prompt\n setGitLogger(logger);\n setGitHubLogger(logger);\n setPromptFunction(promptConfirmation);\n\n // Display version information\n logger.info('APPLICATION_STARTING: KodrDriv application initializing | Version: %s | Status: starting',\n VERSION);\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', 'development', 'updates', 'pull'];\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 === 'pull' || command === 'precommit' || command === 'review' || command === 'select-audio' || command === 'development' || command === 'check-development' || command === 'versions' || command === 'updates') {\n commandName = command;\n }\n\n let summary: string = '';\n\n try {\n // Print debug info at the start of command execution\n if (commandName) {\n printDebugCommandInfo(commandName, runConfig);\n }\n\n // Git commands (from @grunnverk/commands-git)\n if (commandName === COMMAND_COMMIT) {\n summary = await CommandsGit.commit(runConfig);\n } else if (commandName === COMMAND_PRECOMMIT) {\n summary = await CommandsGit.precommit(runConfig);\n } else if (commandName === COMMAND_CLEAN) {\n await CommandsGit.clean(runConfig);\n summary = 'Output directory cleaned successfully.';\n } else if (commandName === COMMAND_PULL) {\n summary = await CommandsGit.pull(runConfig);\n } else if (commandName === COMMAND_REVIEW) {\n summary = await CommandsGit.review(runConfig);\n }\n // Tree commands (from @grunnverk/commands-tree)\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?.exclude) {\n runConfig.tree = runConfig.tree || {};\n runConfig.tree.exclude = runConfig.excludedPatterns;\n }\n summary = await CommandsTree.tree(runConfig);\n } else if (commandName === COMMAND_LINK) {\n summary = await CommandsTree.link(runConfig);\n } else if (commandName === COMMAND_UNLINK) {\n summary = await CommandsTree.unlink(runConfig);\n } else if (commandName === COMMAND_UPDATES) {\n summary = await CommandsTree.updates(runConfig);\n } else if (commandName === COMMAND_VERSIONS) {\n summary = await CommandsTree.versions(runConfig);\n }\n // Publish commands (from @grunnverk/commands-publish)\n else if (commandName === COMMAND_RELEASE) {\n const releaseSummary = await CommandsPublish.release(runConfig);\n summary = `${releaseSummary.title}\\n\\n${releaseSummary.body}`;\n } else if (commandName === COMMAND_PUBLISH) {\n await CommandsPublish.publish(runConfig);\n } else if (commandName === COMMAND_DEVELOPMENT) {\n summary = await CommandsPublish.development(runConfig);\n } else if (commandName === COMMAND_CHECK_DEVELOPMENT) {\n summary = await CommandsPublish.checkDevelopment(runConfig);\n }\n // Audio commands (from @grunnverk/commands-audio)\n else if (commandName === COMMAND_AUDIO_COMMIT) {\n summary = await CommandsAudio.audioCommit(runConfig);\n } else if (commandName === COMMAND_AUDIO_REVIEW) {\n summary = await CommandsAudio.audioReview(runConfig);\n } else if (commandName === COMMAND_SELECT_AUDIO) {\n await CommandsAudio.selectAudio(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('APPLICATION_ERROR: Application error occurred | Error: ' + 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":["dotenvConfig","override","debug","checkNodeVersion","requiredMajorVersion","currentVersion","process","version","majorVersion","parseInt","slice","split","console","error","exit","printDebugCommandInfo","commandName","runConfig","logger","getLogger","info","VERSION","openaiToken","env","OPENAI_API_KEY","githubToken","GITHUB_TOKEN","tokenSuffix","configureEarlyLogging","hasVerbose","argv","includes","hasDebug","setLogLevel","runApplication","initializeTemplates","cardigantimeModule","Cardigantime","createCardigantime","create","cardigantime","defaults","configDirectory","DEFAULT_CONFIG_DIR","configShape","ConfigSchema","shape","features","secureConfig","commandConfig","Arguments","verbose","setLogger","setGitLogger","setGitHubLogger","setPromptFunction","promptConfirmation","COMMAND_CHECK_CONFIG","COMMAND_INIT_CONFIG","command","treeBuiltInCommand","supportedBuiltInCommands","summary","COMMAND_COMMIT","CommandsGit","commit","COMMAND_PRECOMMIT","precommit","COMMAND_CLEAN","clean","COMMAND_PULL","pull","COMMAND_REVIEW","review","COMMAND_TREE","audioReview","directory","tree","directories","excludedPatterns","exclude","CommandsTree","COMMAND_LINK","link","COMMAND_UNLINK","unlink","COMMAND_UPDATES","updates","COMMAND_VERSIONS","versions","COMMAND_RELEASE","releaseSummary","CommandsPublish","release","title","body","COMMAND_PUBLISH","publish","COMMAND_DEVELOPMENT","development","COMMAND_CHECK_DEVELOPMENT","checkDevelopment","COMMAND_AUDIO_COMMIT","CommandsAudio","audioCommit","COMMAND_AUDIO_REVIEW","COMMAND_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WAAW,CAAClF,SAAAA,CAAAA;QAChD,CAAA,MAAO,IAAID,gBAAgBoF,yBAAAA,EAA2B;YAClDtC,OAAAA,GAAU,MAAM8B,eAAAA,CAAgBS,gBAAgB,CAACpF,SAAAA,CAAAA;QACrD,CAAA,MAEK,IAAID,gBAAgBsF,oBAAAA,EAAsB;YAC3CxC,OAAAA,GAAU,MAAMyC,aAAAA,CAAcC,WAAW,CAACvF,SAAAA,CAAAA;QAC9C,CAAA,MAAO,IAAID,gBAAgByF,oBAAAA,EAAsB;YAC7C3C,OAAAA,GAAU,MAAMyC,aAAAA,CAAc5B,WAAW,CAAC1D,SAAAA,CAAAA;QAC9C,CAAA,MAAO,IAAID,gBAAgB0F,oBAAAA,EAAsB;YAC7C,MAAMH,aAAAA,CAAcI,WAAW,CAAC1F,SAAAA,CAAAA;YAChC6C,OAAAA,GAAU,yCAAA;AACd,QAAA;;AAGAlD,QAAAA,OAAAA,CAAQgG,GAAG,CAAC,CAAC,IAAI,EAAE9C,OAAAA,CAAQ,IAAI,CAAC,CAAA;AACpC,IAAA,CAAA,CAAE,OAAOjD,KAAAA,EAAY;;AAEjB,QAAA,IAAIA,iBAAiBgG,qBAAAA,EAAuB;AACxC3F,YAAAA,MAAAA,CAAOE,IAAI,CAAC,yDAAA,GAA4DP,KAAAA,CAAMiG,OAAO,CAAA;AACrFxG,YAAAA,OAAAA,CAAQQ,IAAI,CAAC,CAAA,CAAA;AACjB,QAAA;;QAGA,MAAMD,KAAAA;AACV,IAAA;AACJ;;;;"}
1
+ {"version":3,"file":"application.js","sources":["../src/application.ts"],"sourcesContent":["// Load .env file if it exists, but NEVER override existing environment variables\n// This MUST be the first thing we do, before any other imports that might load dotenv\n// This ensures that shell-exported variables like OPENAI_API_KEY take precedence\nimport { config as dotenvConfig } from 'dotenv';\ndotenvConfig({ override: false, debug: false });\n\nimport * as Cardigantime from '@utilarium/cardigantime';\nimport { setLogger as setGitLogger } from '@grunnverk/git-tools';\nimport { setLogger as setGitHubLogger, setPromptFunction } from '@grunnverk/github-tools';\nimport { promptConfirmation } from '@grunnverk/shared';\nimport { initializeTemplates } from '@grunnverk/ai-service';\nimport { CommandConfig } from 'types';\nimport * as Arguments from './arguments';\n\n// Import commands from extracted packages\nimport * as CommandsGit from '@grunnverk/commands-git';\nimport * as CommandsTree from '@grunnverk/commands-tree';\nimport * as CommandsPublish from '@grunnverk/commands-publish';\nimport * as CommandsAudio from '@grunnverk/commands-audio';\nimport { COMMAND_AUDIO_COMMIT, COMMAND_AUDIO_REVIEW, COMMAND_CHECK_CONFIG, COMMAND_CHECK_DEVELOPMENT, COMMAND_CLEAN, COMMAND_COMMIT, COMMAND_DEVELOPMENT, COMMAND_INIT_CONFIG, COMMAND_LINK, COMMAND_PRECOMMIT, COMMAND_PUBLISH, COMMAND_PULL, COMMAND_RELEASE, COMMAND_REVIEW, COMMAND_SELECT_AUDIO, COMMAND_TREE, COMMAND_UNLINK, COMMAND_UPDATES, COMMAND_VERSIONS, DEFAULT_CONFIG_DIR, VERSION, PROGRAM_NAME } from './constants';\nimport { UserCancellationError } from '@grunnverk/shared';\nimport { getLogger, setLogLevel } from './logging';\nimport { Config, SecureConfig, ConfigSchema } from './types';\n\n/**\n * Check Node.js version and exit with clear error message if version is too old.\n */\nfunction checkNodeVersion(): void {\n const requiredMajorVersion = 24;\n const currentVersion = process.version;\n const majorVersion = parseInt(currentVersion.slice(1).split('.')[0], 10);\n\n if (majorVersion < requiredMajorVersion) {\n // eslint-disable-next-line no-console\n console.error(`\\n❌ ERROR: Node.js version ${requiredMajorVersion}.0.0 or higher is required.`);\n // eslint-disable-next-line no-console\n console.error(` Current version: ${currentVersion}`);\n // eslint-disable-next-line no-console\n console.error(` Please upgrade your Node.js version to continue.\\n`);\n // eslint-disable-next-line no-console\n console.error(` This project uses Vite 7+ which requires Node.js ${requiredMajorVersion}+.\\n`);\n process.exit(1);\n }\n}\n\n/**\n * Get formatted version information.\n */\nexport function getVersionInfo(): { version: string; programName: string; fullVersion: string; formatted: string } {\n return {\n version: VERSION,\n programName: PROGRAM_NAME,\n fullVersion: `${PROGRAM_NAME} ${VERSION}`,\n formatted: `${PROGRAM_NAME} ${VERSION}`\n };\n}\n\n/**\n * Print debug information about the command being executed when debug flag is enabled.\n */\nfunction printDebugCommandInfo(commandName: string, runConfig: Config): void {\n if (runConfig.debug) {\n const logger = getLogger();\n logger.info('DEBUG_INFO_HEADER: KodrDriv debug information');\n logger.info('DEBUG_INFO_COMMAND: Command being executed | Command: %s', commandName);\n logger.info('DEBUG_INFO_VERSION: KodrDriv version | Version: %s', VERSION);\n\n // Log last 4 characters of tokens for debugging permissions issues\n const openaiToken = process.env.OPENAI_API_KEY;\n const githubToken = process.env.GITHUB_TOKEN;\n\n if (openaiToken) {\n const tokenSuffix = openaiToken.slice(-4);\n logger.info('DEBUG_INFO_TOKEN: OpenAI API Key | Suffix: ...%s', tokenSuffix);\n } else {\n logger.info('DEBUG_INFO_TOKEN: OpenAI API Key | Status: not set');\n }\n\n if (githubToken) {\n const tokenSuffix = githubToken.slice(-4);\n logger.info('DEBUG_INFO_TOKEN: GitHub Token | Suffix: ...%s', tokenSuffix);\n } else {\n logger.info('DEBUG_INFO_TOKEN: GitHub Token | Status: not set');\n }\n\n logger.info('DEBUG_INFO_FOOTER: End of debug information');\n }\n}\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 // Check Node.js version first, before doing anything else\n checkNodeVersion();\n\n // Configure logging early, before CardiganTime initialization\n configureEarlyLogging();\n\n // Initialize RiotPrompt templates for ai-service\n initializeTemplates();\n\n // Use proper typing for CardiganTime create function\n interface CardigantimeCreateParams {\n defaults?: any;\n features?: string[];\n configShape?: any;\n logger?: any;\n }\n\n interface CardigantimeInstance {\n read: (args: any) => Promise<any>;\n checkConfig: () => Promise<void>;\n generateConfig: (dir: string) => Promise<void>;\n setLogger: (logger: any) => void;\n }\n\n const cardigantimeModule = Cardigantime as any;\n const createCardigantime = cardigantimeModule.create as (params: CardigantimeCreateParams) => CardigantimeInstance;\n\n const cardigantime = createCardigantime({\n defaults: {\n configDirectory: DEFAULT_CONFIG_DIR,\n },\n configShape: ConfigSchema.shape,\n features: ['config', 'hierarchical'],\n logger: getLogger(),\n });\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 // Configure external packages to use our logger and prompt\n setGitLogger(logger);\n setGitHubLogger(logger);\n setPromptFunction(promptConfirmation);\n\n // Display version information\n logger.info('APPLICATION_STARTING: KodrDriv application initializing | Version: %s | Status: starting',\n VERSION);\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', 'development', 'updates', 'pull'];\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 === 'pull' || command === 'precommit' || command === 'review' || command === 'select-audio' || command === 'development' || command === 'check-development' || command === 'versions' || command === 'updates') {\n commandName = command;\n }\n\n let summary: string = '';\n\n try {\n // Print debug info at the start of command execution\n if (commandName) {\n printDebugCommandInfo(commandName, runConfig);\n }\n\n // Git commands (from @grunnverk/commands-git)\n if (commandName === COMMAND_COMMIT) {\n summary = await CommandsGit.commit(runConfig);\n } else if (commandName === COMMAND_PRECOMMIT) {\n summary = await CommandsGit.precommit(runConfig);\n } else if (commandName === COMMAND_CLEAN) {\n await CommandsGit.clean(runConfig);\n summary = 'Output directory cleaned successfully.';\n } else if (commandName === COMMAND_PULL) {\n summary = await CommandsGit.pull(runConfig);\n } else if (commandName === COMMAND_REVIEW) {\n summary = await CommandsGit.review(runConfig);\n }\n // Tree commands (from @grunnverk/commands-tree)\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?.exclude) {\n runConfig.tree = runConfig.tree || {};\n runConfig.tree.exclude = runConfig.excludedPatterns;\n }\n summary = await CommandsTree.tree(runConfig);\n } else if (commandName === COMMAND_LINK) {\n summary = await CommandsTree.link(runConfig);\n } else if (commandName === COMMAND_UNLINK) {\n summary = await CommandsTree.unlink(runConfig);\n } else if (commandName === COMMAND_UPDATES) {\n summary = await CommandsTree.updates(runConfig);\n } else if (commandName === COMMAND_VERSIONS) {\n summary = await CommandsTree.versions(runConfig);\n }\n // Publish commands (from @grunnverk/commands-publish)\n else if (commandName === COMMAND_RELEASE) {\n const releaseSummary = await CommandsPublish.release(runConfig);\n summary = `${releaseSummary.title}\\n\\n${releaseSummary.body}`;\n } else if (commandName === COMMAND_PUBLISH) {\n await CommandsPublish.publish(runConfig);\n } else if (commandName === COMMAND_DEVELOPMENT) {\n summary = await CommandsPublish.development(runConfig);\n } else if (commandName === COMMAND_CHECK_DEVELOPMENT) {\n summary = await CommandsPublish.checkDevelopment(runConfig);\n }\n // Audio commands (from @grunnverk/commands-audio)\n else if (commandName === COMMAND_AUDIO_COMMIT) {\n summary = await CommandsAudio.audioCommit(runConfig);\n } else if (commandName === COMMAND_AUDIO_REVIEW) {\n summary = await CommandsAudio.audioReview(runConfig);\n } else if (commandName === COMMAND_SELECT_AUDIO) {\n await CommandsAudio.selectAudio(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('APPLICATION_ERROR: Application error occurred | Error: ' + 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":["dotenvConfig","override","debug","checkNodeVersion","requiredMajorVersion","currentVersion","process","version","majorVersion","parseInt","slice","split","console","error","exit","printDebugCommandInfo","commandName","runConfig","logger","getLogger","info","VERSION","openaiToken","env","OPENAI_API_KEY","githubToken","GITHUB_TOKEN","tokenSuffix","configureEarlyLogging","hasVerbose","argv","includes","hasDebug","setLogLevel","runApplication","initializeTemplates","cardigantimeModule","Cardigantime","createCardigantime","create","cardigantime","defaults","configDirectory","DEFAULT_CONFIG_DIR","configShape","ConfigSchema","shape","features","secureConfig","commandConfig","Arguments","verbose","setLogger","setGitLogger","setGitHubLogger","setPromptFunction","promptConfirmation","COMMAND_CHECK_CONFIG","COMMAND_INIT_CONFIG","command","treeBuiltInCommand","supportedBuiltInCommands","summary","COMMAND_COMMIT","CommandsGit","commit","COMMAND_PRECOMMIT","precommit","COMMAND_CLEAN","clean","COMMAND_PULL","pull","COMMAND_REVIEW","review","COMMAND_TREE","audioReview","directory","tree","directories","excludedPatterns","exclude","CommandsTree","COMMAND_LINK","link","COMMAND_UNLINK","unlink","COMMAND_UPDATES","updates","COMMAND_VERSIONS","versions","COMMAND_RELEASE","releaseSummary","CommandsPublish","release","title","body","COMMAND_PUBLISH","publish","COMMAND_DEVELOPMENT","development","COMMAND_CHECK_DEVELOPMENT","checkDevelopment","COMMAND_AUDIO_COMMIT","CommandsAudio","audioCommit","COMMAND_AUDIO_REVIEW","COMMAND_SELECT_AUDIO","selectAudio","log","UserCancellationError","message"],"mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEAA,MAAAA,CAAa;IAAEC,QAAAA,EAAU,KAAA;IAAOC,KAAAA,EAAO;AAAM,CAAA,CAAA;AAoB7C;;AAEC,IACD,SAASC,gBAAAA,GAAAA;AACL,IAAA,MAAMC,oBAAAA,GAAuB,EAAA;IAC7B,MAAMC,cAAAA,GAAiBC,QAAQC,OAAO;IACtC,MAAMC,YAAAA,GAAeC,QAAAA,CAASJ,cAAAA,CAAeK,KAAK,CAAC,CAAA,CAAA,CAAGC,KAAK,CAAC,GAAA,CAAI,CAAC,CAAA,CAAE,EAAE,EAAA,CAAA;AAErE,IAAA,IAAIH,eAAeJ,oBAAAA,EAAsB;;AAErCQ,QAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,2BAA2B,EAAET,oBAAAA,CAAqB,2BAA2B,CAAC,CAAA;;AAE7FQ,QAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,oBAAoB,EAAER,cAAAA,CAAAA,CAAgB,CAAA;;AAErDO,QAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,qDAAqD,CAAC,CAAA;;AAErED,QAAAA,OAAAA,CAAQC,KAAK,CAAC,CAAC,oDA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AAA,GAA4DP,KAAAA,CAAMiG,OAAO,CAAA;AACrFxG,YAAAA,OAAAA,CAAQQ,IAAI,CAAC,CAAA,CAAA;AACjB,QAAA;;QAGA,MAAMD,KAAAA;AACV,IAAA;AACJ;;;;"}
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import os from 'os';
2
2
  import path from 'path';
3
3
 
4
- /** Version string populated at build time with git and system information */ const VERSION = '1.5.6 (HEAD/9d2cc4b T:v1.5.6 2026-01-28 22:36:49 -0800) linux x64 v24.13.0';
4
+ /** Version string populated at build time with git and system information */ const VERSION = '1.5.10 (HEAD/7ae491d T:v1.5.10 2026-01-30 16:24:41 -0800) linux x64 v24.13.0';
5
5
  /** The program name used in CLI help and error messages */ const PROGRAM_NAME = 'kodrdriv';
6
6
  const DEFAULT_OVERRIDES = false;
7
7
  const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = 'YYYY-MM-DD-HHmmss.SSS';
@@ -31,13 +31,13 @@ Optionally, validate release workflow readiness by checking:
31
31
  - List all issues found below the table
32
32
  - Include a summary showing X/Y projects ready
33
33
 
34
- **Example execution for grunnverk workspace:**
34
+ **Example execution for a monorepo workspace:**
35
35
  ```
36
- // Step 1: Identify all projects
36
+ // Step 1: Identify all projects from workspace paths
37
37
  const projects = [
38
- '/Users/tobrien/gitw/grunnverk/kilde',
39
- '/Users/tobrien/gitw/grunnverk/kodrdriv',
40
- '/Users/tobrien/gitw/grunnverk/ai-service',
38
+ '/path/to/workspace/package1',
39
+ '/path/to/workspace/package2',
40
+ '/path/to/workspace/package3',
41
41
  // ... all other projects
42
42
  ];
43
43
 
@@ -2,102 +2,123 @@
2
2
 
3
3
  ## Objective
4
4
 
5
- Ensure that precommit checks pass successfully across the entire monorepo tree. When failures occur, understand the root cause, fix the issues, and resume from the point of failure rather than restarting from the beginning.
6
-
7
- ## Prerequisites
8
-
9
- Before proceeding, fetch the workspace resource to understand the monorepo structure:
10
-
11
- **Workspace Resource**: `kodrdriv://workspace[/path/to/directory]`
12
- - Confirms this is a tree operation (`packages.length > 1`)
13
- - Provides the list of all packages in the monorepo
14
- - Shows the root directory of the monorepo
15
-
16
- **IMPORTANT**: The monorepo root directory is `/Users/tobrien/gitw/grunnverk`, NOT `/Users/tobrien/gitw/grunnverk/kodrdriv`.
17
- - `kodrdriv` is a subdirectory within the `grunnverk` monorepo
18
- - All tree commands MUST be run from the grunnverk root: `/Users/tobrien/gitw/grunnverk`
19
- - Never run tree commands from within the kodrdriv subdirectory
20
- - The `directory` parameter for all MCP tree commands should be `/Users/tobrien/gitw/grunnverk`
21
-
22
- ## Workflow Steps
23
-
24
- 1. **Initial Precommit Check**
25
- - **ALWAYS use the MCP tool**: Run `kodrdriv_tree_precommit` with `fix=true`, `parallel=true`, and `directory="/Users/tobrien/gitw/grunnverk"`
26
- - **DEFAULT: `parallel=true`** - This is the default and recommended setting. It dramatically speeds up execution for large monorepos by running independent packages concurrently (reduces time from 20-30 minutes to 5-10 minutes)
27
- - **DO NOT** fall back to manual command-line execution (`npx kodrdriv tree precommit`) unless the MCP tool is completely broken
28
- - If the MCP tool fails, investigate the error message carefully - it will tell you which package failed and why
29
- - This will execute precommit checks (linting, type checking, tests, build) across all packages, respecting dependency order even in parallel mode
30
-
31
- 2. **Handle Failures**
32
- - **If the MCP tool fails**: The error message will indicate which package failed (e.g., "Command failed in package @grunnverk/tree-execution")
33
- - **DO NOT** switch to manual command-line execution - continue using the MCP tool with `start_from` parameter
34
- - Carefully analyze the error output to understand:
35
- - Which package failed
36
- - What type of error occurred (lint error, type error, test failure, build failure)
37
- - The specific files and lines involved
38
- - Fix the issues in the failing package:
39
- - For lint errors: Fix code style issues or disable specific rules with inline comments if justified
40
- - For type errors: Fix TypeScript type issues
41
- - For test failures: Update or fix tests to match new behavior
42
- - For build failures: Fix compilation or bundling issues
43
- - For coverage drops: Add tests to maintain coverage thresholds
44
- - **Tip**: If the project uses lcov format for coverage reports and you're struggling with coverage thresholds, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`, `brennpunkt_get_file_coverage`) to identify high-priority files and understand coverage gaps. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
45
-
46
- 3. **Resume from Failure Point**
47
- - After fixing issues, use `start_from` parameter to resume from the package that failed
48
- - **DEFAULT: `parallel=true`** - Always use parallel mode when resuming (it's the default)
49
- - This avoids re-running checks on packages that already passed, saving significant time in large projects
50
- - Example: If package `@grunnverk/core` failed, run `kodrdriv_tree_precommit` with `start_from="@grunnverk/core"`, `parallel=true`, and `fix=true`
51
- - The `start_from` parameter accepts either package name (e.g., `@grunnverk/core`) or directory name (e.g., `core`)
52
-
53
- 4. **Iterate Until Success**
54
- - Repeat steps 2-3 until all packages pass precommit checks
55
- - Each iteration should resume from the last failing package
56
-
57
- 5. **Commit Changes**
58
- - Once all precommit checks pass, commit the fixes using `kodrdriv_tree_commit` with `sendit=true`
59
- - The commit message will be automatically generated from the changes
5
+ Ensure that precommit checks pass successfully across the entire monorepo tree. When failures occur, understand the root cause, fix the issues, and continue checking remaining packages rather than restarting from the beginning.
60
6
 
61
- ## Important Notes
7
+ ## CRITICAL: What to Do When This Prompt is Invoked
62
8
 
63
- - **ALWAYS use MCP tools**: Use `kodrdriv_tree_precommit`, `kodrdriv_tree_commit`, etc. - do NOT fall back to manual command-line execution
64
- - **Monorepo Root**: Always use `directory="/Users/tobrien/gitw/grunnverk"` - kodrdriv is a subdirectory, not the root
65
- - **Parallel Execution (DEFAULT)**: `parallel=true` is the default and recommended setting - it reduces execution time from 20-30 minutes to 5-10 minutes by running independent packages concurrently. Always use it unless you have a specific reason not to.
66
- - **Efficiency**: For large monorepos, always use `start_from` to resume from failures rather than restarting the entire process
67
- - **Dependency Order**: The tree commands process packages in dependency order, even in parallel mode - independent packages run concurrently while respecting dependencies
68
- - **Fix Flag**: Use `fix=true` to enable auto-fixing where possible, but manual fixes may still be required
69
- - **All Tree Commands Support `start_from`**: The `start_from` parameter works with all tree MCP commands (`kodrdriv_tree_precommit`, `kodrdriv_tree_publish`, `kodrdriv_tree_commit`, etc.)
70
- - **MCP Tool Failures**: If the MCP tool reports an error, investigate the error message - it contains the package name and failure reason. Continue using the MCP tool with `start_from` and `parallel=true` to resume from the failure point.
9
+ **IMMEDIATELY execute these steps when this prompt is invoked:**
71
10
 
72
- ## Example Flow
11
+ ### Step 1: Fetch Workspace Structure (DO THIS FIRST)
12
+
13
+ Fetch `kodrdriv://workspace{{directory}}` to get:
14
+ - The list of all packages in the monorepo
15
+ - The dependency order of packages (which packages depend on which)
16
+ - Confirmation this is a tree operation (`packages.length > 1`)
17
+
18
+ **IMPORTANT**: The `{{directory}}` parameter points to the monorepo root, not a subdirectory.
19
+
20
+ ### Step 2: Run Precommit Checks on All Packages (DO THIS IMMEDIATELY AFTER STEP 1)
21
+
22
+ **DO NOT** use `kodrdriv_tree_precommit` - it takes too long and provides little benefit.
73
23
 
24
+ **INSTEAD**: Run `kodrdriv_precommit` on individual packages in parallel:
25
+ - **Use concurrency control**: Run 3-4 packages at a time in parallel
26
+ - **Process by dependency level**: Group packages at the same dependency level and run them concurrently
27
+ - **Respect dependency order**: Don't run a package until its dependencies have passed
28
+ - **Use `fix=true`**: Enable auto-fixing where possible
29
+
30
+ **Example of what to do immediately:**
74
31
  ```
75
- 1. Fetch kodrdriv://workspace/Users/tobrien/gitw/grunnverk
76
- Confirms this is a tree with multiple packages
32
+ // After fetching workspace, if you get packages in dependency order:
33
+ // Level 0: shared-utils, core, git-tools (no dependencies)
34
+ // Level 1: commands-git, tree-core (depend on Level 0)
35
+ // etc.
77
36
 
78
- 2. kodrdriv_tree_precommit({
79
- directory: "/Users/tobrien/gitw/grunnverk",
80
- fix: true,
81
- parallel: true // DEFAULT: Use parallel mode (dramatically speeds up execution)
82
- })
83
- → Fails at package "@grunnverk/commands-git"
84
- → Error: "Command failed in package @grunnverk/commands-git"
37
+ // IMMEDIATELY run Level 0 packages in parallel (3-4 at a time):
38
+ kodrdriv_precommit({ directory: "{{directory}}/shared-utils", fix: true })
39
+ kodrdriv_precommit({ directory: "{{directory}}/core", fix: true })
40
+ kodrdriv_precommit({ directory: "{{directory}}/git-tools", fix: true })
85
41
 
86
- 3. Analyze error: TypeScript type error in src/git.ts:42
87
- → Fix the type error in the commands-git package
42
+ // Then continue with next levels...
43
+ ```
88
44
 
89
- 4. kodrdriv_tree_precommit({
90
- directory: "/Users/tobrien/gitw/grunnverk",
91
- fix: true,
92
- parallel: true, // DEFAULT: Always use parallel mode
93
- start_from: "commands-git" // or "@grunnverk/commands-git"
94
- })
95
- Continues from commands-git, may fail at next package
45
+ ### Step 3: Handle Failures and Continue
46
+
47
+ When a package's precommit fails:
48
+
49
+ 1. **Analyze the error output** to understand:
50
+ - What type of error occurred (lint error, type error, test failure, build failure)
51
+ - The specific files and lines involved
52
+
53
+ 2. **Fix the issues** in the failing package:
54
+ - For lint errors: Fix code style issues or disable specific rules with inline comments if justified
55
+ - For type errors: Fix TypeScript type issues
56
+ - For test failures: Update or fix tests to match new behavior
57
+ - For build failures: Fix compilation or bundling issues
58
+ - For coverage drops: Add tests to maintain coverage thresholds
59
+ - **Tip**: If the project uses lcov format for coverage reports and you're struggling with coverage thresholds, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`, `brennpunkt_get_file_coverage`) to identify high-priority files and understand coverage gaps. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
96
60
 
97
- 5. Repeat until all pass (always using MCP tools with parallel=true by default, never manual commands)
61
+ 3. **Re-run precommit** for that specific package:
62
+ ```
63
+ kodrdriv_precommit({ directory: "{{directory}}/failing-package", fix: true })
64
+ ```
98
65
 
99
- 6. kodrdriv_tree_commit({
100
- directory: "/Users/tobrien/gitw/grunnverk",
66
+ 4. **Continue with remaining packages** - don't restart from the beginning:
67
+ - Keep track of which packages have passed and which still need to be checked
68
+ - Continue running 3-4 packages at a time in parallel, respecting dependency order
69
+
70
+ ### Step 4: Commit When All Pass
71
+
72
+ Once all precommit checks pass, commit the fixes:
73
+ ```
74
+ kodrdriv_tree_commit({ directory: "{{directory}}", sendit: true })
75
+ ```
76
+
77
+ The commit message will be automatically generated from the changes.
78
+
79
+ ## Important Notes
80
+
81
+ - **Individual Package Precommits**: Always use `kodrdriv_precommit` on individual packages, NOT `kodrdriv_tree_precommit`
82
+ - **Concurrency Control**: Run 3-4 packages at a time in parallel to balance speed and resource usage
83
+ - **Dependency Order**: Respect package dependencies - don't run a package's precommit until its dependencies have passed
84
+ - **Monorepo Root**: Always use `directory="{{directory}}"` for tree commands
85
+ - **Fix Flag**: Use `fix=true` to enable auto-fixing where possible, but manual fixes may still be required
86
+ - **Track Progress**: Keep track of which packages have passed, failed, or are pending to avoid redundant work
87
+
88
+ ## Example Flow
89
+
90
+ ```
91
+ 1. Fetch kodrdriv://workspace{{directory}}
92
+ → Returns packages in dependency order:
93
+ - Level 0: shared-utils, core, git-tools (no dependencies)
94
+ - Level 1: commands-git, tree-core (depend on Level 0)
95
+ - Level 2: commands-tree, tree-execution (depend on Level 1)
96
+ - etc.
97
+
98
+ 2. Run Level 0 packages in parallel (3 at a time):
99
+ kodrdriv_precommit({ directory: "{{directory}}/shared-utils", fix: true })
100
+ kodrdriv_precommit({ directory: "{{directory}}/core", fix: true })
101
+ kodrdriv_precommit({ directory: "{{directory}}/git-tools", fix: true })
102
+ → All pass
103
+
104
+ 3. Run Level 1 packages in parallel (2 at a time):
105
+ kodrdriv_precommit({ directory: "{{directory}}/commands-git", fix: true })
106
+ kodrdriv_precommit({ directory: "{{directory}}/tree-core", fix: true })
107
+ → commands-git fails with TypeScript error
108
+
109
+ 4. Fix the error in commands-git, then re-run:
110
+ kodrdriv_precommit({ directory: "{{directory}}/commands-git", fix: true })
111
+ → Passes
112
+
113
+ 5. Continue with Level 2 packages in parallel:
114
+ kodrdriv_precommit({ directory: "{{directory}}/commands-tree", fix: true })
115
+ kodrdriv_precommit({ directory: "{{directory}}/tree-execution", fix: true })
116
+ → All pass
117
+
118
+ 6. Continue until all packages pass
119
+
120
+ 7. kodrdriv_tree_commit({
121
+ directory: "{{directory}}",
101
122
  sendit: true
102
123
  })
103
124
  → Commits all fixes
@@ -105,7 +126,9 @@ Before proceeding, fetch the workspace resource to understand the monorepo struc
105
126
 
106
127
  ## What NOT to Do
107
128
 
129
+ - ❌ **DO NOT** use `kodrdriv_tree_precommit` - it takes too long and provides little benefit
130
+ - ❌ **DO NOT** run all packages sequentially - use concurrency (3-4 at a time)
108
131
  - ❌ **DO NOT** run `npx kodrdriv tree precommit` manually from the command line
109
- - ❌ **DO NOT** use `/Users/tobrien/gitw/grunnverk/kodrdriv` as the directory - that's a subdirectory, not the root
110
- - ❌ **DO NOT** switch to manual execution if the MCP tool fails - investigate the error and use `start_from` to resume
111
- - ❌ **DO NOT** run commands from within the kodrdriv directory - always use the grunnverk root
132
+ - ❌ **DO NOT** use a package subdirectory as the directory - use the monorepo root from `{{directory}}`
133
+ - ❌ **DO NOT** run commands from within a package directory - always use the monorepo root
134
+ - ❌ **DO NOT** ignore dependency order - packages must be checked after their dependencies pass
@@ -13915,7 +13915,7 @@ import path2 from "path";
13915
13915
  // src/constants.ts
13916
13916
  import os from "os";
13917
13917
  import path from "path";
13918
- var VERSION = "1.5.6 (HEAD/9d2cc4b T:v1.5.6 2026-01-28 22:36:49 -0800) linux x64 v24.13.0";
13918
+ var VERSION = "1.5.10 (HEAD/7ae491d T:v1.5.10 2026-01-30 16:24:41 -0800) linux x64 v24.13.0";
13919
13919
  var PROGRAM_NAME = "kodrdriv";
13920
13920
  var DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = "YYYY-MM-DD-HHmmss.SSS";
13921
13921
  var DEFAULT_OUTPUT_DIRECTORY = "output/kodrdriv";
@@ -14867,7 +14867,7 @@ var CommandConfigSchema = external_exports.object({
14867
14867
  });
14868
14868
 
14869
14869
  // src/mcp/tools/get-config.ts
14870
- import * as Cardigantime from "@theunwalked/cardigantime";
14870
+ import * as Cardigantime from "@utilarium/cardigantime";
14871
14871
  async function executeGetConfig(args, _context) {
14872
14872
  try {
14873
14873
  const directory = args.directory || process.cwd();
@@ -15463,66 +15463,13 @@ async function executeTreePublish(args, context) {
15463
15463
  );
15464
15464
  }
15465
15465
 
15466
- // src/mcp/tools/tree-precommit.ts
15467
- import * as CommandsTree3 from "@grunnverk/commands-tree";
15468
- async function executeTreePrecommit(args, context) {
15469
- return executeCommand(
15470
- args,
15471
- context,
15472
- (config2) => CommandsTree3.tree(config2),
15473
- (config2, args2) => {
15474
- if (!config2.tree) {
15475
- config2.tree = {};
15476
- }
15477
- config2.tree.builtInCommand = "precommit";
15478
- if (args2.packages) {
15479
- config2.tree.packageArgument = args2.packages.join(",");
15480
- }
15481
- if (args2.start_from) {
15482
- config2.tree.startFrom = args2.start_from;
15483
- }
15484
- if (args2.fix) {
15485
- config2.tree.fix = true;
15486
- }
15487
- if (args2.parallel) {
15488
- config2.tree.parallel = true;
15489
- }
15490
- setupPackageFocusCallback(config2, context);
15491
- },
15492
- (result, args2, originalCwd) => {
15493
- const data = {
15494
- result,
15495
- directory: args2.directory || originalCwd
15496
- };
15497
- if (args2.packages && args2.packages.length > 0) {
15498
- data.packages = args2.packages;
15499
- }
15500
- return data;
15501
- },
15502
- async (args2, directory) => {
15503
- const discovery = await discoverTreePackages(
15504
- directory,
15505
- args2.packages,
15506
- args2.start_from
15507
- );
15508
- if (discovery) {
15509
- return {
15510
- total: discovery.total,
15511
- message: discovery.message
15512
- };
15513
- }
15514
- return null;
15515
- }
15516
- );
15517
- }
15518
-
15519
15466
  // src/mcp/tools/tree-link.ts
15520
- import * as CommandsTree4 from "@grunnverk/commands-tree";
15467
+ import * as CommandsTree3 from "@grunnverk/commands-tree";
15521
15468
  async function executeTreeLink(args, context) {
15522
15469
  return executeCommand(
15523
15470
  args,
15524
15471
  context,
15525
- (config2) => CommandsTree4.tree(config2),
15472
+ (config2) => CommandsTree3.tree(config2),
15526
15473
  (config2, args2) => {
15527
15474
  if (!config2.tree) {
15528
15475
  config2.tree = {};
@@ -15567,12 +15514,12 @@ async function executeTreeLink(args, context) {
15567
15514
  }
15568
15515
 
15569
15516
  // src/mcp/tools/tree-link-status.ts
15570
- import * as CommandsTree5 from "@grunnverk/commands-tree";
15517
+ import * as CommandsTree4 from "@grunnverk/commands-tree";
15571
15518
  async function executeTreeLinkStatus(args, context) {
15572
15519
  return executeCommand(
15573
15520
  args,
15574
15521
  context,
15575
- (config2) => CommandsTree5.tree(config2),
15522
+ (config2) => CommandsTree4.tree(config2),
15576
15523
  (config2, _args) => {
15577
15524
  if (!config2.tree) {
15578
15525
  config2.tree = {};
@@ -15588,12 +15535,12 @@ async function executeTreeLinkStatus(args, context) {
15588
15535
  }
15589
15536
 
15590
15537
  // src/mcp/tools/tree-unlink.ts
15591
- import * as CommandsTree6 from "@grunnverk/commands-tree";
15538
+ import * as CommandsTree5 from "@grunnverk/commands-tree";
15592
15539
  async function executeTreeUnlink(args, context) {
15593
15540
  return executeCommand(
15594
15541
  args,
15595
15542
  context,
15596
- (config2) => CommandsTree6.tree(config2),
15543
+ (config2) => CommandsTree5.tree(config2),
15597
15544
  (config2, args2) => {
15598
15545
  if (!config2.tree) {
15599
15546
  config2.tree = {};
@@ -15638,12 +15585,12 @@ async function executeTreeUnlink(args, context) {
15638
15585
  }
15639
15586
 
15640
15587
  // src/mcp/tools/updates.ts
15641
- import * as CommandsTree7 from "@grunnverk/commands-tree";
15588
+ import * as CommandsTree6 from "@grunnverk/commands-tree";
15642
15589
  async function executeUpdates(args, context) {
15643
15590
  return executeCommand(
15644
15591
  args,
15645
15592
  context,
15646
- (config2) => CommandsTree7.updates(config2),
15593
+ (config2) => CommandsTree6.updates(config2),
15647
15594
  (config2, args2) => {
15648
15595
  if (!config2.updates) {
15649
15596
  config2.updates = {};
@@ -15665,12 +15612,12 @@ async function executeUpdates(args, context) {
15665
15612
  }
15666
15613
 
15667
15614
  // src/mcp/tools/tree-updates.ts
15668
- import * as CommandsTree8 from "@grunnverk/commands-tree";
15615
+ import * as CommandsTree7 from "@grunnverk/commands-tree";
15669
15616
  async function executeTreeUpdates(args, context) {
15670
15617
  return executeCommand(
15671
15618
  args,
15672
15619
  context,
15673
- (config2) => CommandsTree8.updates(config2),
15620
+ (config2) => CommandsTree7.updates(config2),
15674
15621
  (config2, args2) => {
15675
15622
  if (!config2.tree) {
15676
15623
  config2.tree = {};
@@ -15714,12 +15661,12 @@ async function executeTreeUpdates(args, context) {
15714
15661
  }
15715
15662
 
15716
15663
  // src/mcp/tools/tree-pull.ts
15717
- import * as CommandsTree9 from "@grunnverk/commands-tree";
15664
+ import * as CommandsTree8 from "@grunnverk/commands-tree";
15718
15665
  async function executeTreePull(args, context) {
15719
15666
  return executeCommand(
15720
15667
  args,
15721
15668
  context,
15722
- (config2) => CommandsTree9.tree(config2),
15669
+ (config2) => CommandsTree8.tree(config2),
15723
15670
  (config2, args2) => {
15724
15671
  if (!config2.tree) {
15725
15672
  config2.tree = {};
@@ -15784,8 +15731,6 @@ async function executeTool(toolName, args, context) {
15784
15731
  return await executeTreeCommit(args, context);
15785
15732
  case "kodrdriv_tree_publish":
15786
15733
  return await executeTreePublish(args, context);
15787
- case "kodrdriv_tree_precommit":
15788
- return await executeTreePrecommit(args, context);
15789
15734
  case "kodrdriv_tree_link":
15790
15735
  return await executeTreeLink(args, context);
15791
15736
  case "kodrdriv_tree_link_status":
@@ -15860,7 +15805,7 @@ function parseKodrdrivUri(uri) {
15860
15805
 
15861
15806
  // src/mcp/resources/config.ts
15862
15807
  import { getLogger as getCoreLogger4 } from "@grunnverk/core";
15863
- import * as Cardigantime2 from "@theunwalked/cardigantime";
15808
+ import * as Cardigantime2 from "@utilarium/cardigantime";
15864
15809
  async function readConfigResource(uri) {
15865
15810
  const directory = uri.path || process.cwd();
15866
15811
  try {
@@ -20266,16 +20211,6 @@ async function main() {
20266
20211
  start_from: external_exports.string().optional()
20267
20212
  }
20268
20213
  );
20269
- registerTool(
20270
- "kodrdriv_tree_precommit",
20271
- "Run precommit checks across all packages in monorepo. Executes linting, tests, and builds in dependency order.",
20272
- {
20273
- directory: external_exports.string().optional(),
20274
- packages: external_exports.array(external_exports.string()).optional(),
20275
- fix: external_exports.boolean().optional(),
20276
- start_from: external_exports.string().optional()
20277
- }
20278
- );
20279
20214
  registerTool(
20280
20215
  "kodrdriv_tree_link",
20281
20216
  "Link local packages for development. Sets up workspace links between packages for local testing.",