@pknx/waterfall-cli 0.1.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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/bin/waterfall.mjs +14 -0
  4. package/lib/cli/agent/agent-message.ts +71 -0
  5. package/lib/cli/agent/agent-translators.ts +145 -0
  6. package/lib/cli/agent/backend-invoke.ts +133 -0
  7. package/lib/cli/agent/backends.ts +100 -0
  8. package/lib/cli/agent/global-prompts.ts +55 -0
  9. package/lib/cli/commands/bug-start.ts +115 -0
  10. package/lib/cli/commands/comment-add.ts +47 -0
  11. package/lib/cli/commands/cr-all.ts +18 -0
  12. package/lib/cli/commands/cr-finish.ts +176 -0
  13. package/lib/cli/commands/cr-start.ts +105 -0
  14. package/lib/cli/commands/cr-to-rq.ts +18 -0
  15. package/lib/cli/commands/export-pdf.ts +193 -0
  16. package/lib/cli/commands/horizontal/horizontal.ts +232 -0
  17. package/lib/cli/commands/horizontal-create.ts +34 -0
  18. package/lib/cli/commands/horizontal-update.ts +32 -0
  19. package/lib/cli/commands/join-hint.ts +4 -0
  20. package/lib/cli/commands/registry.ts +59 -0
  21. package/lib/cli/commands/resolve-operator-hint.ts +120 -0
  22. package/lib/cli/commands/rq-all.ts +18 -0
  23. package/lib/cli/commands/rq-to-uc.ts +18 -0
  24. package/lib/cli/commands/story-close.ts +124 -0
  25. package/lib/cli/commands/sync-work-items.ts +59 -0
  26. package/lib/cli/commands/sys-start.ts +96 -0
  27. package/lib/cli/commands/test-all.ts +18 -0
  28. package/lib/cli/commands/test-to-story.ts +18 -0
  29. package/lib/cli/commands/types.ts +33 -0
  30. package/lib/cli/commands/uc-all.ts +18 -0
  31. package/lib/cli/commands/uc-to-story.ts +18 -0
  32. package/lib/cli/commands/uc-to-test.ts +18 -0
  33. package/lib/cli/comments/item-comments.ts +285 -0
  34. package/lib/cli/config/dot-waterfall.ts +404 -0
  35. package/lib/cli/config/global-cli.ts +21 -0
  36. package/lib/cli/config/sync-work-item-config.ts +34 -0
  37. package/lib/cli/core/cli-help-spec.ts +833 -0
  38. package/lib/cli/core/cli-log.ts +124 -0
  39. package/lib/cli/core/exec-file.ts +8 -0
  40. package/lib/cli/core/prompt-map.ts +64 -0
  41. package/lib/cli/core/slug.ts +44 -0
  42. package/lib/cli/entry.ts +4 -0
  43. package/lib/cli/export/collect-md.ts +41 -0
  44. package/lib/cli/export/export-items.ts +104 -0
  45. package/lib/cli/export/export-pdf-path.ts +88 -0
  46. package/lib/cli/export/merge-md.ts +37 -0
  47. package/lib/cli/export/mermaid-run.ts +104 -0
  48. package/lib/cli/export/pandoc-pdf.ts +90 -0
  49. package/lib/cli/export/pdf-bundled-worker.mjs +73 -0
  50. package/lib/cli/export/pdf-bundled.ts +36 -0
  51. package/lib/cli/git/cr-agent-context.ts +62 -0
  52. package/lib/cli/git/git-branch-guards.ts +60 -0
  53. package/lib/cli/git/git-cli-mock.ts +191 -0
  54. package/lib/cli/git/git-cli.ts +24 -0
  55. package/lib/cli/main.ts +434 -0
  56. package/lib/cli/paths.ts +9 -0
  57. package/lib/cli/project/pom-json.ts +55 -0
  58. package/lib/cli/spec/spec-init.ts +216 -0
  59. package/lib/cli/spec/spec-root.ts +93 -0
  60. package/lib/cli/sync/apply-remote-comments.ts +87 -0
  61. package/lib/cli/sync/attachment-category.ts +43 -0
  62. package/lib/cli/sync/diff-work-items.ts +113 -0
  63. package/lib/cli/sync/materialize-remote-bugs.ts +66 -0
  64. package/lib/cli/sync/provider-types.ts +43 -0
  65. package/lib/cli/sync/providers/direct-provider.ts +27 -0
  66. package/lib/cli/sync/providers/jira-provider.ts +34 -0
  67. package/lib/cli/sync/providers/registry.ts +26 -0
  68. package/lib/cli/sync/run-sync-work-items.ts +202 -0
  69. package/lib/cli/sync/spec-work-items.ts +226 -0
  70. package/lib/cli/sync/sync-hint-json.ts +163 -0
  71. package/lib/cli/sync/work-item-meta.ts +117 -0
  72. package/lib/cli/work-items/infer-bug-sys.ts +147 -0
  73. package/lib/cli/work-items/remote-bug-import-scaffold.ts +32 -0
  74. package/lib/cli/work-items/write-bug-to-spec.ts +158 -0
  75. package/package.json +54 -0
  76. package/prompts/commands/bug-start.md +46 -0
  77. package/prompts/commands/cr-finish.md +44 -0
  78. package/prompts/commands/cr-start.md +65 -0
  79. package/prompts/commands/cr-to-rq.md +62 -0
  80. package/prompts/commands/horizontal-create.md +27 -0
  81. package/prompts/commands/horizontal-update.md +39 -0
  82. package/prompts/commands/rq-to-uc.md +62 -0
  83. package/prompts/commands/story-close-all.md +34 -0
  84. package/prompts/commands/story-close.md +44 -0
  85. package/prompts/commands/sync-bugs-refine-imports.md +33 -0
  86. package/prompts/commands/sys-start.md +63 -0
  87. package/prompts/commands/test-to-story.md +64 -0
  88. package/prompts/commands/uc-to-story.md +85 -0
  89. package/prompts/commands/uc-to-test.md +58 -0
  90. package/prompts/global/before-changing-spec.md +62 -0
  91. package/prompts/global/content-requirements-vs-use-cases.md +116 -0
  92. package/prompts/global/cursor-overview.md +31 -0
  93. package/prompts/global/git-usage.md +46 -0
  94. package/prompts/global/horizontal-structure.md +75 -0
  95. package/prompts/global/workflows-index.md +59 -0
  96. package/prompts/items/bug-document-structure.md +23 -0
  97. package/prompts/items/cr-document-structure.md +45 -0
  98. package/prompts/items/rq-theme-document-structure.md +36 -0
  99. package/prompts/items/story-document-structure.md +49 -0
  100. package/prompts/items/sys-document-structure.md +36 -0
  101. package/prompts/items/tst-document-structure.md +55 -0
  102. package/prompts/items/uc-document-structure.md +38 -0
  103. package/spec-template/README.md +11 -0
  104. package/spec-template/full/doc/spec-structure.md +16 -0
  105. package/spec-template/full/prompts/before-changing-spec.md +7 -0
  106. package/spec-template/full/prompts/workflows.md +25 -0
@@ -0,0 +1,55 @@
1
+ # TST document structure — required sections, plus TC table shape
2
+
3
+ This guide defines the canonical markdown shape of a TST:
4
+ `tests/TST-<NNN>-<slug>/TST-<NNN>.md`
5
+
6
+ ## Rule
7
+
8
+ TST markdown is the verification spec. It must be navigable from identity, declare which **UC** / **`TC-*`** it verifies (**typed ids**), and present each testcase as a structured `TC-*` section with a consistent table schema. Do **not** use **`### Upstream`**.
9
+
10
+ ## Required identity block
11
+
12
+ Your `TST-<NNN>.md` should start with:
13
+
14
+ 1. A title heading like `# TST-<NNN> — <human description>`
15
+ 2. Identity fields (present verbatim, one per line):
16
+ - `**Id:** TST-<NNN>`
17
+ - `**Status:** <pending|...>` (or current lifecycle status)
18
+ - `Test type: <manual|automated|...>`
19
+
20
+ ## Links and dependencies
21
+
22
+ Include:
23
+
24
+ 1. `## Links and dependencies`
25
+ 2. `### Verified artifacts` — bullet list of **UC-<NNN>** and **`TC-*`** ids this TST exercises (typed ids only; no “upstream” wording)
26
+ 3. `### Downstream references` — **typed ids only** for produced **`STORY-*`** / **`BUG-*`** (no path-based links — **[`before-changing-spec.md`](../global/before-changing-spec.md)**)
27
+
28
+ ## Required top-level sections
29
+
30
+ 1. `## Objective`
31
+ 2. `## Environment and data` (or equivalent)
32
+ 3. A set of `## TC-<NNN>-<seq> — ...` sections
33
+
34
+ ## TC section table shape (common)
35
+
36
+ Each testcase section should contain:
37
+
38
+ 1. Optional `*Source: ...*` line citing **`UC-<NNN>`** and **`TC-<NNN>-<seq>`** by **id only** (no file paths — **[`before-changing-spec.md`](../global/before-changing-spec.md)**)
39
+ 2. A table with header:
40
+ - `Field | Detail`
41
+ 3. Typical rows:
42
+ - `Objective`
43
+ - `Preconditions`
44
+ - `Steps`
45
+ - `Expected outcome`
46
+
47
+ ## Structural constraints
48
+
49
+ 1. TC ids must remain consistent with what the UC `## TC-...` sections declare.
50
+ 2. Don’t redefine UC behavior; this pass only states verification tasks and expected results.
51
+
52
+ ## Downstream references (required)
53
+
54
+ Whenever TEST → STORY or TEST → BUG happens, append the produced **`STORY-*`** / **`BUG-*`** ids under `### Downstream references`.
55
+
@@ -0,0 +1,38 @@
1
+ # UC document structure — one main file, no separate description
2
+
3
+ ## Rule
4
+
5
+ A use case is documented in **`requirements/RQ-…/UC-…/UC-<NNN>.md`** as the **single** human-readable source for:
6
+
7
+ - identity (id, status, priority),
8
+ - **links and dependencies** (including downstream references),
9
+ - **actors**, **goal**, **preconditions**, **postconditions**,
10
+ - **main flow** (specific, **actionable** steps — not RQ-level generalities),
11
+ - **exceptions**, **non-functional expectations**,
12
+ - **acceptance testcases** — **`## TC-<NNN>-<seq> — …`** sections with ids and tables that **prove** the UC is satisfied (see [`content-requirements-vs-use-cases.md`](../global/content-requirements-vs-use-cases.md)),
13
+ - and any **description / context / background** that would otherwise live in a sidecar “description” file.
14
+
15
+ **Do not** add a second markdown file whose only role is “UC description” (e.g. `UC-<NNN>-Description.md`). **Do not** add **`UC-<NNN>-Testcases.md`** — testcases live **in** **`UC-<NNN>.md`**. If you need a long narrative, add a section in **`UC-<NNN>.md`**, for example:
16
+
17
+ ```markdown
18
+ ## Context and description
19
+
20
+ *(Prose, diagrams-as-links, constraints, glossary pointers — all here.)*
21
+ ```
22
+
23
+ ## What stays separate (unchanged)
24
+
25
+ - **Supplementary non-executable** files **under the same UC folder** (diagrams, static samples) per **`CURSOR.md`** — not a duplicate “description” doc.
26
+
27
+ ## Links and dependencies (shape)
28
+
29
+ Include **`### Downstream references`** only — **no** **`### Upstream`**. Owning **RQ** is implied by folder path; cite **RQ-** / **CR-** by **typed id** in prose if needed.
30
+
31
+ ## Downstream references (required)
32
+
33
+ Inside `## Links and dependencies`, include a `### Downstream references` subsection.
34
+
35
+ Append **one bullet per child id** whenever this UC produces implementation stories (**`STORY-*`**), formal tests (**`TST-*`**), or other directly derived items — **typed ids only**, no path-based markdown links (**[`before-changing-spec.md`](../global/before-changing-spec.md)**).
36
+
37
+ In **body sections** (actors, flows, exceptions), cite other artifacts by **typed id** only — not repository paths.
38
+
@@ -0,0 +1,11 @@
1
+ # Spec scaffold templates
2
+
3
+ Templates for **`waterfall spec init --title "…" --full`** live in **`full/`**.
4
+
5
+ ## Regenerating / editing the full scaffold
6
+
7
+ 1. Change files only under **`full/`** (paths mirror the target spec repo).
8
+ 2. Run **`npm test`** in `waterfall-cli` (see `lib/cli/spec/spec-init.test.ts`).
9
+ 3. New checkouts: `waterfall spec init --title "…" --full [DIR]`.
10
+
11
+ The CLI copies this tree **after** creating `pom.json`, the minimal dirs, `number.json`, and `CURSOR.md`, so do not put `pom.json`, `number.json`, or `CURSOR.md` here (they stay in code as the single source for minimal + extended law text).
@@ -0,0 +1,16 @@
1
+ # Spec tree (reference)
2
+
3
+ This file is **non-normative**. Authoritative rules are **`CURSOR.md`** and your team’s change process.
4
+
5
+ | Path | Role |
6
+ |------|------|
7
+ | `pom.json` | Project metadata: **`title`** (required; used by `waterfall export pdf` and for display); more fields may be added later |
8
+ | `changerequests/` | **CR-*** — CLI scaffolds `CR-<NNN>-<slug>/CR-<NNN>.md` on `cr start` |
9
+ | `requirements/` | **RQ-*** themes with nested **UC-*** |
10
+ | `technical/` | **SYS-*** subsystems, **STORY-***, **BUG-*** |
11
+ | `technical/horizontals/` | **HOR-*** cross-cutting aggregates |
12
+ | `tests/` | **TST-*** test specifications |
13
+ | `prompts/` | Spec-local workflow index + pointers (full scaffold only) |
14
+ | `number.json` | Next ids: `CR`, `RQ`, `UC`, `SYS`, `STORY`, `BUG`, `TST`, `HOR` |
15
+
16
+ Regenerate the **`prompts/`** stubs and this file by editing **`waterfall-cli/spec-template/full/`** and re-running **`waterfall spec init --title "…" --full`** in a fresh directory (or merge changes manually).
@@ -0,0 +1,7 @@
1
+ # Before changing spec (pointer)
2
+
3
+ The full **cross-artifact editing rules** (typed ids, `develop` diff habits, hint policy) live in the Waterfall CLI package:
4
+
5
+ **`waterfall-cli/prompts/global/before-changing-spec.md`**
6
+
7
+ This stub exists so links from **`CURSOR.md`** resolve inside this repository. Operators using **embed** delivery already receive that body from the CLI; with **`--prompt-delivery reference`**, agents open the absolute path under the CLI install.
@@ -0,0 +1,25 @@
1
+ # Workflow prompt index
2
+
3
+ This file is the **spec-local** index for how work flows through **CR → RQ → UC → SYS / STORY → TST**. Keep it short; normative repository law is **`CURSOR.md`**.
4
+
5
+ ## CLI-shipped checklists
6
+
7
+ Transition prompts (**scope of edits**, strict typing) ship with the **Waterfall CLI** (not duplicated here):
8
+
9
+ | Step | Typical CLI command | Prompt file (inside CLI install) |
10
+ |------|---------------------|----------------------------------|
11
+ | Start CR | `waterfall cr start "…"` | *(scaffold only; see CLI docs)* |
12
+ | CR → RQ | `waterfall cr to rq "…"` | `prompts/commands/cr-to-rq.md` |
13
+ | RQ → UC | `waterfall rq to uc "…"` | `prompts/commands/rq-to-uc.md` |
14
+ | UC → story | `waterfall uc to story "…"` | `prompts/commands/uc-to-story.md` |
15
+ | UC → test | `waterfall uc to test "…"` | `prompts/commands/uc-to-test.md` |
16
+ | Test → story | `waterfall test to story "…"` | `prompts/commands/test-to-story.md` |
17
+ | Story close | `waterfall story close STORY-NNN` | `prompts/commands/story-close.md` |
18
+ | CR finish | `waterfall cr finish` | `prompts/commands/cr-finish.md` |
19
+
20
+ Orchestration: `waterfall cr all`, `rq all`, `uc all`, `test all` — see the **CLI orchestration** section in each edge prompt.
21
+
22
+ ## This tree
23
+
24
+ - **`workflows.md`** (this file) — index.
25
+ - **`before-changing-spec.md`** — pointer to global rules; keeps `CURSOR.md` links valid in-repo.