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.
Files changed (57) hide show
  1. package/.atl/.skill-registry.cache.json +3 -0
  2. package/.atl/skill-registry.md +55 -0
  3. package/.husky/pre-commit +1 -0
  4. package/CLAUDE.md +74 -0
  5. package/LICENSE +21 -0
  6. package/README.md +181 -2
  7. package/eslint.config.js +34 -0
  8. package/openspec/changes/archive/.gitkeep +0 -0
  9. package/openspec/changes/node-cli-release-cherry-pick/.openspec.yaml +2 -0
  10. package/openspec/changes/node-cli-release-cherry-pick/design.md +126 -0
  11. package/openspec/changes/node-cli-release-cherry-pick/proposal.md +39 -0
  12. package/openspec/changes/node-cli-release-cherry-pick/specs/branch-selection/spec.md +42 -0
  13. package/openspec/changes/node-cli-release-cherry-pick/specs/cherry-pick-orchestration/spec.md +49 -0
  14. package/openspec/changes/node-cli-release-cherry-pick/specs/cli-core/spec.md +37 -0
  15. package/openspec/changes/node-cli-release-cherry-pick/specs/config-management/spec.md +52 -0
  16. package/openspec/changes/node-cli-release-cherry-pick/specs/documentation-generation/spec.md +38 -0
  17. package/openspec/changes/node-cli-release-cherry-pick/specs/gitlab-integration/spec.md +49 -0
  18. package/openspec/changes/node-cli-release-cherry-pick/specs/release-summary/spec.md +37 -0
  19. package/openspec/changes/node-cli-release-cherry-pick/tasks.md +70 -0
  20. package/openspec/config.yaml +32 -0
  21. package/openspec/specs/.gitkeep +0 -0
  22. package/package.json +48 -4
  23. package/scripts/sandbox/harness.js +130 -0
  24. package/scripts/sandbox/make-sandbox.sh +90 -0
  25. package/scripts/sandbox/run-config.js +26 -0
  26. package/scripts/sandbox/run-release.js +26 -0
  27. package/scripts/sandbox/test-package.js +571 -0
  28. package/skills-lock.json +11 -0
  29. package/src/cli/index.js +13 -0
  30. package/src/config/ai-providers.js +285 -0
  31. package/src/config/defaults.js +45 -0
  32. package/src/config/loader.js +127 -0
  33. package/src/config/setup.js +463 -0
  34. package/src/config/validator.js +80 -0
  35. package/src/doc/agents-generator.js +83 -0
  36. package/src/doc/rpd-generator.js +87 -0
  37. package/src/git/branch-parser.js +88 -0
  38. package/src/git/branch-selector.js +97 -0
  39. package/src/git/cherry-pick.js +216 -0
  40. package/src/git/git-auth.js +43 -0
  41. package/src/git/instance.js +17 -0
  42. package/src/git/release-branch.js +106 -0
  43. package/src/git/release-status.js +121 -0
  44. package/src/git/remote-url.js +34 -0
  45. package/src/git/repo-state.js +153 -0
  46. package/src/gitlab/ai-description.js +157 -0
  47. package/src/gitlab/client.js +324 -0
  48. package/src/gitlab/mr-creator.js +55 -0
  49. package/src/gitlab/reviewer-selector.js +52 -0
  50. package/src/index.js +58 -0
  51. package/src/report/summary.js +91 -0
  52. package/src/utils/errors.js +47 -0
  53. package/src/utils/logger.js +36 -0
  54. package/src/utils/prompts.js +59 -0
  55. package/src/utils/secrets.js +24 -0
  56. package/src/workflow/release.js +464 -0
  57. package/test-e2e.js +56 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ "fingerprint": "da1ade5fa2f10330e151b385fee005cbc1139f40"
3
+ }
@@ -0,0 +1,55 @@
1
+ # Skill Registry — release-cherry-pick
2
+
3
+ <!-- Auto-generated by gentle-ai skill-registry refresh. Run `gentle-ai skill-registry refresh --force` to regenerate. -->
4
+
5
+ Last updated: 2026-10-27
6
+
7
+ ## Sources scanned
8
+
9
+ - /home/diovi/.agents/skills
10
+ - /home/diovi/.config/opencode/skills
11
+ - /home/diovi/.claude/skills
12
+
13
+ ## Contract
14
+
15
+ **Delegator use only.** This registry is an index, not a summary. Any agent that launches subagents reads it to select relevant skills, then passes exact `SKILL.md` paths for the subagent to read before work.
16
+
17
+ `SKILL.md` remains the source of truth. Do not inject generated summaries or compact rules by default; pass paths so subagents load the full runtime contract and preserve author intent.
18
+
19
+ ## Skills
20
+
21
+ | Skill | Trigger / description | Scope | Path |
22
+ | --- | --- | --- | --- |
23
+ | `adr` | Ingenius Software's Architecture Decision Record (ADR) format -- 22 fields covering context, decision, alternatives, consequences, and impact on principles/security/cost, with usage guidance for the fields that need it. Use when asked to record, write, or draft an ADR, when a significant architectural decision needs to be documented, or when reviewing whether an existing ADR is complete. Does not cover which architectural principle a decision affects (see architectural-principles, cited from this template's "Impact on principles" field) or whether the decision needs Architecture Review Board approval (see operating-model). arc42-template's own "Architectural decisions" section only lists and links ADRs; it doesn't define their format -- this plugin does. | user | `/home/diovi/.claude/skills/adr/SKILL.md` |
24
+ | `agentic-delivery` | Ingenius methodology for governing delivery work that AI agents (e.g. Claude Code) execute and people approve -- "the agent proposes, arbiters dispose". Use for process questions about working with agents, not for doing the work -- setting a project up for AI-agent delivery (milestone zero), how much autonomy or how many retries an agent gets, what counts as an arbiter or as evidence agent work is done (golden vs. live-fire), phase gates F0-F7, the 7-stage unit loop, agent-per-role with a human approver, parallel agent sessions in batches/waves, logbooks and RESUME HERE, facts sheet, process audits. Not for ordinary tasks an agent performs (coding, adding endpoints, refactoring, writing tests, generating a backlog). Does not cover delivery steps per modality (delivery-playbook), roles/ARB (operating-model), DoD criteria (definition-of-done), adr, arc42-template, security-policy, responsible-ai, architectural-principles, per-modality-checklist, skill-authoring, or producing artifacts (sdlc-skills). | user | `/home/diovi/.claude/skills/agentic-delivery/SKILL.md` |
25
+ | `agentic-migration` | Úsalo al construir o migrar un sistema software con agentes de IA cuando quieras acotar su autonomía con verificación determinista: árbitros que el agente NO escribió (compilador, linter, pruebas con umbral de cobertura, build de producción, e2e, análisis estático) deciden cada cambio. Método reproducible de 7 etapas (analizar, orquestar, traducir, generar, aislar, verificar, registrar), agnóstico de stack: sirve para frontend, backend, sistemas completos o greenfield. Lee el fichero de references/ correspondiente al entrar en cada etapa. | user | `/home/diovi/.claude/skills/agentic-migration/SKILL.md` |
26
+ | `arc42-template` | Ingenius Software's adapted arc42 template for documenting a real project's architecture — 12 sections (full version) or a 7-section reduced version for small/on-demand work. Use when asked to create, start, or maintain the architecture documentation for an Ingenius project, when asked "what should our arc42 doc cover", or when reviewing whether a project's existing architecture documentation is complete. Does not cover which architectural principle applies to a decision (see architectural-principles), who should review or approve it (see operating-model), or the format of an individual decision record (see adr; this template's own "Architectural decisions" section only lists them). | user | `/home/diovi/.claude/skills/arc42-template/SKILL.md` |
27
+ | `architectural-principles` | Ingenius Software's foundational, technology-agnostic architecture principles — the 16 architectural principles (P01-P16), the 4-tier governance model (Principles/Policies/Standards/Guides), and generic coding principles (DRY/KISS/SOLID/YAGNI/Clean Code). Use when citing which Ingenius principle a decision affects or violates, when an ADR or design discussion needs to reference "P0X", when asked "what's Ingenius's architectural philosophy/stance on X" (e.g. monoliths vs. microservices, security by design, reuse), or when reviewing whether a project or plugin aligns with these principles. Does not cover technology-specific coding standards (those live in each technology-specific marketplace, e.g. ingenius-dotnet-skills for .NET), the real technology radar/asset catalog (see tech-radar-catalog), or process/roles (see operating-model). | user | `/home/diovi/.claude/skills/architectural-principles/SKILL.md` |
28
+ | `chained-pr` | Trigger: PRs over 400 lines, stacked PRs, review slices. Split oversized changes into chained PRs that protect review focus. | user | `/home/diovi/.agents/skills/chained-pr/SKILL.md` |
29
+ | `clean-architecture-conformance` | Audits an ASP.NET Core project that follows Clean Architecture — either as a Modular Monolith by Bounded Context (generated by clean-architecture-scaffold/clean-architecture-feature or equivalent) or as classic flat layered Clean Architecture (one Domain/Application/Infrastructure/Api project per solution, no Bounded Contexts) — against the Dependency Rule, module isolation (when applicable), and SOLID/Clean Code violations specific to this architecture. Use when asked to "audit the architecture", "check that the Dependency Rule wasn't broken", "verify module isolation", "does this code respect Clean Architecture?", before a pre-production review, or periodically as architectural health check. Do NOT use for a general code quality review (bugs, style, simplification) unrelated to the layered architecture — use /code-review or /simplify for that. Do NOT use to create a project (clean-architecture-scaffold) or to add a feature (clean-architecture-feature). Reports findings by default; fixes nothing unless the user explicitly asks. | user | `/home/diovi/.config/opencode/skills/clean-architecture-conformance/SKILL.md` |
30
+ | `clean-architecture-feature` | Adds a new use case, entity, or complete feature to an ASP.NET Core project that already follows Clean Architecture as a Modular Monolith by Bounded Context (generated by clean-architecture-scaffold or equivalent). Use when asked to "add a use case", "I need a new entity", "add an endpoint for X", "add a new module" on a project that ALREADY EXISTS. Reads the project's real code (SharedKernel, an already-existing aggregate) to replicate its exact convention — it does not impose its own template nor assume the project uses a third-party MediatR/Result if the real project uses something different. Can create a new Bounded Context (module) if the feature's target doesn't exist yet. DO NOT use to create a project from scratch (use clean-architecture-scaffold), nor to audit conformance of existing code against layer rules (use clean-architecture-conformance), nor on a project that doesn't follow this architecture (layered Clean Architecture with Result pattern) — there is no real convention to read and replicate there. | user | `/home/diovi/.config/opencode/skills/clean-architecture-feature/SKILL.md` |
31
+ | `clean-architecture-scaffold` | Creates a new ASP.NET Core Web API project applying Clean Architecture as a Modular Monolith (Bounded Contexts as internal modules, each with Domain/Application/Infrastructure) from scratch, following Ingenius Software's coding and architecture standards. Use when asked to "create a new project", "build a Web API with Clean Architecture", "scaffold a .NET solution" or equivalent, and the project does not exist yet. Requires the Bounded Contexts to already be identified/designed beforehand (this skill does not perform DDD discovery). Generates simple use cases without MediatR, a custom Result pattern for business errors, EF Core (PostgreSQL or SQL Server, by choice), and test projects with xUnit+NSubstitute+Testcontainers. Do NOT use it to add a use case to a project that already has this structure (use clean-architecture-feature), to audit existing code (use clean-architecture-conformance), for a generic layerless Web API (use dotnet-aspnetcore:dotnet-webapi), or for a microservices-oriented system (out of scope — see the scope note). | user | `/home/diovi/.config/opencode/skills/clean-architecture-scaffold/SKILL.md` |
32
+ | `cognitive-doc-design` | Design docs that reduce cognitive load. Trigger: writing guides, READMEs, RFCs, onboarding, architecture, or review-facing docs. | user | `/home/diovi/.agents/skills/cognitive-doc-design/SKILL.md` |
33
+ | `definition-of-done` | Ingenius Software's technical and architectural Definition of Done (DoD) across 6 levels -- story/task, Pull Request, component/API, release, project closure, and AI -- each with a full narrative criteria list and a condensed, trackable operational checklist (priority, mandatory, risk if not met). Also covers per-modality adaptation, exception management (including who can accept which risk level), a RACI matrix, and tracking metrics. Use when asked whether something is "done," what DoD criteria apply to a story/PR/release/project, how to handle a DoD exception, or who can accept a given risk. Does not cover the per-engagement-modality architecture checklist (a different granularity -- see per-modality-checklist), the full AI design/risk-classification guide (see responsible-ai; this plugin's AI level only lists DoD criteria), which principle a decision affects (architectural-principles), or the ADR/arc42 formats themselves (adr, arc42-template). | user | `/home/diovi/.claude/skills/definition-of-done/SKILL.md` |
34
+ | `delivery-playbook` | Ingenius Software's delivery process by engagement modality -- staffing, closed/fixed-price project, and on-demand development -- each as a short sequence of process steps, plus the minimum deliverables expected per modality. Use when asked what the delivery process looks like for a staffing engagement, a closed project, or on-demand work, or what deliverables a modality requires at minimum. Does not cover the architecture checklist per modality (see per-modality-checklist -- a different tool: checklist controls, not process steps), Definition of Done criteria (see definition-of-done), or roles and escalation (see operating-model). | user | `/home/diovi/.claude/skills/delivery-playbook/SKILL.md` |
35
+ | `find-skills` | Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill. | user | `/home/diovi/.agents/skills/find-skills/SKILL.md` |
36
+ | `go-testing` | Trigger: Go tests, go test coverage, Bubbletea teatest, golden files. Apply focused Go testing patterns. | user | `/home/diovi/.agents/skills/go-testing/SKILL.md` |
37
+ | `judgment-day` | Trigger: judgment day, dual review, adversarial review, juzgar. Run explicit blind dual review with at most two scoped fix/re-judgment rounds. | user | `/home/diovi/.agents/skills/judgment-day/SKILL.md` |
38
+ | `operating-model` | Ingenius Software's operating model for architecture governance — roles and responsibilities, the lightweight Architecture Review Board (ARB), the architectural decision flow, escalation criteria, and governance metrics. Use when asked who should be involved in a decision, whether something needs to go to the ARB, when to escalate an architectural decision, what Ingenius's Architecture Review Board looks like, who is responsible for a given governance activity, or how often architecture reviews happen. Complements architectural-principles: that plugin states what the principles are, this one states who applies them, when, and how formally. Does not cover the principles themselves (see architectural-principles) or any artifact's format (ADR, arc42, Definition of Done — separate plugins). | user | `/home/diovi/.claude/skills/operating-model/SKILL.md` |
39
+ | `per-modality-checklist` | Ingenius Software's architecture checklist scaled by engagement modality (closed/fixed-price project, staffing, on-demand work) plus a cross-cutting responsible-AI checklist that applies whenever AI is involved, regardless of modality. Use when asked to set up or verify the architecture checklist for a project given its engagement type, what's required for a closed project vs. staffing vs. on-demand work, or what responsible-AI controls apply to a delivery. Does not cover per-level Definition of Done criteria (story/task, PR, component, release, project closure — see definition-of-done for that different granularity), which principle a decision affects (architectural-principles), or who should review it (operating-model). | user | `/home/diovi/.claude/skills/per-modality-checklist/SKILL.md` |
40
+ | `responsible-ai` | Ingenius Software's guide for designing, building, and operating AI solutions responsibly — the 7 responsible-AI principles, the 4-level risk classification for AI use cases, the AI design checklist, specific controls for generative AI/RAG (data leakage, prompt injection, hallucinations, cost, provider dependency), and the minimum evidence per AI project. Use when classifying an AI use case's risk level, designing a new AI/GenAI/RAG feature, asking what controls apply to a given AI risk, or reviewing an AI project's evidence. Does not replace the shorter responsible-AI verification checklist in per-modality-checklist (a quick pre-delivery gate, one control among several) -- this plugin is the fuller guide behind it, for actually designing and classifying the solution, not just checking it off before shipping. | user | `/home/diovi/.claude/skills/responsible-ai/SKILL.md` |
41
+ | `security-policy` | Ingenius Software's minimum security controls for software development -- identity/access, secrets, data, APIs, dependencies, logging, CI/CD, and AI -- plus a pre-production security checklist. Use when asked what Ingenius's minimum secure-coding controls are, whether something is safe to ship from a security standpoint, or what the pre-production security checklist covers. Does not cover the full responsible-AI risk classification and design guidance (see responsible-ai; this plugin's AI control is a single minimum-control line, not the full guide), or which DoD/architecture-checklist criterion references this checklist (see definition-of-done and per-modality-checklist -- this plugin is the actual content behind their "pre-production checklist" and security-related criteria). | user | `/home/diovi/.claude/skills/security-policy/SKILL.md` |
42
+ | `skill-authoring` | Ingenius Software's own rules for creating, structuring, or reviewing a Claude Code skill, plugin, or marketplace. Use before or instead of skill-creator for any Ingenius skill/plugin/marketplace work. Covers file layout, scope boundaries, English-content standards, verification discipline, and decision logs. Does not cover a skill's own technology-specific domain content. | user | `/home/diovi/.claude/skills/skill-authoring/SKILL.md` |
43
+ | `skill-creator` | Trigger: new skills, agent instructions, documenting AI usage patterns. Create LLM-first skills with valid frontmatter. | user | `/home/diovi/.agents/skills/skill-creator/SKILL.md` |
44
+ | `skill-improver` | Trigger: improve skills, audit skills, refactor skills, skill quality. Audit and upgrade existing LLM-first skills. | user | `/home/diovi/.agents/skills/skill-improver/SKILL.md` |
45
+ | `tech-radar-catalog` | Ingenius Software's central technology radar (which technologies are adopted/trial/assess/hold/retire, and their status) and reusable asset catalog (templates, pipelines, modules, guides), maintained here as living documents rather than copied per project. Use when asked whether a technology is approved for use at Ingenius, what ring or status a technology has, whether a reusable asset, template, starter kit, scaffold, or component already exists for a given need before building it from scratch, or when proposing a new technology or asset to add to either document. This is the one plugin in this marketplace that intentionally holds real, specific-technology content (currently mostly .NET/Azure, since that's Ingenius's only mature stack) rather than agnostic methodology -- see decision log D20 for why. Does not cover the architectural principles behind a technology choice (architectural-principles) or roles/escalation for approving an exception (operating-model). | user | `/home/diovi/.claude/skills/tech-radar-catalog/SKILL.md` |
46
+ | `token-discipline` | Optimize context and token usage without sacrificing technical accuracy. Apply in every session and on every task that reads files, searches code, runs commands, edits files or writes replies, even when the user does not mention tokens or context. | user | `/home/diovi/.agents/skills/token-discipline/SKILL.md` |
47
+ | `venuenexa-guide` | Interactive guide for working on the VenueNexa project (Ingenius, Zoho project INGENIUS-238, tasks PV1-Tnn). Interviews the team member (in Spanish) about what they need to do today and walks them through the agent-first session ritual - review open tasks, pick one, assume the task's role (PM, Analyst, Architect, Dev, DevOps, QA), work with role-specific questions, and close with change summary, WorkDrive upload, role logbook entry and billable hours. Use whenever the user mentions VenueNexa, "empezar el día", "qué tarea hago", "vamos con PV1-T..", "cerrar la sesión", "bitácora", "imputar horas", RESUME HERE, ONBOARDING, INGENIUS-238, or asks what to do next on the project, even if they don't name the skill. Do NOT use for generic Zoho/GitLab questions unrelated to VenueNexa, for Ingenius-wide architecture rules (use architectural-principles, arc42-template, adr, operating-model) or for authoring skills (use skill-authoring). | user | `/home/diovi/.agents/skills/venuenexa-guide/SKILL.md` |
48
+ | `work-unit-commits` | Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code. | user | `/home/diovi/.agents/skills/work-unit-commits/SKILL.md` |
49
+
50
+ ## Loading protocol
51
+
52
+ 1. Match task context and target files against the `Trigger / description` column.
53
+ 2. Pass only the matching `Path` values to the subagent under `## Skills to load before work`.
54
+ 3. Instruct the subagent to read those exact `SKILL.md` files before reading, writing, reviewing, testing, or creating artifacts.
55
+ 4. If no matching skill exists, proceed without project skill injection and report `skill_resolution: none`.
@@ -0,0 +1 @@
1
+ npx lint-staged
package/CLAUDE.md ADDED
@@ -0,0 +1,74 @@
1
+ # CLAUDE.md
2
+
3
+ This file gives Claude Code context on the `release-cherry-pick` repository.
4
+
5
+ ## Project overview
6
+
7
+ `release-cherry-pick` is a Node.js CLI (built on Commander) that automates release cherry-picking and GitLab merge-request creation. It's designed to be installed/run as an **external tool from inside another git repo** (the "target" project being released) — this repo is the tool itself, not a project that gets released.
8
+
9
+ - Entry point / bin: `src/index.js` (exposes the `release-cherry-pick` command, `main` in `package.json`)
10
+ - Module system: CommonJS (`require`/`module.exports`), async/await throughout
11
+ - GitLab access is a direct REST client (`src/gitlab/client.js`, native `fetch`) authenticated with a Personal Access Token (scope `api`): `gitlab.token` in config, falling back to the `GITLAB_TOKEN` env var. The project path — and the API host when `gitlab.host` is empty — come from the `origin` remote URL via `parseRemoteUrl` (SCP-like SSH, `ssh://`, `http(s)://` with or without credentials; it checks for a `scheme://` before treating `host:path` as SCP syntax, since `https:` contains a colon too — that misparse used to send HTTPS remotes' requests to a wrong project path and 404). A configured `gitlab.host` wins (for SSH aliases) and goes through `normalizeGitlabHost`, since people paste project/page URLs there (e.g. `https://host/group/proj/-/project_members` — that put the API under the project path and 404'd): it drops everything from GitLab's `/-/` separator and the remote's project path suffix, but keeps any other path as a relative URL root (GitLab under `https://example.com/gitlab`), which `getProjectPathId(config)` then strips from the remote's path. The wizard applies the same normalization when the host is typed, and an http:// remote keeps http for the API. No `glab` dependency.
12
+
13
+ ## Commands
14
+
15
+ - `release-cherry-pick release [-f <file> | -b <branches>]` → `runRelease()` in `src/workflow/release.js`. Resolves branches from a file, a CLI list, or interactively, then per branch: create release branch from staging → cherry-pick commits → (if `config.release.autoCreateMR`) push, select a reviewer, and create a GitLab MR via the REST API.
16
+ - `release-cherry-pick config [--init | --show]` → `setupWizard()` (Inquirer) or `loadConfig()`, both in `src/config/`.
17
+
18
+ ## Architecture (`src/`)
19
+
20
+ - `cli/` — Commander program factory (`createProgram()`). Note: the actual commands are registered in `src/index.js`, not here — this module only sets name/description/version.
21
+ - `config/` — `defaults.js` (default config shape), `loader.js` (reads/writes the config **outside the project**, at `~/.release-cherry-pick/<project-key>.json` — `RELEASE_CHERRY_PICK_CONFIG_DIR` overrides the directory, which the sandbox uses to keep its config in `<sandbox>/config`. The key comes from the origin remote via `parseRemoteUrl` in `src/git/remote-url.js` (`host_group_proj`, the same for SSH and HTTPS clones), or the repo folder name + a hash of its path when there's no remote; it's resolved once per cwd with sync `git` calls, since load/save are sync. Saved with 0700/0600 modes; `loadConfig()` deep-merges the file over the defaults so options missing from older files are always present, then runs `validateConfig` — pass `{ validate: false }` to skip, as the wizard does so it can repair a broken file), `setup.js` (Inquirer wizard: asks every option incl. `release.*`; when `autoCreateMR` is on it lists real project members via the REST client to pick `defaultReviewers`/`defaultAssignees`, falling back to typed usernames if there's no token or the call fails — it deliberately doesn't call `ensureAuthenticated`, which prompts for a token and saves the config mid-wizard, bypassing the review/cancel step), `validator.js` (`validateConfig`: type-checks the full merged config and throws one `ConfigError` listing every problem).
22
+ - `git/` — `branch-parser.js` (parses `*TASK-ID*: description` lines — no branch-name field), `branch-selector.js` (`getRemoteBranches` fetches then lists `feature/*`/`hotfix/*` remote branches; `resolveBranchNameForTaskId(taskId, branches?)` finds the real remote branch(es) matching a task ID, used by the `--file` input path instead of guessing a name), `release-branch.js` (`buildReleaseBranchName`/`createReleaseBranch`/`pushBranch` — creates `release/<original-branch-name-with-known-prefix-stripped>` off staging; if the release branch already exists remotely *or locally* (exact name match) it does **not** auto-offer to delete/overwrite it — that's a destructive op on a shared branch — it just reports failure and leaves it for the user to resolve manually), `cherry-pick.js` (cherry-pick via `git.raw(['cherry-pick', ...])`; see "Commit selection" below), `release-status.js` (`ReleaseStatus` class — tracks per-branch `PROCEDE` / `NO PROCEDE` / `CONFLICT` / `SKIPPED` outcomes).
23
+ - `git/instance.js` — the only place `simple-git` is instantiated: `createGit()` passes `allowEnvironment: ['GIT_CONFIG_COUNT', 'GIT_CONFIG_KEY_0', 'GIT_CONFIG_VALUE_0']`. simple-git v4 strips ambient `GIT_*` variables from the git child process, which would silently drop the token header `git-auth.js` injects (and send every HTTPS push/pull back to git's interactive credential prompt). Note the option is spelled `allowEnvironment` in the code even though the v4 docs write `allowEnvoronment` — using the documented spelling does nothing. Every module must use `createGit()`, never `simpleGit()` directly.
24
+ - `gitlab/client.js` — REST client (native `fetch`, no shelling out): `ensureAuthenticated` (resolves PAT from `gitlab.token`/`GITLAB_TOKEN` or prompts interactively, validates via `GET /user`), `getProjectMembers` (`GET /projects/:id/members/all` with pagination), `createMergeRequest` (`POST /projects/:id/merge_requests`, maps reviewer usernames → `reviewer_ids`). Project path is derived from the `origin` remote URL.
25
+ - `gitlab/` — `client.js` (REST API as above), `mr-creator.js` (orchestrates: fallback title/description from `config.release.mrTitleFormat` + commit list, tries AI content, then calls `gitlab.createMergeRequest` with squash/remove-source-branch flags and `config.release.defaultAssignees`, which the client maps from usernames to `assignee_ids` like reviewers → `reviewer_ids`), `ai-description.js` (real Anthropic integration — see below), `reviewer-selector.js` (Inquirer checkbox over project members, pre-checking `config.release.defaultReviewers`, or legacy `defaultReviewerPattern` matches if that list is empty).
26
+ - `doc/` — `agents-generator.js` / `rpd-generator.js`: write `AGENTS.md` / `RPD.md` into the **target** project's root (prompt before overwrite).
27
+ - `report/` — `summary.js`: console + markdown release summaries (`PROCEDE`/`NO PROCEDE`/`CONFLICT`/`SKIPPED` status).
28
+ - `git/repo-state.js` — `captureStartingPoint()` (preflight run first thing in `runRelease`: refuses to start with uncommitted changes to tracked files or a cherry-pick in progress — untracked files are fine — and records the current branch, or commit if detached) and `restoreStartingPoint()` (run in a `finally` after the branch loop: aborts a leftover cherry-pick, checks the starting point back out, then deletes the release branches this run created that ended up empty — CONFLICT, SKIPPED or error, never pushed. PROCEDE branches, and any release branch that existed before the run, are never deleted). Note: `CHERRY_PICK_HEAD` is checked as a file, because simple-git's `raw()` doesn't reject when a git command fails without writing to stderr. `runInterruptible(work, cleanup)` wraps the branch loop so Ctrl+C also runs that cleanup: the first SIGINT sets `signal.interrupted` (the loop checks it between steps and stops; the branch in progress is discarded unless it was already pushed), then cleans up once the loop stops — or after a 2 s grace period if it's stuck on an Inquirer prompt, whose promise never settles — and exits 130; a second Ctrl+C exits immediately. While it runs it also shims `process.kill(process.pid, 'SIGINT')` (what Inquirer calls on Ctrl+C in a prompt) into a plain `SIGINT` event, because on Windows `process.kill` terminates the process unconditionally, skipping every handler.
29
+ - `workflow/release.js` — the main orchestrator (`runRelease`) tying config, GitLab token preflight, branch resolution, cherry-picking, reviewer selection, MR creation, and reporting together.
30
+ - `utils/` — `errors.js` (`AppError` base, subclassed by `ConfigError`/`GitError`/`GitLabError`), `logger.js` (chalk-based colored logger: `info/warn/error/success/header/table`).
31
+
32
+ ## Commit selection for cherry-pick (important, found via real-world testing)
33
+
34
+ `getCommitsToCherryPick(sourceBranch, taskId, baseBranch)` in `src/git/cherry-pick.js` does **not** diff `sourceBranch` against `baseBranch` as a plain range. That was the original approach and it breaks in practice: real branches are often cut from a much older/different base than current `staging` (e.g. `develop` synced only periodically), so `staging..branch` can pull in hundreds of unrelated commits, or (if the branch's work already landed elsewhere) `develop..branch` can show zero commits even though the fix is genuinely still missing from `staging`. Verified against a real PROBROKER branch: `staging..hotfix/PB-I3245-...` returned 606 unrelated commits.
35
+
36
+ Instead it matches commits by the team's own `"[TASK-ID] description"` commit message convention (used consistently — 234/13687 commits in one real repo), restricted to commits not already reachable from `baseBranch`: `git log origin/<branch> --grep='^\[TASK-ID\]' --extended-regexp --regexp-ignore-case --not origin/<baseBranch> --reverse`. This reliably isolates just this task's own commit(s) regardless of the branch's real topology. `runRelease` passes `branchInfo.taskId` as the match key. Git's `--grep` matches any line of the message, so results are then filtered to commits tagged in the **title** (simple-git's `message` is the subject).
37
+
38
+ Commits that mention the task ID without following the convention (`PB-700: fix`, `(PB-700) fix`, or the tag only in the body) would otherwise be left out of the release silently. `findLooseTaskCommits` finds them among the branch's commits not on `baseBranch` (excluding merges, titles tagged for another task, and IDs that merely start the same, e.g. PB-7000). `selectTaskCommits` in `release.js` lists them, asks whether to include them (default no; `orderCommitsByHistory` keeps branch order when mixing), and records the outcome as a note (`ReleaseStatus.addNote`) shown under the task in the console summary and `release-summary.md`. Commits with no ID at all aren't reported: they can't be told apart from unrelated history on branches cut from an old base.
39
+
40
+ A cherry-pick can also come back **empty** (git: "The previous cherry-pick is now empty...") when the commit's net change is already present in the target tree (e.g. the same fix landed a different way) — this is not a real conflict, even though git's own message contains the word "conflict" in passing. `cherry-pick.js` distinguishes this from a real conflict by checking `git status().conflicted` — if there are no actually-conflicted files, it treats it as already-applied, runs `git cherry-pick --skip`, and keeps going (does not abort the branch). `runRelease` checks `cherryPickResult.commitsCherryPicked === 0` after a "success" and marks the branch `SKIPPED` (no push, no MR — nothing to release) rather than `PROCEDE`.
41
+
42
+ ## AI-generated MR content
43
+
44
+ `src/gitlab/ai-description.js` calls the Anthropic Messages API (`@anthropic-ai/sdk`) to draft the MR title and description from the branch's commits, gated on `config.ai.enabled`. API key resolves from `config.ai.apiKey`, falling back to the `ANTHROPIC_API_KEY` env var. Default model: `config.ai.model` (default `claude-haiku-4-5-20251001`). On any failure (disabled, no key, API error, bad JSON) it returns `null` and `mr-creator.js` falls back to the static `config.release.mrTitleFormat` + commit-list template.
45
+
46
+ ## Conventions
47
+
48
+ - Always log via `src/utils/logger.js`, not raw `console.log` (a couple of `console.log(JSON.stringify(...))` calls exist only for `config --show`, which prints a copy with `gitlab.token` and `ai.apiKey` masked via `maskSecret` in `src/utils/secrets.js`).
49
+ - Secret prompts (GitLab token, AI API key) must use Inquirer `type: 'password'` with `mask: '*'` — in inquirer 8, `mask` on a `type: 'input'` prompt is silently ignored and the secret is echoed in clear.
50
+ - AI defaults: `ai.provider`/`ai.model`/`ai.baseURL` default to `''` on purpose — `ensureAiSettings` (in `setup.js`) prompts for provider/model at release time when AI is enabled and they're missing, and an empty `baseURL` lets `resolveBaseURL` pick each provider's own endpoint (a non-empty `config.ai.baseURL` wins for *any* provider).
51
+ - Errors: throw the appropriate `AppError` subclass; top-level handlers in `src/index.js` catch, log `error.message`, and `process.exit(1)`.
52
+ - Config is plaintext JSON kept in the developer's home directory (see `loader.js` above), never in the target repo, so its secrets can't be committed by accident — no `.gitignore` handling is needed or done. It holds `gitlab.token` (PAT with `api` scope; can also come from `GITLAB_TOKEN` env) and optional `gitlab.host`; the project id is resolved from the `origin` remote, not stored.
53
+ - Branch naming: original branches are `feature/*`/`hotfix/*`; release branches are `release/<original-name-with-known-prefix-stripped>` (e.g. `feature/PB-123-list-user` → `release/PB-123-list-user`) via `buildReleaseBranchName` in `src/git/release-branch.js`. Prefixes configurable via `git.branchPrefix` and honored everywhere: the release prefix names the release branch, and every non-release prefix (`getSourcePrefixes` in `src/git/branch-selector.js`, falling back to the defaults if none configured) defines which remote branches are listed/matched by task ID. Staging branch defaults to `staging`.
54
+ - Task IDs: uppercase alphanumeric with hyphen, e.g. `PB-I3217` (regex in `src/git/branch-parser.js`).
55
+ - MR titles: `config.release.mrTitleFormat` (default `[{taskId}] {description}`), used as the fallback when AI generation is off/fails; AI-generated titles are instructed to keep the `[{taskId}] ` prefix.
56
+ - MR options: `config.release.mrSquash` / `config.release.mrRemoveSourceBranch` both default `true` (GitLab's squash + delete-source-branch checkboxes), sent as `squash` / `remove_source_branch` on `POST /projects/:id/merge_requests`.
57
+ - Reviewer: `config.release.defaultReviewerPattern` (default `'^che(i|y)ner$'`) is matched case-insensitively against real project members (`gitlab.getProjectMembers()`) to preselect a default in the per-branch reviewer prompt; selected usernames are mapped to numeric `reviewer_ids` before the MR is created.
58
+ - Domain terminology is Spanish-influenced (`PROCEDE`/`NO PROCEDE`/`CONFLICT`/`SKIPPED` status, `'es-ES'` locale in generated `RPD.md`), reflecting the team's locale.
59
+ - `simple-git@4.0.2` (upgraded from `^3.36.0` for the critical advisories fixed in 4.0.2) has **no `cherryPick()` method** — cherry-pick operations must go through `git.raw(['cherry-pick', ...])`, not a hypothetical `git.cherryPick(...)`. v4 also removed the default export (`const { simpleGit } = require('simple-git')` returns an object, not a function) and blocks abbreviated long-form options (`--conf=` → `GitConfigurationError`), so keep passing full option names — all of this suite's `raw()` args are already canonical.
60
+
61
+ ## Build / test
62
+
63
+ - `npm start` — runs the CLI (`node src/index.js`).
64
+ - `npm test` — placeholder only (`echo "Tests not yet implemented"`), not a real test runner.
65
+ - `node test-e2e.js` — manual smoke script (no assertions) exercising branch parsing, config defaults, `ReleaseStatus`, markdown summary, and doc generation. Not wired to `npm test`.
66
+ - `npm run sandbox:create` / `npm run sandbox:run -- [-b <list> | -f tasks.txt]` — synthetic disposable sandbox (`scripts/sandbox/`): a local bare `origin` + clone in `$TMPDIR/release-cherry-pick-sandbox` with branches covering each scenario (normal, untagged commit, conflict, already-applied → `SKIPPED`, duplicate task ID, no task ID), config `autoCreateMR: false` (no push/GitLab API). `run-release.js` auto-answers Inquirer prompts; `npm run sandbox:config` runs the setup wizard the same way. Shared `harness.js` flags: `--fake-gitlab` (intercepts `fetch()` to `/api/v4` and sets a fake `GITLAB_TOKEN`, so the real `src/gitlab/client.js` runs against a fake — fixed members, `POST merge_requests` prints its body) and auto-answers the searchable `autocomplete`/`checkbox-plus` prompts from `src/utils/prompts.js` too and `--answer name=value` (force a prompt's answer). Use this to validate git-flow changes before touching any real repo.
67
+ - `npm run lint` / `npm run lint:fix` — ESLint (flat config, `eslint.config.js`, `eslint:recommended` + CommonJS/Node globals). A Husky `pre-commit` hook (`.husky/pre-commit`) runs `lint-staged` (`*.js` → `eslint --fix`) automatically on every commit, only against staged files. Hooks are installed with `npm run setup` (runs `husky` once after cloning) — there is deliberately **no `prepare` lifecycle script**, so nothing hook-related ships in the published package (`npm pack`/`npm publish` never runs it either). No Prettier config present (despite AGENTS.md-generated output claiming ESLint conventions for target projects — that doc is about *target* projects, not this repo).
68
+ - `npm run test:package` — end-to-end test of the **published npm artifact**, not the checkout (`scripts/sandbox/test-package.js`; flags `--version <v>`, `--sandbox <dir>`, `--keep`). Phase 1 downloads the registry tarball and checks `dist.integrity`, file list (no `.env`/keys/`.git`, no `preinstall`/`install`/`postinstall` scripts), MIT license vs `LICENSE`, `type: 'password'`+`mask: '*'` on every secret prompt, and scans shipped files for secrets (documentary placeholders excluded). Phase 2 runs a real `npm install` of the tarball into a sandbox prefix, exercises the bin (`--version`, `--help`, `config --show` with `RELEASE_CHERRY_PICK_CONFIG_DIR`) asserting the real `~/.release-cherry-pick` stays untouched, plus `npm audit`. Phase 3 runs the mutated flow twice via `run-release.js --tool <installed-copy>`: `autoCreateMR: false` (nothing pushed; only PROCEDE branches kept locally; exactly the tagged commits picked, staging untouched) and `autoCreateMR: true` against `--fake-gitlab` (push + MR body asserted) — the sandbox's origin is rewritten to `https://gitlab.example.com/sandbox/project.git` with `url.*.insteadOf` pointing back at the local bare repo, and a `git` shim on PATH returns the raw URL for `git remote get-url` (which would otherwise apply insteadOf and break `parseRemoteUrl`); the config must be written with that same shim in PATH or its project key won't match. Phase 4 writes a config containing fake PAT/AI key and asserts `0600`/`0700` modes, no raw secret in console output, `release-summary.md` or git metadata, and masked `config --show`. Phase 5 runs against the local checkout: simple-git must resolve to ≥4.0.2 (the version that fixes the criticals), and a probe proves the `GIT_CONFIG_*` token header reaches git through `createGit()` while a plain `simpleGit()` instance strips it (the allow-list is load-bearing). Currently: 83/83 checks, 2 warnings (shipped `prepare: husky || true`; `npm audit` of the *published* 1.0.0, which still pins `^3.36.0` and reports simple-git ≤4.0.1 criticals — clean once the fixed version is republished).
69
+ - The GitLab REST paths used in `src/gitlab/client.js` (`GET /user`, `GET /projects/:id/members/all`, `POST /projects/:id/merge_requests`, `PRIVATE-TOKEN` auth header, `reviewer_ids`) follow the public GitLab API docs but were **not** live-verified against a real instance from this environment (no token configured here). Re-verify with a test project if MR creation misbehaves.
70
+ - The branch-creation, commit-selection, and empty-cherry-pick logic (everything in "Commit selection for cherry-pick" above) *was* validated against real data: a disposable local mirror clone of an actual production repo (PROBROKER, `gitlab.ingeniuscuba.com`), never pushed to or otherwise touching the real remote. MR creation/reviewer-listing/AI generation were not exercised this way (no real GitLab MR was created, no Anthropic key configured).
71
+
72
+ ## Other tooling in this repo
73
+
74
+ `openspec/` holds spec-driven planning artifacts (proposal/design/tasks docs) used to plan this project's own features — not part of the CLI's runtime behavior. `.agents/`, `.kilocode/`, `.kimi-code/`, `.opencode/` contain mirrored `openspec-*` workflow skills for various AI coding tools, plus one generic (non-project-specific) `nodejs-backend-patterns` skill.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Diovi Robinet Morales
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,182 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # release-cherry-pick
4
+
5
+ **Automates release cherry-picking and GitLab merge-request creation from the command line.**
6
+
7
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white)](https://nodejs.org)
8
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
9
+ [![GitLab API](https://img.shields.io/badge/GitLab-REST%20API%20%2B%20PAT-FC6D26?logo=gitlab&logoColor=white)](https://docs.gitlab.com/api/rest/)
10
+ [![AI](https://img.shields.io/badge/AI-Anthropic%20Claude-D97757)](https://docs.anthropic.com)
11
+ [![CLI](https://img.shields.io/badge/type-CLI-informational)](#)
12
+
13
+ </div>
14
+
15
+ ## What it does
16
+
17
+ Shipping a release by hand — creating a release branch, cherry-picking each fix onto it, writing an MR title/description, picking a reviewer, checking the right MR checkboxes — is repetitive and error-prone, especially when releasing several unrelated tasks at once. `release-cherry-pick` is run **from inside the project being released** and automates that whole sequence for a list of tasks.
18
+
19
+ ## What it solves
20
+
21
+ Given a list of task IDs (from a file, a `-b` flag, or interactive branch selection), for each one it:
22
+
23
+ 1. **Creates a release branch off `staging`**, named after the original branch (prefix stripped): `feature/PB-123-list-user` → `release/PB-123-list-user`.
24
+ 2. **Authenticates to GitLab** with a personal access token (`gitlab.token` in config, or the `GITLAB_TOKEN` env var), prompting for one if missing and validating it against `GET /user`.
25
+ 3. **Cherry-picks only that task's own commits** onto the release branch — matched by the team's `[TASK-ID] description` commit message convention (not a naive branch diff, which breaks when a branch wasn't cut from a recent `staging`).
26
+ 4. **Drafts the MR title and description with Anthropic Claude** from the picked commits, falling back to a static template if AI is disabled or fails.
27
+ 5. **Lists real GitLab project members** for the reviewer prompt, pre-selecting your configured default reviewers.
28
+ 6. **Creates the MR** with squash-commits and delete-source-branch checked by default, assigned to your configured default assignees.
29
+ 7. **Never auto-resolves problems for you**: if cherry-picking conflicts, or the release branch already exists remotely, it stops touching that branch immediately and reports it — you decide manually. Branches whose changes are already present get reported as `SKIPPED`, not silently pushed.
30
+ 8. **Produces a final report** (console + `release-summary.md`) showing exactly which branches shipped, which need manual conflict resolution, which were skipped, and the MR link for each.
31
+
32
+ ## Requirements
33
+
34
+ - Node.js >= 18
35
+ - A GitLab personal access token with the `api` scope (set as `gitlab.token` in config, or export `GITLAB_TOKEN`)
36
+ - Run from inside the git repository you're releasing (it needs an `origin` remote pointing at GitLab)
37
+ - (Optional) an Anthropic API key, for AI-generated MR titles/descriptions
38
+
39
+ ## Installation
40
+
41
+ ```bash
42
+ npm install
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ ### Run a release
48
+
49
+ ```bash
50
+ # Interactive — pick branches from the repo
51
+ node src/index.js release
52
+
53
+ # From a branch-list file
54
+ node src/index.js release --file branches.txt
55
+
56
+ # Direct — comma-separated task IDs and/or full branch names
57
+ node src/index.js release --branches PB-123,PB-124
58
+ node src/index.js release --branches feature/PB-123-list-user,hotfix/PB-124-fix-favicon
59
+ ```
60
+
61
+ A bare task ID is resolved to its real remote branch (same as the file input); for a full branch name, the task ID is extracted from it. Branches whose name doesn't start with a task ID are skipped with a warning.
62
+
63
+ ### Configure
64
+
65
+ ```bash
66
+ # Initialize/update configuration
67
+ node src/index.js config --init
68
+
69
+ # Show current configuration
70
+ node src/index.js config --show
71
+ ```
72
+
73
+ ### Branch list file format
74
+
75
+ ```
76
+ *PB-I3217*: Al gestionar autos de una póliza y al renovar una póliza de auto, el campo Endoso no está listando los posibles valores a seleccionar.
77
+ *PB-I3218*: Error al listar "Coberturas afectadas" (Configuraciones / Reclamos / Coberturas afectadas).
78
+ ```
79
+
80
+ The tool resolves each task ID to its real remote branch automatically (asking you to disambiguate if more than one branch matches).
81
+
82
+ ### Configuration file
83
+
84
+ Since it can hold secrets (`gitlab.token`, `ai.apiKey`), the configuration is **never stored inside the project**. It lives in your home directory, one file per project: `~/.release-cherry-pick/<project>.json` (e.g. `C:\Users\<you>\.release-cherry-pick\gitlab.example.com_group_project.json`). The file name comes from the `origin` remote (host + project path), so it's the same whether you cloned over SSH or HTTPS and doesn't change if you move the folder; repos without a remote use the folder name plus a short hash of its path. `config --show` prints the file's location. On Linux/macOS the file is created readable by your user only. Set `RELEASE_CHERRY_PICK_CONFIG_DIR` to use another directory.
85
+
86
+ ```json
87
+ {
88
+ "git": {
89
+ "stagingBranch": "staging",
90
+ "branchPrefix": {
91
+ "feature": "feature/",
92
+ "hotfix": "hotfix/",
93
+ "release": "release/"
94
+ }
95
+ },
96
+ "gitlab": {
97
+ "host": "",
98
+ "token": ""
99
+ },
100
+ "ai": {
101
+ "enabled": true,
102
+ "provider": "",
103
+ "apiKey": "",
104
+ "model": "",
105
+ "baseURL": ""
106
+ },
107
+ "release": {
108
+ "autoCreateMR": true,
109
+ "mrTitleFormat": "[{taskId}] {description}",
110
+ "defaultReviewers": [],
111
+ "defaultAssignees": [],
112
+ "mrSquash": true,
113
+ "mrRemoveSourceBranch": true,
114
+ "branches": []
115
+ }
116
+ }
117
+ ```
118
+
119
+ `ai.provider`/`ai.model` are empty by default: with AI enabled and no model saved, `release` asks you to pick a provider and model once and saves them. `ai.baseURL` is empty too, so each provider uses its own API endpoint unless you override it. `config --show` masks `gitlab.token` and `ai.apiKey` (e.g. `glpat-****WxYz`, `sk-ant-****9z8y`), and the wizard hides both while you type them.
120
+
121
+ Any option missing from the file is filled in from these defaults when it's loaded, so config files written by older versions keep working; the merged result is validated up front, and every problem (wrong type, invalid value) is reported in a single clear error.
122
+
123
+ `config --init` asks for every option above. When `autoCreateMR` is on, it uses the GitLab token (the one just entered, or `GITLAB_TOKEN`) to list the **real GitLab project members** so you pick `defaultReviewers` (preselected in each MR's reviewer prompt, still editable per MR) and `defaultAssignees` (assigned automatically to every MR) from them. If there's no token yet or the API call fails, it falls back to typing comma-separated usernames. Older configs with `release.defaultReviewerPattern` (a regex over usernames) still work — it's used when `defaultReviewers` is empty — and running the wizard migrates it into the explicit list.
124
+
125
+ GitLab authentication uses a personal access token stored in `gitlab.token` (or the `GITLAB_TOKEN` environment variable, which takes effect when the config value is empty). The GitLab host and project path are both resolved from the `origin` remote URL (SSH `git@host:group/proj.git`, `ssh://…`, or HTTPS, with or without credentials) — no `projectId` is stored. Set `gitlab.host` only when the remote's host isn't the GitLab web host, e.g. an SSH alias from `~/.ssh/config`. The Anthropic API key can also be supplied via the `ANTHROPIC_API_KEY` environment variable instead of the config file.
126
+
127
+ ## Testing in development
128
+
129
+ There's no automated test suite yet (`npm test` is a placeholder). To validate a change, first install the git hooks once per clone (the repo has no `prepare` script on purpose, so nothing hook-related ships in the published package):
130
+
131
+ ```bash
132
+ npm run setup # installs the Husky pre-commit hook (lint-staged → eslint --fix)
133
+ ```
134
+
135
+ 1. **Run the smoke script**, which exercises branch parsing, config defaults, status tracking, and report/doc generation:
136
+ ```bash
137
+ node test-e2e.js
138
+ ```
139
+ 2. **Syntax-check everything** after editing:
140
+ ```bash
141
+ find src -name "*.js" -exec node --check {} \;
142
+ ```
143
+ 3. **Run the full release flow against the synthetic sandbox** — a throwaway local `origin` (bare repo) plus a clone with prepared branches covering each scenario (normal feature/hotfix, untagged commit that must not be picked, real conflict, already-applied change → `SKIPPED`, two branches with the same task ID, branch with no task ID). Its config has `autoCreateMR: false`, so nothing is pushed and the GitLab API is never called:
144
+ ```bash
145
+ npm run sandbox:create # (re)creates it in $TMPDIR/release-cherry-pick-sandbox
146
+ npm run sandbox:run -- -b "PB-100,hotfix/PB-I200-favicon,PB-300,PB-400,PB-500,feature/refactor"
147
+ npm run sandbox:run -- -f tasks.txt # --file path (tasks.txt lives in the sandbox)
148
+ npm run sandbox:run # interactive-selection path
149
+ ```
150
+ `sandbox:run` auto-answers every prompt (list → first choice, checkbox → the checked choices or all if none are, confirm → no), so it runs unattended. Re-run `sandbox:create` before each run to start from a clean state.
151
+
152
+ Two more flags work with both `sandbox:run` and `sandbox:config` (the setup wizard, whose prompts default to their current values):
153
+ - `--fake-gitlab` intercepts `fetch()` calls to the GitLab REST API (`/user`, project members, `POST merge_requests` — which prints the request body it received and returns a fake URL) and sets a fake `GITLAB_TOKEN`, so the real client, member-selection and MR-creation code run end to end with no GitLab. Release branches are pushed to the sandbox's local `origin` only.
154
+ - `--answer name=value` forces the answer of a prompt by name (value parsed as JSON when possible).
155
+ ```bash
156
+ npm run sandbox:config -- --fake-gitlab --answer autoCreateMR=true --answer 'defaultAssignees=["abel"]'
157
+ npm run sandbox:run -- --fake-gitlab -b "PB-100,PB-300" # shows the MR request body, incl. reviewer_ids/assignee_ids
158
+ ```
159
+
160
+ To validate the **published npm package** instead of the checkout — registry tarball integrity and contents (no keys, no install lifecycle scripts, MIT, secret scan, password+mask prompts), a real `npm install` of the tarball with `--version`/`--help`/`config --show`, the mutated cherry-pick flow twice (`autoCreateMR: false` → nothing pushed; `autoCreateMR: true` → push + MR body against the fake GitLab), a secrets pass (config `0600`/`0700`, no raw token in the console output, generated report or git metadata, masked `config --show`) and a final phase against the local checkout proving simple-git ≥4.0.2 with the `GIT_CONFIG_*` token header reaching git through `createGit()`:
161
+ ```bash
162
+ npm run test:package # prints a PASS/FAIL report; flags: --version <v>, --sandbox <dir>, --keep
163
+ ```
164
+ 4. **Exercise the real git flow against an isolated, disposable mirror** — never test branch creation, cherry-picking, or pushes directly against a real project. Clone a mirror of the target repo so pushes/branch deletes only touch your local disk:
165
+ ```bash
166
+ git clone --mirror <path-or-url-to-target-repo> /tmp/rcp-test/mirror.git
167
+ git clone /tmp/rcp-test/mirror.git /tmp/rcp-test/work
168
+ cd /tmp/rcp-test/work
169
+ # run release-cherry-pick's functions/CLI here — origin points only at the local mirror
170
+ ```
171
+ This gives you real branches, real commit history, and real conflict scenarios with zero risk to the actual GitLab project.
172
+ 5. **GitLab API behavior** (token validation, listing reviewers, MR creation) and **AI generation** need a real token (PAT with `api` scope) and a real Anthropic key respectively to exercise end-to-end — verify these manually against a test GitLab project before relying on them in production.
173
+
174
+ ## Developers
175
+
176
+ - lleraabi@gmail.com
177
+ - ariel@ingeniuscuba.com
178
+ - drobinetm@outlook.com
179
+
180
+ ## License
181
+
182
+ MIT
@@ -0,0 +1,34 @@
1
+ const js = require('@eslint/js');
2
+
3
+ module.exports = [
4
+ js.configs.recommended,
5
+ {
6
+ languageOptions: {
7
+ ecmaVersion: 2022,
8
+ sourceType: 'commonjs',
9
+ globals: {
10
+ require: 'readonly',
11
+ module: 'readonly',
12
+ exports: 'writable',
13
+ process: 'readonly',
14
+ console: 'readonly',
15
+ __dirname: 'readonly',
16
+ __filename: 'readonly',
17
+ Buffer: 'readonly',
18
+ fetch: 'readonly',
19
+ AbortController: 'readonly',
20
+ URL: 'readonly',
21
+ setTimeout: 'readonly',
22
+ setInterval: 'readonly',
23
+ clearTimeout: 'readonly',
24
+ clearInterval: 'readonly',
25
+ },
26
+ },
27
+ rules: {
28
+ 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
29
+ },
30
+ },
31
+ {
32
+ ignores: ['node_modules/**', 'openspec/**', '.agents/**', '.kilocode/**', '.kimi-code/**', '.opencode/**'],
33
+ },
34
+ ];
File without changes
@@ -0,0 +1,2 @@
1
+ schema: spec-driven
2
+ created: 2026-09-08
@@ -0,0 +1,126 @@
1
+ ## Context
2
+
3
+ El proyecto es una CLI Node.js que se ejecuta como herramienta externa en otros proyectos para automatizar el proceso de release mediante cherry-pick y creación de Merge Requests en GitLab. Actualmente no existe código base - el proyecto se construirá desde cero.
4
+
5
+ ## Goals / Non-Goals
6
+
7
+ **Goals:**
8
+ - Crear una CLI modular y extensible con arquitectura clara
9
+ - Implementar todas las capacidades definidas en los specs
10
+ - Mantener el proyecto simple y fácil de mantener
11
+ - Proporcionar una experiencia de usuario fluida mediante interacción CLI
12
+
13
+ **Non-Goals:**
14
+ - No implementar interfaz gráfica (solo CLI)
15
+ - No soportar otros proveedores de control de versiones (solo Git/GitLab)
16
+ - No implementar autenticación OAuth (solo tokens personales)
17
+ - No crear un servicio web o API
18
+
19
+ ## Decisions
20
+
21
+ ### Decision 1: Arquitectura modular con separación de responsabilidades
22
+
23
+ **Choice**: Estructura de carpetas por dominio (cli-core, config, cherry-pick, gitlab, etc.)
24
+
25
+ **Rationale**:
26
+ - Facilita testing y mantenimiento
27
+ - Permite desarrollar y probar módulos independientemente
28
+ - Sigue principios de SOLID y Clean Architecture
29
+
30
+ **Alternatives considered**:
31
+ - Estructura plana: Rechazada por dificultad de mantenimiento a medida que crece el proyecto
32
+ - Arquitectura hexagonal: Demasiado compleja para una CLI de este tamaño
33
+
34
+ ### Decision 2: Framework CLI - Commander.js
35
+
36
+ **Choice**: Commander.js para parsing de argumentos
37
+
38
+ **Rationale**:
39
+ - Ampliamente usado y probado
40
+ - Soporte nativo para subcomandos
41
+ - Buena documentación y comunidad
42
+ - Ligero y sin dependencias innecesarias
43
+
44
+ **Alternatives considered**:
45
+ - Yargs: Más complejo, mejor para CLIs con muchas opciones
46
+ - Inquirer.js: Solo para prompts interactivos, no para parsing principal
47
+ - Meow: Más minimalista, menos features
48
+
49
+ ### Decision 3: Interacción CLI - Inquirer.js
50
+
51
+ **Choice**: Inquirer.js para prompts interactivos
52
+
53
+ **Rationale**:
54
+ - Mejor experiencia de usuario para selección de ramas
55
+ - Soporte para listas, confirmaciones, inputs
56
+ - Fácil de usar y personalizar
57
+
58
+ **Alternatives considered**:
59
+ - Prompt: Más básico
60
+ - Readline: Nativo de Node pero más工作 intensivo
61
+
62
+ ### Decision 4: Cliente GitLab - Axios + GitLab API
63
+
64
+ **Choice**: Axios para llamadas HTTP a GitLab API
65
+
66
+ **Rationale**:
67
+ - Control total sobre las llamadas API
68
+ - Fácil de implementar y testear
69
+ - Sin dependencias adicionales innecesarias
70
+
71
+ **Alternatives considered**:
72
+ - gitlab-api npm package: Menos control, dependencia adicional
73
+ - Octokit: Más para GitHub, no GitLab
74
+
75
+ ### Decision 5: Ejecución de comandos Git - simple-git
76
+
77
+ **Choice**: simple-git para ejecutar comandos Git
78
+
79
+ **Rationale**:
80
+ - API simple y consistente
81
+ - Manejo de errores integrado
82
+ - Evita usar child_process directamente (más seguro)
83
+
84
+ **Alternatives considered**:
85
+ - isomorphic-git: Más complejo, mejor para apps web
86
+ - child_process: Más trabajo, propenso a errores
87
+
88
+ ### Decision 6: Estructura de configuración
89
+
90
+ **Choice**: Archivo JSON `.release-cherry-pick.json` en raíz del proyecto
91
+
92
+ **Rationale**:
93
+ - Simple y nativo de Node.js
94
+ - Fácil de leer y modificar manualmente
95
+ - No requiere dependencias adicionales
96
+
97
+ **Alternatives considered**:
98
+ - YAML: Más legible pero requiere librería adicional
99
+ - dotenv: Solo para variables de entorno, no estructurado
100
+
101
+ ## Risks / Trade-offs
102
+
103
+ **Risk: GitLab API rate limiting**
104
+ → Mitigation: Implementar reintentos con backoff exponencial y caché de resultados
105
+
106
+ **Risk: Conflictos de cherry-pick no resolubles automáticamente**
107
+ → Mitigation: Marcar como NO PROCEDE y proporcionar instrucciones claras al usuario
108
+
109
+ **Risk: Tokens de GitLab expuestos en logs**
110
+ → Mitigation: Nunca loggear tokens, usar variables de entorno cuando sea posible
111
+
112
+ **Risk: Cambios en GitLab API**
113
+ → Mitigation: Usar versionado de API y documentar endpoints usados
114
+
115
+ **Trade-off: Simplicidad vs Flexibilidad**
116
+ → Decisión: Priorizar simplicidad para el caso de uso principal, permitir extensibilidad básica
117
+
118
+ ## Migration Plan
119
+
120
+ No aplica - proyecto nuevo desde cero.
121
+
122
+ ## Open Questions
123
+
124
+ 1. ¿Se debe soportar múltiples proyectos GitLab simultáneamente?
125
+ 2. ¿Qué nivel de logging se necesita (verbose, debug, quiet)?
126
+ 3. ¿Se debe implementar modo dry-run para pruebas?
@@ -0,0 +1,39 @@
1
+ ## Why
2
+
3
+ El proyecto actual necesita una herramienta CLI en Node.js que automatice el proceso de release mediante cherry-pick de ramas feature/hotfix hacia ramas de release, y la creación de Merge Requests en GitLab. Este proceso es manual, propenso a errores y consume tiempo significativo del equipo de desarrollo. La herramienta permitirá estandarizar el proceso, reducir errores humanos y agilizar los releases.
4
+
5
+ ## What Changes
6
+
7
+ - Crear una CLI en Node.js que se ejecute como herramienta externa en proyectos existentes
8
+ - Implementar gestión de configuración persistente (ramas, proveedores Git, integración IA)
9
+ - Soporte para listas de ramas predefinidas o selección interactiva desde el repositorio
10
+ - Automatización del flujo: cherry-pick → detección de conflictos → creación de MR en GitLab
11
+ - Generación de reportes de resumen con estado del release (PROCEDE/NO PROCEDE)
12
+ - Creación de documentación AGENTS.md y RPD.md
13
+
14
+ ## Capabilities
15
+
16
+ ### New Capabilities
17
+
18
+ - `cli-core`: Estructura base de la CLI con manejo de argumentos, configuración yLogging
19
+ - `config-management`: Gestión de configuraciones persistentes (ramas, proveedores Git, opciones IA)
20
+ - `branch-selection`: Selección de ramas mediante lista predefinida o interacción con el repositorio
21
+ - `cherry-pick-orchestration`: Orquestación del proceso de cherry-pick con manejo de conflictos
22
+ - `gitlab-integration`: Integración con GitLab API para creación de Merge Requests
23
+ - `release-summary`: Generación de reportes de resumen del proceso de release
24
+ - `documentation-generation`: Generación automática de AGENTS.md y RPD.md
25
+
26
+ ### Modified Capabilities
27
+
28
+ <!-- No hay capacidades existentes a modificar - este es un proyecto nuevo -->
29
+
30
+ ## Impact
31
+
32
+ - **Código**: Nuevo proyecto Node.js completo con estructura modular
33
+ - **Dependencias**:
34
+ - Node.js runtime
35
+ - Librería para interacción CLI (inquirer.js o similar)
36
+ - Cliente GitLab API (axios + gitlab API o librería dedicada)
37
+ - Manejo de procesos child para git commands
38
+ - **Sistemas**: Requiere acceso a GitLab API con permisos para crear MRs
39
+ - **Documentación**: Genera AGENTS.md y RPD.md como parte del proceso