@tacuchi/agent-workflow-cli 25.5.0 → 25.6.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 +2 -0
- package/dist/application/export-service.js +245 -36
- package/dist/application/export-service.js.map +1 -1
- package/dist/application/release-pass-ledger.js +43 -1
- package/dist/application/release-pass-ledger.js.map +1 -1
- package/dist/cli/commands/export.js +64 -15
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/release-pass.js +38 -2
- package/dist/cli/commands/release-pass.js.map +1 -1
- package/dist/cli/parser.js +4 -0
- package/dist/cli/parser.js.map +1 -1
- package/dist/domain/release-pass.js +9 -0
- package/dist/domain/release-pass.js.map +1 -1
- package/package.json +1 -1
- package/skills/w/commands/export-scripts.md +13 -12
- package/skills/w/exports/README.md +4 -2
- package/skills/w/exports/export-scripts/EXPORT.md +39 -45
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: export-scripts
|
|
3
|
-
description: "Consolidates pending SQL into one `docs/scripts/NNN-export-scripts-YYYY-MM-DD/` bundle with continuous numbering after `00-ROLLBACK.sql`. It publishes the net final state, not a chronological transcript.
|
|
3
|
+
description: "Consolidates pending SQL into one `docs/scripts/NNN-export-scripts-YYYY-MM-DD/` bundle with continuous numbering after `00-ROLLBACK.sql`. It publishes the net final state, not a chronological transcript. Its origin is DECLARED: a base (the session corpus, the published bundles, or a sweep of the whole workspace), minus the pieces named in `--exclude`, minus whatever the release book says already ran in `--environment`. Read-only/report: it NEVER executes SQL nor commits; external application is a handoff. Composes the `sql` capability. User-invoked via `/w:export-scripts`."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# export-scripts — consolidated SQL bundle, simple and direct
|
|
7
7
|
|
|
8
|
-
Consolidates
|
|
8
|
+
Consolidates pending SQL migrations into a single bundle under `docs/scripts/NNN-export-scripts-YYYY-MM-DD/`, with continuous numbering after `00-ROLLBACK.sql`. **Read-only / report** — the AI **never executes** the SQL; external application is an optional handoff.
|
|
9
|
+
|
|
10
|
+
**The material is declared, not assumed:** a base brings it, `--exclude` subtracts pieces and `--environment` what the book records as applied. With no flag: the session corpus, bundles out.
|
|
9
11
|
|
|
10
12
|
> `export-*` family (the only artifact→`docs/` path). Design: `docs/referencias/workflow-exports/export-scripts.md`.
|
|
11
13
|
|
|
@@ -17,74 +19,60 @@ Consolidates the pending SQL migrations of N sessions + standalone files into a
|
|
|
17
19
|
|
|
18
20
|
The **`sql`** capability (built-in default `sql`), resolved via `.workflow/skills.toml`. It contributes the DDL/DML category vocabulary, the application order and the rollback derivation. This export does **not** own that logic: it composes it. Rebindable or `off` by config.
|
|
19
21
|
|
|
20
|
-
## When to use
|
|
21
|
-
|
|
22
|
-
- "Release SQL bundle", "consolidate pending SQLs".
|
|
23
|
-
- Before an authorized release handoff.
|
|
24
|
-
- After several `exec`/`quick` sessions left `SCRIPTS.sql` files with migrations.
|
|
25
|
-
|
|
26
|
-
## What it does
|
|
27
|
-
|
|
28
|
-
1. Collects the workspace's SQL from **two sources**: each corpus session's type-B `SCRIPTS.sql` + standalone `docs/scripts/*.sql` (excluding previous bundles).
|
|
29
|
-
2. Classifies the statements by canonical category (DDL-TABLES / DDL-FUNCTIONS / DML / INSERTS).
|
|
30
|
-
3. Resolves the **net final state** across sources, then groups it by category with **continuous numbering** after `00-ROLLBACK.sql`.
|
|
31
|
-
4. Writes only the forwards needed for that final state, retaining traceable origin where useful.
|
|
32
|
-
5. Derives `00-ROLLBACK.sql` **at the end**, reading the already-written forwards.
|
|
33
|
-
6. Writes a minimal `README.md` (Files / Apply / Revert).
|
|
34
|
-
|
|
35
22
|
## What it does NOT do
|
|
36
23
|
|
|
37
|
-
- **Execute SQL** (DB scripts-only
|
|
38
|
-
- Commit, merge
|
|
39
|
-
- Touch `.workflow/sessions/` or the standalone `docs/scripts/*.sql` (read-only).
|
|
24
|
+
- **Execute SQL** (DB scripts-only). The bundle is a deliverable; a human/DBA applies it.
|
|
25
|
+
- Commit, merge or push; touch `.workflow/sessions/` or the loose `*.sql` (read-only).
|
|
40
26
|
- Write any `docs/` folder other than `docs/scripts/` (invariant: one category).
|
|
41
|
-
-
|
|
27
|
+
- Rewrite, renumber or delete a previous bundle: one in the origin is **read**, its directory left as it was.
|
|
42
28
|
- Include read-only type-A (diagnostic queries) or invent SQL.
|
|
43
|
-
-
|
|
29
|
+
- Put email templates, production checklists, commit listings or executive summaries in the README.
|
|
44
30
|
|
|
45
31
|
## Read-only sandbox
|
|
46
32
|
|
|
47
|
-
In plan mode it **describes**, never writes: the resolved `NNN`, the
|
|
33
|
+
In plan mode it **describes**, never writes: the resolved `NNN`, the declared origin with its exclusions, the categories with content and the files that would appear. No `Write`, no mutations; numbering uses `aw next-number --dry-run` (pure).
|
|
48
34
|
|
|
49
35
|
## Inputs
|
|
50
36
|
|
|
51
37
|
**`agent-workflow` CLI (alias `aw`)** — never read hardcoded paths:
|
|
52
38
|
|
|
53
|
-
- `aw release-data [--since sessionNNN] [--source <alias>]` —
|
|
54
|
-
- `aw session-artifacts --code <NNN> --dump scripts` —
|
|
55
|
-
- `aw release-data --standalone-sql` —
|
|
56
|
-
- `aw
|
|
57
|
-
|
|
58
|
-
**Filesystem**:
|
|
59
|
-
|
|
60
|
-
- Standalone `docs/scripts/*.sql` (top-level only, via `--standalone-sql`), **excluding** any `docs/scripts/NNN-export-scripts-*/` (previous outputs of this export).
|
|
39
|
+
- `aw release-data [--since sessionNNN] [--source <alias>]` — the session corpus (ALL sessions, closed + active, with `release_eligible`). `aw sessions` lists only ACTIVE ones: never use it as the corpus.
|
|
40
|
+
- `aw session-artifacts --code <NNN> --dump scripts` — the session's `.sql` files with path and size (content is read by path). No scripts → empty list, silent skip.
|
|
41
|
+
- `aw release-data --standalone-sql [--include-graduated]` — the loose `docs/scripts/*.sql` and the previous bundles. `prepare` already reads both through its base; these are for looking by hand.
|
|
42
|
+
- `aw release-pass list` — the book `--environment` reads: `link --artifact <ruta>` says which bundle a pass carries, `applied --environment` that its SQL RAN there. Nothing inspects a database.
|
|
43
|
+
- `aw next-number docs/scripts` — deterministic numbering; it also creates `docs/scripts` when missing, which is what makes destination resolution a CLI guarantee. In plan mode, `--dry-run`.
|
|
61
44
|
|
|
62
45
|
**Args** (no lifecycle *structured-choice*; harness capability — see [`../../harness/HARNESS.md`](../../harness/HARNESS.md)):
|
|
63
46
|
|
|
64
47
|
```
|
|
65
|
-
/w:export-scripts [--sessions
|
|
66
|
-
[--
|
|
48
|
+
/w:export-scripts [--from sessions|bundles|workspace] [--exclude <nombre>]… [--environment <ambiente>]
|
|
49
|
+
[--sessions NNN[,NNN]] [--since sessionNNN] [--source <alias>]
|
|
67
50
|
```
|
|
68
51
|
|
|
69
52
|
| Flag | Behavior |
|
|
70
53
|
|---|---|
|
|
54
|
+
| `--from <base>` | The base: `sessions` (default) · `bundles` · `workspace` (all three) |
|
|
55
|
+
| `--exclude <nombre>` | Subtracts one piece by the name the inventory prints. **Repeatable** |
|
|
56
|
+
| `--environment <ambiente>` | Subtracts bundles the book records as applied there; no record is reported as such |
|
|
71
57
|
| `--sessions NNN[,NNN]` | Discrete filter by code (takes precedence over `--since`) |
|
|
72
58
|
| `--since sessionNNN` | Only sessions after NNN (exclusive: NNN itself is out; use `--sessions` to include it) |
|
|
73
59
|
| `--source <alias>` | Limits to one source (multi-source workspace) |
|
|
74
|
-
| `--skip-standalone` | Skips reading the standalone `docs/scripts/*.sql` |
|
|
75
|
-
| `--dry-run` | Propositional report, no files written |
|
|
76
60
|
|
|
77
|
-
No args: every corpus session
|
|
61
|
+
No args: every corpus session, bundles and loose SQL out — the behavior that always was. The three composition flags are this export's alone.
|
|
78
62
|
|
|
79
63
|
## Flow
|
|
80
64
|
|
|
81
65
|
### Step 1 — Collect SQL sources
|
|
82
66
|
|
|
83
|
-
|
|
67
|
+
`prepare` already resolved WHICH pieces are in: its inventory lists them per origin with every exclusion and its reason. Read only that.
|
|
68
|
+
|
|
69
|
+
**Sessions**: for every session the inventory names (`aw session-artifacts --code <NNN> --dump scripts`), read the `.sql` files the dump lists (per-script path). Take **only** type-B statements (deliverable DDL/DML migrations); ignore read-only type-A (diagnostic queries). Expected per-statement markers: `-- @category: <01-04>` + `-- @stmt: NNN-verb-target` (format defined by the `sql` capability).
|
|
70
|
+
|
|
71
|
+
**Loose SQL**: per file, honor `@category` markers when present; otherwise infer it from content (`CREATE/ALTER TABLE`, `CREATE INDEX` → `01`; `CREATE OR REPLACE FUNCTION`/`PROCEDURE` → `02`; `UPDATE`/`DELETE` → `03`; `INSERT INTO … VALUES` → `04`). If the filename contains `rollback` → skip (it never enters a forward).
|
|
84
72
|
|
|
85
|
-
**
|
|
73
|
+
**Published bundles**: their forwards in numeric order, same markers. `00-ROLLBACK.sql` is **never** read as a forward — it is the bundle's reverse, not its material.
|
|
86
74
|
|
|
87
|
-
|
|
75
|
+
An empty origin → **abort**: `prepare` already refused, saying whether nothing matched or everything was already applied.
|
|
88
76
|
|
|
89
77
|
### Step 2 — Bundle numbering
|
|
90
78
|
|
|
@@ -92,10 +80,16 @@ If the A + B union is empty → **abort**: there is no pending SQL in the worksp
|
|
|
92
80
|
|
|
93
81
|
### Step 3 — Net final state, classification and internal order
|
|
94
82
|
|
|
95
|
-
Reconcile
|
|
83
|
+
Reconcile every candidate the origin brought against the code and the declared final state. Omit
|
|
96
84
|
objects born and retired within the sequence; write migrated objects directly in their final form;
|
|
97
|
-
omit explicitly retired objects even when their deletion is absent from the input.
|
|
98
|
-
|
|
85
|
+
omit explicitly retired objects even when their deletion is absent from the input.
|
|
86
|
+
|
|
87
|
+
**A previous bundle in the origin is MATERIAL A RECONCILIAR, not untouchable history.** Two that
|
|
88
|
+
contradict — one creating an object, a later one retiring it — publish the resulting net final state,
|
|
89
|
+
never their chronological sum: the new bundle does not create it, and its `00-ROLLBACK.sql` does not
|
|
90
|
+
reverse a creation it never published. The bundles on disk are never modified.
|
|
91
|
+
|
|
92
|
+
Then group the remaining statements by canonical category: `01 DDL-TABLES` · `02 DDL-FUNCTIONS` · `03 DML` ·
|
|
99
93
|
`04 INSERTS`. Origin is traceability, not an ordering authority over the final contract.
|
|
100
94
|
|
|
101
95
|
### Step 4 — Continuous numbering (no gaps)
|
|
@@ -112,11 +106,11 @@ Via the `sql` capability, **reading the already-written forwards** (not the orig
|
|
|
112
106
|
|
|
113
107
|
### Step 7 — Write the `README.md` (3 sections)
|
|
114
108
|
|
|
115
|
-
`## Archivos` (table: 1 row per file present) · `## Aplicar` (one `psql -f` per file in ascending order; the export executes nothing) · `## Revertir` (`psql -f 00-ROLLBACK.sql` + a note if there is an irreversible block). The README is a user-facing deliverable → write it in the user's language. **Vetoed**:
|
|
109
|
+
`## Archivos` (table: 1 row per file present) · `## Aplicar` (one `psql -f` per file in ascending order; the export executes nothing) · `## Revertir` (`psql -f 00-ROLLBACK.sql` + a note if there is an irreversible block). The README is a user-facing deliverable → write it in the user's language. **Vetoed**: everything the section above forbids.
|
|
116
110
|
|
|
117
111
|
### Step 8 — Write or report
|
|
118
112
|
|
|
119
|
-
|
|
113
|
+
Publish through the three stages (`prepare` → `validate` → `apply --approval`); in plan mode, describe instead. **NEVER commit**. Summary: one line per file + the bundle path, naming the origin and what stayed out.
|
|
120
114
|
|
|
121
115
|
## Output location
|
|
122
116
|
|
|
@@ -130,7 +124,7 @@ docs/scripts/NNN-export-scripts-YYYY-MM-DD/
|
|
|
130
124
|
|
|
131
125
|
## Re-run
|
|
132
126
|
|
|
133
|
-
Functionally idempotent: each invocation takes the next `NNN` and **never overwrites** previous
|
|
127
|
+
Functionally idempotent: each invocation takes the next `NNN` and **never overwrites** a previous bundle. To regenerate, delete the directory by hand and re-invoke.
|
|
134
128
|
|
|
135
129
|
## Resources
|
|
136
130
|
|