@techierathore/techieflow 1.0.4 → 1.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.
- package/.claude/commands/TechieFlow/tasks/_owner-language.md +1 -0
- package/.claude/commands/TechieFlow/tasks/_status-update-gate.md +4 -3
- package/.claude/commands/TechieFlow/tasks/amend-docs.md +1 -1
- package/.claude/commands/TechieFlow/tasks/day1-brownfield.md +1 -1
- package/.claude/commands/TechieFlow/tasks/day1-greenfield.md +1 -1
- package/.claude/commands/TechieFlow/tasks/fix-issues.md +2 -2
- package/.claude/commands/TechieFlow/tasks/generate-html.md +2 -2
- package/.claude/commands/TechieFlow/tasks/handoff-phase.md +2 -2
- package/.claude/commands/TechieFlow/tasks/mockups.md +1 -1
- package/.claude/commands/TechieFlow/tasks/productguide.md +2 -2
- package/.claude/commands/TechieFlow/tasks/render-workflow-docs.md +1 -1
- package/.claude/commands/TechieFlow/tasks/triage-issues.md +2 -2
- package/.opencode/plugin/techieflow.js +179 -7
- package/.tfcore/hooks/block-git.sh +4 -2
- package/.tfcore/hooks/guard-build.sh +5 -1
- package/.tfcore/hooks/guard-db.sh +6 -4
- package/.tfcore/hooks/guard-status-html.sh +86 -2
- package/.tfcore/hooks/guard-verify.sh +8 -3
- package/.tfcore/hooks/sweep-artifacts.sh +46 -0
- package/.tfcore/standards/owner-words.txt +23 -0
- package/.tfcore/tasks/_owner-language.md +1 -0
- package/.tfcore/tasks/_status-update-gate.md +4 -3
- package/.tfcore/tasks/amend-docs.md +1 -1
- package/.tfcore/tasks/day1-brownfield.md +1 -1
- package/.tfcore/tasks/day1-greenfield.md +1 -1
- package/.tfcore/tasks/fix-issues.md +2 -2
- package/.tfcore/tasks/generate-html.md +2 -2
- package/.tfcore/tasks/handoff-phase.md +2 -2
- package/.tfcore/tasks/mockups.md +1 -1
- package/.tfcore/tasks/productguide.md +2 -2
- package/.tfcore/tasks/render-workflow-docs.md +1 -1
- package/.tfcore/tasks/triage-issues.md +2 -2
- package/.tfcore/telemetry/SCHEMA.md +4 -0
- package/.tfcore/telemetry/install-metrics.sh +3 -2
- package/.tfcore/telemetry/tf-metrics.sh +19 -2
- package/.tfcore/templates/v4custom/app-agents-md-tmpl.md +6 -0
- package/.tfcore/templates/v4custom/app-brd-tmpl.md +5 -3
- package/.tfcore/templates/v4custom/app-phase-brd-tmpl.md +94 -0
- package/.tfcore/templates/v4custom/app-phase-uidesign-tmpl.md +60 -0
- package/.tfcore/templates/v4custom/app-uidesign-tmpl.md +4 -2
- package/.tfcore/templates/v4custom/build-subagent-prompt.md +2 -2
- package/.tfcore/templates/v4custom/html-render-shell.md +4 -2
- package/.tfcore/utils/__pycache__/tf-devguide-list.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-doc-check.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-misses-md.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-render-html.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-split-brd.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-status-facts.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-triage.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-verify-list.cpython-312.pyc +0 -0
- package/.tfcore/utils/__pycache__/tf-verify-verdict.cpython-312.pyc +0 -0
- package/.tfcore/utils/tf-assets-browser.mjs +96 -0
- package/.tfcore/utils/tf-assets.sh +97 -12
- package/.tfcore/utils/tf-brd-status.py +14 -5
- package/.tfcore/utils/tf-build-list.py +80 -12
- package/.tfcore/utils/tf-build-list.sh +2 -1
- package/.tfcore/utils/tf-build.sh +88 -15
- package/.tfcore/utils/tf-ci-repro.py +685 -0
- package/.tfcore/utils/tf-ci-repro.sh +24 -0
- package/.tfcore/utils/tf-devguide-list.py +47 -22
- package/.tfcore/utils/tf-doc-check.py +136 -6
- package/.tfcore/utils/tf-doc-tests.sh +79 -0
- package/.tfcore/utils/tf-emit.sh +92 -35
- package/.tfcore/utils/tf-feedback.sh +13 -0
- package/.tfcore/utils/tf-fix-close.sh +79 -29
- package/.tfcore/utils/tf-goal.sh +12 -12
- package/.tfcore/utils/tf-harness.sh +9 -4
- package/.tfcore/utils/tf-lock.sh +29 -0
- package/.tfcore/utils/tf-log-miss.py +34 -8
- package/.tfcore/utils/tf-login.mjs +167 -0
- package/.tfcore/utils/tf-misses-md.py +10 -4
- package/.tfcore/utils/tf-mockup-parity.mjs +427 -63
- package/.tfcore/utils/tf-mockup-parity.sh +14 -2
- package/.tfcore/utils/tf-owner-text.py +233 -0
- package/.tfcore/utils/tf-owner-text.sh +14 -0
- package/.tfcore/utils/tf-phase.sh +15 -1
- package/.tfcore/utils/tf-portable.sh +230 -0
- package/.tfcore/utils/tf-render-html.py +60 -2
- package/.tfcore/utils/tf-selfcheck.sh +39 -6
- package/.tfcore/utils/tf-split-brd.py +11 -1
- package/.tfcore/utils/tf-status-evidence.sh +11 -9
- package/.tfcore/utils/tf-status-facts.py +72 -32
- package/.tfcore/utils/tf-triage.py +62 -16
- package/.tfcore/utils/tf-triage.sh +2 -0
- package/.tfcore/utils/tf-verify-boot.sh +263 -43
- package/.tfcore/utils/tf-verify-emit.sh +20 -0
- package/.tfcore/utils/tf-verify-env.sh +33 -4
- package/.tfcore/utils/tf-verify-list.py +75 -8
- package/.tfcore/utils/tf-verify-screens.mjs +171 -32
- package/.tfcore/utils/tf-verify-screens.sh +8 -3
- package/.tfcore/utils/tf-verify-tests.sh +215 -14
- package/.tfcore/utils/tf-verify-verdict.py +48 -9
- package/.tfcore/utils/tf_defect.py +27 -0
- package/.tfcore/utils/tf_feedback.py +209 -0
- package/.tfcore/utils/tf_roadmap.py +35 -0
- package/README.md +4 -0
- package/docs/TechieFlow-Installation.md +5 -3
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ Everything the owner reads — a terminal reply, a document, a status line, the
|
|
|
9
9
|
- **No coined terms, no shorthand.** "the framework's own script", not "the oracle". "the number you divide by", not "the denominator". If the owner would have to look a word up, it is the wrong word.
|
|
10
10
|
- **Writing a glossary means the words are wrong.** Change the words. `tf-doc-check.sh` refuses a glossary section.
|
|
11
11
|
- First sentence carries the answer. Name the thing, not its id. Short sentences. Never dramatise.
|
|
12
|
+
- **A command's closing message is checked before the turn can end** (`tf-owner-text.sh`, run by the Stop hook on it and on any free-form document it hands over): no word from `.tfcore/standards/owner-words.txt`; each open upstream problem in a table row saying what it affects and whether it blocks or breaks anything, with the prompt that fixes it; one recorded as fixed upstream called fixed; each command still to run given as the line to paste; and the next prompt in a code block.
|
|
12
13
|
|
|
13
14
|
## 2. A question for the owner goes in a file, not in the conversation
|
|
14
15
|
|
|
@@ -7,8 +7,9 @@ Steps, in this order:
|
|
|
7
7
|
1. `bash .tfcore/utils/tf-status-facts.sh {App} "{command}"` prints today's date, the phase line, the last verified build, the Open requirements section, the Verification log with its new row, the library feedback lines, and the next command in both harness forms. Copy them as printed.
|
|
8
8
|
2. Write `PROJECT-STATUS.md` with the Write tool in the shape of `.tfcore/templates/v4custom/app-project-status-tmpl.md`: replace every section in place, add none. You write two parts yourself: "Where I am" (at most 80 words, state not story) and "Known blockers". A refused write means the content is mis-shaped: trim it, do not reword it.
|
|
9
9
|
3. `bash .tfcore/utils/tf-doc-check.sh PROJECT-STATUS.md <every document this command wrote>`; day-1 and `*amend-docs` run `--app {App}` instead, because they own every document. A `FAIL` line means the phase is not closed: fix the document and re-run. A line printed as `OLD` was already there when the command started (the phase marker records them); it does not block and is repaired through `*amend-docs`. Never edit a schema to make a document pass. Documents this command did not write are reported with `--warn`, not fixed here: an older project is repaired through `*amend-docs` when it is next worked on (Schemas §7.1, decision 8).
|
|
10
|
-
4. `bash .tfcore/utils/tf-
|
|
11
|
-
5. `bash .tfcore/utils/tf-
|
|
12
|
-
6.
|
|
10
|
+
4. When this command changed a file under `docs/`, `bash .tfcore/utils/tf-doc-tests.sh <every document it changed>`. A unit test may read a document and guard its text; when one does, this runs the unit tests. `NONE` or `PASS` goes on. `FAIL` means the phase is not closed: put the guarded text back, or, when the change is meant, name the test under "Known blockers" for `*triage-and-fix` to update, since a document command never edits code. `NOT-RUN` is reported as it is printed (Lekhak TF-016).
|
|
11
|
+
5. `bash .tfcore/utils/tf-render-html.sh PROJECT-STATUS.md`, and the same for every human document this command wrote. The checklist, the miss log and feedback files are never rendered.
|
|
12
|
+
6. `bash .tfcore/utils/tf-brd-status.sh {App}` rewrites the BRD's Development status table from the checklist and re-renders the BRD.
|
|
13
|
+
7. Append the run record: `.tfcore/tasks/_metrics-emit-gate.md`.
|
|
13
14
|
|
|
14
15
|
Evidence for every line is the checklist's Requirements Status table and the files on disk, never git. Check a framework file by reading its literal path under `.tfcore/`; search tools skip that folder.
|
|
@@ -22,6 +22,6 @@ First: `bash .tfcore/utils/tf-phase.sh start amend-docs {App}` prints the start
|
|
|
22
22
|
8. If the amendment changed code-level flows, say that `*devguide {App} --update` is due after the next build.
|
|
23
23
|
9. Close what this amendment fixed: `bash .tfcore/utils/tf-emit.sh --open-misses {App} --artifact-class doc` lists the open misses whose deficient artifact is a document. Close the ones this amendment resolves in one call: `bash .tfcore/utils/tf-fix-close.sh {App} --misses <id>,<id> --fix-cmd amend-docs --verdict Verified`. Where the mapping from a miss to this amendment is unclear, ask, do not guess. Without this a document miss can never close: `*fix-issues` and `*build-phase` close off checklist rows the verifier touched, which a BRD edit never is.
|
|
24
24
|
10. Decide whether this amendment is a miss: should the original documents plainly have said this (a behaviour that was always required, or two sections that contradicted each other)? Then run `*log-miss {App} "<one sentence>"`. A change of mind or a feature decided today is scope arriving late, not a miss.
|
|
25
|
-
11. `bash .tfcore/utils/tf-doc-check.sh --app {App}`; fix every FAIL.
|
|
25
|
+
11. `bash .tfcore/utils/tf-doc-check.sh --app {App}`; fix every FAIL. Then `bash .tfcore/utils/tf-doc-tests.sh <every document this amendment changed>`: a unit test that reads one of them runs, and a `FAIL` means the amendment removed or changed text a test guards. Put it back, or, when the change is meant, the phase stays open and the report names the test for `*triage-and-fix`; never edit the test here (Lekhak TF-016).
|
|
26
26
|
12. Run the status gate (`.tfcore/tasks/_status-update-gate.md`) with `"cmd":"amend-docs"`.
|
|
27
27
|
13. Report: items added (ids), modified, removed, the highest id now, what changed in the Architecture, the checklist rows touched, and the next command from the gate.
|
|
@@ -19,7 +19,7 @@ First, before anything else: `bash .tfcore/utils/tf-phase.sh start day1-brownfie
|
|
|
19
19
|
4. BRD, first half: `docs/{App}-BRD.md` from `app-brd-tmpl.md`: the header (App, Kind, Size, Stack answer set, Status, Date), Summary, Scope, Users and roles, and the Screens and flow table, one row per routed page found in the code. A dialog is a row under its parent screen with `on /route` in the Route column.
|
|
20
20
|
5. Mockups: run `.tfcore/tasks/mockups.md` for `{App}`. It links the mockups already in `docs/mockups/` to their screens and produces one for every screen that has none, from the code and the running application. Every screen ends with a mockup.
|
|
21
21
|
6. BRD, second half: the Requirements ledger, one `BRD-N` per thing the verifier will test, each naming its screen, linking its mockup and carrying one acceptance line "When <actor> <does what> on <screen>, then <observable result>". Harvested documents come first: every "the system shall" or "the user can" line becomes an item, attributed, and every table, screen inventory and workflow they hold carries in, never compressed to a one-liner. Then the code: what it already does becomes items too. Mark inferred items `<!-- inferred — please verify -->`. The Non-functional table takes a `perf-budget:` only where the owner stated a number, and the logging requirement from the answer set, recorded as met when the scan found it wired. The Development status table has one row per screen with Verified and Open counts from the strongest evidence. If the count would pass the size cap, propose a phase split instead of merging items.
|
|
22
|
-
Large: steps 4 to 6 run once per phase of the Phases table, phase 1 in `docs/{App}-BRD.md` and `docs/{App}-UIDesign.md`, phase n in `docs/{App}-Pn-BRD.md` and `docs/{App}-Pn-UIDesign.md`, each header carrying `Phase | n of m` and its own Size, ids running on across phases.
|
|
22
|
+
Large: steps 4 to 6 run once per phase of the Phases table, phase 1 in `docs/{App}-BRD.md` and `docs/{App}-UIDesign.md`, phase n in `docs/{App}-Pn-BRD.md` (from `app-phase-brd-tmpl.md`: this phase's screens and requirements only, linking back to phase 1) and `docs/{App}-Pn-UIDesign.md` (from `app-phase-uidesign-tmpl.md`, the same way), each header carrying `Phase | n of m` and its own Size, ids running on across phases.
|
|
23
23
|
7. Checklist: run `.tfcore/tasks/split-brd.md` for `{App}` (Large: with `--all-phases`, one checklist per phase). If a phased plan is among the harvested documents, split-brd migrates its statuses; the plan then moves to `docs/OldDocs/`.
|
|
24
24
|
8. Coding Standards: `docs/{App}-Coding-Standards.md` from `app-coding-standards-tmpl.md`. "Standards applied" names `.tfcore/standards/coding-standards-core.md` and the stack file, plus the choices the stack file leaves open. Where the stack file leaves a naming convention open, it follows the drift scan of step 3: the dominant style if one reaches 80 percent, else the stack file's default; a drafting instruction overrides. "Project rules" holds only rules true of this project alone.
|
|
25
25
|
9. `bash .tfcore/utils/tf-day1-files.sh {App} --prefix {obj|none}` writes `.editorconfig`, `AGENTS.md` and `CLAUDE.md`.
|
|
@@ -21,7 +21,7 @@ Then, in this order:
|
|
|
21
21
|
8. BRD, first half: `docs/{App}-BRD.md` from `app-brd-tmpl.md`: the header (App, Kind, Size, Stack answer set, Status, Date), Summary, Scope, Users and roles, and the Screens and flow table. A dialog is a row under its parent screen with `on /route` in the Route column.
|
|
22
22
|
9. Mockups: run `.tfcore/tasks/mockups.md` for `{App}`. It reads the Screens and flow table and produces `docs/{App}-UIDesign.md` and one `docs/mockups/<screen>.html` per screen. An app with no screens records "skipped — no UI".
|
|
23
23
|
10. BRD, second half: the Requirements ledger, one `BRD-N` per thing the verifier will test, each naming its screen, linking its mockup and carrying one acceptance line "When <actor> <does what> on <screen>, then <observable result>"; the Non-functional table (a `perf-budget:` only where the owner gave a number; the logging requirement from the answer set); the Development status table, one row per screen, all Planned. The concept is the primary source: every feature, actor and constraint in it becomes an item. Mark inferred items `<!-- inferred — please verify -->`. Harvested requirements carry in as items, attributed, none dropped. If the count would pass the size cap, propose a phase split instead of merging items.
|
|
24
|
-
Large: steps 8 to 10 run once per phase of the Phases table, phase 1 in `docs/{App}-BRD.md` and `docs/{App}-UIDesign.md`, phase n in `docs/{App}-Pn-BRD.md` and `docs/{App}-Pn-UIDesign.md`, each header carrying `Phase | n of m` and its own Size, ids running on across phases. Every screen gets its mockup now.
|
|
24
|
+
Large: steps 8 to 10 run once per phase of the Phases table, phase 1 in `docs/{App}-BRD.md` and `docs/{App}-UIDesign.md`, phase n in `docs/{App}-Pn-BRD.md` (from `app-phase-brd-tmpl.md`: this phase's screens and requirements only, linking back to phase 1) and `docs/{App}-Pn-UIDesign.md` (from `app-phase-uidesign-tmpl.md`, the same way), each header carrying `Phase | n of m` and its own Size, ids running on across phases. Every screen gets its mockup now.
|
|
25
25
|
11. `bash .tfcore/utils/tf-doc-check.sh --app {App}`; fix every FAIL.
|
|
26
26
|
12. Run the status gate (`.tfcore/tasks/_status-update-gate.md`); the run record carries `"cmd":"day1-greenfield","mode":"stage1"`.
|
|
27
27
|
13. Stop and say: "Stage 1 is complete: BRD, Architecture and mockups are written and rendered. Review them in the HTML files, or edit the markdown. When you approve, run `*day1-greenfield {App} --stage2`. To change a screen, edit the concept and re-run stage 1, or run `*mockups {App} --update`."
|
|
@@ -8,8 +8,8 @@ First: `bash .tfcore/utils/tf-phase.sh start fix-issues {App}` prints the start
|
|
|
8
8
|
|
|
9
9
|
1. Triage first, as `.tfcore/tasks/triage-issues.md` steps 1 to 4: read the evidence, boot (`tf-verify-boot.sh start`), reproduce each issue on its screen with the screens script, map it to its row, and log it with `tf-triage.sh demote` or `new`. Then `bash .tfcore/utils/tf-triage.sh {App} close --started <the step-0 time> --cmd fix-issues` writes the escaped gate records and the misses with the discovery cost. A defect nobody logged has no miss to close, so this step is never skipped.
|
|
10
10
|
2. `bash .tfcore/utils/tf-build-list.sh {App} --prompts` now prints FIX mode with the demoted rows, their clusters and one builder prompt each. Spawn every cluster in one turn, exactly as `.tfcore/tasks/build-phase.md` step 2 says: `[trblazeui]` through `/trblazeui`, `[techierag]` through `/techierag`, the rest through the builder sub-agent. A library gap goes into the library's feedback file and the row becomes `Blocked`; never a workaround.
|
|
11
|
-
3. `bash .tfcore/utils/tf-build.sh` until PASS, then smoke every fixed screen with `tf-verify-screens.sh --screen …` (`.tfcore/tasks/_smoke-test-policy.md`); a screen that still fails re-enters step 2 for its rows.
|
|
12
|
-
4. Execute `.tfcore/tasks/verify-phase.md` inline, scoped to the touched rows
|
|
11
|
+
3. `bash .tfcore/utils/tf-build.sh` until PASS, then smoke every fixed screen with `tf-verify-screens.sh --screen …` (`.tfcore/tasks/_smoke-test-policy.md`); a screen that still fails re-enters step 2 for its rows. When the evidence was a failed CI run, `bash .tfcore/utils/tf-ci-repro.sh` must also print PASS; a local build with warm caches does not prove a CI fix. The report says the fix passed that reproduction and that the owner's next CI run is the final check, never that CI is fixed.
|
|
12
|
+
4. Execute `.tfcore/tasks/verify-phase.md` inline, scoped to the touched rows, with its own step 0; rows of another phase's checklist are a second verify with `--phase N`. Only that run writes `Verified`.
|
|
13
13
|
5. `bash .tfcore/utils/tf-verify-boot.sh stop`, then `bash .tfcore/utils/tf-fix-close.sh {App} --started <the step-0 time> --subagents <what was fanned out> --build <pass|fail>`: the fix-issues run record first, then one miss-fix per touched row with the verifier's verdict from the ledger. A row the verifier left below `Verified` stays open with that verdict on its miss-fix.
|
|
14
14
|
6. Run the status gate (`.tfcore/tasks/_status-update-gate.md`); the run record is the one step 5 wrote. When this run is the last step of a goal, write the sentinel (`.tfcore/tasks/_yolo-mode.md`).
|
|
15
15
|
7. Report: evidence read, issues by kind, rows fixed and now `Verified`, rows still open and why, library gaps logged, and the next command from the gate.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generate-html
|
|
2
2
|
|
|
3
|
-
Convert one or more **human-readable** markdown files to self-contained HTML using the shared shell. Use this when you need to render documents that `*render-workflow-docs` does not cover (the UsageGuide, the DevGuide,
|
|
3
|
+
Convert one or more **human-readable** markdown files to self-contained HTML using the shared shell. Use this when you need to render documents that `*render-workflow-docs` does not cover (the UsageGuide, the DevGuide, ad-hoc design notes, legacy/archived docs). Note: suffixed doc variants like `-v2` are banned by the collision policy (day1-brownfield §1.6) — superseded docs live unmodified in `docs/OldDocs/`.
|
|
4
4
|
|
|
5
5
|
**NEVER render an agent working document to HTML.** Two are banned by name and `tf-render-html.sh` refuses both with exit 2: the **requirements checklist** `*-Checklist.md` (and its Requirements Status table), and the **miss log** `*-Misses.md`. Agents read them in markdown; an HTML mirror burns tokens and drifts from the source. If asked to render either, decline and explain it is an agent document; if a stale `*-Checklist.html` or `*-Misses.html` exists from before this rule, delete it. The test for any other file: **if the only reader is an agent, it stays markdown.**
|
|
6
6
|
|
|
@@ -92,7 +92,7 @@ Per shell §9 checklist, for each rendered file confirm:
|
|
|
92
92
|
- No external resource references except the two CDN scripts.
|
|
93
93
|
|
|
94
94
|
**Mermaid validity pass (do this for EVERY diagram — it is the #1 reported bug).** Apply the shell §5.5 self-check to each mermaid block before emitting it:
|
|
95
|
-
- Each node/edge/subgraph label that contains anything other than letters, digits, and spaces (i.e. has `(` `)` `/` `&` `:` `,` `[` `]` `{` `}` `#` `@` `<` `>` `|` `"` etc.) MUST be wrapped in double quotes, with the quotes INSIDE the shape brackets (`API["
|
|
95
|
+
- Each node/edge/subgraph label that contains anything other than letters, digits, and spaces (i.e. has `(` `)` `/` `&` `:` `,` `[` `]` `{` `}` `#` `@` `<` `>` `|` `"` etc.) MUST be wrapped in double quotes, with the quotes INSIDE the shape brackets (`API["Orders API (v2)"]`, `DB[("Main database")]`).
|
|
96
96
|
- No node id is a reserved word (lowercase `end`).
|
|
97
97
|
- If you find a bare label in the source MD, **fix it in the emitted HTML** (quote it) rather than copying through a diagram you know will throw "Syntax error" in the browser. Note any such fix in the output summary so the author can also fix the MD source.
|
|
98
98
|
|
|
@@ -84,11 +84,11 @@ Invoke `render-workflow-docs {AppName}` as a subtask. Specifically:
|
|
|
84
84
|
- `docs/{AppName}-Architecture.html` — if implementation revealed "as-built" deltas from "Target", update Architecture.md first, then re-render. Set status to "Current (post-implementation)" or "Current + planned target" as appropriate.
|
|
85
85
|
- `PROJECT-STATUS.html` — always re-render (just updated in §2)
|
|
86
86
|
|
|
87
|
-
Then re-render the **Usage Guide** (updated in §1) and the **DevGuide** (refreshed in §3a) via `.tfcore/tasks/generate-html.md`: `docs/{AppName}-UsageGuide.md` (+
|
|
87
|
+
Then re-render the **Usage Guide** (updated in §1) and the **DevGuide** (refreshed in §3a) via `.tfcore/tasks/generate-html.md`: `docs/{AppName}-UsageGuide.md` (+ `docs/{AppName}-DevGuide.md`) → sibling `.html`. **Do NOT render the checklist to HTML** — it is an AI-agent working document kept in markdown only; its Status table stays accurate in markdown.
|
|
88
88
|
|
|
89
89
|
### 3a. Refresh the Developer Guide
|
|
90
90
|
|
|
91
|
-
Run `.tfcore/tasks/devguide.md` for `{AppName}` (`*devguide {AppName}`) so the screen-by-screen code map reflects the final as-built code — this is the doc a human developer uses to chase bugs and verify the AI-generated code from page → control → service → data-access → stored proc. If a DevGuide already exists, an incremental `--update` is enough (remap only changed screens). It produces `docs/{AppName}-DevGuide.md
|
|
91
|
+
Run `.tfcore/tasks/devguide.md` for `{AppName}` (`*devguide {AppName}`) so the screen-by-screen code map reflects the final as-built code — this is the doc a human developer uses to chase bugs and verify the AI-generated code from page → control → service → data-access → stored proc. If a DevGuide already exists, an incremental `--update` is enough (remap only changed screens). It produces `docs/{AppName}-DevGuide.md`, one file at any size, and its `.html`; §3 above already lists them in the re-render set.
|
|
92
92
|
|
|
93
93
|
### 4. Consolidate the per-library feedback files
|
|
94
94
|
|
|
@@ -9,7 +9,7 @@ First: `bash .tfcore/utils/tf-phase.sh start mockups {App}` prints the start tim
|
|
|
9
9
|
1. `bash .tfcore/utils/tf-mockups-locate.sh` moves any mockup found elsewhere in the repository into `docs/mockups/` and lists what is there.
|
|
10
10
|
2. Read the component reference of the UI library named in the Architecture's Stack decisions (for TrBlazeUI, `.trblazeui/TrBlazeUI-AI-Reference.md`; build once if it is absent). Design only with controls that exist. A control the library lacks is logged as an entry in `docs/{App}-<Library>-Feedback.md`, never designed in silently.
|
|
11
11
|
3. Read the BRD's Screens and flow table: every row is a screen, with its route, roles and fields; a dialog row belongs to its parent screen. A screen that already has a mockup in `docs/mockups/` keeps it and is linked. An app with no screens records "skipped — no UI" in the UIDesign and stops.
|
|
12
|
-
4. For each screen without a mockup (fan out one sub-agent per group of screens when there are many): decide the layout regions, map every region to a control, write `docs/mockups/<screen-slug>.html` with realistic placeholder data in the library's visual language, and fill the screen's section in `docs/{App}-UIDesign.md` from `.tfcore/templates/v4custom/app-uidesign-tmpl.md` (mockup link, roles, regions-to-controls table, fields table, the dialogs it opens, the empty, loading and error states). One shell, one theme, one spacing system across the set.
|
|
12
|
+
4. For each screen without a mockup (fan out one sub-agent per group of screens when there are many): decide the layout regions, map every region to a control, write `docs/mockups/<screen-slug>.html` with realistic placeholder data in the library's visual language, and fill the screen's section in `docs/{App}-UIDesign.md` from `.tfcore/templates/v4custom/app-uidesign-tmpl.md` — for phase n of a Large project, `docs/{App}-Pn-UIDesign.md` from `app-phase-uidesign-tmpl.md`, which carries that phase's screens only (mockup link, roles, regions-to-controls table, fields table, the dialogs it opens, the empty, loading and error states). One shell, one theme, one spacing system across the set.
|
|
13
13
|
5. Make the set click through. The entry screen is the sign-in page (or onboarding, or the home page when there is neither). Every link and every navigation button goes to the mockup it names, written as `<a href="screen.html">` or a form action, never as a script (`onclick="location.href=…"` is refused: it dies in any viewer without scripts): sign in opens the home screen, logout returns to sign in, an "Add" button opens the add screen, a row opens its detail, every menu item leads to its screen. Every screen has a way out. A button that does not navigate shows a message with `onclick`. A dialog opens on its parent page. Sign-in needs no credentials: the button alone navigates.
|
|
14
14
|
6. Anchor every element the build must match with `data-testid`, using the names from the regions-to-controls table: the layout regions, every badge and status indicator, every icon button, every card, table and chart, and every value cell whose width matters. The verifier compares only anchored elements; a mockup without anchors is ungradeable.
|
|
15
15
|
7. `bash .tfcore/utils/tf-doc-check.sh --app {App}`: it refuses a broken link, an unreachable or dead-end screen, an inert button and an unanchored mockup. Fix every FAIL.
|
|
@@ -26,7 +26,7 @@ The Product Guide documents the real running app. If the repo is doc-only / not
|
|
|
26
26
|
### 2. Gather the screen inventory + screenshots (reuse, don't reinvent)
|
|
27
27
|
|
|
28
28
|
The DevGuide already did the hard discovery work — reuse it:
|
|
29
|
-
- Read the **DevGuide** (`docs/{AppName}-DevGuide.md
|
|
29
|
+
- Read the **DevGuide** (`docs/{AppName}-DevGuide.md`) for the role→menu map, the screen list, the real post-login landing per role (LANDING-TRUTH), and each screen's purpose.
|
|
30
30
|
- Use the **screenshots** the DevGuide's OBSERVE pass captured under `docs/screenshots/{AppName}/` (`{role}-{screen-slug}.png`, + `-mobile` where present). These are the images the guide embeds.
|
|
31
31
|
- Read the **BRD** §9 feature catalog (feature purpose/benefit, personas) and the **UsageGuide** (user flows + known limitations) for the plain-language "what it's for" and "tips".
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ The DevGuide already did the hard discovery work — reuse it:
|
|
|
34
34
|
|
|
35
35
|
### 3. Decide structure — single doc vs per-role split
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**Split per role** when `roles ≥ 3` OR `screens > 12` OR any role has `> 8` screens; else single. Honor `--single`/`--split`. A split guide lives in `docs/productguides/` (index + per-role files co-located, so relative links resolve); a single guide is `docs/{AppName}-ProductGuide.md`. On a structure switch (single↔split), move/delete the stale-location copy so only one canonical copy survives.
|
|
38
38
|
|
|
39
39
|
### 4. Write the guide — END-USER voice, screenshot per screen (FAN OUT per role)
|
|
40
40
|
|
|
@@ -6,7 +6,7 @@ Render BRD.html, Architecture.html, and PROJECT-STATUS.html from their markdown
|
|
|
6
6
|
|
|
7
7
|
After day-1 (or any phase that changes BRD/Architecture/PROJECT-STATUS), regenerate the human-readable HTML mirrors. Self-contained single-file HTML with Mermaid rendering, copy buttons on every code block, mermaid toolbar (zoom/fit/1:1/fullscreen/popout), inline TOC, and sidebar TOC for long docs.
|
|
8
8
|
|
|
9
|
-
**If the user has ad-hoc HUMAN-readable docs to render (
|
|
9
|
+
**If the user has ad-hoc HUMAN-readable docs to render (design notes, archived docs, anything else), use `*generate-html @path/to/file.md` instead — this task only handles the three canonical files.** Note: the **checklist is an AI-agent working document and is NEVER rendered to HTML** — do not render `*-Checklist.md` here or via `generate-html`. Nor are the miss log and feedback files.
|
|
10
10
|
|
|
11
11
|
## Inputs
|
|
12
12
|
|
|
@@ -6,9 +6,9 @@ First: `bash .tfcore/utils/tf-phase.sh start triage-issues {App}` prints the sta
|
|
|
6
6
|
|
|
7
7
|
## Steps
|
|
8
8
|
|
|
9
|
-
1. Read every screenshot and the notes; from a written list take one issue per symptom in the reporter's words. Build the issue list: screen, role, symptom, evidence path, a first guess of kind (`layout`, `render-empty`, `data-logic`, `rag`).
|
|
9
|
+
1. Read every screenshot and the notes; from a written list take one issue per symptom in the reporter's words. Build the issue list: screen, role, symptom, evidence path, a first guess of kind (`layout`, `render-empty`, `data-logic`, `rag`). A failed CI run (its id, link or log) is evidence too: its issue is the failing step and its first error.
|
|
10
10
|
2. `bash .tfcore/utils/tf-verify-boot.sh start` boots the application (dependent services first, from their own configuration). Sign in as a UsageGuide test user (`.tfcore/tasks/_smoke-test-policy.md`). NONE means the issues are logged from the evidence alone and the report says the app was not booted.
|
|
11
|
-
3. Reproduce each issue on its screen; `bash .tfcore/utils/tf-verify-screens.sh --screen <name>=<route> … --base <url>` gives the render and visual evidence and a screenshot. Settle the kind from what you see and map the issue to its row in the checklist (the acceptance line's screen; the DevGuide's screen list). Print the triage table: issue, row, kind, action.
|
|
11
|
+
3. Reproduce each issue on its screen; `bash .tfcore/utils/tf-verify-screens.sh --screen <name>=<route> … --base <url>` gives the render and visual evidence and a screenshot. Settle the kind from what you see and map the issue to its row in the checklist (the acceptance line's screen; the DevGuide's screen list). Print the triage table: issue, row, kind, action. A CI failure is reproduced with `bash .tfcore/utils/tf-ci-repro.sh [<workflow>] [--job <id>]`, never by running the workflow's commands here: this machine's package caches and build output hide what a fresh runner hits (Lekhak TF-019: a runtime pack only the local NuGet cache held). Its FAIL line is the reproduction; a PASS means it could not be reproduced here, logged with `note`.
|
|
12
12
|
4. Log each issue with `bash .tfcore/utils/tf-triage.sh {App} …`: `demote <REQ> "<symptom>" --kind … --evidence <path>` for a defect inside a row's scope, whatever its status; `new "<title>" "<When … on <screen>, then …>" --section "<screen>"` for a defect no row covers (a Not Started row with `BRD-pending`; new scope rather than a defect is still logged, and the report names `*amend-docs`); `note <REQ> "<what was tried>"` when it could not be reproduced. `--source production` for a live report. Whose gap it was is recorded as `--sort` (the four questions of `.tfcore/tasks/log-miss.md` step 1); without it a demoted row is `weak-check` (its line existed and the check let it through) and a new row is `spec`.
|
|
13
13
|
5. With `verify`: execute `.tfcore/tasks/verify-phase.md` inline, scoped to the demoted rows' siblings on the same screens and any scope the owner named. Without it, the verifier does not run and nothing is re-checked informally.
|
|
14
14
|
6. `bash .tfcore/utils/tf-verify-boot.sh stop`, then `bash .tfcore/utils/tf-triage.sh {App} close --started <the step-0 time>`: one escaped gate record per row (no check caught it), one miss per row in the reporter's words with the discovery cost, the run record, and a warning plus a miss if any code file changed during the run.
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// bash {command} -> Bash {command} -> block-git.sh + guard-artifacts.sh + guard-verify-deps.sh
|
|
22
22
|
// edit {filePath,oldString,newString} -> Edit {file_path,old_string,new_string}
|
|
23
23
|
// write {filePath,content} -> Write {file_path,content} -> guard-status.sh + guard-verify.sh
|
|
24
|
-
// session.idle (root session) -> Stop {stop_hook_active}
|
|
24
|
+
// session.idle (root session) -> Stop {stop_hook_active, last_assistant_message, turn_started} -> guard-status-html.sh
|
|
25
25
|
// session.created (first root session) -> SessionStart -> sweep-artifacts.sh
|
|
26
26
|
// OpenCode has no blocking Stop hook, so the stale-PROJECT-STATUS.html guard
|
|
27
27
|
// (_status-update-gate.md step 4) is bridged as a ONE-SHOT nudge: when the root
|
|
@@ -42,14 +42,25 @@
|
|
|
42
42
|
// idles once). Records share session_id; consumers take the record with the
|
|
43
43
|
// highest output_tokens (or latest ts) per session_id. SCHEMA.md §4 notes this.
|
|
44
44
|
|
|
45
|
+
//
|
|
46
|
+
// Two OpenCode plugin APIs, one file (2026-09-27). OpenCode 1.x (the design's 1.18.18; 1.18.32 is
|
|
47
|
+
// the last 1.x) reads the default export's `server`; OpenCode 2 (checked on 2.0.18, 2026-09-28)
|
|
48
|
+
// accepts only a default export with `id` and `setup`, and refused this file with "Plugin must export
|
|
49
|
+
// a default definition with an id and an effect or setup function". The default export carries all
|
|
50
|
+
// three; `setup` translates 2.x's hook and event API into the 1.x hooks below, so the guards, the
|
|
51
|
+
// shell env and telemetry are the same code in both. What 2.x does not offer: `permission.ask` (YOLO
|
|
52
|
+
// auto-approval; OpenCode 2's own `--auto` flag is the switch there) and the session's messages, so
|
|
53
|
+
// the Stop nudge's owner-text check (guard-status-html.sh check 5) is skipped there; checks 1-4 run.
|
|
54
|
+
|
|
45
55
|
import fs from "node:fs"
|
|
46
56
|
import path from "node:path"
|
|
47
57
|
import os from "node:os"
|
|
48
58
|
import { spawnSync } from "node:child_process"
|
|
59
|
+
import { fileURLToPath } from "node:url"
|
|
49
60
|
|
|
50
61
|
const GUARD_TIMEOUT_MS = 10000
|
|
51
62
|
|
|
52
|
-
|
|
63
|
+
const TechieFlowPlugin = async ({ directory, client }) => {
|
|
53
64
|
const root = directory
|
|
54
65
|
const hooksDir = path.join(root, ".tfcore", "hooks")
|
|
55
66
|
const tfEmit = path.join(root, ".tfcore", "utils", "tf-emit.sh")
|
|
@@ -110,8 +121,29 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
110
121
|
const htmlNudged = Object.create(null) // rootID -> true once the stale-HTML nudge was sent
|
|
111
122
|
let pointerWritten = false
|
|
112
123
|
|
|
124
|
+
// What Claude Code hands its Stop hook and OpenCode does not: the closing message, and when
|
|
125
|
+
// the turn began (the last prompt the owner typed). The guard checks the message the owner
|
|
126
|
+
// reads at the end of a command (tf-owner-text.sh). Empty on any failure: the check then skips.
|
|
127
|
+
async function closingTurn(rootID) {
|
|
128
|
+
try {
|
|
129
|
+
if (typeof client.session.messages !== "function") return {}
|
|
130
|
+
const res = await client.session.messages({ path: { id: rootID } })
|
|
131
|
+
const list = Array.isArray(res) ? res : (res && res.data) || []
|
|
132
|
+
const text = (m) => (m.parts || []).filter((x) => x.type === "text" && !x.synthetic).map((x) => x.text).join("\n")
|
|
133
|
+
let message = "", turn = null
|
|
134
|
+
for (const m of list) {
|
|
135
|
+
const info = m.info || {}
|
|
136
|
+
if (info.role === "user" && text(m).trim()) turn = (info.time || {}).created || turn
|
|
137
|
+
if (info.role === "assistant" && text(m).trim()) message = text(m)
|
|
138
|
+
}
|
|
139
|
+
return turn ? { last_assistant_message: message, turn_started: turn } : {}
|
|
140
|
+
} catch {
|
|
141
|
+
return {}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
113
145
|
// Stop-hook analogue for guard-status-html.sh (see header). Never throws.
|
|
114
|
-
function nudgeStaleStatusHtml(rootID) {
|
|
146
|
+
async function nudgeStaleStatusHtml(rootID) {
|
|
115
147
|
try {
|
|
116
148
|
if (!client || !client.session || typeof client.session.prompt !== "function") return
|
|
117
149
|
const msg = guardBlocks("guard-status-html.sh", {
|
|
@@ -119,6 +151,7 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
119
151
|
cwd: root,
|
|
120
152
|
session_id: rootID,
|
|
121
153
|
stop_hook_active: htmlNudged[rootID] === true,
|
|
154
|
+
...(htmlNudged[rootID] === true ? {} : await closingTurn(rootID)),
|
|
122
155
|
})
|
|
123
156
|
if (!msg) return
|
|
124
157
|
htmlNudged[rootID] = true
|
|
@@ -232,14 +265,16 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
232
265
|
const args = output.args || {}
|
|
233
266
|
let payload = null
|
|
234
267
|
let scripts = []
|
|
235
|
-
if (input.tool === "bash") {
|
|
268
|
+
if (input.tool === "bash" || input.tool === "shell") {
|
|
269
|
+
// 1.x calls it bash; 2.x calls it shell (same `command` argument)
|
|
236
270
|
payload = { tool_name: "Bash", tool_input: { command: String(args.command || ""), run_in_background: !!(args.background || args.run_in_background) } }
|
|
237
271
|
scripts = ["block-git.sh", "guard-artifacts.sh", "guard-status.sh", "guard-metrics.sh", "guard-db.sh", "guard-build.sh", "guard-verify-deps.sh"]
|
|
238
272
|
} else if (input.tool === "edit") {
|
|
273
|
+
// 1.x names the file filePath, 2.x names it path
|
|
239
274
|
payload = {
|
|
240
275
|
tool_name: "Edit",
|
|
241
276
|
tool_input: {
|
|
242
|
-
file_path: String(args.filePath || ""),
|
|
277
|
+
file_path: String(args.filePath || args.path || ""),
|
|
243
278
|
old_string: String(args.oldString || ""),
|
|
244
279
|
new_string: String(args.newString || ""),
|
|
245
280
|
},
|
|
@@ -248,7 +283,7 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
248
283
|
} else if (input.tool === "write") {
|
|
249
284
|
payload = {
|
|
250
285
|
tool_name: "Write",
|
|
251
|
-
tool_input: { file_path: String(args.filePath || ""), content: String(args.content || "") },
|
|
286
|
+
tool_input: { file_path: String(args.filePath || args.path || ""), content: String(args.content || "") },
|
|
252
287
|
}
|
|
253
288
|
scripts = ["guard-status.sh", "guard-verify.sh", "guard-metrics.sh"]
|
|
254
289
|
} else if (input.tool === "apply_patch") {
|
|
@@ -367,7 +402,7 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
367
402
|
if (!sid) return
|
|
368
403
|
if (rootOf(sid) === sid) {
|
|
369
404
|
emitSession(sid)
|
|
370
|
-
nudgeStaleStatusHtml(sid)
|
|
405
|
+
await nudgeStaleStatusHtml(sid)
|
|
371
406
|
}
|
|
372
407
|
return
|
|
373
408
|
}
|
|
@@ -375,3 +410,140 @@ export const TechieFlowPlugin = async ({ directory, client }) => {
|
|
|
375
410
|
},
|
|
376
411
|
}
|
|
377
412
|
}
|
|
413
|
+
|
|
414
|
+
// ---- OpenCode 2.x: translate its API into the 1.x hooks above ----
|
|
415
|
+
// The 2.x context names no project directory, and its background service does not run in the
|
|
416
|
+
// project, so the root is where this file sits: <root>/.opencode/plugin/techieflow.js.
|
|
417
|
+
function projectRoot() {
|
|
418
|
+
try {
|
|
419
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..")
|
|
420
|
+
} catch {
|
|
421
|
+
return process.cwd()
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function eventTime(value) {
|
|
426
|
+
const n = typeof value === "number" ? value : Date.parse(String(value || ""))
|
|
427
|
+
return Number.isFinite(n) ? n : Date.now()
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
async function setupV2(context) {
|
|
431
|
+
const root = projectRoot()
|
|
432
|
+
// What the Stop nudge needs from a client: prompt a session. 2.x has no message listing, so
|
|
433
|
+
// closingTurn() finds no messages and the owner-text check is skipped (see the header).
|
|
434
|
+
const client = {
|
|
435
|
+
session: {
|
|
436
|
+
prompt: ({ path: p, body }) =>
|
|
437
|
+
context.session.prompt({
|
|
438
|
+
sessionID: p.id,
|
|
439
|
+
text: ((body && body.parts) || []).map((x) => x.text || "").join("\n"),
|
|
440
|
+
}),
|
|
441
|
+
},
|
|
442
|
+
}
|
|
443
|
+
const hooks = await TechieFlowPlugin({ directory: root, client })
|
|
444
|
+
const registrations = []
|
|
445
|
+
|
|
446
|
+
// Guards. A throw here stops the call, as in 1.x.
|
|
447
|
+
registrations.push(
|
|
448
|
+
await context.tool.hook("execute.before", async (event) => {
|
|
449
|
+
await hooks["tool.execute.before"]({ tool: event.tool, sessionID: event.sessionID, callID: event.id }, { args: event.input || {} })
|
|
450
|
+
}),
|
|
451
|
+
)
|
|
452
|
+
|
|
453
|
+
// TF_HARNESS, TF_PROJECT_DIR, TF_YOLO for the agent's shell commands.
|
|
454
|
+
registrations.push(
|
|
455
|
+
await context.shell.hook("create.before", async (event) => {
|
|
456
|
+
if (!event || !event.env) return
|
|
457
|
+
await hooks["shell.env"]({}, { env: event.env })
|
|
458
|
+
}),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
// Telemetry and the Stop nudge: 2.x events rewritten as the 1.x events the handler reads.
|
|
462
|
+
// A step carries its own tokens and cost; each step is recorded once, under its own key.
|
|
463
|
+
// The session is created before this subscription starts, so no session.created arrives for
|
|
464
|
+
// it: a session is learned the first time an event of this project names it, and its parent
|
|
465
|
+
// is read with session.get (a root session has no parentID). A turn ends with
|
|
466
|
+
// session.execution.*, which carries no location, so only sessions learned here count.
|
|
467
|
+
const models = Object.create(null) // assistantMessageID -> {model, t0}
|
|
468
|
+
const known = Object.create(null) // sessionID -> true once learned
|
|
469
|
+
let stream = null
|
|
470
|
+
let stopped = false
|
|
471
|
+
const learn = async (sessionID) => {
|
|
472
|
+
if (!sessionID || known[sessionID]) return
|
|
473
|
+
known[sessionID] = true
|
|
474
|
+
let parentID = null
|
|
475
|
+
try {
|
|
476
|
+
const info = await context.session.get({ sessionID })
|
|
477
|
+
parentID = (info && info.parentID) || null
|
|
478
|
+
} catch {}
|
|
479
|
+
await hooks.event({ event: { type: "session.created", properties: { info: { id: sessionID, parentID } } } })
|
|
480
|
+
}
|
|
481
|
+
const translate = (ev) => {
|
|
482
|
+
const d = ev.data || {}
|
|
483
|
+
if (ev.type === "session.step.started") {
|
|
484
|
+
models[d.assistantMessageID] = { model: d.model || {}, t0: eventTime(ev.created) }
|
|
485
|
+
return null
|
|
486
|
+
}
|
|
487
|
+
if (ev.type === "session.step.ended") {
|
|
488
|
+
const started = models[d.assistantMessageID] || { model: {}, t0: eventTime(ev.created) }
|
|
489
|
+
const t = d.tokens || {}
|
|
490
|
+
return {
|
|
491
|
+
type: "message.updated",
|
|
492
|
+
properties: {
|
|
493
|
+
info: {
|
|
494
|
+
role: "assistant",
|
|
495
|
+
id: String(d.assistantMessageID) + ":" + String(ev.id),
|
|
496
|
+
sessionID: d.sessionID,
|
|
497
|
+
providerID: started.model.providerID,
|
|
498
|
+
modelID: started.model.id,
|
|
499
|
+
cost: d.cost,
|
|
500
|
+
tokens: { input: t.input, output: t.output, cache: t.cache || {} },
|
|
501
|
+
time: { created: started.t0, completed: eventTime(ev.created) },
|
|
502
|
+
},
|
|
503
|
+
},
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
const idle =
|
|
507
|
+
/^session\.execution\.(succeeded|failed|interrupted)$/.test(ev.type) ||
|
|
508
|
+
(ev.type === "session.status" && d.status && d.status.type === "idle") ||
|
|
509
|
+
ev.type === "session.idle"
|
|
510
|
+
if (idle && known[d.sessionID]) return { type: "session.idle", properties: { sessionID: d.sessionID } }
|
|
511
|
+
return null
|
|
512
|
+
}
|
|
513
|
+
;(async () => {
|
|
514
|
+
try {
|
|
515
|
+
stream = context.event.subscribe()
|
|
516
|
+
for await (const ev of stream) {
|
|
517
|
+
if (stopped) break
|
|
518
|
+
try {
|
|
519
|
+
if (!ev) continue
|
|
520
|
+
if (ev.location && ev.location.directory) {
|
|
521
|
+
if (path.resolve(ev.location.directory) !== root) continue
|
|
522
|
+
if (ev.data && ev.data.sessionID) await learn(ev.data.sessionID)
|
|
523
|
+
}
|
|
524
|
+
const event = translate(ev)
|
|
525
|
+
if (event) await hooks.event({ event })
|
|
526
|
+
} catch {} // telemetry never blocks anything
|
|
527
|
+
}
|
|
528
|
+
} catch {}
|
|
529
|
+
})()
|
|
530
|
+
|
|
531
|
+
return async () => {
|
|
532
|
+
stopped = true
|
|
533
|
+
try {
|
|
534
|
+
if (stream && typeof stream.return === "function") await stream.return()
|
|
535
|
+
} catch {}
|
|
536
|
+
for (const r of registrations) {
|
|
537
|
+
try {
|
|
538
|
+
await r.dispose()
|
|
539
|
+
} catch {}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// OpenCode 1.x reads `server`; OpenCode 2.x reads `setup`. Each ignores the other.
|
|
545
|
+
export default {
|
|
546
|
+
id: "techieflow",
|
|
547
|
+
server: TechieFlowPlugin,
|
|
548
|
+
setup: setupV2,
|
|
549
|
+
}
|
|
@@ -85,7 +85,9 @@ if ! command -v python3 >/dev/null 2>&1; then
|
|
|
85
85
|
fi
|
|
86
86
|
|
|
87
87
|
# Verdicts: ALLOW | ASK_RM | BLOCK_WRITE | BLOCK_READ
|
|
88
|
-
|
|
88
|
+
# The program is read into a variable first: bash 3.2 (a stock Mac) cannot parse this program as a
|
|
89
|
+
# here-document inside $( ), because it scans the text for quotes and brackets.
|
|
90
|
+
IFS= read -r -d '' GIT_GUARD_PY <<'PY' || true
|
|
89
91
|
import json, os, re, shlex, sys
|
|
90
92
|
|
|
91
93
|
raw = os.environ.get("TF_HOOK_INPUT", "")
|
|
@@ -283,7 +285,7 @@ elif (found_rm[0] or found_sudo[0]) and not yolo:
|
|
|
283
285
|
else:
|
|
284
286
|
print("ALLOW")
|
|
285
287
|
PY
|
|
286
|
-
)"
|
|
288
|
+
VERDICT="$(TF_HOOK_INPUT="$INPUT" TF_YOLO_ON="$YOLO" python3 -c "$GIT_GUARD_PY" 2>/dev/null </dev/null)"
|
|
287
289
|
|
|
288
290
|
case "$VERDICT" in
|
|
289
291
|
BLOCK_WRITE) block_git_msg; exit 2 ;;
|
|
@@ -59,8 +59,12 @@ if not re.search(BUILD, low):
|
|
|
59
59
|
sys.exit(0)
|
|
60
60
|
|
|
61
61
|
bg_flag = bool(ti.get("run_in_background"))
|
|
62
|
+
# A quoted argument is data, not shell: `--screen "Scorecard & Portfolio=/x"` backgrounds nothing
|
|
63
|
+
# (AppManager TF-025). A quoted string that itself names a build stays, so
|
|
64
|
+
# `powershell.exe -Command "dotnet run &"` is still read.
|
|
65
|
+
bare = re.sub(r"\"[^\"]*\"|'[^']*'", lambda m: m.group(0) if re.search(BUILD, m.group(0)) else '""', low)
|
|
62
66
|
# `&` that is not `&&` and not inside `2>&1` / `>&2`
|
|
63
|
-
inline_bg = bool(re.search(r"(?<![&>\d])&(?![&\d])",
|
|
67
|
+
inline_bg = bool(re.search(r"(?<![&>\d])&(?![&\d])", bare)) or bool(re.search(r"\b(nohup|setsid|disown)\b", bare))
|
|
64
68
|
if not (bg_flag or inline_bg):
|
|
65
69
|
sys.exit(0)
|
|
66
70
|
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
# mongosh with INSERT / UPDATE / DELETE / CREATE / ALTER / DROP / TRUNCATE / GRANT /
|
|
10
10
|
# REPLACE / MERGE in the command text, a -f / -i script, or stdin redirected from a file
|
|
11
11
|
# - dropping or resetting a database
|
|
12
|
-
# What it allows only while .tfcore/.session/phase.json says build-phase
|
|
12
|
+
# What it allows only while .tfcore/.session/phase.json says build-phase, fix-issues or
|
|
13
|
+
# triage-and-fix (whose step 3 runs the fix-issues steps)
|
|
13
14
|
# (written by bash .tfcore/utils/tf-phase.sh start <command>, step 0 of every task):
|
|
14
15
|
# - a migration runner: dotnet ef database update, dotnet run --project <…Db|…Migration(s)…>,
|
|
15
16
|
# dbup, flyway migrate, liquibase update, alembic upgrade, prisma migrate, knex migrate,
|
|
@@ -75,11 +76,12 @@ if direct_write or re.search(DROP_DB, low):
|
|
|
75
76
|
|
|
76
77
|
if re.search(MIGRATORS, low):
|
|
77
78
|
ph = phase()
|
|
78
|
-
|
|
79
|
+
# triage-and-fix step 3 is fix-issues steps 2 to 5 under its own marker (AppManager TF-027)
|
|
80
|
+
if ph in ("build-phase", "fix-issues", "triage-and-fix"):
|
|
79
81
|
sys.exit(0)
|
|
80
82
|
who = f"the marker says {ph}" if ph else "no command marker is set"
|
|
81
|
-
print("BLOCKED by TechieFlow policy: a database migration runs only from *build-phase
|
|
82
|
-
f"*fix-issues, and {who}. Day-1, mockups, split-brd, amend-docs, devguide, verify, "
|
|
83
|
+
print("BLOCKED by TechieFlow policy: a database migration runs only from *build-phase, "
|
|
84
|
+
f"*fix-issues or *triage-and-fix, and {who}. Day-1, mockups, split-brd, amend-docs, devguide, verify, "
|
|
83
85
|
"triage and status commands write documents and records, never the database. If you are "
|
|
84
86
|
"inside build-phase or fix-issues, step 0 was skipped: run "
|
|
85
87
|
"bash .tfcore/utils/tf-phase.sh start <command> <App> and retry. Owner rule 2026-09-05.",
|