release-cherry-pick 0.0.0-stage → 1.0.1
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/.atl/.skill-registry.cache.json +3 -0
- package/.atl/skill-registry.md +55 -0
- package/.husky/pre-commit +1 -0
- package/CLAUDE.md +74 -0
- package/LICENSE +21 -0
- package/README.md +181 -2
- package/eslint.config.js +34 -0
- package/openspec/changes/archive/.gitkeep +0 -0
- package/openspec/changes/node-cli-release-cherry-pick/.openspec.yaml +2 -0
- package/openspec/changes/node-cli-release-cherry-pick/design.md +126 -0
- package/openspec/changes/node-cli-release-cherry-pick/proposal.md +39 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/branch-selection/spec.md +42 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/cherry-pick-orchestration/spec.md +49 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/cli-core/spec.md +37 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/config-management/spec.md +52 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/documentation-generation/spec.md +38 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/gitlab-integration/spec.md +49 -0
- package/openspec/changes/node-cli-release-cherry-pick/specs/release-summary/spec.md +37 -0
- package/openspec/changes/node-cli-release-cherry-pick/tasks.md +70 -0
- package/openspec/config.yaml +32 -0
- package/openspec/specs/.gitkeep +0 -0
- package/package.json +48 -4
- package/scripts/sandbox/harness.js +130 -0
- package/scripts/sandbox/make-sandbox.sh +90 -0
- package/scripts/sandbox/run-config.js +26 -0
- package/scripts/sandbox/run-release.js +26 -0
- package/scripts/sandbox/test-package.js +571 -0
- package/skills-lock.json +11 -0
- package/src/cli/index.js +13 -0
- package/src/config/ai-providers.js +285 -0
- package/src/config/defaults.js +45 -0
- package/src/config/loader.js +127 -0
- package/src/config/setup.js +463 -0
- package/src/config/validator.js +80 -0
- package/src/doc/agents-generator.js +83 -0
- package/src/doc/rpd-generator.js +87 -0
- package/src/git/branch-parser.js +88 -0
- package/src/git/branch-selector.js +97 -0
- package/src/git/cherry-pick.js +216 -0
- package/src/git/git-auth.js +43 -0
- package/src/git/instance.js +17 -0
- package/src/git/release-branch.js +106 -0
- package/src/git/release-status.js +121 -0
- package/src/git/remote-url.js +34 -0
- package/src/git/repo-state.js +153 -0
- package/src/gitlab/ai-description.js +157 -0
- package/src/gitlab/client.js +324 -0
- package/src/gitlab/mr-creator.js +55 -0
- package/src/gitlab/reviewer-selector.js +52 -0
- package/src/index.js +58 -0
- package/src/report/summary.js +91 -0
- package/src/utils/errors.js +47 -0
- package/src/utils/logger.js +36 -0
- package/src/utils/prompts.js +59 -0
- package/src/utils/secrets.js +24 -0
- package/src/workflow/release.js +464 -0
- package/test-e2e.js +56 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Creates a disposable local sandbox to exercise release-cherry-pick without touching any real repo:
|
|
3
|
+
# origin.git bare repo that stands in for GitLab
|
|
4
|
+
# work/ clone where the tool is run (config has autoCreateMR: false, so no push or GitLab API calls)
|
|
5
|
+
# config/ the tool's config for the sandbox project (instead of ~/.release-cherry-pick)
|
|
6
|
+
# Usage: bash scripts/sandbox/make-sandbox.sh [sandbox-dir] (default: $TMPDIR/release-cherry-pick-sandbox)
|
|
7
|
+
set -e
|
|
8
|
+
TOOL_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
9
|
+
ROOT="${1:-${TMPDIR:-/tmp}/release-cherry-pick-sandbox}"
|
|
10
|
+
rm -rf "$ROOT" && mkdir -p "$ROOT" && ROOT="$(cd "$ROOT" && pwd)" && cd "$ROOT"
|
|
11
|
+
|
|
12
|
+
git init -q --bare -b main origin.git
|
|
13
|
+
git clone -q origin.git work 2>/dev/null
|
|
14
|
+
cd work
|
|
15
|
+
git config user.name "Sandbox"
|
|
16
|
+
git config user.email "sandbox@example.com"
|
|
17
|
+
git config core.autocrlf false
|
|
18
|
+
|
|
19
|
+
commit() { git add . && git commit -qm "$1"; }
|
|
20
|
+
|
|
21
|
+
echo "base" > app.txt && echo "a" > shared.txt
|
|
22
|
+
commit "init" && git branch -M staging && git push -q -u origin staging
|
|
23
|
+
|
|
24
|
+
# PB-100: normal case (2 tagged commits + 1 untagged one that must NOT be picked)
|
|
25
|
+
git checkout -qb feature/PB-100-list-user staging
|
|
26
|
+
echo "list user" > pb100.txt && commit "[PB-100] add list user"
|
|
27
|
+
echo "wip" > noise.txt && commit "untagged commit"
|
|
28
|
+
echo "list user v2" > pb100.txt && commit "[PB-100] fix list user"
|
|
29
|
+
git push -q -u origin feature/PB-100-list-user
|
|
30
|
+
|
|
31
|
+
# PB-I200: normal hotfix
|
|
32
|
+
git checkout -qb hotfix/PB-I200-favicon staging
|
|
33
|
+
echo "favicon" > favicon.txt && commit "[PB-I200] fix favicon"
|
|
34
|
+
git push -q -u origin hotfix/PB-I200-favicon
|
|
35
|
+
|
|
36
|
+
# PB-300: real conflict (touches shared.txt, which staging later changes differently)
|
|
37
|
+
git checkout -qb feature/PB-300-conflict staging
|
|
38
|
+
echo "b-from-feature" > shared.txt && commit "[PB-300] change shared"
|
|
39
|
+
git push -q -u origin feature/PB-300-conflict
|
|
40
|
+
|
|
41
|
+
# PB-400: already applied to staging another way (empty cherry-pick -> SKIPPED)
|
|
42
|
+
git checkout -qb feature/PB-400-already staging
|
|
43
|
+
echo "same fix" > pb400.txt && commit "[PB-400] same fix"
|
|
44
|
+
git push -q -u origin feature/PB-400-already
|
|
45
|
+
|
|
46
|
+
# PB-500: two branches with the same task ID (tool must ask which one)
|
|
47
|
+
git checkout -qb feature/PB-500-one staging
|
|
48
|
+
echo 1 > pb500.txt && commit "[PB-500] one" && git push -q -u origin feature/PB-500-one
|
|
49
|
+
git checkout -qb feature/PB-500-two staging
|
|
50
|
+
echo 2 > pb500.txt && commit "[PB-500] two" && git push -q -u origin feature/PB-500-two
|
|
51
|
+
|
|
52
|
+
# feature/refactor: no task ID in the name (tool must warn and skip it)
|
|
53
|
+
git checkout -qb feature/refactor staging
|
|
54
|
+
echo "refactor" > refactor.txt && commit "refactor something"
|
|
55
|
+
git push -q -u origin feature/refactor
|
|
56
|
+
|
|
57
|
+
# staging moves on: conflicts with PB-300 and already contains PB-400's change
|
|
58
|
+
git checkout -q staging
|
|
59
|
+
echo "b-from-staging" > shared.txt && echo "same fix" > pb400.txt
|
|
60
|
+
commit "staging moves on" && git push -q origin staging
|
|
61
|
+
|
|
62
|
+
# The tool keeps its config outside the project (see src/config/loader.js); the sandbox's copy goes
|
|
63
|
+
# in $ROOT/config instead of the real ~/.release-cherry-pick. Written through saveConfig so the file
|
|
64
|
+
# gets the same per-project name the tool computes.
|
|
65
|
+
CONFIG_JSON='{
|
|
66
|
+
"git": { "stagingBranch": "staging", "branchPrefix": { "feature": "feature/", "hotfix": "hotfix/", "release": "release/" } },
|
|
67
|
+
"gitlab": { "host": "" },
|
|
68
|
+
"ai": { "enabled": false, "provider": "", "apiKey": "", "model": "", "baseURL": "" },
|
|
69
|
+
"release": { "autoCreateMR": false, "mrTitleFormat": "[{taskId}] {description}", "defaultReviewers": [], "defaultAssignees": [], "mrSquash": true, "mrRemoveSourceBranch": true }
|
|
70
|
+
}'
|
|
71
|
+
node -e "
|
|
72
|
+
process.env.RELEASE_CHERRY_PICK_CONFIG_DIR = process.argv[2];
|
|
73
|
+
const loader = require(process.argv[1] + '/src/config/loader');
|
|
74
|
+
loader.saveConfig(JSON.parse(process.argv[3]));
|
|
75
|
+
console.log('Sandbox config: ' + loader.getConfigPath());
|
|
76
|
+
" "$TOOL_DIR" "$ROOT/config" "$CONFIG_JSON"
|
|
77
|
+
|
|
78
|
+
# Branch list file for the -f/--file input path
|
|
79
|
+
cat > tasks.txt <<'EOF'
|
|
80
|
+
*PB-100*: Listar usuarios
|
|
81
|
+
*PB-I200*: Favicon incorrecto
|
|
82
|
+
*PB-300*: Cambio con conflicto
|
|
83
|
+
*PB-400*: Fix ya aplicado
|
|
84
|
+
*PB-500*: Dos ramas con el mismo ID
|
|
85
|
+
EOF
|
|
86
|
+
|
|
87
|
+
# Keep the untracked sandbox files out of git status
|
|
88
|
+
printf 'tasks.txt\nrelease-summary.md\nAGENTS.md\nRPD.md\n' >> .git/info/exclude
|
|
89
|
+
|
|
90
|
+
echo "Sandbox ready: $(pwd)"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Runs the setup wizard (config --init) against the sandbox, answering every prompt with its
|
|
4
|
+
// default unless forced with --answer. See harness.js for common flags.
|
|
5
|
+
// Usage:
|
|
6
|
+
// node scripts/sandbox/run-config.js --fake-gitlab --answer autoCreateMR=true
|
|
7
|
+
// node scripts/sandbox/run-config.js --answer autoCreateMR=true (no GitLab token -> manual usernames)
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const { setup } = require('./harness');
|
|
11
|
+
|
|
12
|
+
const harness = setup(process.argv.slice(2), { confirmDefault: 'default' });
|
|
13
|
+
|
|
14
|
+
harness.require('src/config/setup')
|
|
15
|
+
.setupWizard()
|
|
16
|
+
.then((config) => {
|
|
17
|
+
if (config) {
|
|
18
|
+
const configPath = harness.require('src/config/loader').getConfigPath();
|
|
19
|
+
console.log(`\n--- saved ${configPath} ---`);
|
|
20
|
+
console.log(fs.readFileSync(configPath, 'utf8'));
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
console.error(error);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Runs runRelease() against the sandbox created by make-sandbox.sh, answering every prompt itself
|
|
4
|
+
// (confirms default to "no", so no report/docs files are written). See harness.js for common flags.
|
|
5
|
+
// Usage:
|
|
6
|
+
// node scripts/sandbox/run-release.js -b "PB-100,hotfix/PB-I200-favicon" [--work <dir>] [--fake-gitlab]
|
|
7
|
+
// node scripts/sandbox/run-release.js -f tasks.txt
|
|
8
|
+
// node scripts/sandbox/run-release.js (interactive branch selection path)
|
|
9
|
+
|
|
10
|
+
const { setup } = require('./harness');
|
|
11
|
+
|
|
12
|
+
const harness = setup(process.argv.slice(2), { confirmDefault: false });
|
|
13
|
+
|
|
14
|
+
const options = {};
|
|
15
|
+
for (let i = 0; i < harness.rest.length; i++) {
|
|
16
|
+
const arg = harness.rest[i];
|
|
17
|
+
if (arg === '-b' || arg === '--branches') options.branches = harness.rest[++i];
|
|
18
|
+
else if (arg === '-f' || arg === '--file') options.file = harness.rest[++i];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
harness.require('src/workflow/release')
|
|
22
|
+
.runRelease(options)
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
console.error(error);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|