release-cherry-pick 1.0.1 → 1.0.2
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/package.json +4 -1
- package/.atl/.skill-registry.cache.json +0 -3
- package/.atl/skill-registry.md +0 -55
- package/.husky/pre-commit +0 -1
- package/CLAUDE.md +0 -74
- package/eslint.config.js +0 -34
- package/openspec/changes/archive/.gitkeep +0 -0
- package/openspec/changes/node-cli-release-cherry-pick/.openspec.yaml +0 -2
- package/openspec/changes/node-cli-release-cherry-pick/design.md +0 -126
- package/openspec/changes/node-cli-release-cherry-pick/proposal.md +0 -39
- package/openspec/changes/node-cli-release-cherry-pick/specs/branch-selection/spec.md +0 -42
- package/openspec/changes/node-cli-release-cherry-pick/specs/cherry-pick-orchestration/spec.md +0 -49
- package/openspec/changes/node-cli-release-cherry-pick/specs/cli-core/spec.md +0 -37
- package/openspec/changes/node-cli-release-cherry-pick/specs/config-management/spec.md +0 -52
- package/openspec/changes/node-cli-release-cherry-pick/specs/documentation-generation/spec.md +0 -38
- package/openspec/changes/node-cli-release-cherry-pick/specs/gitlab-integration/spec.md +0 -49
- package/openspec/changes/node-cli-release-cherry-pick/specs/release-summary/spec.md +0 -37
- package/openspec/changes/node-cli-release-cherry-pick/tasks.md +0 -70
- package/openspec/config.yaml +0 -32
- package/openspec/specs/.gitkeep +0 -0
- package/scripts/sandbox/harness.js +0 -130
- package/scripts/sandbox/make-sandbox.sh +0 -90
- package/scripts/sandbox/run-config.js +0 -26
- package/scripts/sandbox/run-release.js +0 -26
- package/scripts/sandbox/test-package.js +0 -571
- package/skills-lock.json +0 -11
- package/test-e2e.js +0 -56
package/openspec/changes/node-cli-release-cherry-pick/specs/documentation-generation/spec.md
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
## Purpose
|
|
2
|
-
|
|
3
|
-
Generar documentación automática AGENTS.md y RPD.md como parte del proceso de release.
|
|
4
|
-
|
|
5
|
-
## ADDED Requirements
|
|
6
|
-
|
|
7
|
-
### Requirement: AGENTS.md generation
|
|
8
|
-
The system SHALL generate an AGENTS.md file documenting the project structure and conventions.
|
|
9
|
-
|
|
10
|
-
#### Scenario: Generate AGENTS.md
|
|
11
|
-
- **WHEN** release process completes successfully
|
|
12
|
-
- **THEN** the system SHALL create AGENTS.md with project overview, architecture, and conventions
|
|
13
|
-
|
|
14
|
-
#### Scenario: Include code conventions
|
|
15
|
-
- **WHEN** generating AGENTS.md
|
|
16
|
-
- **THEN** the system SHALL document coding standards, file structure, and naming conventions
|
|
17
|
-
|
|
18
|
-
### Requirement: RPD.md generation
|
|
19
|
-
The system SHALL generate an RPD.md (Release Process Document) file.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Generate RPD.md
|
|
22
|
-
- **WHEN** release process completes
|
|
23
|
-
- **THEN** the system SHALL create RPD.md documenting the release process, steps taken, and results
|
|
24
|
-
|
|
25
|
-
#### Scenario: Include release details
|
|
26
|
-
- **WHEN** generating RPD.md
|
|
27
|
-
- **THEN** the system SHALL include branch names, commit hashes, and MR links
|
|
28
|
-
|
|
29
|
-
### Requirement: Documentation placement
|
|
30
|
-
The system SHALL place generated documentation in the correct location.
|
|
31
|
-
|
|
32
|
-
#### Scenario: Save to project root
|
|
33
|
-
- **WHEN** generating documentation files
|
|
34
|
-
- **THEN** the system SHALL save AGENTS.md and RPD.md in the project root directory
|
|
35
|
-
|
|
36
|
-
#### Scenario: Overwrite existing files
|
|
37
|
-
- **WHEN** documentation files already exist
|
|
38
|
-
- **THEN** the system SHALL ask user whether to overwrite or skip
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
## Purpose
|
|
2
|
-
|
|
3
|
-
Integrar con la API de GitLab para crear Merge Requests automatizados con títulos y descripciones generadas.
|
|
4
|
-
|
|
5
|
-
## ADDED Requirements
|
|
6
|
-
|
|
7
|
-
### Requirement: GitLab authentication
|
|
8
|
-
The system SHALL authenticate with GitLab using personal access tokens.
|
|
9
|
-
|
|
10
|
-
#### Scenario: Validate token permissions
|
|
11
|
-
- **WHEN** user provides GitLab token
|
|
12
|
-
- **THEN** the system SHALL validate the token has required permissions (api scope)
|
|
13
|
-
|
|
14
|
-
#### Scenario: Handle authentication failure
|
|
15
|
-
- **WHEN** token is invalid or expired
|
|
16
|
-
- **THEN** the system SHALL display clear error message and prompt for new token
|
|
17
|
-
|
|
18
|
-
### Requirement: MR creation
|
|
19
|
-
The system SHALL create Merge Requests in GitLab.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Create MR with title format
|
|
22
|
-
- **WHEN** creating a Merge Request
|
|
23
|
-
- **THEN** the system SHALL use format `[TASK-ID] Description` as title
|
|
24
|
-
|
|
25
|
-
#### Scenario: Set MR source and target branches
|
|
26
|
-
- **WHEN** creating a Merge Request
|
|
27
|
-
- **THEN** the system SHALL set source branch as release branch and target as staging
|
|
28
|
-
|
|
29
|
-
#### Scenario: Add MR description
|
|
30
|
-
- **WHEN** creating a Merge Request
|
|
31
|
-
- **THEN** the system SHALL generate description from source branch commits
|
|
32
|
-
|
|
33
|
-
### Requirement: AI-powered descriptions
|
|
34
|
-
The system SHALL optionally use AI to generate MR descriptions.
|
|
35
|
-
|
|
36
|
-
#### Scenario: Generate AI description
|
|
37
|
-
- **WHEN** AI is enabled and configured
|
|
38
|
-
- **THEN** the system SHALL send commit messages to AI provider and use generated description
|
|
39
|
-
|
|
40
|
-
#### Scenario: Fallback to manual description
|
|
41
|
-
- **WHEN** AI generation fails
|
|
42
|
-
- **THEN** the system SHALL fall back to using commit messages directly
|
|
43
|
-
|
|
44
|
-
### Requirement: MR link retrieval
|
|
45
|
-
The system SHALL retrieve the created MR URL for user reference.
|
|
46
|
-
|
|
47
|
-
#### Scenario: Get MR URL
|
|
48
|
-
- **WHEN** MR is successfully created
|
|
49
|
-
- **THEN** the system SHALL return the MR URL for display in summary
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
## Purpose
|
|
2
|
-
|
|
3
|
-
Generar reportes de resumen del proceso de release con estado de cada operación y enlaces a MRs creados.
|
|
4
|
-
|
|
5
|
-
## ADDED Requirements
|
|
6
|
-
|
|
7
|
-
### Requirement: Operation summary generation
|
|
8
|
-
The system SHALL generate a comprehensive summary after completing the release process.
|
|
9
|
-
|
|
10
|
-
#### Scenario: Display release summary
|
|
11
|
-
- **WHEN** release process completes
|
|
12
|
-
- **THEN** the system SHALL display a summary table with branch name, status (PROCEDE/NO PROCEDE), and MR link
|
|
13
|
-
|
|
14
|
-
#### Scenario: Include timestamp
|
|
15
|
-
- **WHEN** generating summary
|
|
16
|
-
- **THEN** the system SHALL include the date and time of the release operation
|
|
17
|
-
|
|
18
|
-
### Requirement: MR link tracking
|
|
19
|
-
The system SHALL track and display MR links for each created Merge Request.
|
|
20
|
-
|
|
21
|
-
#### Scenario: Display MR links
|
|
22
|
-
- **WHEN** MRs are created
|
|
23
|
-
- **THEN** the system SHALL display clickable links to each MR in GitLab
|
|
24
|
-
|
|
25
|
-
### Requirement: Export summary
|
|
26
|
-
The system SHALL allow exporting the summary to a file.
|
|
27
|
-
|
|
28
|
-
#### Scenario: Export to markdown
|
|
29
|
-
- **WHEN** user requests export
|
|
30
|
-
- **THEN** the system SHALL save the summary as a markdown file in the project root
|
|
31
|
-
|
|
32
|
-
### Requirement: Conflict reporting
|
|
33
|
-
The system SHALL provide detailed information about conflicts.
|
|
34
|
-
|
|
35
|
-
#### Scenario: Report conflicting files
|
|
36
|
-
- **WHEN** cherry-pick fails due to conflicts
|
|
37
|
-
- **THEN** the system SHALL list the specific files that have conflicts
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
## 1. Project Setup
|
|
2
|
-
|
|
3
|
-
- [x] 1.1 Initialize Node.js project with `npm init` and verify package.json is created
|
|
4
|
-
- [x] 1.2 Install dependencies: commander, inquirer, simple-git, axios, chalk
|
|
5
|
-
- [x] 1.3 Create project structure: src/cli/, src/config/, src/git/, src/gitlab/, src/utils/
|
|
6
|
-
- [x] 1.4 Create entry point file `src/index.js` and verify it runs without errors
|
|
7
|
-
|
|
8
|
-
## 2. CLI Core Implementation
|
|
9
|
-
|
|
10
|
-
- [x] 2.1 Implement Commander.js setup with basic commands in `src/cli/index.js`
|
|
11
|
-
- [x] 2.2 Implement logging system with colored output in `src/utils/logger.js`
|
|
12
|
-
- [x] 2.3 Implement error handling middleware in `src/utils/errors.js`
|
|
13
|
-
- [x] 2.4 Create help command and verify `--help` displays usage information
|
|
14
|
-
|
|
15
|
-
## 3. Configuration Management
|
|
16
|
-
|
|
17
|
-
- [x] 3.1 Create configuration loader in `src/config/loader.js`
|
|
18
|
-
- [x] 3.2 Implement default configuration template
|
|
19
|
-
- [x] 3.3 Create configuration validation function
|
|
20
|
-
- [x] 3.4 Implement interactive configuration setup wizard
|
|
21
|
-
- [x] 3.5 Test configuration load/save/validate cycle
|
|
22
|
-
|
|
23
|
-
## 4. Branch Selection
|
|
24
|
-
|
|
25
|
-
- [x] 4.1 Implement branch list file parser in `src/git/branch-parser.js`
|
|
26
|
-
- [x] 4.2 Create interactive branch selection with Inquirer.js in `src/git/branch-selector.js`
|
|
27
|
-
- [x] 4.3 Implement branch search/filter functionality
|
|
28
|
-
- [x] 4.4 Add branch validation (exists, mergeable)
|
|
29
|
-
- [x] 4.5 Test branch selection with both file and interactive modes
|
|
30
|
-
|
|
31
|
-
## 5. Cherry-Pick Orchestration
|
|
32
|
-
|
|
33
|
-
- [x] 5.1 Create release branch creator in `src/git/release-branch.js`
|
|
34
|
-
- [x] 5.2 Implement cherry-pick executor in `src/git/cherry-pick.js`
|
|
35
|
-
- [x] 5.3 Add conflict detection and reporting
|
|
36
|
-
- [x] 5.4 Implement PROCEDE/NO PROCEDE status tracking
|
|
37
|
-
- [x] 5.5 Create operation summary generator
|
|
38
|
-
- [x] 5.6 Test complete cherry-pick flow with mock branches
|
|
39
|
-
|
|
40
|
-
## 6. GitLab Integration
|
|
41
|
-
|
|
42
|
-
- [x] 6.1 Create GitLab client in `src/gitlab/client.js`
|
|
43
|
-
- [x] 6.2 Implement token validation and authentication
|
|
44
|
-
- [x] 6.3 Create MR creator with title format `[TASK-ID] Description`
|
|
45
|
-
- [x] 6.4 Implement MR description generator from commits
|
|
46
|
-
- [x] 6.5 Add optional AI description generation
|
|
47
|
-
- [x] 6.6 Test GitLab API calls with mock responses
|
|
48
|
-
|
|
49
|
-
## 7. Release Summary
|
|
50
|
-
|
|
51
|
-
- [x] 7.1 Create summary generator in `src/report/summary.js`
|
|
52
|
-
- [x] 7.2 Implement summary display with table format
|
|
53
|
-
- [x] 7.3 Add MR link tracking and display
|
|
54
|
-
- [x] 7.4 Implement markdown export functionality
|
|
55
|
-
- [x] 7.5 Test summary generation with sample data
|
|
56
|
-
|
|
57
|
-
## 8. Documentation Generation
|
|
58
|
-
|
|
59
|
-
- [x] 8.1 Create AGENTS.md generator in `src/doc/agents-generator.js`
|
|
60
|
-
- [x] 8.2 Create RPD.md generator in `src/doc/rpd-generator.js`
|
|
61
|
-
- [x] 8.3 Implement file overwrite confirmation
|
|
62
|
-
- [x] 8.4 Test documentation generation in project root
|
|
63
|
-
|
|
64
|
-
## 9. Integration and Testing
|
|
65
|
-
|
|
66
|
-
- [x] 9.1 Create main orchestration flow in `src/workflow/release.js`
|
|
67
|
-
- [x] 9.2 Integrate all modules into complete release workflow
|
|
68
|
-
- [x] 9.3 Create end-to-end test with sample repository
|
|
69
|
-
- [x] 9.4 Verify all specs are implemented correctly
|
|
70
|
-
- [x] 9.5 Create README.md with usage instructions
|
package/openspec/config.yaml
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
schema: spec-driven
|
|
2
|
-
|
|
3
|
-
# Project context (optional)
|
|
4
|
-
# This is shown to AI when creating artifacts.
|
|
5
|
-
# Add your tech stack, conventions, style guides, domain knowledge, etc.
|
|
6
|
-
# Example:
|
|
7
|
-
# context: |
|
|
8
|
-
# Tech stack: TypeScript, React, Node.js
|
|
9
|
-
# We use conventional commits
|
|
10
|
-
# Domain: e-commerce platform
|
|
11
|
-
|
|
12
|
-
# Per-artifact rules (optional)
|
|
13
|
-
# Add custom rules for specific artifacts.
|
|
14
|
-
# Example:
|
|
15
|
-
# rules:
|
|
16
|
-
# proposal:
|
|
17
|
-
# - Keep proposals under 500 words
|
|
18
|
-
# - Always include a "Non-goals" section
|
|
19
|
-
# tasks:
|
|
20
|
-
# - Break tasks into chunks of max 2 hours
|
|
21
|
-
|
|
22
|
-
# Per-operation guidance (optional)
|
|
23
|
-
# Add advisory guidance for how apply and archive work should be conducted.
|
|
24
|
-
# This is separate from artifact rules above.
|
|
25
|
-
# Example:
|
|
26
|
-
# operations:
|
|
27
|
-
# apply:
|
|
28
|
-
# guidance:
|
|
29
|
-
# - Keep test summaries concise
|
|
30
|
-
# archive:
|
|
31
|
-
# guidance:
|
|
32
|
-
# - Summarize the archive outcome before finishing
|
package/openspec/specs/.gitkeep
DELETED
|
File without changes
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Shared setup for the sandbox runners: parses the common flags, chdirs into the sandbox, makes
|
|
4
|
-
// every Inquirer prompt answer itself and, with --fake-gitlab, replaces the GitLab REST API with a fake.
|
|
5
|
-
//
|
|
6
|
-
// Common flags:
|
|
7
|
-
// --work <dir> sandbox clone to run in (default: $TMPDIR/release-cherry-pick-sandbox/work)
|
|
8
|
-
// --tool <dir> tool to load instead of this checkout (e.g. an installed copy under
|
|
9
|
-
// <prefix>/node_modules/release-cherry-pick) — inquirer is resolved from it
|
|
10
|
-
// --answer name=value force the answer of the prompt named `name` (repeatable); value is parsed
|
|
11
|
-
// as JSON when possible, e.g. --answer autoCreateMR=true --answer 'x=["a"]'
|
|
12
|
-
// --fake-gitlab intercept fetch() calls to <host>/api/v4 (GET /user, project members, POST
|
|
13
|
-
// merge_requests — which prints the request body and returns a fake URL), so
|
|
14
|
-
// the real src/gitlab/client.js runs with no GitLab; sets a fake GITLAB_TOKEN
|
|
15
|
-
//
|
|
16
|
-
// Auto-answers (when not forced): list/searchable list -> its default if any, else the first choice;
|
|
17
|
-
// checkbox -> the checked choices (or all if none are checked); input -> its default; confirm ->
|
|
18
|
-
// `confirmDefault` (see setup()).
|
|
19
|
-
|
|
20
|
-
const os = require('os');
|
|
21
|
-
const path = require('path');
|
|
22
|
-
|
|
23
|
-
const TOOL_DIR = path.resolve(__dirname, '..', '..');
|
|
24
|
-
|
|
25
|
-
const FAKE_MEMBERS = [
|
|
26
|
-
{ id: 1, username: 'cheiner', name: 'Cheiner Reviewer' },
|
|
27
|
-
{ id: 2, username: 'abel', name: 'Abel Developer' },
|
|
28
|
-
{ id: 3, username: 'ariel', name: 'Ariel Developer' },
|
|
29
|
-
{ id: 4, username: 'drobinet', name: 'D. Robinet' }
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
function parseArgs(argv) {
|
|
33
|
-
const options = { workDir: path.join(os.tmpdir(), 'release-cherry-pick-sandbox', 'work'), toolDir: TOOL_DIR, answers: {}, fakeGitlab: false, rest: [] };
|
|
34
|
-
for (let i = 0; i < argv.length; i++) {
|
|
35
|
-
const arg = argv[i];
|
|
36
|
-
if (arg === '--work') options.workDir = path.resolve(argv[++i]);
|
|
37
|
-
else if (arg === '--tool') options.toolDir = path.resolve(argv[++i]);
|
|
38
|
-
else if (arg === '--fake-gitlab') options.fakeGitlab = true;
|
|
39
|
-
else if (arg === '--answer') {
|
|
40
|
-
const [name, ...value] = argv[++i].split('=');
|
|
41
|
-
const raw = value.join('=');
|
|
42
|
-
try {
|
|
43
|
-
options.answers[name] = JSON.parse(raw);
|
|
44
|
-
} catch {
|
|
45
|
-
options.answers[name] = raw;
|
|
46
|
-
}
|
|
47
|
-
} else options.rest.push(arg);
|
|
48
|
-
}
|
|
49
|
-
return options;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function installFakeGitlab() {
|
|
53
|
-
const realFetch = globalThis.fetch;
|
|
54
|
-
if (!process.env.GITLAB_TOKEN) {
|
|
55
|
-
process.env.GITLAB_TOKEN = 'fake-sandbox-token';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
globalThis.fetch = async (url, init = {}) => {
|
|
59
|
-
const { pathname } = new URL(url);
|
|
60
|
-
if (!pathname.startsWith('/api/v4/')) {
|
|
61
|
-
return realFetch(url, init);
|
|
62
|
-
}
|
|
63
|
-
const method = init.method || 'GET';
|
|
64
|
-
const json = (status, body) => new globalThis.Response(JSON.stringify(body), { status, headers: { 'Content-Type': 'application/json' } });
|
|
65
|
-
|
|
66
|
-
if (method === 'GET' && pathname === '/api/v4/user') return json(200, { id: 2, username: 'abel' });
|
|
67
|
-
if (method === 'GET' && /\/members\/all$/.test(pathname)) return json(200, FAKE_MEMBERS);
|
|
68
|
-
if (method === 'POST' && /\/merge_requests$/.test(pathname)) {
|
|
69
|
-
const body = JSON.parse(init.body);
|
|
70
|
-
console.log(` [fake-gitlab] POST ${pathname} ${JSON.stringify({ ...body, description: `(${body.description.length} chars)` })}`);
|
|
71
|
-
return json(201, { web_url: `https://gitlab.example.com/group/project/-/merge_requests/1?source=${body.source_branch}` });
|
|
72
|
-
}
|
|
73
|
-
return json(404, { message: `fake gitlab: unsupported ${method} ${pathname}` });
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function choiceValue(choice) {
|
|
78
|
-
return typeof choice === 'string' ? choice : choice.value;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function setup(argv, { confirmDefault }) {
|
|
82
|
-
const options = parseArgs(argv);
|
|
83
|
-
const toolDir = options.toolDir;
|
|
84
|
-
|
|
85
|
-
// simple-git captures the cwd when its modules load, so chdir before requiring the tool
|
|
86
|
-
process.chdir(options.workDir);
|
|
87
|
-
|
|
88
|
-
// Keep the sandbox's config inside the sandbox, never in the real ~/.release-cherry-pick
|
|
89
|
-
process.env.RELEASE_CHERRY_PICK_CONFIG_DIR = path.join(path.dirname(options.workDir), 'config');
|
|
90
|
-
|
|
91
|
-
if (options.fakeGitlab) {
|
|
92
|
-
installFakeGitlab();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Resolved through the tool dir so --tool works for an installed copy too, where inquirer is
|
|
96
|
-
// hoisted next to the package instead of living inside it.
|
|
97
|
-
const inquirer = require(require.resolve('inquirer', { paths: [toolDir] }));
|
|
98
|
-
inquirer.prompt = async (questions, previous = {}) => {
|
|
99
|
-
const answers = { ...previous };
|
|
100
|
-
for (const q of [].concat(questions)) {
|
|
101
|
-
if (typeof q.when === 'function' && !q.when(answers)) continue;
|
|
102
|
-
|
|
103
|
-
// Searchable prompts (autocomplete / checkbox-plus) provide their choices through source()
|
|
104
|
-
const choices = typeof q.source === 'function' ? await q.source(answers, '') : q.choices;
|
|
105
|
-
|
|
106
|
-
let value;
|
|
107
|
-
if (q.name in options.answers) value = options.answers[q.name];
|
|
108
|
-
else if (q.type === 'list' || q.type === 'autocomplete') {
|
|
109
|
-
const values = choices.map(choiceValue);
|
|
110
|
-
value = q.default !== undefined && values.includes(q.default) ? q.default : values[0];
|
|
111
|
-
} else if (q.type === 'checkbox' || q.type === 'checkbox-plus') {
|
|
112
|
-
const checked = choices.filter(c => c.checked);
|
|
113
|
-
value = (checked.length > 0 ? checked : choices).map(choiceValue);
|
|
114
|
-
} else if (q.type === 'confirm') value = confirmDefault === 'default' ? q.default : confirmDefault;
|
|
115
|
-
else value = q.default;
|
|
116
|
-
|
|
117
|
-
console.log(` [auto-answer] ${q.message} -> ${JSON.stringify(value)}`);
|
|
118
|
-
answers[q.name] = value;
|
|
119
|
-
}
|
|
120
|
-
return answers;
|
|
121
|
-
};
|
|
122
|
-
// src/utils/prompts.js registers custom prompt types (autocomplete, checkbox-plus); since every
|
|
123
|
-
// prompt is answered above, registering is a no-op here.
|
|
124
|
-
inquirer.registerPrompt = () => {};
|
|
125
|
-
inquirer.prompt.registerPrompt = () => {};
|
|
126
|
-
|
|
127
|
-
return { ...options, require: (relative) => require(path.join(toolDir, relative)) };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
module.exports = { setup, FAKE_MEMBERS };
|
|
@@ -1,90 +0,0 @@
|
|
|
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)"
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
});
|