@tacuchi/agent-workflow-cli 25.4.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/cut-intent-ledger.js +164 -0
- package/dist/application/cut-intent-ledger.js.map +1 -0
- package/dist/application/export-service.js +253 -37
- package/dist/application/export-service.js.map +1 -1
- package/dist/application/history-publications.js +76 -0
- package/dist/application/history-publications.js.map +1 -0
- package/dist/application/lineage-service.js +119 -0
- package/dist/application/lineage-service.js.map +1 -0
- package/dist/application/paths-service.js +8 -0
- package/dist/application/paths-service.js.map +1 -1
- package/dist/application/persist-service.js +9 -3
- package/dist/application/persist-service.js.map +1 -1
- package/dist/application/release-pass-ledger.js +327 -0
- package/dist/application/release-pass-ledger.js.map +1 -0
- package/dist/application/resume-service.js +9 -5
- package/dist/application/resume-service.js.map +1 -1
- package/dist/application/retirement/prepare.js +2 -2
- package/dist/application/retirement/prepare.js.map +1 -1
- package/dist/application/retirement/resolve.js.map +1 -1
- package/dist/application/session-resolver.js +8 -2
- package/dist/application/session-resolver.js.map +1 -1
- package/dist/application/{retirement/graph.js → workline-graph.js} +18 -12
- package/dist/application/workline-graph.js.map +1 -0
- package/dist/application/workline-index-service.js +200 -16
- package/dist/application/workline-index-service.js.map +1 -1
- package/dist/application/workspace-materialization-service.js +40 -4
- package/dist/application/workspace-materialization-service.js.map +1 -1
- package/dist/application/worktree-service.js +276 -6
- package/dist/application/worktree-service.js.map +1 -1
- package/dist/cli/commands/cut-intent.js +176 -0
- package/dist/cli/commands/cut-intent.js.map +1 -0
- package/dist/cli/commands/export.js +64 -15
- package/dist/cli/commands/export.js.map +1 -1
- package/dist/cli/commands/index.js +10 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/release-pass.js +228 -0
- package/dist/cli/commands/release-pass.js.map +1 -0
- package/dist/cli/commands/resume.js +3 -0
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/status.js +7 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/worktree.js +19 -5
- package/dist/cli/commands/worktree.js.map +1 -1
- package/dist/cli/help-groups.js +11 -0
- package/dist/cli/help-groups.js.map +1 -1
- package/dist/cli/main.js +27 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/parser.js +4 -0
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/tui/data/recommended-skills.js +39 -10
- package/dist/cli/tui/data/recommended-skills.js.map +1 -1
- package/dist/domain/cut-intent.js +79 -0
- package/dist/domain/cut-intent.js.map +1 -0
- package/dist/domain/flow/authority.js +8 -0
- package/dist/domain/flow/authority.js.map +1 -1
- package/dist/domain/release-pass.js +104 -0
- package/dist/domain/release-pass.js.map +1 -0
- package/dist/runtime/namespace-resolver.js +3 -10
- package/dist/runtime/namespace-resolver.js.map +1 -1
- package/dist/runtime/workline-marker.js +70 -0
- package/dist/runtime/workline-marker.js.map +1 -0
- 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
- package/dist/application/retirement/graph.js.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
/**
|
|
3
|
+
* What tells a Workline workspace apart from a directory that merely shares the
|
|
4
|
+
* name of a subfolder.
|
|
5
|
+
*
|
|
6
|
+
* The canonical marker used to be `.<ns>/sessions/` alone, and that is a shape
|
|
7
|
+
* the host tools imitate: `~/.claude/sessions`, `~/.codex/sessions` and
|
|
8
|
+
* `~/.kimi-code/sessions` all exist on a normal machine. With three of them in
|
|
9
|
+
* one home directory, every command launched from a path that was never
|
|
10
|
+
* initialized read `$HOME` as three workspaces at once and died with
|
|
11
|
+
* `WORKLINE_NAMESPACE_AMBIGUOUS` before any service was built.
|
|
12
|
+
*
|
|
13
|
+
* So the workspace gets a mark of its own, `.<ns>/workline.json`, written by the
|
|
14
|
+
* minimal materialization. No host tool writes it, which is the whole point.
|
|
15
|
+
*/
|
|
16
|
+
export const WORKLINE_MARKER_FILE = "workline.json";
|
|
17
|
+
/**
|
|
18
|
+
* Evidence that a directory was a Workline workspace BEFORE the mark existed.
|
|
19
|
+
*
|
|
20
|
+
* A workspace already materialized has to keep resolving without anybody running
|
|
21
|
+
* a migration, and these are the runtime files only Workline puts at `.<ns>/`.
|
|
22
|
+
* The first write into such a workspace adds the mark, so this reading is the
|
|
23
|
+
* bridge and not a second contract: after it, the mark answers on its own.
|
|
24
|
+
*/
|
|
25
|
+
export const LEGACY_WORKLINE_FILES = [
|
|
26
|
+
"HISTORY.md",
|
|
27
|
+
"claims.jsonl",
|
|
28
|
+
"skills.toml",
|
|
29
|
+
"processes.json",
|
|
30
|
+
];
|
|
31
|
+
/** The bytes the mark carries: enough to read it, never a second source of truth. */
|
|
32
|
+
export function worklineMarkerContent(namespace) {
|
|
33
|
+
return `${JSON.stringify({ workline: 1, namespace }, null, 2)}\n`;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Whether `dir` holds the Workline workspace of `namespace`.
|
|
37
|
+
*
|
|
38
|
+
* Fails CLOSED in the direction that matters: a directory that only looks like
|
|
39
|
+
* one — `sessions/` and nothing of Workline's beside it — is not adopted as a
|
|
40
|
+
* workspace, so the command's own path is, which is what the person asked for.
|
|
41
|
+
*/
|
|
42
|
+
export async function isWorklineRoot(fs, dir, namespace) {
|
|
43
|
+
const root = join(dir, `.${namespace}`);
|
|
44
|
+
if (await isFile(fs, join(root, WORKLINE_MARKER_FILE)))
|
|
45
|
+
return true;
|
|
46
|
+
if (!(await isDir(fs, join(root, "sessions"))))
|
|
47
|
+
return false;
|
|
48
|
+
for (const legacy of LEGACY_WORKLINE_FILES) {
|
|
49
|
+
if (await isFile(fs, join(root, legacy)))
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
async function isFile(fs, path) {
|
|
55
|
+
try {
|
|
56
|
+
return (await fs.stat(path)).type === "file";
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function isDir(fs, path) {
|
|
63
|
+
try {
|
|
64
|
+
return (await fs.stat(path)).type === "dir";
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=workline-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workline-marker.js","sourceRoot":"","sources":["../../src/runtime/workline-marker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,YAAY;IACZ,cAAc;IACd,aAAa;IACb,gBAAgB;CACR,CAAC;AAEX,qFAAqF;AACrF,MAAM,UAAU,qBAAqB,CAAC,SAAiB;IACrD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,EAAkB,EAClB,GAAW,EACX,SAAiB;IAEjB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;IACxC,IAAI,MAAM,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpE,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7D,KAAK,MAAM,MAAM,IAAI,qBAAqB,EAAE,CAAC;QAC3C,IAAI,MAAM,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;IACxD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,MAAM,CAAC,EAAkB,EAAE,IAAY;IACpD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,KAAK,UAAU,KAAK,CAAC,EAAkB,EAAE,IAAY;IACnD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tacuchi/agent-workflow-cli",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.6.0",
|
|
4
4
|
"description": "Runtime CLI for Workline — the stages + loops + artifacts system for agent work. Bundles the universal `w` skill set under `skills/w/` (slash commands `/w:*`: spec-new/spec-refine, plan-new/plan-exec, quick, persist, workspace-init, export-*); `self install --target <host>` copies SKILL + commands + hooks into the host. Pluggable capability skills resolve through `.workflow/skills.toml`. Namespace auto-detected from any `.<ns>/sessions/` dir in CWD; default `workflow`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Use to
|
|
3
|
-
argument-hint: "[--sessions <ids>] [--since <YYYY-MM-DD>] [--source <alias>]"
|
|
2
|
+
description: Use to consolidate the workspace's pending SQL into a docs/scripts/ bundle from a declared origin — continuous forwards plus rollback. `aw export-scripts` checks shape and NEVER executes SQL. Never automatic.
|
|
3
|
+
argument-hint: "[--from sessions|bundles|workspace] [--exclude <nombre>] [--environment <ambiente>] [--sessions <ids>] [--since <YYYY-MM-DD>] [--source <alias>]"
|
|
4
4
|
allowed-tools: ["Bash", "Read"]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Run
|
|
8
8
|
|
|
9
|
-
1. `aw export-scripts prepare --format human` (+
|
|
10
|
-
2. Answer with one JSON
|
|
11
|
-
3. `echo '<json>' | aw export-scripts validate --format human` → preview + `approval_digest`; confirm
|
|
9
|
+
1. `aw export-scripts prepare --format human` (+ the flags above) → origin, material, destination, `input_digest`.
|
|
10
|
+
2. Answer with one JSON — `aw export-scripts --help` publishes the envelope. Copy its `scope` **verbatim**: it carries the prepared origin, so 3 and 4 never repeat flags. `NNN` is advisory: `apply` renumbers.
|
|
11
|
+
3. `echo '<json>' | aw export-scripts validate --format human` → preview + `approval_digest`; confirm origin and destination.
|
|
12
12
|
4. `echo '<json>' | aw export-scripts apply --approval <digest>`. On rejection nothing was written: fix and repeat step 3.
|
|
13
13
|
|
|
14
14
|
## What it produces
|
|
15
15
|
|
|
16
|
-
- `docs/scripts/NNN-export-scripts-YYYY-MM-DD/`: `00-ROLLBACK.sql` and `README.md
|
|
17
|
-
-
|
|
18
|
-
- Never write into `docs/` with a file tool: one pass, all or nothing
|
|
16
|
+
- `docs/scripts/NNN-export-scripts-YYYY-MM-DD/`: `00-ROLLBACK.sql` and `README.md` required, + forwards `NN-<nombre>.sql` numbered **continuously from 01**; a gap is rejected.
|
|
17
|
+
- Nothing here executes SQL: applying the bundle is a handoff to an authorized operator.
|
|
18
|
+
- Never write into `docs/` with a file tool: one pass, all or nothing; no session touched.
|
|
19
19
|
|
|
20
20
|
## Net final state
|
|
21
21
|
|
|
22
|
-
Publish the final state, not a
|
|
23
|
-
|
|
22
|
+
Publish the final state, not a chronology: omit transients, write migrations in final form, reconcile the code.
|
|
23
|
+
Rollback safely reverses it; exclude concrete identities and test seeds. A previous bundle in the
|
|
24
|
+
origin is `MATERIAL A RECONCILIAR`, not history: two that contradict publish their net state, not their sum.
|
|
24
25
|
`ESTADO FINAL NETO` · `orden seguro para las dependencias` · `objetos compartidos y necesarios para el estado final`
|
|
25
26
|
|
|
26
27
|
## More context
|
|
27
28
|
|
|
28
|
-
`aw context-plan --command export-scripts --signal <s> --root "${CLAUDE_PLUGIN_ROOT}/skills/w"` returns the extra documents a case needs; read exactly
|
|
29
|
+
`aw context-plan --command export-scripts --signal <s> --root "${CLAUDE_PLUGIN_ROOT}/skills/w"` returns the extra documents a case needs; read exactly those:
|
|
29
30
|
|
|
30
|
-
- `authoring` — the
|
|
31
|
+
- `authoring` — the origin or the rollback is not obvious → [`../exports/export-scripts/EXPORT.md`](../exports/export-scripts/EXPORT.md), no longer loaded on the normal path
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
| Export | Composes | Reads (artifacts / sessions + corpus) | Writes (its ONLY category) |
|
|
26
26
|
|---|---|---|---|
|
|
27
|
-
| [`export-scripts`](export-scripts/EXPORT.md) | `sql` |
|
|
27
|
+
| [`export-scripts`](export-scripts/EXPORT.md) | `sql` | a DECLARED origin: session `SCRIPTS.sql`, loose `docs/scripts/*.sql` and/or published bundles, minus `--exclude` and what already ran in `--environment` | `docs/scripts/NNN-export-scripts-<date>/` (numbered forwards + `00-ROLLBACK.sql`) |
|
|
28
28
|
| [`export-manuals`](export-manuals/EXPORT.md) | — (prose: ambient conventions) | sessions + `DECISION` + plan-doc (`Solution` incl. Final behavior block, `Validations`) + touched code | `docs/manuals/` |
|
|
29
29
|
| [`export-diagrams`](export-diagrams/EXPORT.md) | `diagrams` | source code of the sources + plan-doc (AS-IS → TO-BE delta in `Solution`, `Impacted`) | `docs/diagrams/` (C4 / mermaid) |
|
|
30
30
|
| [`export-reports`](export-reports/EXPORT.md) | — (prose: ambient conventions) | corpus of sessions (spec, `CONCLUSIONS`, `DECISION`) + plan-doc state + `docs/` | `docs/reports/` (executive / functional report) |
|
|
@@ -64,7 +64,9 @@ Mirrors `docs/referencias/workflow-exports/` and the old export SKILLs. Frontmat
|
|
|
64
64
|
Exports read the corpus through the CLI — **never hard-coded paths**:
|
|
65
65
|
|
|
66
66
|
- `aw sessions` — list sessions (counts + next correlative) to enumerate the corpus.
|
|
67
|
-
- `aw release-data [--since sessionNNN] [--source alias] [--include-graduated] [--standalone-sql]` — consolidated dump of sessions (corpus enumeration)
|
|
67
|
+
- `aw release-data [--since sessionNNN] [--source alias] [--include-graduated] [--standalone-sql]` — consolidated dump of sessions (corpus enumeration); `--include-graduated` adds the previous `docs/scripts` bundles (modern and legacy naming) and `--standalone-sql` the loose top-level `*.sql`.
|
|
68
|
+
- `aw export-scripts prepare [--from sessions|bundles|workspace] [--exclude <nombre>] [--environment <ambiente>]` — composes the origin and declares it: where it started, what stayed in, what stayed out and why. These three flags are this export's alone.
|
|
69
|
+
- `aw release-pass link --artifact <ruta> | applied --environment <ambiente>` — the book `--environment` reads: `link` attaches a bundle to a pass by path, `applied` records that its SQL RAN there. Nothing inspects a database.
|
|
68
70
|
- `aw session-artifacts --code <NNN> [--dump [kinds]]` — counts by default; `--dump` returns `{path, content, size}` per artifact (objetivo, decisiones, conclusiones, tasks, checkpoint, backlog, scripts).
|
|
69
71
|
- `aw next-number docs/<category>` — deterministic numbering of the output. It also **creates the category folder when missing** (workspace-init no longer scaffolds docs/ upfront) — this is what makes destination resolution a CLI guarantee. In plan/dry-run mode call it with `--dry-run` (pure query, creates nothing).
|
|
70
72
|
|
|
@@ -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
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../src/application/retirement/graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAsB,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEzF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAKL,YAAY,EACZ,UAAU,EACV,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,EAAoB,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAML,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AAiCtC,MAAM,OAAO,eAAe;IAef;IAEA;IAhBM,KAAK,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC7C,KAAK,GAAmB,EAAE,CAAC;IAEpC;;;;;;;;;OASG;IACH,YACW,YAA2C;IACpD,+EAA+E;IACtE,KAAoB;QAFpB,iBAAY,GAAZ,YAAY,CAA+B;QAE3C,UAAK,GAAL,KAAK,CAAe;IAC5B,CAAC;IAEJ,GAAG,CAAC,IAAe;QACjB,IAAI,CAAC,KAAK,CAAC,GAA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