@tacuchi/agent-workflow-cli 21.16.0 → 22.0.0
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 +4 -16
- package/dist/adapters/git-cli.js +36 -0
- package/dist/adapters/git-cli.js.map +1 -1
- package/dist/application/capability/design-handler.js +472 -177
- package/dist/application/capability/design-handler.js.map +1 -1
- package/dist/application/capability/dispatcher.js +1 -1
- package/dist/application/capability/dispatcher.js.map +1 -1
- package/dist/application/capability/durable-effect.js +1 -1
- package/dist/application/capability/durable-effect.js.map +1 -1
- package/dist/application/check-branch-service.js +1 -0
- package/dist/application/check-branch-service.js.map +1 -1
- package/dist/application/checkpoint-service.js +4 -3
- package/dist/application/checkpoint-service.js.map +1 -1
- package/dist/application/design/consumer-document.js +179 -0
- package/dist/application/design/consumer-document.js.map +1 -0
- package/dist/application/design/design-content-gate-service.js +9 -1
- package/dist/application/design/design-content-gate-service.js.map +1 -1
- package/dist/application/design/design-gate-service.js +18 -1
- package/dist/application/design/design-gate-service.js.map +1 -1
- package/dist/application/design/design-index-service.js +22 -3
- package/dist/application/design/design-index-service.js.map +1 -1
- package/dist/application/design/design-publish-service.js +44 -136
- package/dist/application/design/design-publish-service.js.map +1 -1
- package/dist/application/design/design-simple-service.js +38 -24
- package/dist/application/design/design-simple-service.js.map +1 -1
- package/dist/application/dev-only-services.js +19 -12
- package/dist/application/dev-only-services.js.map +1 -1
- package/dist/application/docs-canon-service.js +79 -5
- package/dist/application/docs-canon-service.js.map +1 -1
- package/dist/application/dsn-reader-service.js +12 -47
- package/dist/application/dsn-reader-service.js.map +1 -1
- package/dist/application/export-service.js +20 -11
- package/dist/application/export-service.js.map +1 -1
- package/dist/application/flow/flow-service.js +25 -0
- package/dist/application/flow/flow-service.js.map +1 -1
- package/dist/application/flow/internal-actions.js +5 -0
- package/dist/application/flow/internal-actions.js.map +1 -1
- package/dist/application/flow/submit.js +152 -22
- package/dist/application/flow/submit.js.map +1 -1
- package/dist/application/history-table.js +82 -44
- package/dist/application/history-table.js.map +1 -1
- package/dist/application/history-update-service.js +19 -9
- package/dist/application/history-update-service.js.map +1 -1
- package/dist/application/hook-git-commit-advisor.js +5 -4
- package/dist/application/hook-git-commit-advisor.js.map +1 -1
- package/dist/application/hook-sql-mutation-guard.js +1 -1
- package/dist/application/hook-sql-mutation-guard.js.map +1 -1
- package/dist/application/lifecycle-target.js +1 -0
- package/dist/application/lifecycle-target.js.map +1 -1
- package/dist/application/local-proposal.js +47 -23
- package/dist/application/local-proposal.js.map +1 -1
- package/dist/application/mcp-connections-service.js +37 -2
- package/dist/application/mcp-connections-service.js.map +1 -1
- package/dist/application/mcp-dbhub-launcher.js +22 -50
- package/dist/application/mcp-dbhub-launcher.js.map +1 -1
- package/dist/application/mcp-doctor-service.js +14 -23
- package/dist/application/mcp-doctor-service.js.map +1 -1
- package/dist/application/mcp-remove-service.js +3 -3
- package/dist/application/mcp-remove-service.js.map +1 -1
- package/dist/application/mcp-setup-service.js +4 -4
- package/dist/application/mcp-setup-service.js.map +1 -1
- package/dist/application/mcp-test-connection-service.js +4 -6
- package/dist/application/mcp-test-connection-service.js.map +1 -1
- package/dist/application/parsers/phases.js +17 -5
- package/dist/application/parsers/phases.js.map +1 -1
- package/dist/application/parsers/project-block.js +5 -11
- package/dist/application/parsers/project-block.js.map +1 -1
- package/dist/application/parsers/sessions-csv.js +16 -14
- package/dist/application/parsers/sessions-csv.js.map +1 -1
- package/dist/application/parsers/spec-relation.js +15 -11
- package/dist/application/parsers/spec-relation.js.map +1 -1
- package/dist/application/parsers/tasks.js +25 -1
- package/dist/application/parsers/tasks.js.map +1 -1
- package/dist/application/persist-service.js +67 -29
- package/dist/application/persist-service.js.map +1 -1
- package/dist/application/plugin-doctor/skills.js +1 -40
- package/dist/application/plugin-doctor/skills.js.map +1 -1
- package/dist/application/plugin-doctor-service.js +1 -3
- package/dist/application/plugin-doctor-service.js.map +1 -1
- package/dist/application/release-data/artifacts.js +1 -0
- package/dist/application/release-data/artifacts.js.map +1 -1
- package/dist/application/release-data/bundles.js +15 -6
- package/dist/application/release-data/bundles.js.map +1 -1
- package/dist/application/release-data/common.js +16 -7
- package/dist/application/release-data/common.js.map +1 -1
- package/dist/application/release-data/sessions.js +36 -8
- package/dist/application/release-data/sessions.js.map +1 -1
- package/dist/application/render/project-block.js +2 -2
- package/dist/application/render/project-block.js.map +1 -1
- package/dist/application/resume-service.js +9 -1
- package/dist/application/resume-service.js.map +1 -1
- package/dist/application/retirement/graph.js +14 -13
- package/dist/application/retirement/graph.js.map +1 -1
- package/dist/application/retirement/prepare.js +15 -2
- package/dist/application/retirement/prepare.js.map +1 -1
- package/dist/application/retirement/resolve.js.map +1 -1
- package/dist/application/self/clean-legacy.js +2 -4
- package/dist/application/self/clean-legacy.js.map +1 -1
- package/dist/application/self/mcp-config.js +8 -9
- package/dist/application/self/mcp-config.js.map +1 -1
- package/dist/application/session-close-service.js +8 -2
- package/dist/application/session-close-service.js.map +1 -1
- package/dist/application/session-create-service.js +26 -14
- package/dist/application/session-create-service.js.map +1 -1
- package/dist/application/session-resolver.js +80 -34
- package/dist/application/session-resolver.js.map +1 -1
- package/dist/application/session-resume-service.js +4 -3
- package/dist/application/session-resume-service.js.map +1 -1
- package/dist/application/source-boundary-policy.js +483 -0
- package/dist/application/source-boundary-policy.js.map +1 -0
- package/dist/application/status-service.js +1 -0
- package/dist/application/status-service.js.map +1 -1
- package/dist/application/workline-index-service.js +42 -20
- package/dist/application/workline-index-service.js.map +1 -1
- package/dist/application/workspace-migrate/apply.js +2 -4
- package/dist/application/workspace-migrate/apply.js.map +1 -1
- package/dist/application/workspace-migrate/plan.js +9 -6
- package/dist/application/workspace-migrate/plan.js.map +1 -1
- package/dist/application/workspace-migrate/preview.js +3 -3
- package/dist/application/workspace-migrate/preview.js.map +1 -1
- package/dist/application/worktree-service.js +3 -0
- package/dist/application/worktree-service.js.map +1 -1
- package/dist/cli/commands/capability.js +124 -5
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/cli/commands/designs.js +2 -6
- package/dist/cli/commands/designs.js.map +1 -1
- package/dist/cli/commands/dev-only.js +1 -1
- package/dist/cli/commands/dev-only.js.map +1 -1
- package/dist/cli/commands/flow.js +3 -1
- package/dist/cli/commands/flow.js.map +1 -1
- package/dist/cli/commands/index.js +0 -2
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/mcp.js +53 -55
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/persist.js +27 -21
- package/dist/cli/commands/persist.js.map +1 -1
- package/dist/cli/commands/resume.js +2 -2
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/session-create.js +2 -1
- package/dist/cli/commands/session-create.js.map +1 -1
- package/dist/cli/help-groups.js +0 -1
- package/dist/cli/help-groups.js.map +1 -1
- package/dist/cli/main.js +0 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/parser.js +1 -0
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/tui/data/recommended-skills.js +2 -2
- package/dist/cli/tui/data/recommended-skills.js.map +1 -1
- package/dist/cli/tui/tabs/mcp-tab-helpers.js +1 -1
- package/dist/cli/tui/tabs/mcp-tab.js +2 -2
- package/dist/cli/tui/tabs/mcp-tab.js.map +1 -1
- package/dist/domain/capability/protocol.js.map +1 -1
- package/dist/domain/correlative.js +121 -0
- package/dist/domain/correlative.js.map +1 -0
- package/dist/domain/design/capability.js +37 -3
- package/dist/domain/design/capability.js.map +1 -1
- package/dist/domain/design/direct.js.map +1 -1
- package/dist/domain/design/simple.js +33 -1
- package/dist/domain/design/simple.js.map +1 -1
- package/dist/domain/docs-canon.js +31 -0
- package/dist/domain/docs-canon.js.map +1 -0
- package/dist/domain/flow/answer.js +57 -1
- package/dist/domain/flow/answer.js.map +1 -1
- package/dist/domain/flow/authority.js +28 -29
- package/dist/domain/flow/authority.js.map +1 -1
- package/dist/domain/flow/execution-result.js +13 -1
- package/dist/domain/flow/execution-result.js.map +1 -1
- package/dist/domain/flow/run-state.js.map +1 -1
- package/dist/domain/mcp-entry.js +7 -12
- package/dist/domain/mcp-entry.js.map +1 -1
- package/dist/domain/retirement/selector.js +16 -14
- package/dist/domain/retirement/selector.js.map +1 -1
- package/dist/domain/source-boundary.js +3 -0
- package/dist/domain/source-boundary.js.map +1 -0
- package/dist/domain/workline-node.js +12 -5
- package/dist/domain/workline-node.js.map +1 -1
- package/dist/runtime/namespace-resolver.js +0 -3
- package/dist/runtime/namespace-resolver.js.map +1 -1
- package/package.json +5 -5
- package/skills/w/SKILL.md +2 -2
- package/skills/w/artifacts/artifacts-core/SCRIPTS.sql +14 -9
- package/skills/w/artifacts/artifacts-research/CONCLUSIONS.md +7 -0
- package/skills/w/commands/export-scripts.md +8 -2
- package/skills/w/commands/plan-new.md +1 -0
- package/skills/w/context/MANIFEST.json +2 -9
- package/skills/w/exports/export-scripts/EXPORT.md +13 -9
- package/skills/w/loops/CHASSIS.md +1 -1
- package/skills/w/loops/plan-exec-loop/LOOP.md +14 -10
- package/skills/w/loops/plan-new-loop/LOOP.md +16 -16
- package/skills/w/loops/plan-refine-loop/LOOP.md +6 -1
- package/skills/w/loops/quick-loop/LOOP.md +2 -2
- package/skills/w/loops/spec-refine-loop/LOOP.md +4 -0
- package/skills/w/modules/DB-RESEARCH-RULE.md +5 -5
- package/skills/w/modules/DB-SCRIPTS-ONLY.md +5 -6
- package/skills/w/modules/EXEC-DB-POLICY.md +2 -2
- package/skills/w/modules/PLAN-INPUT.md +11 -9
- package/skills/w/roles/sql/ROLE.md +9 -9
- package/dist/application/decisiones-service.js +0 -31
- package/dist/application/decisiones-service.js.map +0 -1
- package/dist/application/dev-bootstrap-dsn-service.js +0 -76
- package/dist/application/dev-bootstrap-dsn-service.js.map +0 -1
- package/dist/application/profile/profile-service.js +0 -199
- package/dist/application/profile/profile-service.js.map +0 -1
- package/dist/application/tasks-service.js +0 -45
- package/dist/application/tasks-service.js.map +0 -1
- package/dist/cli/commands/bootstrap-dsn.js +0 -16
- package/dist/cli/commands/bootstrap-dsn.js.map +0 -1
- package/dist/cli/tui/components/process-list.js +0 -43
- package/dist/cli/tui/components/process-list.js.map +0 -1
|
@@ -52,7 +52,7 @@ Read **[`../CHASSIS.md`](../CHASSIS.md)** — the loop's **full engine** — **a
|
|
|
52
52
|
|
|
53
53
|
- **No phases, no plan-doc**: the prompt **is** the task (a single unit). No roadmap.
|
|
54
54
|
- **Proportional verification-first** (minimal ceremony): even here the check is **seeded before**, sized to the task. Code: one test (bug repro → fix) or "existing build/lint/tests stay green" (chore). **Analysis/design**: a **short falsifiable rubric**, *ratified by the user* before pursuing it. It is the run's `SESSION.Success criteria` (see [chassis § *Verification-first*](../CHASSIS.md)).
|
|
55
|
-
- **Git and DB inline** (full policies in [`../CODE-POLICIES.md`](../CODE-POLICIES.md)): before editing, verify each source's expected branch (`aw check-branch`); **proposed** commit (approve first) — never `push`/`--amend`/`--no-verify`. The AI **never executes DML/DDL**: migrations are drafted into the session's `SCRIPTS.sql
|
|
55
|
+
- **Git and DB inline** (full policies in [`../CODE-POLICIES.md`](../CODE-POLICIES.md)): before editing, verify each source's expected branch (`aw check-branch`); **proposed** commit (approve first) — never `push`/`--amend`/`--no-verify`. The AI **never executes DML/DDL**: migrations are drafted into the session's `SCRIPTS.sql`; fixture/ephemeral checks are local proof and any remote read is research context, never closure.
|
|
56
56
|
- **One session. One commit** proposed at the end (only if there were code changes), **after the proportional closing review gate** ([`../CODE-POLICIES.md`](../CODE-POLICIES.md) § *Closing review gate*): diff re-read + ambient conventions; fix or defer; nothing reaches the commit unreviewed.
|
|
57
57
|
- **Entry SIZE GATE** (before creating the session): a quick that should have been a spec costs more than the ceremony it saved, so the size of the objective is judged **before** anything exists. Your part is recognizing the signals; the threshold, the question and its options are the CLI's. A signal already resolved by *adopted context* is **not** a signal (chassis § *Adopted context*). A **resume** of an existing quick never re-fires it.
|
|
58
58
|
- **`Recortar alcance`**, if chosen: propose the **sub-task that DOES fit** a quick (`SESSION.Objective` = the sub-task; the original prompt goes into `## Origin`) and defer the rest to `BACKLOG` ("trimmed at the gate — may warrant its own spec, `/w:spec-new`").
|
|
@@ -81,7 +81,7 @@ quick-loop(prompt):
|
|
|
81
81
|
work the task (minimal loop):
|
|
82
82
|
if it edits code → verify each source's expected branch (`aw check-branch`); mismatch → pause + resolve
|
|
83
83
|
produce the deliverable: edit code (minimal change) OR author the analysis/design
|
|
84
|
-
if
|
|
84
|
+
if fixture/ephemeral DB check → run it from the checkout + capture its proof
|
|
85
85
|
if DB change (DDL/DML) → SCRIPTS.sql (session artifact, DO NOT execute)
|
|
86
86
|
if non-obvious decision → DECISION
|
|
87
87
|
if doubt/gap → inline research, a probe OR structured-choice # chassis § Proof of concept
|
|
@@ -70,6 +70,9 @@ The **UI unspecified** gap (when the requirement involves UI; see *Gap taxonomy*
|
|
|
70
70
|
|
|
71
71
|
> **Two levels of the same capability:** a compact SPEC may already close its exact roots at `handoff`; otherwise SPEC keeps an `outline` reference and PLAN promotes exactly the closure it implements. A valid handoff is reused, never re-authored. One package, two questions — never two formats.
|
|
72
72
|
|
|
73
|
+
> **Compound publication:** a new baseline carries this final spec as `consumer_document`
|
|
74
|
+
> (path + base digest); package, manifest and spec publish or roll back together.
|
|
75
|
+
|
|
73
76
|
Other transversal capabilities the engine always uses: `research` (**inline** — chassis § *Research*), `sql` (DB rule inside research — chassis). All resolved by config; `off` → the loop continues without the capability and, if it was needed, says so or asks. The spec's **prose** follows the **ambient** writing conventions (the host auto-applies an installed writing skill if present), not a composed role.
|
|
74
77
|
|
|
75
78
|
> **Ambient conventions (not roles):** code/testing/writing standards and `creating-tools` are standalone skills the host auto-discovers by `description` — Workline neither binds nor depends on them. Full doctrine: [../../roles/README.md](../../roles/README.md).
|
|
@@ -224,6 +227,7 @@ finalize:
|
|
|
224
227
|
- every **blocking** functional decision is resolved, and every remaining question carries its destination;
|
|
225
228
|
- **Minimality** — no gold-plating: every criterion and scope item earns its place (chassis § *Minimality*); speculative scope is cut or deferred, and no technical solution was imposed that the requirement did not ask for;
|
|
226
229
|
- `PLAN` can continue without inventing behavior, scope or product decisions.
|
|
230
|
+
- its gate evidence is checkout-bounded: local inspection/commands may establish it; a deployed product, host runtime or remote query is context or handoff, never a closing condition.
|
|
227
231
|
- Whatever fails **comes back as a gap**. A question owned by `PLAN` **never** fails the gate: it is recorded with its destination, not closed.
|
|
228
232
|
- Passes → `edit_in_place_with_confirm(spec)` + `status: ready-for-plan` → `finalize`. The stamp only counts once the document really carries it.
|
|
229
233
|
- `Cerrar` → the chassis `finalize` (always persists `CHECKPOINT`; `BACKLOG` **only if** something is deferred — here: close reason + deferred `Open questions`).
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Loaded when the run reads or writes a database (signal `db`).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Research is autonomous except for DB choice. A remote read is context, never plan-execution proof.
|
|
6
6
|
|
|
7
|
-
1.
|
|
8
|
-
2. Write
|
|
9
|
-
3.
|
|
7
|
+
1. With >1 candidate MCP and no default, ask which one through the content structured-choice (inside the ≤3 + `flow` limit) before querying; otherwise do not ask.
|
|
8
|
+
2. Write queries first in session `SCRIPTS.sql`.
|
|
9
|
+
3. Run them read-only via MCP (`sql-mutation-guard`: never DML/DDL), then record `RemoteContextSnapshot` in `SCRIPTS.sql` plus conclusion/digest in `CONCLUSIONS.md` before plan approval.
|
|
10
10
|
|
|
11
|
-
> The AI **never executes DML/DDL**.
|
|
11
|
+
> Snapshots have no automatic TTL; refreshing during execution means `/w:plan-refine`. The AI **never executes DML/DDL**. Draft migrations in session `SCRIPTS.sql`; `export-*` promotes them separately as handoff.
|
|
@@ -4,11 +4,10 @@ Loaded when a code-editing run touches the database (signal `db`).
|
|
|
4
4
|
|
|
5
5
|
## DB scripts-only — the AI never executes DML/DDL
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Classify by **role**, not file (see [`SCRIPTS.sql`](../artifacts/artifacts-core/SCRIPTS.sql)):
|
|
8
8
|
|
|
9
|
-
- **Read-only
|
|
10
|
-
- **
|
|
9
|
+
- **Read-only remote query** → research context: record query, digest and `RemoteContextSnapshot` before approval.
|
|
10
|
+
- **Fixture/ephemeral DB test** → checkout proof; may validate a phase locally.
|
|
11
|
+
- **DDL/DML migration** → draft in session `SCRIPTS.sql`; **NEVER execute**.
|
|
11
12
|
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
> **Showing beats asserting here:** the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document — it asks the session's script back, because no narration tells drafting from running.
|
|
13
|
+
> Migration application is a non-blocking handoff, never a task, validation or exit condition. The plan closes on its local contract/tests; the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document and it verifies the session script, not narration.
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Loaded when a phase touches the database (signal `db`).
|
|
4
4
|
|
|
5
|
-
## Delta 3 — DB policy: **
|
|
5
|
+
## Delta 3 — DB policy: **checkout proof, never deployed closure**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
See [`DB-SCRIPTS-ONLY.md`](DB-SCRIPTS-ONLY.md) and [`../loops/CODE-POLICIES.md`](../loops/CODE-POLICIES.md). Fixture/ephemeral-DB checks in the acquired checkout may close a phase. Do not open remote reads here: they are captured research context. Draft DDL/DML in `SCRIPTS.sql`; applying it is handoff and never blocks `validada` or plan closure.
|
|
@@ -4,25 +4,27 @@ Loaded when the input is not plainly a `ready-for-plan` spec (signal `input`).
|
|
|
4
4
|
|
|
5
5
|
## plan-new — four modes
|
|
6
6
|
|
|
7
|
-
1. **Ready spec** (`docs/specs/NNN-spec-<slug>.md
|
|
8
|
-
2. **Spec not ready** (`
|
|
9
|
-
3. **Prompt** (no spec
|
|
10
|
-
4. **External plan
|
|
7
|
+
1. **Ready spec** (`docs/specs/NNN-spec-<slug>.md`, `status: ready-for-plan`) → proceed.
|
|
8
|
+
2. **Spec not ready** (`draft`, `refining`, or no mark) → **soft-suggest** `/w:spec-refine`, never a block. `PLAN` questions remain input here.
|
|
9
|
+
3. **Prompt** (no spec) → propose and normally launch `/w:spec-new`, then continue.
|
|
10
|
+
4. **External plan** (host, hand-written, another agent) → **adopt once, NO RESEARCH** at `docs/plans/PPP-plan-<slug>.md`. Normalize only supplied material; set `## Origin` to "adopted from <source>" + host/model/date; offer `/w:plan-refine` or `/w:plan-exec`. A matching Origin resumes; never overwrite a plan-doc.
|
|
11
11
|
|
|
12
12
|
> **Mode 3 vs 4:** a prompt that *describes a wish* → SPEC (mode 3); content that *already is a plan* → adopt (mode 4).
|
|
13
13
|
|
|
14
|
-
>
|
|
14
|
+
> Adoption is CLI-owned: the deterministic steps below are decided by the CLI (`aw flow advance`), not by this document.
|
|
15
|
+
|
|
16
|
+
> **Source-bounded:** new/refined plans declare `> Límite de ejecución: checkout`; each phase `> Fuentes:`; each task `_(fuentes: …)_`. `workspace` is reserved; other aliases exist in `AGENTS.md > Fuentes`; task sources are a phase subset. A legacy/manual plan without this form is adopted but **cannot execute**: `/w:plan-refine` adds it.
|
|
15
17
|
|
|
16
18
|
> **Ready vs not** is read from the spec's frontmatter `status`, never from the filename. **Legacy compat:** a spec with no frontmatter that carries `## Refinement decisions` — or the older `## Q&A traceability` — counts as ready the same way.
|
|
17
19
|
|
|
18
20
|
## plan-refine — three modes
|
|
19
21
|
|
|
20
|
-
1. **Existing plan** (`docs/plans/PPP-plan-<slug>.md`) → proceed
|
|
21
|
-
2. **No plan** →
|
|
22
|
-
3. **Returned by `plan-exec`** (
|
|
22
|
+
1. **Existing plan** (`docs/plans/PPP-plan-<slug>.md`) → proceed regardless of provenance.
|
|
23
|
+
2. **No plan** → soft-suggest `/w:plan-new`; the user decides.
|
|
24
|
+
3. **Returned by `plan-exec`** (unexecutable entry or structural deviation) → retain `validada` phases and redesign only pending work.
|
|
23
25
|
|
|
24
26
|
> **Spec-less plans are legitimate input.** The coherence gate **degrades gracefully**: criteria trace to the plan's own Final behavior block instead of spec criteria, and the "spec criteria uncovered" gap does not apply.
|
|
25
27
|
|
|
26
28
|
## Numbering
|
|
27
29
|
|
|
28
|
-
The
|
|
30
|
+
The name is `docs/plans/PPP-plan-<slug>.md`; `aw next-number docs/plans --claim plan-<slug>.md --code <NNN>` claims it for this run. The slug comes from the Requirement. It does not inherit the spec `NNN`: `## Origin` carries that link.
|
|
@@ -21,7 +21,7 @@ description: >-
|
|
|
21
21
|
|
|
22
22
|
Author database changes as **versioned SQL scripts**, never executing them. Two modes:
|
|
23
23
|
|
|
24
|
-
- **Read-only** (query): read schema/data
|
|
24
|
+
- **Read-only** (query): read schema/data through a registered connection to understand the domain (research, planning).
|
|
25
25
|
- **Write-to-script** (change): every DB mutation is written to the session's `SCRIPTS.sql`; the **user applies it**, never the AI.
|
|
26
26
|
|
|
27
27
|
## Composed by
|
|
@@ -35,11 +35,11 @@ Author database changes as **versioned SQL scripts**, never executing them. Two
|
|
|
35
35
|
|
|
36
36
|
### Rule zero — never execute SQL (invariant 4)
|
|
37
37
|
|
|
38
|
-
The AI **never executes DML/DDL** against any DB, through any channel (MCP, `psql`, `Bash`, an app driver). Migrations stay in `SCRIPTS.sql` and
|
|
38
|
+
The AI **never executes DML/DDL** against any DB, through any channel (MCP, `psql`, `Bash`, an app driver). Migrations stay in `SCRIPTS.sql` and external application is a handoff. Local fixture or ephemeral-DB tests may verify the checkout contract; a deployed application is never a closing requirement.
|
|
39
39
|
|
|
40
|
-
- **Read-only reads
|
|
41
|
-
-
|
|
42
|
-
-
|
|
40
|
+
- **Read-only remote reads**: `SELECT`, schema inspection, counts — research context only. No `INSERT/UPDATE/DELETE/CREATE/ALTER/DROP/TRUNCATE`.
|
|
41
|
+
- Choose only a registered connection; the registry, not environment-name conventions, supplies its exact DSN variable.
|
|
42
|
+
- A remote snapshot is recorded before plan approval and is never refreshed from `plan-exec`.
|
|
43
43
|
|
|
44
44
|
### Staging — a single `SCRIPTS.sql` per session
|
|
45
45
|
|
|
@@ -53,7 +53,7 @@ Every statement is **appended** with a pair of comment markers:
|
|
|
53
53
|
```sql
|
|
54
54
|
-- @category: 01-ddl-tablas
|
|
55
55
|
-- @stmt: 01-crear-tabla-usuarios
|
|
56
|
-
CREATE TABLE IF NOT EXISTS
|
|
56
|
+
CREATE TABLE IF NOT EXISTS <schema>.<table> (
|
|
57
57
|
...
|
|
58
58
|
);
|
|
59
59
|
```
|
|
@@ -90,7 +90,7 @@ CREATE TABLE IF NOT EXISTS esq_credito.tb_usuarios (
|
|
|
90
90
|
|
|
91
91
|
Only 4 fields. Author/Date/long notes do NOT go in the header (a free block below, if needed). If the engine is not Postgres, state it in `Objeto:`.
|
|
92
92
|
- **Idempotency**: `CREATE TABLE IF NOT EXISTS`, `DROP ... IF EXISTS`, `CREATE OR REPLACE`, `ON CONFLICT`.
|
|
93
|
-
- **Explicit schema**
|
|
93
|
+
- **Explicit schema when the project has one** (`<schema>.<table>`); never invent a schema name or assume `public`.
|
|
94
94
|
- **CTEs over DO/LOOP**: one transformation = chained `WITH ... AS` + one final `INSERT/UPDATE/DELETE`. Avoid `DO $$ ... LOOP ... END $$` when the result is achievable declaratively (easier to audit and revert). Exception: dynamic object discovery (FKs/columns/constraints) — document the reason in `Objeto:`.
|
|
95
95
|
- **Parametrized queries** always (never string concatenation) — in any SQL that ends up in app code.
|
|
96
96
|
- Never create `fn_*`/`sp_*` to reuse logic exclusive to one script; use a CTE or inline.
|
|
@@ -124,10 +124,10 @@ CREATE TABLE IF NOT EXISTS esq_credito.tb_usuarios (
|
|
|
124
124
|
| `CREATE INDEX idx_...` | `DROP INDEX IF EXISTS idx_...;` |
|
|
125
125
|
| `CREATE SEQUENCE seq_...` | `DROP SEQUENCE IF EXISTS seq_...;` |
|
|
126
126
|
| `CREATE OR REPLACE FUNCTION fn_x(...)` | `DROP FUNCTION IF EXISTS fn_x(<signature>);` |
|
|
127
|
-
| `UPDATE/DELETE` with a backup
|
|
127
|
+
| `UPDATE/DELETE` with a declared backup table | `UPDATE … FROM <backup_schema>.<backup_table>` |
|
|
128
128
|
| `INSERT INTO tb_x VALUES (...)` | `DELETE FROM tb_x WHERE <natural key / range>;` (never DELETE without WHERE) |
|
|
129
129
|
|
|
130
|
-
**Irreversible → manual "Fase 5" block** (outside the transaction, one line per case): `TRUNCATE`, `DROP COLUMN`/`DROP TABLE` without backup, lossy `ALTER COLUMN TYPE`, `DROP ... CASCADE`, `DELETE/UPDATE` without a backup
|
|
130
|
+
**Irreversible → manual "Fase 5" block** (outside the transaction, one line per case): `TRUNCATE`, `DROP COLUMN`/`DROP TABLE` without backup, lossy `ALTER COLUMN TYPE`, `DROP ... CASCADE`, `DELETE/UPDATE` without a declared backup. To make a destructive change reversible, write the project-appropriate backup in the same forward (`<backup_schema>.<backup_table>`).
|
|
131
131
|
|
|
132
132
|
## Output
|
|
133
133
|
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { parseDecisiones } from "./parsers/decisiones.js";
|
|
2
|
-
import { relpath } from "./paths.js";
|
|
3
|
-
import { canonicalArtifactPath, findArtifact } from "./session-artifacts.js";
|
|
4
|
-
import { resolveSessionTarget, sessionReadRequest, } from "./session-resolver.js";
|
|
5
|
-
export async function runDecisionesCommand(fs, env, paths, input) {
|
|
6
|
-
const resolution = await resolveSessionTarget(fs, paths, sessionReadRequest(input));
|
|
7
|
-
if (resolution.outcome !== "resolved")
|
|
8
|
-
return { sessionError: resolution };
|
|
9
|
-
const session = resolution.session;
|
|
10
|
-
const decPath = await findArtifact(session.path, "decisions", fs);
|
|
11
|
-
if (!decPath) {
|
|
12
|
-
return {
|
|
13
|
-
session: session.folder,
|
|
14
|
-
path: relpath(canonicalArtifactPath(session.path, "decisions"), env.cwd()),
|
|
15
|
-
exists: false,
|
|
16
|
-
count: 0,
|
|
17
|
-
items: [],
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const pathPosix = relpath(decPath, env.cwd());
|
|
21
|
-
const text = await fs.readText(decPath);
|
|
22
|
-
const items = parseDecisiones(text, input.full === true);
|
|
23
|
-
return {
|
|
24
|
-
session: session.folder,
|
|
25
|
-
path: pathPosix,
|
|
26
|
-
exists: true,
|
|
27
|
-
count: items.length,
|
|
28
|
-
items,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=decisiones-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decisiones-service.js","sourceRoot":"","sources":["../../src/application/decisiones-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAqB/B,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,EAAkB,EAClB,GAAY,EACZ,KAAmB,EACnB,KAA6B;IAE7B,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,IAAI,UAAU,CAAC,OAAO,KAAK,UAAU;QAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3E,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;IACnC,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,CAAC,CAAC;IAClE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,MAAM;YACvB,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC1E,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACzD,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,MAAM;QACvB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
export function runBootstrapDsn(paths, input) {
|
|
4
|
-
const entries = [];
|
|
5
|
-
if (input.certDsn)
|
|
6
|
-
entries.push({ key: "DB_CERT_DSN", value: input.certDsn });
|
|
7
|
-
if (input.prodDsn)
|
|
8
|
-
entries.push({ key: "DB_PROD_DSN", value: input.prodDsn });
|
|
9
|
-
if (entries.length === 0) {
|
|
10
|
-
return {
|
|
11
|
-
error: "Ni DB_CERT_DSN ni DB_PROD_DSN visibles en el entorno actual. Exportalas en ~/.zshenv (macOS/Linux) o System Environment (Windows) y reabrí Claude Code desde una terminal donde 'echo $DB_CERT_DSN' devuelva valor.",
|
|
12
|
-
exitCode: 2,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const path = writeDsnValues(paths, entries);
|
|
16
|
-
return { ok: true, path, wrote: entries.map((entry) => entry.key) };
|
|
17
|
-
}
|
|
18
|
-
export function writeDsnValue(paths, input) {
|
|
19
|
-
const path = writeDsnValues(paths, [input]);
|
|
20
|
-
return { ok: true, path, key: input.key };
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Upsert of every entry into dsn.env, preserving the lines this call does not
|
|
24
|
-
* own: the file is shared by every connection the user ever bootstrapped, so a
|
|
25
|
-
* whole-file rewrite would drop the DSNs of the other ones.
|
|
26
|
-
*/
|
|
27
|
-
function writeDsnValues(paths, entries) {
|
|
28
|
-
const target = paths.userDsnFile();
|
|
29
|
-
let lines = readDsnLines(target);
|
|
30
|
-
for (const entry of entries) {
|
|
31
|
-
lines = upsertDsnLine(lines, entry.key, entry.value);
|
|
32
|
-
}
|
|
33
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
34
|
-
writeFileSync(target, `${lines.join("\n")}\n`, "utf-8");
|
|
35
|
-
try {
|
|
36
|
-
chmodSync(target, 0o600);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
// Best effort: filesystems without POSIX modes (Windows, FAT) must not fail
|
|
40
|
-
// a write that already landed. The DSN is still written.
|
|
41
|
-
}
|
|
42
|
-
return target;
|
|
43
|
-
}
|
|
44
|
-
function readDsnLines(path) {
|
|
45
|
-
if (!existsSync(path))
|
|
46
|
-
return [];
|
|
47
|
-
const lines = readFileSync(path, "utf-8").split(/\r?\n/);
|
|
48
|
-
// Only the empty tail the final newline produces is dropped. Blank lines
|
|
49
|
-
// inside the file are the user's own grouping of a file this tool shares with
|
|
50
|
-
// them, and an upsert has no business collapsing it.
|
|
51
|
-
if (lines[lines.length - 1] === "")
|
|
52
|
-
lines.pop();
|
|
53
|
-
return lines;
|
|
54
|
-
}
|
|
55
|
-
function upsertDsnLine(lines, key, value) {
|
|
56
|
-
const prefix = `${key}=`;
|
|
57
|
-
const next = [];
|
|
58
|
-
let replaced = false;
|
|
59
|
-
for (const line of lines) {
|
|
60
|
-
// Compare the line trimmed: an indented assignment still assigns, and
|
|
61
|
-
// leaving it behind would keep a stale credential alive in a file the user
|
|
62
|
-
// believes updated. Duplicates of the same key collapse into the first.
|
|
63
|
-
if (!line.trimStart().startsWith(prefix)) {
|
|
64
|
-
next.push(line);
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (replaced)
|
|
68
|
-
continue;
|
|
69
|
-
replaced = true;
|
|
70
|
-
next.push(`${key}=${value}`);
|
|
71
|
-
}
|
|
72
|
-
if (!replaced)
|
|
73
|
-
next.push(`${key}=${value}`);
|
|
74
|
-
return next;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=dev-bootstrap-dsn-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-bootstrap-dsn-service.js","sourceRoot":"","sources":["../../src/application/dev-bootstrap-dsn-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8BpC,MAAM,UAAU,eAAe,CAC7B,KAAmB,EACnB,KAAwB;IAExB,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAE9E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO;YACL,KAAK,EACH,qNAAqN;YACvN,QAAQ,EAAE,CAAC;SACZ,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EA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,CAAC,CAAC,KAAK,EAAE;QAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,KAAe,EAAE,GAAW,EAAE,KAAa;IAChE,MAAM,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,sEAAsE;QACtE,2EAA2E;QAC3E,wEAAwE;QACxE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACzC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,SAAS;QACX,CAAC;QACD,IAAI,QAAQ;YAAE,SAAS;QACvB,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;IAC/B,CAAC;IACD,IAAI,CAAC,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;IAC5C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { isAbsolute, join } from "node:path";
|
|
2
|
-
export const ENV_VAR_PROFILE = "AW_PROFILE";
|
|
3
|
-
export const USER_CONFIG_RELPATH = join(".config", "agent-workflow", "profile.json");
|
|
4
|
-
export const WORKSPACE_PROFILE_FILENAME = "profile.json";
|
|
5
|
-
export const DEFAULT_NAMESPACE = "agent-workflow";
|
|
6
|
-
export const DEFAULT_PROFILE = Object.freeze({
|
|
7
|
-
namespace: DEFAULT_NAMESPACE,
|
|
8
|
-
company: "agent-workflow",
|
|
9
|
-
claude_md_block: "AW-PROJECT",
|
|
10
|
-
mcp_databases: [],
|
|
11
|
-
lexicon_path: null,
|
|
12
|
-
examples_path: null,
|
|
13
|
-
migrate_legacy_rules: [],
|
|
14
|
-
custom_anchors: [],
|
|
15
|
-
});
|
|
16
|
-
export async function resolveProfile(fs, env, input = {}) {
|
|
17
|
-
const cwd = env.cwd();
|
|
18
|
-
const home = env.homeDir();
|
|
19
|
-
const wsNs = (input.workspaceNamespace ?? DEFAULT_NAMESPACE).trim() || DEFAULT_NAMESPACE;
|
|
20
|
-
const flagPath = (input.flagPath ?? "").trim();
|
|
21
|
-
if (flagPath.length > 0) {
|
|
22
|
-
const abs = isAbsolute(flagPath) ? flagPath : join(cwd, flagPath);
|
|
23
|
-
return loadOrFail(fs, abs, "flag");
|
|
24
|
-
}
|
|
25
|
-
const envValue = (env.get(ENV_VAR_PROFILE) ?? "").trim();
|
|
26
|
-
if (envValue.length > 0) {
|
|
27
|
-
const abs = isAbsolute(envValue) ? envValue : join(cwd, envValue);
|
|
28
|
-
return loadOrFail(fs, abs, "env");
|
|
29
|
-
}
|
|
30
|
-
const userPath = join(home, USER_CONFIG_RELPATH);
|
|
31
|
-
if (await fs.exists(userPath)) {
|
|
32
|
-
return loadOrFail(fs, userPath, "user-config");
|
|
33
|
-
}
|
|
34
|
-
const workspacePath = join(cwd, `.${wsNs}`, WORKSPACE_PROFILE_FILENAME);
|
|
35
|
-
if (await fs.exists(workspacePath)) {
|
|
36
|
-
return loadOrFail(fs, workspacePath, "workspace");
|
|
37
|
-
}
|
|
38
|
-
// structuredClone also unfreezes the frozen DEFAULT_PROFILE for the caller.
|
|
39
|
-
return { profile: structuredClone(DEFAULT_PROFILE), source: "default", path: null };
|
|
40
|
-
}
|
|
41
|
-
async function loadOrFail(fs, path, source) {
|
|
42
|
-
if (!(await fs.exists(path))) {
|
|
43
|
-
return {
|
|
44
|
-
code: "PROFILE_NOT_FOUND",
|
|
45
|
-
message: `profile no encontrado (${source}): ${path}`,
|
|
46
|
-
path,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const text = await fs.readText(path);
|
|
50
|
-
const parsed = parseAndValidate(text, path);
|
|
51
|
-
if ("code" in parsed)
|
|
52
|
-
return parsed;
|
|
53
|
-
return { profile: parsed, source, path };
|
|
54
|
-
}
|
|
55
|
-
function parseAndValidate(text, path) {
|
|
56
|
-
let raw;
|
|
57
|
-
try {
|
|
58
|
-
raw = JSON.parse(text);
|
|
59
|
-
}
|
|
60
|
-
catch (err) {
|
|
61
|
-
return {
|
|
62
|
-
code: "PROFILE_INVALID_JSON",
|
|
63
|
-
message: `JSON inválido en ${path}: ${err.message}`,
|
|
64
|
-
path,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
return validateProfile(raw, path);
|
|
68
|
-
}
|
|
69
|
-
export function validateProfile(raw, path) {
|
|
70
|
-
if (!isObject(raw))
|
|
71
|
-
return failSchema("root", "objeto esperado", path);
|
|
72
|
-
const scalarErr = validateScalarFields(raw, path);
|
|
73
|
-
if (scalarErr !== null)
|
|
74
|
-
return scalarErr;
|
|
75
|
-
const arrayErr = validateArrayFields(raw, path);
|
|
76
|
-
if (arrayErr !== null)
|
|
77
|
-
return arrayErr;
|
|
78
|
-
return {
|
|
79
|
-
namespace: raw.namespace,
|
|
80
|
-
company: raw.company,
|
|
81
|
-
claude_md_block: raw.claude_md_block,
|
|
82
|
-
mcp_databases: raw.mcp_databases.map((d) => ({ ...d })),
|
|
83
|
-
lexicon_path: (raw.lexicon_path ?? null),
|
|
84
|
-
examples_path: (raw.examples_path ?? null),
|
|
85
|
-
migrate_legacy_rules: raw.migrate_legacy_rules.map((r) => ({ ...r })),
|
|
86
|
-
custom_anchors: raw.custom_anchors.map((a) => ({ ...a })),
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function validateScalarFields(raw, path) {
|
|
90
|
-
if (!isNonEmptyString(raw.namespace) || !isKebab(raw.namespace)) {
|
|
91
|
-
return failSchema("namespace", "string kebab no vacío (^[a-z][a-z0-9-]*$)", path);
|
|
92
|
-
}
|
|
93
|
-
if (!isNonEmptyString(raw.company)) {
|
|
94
|
-
return failSchema("company", "string no vacío", path);
|
|
95
|
-
}
|
|
96
|
-
if (!isNonEmptyString(raw.claude_md_block) ||
|
|
97
|
-
!/^[A-Z][A-Z0-9_-]*$/.test(raw.claude_md_block)) {
|
|
98
|
-
return failSchema("claude_md_block", "string [A-Z][A-Z0-9_-]*", path);
|
|
99
|
-
}
|
|
100
|
-
const lexErr = validateNullableString(raw.lexicon_path, "lexicon_path", path);
|
|
101
|
-
if (lexErr !== null)
|
|
102
|
-
return lexErr;
|
|
103
|
-
const exErr = validateNullableString(raw.examples_path, "examples_path", path);
|
|
104
|
-
if (exErr !== null)
|
|
105
|
-
return exErr;
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
function validateNullableString(value, field, path) {
|
|
109
|
-
if (value === null || value === undefined)
|
|
110
|
-
return null;
|
|
111
|
-
if (!isNonEmptyString(value))
|
|
112
|
-
return failSchema(field, "string no vacío o null", path);
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
function validateArrayFields(raw, path) {
|
|
116
|
-
const mcpErr = validateArray(raw.mcp_databases, "mcp_databases", validateMcpDatabase, path);
|
|
117
|
-
if (mcpErr !== null)
|
|
118
|
-
return mcpErr;
|
|
119
|
-
const ruleErr = validateArray(raw.migrate_legacy_rules, "migrate_legacy_rules", validateLegacyRule, path);
|
|
120
|
-
if (ruleErr !== null)
|
|
121
|
-
return ruleErr;
|
|
122
|
-
const anchorErr = validateArray(raw.custom_anchors, "custom_anchors", validateAnchor, path);
|
|
123
|
-
if (anchorErr !== null)
|
|
124
|
-
return anchorErr;
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
function validateArray(value, field, item, path) {
|
|
128
|
-
if (!Array.isArray(value))
|
|
129
|
-
return failSchema(field, "array", path);
|
|
130
|
-
for (let i = 0; i < value.length; i++) {
|
|
131
|
-
const err = item(value[i], i, path);
|
|
132
|
-
if (err !== null)
|
|
133
|
-
return err;
|
|
134
|
-
}
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
function validateMcpDatabase(raw, idx, path) {
|
|
138
|
-
const field = `mcp_databases[${idx}]`;
|
|
139
|
-
if (!isObject(raw))
|
|
140
|
-
return failSchema(field, "objeto esperado", path);
|
|
141
|
-
if (!isNonEmptyString(raw.alias))
|
|
142
|
-
return failSchema(`${field}.alias`, "string no vacío", path);
|
|
143
|
-
if (!isNonEmptyString(raw.host))
|
|
144
|
-
return failSchema(`${field}.host`, "string no vacío", path);
|
|
145
|
-
if (typeof raw.port !== "number" ||
|
|
146
|
-
!Number.isInteger(raw.port) ||
|
|
147
|
-
raw.port <= 0 ||
|
|
148
|
-
raw.port > 65535) {
|
|
149
|
-
return failSchema(`${field}.port`, "entero 1-65535", path);
|
|
150
|
-
}
|
|
151
|
-
if (!isNonEmptyString(raw.database))
|
|
152
|
-
return failSchema(`${field}.database`, "string no vacío", path);
|
|
153
|
-
if (raw.schema !== undefined && !isNonEmptyString(raw.schema)) {
|
|
154
|
-
return failSchema(`${field}.schema`, "string no vacío o undefined", path);
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
}
|
|
158
|
-
function validateLegacyRule(raw, idx, path) {
|
|
159
|
-
const field = `migrate_legacy_rules[${idx}]`;
|
|
160
|
-
if (!isObject(raw))
|
|
161
|
-
return failSchema(field, "objeto esperado", path);
|
|
162
|
-
if (!isNonEmptyString(raw.from))
|
|
163
|
-
return failSchema(`${field}.from`, "string no vacío", path);
|
|
164
|
-
if (!isNonEmptyString(raw.to))
|
|
165
|
-
return failSchema(`${field}.to`, "string no vacío", path);
|
|
166
|
-
if (raw.scope !== undefined &&
|
|
167
|
-
!["skill", "command", "hook", "anchor"].includes(raw.scope)) {
|
|
168
|
-
return failSchema(`${field}.scope`, "skill|command|hook|anchor o undefined", path);
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
function validateAnchor(raw, idx, path) {
|
|
173
|
-
const field = `custom_anchors[${idx}]`;
|
|
174
|
-
if (!isObject(raw))
|
|
175
|
-
return failSchema(field, "objeto esperado", path);
|
|
176
|
-
if (!isNonEmptyString(raw.anchor))
|
|
177
|
-
return failSchema(`${field}.anchor`, "string no vacío", path);
|
|
178
|
-
if (!isNonEmptyString(raw.target))
|
|
179
|
-
return failSchema(`${field}.target`, "string no vacío", path);
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
function isObject(v) {
|
|
183
|
-
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
184
|
-
}
|
|
185
|
-
function isNonEmptyString(v) {
|
|
186
|
-
return typeof v === "string" && v.trim().length > 0;
|
|
187
|
-
}
|
|
188
|
-
function isKebab(s) {
|
|
189
|
-
return /^[a-z][a-z0-9-]*$/.test(s);
|
|
190
|
-
}
|
|
191
|
-
function failSchema(field, expected, path) {
|
|
192
|
-
return {
|
|
193
|
-
code: "PROFILE_INVALID_SCHEMA",
|
|
194
|
-
message: `${field}: ${expected}`,
|
|
195
|
-
field,
|
|
196
|
-
...(path !== undefined ? { path } : {}),
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
//# sourceMappingURL=profile-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile-service.js","sourceRoot":"","sources":["../../../src/application/profile/profile-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,0BAA0B,GAAG,cAAc,CAAC;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAgClD,MAAM,CAAC,MAAM,eAAe,GAAY,MAAM,CAAC,MAAM,CAAC;IACpD,SAAS,EAAE,iBAAiB;IA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AAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,gBAAgB,CAAC,CAAU;IAClC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,KAAa,EAAE,QAAgB,EAAE,IAAa;IAChE,OAAO;QACL,IAAI,EAAE,wBAAwB;QAC9B,OAAO,EAAE,GAAG,KAAK,KAAK,QAAQ,EAAE;QAChC,KAAK;QACL,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { parseTasks } from "./parsers/tasks.js";
|
|
3
|
-
import { relpath } from "./paths.js";
|
|
4
|
-
import { resolveSessionTarget, sessionReadRequest, } from "./session-resolver.js";
|
|
5
|
-
export async function runTasksCommand(fs, env, paths, input) {
|
|
6
|
-
const resolution = await resolveSessionTarget(fs, paths, sessionReadRequest(input));
|
|
7
|
-
if (resolution.outcome !== "resolved")
|
|
8
|
-
return { sessionError: resolution };
|
|
9
|
-
const session = resolution.session;
|
|
10
|
-
const tasksPath = join(session.path, "TASKS.md");
|
|
11
|
-
const cwd = env.cwd();
|
|
12
|
-
const verbose = input.verbose === true;
|
|
13
|
-
const pathOut = verbose ? tasksPath : relpath(tasksPath, cwd);
|
|
14
|
-
if (!(await fs.exists(tasksPath))) {
|
|
15
|
-
return {
|
|
16
|
-
session: session.folder,
|
|
17
|
-
path: pathOut,
|
|
18
|
-
exists: false,
|
|
19
|
-
total: 0,
|
|
20
|
-
open: 0,
|
|
21
|
-
closed: 0,
|
|
22
|
-
progress_pct: 0,
|
|
23
|
-
items: [],
|
|
24
|
-
next_open: null,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const text = await fs.readText(tasksPath);
|
|
28
|
-
const parsed = parseTasks(text, !verbose);
|
|
29
|
-
let items = parsed.items;
|
|
30
|
-
if (input.onlyOpen === true) {
|
|
31
|
-
items = items.filter((t) => t.status === "open");
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
session: session.folder,
|
|
35
|
-
path: pathOut,
|
|
36
|
-
exists: true,
|
|
37
|
-
total: parsed.total,
|
|
38
|
-
open: parsed.open,
|
|
39
|
-
closed: parsed.closed,
|
|
40
|
-
progress_pct: parsed.progress_pct,
|
|
41
|
-
items,
|
|
42
|
-
next_open: parsed.next_open,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=tasks-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks-service.js","sourceRoot":"","sources":["../../src/application/tasks-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAmC,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAwB/B,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,EAAkB,EAClB,GAAY,EACZ,KAAmB,EACnB,KAAwB;IAExB,MAAM,UAAU,GAAG,MAAM,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,IAAI,UAAU,CAAC,OAAO,KAAK,UAAU;QAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;IAC3E,MAAM,OAAO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,EAAE,MAAM,CAAC,MAAM;QACrB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,KAAK;QACL,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { runBootstrapDsn } from "../../application/dev-bootstrap-dsn-service.js";
|
|
2
|
-
import { fail } from "../render.js";
|
|
3
|
-
export const bootstrapDsnCommand = {
|
|
4
|
-
name: "bootstrap-dsn",
|
|
5
|
-
describe: "Persist DB_CERT_DSN/DB_PROD_DSN to the namespace's dsn.env file.",
|
|
6
|
-
async execute(_args, ctx) {
|
|
7
|
-
const certDsn = ctx.env.get("DB_CERT_DSN");
|
|
8
|
-
const prodDsn = ctx.env.get("DB_PROD_DSN");
|
|
9
|
-
const result = runBootstrapDsn(ctx.paths, { certDsn, prodDsn });
|
|
10
|
-
if ("error" in result) {
|
|
11
|
-
return fail("MISSING_DSN", result.error, { error: result.error }, 2);
|
|
12
|
-
}
|
|
13
|
-
return { ok: true, data: result, exitCode: 0 };
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=bootstrap-dsn.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap-dsn.js","sourceRoot":"","sources":["../../../src/cli/commands/bootstrap-dsn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gDAAgD,CAAC;AAIjF,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC7C,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,kEAAkE;IAC5E,KAAK,CAAC,OAAO,CAAC,KAAiB,EAAE,GAAe;QAC9C,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3C,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACjD,CAAC;CACF,CAAC"}
|