@imolko/ultra-agent 0.1.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/bin/cli.js +2 -0
- package/dist-node/bin.d.ts +2 -0
- package/dist-node/bin.d.ts.map +1 -0
- package/dist-node/bin.js +5 -0
- package/dist-node/bin.js.map +1 -0
- package/dist-node/cli.d.ts +41 -0
- package/dist-node/cli.d.ts.map +1 -0
- package/dist-node/cli.js +170 -0
- package/dist-node/cli.js.map +1 -0
- package/dist-node/index.d.ts +14 -0
- package/dist-node/index.d.ts.map +1 -0
- package/dist-node/index.js +40 -0
- package/dist-node/index.js.map +1 -0
- package/dist-node/init-lint.d.ts +43 -0
- package/dist-node/init-lint.d.ts.map +1 -0
- package/dist-node/init-lint.js +84 -0
- package/dist-node/init-lint.js.map +1 -0
- package/dist-node/manifest.d.ts +33 -0
- package/dist-node/manifest.d.ts.map +1 -0
- package/dist-node/manifest.js +59 -0
- package/dist-node/manifest.js.map +1 -0
- package/dist-node/materializer.d.ts +52 -0
- package/dist-node/materializer.d.ts.map +1 -0
- package/dist-node/materializer.js +194 -0
- package/dist-node/materializer.js.map +1 -0
- package/dist-node/package-root.d.ts +5 -0
- package/dist-node/package-root.d.ts.map +1 -0
- package/dist-node/package-root.js +17 -0
- package/dist-node/package-root.js.map +1 -0
- package/dist-node/payload.d.ts +22 -0
- package/dist-node/payload.d.ts.map +1 -0
- package/dist-node/payload.js +49 -0
- package/dist-node/payload.js.map +1 -0
- package/dist-node/pointer-hub.d.ts +22 -0
- package/dist-node/pointer-hub.d.ts.map +1 -0
- package/dist-node/pointer-hub.js +50 -0
- package/dist-node/pointer-hub.js.map +1 -0
- package/dist-node/publication.cli.d.ts +9 -0
- package/dist-node/publication.cli.d.ts.map +1 -0
- package/dist-node/publication.cli.js +17 -0
- package/dist-node/publication.cli.js.map +1 -0
- package/dist-node/publication.d.ts +23 -0
- package/dist-node/publication.d.ts.map +1 -0
- package/dist-node/publication.js +47 -0
- package/dist-node/publication.js.map +1 -0
- package/dist-node/reconcile.cli.d.ts +11 -0
- package/dist-node/reconcile.cli.d.ts.map +1 -0
- package/dist-node/reconcile.cli.js +39 -0
- package/dist-node/reconcile.cli.js.map +1 -0
- package/dist-node/reconcile.d.ts +30 -0
- package/dist-node/reconcile.d.ts.map +1 -0
- package/dist-node/reconcile.js +51 -0
- package/dist-node/reconcile.js.map +1 -0
- package/dist-node/ship/prompts/fix.md +22 -0
- package/dist-node/ship/prompts/implement.md +34 -0
- package/dist-node/ship/prompts/review.md +28 -0
- package/dist-node/ship/ship.agent.d.ts +22 -0
- package/dist-node/ship/ship.agent.d.ts.map +1 -0
- package/dist-node/ship/ship.agent.js +142 -0
- package/dist-node/ship/ship.agent.js.map +1 -0
- package/dist-node/ship/ship.args.d.ts +15 -0
- package/dist-node/ship/ship.args.d.ts.map +1 -0
- package/dist-node/ship/ship.args.js +93 -0
- package/dist-node/ship/ship.args.js.map +1 -0
- package/dist-node/ship/ship.context.d.ts +12 -0
- package/dist-node/ship/ship.context.d.ts.map +1 -0
- package/dist-node/ship/ship.context.js +3 -0
- package/dist-node/ship/ship.context.js.map +1 -0
- package/dist-node/ship/ship.d.ts +4 -0
- package/dist-node/ship/ship.d.ts.map +1 -0
- package/dist-node/ship/ship.js +221 -0
- package/dist-node/ship/ship.js.map +1 -0
- package/dist-node/ship/ship.mr.d.ts +9 -0
- package/dist-node/ship/ship.mr.d.ts.map +1 -0
- package/dist-node/ship/ship.mr.js +171 -0
- package/dist-node/ship/ship.mr.js.map +1 -0
- package/dist-node/ship/ship.output.d.ts +9 -0
- package/dist-node/ship/ship.output.d.ts.map +1 -0
- package/dist-node/ship/ship.output.js +21 -0
- package/dist-node/ship/ship.output.js.map +1 -0
- package/dist-node/ship/ship.tracker.d.ts +37 -0
- package/dist-node/ship/ship.tracker.d.ts.map +1 -0
- package/dist-node/ship/ship.tracker.js +220 -0
- package/dist-node/ship/ship.tracker.js.map +1 -0
- package/dist-node/version.cli.d.ts +9 -0
- package/dist-node/version.cli.d.ts.map +1 -0
- package/dist-node/version.cli.js +30 -0
- package/dist-node/version.cli.js.map +1 -0
- package/dist-node/version.d.ts +24 -0
- package/dist-node/version.d.ts.map +1 -0
- package/dist-node/version.js +76 -0
- package/dist-node/version.js.map +1 -0
- package/docs/adr/ADR-0000-proceso-y-formato-de-adrs.md +115 -0
- package/docs/adr/foundational/A-001-clean-architecture-4-capas.md +88 -0
- package/docs/adr/foundational/A-002-cqrs-semantico.md +58 -0
- package/docs/adr/foundational/A-003-tdd.md +97 -0
- package/docs/adr/foundational/A-005-either-return-custom-methods.md +80 -0
- package/docs/adr/foundational/A-006-feature-completion-criteria.md +47 -0
- package/docs/adr/foundational/A-007-data-contract-fail-fast.md +109 -0
- package/docs/adr/foundational/A-008-bounded-context-decomposition.md +130 -0
- package/docs/adr/foundational/A-009-use-case-taxonomy.md +99 -0
- package/docs/adr/foundational/A-010-propiedad-emision-eventos-dominio.md +95 -0
- package/docs/adr/foundational/A-011-characterization-first-refactoring.md +90 -0
- package/docs/adr/foundational/A-012-helm-mecanismo-primario-despliegue.md +67 -0
- package/docs/adr/foundational/A-013-contrato-settings-unica-fuente-configuracion.md +74 -0
- package/docs/adr/foundational/A-014-generacion-artefactos-despliegue-desde-contrato-settings.md +75 -0
- package/docs/adr/foundational/A-015-cloudevents-estandar-eventos.md +85 -0
- package/docs/adr/foundational/A-016-cicd-gitlab-pipeline-raiz-pipelines-modulares.md +92 -0
- package/docs/adr/foundational/A-017-taxonomia-repositorios-librerias-sistemas.md +93 -0
- package/docs/adr/foundational/A-018-practicas-build-imagenes-docker.md +85 -0
- package/docs/adr/foundational/A-019-convenciones-autoria-helm-charts.md +97 -0
- package/docs/adr/foundational/A-020-entorno-desarrollo-estandarizado-devcontainer.md +58 -0
- package/docs/adr/foundational/A-022-formato-reporte-tests-ctrf.md +55 -0
- package/docs/adr/foundational/A-023-composicion-bloques-prompt-agentes.md +65 -0
- package/docs/adr/foundational/A-024-features-slices-verticales-portables.md +41 -0
- package/docs/adr/foundational/A-025-anatomia-mecanica-feature-puertos-adaptadores-drivers.md +104 -0
- package/docs/adr/foundational/A-026-infraestructura-compartida.md +44 -0
- package/docs/adr/foundational/A-027-patron-wiring-entry-point.md +67 -0
- package/docs/adr/foundational/A-029-verbos-intencion-metodos-lado-negocio.md +54 -0
- package/docs/adr/foundational/A-030-global-development-tooling.md +52 -0
- package/docs/adr/foundational/A-031-ubiquitous-language.md +64 -0
- package/docs/adr/foundational/A-032-domain-artifact-documentation-format.md +128 -0
- package/docs/adr/foundational/A-033-estandar-mensajes-commit.md +127 -0
- package/docs/adr/foundational/A-034-canonical-skill-set.md +64 -0
- package/docs/adr/foundational/A-035-captura-ideas-reanclaje-candies.md +51 -0
- package/docs/adr/foundational/A-036-adopcion-wayfinder-ortogonalidad-labels.md +37 -0
- package/docs/adr/foundational/A-037-formalizacion-taxonomia-labels.md +98 -0
- package/docs/adr/foundational/A-038-issues-referencian-skills-nombre.md +54 -0
- package/docs/adr/foundational/A-039-pipeline-ship-issues-hijos-spec.md +64 -0
- package/docs/adr/foundational/A-040-punteros-configuracion-repo-skills.md +44 -0
- package/docs/adr/foundational/A-041-estrategia-de-ramas.md +45 -0
- package/docs/adr/foundational/A-042-formato-documentos-issue-tracker.md +78 -0
- package/docs/adr/foundational/A-043-vocabulario-etiquetas-adrs.md +42 -0
- package/docs/adr/foundational/A-044-composicion-funcional-procesos-operaciones.md +44 -0
- package/docs/adr/foundational/A-045-guardrails-aplicables-no-directrices.md +48 -0
- package/docs/adr/foundational/A-046-metricas-de-forma-y-legibilidad-del-codigo.md +50 -0
- package/docs/adr/foundational/A-047-dependencias-explicitas-sin-globales-ambientales.md +40 -0
- package/docs/adr/foundational/A-048-cobertura-minima-codigo.md +39 -0
- package/docs/adr/foundational/A-049-materializacion-bucle-guardrails-extension-nativa-pi.md +49 -0
- package/docs/adr/foundational/A-050-el-caso-de-uso-pide-al-dominio-no-lee-su-representacion.md +50 -0
- package/docs/adr/foundational/A-051-orden-imports-por-distancia.md +47 -0
- package/docs/adr/foundational/A-052-distribucion-metodologia-paquete-versionado.md +42 -0
- package/docs/adr/foundational/A-053-errores-compartidos-entre-features-dos-hogares-por-capa.md +43 -0
- package/docs/adr/foundational/A-054-contrato-costura-driver-port-raw-data-canal-error.md +65 -0
- package/docs/adr/foundational/index.md +98 -0
- package/docs/adr/index.md +19 -0
- package/docs/adr/python/P-001-dependencias-por-feature-fastapi-depends.md +63 -0
- package/docs/adr/python/P-002-inyeccion-token-por-request-sin-persistirlo.md +35 -0
- package/docs/adr/python/P-003-sqlalchemy-async-connection-pooling.md +59 -0
- package/docs/adr/python/P-004-serializer-json-custom-modelos-pydantic.md +47 -0
- package/docs/adr/python/P-005-patrones-pitfalls-nicegui.md +148 -0
- package/docs/adr/python/P-006-convenciones-pytest.md +96 -0
- package/docs/adr/python/P-007-ci-python-alineacion-poetry-version-unica.md +55 -0
- package/docs/adr/python/P-008-empaquetado-infraestructura-compartida-por-tecnologia.md +38 -0
- package/docs/adr/python/index.md +14 -0
- package/docs/adr/typescript/T-001-ddd-artifact-validation-zod-primitives.md +136 -0
- package/docs/adr/typescript/T-002-test-documentation-jsdoc.md +133 -0
- package/docs/adr/typescript/T-003-readme-formatting-domain-artifacts.md +51 -0
- package/docs/adr/typescript/T-005-input-optionality-use-case-not-entity.md +130 -0
- package/docs/adr/typescript/T-006-small-enums-inlined-zod-regex.md +77 -0
- package/docs/adr/typescript/T-007-controller-input-zod-schema.md +79 -0
- package/docs/adr/typescript/T-008-expressive-use-case-pipe.md +207 -0
- package/docs/adr/typescript/T-009-mdx-brace-escaping.md +80 -0
- package/docs/adr/typescript/T-010-stack-tooling-typescript-dominio.md +53 -0
- package/docs/adr/typescript/T-011-ultra-reporter-herramienta-canonica-documentacion.md +52 -0
- package/docs/adr/typescript/T-012-npm-workspaces-estructura-monorepo-clean-architecture.md +54 -0
- package/docs/adr/typescript/T-013-definicion-eventos-versionados-ultra-ddd.md +45 -0
- package/docs/adr/typescript/T-014-publicacion-distribucion-librerias-npm-semver.md +53 -0
- package/docs/adr/typescript/T-015-method-placement-definition.md +35 -0
- package/docs/adr/typescript/T-016-contrato-settings-zod.md +34 -0
- package/docs/adr/typescript/T-017-characterization-tests-golden-files.md +39 -0
- package/docs/adr/typescript/T-018-procedencia-campos-frontmatter.md +55 -0
- package/docs/adr/typescript/T-019-ultra-generator-herramienta-canonica-generacion.md +35 -0
- package/docs/adr/typescript/T-020-ultra-settings-herramienta-canonica-exportacion-despliegue.md +36 -0
- package/docs/adr/typescript/T-021-pipe-flujo-datos-operadores-semantica-contexto-inmutable.md +105 -0
- package/docs/adr/typescript/T-022-construction-is-execution-single-boundary.md +112 -0
- package/docs/adr/typescript/T-023-registry-cli-declara-dependencias-reales.md +84 -0
- package/docs/adr/typescript/T-024-paquete-ultra-agent-manifiesto-pi-peers-cli.md +39 -0
- package/docs/adr/typescript/T-025-publicacion-npm-trusted-publishing-procedencia.md +59 -0
- package/docs/adr/typescript/index.md +30 -0
- package/eslint/index.mjs +721 -0
- package/package.json +94 -0
- package/pi/extensions/handoff/README.md +92 -0
- package/pi/extensions/handoff/handoff-prompt.txt +9 -0
- package/pi/extensions/handoff/index.ts +296 -0
- package/pi/extensions/handoff/package.json +12 -0
- package/pi/extensions/qa-guardrail/README.md +108 -0
- package/pi/extensions/qa-guardrail/adapters/cli.ts +100 -0
- package/pi/extensions/qa-guardrail/adapters/eslint.ts +90 -0
- package/pi/extensions/qa-guardrail/adapters/registry.ts +45 -0
- package/pi/extensions/qa-guardrail/baseline.ts +74 -0
- package/pi/extensions/qa-guardrail/cerco.ts +134 -0
- package/pi/extensions/qa-guardrail/check.ts +185 -0
- package/pi/extensions/qa-guardrail/config.ts +189 -0
- package/pi/extensions/qa-guardrail/delta.ts +52 -0
- package/pi/extensions/qa-guardrail/feedback.ts +26 -0
- package/pi/extensions/qa-guardrail/index.ts +311 -0
- package/pi/extensions/qa-guardrail/nstop.ts +82 -0
- package/pi/extensions/qa-guardrail/package.json +12 -0
- package/pi/extensions/qa-guardrail/selection.ts +98 -0
- package/pi/extensions/qa-guardrail/types.ts +64 -0
- package/scripts/copy-assets.sh +10 -0
- package/scripts/reconcile-tags.sh +94 -0
- package/scripts/release-beta.sh +64 -0
- package/scripts/release-build.sh +53 -0
- package/scripts/release.sh +51 -0
- package/scripts/verify-adr-consistency.py +217 -0
- package/skills/code-review/SKILL.md +66 -0
- package/skills/codebase-design/SKILL.md +46 -0
- package/skills/configure-repo/SKILL.md +33 -0
- package/skills/diagnose-bug/SKILL.md +63 -0
- package/skills/domain-modeling/SKILL.md +56 -0
- package/skills/grill-me/SKILL.md +34 -0
- package/skills/i-have-an-idea/SKILL.md +166 -0
- package/skills/implement/SKILL.md +22 -0
- package/skills/research/SKILL.md +17 -0
- package/skills/ship/SKILL.md +26 -0
- package/skills/spike/SKILL.md +27 -0
- package/skills/tdd/SKILL.md +68 -0
- package/skills/tdd/references/deep-modules.md +53 -0
- package/skills/tdd/references/interface-design.md +74 -0
- package/skills/tdd/references/mocking.md +80 -0
- package/skills/tdd/references/refactoring.md +49 -0
- package/skills/tdd/references/tests.md +184 -0
- package/skills/to-specs/SKILL.md +141 -0
- package/skills/to-tasks/SKILL.md +143 -0
- package/skills/triage/SKILL.md +73 -0
- package/skills/ultra-generator/SKILL.md +263 -0
- package/skills/ultra-generator/references/aggregate-root.md +149 -0
- package/skills/ultra-generator/references/domain-event.md +174 -0
- package/skills/ultra-generator/references/entity.md +133 -0
- package/skills/ultra-generator/references/service.md +92 -0
- package/skills/ultra-generator/references/value-object.md +135 -0
- package/skills/wayfinder/SKILL.md +201 -0
- package/skills/workflow/SKILL.md +31 -0
- package/skills/writing-for-agents/SKILL-MECHANICS.md +32 -0
- package/skills/writing-for-agents/SKILL.md +86 -0
- package/skills/writing-for-agents/references/adrs.md +19 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.main = main;
|
|
4
|
+
exports.runShip = runShip;
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const node_os_1 = require("node:os");
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const ship_output_1 = require("./ship.output");
|
|
9
|
+
const ship_args_1 = require("./ship.args");
|
|
10
|
+
const ship_agent_1 = require("./ship.agent");
|
|
11
|
+
const ship_tracker_1 = require("./ship.tracker");
|
|
12
|
+
const ship_mr_1 = require("./ship.mr");
|
|
13
|
+
const TEXT_PREVIEW_LENGTH = 200;
|
|
14
|
+
const MAX_FIX_ATTEMPTS = 3;
|
|
15
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
16
|
+
function summarize(output) {
|
|
17
|
+
return output.slice(0, TEXT_PREVIEW_LENGTH).replace(/\n/g, " ");
|
|
18
|
+
}
|
|
19
|
+
function recoverOrphans(projectEncoded, parentIid) {
|
|
20
|
+
const allChildren = (0, ship_tracker_1.getLinkedChildren)(projectEncoded, parentIid);
|
|
21
|
+
for (const child of allChildren) {
|
|
22
|
+
if (child.labels.includes(ship_tracker_1.STATE_IN_DEV)) {
|
|
23
|
+
(0, ship_output_1.writeLine)(` ♻️ Recuperando issue huérfano #${child.iid} (in-development → ready)`);
|
|
24
|
+
(0, ship_tracker_1.resetOrphan)(child.iid);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function reportNoNextIssue(children) {
|
|
29
|
+
const hasOpen = children.some((child) => child.state === "opened");
|
|
30
|
+
if (hasOpen) {
|
|
31
|
+
(0, ship_output_1.writeLine)(" ⚠️ Todos los hijos restantes están bloqueados o no son AFK. Terminando bucle.");
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
(0, ship_output_1.writeLine)(" ✅ Todos los hijos están cerrados.");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// ── Implement loop ────────────────────────────────────────────────────────────
|
|
38
|
+
async function runChildAgent(ctx, child) {
|
|
39
|
+
const progressCtx = (0, ship_tracker_1.getIssueComments)(ctx.parentIid);
|
|
40
|
+
const tmpDir = (0, node_fs_1.mkdtempSync)((0, node_path_1.join)((0, node_os_1.tmpdir)(), "ship-ctx-"));
|
|
41
|
+
const prdFile = (0, node_path_1.join)(tmpDir, "prd.md");
|
|
42
|
+
const issueFile = (0, node_path_1.join)(tmpDir, "issue.md");
|
|
43
|
+
const progressFile = (0, node_path_1.join)(tmpDir, "progress.md");
|
|
44
|
+
(0, node_fs_1.writeFileSync)(prdFile, `# PRD — Parent Issue #${ctx.parentIid}\n\n## ${ctx.parentIssue.title}\n\n${ctx.parentIssue.description}`);
|
|
45
|
+
(0, node_fs_1.writeFileSync)(issueFile, `# Child Issue #${child.iid}: ${child.title}\n\n${child.description}`);
|
|
46
|
+
(0, node_fs_1.writeFileSync)(progressFile, `# Progress (comments from parent #${ctx.parentIid})\n\n${progressCtx || "No progress comments yet."}`);
|
|
47
|
+
try {
|
|
48
|
+
return await (0, ship_agent_1.runAgent)({
|
|
49
|
+
phase: "implement",
|
|
50
|
+
contextFiles: [prdFile, issueFile, progressFile],
|
|
51
|
+
task: `Implementa el issue hijo #${child.iid}: ${child.title}. Lee los tres archivos de contexto primero.`,
|
|
52
|
+
provider: ctx.provider,
|
|
53
|
+
model: ctx.model,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
(0, ship_output_1.writeError)(` ❌ Fallo al lanzar el sub-agente: ${error}`);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
(0, ship_agent_1.removePath)(tmpDir);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async function implementChild(ctx, child) {
|
|
65
|
+
(0, ship_output_1.printRule)();
|
|
66
|
+
(0, ship_output_1.writeLine)(` Issue hijo: #${child.iid} — ${child.title}`);
|
|
67
|
+
(0, ship_output_1.printRule)();
|
|
68
|
+
(0, ship_tracker_1.claim)(child.iid);
|
|
69
|
+
(0, ship_output_1.writeLine)(` 🔒 Reclamado #${child.iid} (state::ready → state::in-development)`);
|
|
70
|
+
const result = await runChildAgent(ctx, child);
|
|
71
|
+
if (!result) {
|
|
72
|
+
(0, ship_tracker_1.resetOrphan)(child.iid);
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (result.verdict !== "done") {
|
|
76
|
+
(0, ship_output_1.writeLine)(` ⚠️ Issue #${child.iid} sin veredicto 'done' (${result.verdict || "sin veredicto"}). Queda en in-development.`);
|
|
77
|
+
(0, ship_output_1.writeLine)(" Deteniendo el bucle para revisión manual.");
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
(0, ship_tracker_1.markDone)(child.iid, { parentIid: ctx.parentIid, summary: summarize(result.output) });
|
|
81
|
+
(0, ship_output_1.writeLine)(` ✅ Issue #${child.iid} completado.`);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
function shouldStopByIteration(ctx, iteration) {
|
|
85
|
+
if (ctx.maxIterations > 0 && iteration > ctx.maxIterations) {
|
|
86
|
+
(0, ship_output_1.writeLine)(` 🏁 Alcanzado el tope de ${ctx.maxIterations} iteraciones.`);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
async function runImplementLoop(ctx) {
|
|
92
|
+
const doneChildren = [];
|
|
93
|
+
let iteration = 0;
|
|
94
|
+
for (;;) {
|
|
95
|
+
iteration++;
|
|
96
|
+
if (shouldStopByIteration(ctx, iteration))
|
|
97
|
+
break;
|
|
98
|
+
const children = (0, ship_tracker_1.getLinkedChildren)(ctx.projectEncoded, ctx.parentIid);
|
|
99
|
+
if (children.length === 0) {
|
|
100
|
+
(0, ship_output_1.writeLine)(" No linked child issues found for parent.");
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
const nextIssue = (0, ship_tracker_1.selectNextIssue)(children);
|
|
104
|
+
if (!nextIssue) {
|
|
105
|
+
reportNoNextIssue(children);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
const completed = await implementChild(ctx, nextIssue);
|
|
109
|
+
if (completed) {
|
|
110
|
+
doneChildren.push(nextIssue);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return doneChildren;
|
|
117
|
+
}
|
|
118
|
+
// ── Review + fix phase ────────────────────────────────────────────────────────
|
|
119
|
+
async function runFixPhase(ctx, reviewOutput) {
|
|
120
|
+
(0, ship_output_1.writeLine)("");
|
|
121
|
+
(0, ship_output_1.printRule)();
|
|
122
|
+
(0, ship_output_1.writeLine)(" Fase de corrección");
|
|
123
|
+
(0, ship_output_1.printRule)();
|
|
124
|
+
for (let attempt = 1; attempt <= MAX_FIX_ATTEMPTS; attempt++) {
|
|
125
|
+
(0, ship_output_1.writeLine)(` Corrección, intento ${attempt}/${MAX_FIX_ATTEMPTS}`);
|
|
126
|
+
const fixTask = `Corrige estos hallazgos de la revisión:\n\n${reviewOutput}\n\nDeja los tests en verde y termina con un VERDICT.`;
|
|
127
|
+
const fix = await (0, ship_agent_1.runAgent)({
|
|
128
|
+
phase: "fix",
|
|
129
|
+
contextFiles: [],
|
|
130
|
+
task: fixTask,
|
|
131
|
+
provider: ctx.provider,
|
|
132
|
+
model: ctx.model,
|
|
133
|
+
});
|
|
134
|
+
if (fix.verdict === "done") {
|
|
135
|
+
(0, ship_output_1.writeLine)(` ✅ Hallazgos corregidos.`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (fix.verdict === "blocked") {
|
|
139
|
+
(0, ship_output_1.writeLine)(" ⚠️ La corrección quedó bloqueada; deteniendo.");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
(0, ship_output_1.writeLine)(" ⚠️ La corrección no terminó en verde; reintentando...");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function runReviewPhase(ctx) {
|
|
146
|
+
(0, ship_output_1.writeLine)("");
|
|
147
|
+
(0, ship_output_1.printRule)();
|
|
148
|
+
(0, ship_output_1.writeLine)(" Fase de revisión");
|
|
149
|
+
(0, ship_output_1.printRule)();
|
|
150
|
+
const prdFile = (0, node_path_1.join)((0, node_os_1.tmpdir)(), "ship-prd.md");
|
|
151
|
+
(0, node_fs_1.writeFileSync)(prdFile, `# PRD — Parent Issue #${ctx.parentIid}\n\n## ${ctx.parentIssue.title}\n\n${ctx.parentIssue.description}`);
|
|
152
|
+
const reviewTask = `Revisa el diff del working tree contra el PRD (lee el archivo de contexto) y los ADRs. Reporta hallazgos y un VERDICT.`;
|
|
153
|
+
const review = await (0, ship_agent_1.runAgent)({
|
|
154
|
+
phase: "review",
|
|
155
|
+
contextFiles: [prdFile],
|
|
156
|
+
task: reviewTask,
|
|
157
|
+
provider: ctx.provider,
|
|
158
|
+
model: ctx.model,
|
|
159
|
+
});
|
|
160
|
+
(0, ship_agent_1.removePath)(prdFile);
|
|
161
|
+
if (review.verdict !== "issues") {
|
|
162
|
+
(0, ship_output_1.writeLine)(` ✅ Revisión limpia (verdict: ${review.verdict || "n/a"}).`);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
await runFixPhase(ctx, review.output);
|
|
166
|
+
}
|
|
167
|
+
// ── Main ──────────────────────────────────────────────────────────────────────
|
|
168
|
+
function printStartupHeader(args) {
|
|
169
|
+
(0, ship_output_1.writeLine)(`Provider: ${args.provider}`);
|
|
170
|
+
(0, ship_output_1.writeLine)(`Model: ${args.model}`);
|
|
171
|
+
(0, ship_output_1.writeLine)(`Parent issue IID: ${args.parentIid}`);
|
|
172
|
+
(0, ship_output_1.writeLine)("");
|
|
173
|
+
}
|
|
174
|
+
function loadParentIssue(parentIid) {
|
|
175
|
+
const parentIssue = (0, ship_tracker_1.getIssue)(parentIid);
|
|
176
|
+
if (parentIssue.state !== "opened") {
|
|
177
|
+
(0, ship_output_1.writeError)(`Error: parent issue #${parentIid} is ${parentIssue.state} (must be 'opened').`);
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
(0, ship_output_1.writeLine)(`PRD: ${parentIssue.title}`);
|
|
181
|
+
(0, ship_output_1.writeLine)("");
|
|
182
|
+
return parentIssue;
|
|
183
|
+
}
|
|
184
|
+
async function main(args) {
|
|
185
|
+
printStartupHeader(args);
|
|
186
|
+
(0, ship_tracker_1.verifyAuth)();
|
|
187
|
+
const project = (0, ship_tracker_1.getProjectPath)();
|
|
188
|
+
const projectEncoded = (0, ship_tracker_1.encodeProjectPath)(project);
|
|
189
|
+
(0, ship_output_1.writeLine)(`Project: ${project}`);
|
|
190
|
+
(0, ship_output_1.writeLine)("");
|
|
191
|
+
const parentIssue = loadParentIssue(args.parentIid);
|
|
192
|
+
recoverOrphans(projectEncoded, args.parentIid);
|
|
193
|
+
const ctx = {
|
|
194
|
+
parentIid: args.parentIid,
|
|
195
|
+
provider: args.provider,
|
|
196
|
+
model: args.model,
|
|
197
|
+
maxIterations: args.maxIterations,
|
|
198
|
+
targetBranch: args.targetBranch,
|
|
199
|
+
projectEncoded,
|
|
200
|
+
parentIssue,
|
|
201
|
+
};
|
|
202
|
+
const doneChildren = await runImplementLoop(ctx);
|
|
203
|
+
if (doneChildren.length === 0) {
|
|
204
|
+
(0, ship_output_1.writeLine)("");
|
|
205
|
+
(0, ship_output_1.writeLine)(" No se completó ningún hijo — no hay diff que revisar.");
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
await runReviewPhase(ctx);
|
|
209
|
+
await (0, ship_mr_1.openMergeRequest)(ctx);
|
|
210
|
+
}
|
|
211
|
+
async function runShip(argv) {
|
|
212
|
+
const args = (0, ship_args_1.parseArgv)(argv);
|
|
213
|
+
await main(args);
|
|
214
|
+
}
|
|
215
|
+
if (require.main === module) {
|
|
216
|
+
runShip(process.argv.slice(2)).catch((error) => {
|
|
217
|
+
(0, ship_output_1.writeError)(`Fatal error: ${error}`);
|
|
218
|
+
process.exit(1);
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=ship.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.js","sourceRoot":"","sources":["../../src/ship/ship.ts"],"names":[],"mappings":";;AA8NA,oBAiCC;AAED,0BAGC;AApQD,yCAAiC;AACjC,qCAAiC;AACjC,qCAAqD;AACrD,+CAAiE;AACjE,2CAAyD;AACzD,6CAAsE;AACtE,iDAawB;AAExB,uCAA6C;AAE7C,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,iFAAiF;AAEjF,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,cAAc,CAAC,cAAsB,EAAE,SAAiB;IAC/D,MAAM,WAAW,GAAG,IAAA,gCAAiB,EAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACjE,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,2BAAY,CAAC,EAAE,CAAC;YACxC,IAAA,uBAAS,EAAC,qCAAqC,KAAK,CAAC,GAAG,2BAA2B,CAAC,CAAC;YACrF,IAAA,0BAAW,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAiB;IAC1C,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;IACnE,IAAI,OAAO,EAAE,CAAC;QACZ,IAAA,uBAAS,EAAC,kFAAkF,CAAC,CAAC;IAChG,CAAC;SAAM,CAAC;QACN,IAA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,IAAA,qBAAS,EAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7C,IAAA,wBAAU,EAAC,gBAAgB,KAAK,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ShipContext } from "./ship.context";
|
|
2
|
+
export declare function openMrIid(mrs: unknown): number | null;
|
|
3
|
+
export declare function findOpenMr(branch: string, targetBranch: string): number | null;
|
|
4
|
+
export declare function prepareBranchAndCommit(parentIid: number, targetBranch: string): string;
|
|
5
|
+
/** Un repo sin script `lint` no tiene gate de forma que aplicar. */
|
|
6
|
+
export declare function isMissingLintScript(output: string): boolean;
|
|
7
|
+
export declare function runLintGate(): boolean;
|
|
8
|
+
export declare function openMergeRequest(ctx: ShipContext): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=ship.mr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.mr.d.ts","sourceRoot":"","sources":["../../src/ship/ship.mr.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoBlD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKrD;AAGD,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAY9E;AAoCD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAetF;AAID,oEAAoE;AACpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,wBAAgB,WAAW,IAAI,OAAO,CAcrC;AA0BD,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCtE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.openMrIid = openMrIid;
|
|
4
|
+
exports.findOpenMr = findOpenMr;
|
|
5
|
+
exports.prepareBranchAndCommit = prepareBranchAndCommit;
|
|
6
|
+
exports.isMissingLintScript = isMissingLintScript;
|
|
7
|
+
exports.runLintGate = runLintGate;
|
|
8
|
+
exports.openMergeRequest = openMergeRequest;
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const ship_output_1 = require("./ship.output");
|
|
11
|
+
const ship_tracker_1 = require("./ship.tracker");
|
|
12
|
+
const PROTECTED_BRANCHES = ["develop", "main", "master"];
|
|
13
|
+
const MR_TITLE_LENGTH = 72;
|
|
14
|
+
const GIT_TIMEOUT_MS = 60000;
|
|
15
|
+
const GIT_PUSH_TIMEOUT_MS = 180000;
|
|
16
|
+
const LINT_TIMEOUT_MS = 180000;
|
|
17
|
+
// Falla rápido en vez de colgarse esperando credenciales: desactiva el askpass
|
|
18
|
+
// (p. ej. el de VS Code) y el prompt de terminal. Las credenciales deben venir
|
|
19
|
+
// de un helper configurado (`git config --global credential.helper '!glab auth git-credential'`).
|
|
20
|
+
const GIT_NO_PROMPT_PREFIX = "unset GIT_ASKPASS SSH_ASKPASS; GIT_TERMINAL_PROMPT=0";
|
|
21
|
+
// Decide si hay un MR abierto para un par origen→destino. Puro: recibe la lista
|
|
22
|
+
// ya parseada de `glab mr list` y devuelve el iid del primer MR, o null.
|
|
23
|
+
function openMrIid(mrs) {
|
|
24
|
+
if (!Array.isArray(mrs))
|
|
25
|
+
return null;
|
|
26
|
+
const first = mrs[0];
|
|
27
|
+
const iid = first?.iid;
|
|
28
|
+
return typeof iid === "number" ? iid : null;
|
|
29
|
+
}
|
|
30
|
+
// Consulta el tracker por un MR abierto para `branch` → `targetBranch`.
|
|
31
|
+
function findOpenMr(branch, targetBranch) {
|
|
32
|
+
const mrs = (0, ship_tracker_1.glabJson)([
|
|
33
|
+
"mr",
|
|
34
|
+
"list",
|
|
35
|
+
"--source-branch",
|
|
36
|
+
branch,
|
|
37
|
+
"--target-branch",
|
|
38
|
+
targetBranch,
|
|
39
|
+
"--output",
|
|
40
|
+
"json",
|
|
41
|
+
]);
|
|
42
|
+
return openMrIid(mrs);
|
|
43
|
+
}
|
|
44
|
+
function commitShip(parentIid) {
|
|
45
|
+
try {
|
|
46
|
+
(0, node_child_process_1.execSync)(`git commit -m "chore: ship #${parentIid}"`, {
|
|
47
|
+
encoding: "utf-8",
|
|
48
|
+
shell: "/bin/bash",
|
|
49
|
+
timeout: GIT_TIMEOUT_MS,
|
|
50
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const message = String(error);
|
|
55
|
+
if (!/nothing to commit/i.test(message)) {
|
|
56
|
+
(0, ship_output_1.writeError)(` ❌ git commit falló: ${message}`);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
// nothing to commit — still fine
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function pushBranch() {
|
|
63
|
+
try {
|
|
64
|
+
(0, node_child_process_1.execSync)(`${GIT_NO_PROMPT_PREFIX} git push -u origin HEAD`, {
|
|
65
|
+
encoding: "utf-8",
|
|
66
|
+
shell: "/bin/bash",
|
|
67
|
+
timeout: GIT_PUSH_TIMEOUT_MS,
|
|
68
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
(0, ship_output_1.writeError)(" ❌ git push falló. Verifica la autenticación de git:");
|
|
73
|
+
(0, ship_output_1.writeError)(" git config --global credential.helper '!glab auth git-credential'");
|
|
74
|
+
(0, ship_output_1.writeError)(` Detalle: ${error}`);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function prepareBranchAndCommit(parentIid, targetBranch) {
|
|
79
|
+
const current = (0, node_child_process_1.execSync)("git branch --show-current", { encoding: "utf-8", timeout: GIT_TIMEOUT_MS }).trim();
|
|
80
|
+
let branch = current;
|
|
81
|
+
if (PROTECTED_BRANCHES.includes(current)) {
|
|
82
|
+
branch = `feat/ship-${parentIid}`;
|
|
83
|
+
(0, node_child_process_1.execSync)(`git checkout -b ${branch}`, { encoding: "utf-8", shell: "/bin/bash", timeout: GIT_TIMEOUT_MS });
|
|
84
|
+
(0, ship_output_1.writeLine)(` 🌿 Creada rama ${branch} (no se trabaja directo sobre ${current})`);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
(0, ship_output_1.writeLine)(` 🌿 Rama actual: ${branch} (target: ${targetBranch})`);
|
|
88
|
+
}
|
|
89
|
+
(0, node_child_process_1.execSync)("git add -A", { encoding: "utf-8", shell: "/bin/bash", timeout: GIT_TIMEOUT_MS });
|
|
90
|
+
commitShip(parentIid);
|
|
91
|
+
pushBranch();
|
|
92
|
+
return branch;
|
|
93
|
+
}
|
|
94
|
+
// ── Lint gate (A-045/A-046) ──────────────────────────────────────────────
|
|
95
|
+
/** Un repo sin script `lint` no tiene gate de forma que aplicar. */
|
|
96
|
+
function isMissingLintScript(output) {
|
|
97
|
+
return /Missing script/i.test(output);
|
|
98
|
+
}
|
|
99
|
+
function runLintGate() {
|
|
100
|
+
try {
|
|
101
|
+
(0, node_child_process_1.execSync)("npm run lint", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], timeout: LINT_TIMEOUT_MS });
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
// A-049: la ausencia de linter es un warning, no un fallo; un fallo de lint real sí bloquea.
|
|
106
|
+
const failure = error;
|
|
107
|
+
const output = `${String(failure.stdout ?? "")}${String(failure.stderr ?? "")}`;
|
|
108
|
+
if (isMissingLintScript(output)) {
|
|
109
|
+
(0, ship_output_1.writeLine)(" ⚠️ Sin script `lint` — se omite el gate de forma (A-045/A-046).");
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// ── Merge request (one per parent, A-033) ───────────────────────────────────
|
|
116
|
+
function buildMrBody(ctx, completedIds) {
|
|
117
|
+
const closesList = [`#${ctx.parentIid}`, ...completedIds.map((id) => `#${id}`)].join(" ");
|
|
118
|
+
return [
|
|
119
|
+
`## Contexto`,
|
|
120
|
+
``,
|
|
121
|
+
`Implementa el spec #${ctx.parentIid}: ${ctx.parentIssue.title}.`,
|
|
122
|
+
``,
|
|
123
|
+
`Hijos implementados: ${completedIds.map((id) => `#${id}`).join(", ")}.`,
|
|
124
|
+
``,
|
|
125
|
+
`Closes: ${closesList}`,
|
|
126
|
+
].join("\n");
|
|
127
|
+
}
|
|
128
|
+
function createMergeRequest(ctx, payload) {
|
|
129
|
+
try {
|
|
130
|
+
(0, ship_tracker_1.glabExec)(["mr", "create", "--title", payload.subject, "--description", payload.body, "--target-branch", ctx.targetBranch, "--yes"]);
|
|
131
|
+
(0, ship_output_1.writeLine)(` ✅ Merge request abierto (título: "${payload.subject}").`);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
(0, ship_output_1.writeError)(` ❌ No se pudo abrir el MR: ${error}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function openMergeRequest(ctx) {
|
|
138
|
+
(0, ship_output_1.writeLine)("");
|
|
139
|
+
(0, ship_output_1.printRule)();
|
|
140
|
+
(0, ship_output_1.writeLine)(" Abriendo merge request");
|
|
141
|
+
(0, ship_output_1.printRule)();
|
|
142
|
+
// Lint gate: el MR no se abre si el guardrail de forma (A-045/A-046) falla.
|
|
143
|
+
(0, ship_output_1.writeLine)(" Verificando lint (A-045/A-046)...");
|
|
144
|
+
if (!runLintGate()) {
|
|
145
|
+
(0, ship_output_1.writeError)(" ❌ Lint falló — corrige los errores de forma antes de abrir el MR.");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let branch;
|
|
149
|
+
try {
|
|
150
|
+
branch = prepareBranchAndCommit(ctx.parentIid, ctx.targetBranch);
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
(0, ship_output_1.writeError)(" ❌ No se pudo preparar/empujar la rama; se omite la apertura del MR.");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// Derive completed children from the tracker (crash-resilient): if this run
|
|
157
|
+
// was resumed after an earlier crash, the in-memory doneChildren only holds
|
|
158
|
+
// the children completed in THIS run, but the MR must reflect every
|
|
159
|
+
// state::completed child so Closes lists them all.
|
|
160
|
+
const completedIds = (0, ship_tracker_1.getLinkedChildren)(ctx.projectEncoded, ctx.parentIid)
|
|
161
|
+
.filter((child) => child.labels.includes(ship_tracker_1.STATE_COMPLETED))
|
|
162
|
+
.map((child) => child.iid);
|
|
163
|
+
const subject = `feat: ${ctx.parentIssue.title}`.slice(0, MR_TITLE_LENGTH);
|
|
164
|
+
const existingMrIid = findOpenMr(branch, ctx.targetBranch);
|
|
165
|
+
if (existingMrIid !== null) {
|
|
166
|
+
(0, ship_output_1.writeLine)(` ♻️ Ya existe MR !${existingMrIid} para ${branch} → ${ctx.targetBranch}; se omite la creación.`);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
createMergeRequest(ctx, { subject, body: buildMrBody(ctx, completedIds) });
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=ship.mr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.mr.js","sourceRoot":"","sources":["../../src/ship/ship.mr.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YAAY,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Salida del pipeline ship. Reemplaza `console.log`/`console.error` por
|
|
3
|
+
* escrituras directas a stdout/stderr para cumplir `no-console` (A-047) sin
|
|
4
|
+
* cambiar el comportamiento observable del orquestador.
|
|
5
|
+
*/
|
|
6
|
+
export declare function writeLine(text: string): void;
|
|
7
|
+
export declare function writeError(text: string): void;
|
|
8
|
+
export declare function printRule(): void;
|
|
9
|
+
//# sourceMappingURL=ship.output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.output.d.ts","sourceRoot":"","sources":["../../src/ship/ship.output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,SAAS,IAAI,IAAI,CAEhC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Salida del pipeline ship. Reemplaza `console.log`/`console.error` por
|
|
4
|
+
* escrituras directas a stdout/stderr para cumplir `no-console` (A-047) sin
|
|
5
|
+
* cambiar el comportamiento observable del orquestador.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.writeLine = writeLine;
|
|
9
|
+
exports.writeError = writeError;
|
|
10
|
+
exports.printRule = printRule;
|
|
11
|
+
const RULE_WIDTH = 80;
|
|
12
|
+
function writeLine(text) {
|
|
13
|
+
process.stdout.write(`${text}\n`);
|
|
14
|
+
}
|
|
15
|
+
function writeError(text) {
|
|
16
|
+
process.stderr.write(`${text}\n`);
|
|
17
|
+
}
|
|
18
|
+
function printRule() {
|
|
19
|
+
writeLine("═".repeat(RULE_WIDTH));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ship.output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.output.js","sourceRoot":"","sources":["../../src/ship/ship.output.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAIH,8BAEC;AAED,gCAEC;AAED,8BAEC;AAZD,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAgB,SAAS;IACvB,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const STATE_READY = "state::ready";
|
|
2
|
+
export declare const STATE_IN_DEV = "state::in-development";
|
|
3
|
+
export declare const STATE_COMPLETED = "state::completed";
|
|
4
|
+
export declare const EXEC_AFK = "exec::AFK";
|
|
5
|
+
export interface Issue {
|
|
6
|
+
iid: number;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
state: string;
|
|
10
|
+
labels: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare function glab(args: string[]): string;
|
|
13
|
+
export declare function glabJson(args: string[]): unknown;
|
|
14
|
+
export declare function glabExec(args: string[]): string;
|
|
15
|
+
export declare function verifyAuth(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Extrae el path completo del proyecto (`namespace/proyecto`) de un remote de git.
|
|
18
|
+
* Conserva todos los segmentos del namespace —los grupos anidados no se truncan—
|
|
19
|
+
* y soporta HTTPS, `ssh://` y la forma SCP (`git@host:path`).
|
|
20
|
+
*/
|
|
21
|
+
export declare function projectPathFromRemote(remote: string): string;
|
|
22
|
+
export declare function getProjectPath(): string;
|
|
23
|
+
export declare function encodeProjectPath(project: string): string;
|
|
24
|
+
export declare function getIssue(iid: number): Issue;
|
|
25
|
+
export declare function getIssueComments(iid: number): string;
|
|
26
|
+
export declare function getLinkedChildren(projectEncoded: string, parentIid: number): Issue[];
|
|
27
|
+
export declare function extractBlockers(description: string): number[];
|
|
28
|
+
export declare function isBlocked(issue: Issue, fetchIssue?: (iid: number) => Issue): boolean;
|
|
29
|
+
export declare function isReady(child: Issue): boolean;
|
|
30
|
+
export declare function selectNextIssue(children: Issue[], fetchIssue?: (iid: number) => Issue): Issue | null;
|
|
31
|
+
export declare function claim(iid: number): void;
|
|
32
|
+
export declare function markDone(iid: number, context: {
|
|
33
|
+
parentIid: number;
|
|
34
|
+
summary: string;
|
|
35
|
+
}): void;
|
|
36
|
+
export declare function resetOrphan(iid: number): void;
|
|
37
|
+
//# sourceMappingURL=ship.tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ship.tracker.d.ts","sourceRoot":"","sources":["../../src/ship/ship.tracker.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAC1C,eAAO,MAAM,YAAY,0BAA0B,CAAC;AACpD,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,QAAQ,cAAc,CAAC;AAMpC,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAwBD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAO3C;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAUhD;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,G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