@idea1/cli 1.8.2 → 1.8.3
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 +92 -18
- package/dist/commands/approve-pr.js +5 -5
- package/dist/commands/approve-pr.js.map +1 -1
- package/dist/commands/attach-project-item.d.ts.map +1 -1
- package/dist/commands/attach-project-item.js +27 -7
- package/dist/commands/attach-project-item.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +8 -6
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +3 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/integrate.d.ts +13 -0
- package/dist/commands/integrate.d.ts.map +1 -0
- package/dist/commands/integrate.js +128 -0
- package/dist/commands/integrate.js.map +1 -0
- package/dist/commands/ready-for-approval.js +1 -1
- package/dist/commands/ready-for-approval.js.map +1 -1
- package/dist/commands/release.d.ts +4 -0
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +105 -20
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/ship-local-changes.d.ts +8 -0
- package/dist/commands/ship-local-changes.d.ts.map +1 -0
- package/dist/commands/ship-local-changes.js +33 -0
- package/dist/commands/ship-local-changes.js.map +1 -0
- package/dist/commands/start-project-item.d.ts +27 -0
- package/dist/commands/start-project-item.d.ts.map +1 -0
- package/dist/commands/start-project-item.js +325 -0
- package/dist/commands/start-project-item.js.map +1 -0
- package/dist/commands/start.d.ts +6 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +53 -18
- package/dist/commands/start.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/lib/claude-options.d.ts +3 -2
- package/dist/lib/claude-options.d.ts.map +1 -1
- package/dist/lib/claude-options.js +15 -4
- package/dist/lib/claude-options.js.map +1 -1
- package/dist/lib/settings.d.ts +13 -3
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/settings.js +12 -3
- package/dist/lib/settings.js.map +1 -1
- package/dist/services/git.d.ts +34 -13
- package/dist/services/git.d.ts.map +1 -1
- package/dist/services/git.js +75 -39
- package/dist/services/git.js.map +1 -1
- package/dist/services/github.d.ts +15 -0
- package/dist/services/github.d.ts.map +1 -1
- package/dist/services/github.js +47 -0
- package/dist/services/github.js.map +1 -1
- package/dist/services/setup.d.ts.map +1 -1
- package/dist/services/setup.js +18 -24
- package/dist/services/setup.js.map +1 -1
- package/dist/services/workflow.d.ts +17 -0
- package/dist/services/workflow.d.ts.map +1 -0
- package/dist/services/workflow.js +39 -0
- package/dist/services/workflow.js.map +1 -0
- package/dist/types/index.d.ts +18 -24
- package/dist/types/index.d.ts.map +1 -1
- package/dist/version.d.ts +2 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +3 -2
- package/dist/version.js.map +1 -1
- package/dist/workflow/engine/approval-flow.d.ts +8 -1
- package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
- package/dist/workflow/engine/approval-flow.js +23 -8
- package/dist/workflow/engine/approval-flow.js.map +1 -1
- package/dist/workflow/engine/handlers/agent-implementation.js +1 -1
- package/dist/workflow/engine/handlers/agent-implementation.js.map +1 -1
- package/dist/workflow/engine/handlers/approve-pr.d.ts.map +1 -1
- package/dist/workflow/engine/handlers/approve-pr.js +9 -3
- package/dist/workflow/engine/handlers/approve-pr.js.map +1 -1
- package/dist/workflow/engine/handlers/ready-for-approval.d.ts +5 -0
- package/dist/workflow/engine/handlers/ready-for-approval.d.ts.map +1 -1
- package/dist/workflow/engine/handlers/ready-for-approval.js +11 -7
- package/dist/workflow/engine/handlers/ready-for-approval.js.map +1 -1
- package/dist/workflow/engine/{release-flow.d.ts → release-engine.d.ts} +77 -6
- package/dist/workflow/engine/release-engine.d.ts.map +1 -0
- package/dist/workflow/engine/{release-flow.js → release-engine.js} +279 -17
- package/dist/workflow/engine/release-engine.js.map +1 -0
- package/dist/workflow/engine/ship-flow.d.ts +87 -0
- package/dist/workflow/engine/ship-flow.d.ts.map +1 -0
- package/dist/workflow/engine/ship-flow.js +227 -0
- package/dist/workflow/engine/ship-flow.js.map +1 -0
- package/dist/workflow/engine/workflow-engine.d.ts +18 -2
- package/dist/workflow/engine/workflow-engine.d.ts.map +1 -1
- package/dist/workflow/engine/workflow-engine.js +58 -19
- package/dist/workflow/engine/workflow-engine.js.map +1 -1
- package/package.json +2 -2
- package/dist/workflow/engine/release-flow.d.ts.map +0 -1
- package/dist/workflow/engine/release-flow.js.map +0 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { logger } from '../lib/logger.js';
|
|
2
|
+
import { promptInput, promptSelect } from '../lib/prompt.js';
|
|
3
|
+
import { resolveNamedList } from '../cli/named-lists.js';
|
|
4
|
+
import * as git from '../services/git.js';
|
|
5
|
+
import * as github from '../services/github.js';
|
|
6
|
+
import * as worktree from '../services/worktree.js';
|
|
7
|
+
import { INTEGRATION_KIND, PR_MODE_OPTION, createGatedPr, runPrMode, validateSourceBranch } from '../services/release-flow.js';
|
|
8
|
+
/**
|
|
9
|
+
* The integration branch to integrate: the one given, else the current branch when it is one,
|
|
10
|
+
* else a pick from the integration branches on origin.
|
|
11
|
+
*/
|
|
12
|
+
async function resolveIntegrationBranch(cliBranch) {
|
|
13
|
+
const integrationBranches = await worktree.listExistingIntegrationBranches();
|
|
14
|
+
if (cliBranch) {
|
|
15
|
+
if (!integrationBranches.includes(cliBranch)) {
|
|
16
|
+
throw new Error(`'${cliBranch}' is not an integration branch on origin.` +
|
|
17
|
+
(integrationBranches.length > 0 ? `\nIntegration branches: ${integrationBranches.join(', ')}` : ''));
|
|
18
|
+
}
|
|
19
|
+
return cliBranch;
|
|
20
|
+
}
|
|
21
|
+
const currentBranch = await git.getCurrentBranch();
|
|
22
|
+
if (integrationBranches.includes(currentBranch)) {
|
|
23
|
+
return currentBranch;
|
|
24
|
+
}
|
|
25
|
+
if (integrationBranches.length === 0) {
|
|
26
|
+
throw new Error('No integration branches exist on origin.');
|
|
27
|
+
}
|
|
28
|
+
return promptSelect('Which integration branch?', integrationBranches.map(branch => ({ label: branch, value: branch })));
|
|
29
|
+
}
|
|
30
|
+
async function promptAssignee() {
|
|
31
|
+
return promptSelect('Who approves this integration by merging its PR? (the approver of record)', await resolveNamedList('github-members'));
|
|
32
|
+
}
|
|
33
|
+
async function promptPrTitle(integrationBranch) {
|
|
34
|
+
const integrationName = await worktree.extractIntegrationName(integrationBranch);
|
|
35
|
+
const defaultTitle = `Integration ${integrationName} ${new Date().toISOString().split('T')[0]}`;
|
|
36
|
+
return promptInput('Enter PR title:', { default: defaultTitle });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Stage 1 of change management for an integration branch (change-management-policy.md clause 2):
|
|
40
|
+
* the work items merged into `working/integration/<name>-main` were each approved there by their
|
|
41
|
+
* assignee; this command carries the integration branch into the release branch through its own
|
|
42
|
+
* PR, assigned to its approver. The assignee approves by merging it - after the required CI/CD
|
|
43
|
+
* checks pass - with the same sequence and the same recorded admin override as `idea1 release`.
|
|
44
|
+
*
|
|
45
|
+
* Creating the PR and merging it are usually done by different people at different times, so
|
|
46
|
+
* the command reuses an open PR when one exists and the assignee runs it in `merge` mode.
|
|
47
|
+
*/
|
|
48
|
+
export const integrateCommand = {
|
|
49
|
+
name: 'integrate',
|
|
50
|
+
aliases: ['int'],
|
|
51
|
+
description: 'Open the PR from an integration branch into the release branch, assigned to its approver, and (as the assignee) merge it once the checks pass',
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
longName: 'branch',
|
|
55
|
+
shortName: 'b',
|
|
56
|
+
description: 'Integration branch to integrate (default: the current branch, or a pick from origin)',
|
|
57
|
+
defaultValue: '',
|
|
58
|
+
promptWhenDefaultExists: false
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
longName: 'target',
|
|
62
|
+
shortName: 't',
|
|
63
|
+
description: 'Branch to integrate into (default: baseBranch)',
|
|
64
|
+
defaultValue: '',
|
|
65
|
+
promptWhenDefaultExists: false
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
longName: 'assignee',
|
|
69
|
+
shortName: 'a',
|
|
70
|
+
description: 'Who approves the integration by merging its PR - the approver of record (prompted when the PR is created)',
|
|
71
|
+
defaultValue: '',
|
|
72
|
+
promptWhenDefaultExists: false
|
|
73
|
+
},
|
|
74
|
+
PR_MODE_OPTION,
|
|
75
|
+
{
|
|
76
|
+
longName: 'title',
|
|
77
|
+
description: 'PR title',
|
|
78
|
+
defaultValue: '',
|
|
79
|
+
promptWhenDefaultExists: false
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
async execute(resolved) {
|
|
83
|
+
const branchArg = resolved['branch'] || undefined;
|
|
84
|
+
const targetArg = resolved['target'] || undefined;
|
|
85
|
+
const assigneeArg = resolved['assignee'] || undefined;
|
|
86
|
+
const prMode = resolved['pr-mode'];
|
|
87
|
+
const titleArg = resolved['title'] || undefined;
|
|
88
|
+
await github.ensureGitHubCli();
|
|
89
|
+
const integrationBranch = await resolveIntegrationBranch(branchArg);
|
|
90
|
+
const targetBranch = targetArg ?? await worktree.resolveBaseBranch();
|
|
91
|
+
logger.header(`Integration: ${integrationBranch} -> ${targetBranch}`);
|
|
92
|
+
logger.newline();
|
|
93
|
+
logger.info(`PR mode: ${prMode}`);
|
|
94
|
+
logger.newline();
|
|
95
|
+
const existingPr = await github.checkPrExists(integrationBranch, targetBranch);
|
|
96
|
+
let prUrl;
|
|
97
|
+
if (existingPr) {
|
|
98
|
+
logger.info(`Using the open PR #${existingPr.number}`);
|
|
99
|
+
prUrl = existingPr.url;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
await validateSourceBranch(integrationBranch);
|
|
103
|
+
const assignee = assigneeArg ?? await promptAssignee();
|
|
104
|
+
const prTitle = titleArg ?? await promptPrTitle(integrationBranch);
|
|
105
|
+
logger.info(`Using title: ${prTitle}`);
|
|
106
|
+
logger.newline();
|
|
107
|
+
prUrl = await createGatedPr({
|
|
108
|
+
sourceBranch: integrationBranch,
|
|
109
|
+
targetBranch,
|
|
110
|
+
title: prTitle,
|
|
111
|
+
assignee,
|
|
112
|
+
kind: INTEGRATION_KIND
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
logger.newline();
|
|
116
|
+
await runPrMode({
|
|
117
|
+
mode: prMode,
|
|
118
|
+
sourceBranch: integrationBranch,
|
|
119
|
+
targetBranch,
|
|
120
|
+
prUrl,
|
|
121
|
+
kind: INTEGRATION_KIND,
|
|
122
|
+
openActionsAfterMerge: false
|
|
123
|
+
});
|
|
124
|
+
logger.newline();
|
|
125
|
+
logger.hint(`PR: ${prUrl}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=integrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrate.js","sourceRoot":"","sources":["../../src/commands/integrate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,SAAS,EACT,oBAAoB,EAErB,MAAM,6BAA6B,CAAC;AAErC;;;GAGG;AACH,KAAK,UAAU,wBAAwB,CAAC,SAAkB;IACxD,MAAM,mBAAmB,GAAG,MAAM,QAAQ,CAAC,+BAA+B,EAAE,CAAC;IAE7E,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7C,MAAM,IAA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CAAC"}
|
|
@@ -6,7 +6,7 @@ import * as git from '../services/git.js';
|
|
|
6
6
|
import * as github from '../services/github.js';
|
|
7
7
|
import * as worktree from '../services/worktree.js';
|
|
8
8
|
import { ensurePrReadyForApproval } from '../workflow/engine/approval-flow.js';
|
|
9
|
-
import { validateSourceBranch } from '../workflow/engine/release-
|
|
9
|
+
import { validateSourceBranch } from '../workflow/engine/release-engine.js';
|
|
10
10
|
import { advanceAsNeededTo, resolveTransitionIfManaged } from '../workflow/engine/workflow-engine.js';
|
|
11
11
|
import { deferredHandlerOptions } from '../workflow/engine/handlers/index.js';
|
|
12
12
|
import { readyForApprovalHandler } from '../workflow/engine/handlers/ready-for-approval.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ready-for-approval.js","sourceRoot":"","sources":["../../src/commands/ready-for-approval.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,E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ED,KAAK,CAAC,OAAO,CAAC,QAAgC;QAC5C,MAAM,UAAU,GAAG,MAAM,0BAA0B,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC3E,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,iBAAiB,CAAC,UAAU,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAC;YAC5E,OAAO;QACT,CAAC;QAED,MAAM,kCAAkC,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;CACF,CAAC"}
|
|
@@ -5,6 +5,10 @@ import type { Command } from '../types/index.js';
|
|
|
5
5
|
* releaser and the approver, and their merge is the recorded approval. No review is required:
|
|
6
6
|
* every change in the release was already approved on its own PR, and the body lists them. What
|
|
7
7
|
* this stage gates is the build - the required CI/CD checks must pass before the merge.
|
|
8
|
+
*
|
|
9
|
+
* Before the PR is opened, the packages that changed since the last release get their version
|
|
10
|
+
* bumps, committed and pushed to the release branch by this command. `--approve` instead approves
|
|
11
|
+
* and merges the release PR that is already open.
|
|
8
12
|
*/
|
|
9
13
|
export declare const releaseCommand: Command;
|
|
10
14
|
//# sourceMappingURL=release.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAkJjD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,OAgG5B,CAAC"}
|
package/dist/commands/release.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { logger } from '../lib/logger.js';
|
|
2
|
-
import { readBranchSettings } from '../lib/settings.js';
|
|
3
|
-
import { promptInput } from '../lib/prompt.js';
|
|
4
|
-
import { runHook } from '../services/hooks.js';
|
|
2
|
+
import { readBranchSettings, readReleaseSettings } from '../lib/settings.js';
|
|
3
|
+
import { promptInput, promptSelect } from '../lib/prompt.js';
|
|
5
4
|
import * as git from '../services/git.js';
|
|
6
5
|
import * as github from '../services/github.js';
|
|
7
|
-
import { PR_MODE_OPTION, RELEASE_KIND, createGatedPr, runPrMode, validateSourceBranch } from '../workflow/engine/release-
|
|
6
|
+
import { PR_MODE_OPTION, RELEASE_KIND, VERSION_BUMP_TYPES, approveRelease, commitVersionBumps, createGatedPr, detectPendingVersionBumps, runPrMode, validateSourceBranch } from '../workflow/engine/release-engine.js';
|
|
8
7
|
/**
|
|
9
8
|
* Resolve the release branch (source branch)
|
|
10
9
|
*/
|
|
@@ -12,7 +11,7 @@ async function resolveReleaseBranch(cliBranch) {
|
|
|
12
11
|
if (cliBranch) {
|
|
13
12
|
return cliBranch;
|
|
14
13
|
}
|
|
15
|
-
return (await readBranchSettings(await git.getRepoRoot())).
|
|
14
|
+
return (await readBranchSettings(await git.getRepoRoot())).baseBranch;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* Resolve the target branch
|
|
@@ -31,30 +30,96 @@ async function promptPrTitle() {
|
|
|
31
30
|
return promptInput('Enter PR title:', { default: defaultTitle });
|
|
32
31
|
}
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* run the release is gated on, already include whatever it committed.
|
|
33
|
+
* Why a `--bumps` value is malformed, or undefined when it is well formed: comma-separated
|
|
34
|
+
* `<package>=<patch|minor|major>` entries, e.g. `filekit=minor,cli=patch`.
|
|
37
35
|
*/
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
function bumpsOptionError(value) {
|
|
37
|
+
for (const entry of value.split(',').map(part => part.trim()).filter(part => part.length > 0)) {
|
|
38
|
+
const [name, type, ...rest] = entry.split('=').map(part => part.trim());
|
|
39
|
+
if (!name || rest.length > 0 || !VERSION_BUMP_TYPES.includes(type)) {
|
|
40
|
+
return `"${entry}" is not <package>=<${VERSION_BUMP_TYPES.join('|')}> (e.g. filekit=minor,cli=patch)`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The bump types a well-formed `--bumps` value names, by package name. */
|
|
46
|
+
function parseBumpsOption(value) {
|
|
47
|
+
return new Map(value.split(',')
|
|
48
|
+
.map(part => part.trim())
|
|
49
|
+
.filter(part => part.length > 0)
|
|
50
|
+
.map(entry => {
|
|
51
|
+
const [name, type] = entry.split('=').map(part => part.trim());
|
|
52
|
+
return [name, type];
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Bump the versions of the packages that changed since the last release, before the PR is opened,
|
|
57
|
+
* so the PR's head - and the one CI/CD run the release is gated on - already carries them. The
|
|
58
|
+
* bump is made here, in the local checkout: the packages' `package.json` and lockfiles are edited,
|
|
59
|
+
* committed and pushed to the release branch. Nothing is asked, and nothing is committed, when no
|
|
60
|
+
* versioned package needs a bump or the repository declares none. A bump is never made onto an
|
|
61
|
+
* open release PR, which may already be approved.
|
|
62
|
+
*/
|
|
63
|
+
async function bumpPendingVersions(sourceBranch, targetBranch, requestedBumps) {
|
|
40
64
|
const repoRoot = await git.getRepoRoot();
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
65
|
+
const settings = await readReleaseSettings(repoRoot);
|
|
66
|
+
if (settings.versionedPackages.length === 0) {
|
|
67
|
+
if (requestedBumps.size > 0) {
|
|
68
|
+
throw new Error('--bumps was given, but this repository declares no release.versionedPackages in .idea1/settings.json.');
|
|
69
|
+
}
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const knownNames = settings.versionedPackages.map(pkg => pkg.name);
|
|
73
|
+
const unknownNames = [...requestedBumps.keys()].filter(name => !knownNames.includes(name));
|
|
74
|
+
if (unknownNames.length > 0) {
|
|
75
|
+
throw new Error(`--bumps names unknown package(s): ${unknownNames.join(', ')}. ` +
|
|
76
|
+
`The versioned packages are: ${knownNames.join(', ')}.`);
|
|
77
|
+
}
|
|
78
|
+
if (await github.checkPrExists(sourceBranch, targetBranch)) {
|
|
79
|
+
logger.dim('A release PR is already open, so no version bump is made onto it');
|
|
80
|
+
logger.newline();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
logger.step('Checking which versioned packages changed since the last release...');
|
|
84
|
+
const pending = await detectPendingVersionBumps(settings.versionedPackages, sourceBranch, targetBranch);
|
|
85
|
+
if (pending.length === 0) {
|
|
86
|
+
logger.success('No versioned package needs a version bump');
|
|
87
|
+
logger.newline();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const bumps = {};
|
|
91
|
+
for (const pkg of pending) {
|
|
92
|
+
bumps[pkg.name] = requestedBumps.get(pkg.name) ?? await promptBumpType(pkg);
|
|
93
|
+
}
|
|
94
|
+
for (const name of requestedBumps.keys()) {
|
|
95
|
+
if (!(name in bumps)) {
|
|
96
|
+
logger.dim(`${name} is unchanged or already bumped for this release - ignoring its --bumps entry`);
|
|
97
|
+
}
|
|
44
98
|
}
|
|
45
99
|
logger.newline();
|
|
100
|
+
await commitVersionBumps({ releaseBranch: sourceBranch, pending, bumps });
|
|
101
|
+
logger.newline();
|
|
102
|
+
}
|
|
103
|
+
async function promptBumpType(pkg) {
|
|
104
|
+
return await promptSelect(`The ${pkg.label} (${pkg.currentVersion}) changed since the last release - version bump:`, VERSION_BUMP_TYPES.map(type => ({ label: type, value: type })), { default: 'patch' });
|
|
46
105
|
}
|
|
106
|
+
const isApprove = (resolved) => resolved['approve'] === 'true';
|
|
47
107
|
/**
|
|
48
108
|
* Stage 2 of change management (change-management-policy.md clause 2): the release PR from the
|
|
49
109
|
* release branch into main. It is assigned to the person who runs the command - they are the
|
|
50
110
|
* releaser and the approver, and their merge is the recorded approval. No review is required:
|
|
51
111
|
* every change in the release was already approved on its own PR, and the body lists them. What
|
|
52
112
|
* this stage gates is the build - the required CI/CD checks must pass before the merge.
|
|
113
|
+
*
|
|
114
|
+
* Before the PR is opened, the packages that changed since the last release get their version
|
|
115
|
+
* bumps, committed and pushed to the release branch by this command. `--approve` instead approves
|
|
116
|
+
* and merges the release PR that is already open.
|
|
53
117
|
*/
|
|
54
118
|
export const releaseCommand = {
|
|
55
119
|
name: 'release',
|
|
56
120
|
aliases: ['r', 'rel'],
|
|
57
|
-
description: '
|
|
121
|
+
description: 'Bump the versions of changed packages, open the release PR from the release branch into main assigned to you, ' +
|
|
122
|
+
'and merge it once the checks pass (--approve merges the open release PR)',
|
|
58
123
|
options: [
|
|
59
124
|
{
|
|
60
125
|
longName: 'branch',
|
|
@@ -70,26 +135,46 @@ export const releaseCommand = {
|
|
|
70
135
|
defaultValue: '',
|
|
71
136
|
promptWhenDefaultExists: false
|
|
72
137
|
},
|
|
73
|
-
|
|
138
|
+
{
|
|
139
|
+
longName: 'approve',
|
|
140
|
+
description: 'Approve and merge the open release PR instead of opening one',
|
|
141
|
+
isFlag: true
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
longName: 'bumps',
|
|
145
|
+
description: 'Version bump per changed package, e.g. filekit=minor,cli=patch (changed packages not named are prompted)',
|
|
146
|
+
defaultValue: '',
|
|
147
|
+
promptWhenDefaultExists: false,
|
|
148
|
+
validate: bumpsOptionError,
|
|
149
|
+
dependsOn: resolved => !isApprove(resolved)
|
|
150
|
+
},
|
|
151
|
+
{ ...PR_MODE_OPTION, dependsOn: resolved => !isApprove(resolved) },
|
|
74
152
|
{
|
|
75
153
|
longName: 'title',
|
|
76
154
|
description: 'PR title',
|
|
77
155
|
defaultValue: '',
|
|
78
|
-
promptWhenDefaultExists: false
|
|
156
|
+
promptWhenDefaultExists: false,
|
|
157
|
+
dependsOn: resolved => !isApprove(resolved)
|
|
79
158
|
}
|
|
80
159
|
],
|
|
81
160
|
async execute(resolved) {
|
|
82
161
|
const branchArg = resolved['branch'] || undefined;
|
|
83
162
|
const targetArg = resolved['target'] || undefined;
|
|
84
|
-
const prMode = resolved['pr-mode'];
|
|
85
|
-
const titleArg = resolved['title'] || undefined;
|
|
86
163
|
const sourceBranch = await resolveReleaseBranch(branchArg);
|
|
87
164
|
const targetBranch = await resolveTargetBranch(targetArg);
|
|
165
|
+
await github.ensureGitHubCli();
|
|
166
|
+
if (isApprove(resolved)) {
|
|
167
|
+
logger.header(`Approve release: ${sourceBranch} -> ${targetBranch}`);
|
|
168
|
+
logger.newline();
|
|
169
|
+
await approveRelease(sourceBranch, targetBranch);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const prMode = resolved['pr-mode'];
|
|
173
|
+
const titleArg = resolved['title'] || undefined;
|
|
88
174
|
logger.header(`Release: ${sourceBranch} -> ${targetBranch}`);
|
|
89
175
|
logger.newline();
|
|
90
|
-
await github.ensureGitHubCli();
|
|
91
176
|
await validateSourceBranch(sourceBranch);
|
|
92
|
-
await
|
|
177
|
+
await bumpPendingVersions(sourceBranch, targetBranch, parseBumpsOption(resolved['bumps']));
|
|
93
178
|
const prTitle = titleArg ?? await promptPrTitle();
|
|
94
179
|
logger.info(`Using title: ${prTitle}`);
|
|
95
180
|
logger.info(`PR mode: ${prMode}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/commands/release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,GAAG,MAAM,oBAAo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,EAAE,CAAC,CAAC;IAC9B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* `start --carry-local-changes --approve-and-merge` with nothing asked beyond what a new item
|
|
4
|
+
* needs (its title and Project): the uncommitted changes of the base branch checkout become a
|
|
5
|
+
* project item's branch and PR, which merges into the base branch once the required checks pass.
|
|
6
|
+
*/
|
|
7
|
+
export declare const shipLocalChangesCommand: Command;
|
|
8
|
+
//# sourceMappingURL=ship-local-changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-local-changes.d.ts","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAWjD;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAuBrC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isolationModeOption } from '../lib/isolation.js';
|
|
2
|
+
import { branchCreationOptions } from '../workflow/engine/branch-setup.js';
|
|
3
|
+
import { approveAndMergeOption, carryLocalChangesOption, commitMessageOption, unpromptedReviewersOption } from '../workflow/engine/ship-flow.js';
|
|
4
|
+
import { projectItemTargetOptions, startProjectItem } from './start.js';
|
|
5
|
+
/**
|
|
6
|
+
* `start --carry-local-changes --approve-and-merge` with nothing asked beyond what a new item
|
|
7
|
+
* needs (its title and Project): the uncommitted changes of the base branch checkout become a
|
|
8
|
+
* project item's branch and PR, which merges into the base branch once the required checks pass.
|
|
9
|
+
*/
|
|
10
|
+
export const shipLocalChangesCommand = {
|
|
11
|
+
name: 'ship-local-changes',
|
|
12
|
+
aliases: ['ship'],
|
|
13
|
+
description: 'Ship the uncommitted changes of your base branch checkout: create a project item and its branch, commit and push the changes there, and advance it through approval, merging its PR once the checks pass',
|
|
14
|
+
options: [
|
|
15
|
+
...projectItemTargetOptions.map(option => option.longName === 'url'
|
|
16
|
+
? { ...option, description: 'Project item URL (default: create a new item)', promptWhenDefaultExists: false }
|
|
17
|
+
: option),
|
|
18
|
+
...branchCreationOptions
|
|
19
|
+
.filter(option => option.longName !== 'workflow-type')
|
|
20
|
+
.map(option => ({ ...option, defaultValue: '', promptWhenDefaultExists: false })),
|
|
21
|
+
commitMessageOption,
|
|
22
|
+
{ ...isolationModeOption, description: 'Where to work on the branch while it is shipped', defaultValue: 'worktree', promptWhenDefaultExists: false },
|
|
23
|
+
unpromptedReviewersOption
|
|
24
|
+
],
|
|
25
|
+
async execute(resolved) {
|
|
26
|
+
await startProjectItem({
|
|
27
|
+
...resolved,
|
|
28
|
+
[carryLocalChangesOption.longName]: 'true',
|
|
29
|
+
[approveAndMergeOption.longName]: 'true'
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ship-local-changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship-local-changes.js","sourceRoot":"","sources":["../../src/commands/ship-local-changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAY;IAC9C,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,WAAW,EAAE,0MAA0M;IACvN,OAAO,EAAE;QACP,GAAG,wBAAwB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,KAAK;YACjE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,+CAA+C,EAAE,uBAAuB,EAAE,KAAK,EAAE;YAC7G,CAAC,CAAC,MAAM,CAAC;QACX,GAAG,qBAAqB;aACrB,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,eAAe,CAAC;aACrD,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,CAAC;QACnF,mBAAmB;QACnB,EAAE,GAAG,mBAAmB,EAAE,WAAW,EAAE,iDAAiD,EAAE,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAE,KAAK,EAAE;QACpJ,yBAAyB;KAC1B;IAED,KAAK,CAAC,OAAO,CAAC,QAAgC;QAC5C,MAAM,gBAAgB,CAAC;YACrB,GAAG,QAAQ;YACX,CAAC,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM;YAC1C,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM;SACzC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Command, ClaudePermissionMode, ClaudeEffortLevel } from '../types/index.js';
|
|
2
|
+
export declare const VALID_PERMISSION_MODES: ClaudePermissionMode[];
|
|
3
|
+
export declare const VALID_EFFORT_LEVELS: ClaudeEffortLevel[];
|
|
4
|
+
export declare const WORKFLOW_CHOICES: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
export interface IntegrationBranchSelection {
|
|
9
|
+
integrationName: string;
|
|
10
|
+
integrationBranchName: string;
|
|
11
|
+
isNew: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Prompt the user whether to stack this branch on another and resolve the
|
|
15
|
+
* chosen stack branch. Prompt-only: performs no branch writes. Returns the
|
|
16
|
+
* resolved stack branch name, or null when the user opts not to stack.
|
|
17
|
+
* Shared by start-project-item and attach-project-item.
|
|
18
|
+
*/
|
|
19
|
+
export declare function promptForStackBranch(): Promise<string | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Prompt the user for integration-branch selection. Prompt-only: does not
|
|
22
|
+
* perform any branch writes. Must be invoked before setWorkflowStatus so the
|
|
23
|
+
* user completes all setup questions up front.
|
|
24
|
+
*/
|
|
25
|
+
export declare function promptForIntegrationBranch(): Promise<IntegrationBranchSelection>;
|
|
26
|
+
export declare const startProjectItemCommand: Command;
|
|
27
|
+
//# sourceMappingURL=start-project-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-project-item.d.ts","sourceRoot":"","sources":["../../src/commands/start-project-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,oBAAoB,EAAwB,iBAAiB,EAAkC,MAAM,mBAAmB,CAAC;AAUhJ,eAAO,MAAM,sBAAsB,EAAE,oBAAoB,EAAmF,CAAC;AAE7I,eAAO,MAAM,mBAAmB,EAAE,iBAAiB,EAA8C,CAAC;AAQlG,eAAO,MAAM,gBAAgB;;;GAG5B,CAAC;AAkBF,MAAM,WAAW,0BAA0B;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6BnE;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAoBtF;AAED,eAAO,MAAM,uBAAuB,EAAE,OAqLrC,CAAC"}
|