@eldrforge/kodrdriv 1.2.21 → 1.2.23
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/WORKFLOW-PRECHECK-IMPLEMENTATION.md +239 -0
- package/WORKFLOW-SKIP-SUMMARY.md +121 -0
- package/dist/arguments.js +2 -2
- package/dist/arguments.js.map +1 -1
- package/dist/commands/audio-commit.js +15 -6
- package/dist/commands/audio-commit.js.map +1 -1
- package/dist/commands/audio-review.js +31 -15
- package/dist/commands/audio-review.js.map +1 -1
- package/dist/commands/commit.js +30 -19
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/link.js +27 -27
- package/dist/commands/link.js.map +1 -1
- package/dist/commands/publish.js +74 -21
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.js +30 -17
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/review.js +33 -26
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/select-audio.js +4 -4
- package/dist/commands/select-audio.js.map +1 -1
- package/dist/commands/tree.js +122 -35
- package/dist/commands/tree.js.map +1 -1
- package/dist/commands/unlink.js +13 -13
- package/dist/commands/unlink.js.map +1 -1
- package/dist/commands/updates.js +21 -0
- package/dist/commands/updates.js.map +1 -1
- package/dist/commands/versions.js +5 -5
- package/dist/commands/versions.js.map +1 -1
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/content/files.js +4 -4
- package/dist/content/files.js.map +1 -1
- package/dist/logging.js +3 -3
- package/dist/logging.js.map +1 -1
- package/dist/util/aiAdapter.js +28 -0
- package/dist/util/aiAdapter.js.map +1 -0
- package/dist/util/general.js +5 -5
- package/dist/util/general.js.map +1 -1
- package/dist/util/interactive.js +6 -437
- package/dist/util/interactive.js.map +1 -1
- package/dist/util/loggerAdapter.js +24 -0
- package/dist/util/loggerAdapter.js.map +1 -0
- package/dist/util/performance.js +4 -4
- package/dist/util/performance.js.map +1 -1
- package/dist/util/safety.js +4 -4
- package/dist/util/safety.js.map +1 -1
- package/dist/util/storage.js +2 -2
- package/dist/util/storage.js.map +1 -1
- package/dist/util/storageAdapter.js +25 -0
- package/dist/util/storageAdapter.js.map +1 -0
- package/package.json +7 -6
- package/GITHUB-TOOLS-INTEGRATION.md +0 -323
- package/INTEGRATION-SUMMARY.md +0 -232
- package/TEST-STATUS.md +0 -168
- package/dist/prompt/commit.js +0 -76
- package/dist/prompt/commit.js.map +0 -1
- package/dist/prompt/instructions/commit.md +0 -133
- package/dist/prompt/instructions/release.md +0 -188
- package/dist/prompt/instructions/review.md +0 -169
- package/dist/prompt/personas/releaser.md +0 -24
- package/dist/prompt/personas/you.md +0 -55
- package/dist/prompt/release.js +0 -100
- package/dist/prompt/release.js.map +0 -1
- package/dist/prompt/review.js +0 -64
- package/dist/prompt/review.js.map +0 -1
- package/dist/util/openai.js +0 -365
- package/dist/util/openai.js.map +0 -1
package/dist/commands/publish.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'path';
|
|
2
2
|
import { execute as execute$1 } from './commit.js';
|
|
3
3
|
import { hasStagedChanges } from '../content/diff.js';
|
|
4
4
|
import { execute as execute$2 } from './release.js';
|
|
@@ -8,11 +8,11 @@ import * as GitHub from '@eldrforge/github-tools';
|
|
|
8
8
|
import { create } from '../util/storage.js';
|
|
9
9
|
import { calculateBranchDependentVersion, calculateTargetVersion, checkIfTagExists, confirmVersionInteractively, getOutputPath } from '../util/general.js';
|
|
10
10
|
import { DEFAULT_OUTPUT_DIRECTORY, KODRDRIV_DEFAULTS } from '../constants.js';
|
|
11
|
-
import
|
|
11
|
+
import fs from 'fs/promises';
|
|
12
12
|
|
|
13
13
|
const scanNpmrcForEnvVars = async (storage)=>{
|
|
14
14
|
const logger = getLogger();
|
|
15
|
-
const npmrcPath =
|
|
15
|
+
const npmrcPath = path.join(process.cwd(), '.npmrc');
|
|
16
16
|
const envVars = [];
|
|
17
17
|
if (await storage.exists(npmrcPath)) {
|
|
18
18
|
try {
|
|
@@ -42,18 +42,18 @@ const scanNpmrcForEnvVars = async (storage)=>{
|
|
|
42
42
|
* and cleans them up if found by removing package-lock.json and regenerating it.
|
|
43
43
|
*/ const cleanupNpmLinkReferences = async (isDryRun)=>{
|
|
44
44
|
const logger = getDryRunLogger(isDryRun);
|
|
45
|
-
const packageLockPath =
|
|
45
|
+
const packageLockPath = path.join(process.cwd(), 'package-lock.json');
|
|
46
46
|
try {
|
|
47
47
|
// Check if package-lock.json exists
|
|
48
48
|
try {
|
|
49
|
-
await
|
|
49
|
+
await fs.access(packageLockPath);
|
|
50
50
|
} catch {
|
|
51
51
|
// No package-lock.json, nothing to clean
|
|
52
52
|
logger.verbose('No package-lock.json found, skipping npm link cleanup');
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
// Read and parse package-lock.json
|
|
56
|
-
const packageLockContent = await
|
|
56
|
+
const packageLockContent = await fs.readFile(packageLockPath, 'utf-8');
|
|
57
57
|
const packageLock = safeJsonParse(packageLockContent, packageLockPath);
|
|
58
58
|
// Check for file: dependencies in the lockfile
|
|
59
59
|
let hasFileReferences = false;
|
|
@@ -91,7 +91,7 @@ const scanNpmrcForEnvVars = async (storage)=>{
|
|
|
91
91
|
logger.info('DRY RUN: Would remove package-lock.json and regenerate it');
|
|
92
92
|
} else {
|
|
93
93
|
// Remove package-lock.json
|
|
94
|
-
await
|
|
94
|
+
await fs.unlink(packageLockPath);
|
|
95
95
|
logger.verbose('Removed package-lock.json with npm link references');
|
|
96
96
|
// Regenerate clean package-lock.json
|
|
97
97
|
logger.verbose('Regenerating package-lock.json from package.json...');
|
|
@@ -210,9 +210,35 @@ const runPrechecks = async (runConfig, targetBranch)=>{
|
|
|
210
210
|
logger.info(`ℹ️ Target branch '${effectiveTargetBranch}' does not exist locally - will be created when needed.`);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
// Check GitHub Actions workflow configuration
|
|
214
|
+
logger.info('Checking GitHub Actions workflow configuration...');
|
|
215
|
+
if (isDryRun) {
|
|
216
|
+
logger.info('Would check if GitHub Actions workflows are configured for pull requests');
|
|
217
|
+
} else {
|
|
218
|
+
try {
|
|
219
|
+
// TODO: Re-enable when checkWorkflowConfiguration is exported from github-tools
|
|
220
|
+
// const workflowConfig = await GitHub.checkWorkflowConfiguration(effectiveTargetBranch);
|
|
221
|
+
const workflowConfig = {
|
|
222
|
+
hasWorkflows: true,
|
|
223
|
+
hasPullRequestTriggers: true,
|
|
224
|
+
workflowCount: 0,
|
|
225
|
+
triggeredWorkflowNames: []
|
|
226
|
+
};
|
|
227
|
+
if (!workflowConfig.hasWorkflows) ; else if (!workflowConfig.hasPullRequestTriggers) ; else {
|
|
228
|
+
logger.info(`✅ Found ${workflowConfig.triggeredWorkflowNames.length} workflow(s) that will run on PRs to ${effectiveTargetBranch}:`);
|
|
229
|
+
for (const workflowName of workflowConfig.triggeredWorkflowNames){
|
|
230
|
+
logger.info(` - ${workflowName}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
} catch (error) {
|
|
234
|
+
// Don't fail the precheck if we can't verify workflows
|
|
235
|
+
// The wait logic will handle it later
|
|
236
|
+
logger.debug(`Could not verify workflow configuration: ${error.message}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
213
239
|
// Check if prepublishOnly script exists in package.json
|
|
214
240
|
logger.info('Checking for prepublishOnly script...');
|
|
215
|
-
const packageJsonPath =
|
|
241
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
216
242
|
if (!await storage.exists(packageJsonPath)) {
|
|
217
243
|
if (!isDryRun) {
|
|
218
244
|
throw new Error('package.json not found in current directory.');
|
|
@@ -536,7 +562,10 @@ const execute = async (runConfig)=>{
|
|
|
536
562
|
await runWithDryRunSupport('npm run prepublishOnly', isDryRun, {}, true); // Use inherited stdio
|
|
537
563
|
// STEP 2: Commit dependency updates if any (still no version bump)
|
|
538
564
|
logger.verbose('Staging dependency updates for commit');
|
|
539
|
-
|
|
565
|
+
// Check if package-lock.json exists before trying to stage it
|
|
566
|
+
const packageLockExists = await storage.exists('package-lock.json');
|
|
567
|
+
const filesToStage = packageLockExists ? 'package.json package-lock.json' : 'package.json';
|
|
568
|
+
await runWithDryRunSupport(`git add ${filesToStage}`, isDryRun);
|
|
540
569
|
logger.verbose('Checking for staged dependency updates...');
|
|
541
570
|
if (isDryRun) {
|
|
542
571
|
logger.verbose('Would create dependency update commit if changes are staged');
|
|
@@ -637,7 +666,10 @@ const execute = async (runConfig)=>{
|
|
|
637
666
|
const { stdout: mergeChangesStatus } = await run('git status --porcelain');
|
|
638
667
|
if (mergeChangesStatus.trim()) {
|
|
639
668
|
logger.verbose('Staging post-merge changes for commit');
|
|
640
|
-
|
|
669
|
+
// Check if package-lock.json exists before trying to stage it
|
|
670
|
+
const packageLockExistsPostMerge = await storage.exists('package-lock.json');
|
|
671
|
+
const filesToStagePostMerge = packageLockExistsPostMerge ? 'package.json package-lock.json' : 'package.json';
|
|
672
|
+
await run(`git add ${filesToStagePostMerge}`);
|
|
641
673
|
if (await hasStagedChanges()) {
|
|
642
674
|
logger.verbose('Committing post-merge changes...');
|
|
643
675
|
await execute$1(runConfig);
|
|
@@ -704,7 +736,10 @@ const execute = async (runConfig)=>{
|
|
|
704
736
|
}
|
|
705
737
|
// STEP 5: Commit version bump as a separate commit
|
|
706
738
|
logger.verbose('Staging version bump for commit');
|
|
707
|
-
|
|
739
|
+
// Check if package-lock.json exists before trying to stage it
|
|
740
|
+
const packageLockExistsVersionBump = await storage.exists('package-lock.json');
|
|
741
|
+
const filesToStageVersionBump = packageLockExistsVersionBump ? 'package.json package-lock.json' : 'package.json';
|
|
742
|
+
await runWithDryRunSupport(`git add ${filesToStageVersionBump}`, isDryRun);
|
|
708
743
|
if (isDryRun) {
|
|
709
744
|
logger.verbose('Would create version bump commit');
|
|
710
745
|
} else {
|
|
@@ -779,16 +814,34 @@ const execute = async (runConfig)=>{
|
|
|
779
814
|
}
|
|
780
815
|
logger.info(`Waiting for PR #${pr.number} checks to complete...`);
|
|
781
816
|
if (!isDryRun) {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
817
|
+
// Check if we already know from prechecks that no workflows will trigger
|
|
818
|
+
let shouldSkipWait = false;
|
|
819
|
+
try {
|
|
820
|
+
// TODO: Re-enable when checkWorkflowConfiguration is exported from github-tools
|
|
821
|
+
// const workflowConfig = await GitHub.checkWorkflowConfiguration(targetBranch);
|
|
822
|
+
const workflowConfig = {
|
|
823
|
+
hasWorkflows: true,
|
|
824
|
+
hasPullRequestTriggers: true,
|
|
825
|
+
workflowCount: 0,
|
|
826
|
+
triggeredWorkflowNames: []
|
|
827
|
+
};
|
|
828
|
+
if (!workflowConfig.hasWorkflows || !workflowConfig.hasPullRequestTriggers) ;
|
|
829
|
+
} catch (error) {
|
|
830
|
+
// If we can't verify, proceed with waiting to be safe
|
|
831
|
+
logger.debug(`Could not verify workflow configuration for wait skip: ${error.message}`);
|
|
832
|
+
}
|
|
833
|
+
if (!shouldSkipWait) {
|
|
834
|
+
var _runConfig_publish15, _runConfig_publish16, _runConfig_publish17;
|
|
835
|
+
// Configure timeout and user confirmation behavior
|
|
836
|
+
const timeout = ((_runConfig_publish15 = runConfig.publish) === null || _runConfig_publish15 === void 0 ? void 0 : _runConfig_publish15.checksTimeout) || KODRDRIV_DEFAULTS.publish.checksTimeout;
|
|
837
|
+
const senditMode = ((_runConfig_publish16 = runConfig.publish) === null || _runConfig_publish16 === void 0 ? void 0 : _runConfig_publish16.sendit) || false;
|
|
838
|
+
// sendit flag overrides skipUserConfirmation - if sendit is true, skip confirmation
|
|
839
|
+
const skipUserConfirmation = senditMode || ((_runConfig_publish17 = runConfig.publish) === null || _runConfig_publish17 === void 0 ? void 0 : _runConfig_publish17.skipUserConfirmation) || false;
|
|
840
|
+
await GitHub.waitForPullRequestChecks(pr.number, {
|
|
841
|
+
timeout,
|
|
842
|
+
skipUserConfirmation
|
|
843
|
+
});
|
|
844
|
+
}
|
|
792
845
|
}
|
|
793
846
|
const mergeMethod = ((_runConfig_publish2 = runConfig.publish) === null || _runConfig_publish2 === void 0 ? void 0 : _runConfig_publish2.mergeMethod) || 'squash';
|
|
794
847
|
if (isDryRun) {
|