@capagents/forgeqe 2.7.1 → 2.7.3

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 (124) hide show
  1. package/HOW_TO_USE.md +82 -18
  2. package/THIRD_PARTY_NOTICES.md +62 -22
  3. package/bin/forgeqe.js +1 -1
  4. package/dist/docs-site/docs/architecture/index.html +1 -1
  5. package/dist/docs-site/docs/containers/index.html +1 -1
  6. package/dist/docs-site/docs/index.html +71 -2
  7. package/dist/docs-site/docs/search.js +1 -1
  8. package/dist/forgeqe.js +1775 -1520
  9. package/dist/web/THIRD_PARTY_NOTICES.md +578 -51
  10. package/dist/web/assets/Agent-DU51Em-3.js +4 -0
  11. package/dist/web/assets/ApiTests-D6YhbfPF.js +10 -0
  12. package/dist/web/assets/Chat-CQsQvyDs.js +3 -0
  13. package/dist/web/assets/Data-Djj0u25X.js +3 -0
  14. package/dist/web/assets/Evidence-R2GZ5yW9.js +1 -0
  15. package/dist/web/assets/Features-C1qvr-oy.js +1 -0
  16. package/dist/web/assets/Jobs-BOr2nkQa.js +5 -0
  17. package/dist/web/assets/KindPage-CB2gMzhI.js +6 -0
  18. package/dist/web/assets/Migration-71lvv1zU.js +2 -0
  19. package/dist/web/assets/Product-BAQtMlzO.js +7 -0
  20. package/dist/web/assets/Product-DLioOiRN.css +1 -0
  21. package/dist/web/assets/Quality-DeUvoOND.js +1 -0
  22. package/dist/web/assets/Record-CPjgxHRX.js +2 -0
  23. package/dist/web/assets/Regression-D8V0CNAw.js +5 -0
  24. package/dist/web/assets/Reports-Bhv6gqFl.js +2 -0
  25. package/dist/web/assets/Response-CXyWQxrt.js +4 -0
  26. package/dist/web/assets/Runs-Ba8X4nId.js +2 -0
  27. package/dist/web/assets/Shell-BoXDubsc.js +3 -0
  28. package/dist/web/assets/TestCases-DEciDMh1.js +1 -0
  29. package/dist/web/assets/TestData-DY6MVYdx.js +2 -0
  30. package/dist/web/assets/Tosca-BzNnPm0_.js +2 -0
  31. package/dist/web/assets/WhatsNew-7O1MlqCy.js +1 -0
  32. package/dist/web/assets/dataParts-0a9Sjn2u.js +3 -0
  33. package/dist/web/assets/index-C9TchKsF.css +2 -0
  34. package/dist/web/assets/index-DcmN4YB2.js +43 -0
  35. package/dist/web/assets/logos-BnPN8M-S.js +1 -0
  36. package/dist/web/assets/parts-mP2z3tbH.js +1 -0
  37. package/dist/web/assets/productParts-B2wO-b1i.js +1 -0
  38. package/dist/web/assets/qualityParts-ByR8_rNE.js +1 -0
  39. package/dist/web/assets/segmented-BZcnZadS.js +1 -0
  40. package/dist/web/assets/{thread-CHhZJi-Y.js → thread-DLf1W085.js} +2 -2
  41. package/dist/web/assets/usePageChat-lpZh_ziF.js +1 -0
  42. package/dist/web/index.html +3 -3
  43. package/docs/ARCHITECTURE.md +1 -1
  44. package/docs/CONTAINERS.md +1 -1
  45. package/docs/EVIDENCE.md +9 -4
  46. package/docs/GRAPHIFY.md +178 -0
  47. package/docs/PRODUCT_KNOWLEDGE.md +25 -4
  48. package/docs/PRODUCT_VIEWS.md +5 -2
  49. package/docs/prompts/graphify-evidence.md +167 -0
  50. package/docs/user-guide.html +71 -2
  51. package/evals/evidence/domain/base/orders-api/src/report.ts +4 -0
  52. package/evals/evidence/domain/base/orders-api/src/routes/admin.ts +2 -1
  53. package/evals/evidence/domain/cases/bad-function-removed/after/src/workflow.ts +6 -0
  54. package/evals/evidence/domain/cases/bad-function-removed/case.json +14 -0
  55. package/evals/evidence/domain/cases/bad-signature-changed/after/src/workflow.ts +6 -0
  56. package/evals/evidence/domain/cases/bad-signature-changed/case.json +14 -0
  57. package/evals/evidence/domain/cases/bad-state-set-directly/after/src/routes/admin.ts +2 -1
  58. package/evals/evidence/domain/cases/bad-untested-change/after/src/routes/admin.ts +2 -1
  59. package/evals/evidence/domain/cases/bad-untested-helper/after/src/report.ts +4 -0
  60. package/evals/evidence/domain/cases/bad-untested-helper/case.json +14 -0
  61. package/evals/evidence/domain/cases/good-optional-parameter/after/src/workflow.ts +6 -0
  62. package/evals/evidence/domain/cases/good-optional-parameter/case.json +12 -0
  63. package/evals/evidence/domain/cases/good-tested-helper/after/src/clients/payments.ts +8 -0
  64. package/evals/evidence/domain/cases/good-tested-helper/case.json +12 -0
  65. package/forgeqe.example.yaml +14 -1
  66. package/package.json +17 -14
  67. package/prompts/README.md +1 -0
  68. package/prompts/product-investigate.md +1 -1
  69. package/prompts/tosca.md +64 -0
  70. package/py/forgeqe_desktop/models.py +14 -5
  71. package/py/forgeqe_engine/__init__.py +1 -1
  72. package/py/forgeqe_knowledge/graphify_bridge.py +156 -0
  73. package/py/forgeqe_tosca/__init__.py +85 -0
  74. package/py/forgeqe_tosca/__main__.py +50 -0
  75. package/py/forgeqe_tosca/ntir.py +484 -0
  76. package/py/forgeqe_tosca/render.py +128 -0
  77. package/py/forgeqe_tosca/tsu.py +187 -0
  78. package/py/forgeqe_tosca/vendor/toscatsu/LICENSE +26 -0
  79. package/py/forgeqe_tosca/vendor/toscatsu/UPSTREAM +7 -0
  80. package/py/forgeqe_tosca/vendor/toscatsu/gen_tsu.py +735 -0
  81. package/py/forgeqe_tosca/vendor/toscatsu/parse_tsu.py +1979 -0
  82. package/py/forgeqe_tosca/vendor/toscatsu/spec_to_manifest.py +878 -0
  83. package/py/forgeqe_tosca/vendored.py +50 -0
  84. package/skills/tosca-knowledge/SKILL.md +56 -0
  85. package/skills/tosca-knowledge/references/actions-and-values.md +63 -0
  86. package/skills/tosca-knowledge/references/locators.md +29 -0
  87. package/skills/tosca-knowledge/references/mapping-cypress.md +21 -0
  88. package/skills/tosca-knowledge/references/mapping-playwright.md +31 -0
  89. package/skills/tosca-knowledge/references/mapping-selenium-webdriverio.md +26 -0
  90. package/skills/tosca-knowledge/references/ntir.md +46 -0
  91. package/dist/web/assets/Agent-Ol1sf0Me.js +0 -4
  92. package/dist/web/assets/ApiTests-BfN5VysH.js +0 -10
  93. package/dist/web/assets/Chat-Bk2ECB9h.js +0 -3
  94. package/dist/web/assets/Data-DSZ9xkqr.js +0 -3
  95. package/dist/web/assets/Evidence-BVjGRwcr.js +0 -1
  96. package/dist/web/assets/Features-DQEzR0Mz.js +0 -1
  97. package/dist/web/assets/Jobs-chEiiqmE.js +0 -5
  98. package/dist/web/assets/KindPage-D-Jah0cx.js +0 -6
  99. package/dist/web/assets/Migration-DMIBgW27.js +0 -2
  100. package/dist/web/assets/Product-B3buEWja.js +0 -1
  101. package/dist/web/assets/Quality-DuELzB5I.js +0 -1
  102. package/dist/web/assets/Record-DLTuuxTP.js +0 -2
  103. package/dist/web/assets/Regression-Bjz4Xfbo.js +0 -5
  104. package/dist/web/assets/Reports-p8Qp2KwM.js +0 -2
  105. package/dist/web/assets/Response-DGJAmOI0.js +0 -4
  106. package/dist/web/assets/Runs-CnPPwEq7.js +0 -2
  107. package/dist/web/assets/Shell-Molb7AUz.js +0 -3
  108. package/dist/web/assets/TestCases-CUZ-kHja.js +0 -1
  109. package/dist/web/assets/TestData-B3P1fBRO.js +0 -2
  110. package/dist/web/assets/WhatsNew-CdiZ0Eob.js +0 -1
  111. package/dist/web/assets/arrow-down-D5oPK0MM.js +0 -1
  112. package/dist/web/assets/arrow-right-2yt0QgFJ.js +0 -1
  113. package/dist/web/assets/circle-DIklM9wF.js +0 -1
  114. package/dist/web/assets/circle-dashed-BZvX5dyl.js +0 -1
  115. package/dist/web/assets/circle-dot-Cd20PWQi.js +0 -1
  116. package/dist/web/assets/dataParts-D0dUqael.js +0 -3
  117. package/dist/web/assets/index-BC72t3H1.js +0 -43
  118. package/dist/web/assets/index-BiJ_Nvm1.css +0 -2
  119. package/dist/web/assets/keyboard-Dab5j5YB.js +0 -1
  120. package/dist/web/assets/pencil-DeEsXRZX.js +0 -1
  121. package/dist/web/assets/productParts-Ciuentrl.js +0 -1
  122. package/dist/web/assets/qualityParts-CZCG8hDs.js +0 -1
  123. package/dist/web/assets/segmented-BMOboT4H.js +0 -1
  124. package/dist/web/assets/usePageChat-eO0J5JlP.js +0 -1
@@ -0,0 +1,178 @@
1
+ # Graphify in product knowledge: what it gives, measured
2
+
3
+ [Graphify](https://github.com/Graphify-Labs/graphify) (PyPI `graphifyy`, Apache-2.0) reads code with tree-sitter in about 40
4
+ languages, without a model. ForgeQE uses it to read the code structure of the product's repositories: functions, classes and
5
+ the calls, imports and inheritance between them. ForgeQE keeps reading what Graphify does not know: HTTP endpoints and the
6
+ calls between services, tables, screens, messages, infrastructure, business rules, and the Evidence model.
7
+
8
+ This page records what Graphify produced on a real repository, so the reader in `src/product/graphify.ts` is built on
9
+ its real output and not on its README.
10
+
11
+ ## How it was measured
12
+
13
+ - **Graphify:** 0.9.103, installed into its own Python 3.12 virtualenv.
14
+ - **Repository:** this repository's `ForgeQE/` at `69fa3f9`, exported with `git archive`.
15
+ - TypeScript, TSX, JavaScript and Python.
16
+ - 1,839 files Graphify reads, 1,854 files `forgeqe knowledge build` reads.
17
+ - **Computer:** Apple silicon, 14 cores.
18
+ - **Graphify's settings:** run through its Python library, not its `graphify` command, with `GRAPHIFY_BACKEND=none` and
19
+ `GRAPHIFY_QUERY_LOG_DISABLE=1`.
20
+ - The file list was given to it, not found by its own walk.
21
+ - Its output and cache went to a folder outside the repository.
22
+ - **ForgeQE's settings:** `forgeqe knowledge build` with `product.model: false`.
23
+
24
+ ## What Graphify's output holds
25
+
26
+ - **`graph.json` top level:** `directed`, `multigraph`, `graph`, `nodes`, `links`, `hyperedges`.
27
+ - `graph` holds `schema_version: 1` and `graphify_version: "0.9.103"`.
28
+ - **Node:**
29
+ - `id`: a slug of path and name, for example `src_api_run_masksecrets`;
30
+ - `label`: the name, with `()` on callables;
31
+ - `source_file`: relative to the root given, with forward slashes;
32
+ - `source_location`: `L<line>`;
33
+ - `file_type`: `code`, `document`, `rationale` or `concept`;
34
+ - `community`;
35
+ - `_callable`, `_callable_class`, `_origin`.
36
+ - **Edge:**
37
+ - `source` and `target`; the order is the direction, whatever `directed` says;
38
+ - `relation`;
39
+ - `confidence`: `EXTRACTED`, `INFERRED` or `AMBIGUOUS`;
40
+ - `confidence_score`;
41
+ - `source_file`, `source_location`: the line of the call or import;
42
+ - `context`, for example `call`.
43
+ - **Relations on this repository:**
44
+
45
+ | Relation | Count |
46
+ |---|---|
47
+ | `calls` | 18,137 |
48
+ | `contains` | 17,059 |
49
+ | `imports` | 13,247 |
50
+ | `imports_from` | 8,505 |
51
+ | `references` | 1,804 |
52
+ | `rationale_for` | 738 |
53
+ | `method` | 696 |
54
+ | `indirect_call` | 422 |
55
+ | `uses` | 233 |
56
+ | `dynamic_import` | 100 |
57
+ | `declares` | 78 |
58
+ | `re_exports` | 61 |
59
+ | `inherits` | 29 |
60
+ | `cites` | 8 |
61
+ | `defines` | 6 |
62
+ | `implements` | 1 |
63
+
64
+ - **Confidence:** 59,500 `EXTRACTED` and 1,624 `INFERRED` edges. Of the `calls`, 17,752 are `EXTRACTED` and 385 `INFERRED`.
65
+ - **`rationale` nodes (740):** docstrings and `NOTE`/`WHY` comments, linked to the code they explain by `rationale_for`.
66
+ - Graphify redacts credential shapes in them.
67
+ - **Not in its output:** HTTP routes, URL calls between services, message topics. These stay ForgeQE's.
68
+
69
+ ## Compared with `forgeqe knowledge build`
70
+
71
+ | | Graphify | ForgeQE today |
72
+ |---|---|---|
73
+ | Functions and classes | 11,635 callables | 7,072 (6,908 functions, 164 classes) |
74
+ | Calls between functions | 18,137 | none (the 158 `calls` edges are HTTP) |
75
+ | Imports | 13,247 + 8,505 `imports_from` | 5,262 |
76
+ | Inheritance | 29 `inherits`, 1 `implements` | 4 `inherits` |
77
+ | "Why" text tied to the code | 740 rationale nodes | none |
78
+ | Endpoints, tables, screens, tests, config | none | 170 endpoints, 9 tables, 80 screens, 1,572 `tested_by` |
79
+ | Time, cold | 44 s | 5.6 s |
80
+ | Time, one file changed | about 40 s on its own; 5.8 s in `forgeqe knowledge build`, which reads only changed files again | under 1 s for that file |
81
+ | Memory | 420–460 MB | 770 MB |
82
+
83
+ - **Functions both found:** 7,026.
84
+ - **Only Graphify found:** 2,269 classes and types, 1,544 top-level functions, 898 methods and nested functions.
85
+ - **Only ForgeQE found:** 46, mostly constants that ForgeQE counts as functions (`DEFAULT_CARD`, `GRID`).
86
+
87
+ ### Are the calls right?
88
+
89
+ - **Sample:** 600 `calls` edges drawn at random.
90
+ - **Result:** in 599 of them, the cited line names the called function.
91
+ - **The one exception was right too:** `searchFiles` is imported under another name, `searchChatFiles`, and Graphify followed
92
+ the import.
93
+ - **Not tested:** calls missed through callbacks and dynamic dispatch. `indirect_call` covers some of them.
94
+
95
+ ### Impact: file level against call level
96
+
97
+ ForgeQE's `impactOf` follows a changed function up to its file, then to every file that imports it. On three helpers:
98
+
99
+ | Changed function | `forgeqe knowledge impact` today | Through Graphify's calls (up to 8 hops) |
100
+ |---|---|---|
101
+ | `summaryHtml` (src/mcp/reporttools.ts) | 255 nodes, 128 test files | 10 calling functions in 8 files, 2 test files, no web endpoint |
102
+ | `sendablePath` (src/mcp/attachtools.ts) | 226 nodes, about every endpoint of src/web/server.ts | 9 calling functions in 7 files, 2 test files, 1 endpoint |
103
+ | `maskSecrets` (src/api/run.ts) | 229 nodes, about every endpoint of src/web/server.ts | 13 calling functions in 7 files, 2 test files, 2 endpoints (`ANY /api/{}`, `POST /api/apitests/import`) |
104
+
105
+ The file-level answer is so broad that "covered by 128 test files" says nothing about whether the change is tested. The
106
+ call-level answer names the tests that actually reach it.
107
+
108
+ To keep what the file level does get right, the impact walk uses both:
109
+ - calls where they exist;
110
+ - imports where nothing calls (a module's top-level code, configuration).
111
+
112
+ ## Safety, from reading its code (0.9.103)
113
+
114
+ - **Network:** a code scan opens no connection.
115
+ - The code that makes connections serves `graphify add <url>`.
116
+ - The model features are switched off with `GRAPHIFY_BACKEND=none`.
117
+ - **Running the scanned code:** it never does. The only programs it starts:
118
+ - `git ls-files` and `git config` in the repository;
119
+ - `git rev-parse HEAD`;
120
+ - the C preprocessor on Fortran files after removing their `#include` lines.
121
+ - **Git configuration:** its git commands use the repository's own configuration, so a hostile repository could set
122
+ `core.fsmonitor` to a command. ForgeQE passes `GIT_CONFIG_COUNT`/`GIT_CONFIG_KEY_0=core.fsmonitor`/`GIT_CONFIG_VALUE_0=false`
123
+ in Graphify's environment, as its own git calls do.
124
+ - **Where it writes:** with `GRAPHIFY_OUT` set to an absolute folder, its cache and output go there and the repository is
125
+ left untouched. This was checked with `git status` on the scanned copy.
126
+ - **Its output is untrusted:** names and rationale text come from the repository.
127
+ - `src/product/graphify.ts` takes known fields only, caps sizes, keeps a node only when its file is inside the repository,
128
+ and never passes rationale text to an agent as an instruction.
129
+
130
+ ## Gotchas found on the way
131
+
132
+ - **`collect_files` drops whole trees.** It drops any path with a part it counts as noise, and `tmp` was one; a path under
133
+ `~/.forgeqe` may be another.
134
+ - ForgeQE gives Graphify its own file list from `scanRepo`, so `.gitignore`, `.forgeqeignore` and `product.exclude` apply as
135
+ they do today.
136
+ - **Worker processes re-import the entry script.** Extraction runs in a process pool, and on macOS and Windows each worker
137
+ re-imports the script that started it.
138
+ - ForgeQE's bridge script keeps its work under `if __name__ == "__main__":`.
139
+ - **A rebuild re-resolves everything.** It reads each changed file again, but the cross-file resolution runs over the whole
140
+ repository: about 40 s here after one file changed.
141
+ - `extract()` takes `resolution_context_nodes`/`resolution_context_edges` to re-read only changed files.
142
+ - ForgeQE's build knows which files changed and uses that.
143
+ - **SQL and Terraform files need extras.** `.sql` and `.tf` files give nothing without `graphifyy[sql,terraform]`, which
144
+ ForgeQE installs.
145
+ - **Inline route handlers have no calls.** In `router.post("/x", async (req, res) => { cancel(…) })`, Graphify records no
146
+ call from the anonymous handler; only a function passed by name (`requireAuth`) appears, as `indirect_call`.
147
+ - ForgeQE reads the plain calls in each route's handler itself (`handlerCalls`, `src/product/structure.ts`) and keeps
148
+ one only for a name Graphify saw the file import, or the file declares: `endpoint → calls → function`, observed.
149
+ - **Partial reads.** Three TypeScript files had syntax regions tree-sitter could not read and were partly extracted. Graphify
150
+ reports them, and the build passes that on.
151
+
152
+ ## How ForgeQE uses it
153
+
154
+ Graphify is part of every `forgeqe knowledge build`, installed and pinned by ForgeQE like the browser engine:
155
+
156
+ - **Install:** its own virtualenv `~/.forgeqe/knowledge/.venv`, created with `uv`, with `graphifyy[sql,terraform]==0.9.103`
157
+ pinned. `forgeqe doctor` checks it.
158
+ - **Run:** a bridge script (`py/forgeqe_knowledge/graphify_bridge.py`) started with an argument array and no shell.
159
+ - Its environment is `allowListEnv` plus the Graphify and git settings above.
160
+ - It has a time limit and an output size limit.
161
+ - **Read:** `src/product/graphify.ts` maps the output onto ForgeQE's node ids and the Evidence model:
162
+ - `EXTRACTED` becomes `observed`; `INFERRED` and `AMBIGUOUS` become `inferred`, each with `how: "graphify 0.9.103: …"`;
163
+ - the file and line are kept, and ForgeQE takes the quote from the file itself.
164
+ - **Use:** impact, Evidence's domain check, the Investigator's paths, and the Engineering view's modules and hotspots read
165
+ the call graph (docs/prompts/graphify-evidence.md, Steps 2–5).
166
+ - **Reasons in the code:** Graphify's rationale nodes are mostly Python docstrings, cut at 80 characters, and it reads no
167
+ JSDoc. ForgeQE reads the whole comment from the file itself (`src/product/why.ts`) for any of `/** */`, `//`, `#` and
168
+ docstrings. A comment marked as a reason (`WHY:`, `NOTE:`, `IMPORTANT:`, an ADR or RFC) becomes a `claim` node that
169
+ `documents` the function below it; Evidence's business-rule findings quote what the code says about the rule. A comment
170
+ holding an instruction to an agent (`instructionIn`) is named, never repeated.
171
+ - **Documents:** a docs folder's PDF, Word and Excel files are converted to text by Graphify's own converters
172
+ (`graphifyy[pdf,office]`, `readDocuments`), within their size caps. A database's schema is read by ForgeQE's data engine
173
+ rather than Graphify's Postgres reader: it covers every engine `databases:` does, with that entry's own sign-in and
174
+ read-only check (`src/product/dbschema.ts`).
175
+ - **Modules and hotspots:** a community of at least three functions and classes is a `module` node (each member
176
+ `categorized_under` it, a link impact and paths do not follow), named after its folder; 241 on this repository. Each
177
+ repository's 20 most called functions and classes are tagged `hotspot`. The API test planner and exploratory charters
178
+ are given "Most depended on, fewest tests" for the repositories a task is about.
@@ -98,8 +98,12 @@ Copilot costs no tokens, so the cost prompt then shows only the number of files
98
98
  1. **Scan** (no model). Each repository's files, languages, and frameworks (`package.json`, `pom.xml`, `*.csproj`,
99
99
  `requirements.txt`, `pyproject.toml`). `.gitignore` and `.forgeqeignore` apply. Hidden files and files named like
100
100
  credentials are never read.
101
- 2. **Structure** (no model). tree-sitter facts become `file`, `class`, `function` nodes and `contains`, `imports`,
102
- `calls` edges. Pattern rules add:
101
+ 2. **Structure** (no model). Graphify (`src/product/graphify.ts`, docs/GRAPHIFY.md) reads the code in about 40
102
+ languages: `class` and `function` nodes (a method as `Class.name`) and `calls`, `imports`, `inherits`, `implements`
103
+ and `contains` edges between them. A call from a test becomes `tested_by` on what it calls. Its `EXTRACTED` links are
104
+ observed and its `INFERRED` ones inferred, each with its file, line and quote. ForgeQE installs Graphify, pinned, into
105
+ `~/.forgeqe/knowledge/.venv` the first time; a rebuild reads only the changed files again. ForgeQE's own tree-sitter
106
+ facts add to the same nodes. Pattern rules add:
103
107
  - `endpoint` nodes from route definitions (Express, ASP.NET `[Http*]`, Spring `@*Mapping`, FastAPI and Flask);
104
108
  - `table` nodes from migrations and SQL;
105
109
  - `config` nodes, with `tested_by` edges from tests to the code they import;
@@ -152,9 +156,15 @@ Rules for links (as built):
152
156
  3. returns a compact block within a character budget, each line with `repo:file:line`.
153
157
  - **The `product_knowledge` tool** for ForgeQE's agent (`src/mcp/producttools.ts`), one tool with an `op`, as
154
158
  `data_flows` is: `search`, `node` (one node and its neighbours), `impact` (what depends on a file, class, endpoint,
155
- or table, across repositories, and the tests that cover it), `status`, `gaps`, and `build`. Phase 2 adds `flow` (a
159
+ or table, across repositories, and the tests that cover it: a function or class with known callers is followed
160
+ through them, the routes those calls are made under, and the services that call those routes, with each link only
161
+ inferred marked; anything else through its file's importers), `status`, `gaps`, and `build`. Phase 2 adds `flow` (a
156
162
  business flow, step by step). The same questions from a terminal:
157
- `forgeqe knowledge build|status|search|node|impact|flow|gaps|check|ask|findings`. `ask` (op `ask`) runs the
163
+ `forgeqe knowledge build|status|search|node|impact|path|flow|gaps|check|ask|findings`. `path <from> <to>` (op `path`,
164
+ `ref` and `to`) is the cheapest chain of links by which one reaches the other: calls, an endpoint's handler, calls
165
+ between services, table reads and writes, inheritance, and imports, which cost the most, so a chain of calls wins.
166
+ Both ways are tried, and an answer the other way round says so. Each step names the line it rests on, and a step only
167
+ inferred is marked. `ask` (op `ask`) runs the
158
168
  investigator (PRODUCT_VIEWS.md, Investigation).
159
169
  - **Prompts**: the planners, the explorer, the API planner, and the browser agent get the matching block next to
160
170
  today's knowledge sections.
@@ -189,6 +199,17 @@ is never changed).
189
199
  submodules and LFS are off and symbolic links are checked out as plain files. The token comes from `token_env` and is
190
200
  sent as an `http.<host>.extraHeader` through git's environment, so it is in no argument, link or file, and is cut out of
191
201
  any error shown.
202
+ - A repository's database (`product.repos.<name>.database`, a `databases:` entry) is read through ForgeQE's data engine
203
+ (`src/product/dbschema.ts`): that entry's own sign-in and an environment of only its variables, and only an entry that
204
+ is not writable. Its tables, columns, keys and foreign keys join the graph as `schema` evidence; a table the code
205
+ defines too gets both readings, and the build says which tables and columns differ between the code and the database.
206
+ Names from the database are plain text, capped.
207
+ - PDF, Word and Excel files of a docs folder are read as text by Graphify's converters (their size caps), only files the
208
+ folder's scan lists (no hidden, credential-named or linked-out file), each path checked inside the folder again.
209
+ - Graphify runs with an argument array and no shell, models off (`GRAPHIFY_BACKEND=none`), an environment of system
210
+ settings only, git's fsmonitor off, a time limit, and its output in ForgeQE's cache, never in the repository. It gets
211
+ ForgeQE's own file list, and its result is untrusted (`parseGraphify`): a known format and version only, a node only in
212
+ a listed file, a function's name only plain (no spaces, no shell characters), an edge only between nodes it kept.
192
213
  - Tests feed hostile input: a repository path of `../../.ssh`, a summary holding `<script>` and `; rm -rf ~`, and a
193
214
  document link of `javascript:`.
194
215
 
@@ -273,8 +273,11 @@ Rust and hand-written routing. Helm templates are not read yet.
273
273
  5. **Engineering view** (done) in the web app, page Product (`web/src/pages/Product.tsx`, data from
274
274
  `src/web/engineering.ts`): the services map drawn like ForgeQE's architecture map (bands for front ends,
275
275
  gateways, services, and data and messages; outside systems in a side column; wires at right angles laid out by
276
- `web/src/pages/archLayout.ts`, never through a card), with every link in words on its own tab; one service from the inside (endpoints with their authentication,
277
- callers and what a change reaches; calls out, data, messages, outside services, cloud resources); runs against the
276
+ `web/src/pages/archLayout.ts`, never through a card), with every link in words on its own tab, above them "How one part reaches another" (two parts picked from the graph's
277
+ search, and the chain of links between them with the line each rests on: `pathBetween`, `/api/knowledge/engineering/path`); one service from the inside (endpoints with their authentication,
278
+ callers and what a change reaches; calls out, data, messages, outside services, cloud resources; its modules, Graphify's
279
+ communities of the code, with their most called members; and what is most depended on, the hotspots, each with its
280
+ callers, the endpoints it serves and the tests that reach it, least tested first); runs against the
278
281
  code; open questions. Every part and link says how it is known, opens its evidence in a side panel, and an open
279
282
  question is investigated in a chat. Built on the sample product in `evals/knowledge/shop`. Findings are not yet
280
283
  shown on the page.
@@ -0,0 +1,167 @@
1
+ # Prompt: use Graphify in ForgeQE's product knowledge and Evidence
2
+
3
+ Paste everything below the line into a Claude Code session opened at the root of `cli-agents`, on a branch of its own.
4
+ Run it on a computer that has Python 3.10+ and a checkout of a real product (QI-Commerce in Azure DevOps, or any
5
+ multi-service repository).
6
+
7
+ ---
8
+
9
+ ## Goal
10
+
11
+ ForgeQE builds a product knowledge graph from the product's repositories (`forgeqe knowledge build`, `ForgeQE/src/product/`).
12
+ The Engineering view (`web/src/pages/Product.tsx`), the Investigator (`src/product/investigate.ts`) and Evidence's domain check
13
+ (`src/evidence/product.ts`, `checkChange`: business rules, architecture, dependencies, regression, security) all read it.
14
+
15
+ ForgeQE's code readers are pattern matches (`src/product/patterns.ts`, `src/product/structure.ts`). They miss what a real
16
+ parser sees. An example: a `fetch` whose method came from a helper read as GET until a hand-written fix.
17
+
18
+ [Graphify](https://github.com/Graphify-Labs/graphify) (PyPI `graphifyy`, Apache-2.0) parses code with tree-sitter in about 40
19
+ languages, locally and without a model. It writes `graphify-out/graph.json` with `calls`, `imports`, `inherits` and similar
20
+ edges, each tagged `EXTRACTED` or `INFERRED`. It also builds communities (Leiden), "god nodes", and nodes for `# NOTE:` /
21
+ `# WHY:` comments and ADR/RFC citations. It can introspect a Postgres schema and read PDF and Office files.
22
+
23
+ **Graphify is part of every build: it reads the code structure (functions, classes, calls, imports, inheritance, "why"
24
+ comments).** The measured comparison is in `ForgeQE/docs/GRAPHIFY.md`. These stay ForgeQE's own:
25
+ - cross-repository linking (`resolveCalls`, `resolveTables`, `src/product/wiring*.ts`);
26
+ - the infrastructure resolver;
27
+ - the Evidence model (`Evidence` in `src/product/types.ts`: source, state observed/inferred/unknown, confidence, quote);
28
+ - the cache, history and knowledge pack;
29
+ - every Evidence lens.
30
+
31
+ ## Read first
32
+
33
+ - `CLAUDE.md` at the root: the security rules. They apply to every line you write.
34
+ - `ForgeQE/docs/PRODUCT_KNOWLEDGE.md`, `ForgeQE/docs/PRODUCT_VIEWS.md`, `ForgeQE/docs/EVIDENCE.md`.
35
+ - `ForgeQE/src/product/types.ts` (`NodeType`, `EdgeType`, `Evidence`, `KnowledgeGraph`).
36
+ - `src/product/structure.ts` (`buildRepoGraph`, `FileRecord`, `CACHE_VERSION`) and `src/product/build.ts` (`buildProductGraph`,
37
+ `mergeParts`, `resolveCalls`).
38
+ - `src/product/query.ts` (`impactOf`, `findNode`, `describeImpact`).
39
+ - `src/evidence/product.ts` (`checkChange`) and `src/evidence/harnessproduct.ts`.
40
+ - `src/product/config.ts` for how `product:` settings are read, and `forgeqe.example.yaml` plus
41
+ `tests/settings-coverage.test.ts` (every option needs a Settings field).
42
+
43
+ ## Step 0: look before building (no ForgeQE code yet)
44
+
45
+ 1. Install the pinned version in its own virtualenv: `python3 -m venv .venv-graphify && .venv-graphify/bin/pip install graphifyy==0.9.103`.
46
+ Do **not** run `graphify install`, which writes hooks into assistant settings.
47
+ 2. Run it on one service and on the whole product checkout, with models and the query log off:
48
+ `GRAPHIFY_BACKEND=none GRAPHIFY_QUERY_LOG_DISABLE=1 .venv-graphify/bin/graphify <repo>`. Read `graphify --help` for the
49
+ exact flags; do not guess them.
50
+ 3. Write down from the real `graph.json`:
51
+ - its top-level keys, `schema_version`, and node and edge fields;
52
+ - how file paths and line numbers appear;
53
+ - which edge types it emits;
54
+ - what `EXTRACTED` and `INFERRED` mean in practice.
55
+ Record the version that produced it.
56
+ 4. Compare with `forgeqe knowledge build` on the same checkout:
57
+ - which calls, imports, classes and functions Graphify finds that ForgeQE misses, and the reverse;
58
+ - anything Graphify gets wrong;
59
+ - run time and memory.
60
+ 5. Check from its code, not its README:
61
+ - it never executes the repository's code;
62
+ - it opens no network connection with `GRAPHIFY_BACKEND=none`;
63
+ - where it writes files.
64
+ Stop and report if any of these does not hold.
65
+
66
+ Put the findings in `ForgeQE/docs/GRAPHIFY.md` and show me the comparison before Step 1. (Done: `GRAPHIFY.md`.)
67
+
68
+ ## Step 1: Graphify as the code reader
69
+
70
+ - **Install:** ForgeQE installs it like the browser engine (`src/engine/setup.ts`): its own virtualenv
71
+ `~/.forgeqe/knowledge/.venv` made with `uv`, `graphifyy[sql,terraform]==<pinned>`, checked by `forgeqe doctor`. No setting
72
+ turns it off.
73
+ - **Running it:** Graphify runs once per repository after the repository is fetched, into a folder under ForgeQE's cache (never inside
74
+ the repository), through a bridge script of ForgeQE's that calls its library with the file list `scanRepo` made:
75
+ - started with an argument array and no shell;
76
+ - `GRAPHIFY_BACKEND=none` and `GRAPHIFY_QUERY_LOG_DISABLE=1`;
77
+ - the environment built with `allowListEnv`, never one of `privateEnvNames`;
78
+ - a time limit and an output size limit;
79
+ - the program found on PATH or through a setting holding a path; never a command string.
80
+ - When it cannot be installed (no Python 3.10+, no network to PyPI), the build stops and says how to fix it.
81
+ - Only the changed files are read again, with the rest passed as resolution context (`GRAPHIFY.md`, Gotchas).
82
+ - **Reading its output:** a new `src/product/graphify.ts` reads `graph.json` as **untrusted**:
83
+ - its `schema_version` is checked against the versions you saw in Step 0;
84
+ - known fields only, of their types, with sizes capped;
85
+ - a node kept only when its file, resolved with `realpathSync`, is inside the repository and not hidden;
86
+ - names cleaned to plain text, no instruction text carried into a summary.
87
+ - **Mapping:** map to ForgeQE's types:
88
+ - `calls`, `imports`, `inherits`, `implements` onto the same `EdgeType`s;
89
+ - functions and classes onto ForgeQE's node ids (`<repo>:<type>:<file>:<name>`) so they merge with what ForgeQE read rather than
90
+ duplicating it;
91
+ - `EXTRACTED` becomes `state: "observed"`, `INFERRED` becomes `state: "inferred"`, with `how: "graphify <version>: …"` and the
92
+ file and line;
93
+ - `quote` filled from the file by ForgeQE itself, so `forgeqe knowledge check` can find it again.
94
+ - Where ForgeQE and Graphify disagree, keep both edges with their evidence; never overwrite an observation.
95
+ - **Cache:** the per-file cache stays right: raise `CACHE_VERSION` when `FileRecord` changes, and key Graphify's output on the repository's
96
+ commit and Graphify's version.
97
+ - **Tests (`tests/graphify.test.ts`):** a recorded `graph.json` from Step 0 maps as expected. Hostile inputs are refused:
98
+ - a node with `../../.env` or an absolute path;
99
+ - a symbolic link out of the repository;
100
+ - an unknown `schema_version`;
101
+ - a 50 MB file;
102
+ - a name holding `; rm -rf ~` or an instruction;
103
+ - an edge to a node that does not exist.
104
+ - A missing or failing Graphify stops the build with its reason.
105
+
106
+ ## Step 2: function-level calls for impact and the domain check
107
+
108
+ - `impactOf` (`src/product/query.ts`) follows `calls` edges as well as containment, imports and tests. Then the impact of a
109
+ function reaches the endpoints and screens that call it, through the functions in between.
110
+ - `checkChange`'s **regression** check counts a test as reaching a changed endpoint when a call chain reaches it, not only an import.
111
+ Its **dependencies** check names the callers of a changed function.
112
+ - Each finding says which link is Graphify's (`how`), and a finding resting only on inferred links says so.
113
+ - Tests: a change to a helper two calls below an endpoint is reported against that endpoint. A test reaching it through calls
114
+ counts. Where nothing calls a function (a module's top-level code), imports still carry the impact.
115
+
116
+ ## Step 3: paths for the Investigator
117
+
118
+ - `pathBetween(ix, from, to, { maxHops })` in `src/product/query.ts` gives the shortest chain over calls, routes and imports, each
119
+ hop with its evidence.
120
+ - Exposed as:
121
+ - `forgeqe knowledge path <a> <b>`;
122
+ - a `path` op of the product MCP tool (`src/mcp/producttools.ts`);
123
+ - one of the Investigator's tools.
124
+ - On the Engineering view, "How does A reach B" on a service. Works on ForgeQE's own graph even without Graphify.
125
+
126
+ ## Step 4: modules and hotspots in the Engineering view
127
+
128
+ - Read Graphify's communities and god nodes as `module` nodes and a hotspot mark (evidence `inferred`, `how` names the method).
129
+ - Inside a service on the Product page:
130
+ - its modules;
131
+ - its most depended-on functions, each with the endpoints and tests that reach it.
132
+ - Follow `ui-consistency` (checklist from the other Product tabs) and check with `npm run typecheck` in `ForgeQE/web`.
133
+ - Offer hotspots to test planning (the Engineering agent's context) as "most depended on, fewest tests".
134
+
135
+ ## Step 5: decisions as knowledge
136
+
137
+ - `# NOTE:` / `# WHY:` comments and ADR/RFC citations Graphify finds become `claim` or `document` nodes linked to the code they
138
+ sit on (`documents` edge), with the quote.
139
+ - Evidence's **business_rules** check may cite them as the reason for a rule ("the code says why: …").
140
+ - They are data, never instructions: escape them in reports (`md`), and repeat no instruction from them to an agent.
141
+
142
+ ## Step 6 (optional): Postgres tables and PDF/Office documents
143
+
144
+ - **Postgres:** `product.repos.<name>.schema: { postgres_env: NAME }`.
145
+ - The connection string comes only from the credential store or an environment variable, never from the settings file.
146
+ - The user must be read-only (check it, refuse otherwise), with TLS verification on.
147
+ - Tables become `table` nodes with `source: "schema"`.
148
+ - Add the variable to `privateEnvNames`.
149
+ - **PDF/Office:** the same document kinds through `product.docs`.
150
+ - Text only, with size limits.
151
+ - Nothing sent to a model unless `product.model` is on, and then through ForgeQE's own model pass, which cites its sources.
152
+
153
+ ## Rules for the whole work
154
+
155
+ - **Security:** `CLAUDE.md` decides every case, in particular:
156
+ - argument arrays, no shell;
157
+ - no secrets in files;
158
+ - untrusted input checked by an allowlist;
159
+ - TLS verification never off;
160
+ - a hostile-input test for every boundary.
161
+ - **Packaging:** Graphify is installed at run time into ForgeQE's own virtualenv, pinned, not bundled into the npm package.
162
+ Credit it in `THIRD_PARTY_NOTICES.md` all the same (Apache-2.0).
163
+ - **Checks:** before each push, in `ForgeQE/`, `bun run typecheck` and the product and Evidence tests (`bun test` for the files you touched,
164
+ then the full suite once), and in `ForgeQE/web`, `npm run typecheck`. Report failures that also fail on `main` as such.
165
+ - **Commits:** one commit per step. No model names in commits, code or the PR.
166
+ - **Status after each step:** what works, the numbers from QI-Commerce or the checkout you used (calls, impact chains, test
167
+ reach before and after), and what is left.
@@ -392,7 +392,7 @@ forgeqe docs --copy ./docs # copy the guide, the architecture page, the refere
392
392
  <div class="area"><a class="area-name" href="#area-mobile"><span class="mono">Mobile</span></a><ul class="tiles"><li><a class="tile" href="#cap-mobile-apps"><b>Automate Android and iOS apps</b><span>Sign in to the courier app and accept the first delivery, and save it as a test</span></a></li></ul></div>
393
393
  <div class="area"><a class="area-name" href="#area-operations"><span class="mono">Operations</span></a><ul class="tiles"><li><a class="tile" href="#cap-containers"><b>Services, mocks, workspace and browser in Docker or Podman</b><span>Start the database and the queue in Docker</span></a></li><li><a class="tile" href="#cap-monitoring"><b>Scheduled monitoring with alerts</b><span>Check the login flow every 15 minutes and alert Teams</span></a></li><li><a class="tile" href="#cap-jobs"><b>Background jobs on a schedule</b><span>Run the release-2.3 pack every weekday at 2am in the background</span></a></li><li><a class="tile" href="#cap-custom-agents"><b>Your team's custom agents</b><span>Ask our custom agent checkout-guard to check the basket on QA</span></a></li><li><a class="tile" href="#cap-notifications"><b>Teams and email notifications</b><span>Post the results to the QA channel</span></a></li><li><a class="tile" href="#cap-pipelines"><b>CI pipelines</b><span>Add a GitHub Actions workflow that runs tests/cases.yaml on every PR, and make it green</span></a></li></ul></div>
394
394
  <div class="area"><a class="area-name" href="#area-data"><span class="mono">Data</span></a><ul class="tiles"><li><a class="tile" href="#cap-databases"><b>Ask a database in plain language</b><span>Which customers in India have paid orders? Ask the orders database</span></a></li><li><a class="tile" href="#cap-test-data"><b>Test data on demand</b><span>Generate test data: 20 customers with 1 to 3 orders each in the shop database</span></a></li><li><a class="tile" href="#cap-data-flows"><b>Data flows between systems</b><span>Check that customers from the digital database reach the CRM correctly</span></a></li></ul></div>
395
- <div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-migrate-tests"><b>Migrate a test suite</b><span>Migrate the Selenium tests in tests/ to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-regression-packs"><b>Regression packs for a release</b><span>Build a regression pack for sprint 12 and run it on TestMu</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li></ul></div>
395
+ <div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-migrate-tests"><b>Migrate a test suite</b><span>Migrate the Selenium tests in tests/ to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-tosca-convert"><b>Convert Tosca test cases</b><span>Convert the Tosca export tosca/checkout.tsu to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-regression-packs"><b>Regression packs for a release</b><span>Build a regression pack for sprint 12 and run it on TestMu</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li></ul></div>
396
396
  <div class="area"><a class="area-name" href="#area-pull-requests"><span class="mono">Pull requests</span></a><ul class="tiles"><li><a class="tile" href="#cap-pr-review"><b>Review pull requests</b><span>Review PR 42 and focus on error handling</span></a></li><li><a class="tile" href="#cap-pr-impact"><b>Pull request impact and test selection</b><span>What does PR 42 impact?</span></a></li></ul></div>
397
397
  <div class="area"><a class="area-name" href="#area-api"><span class="mono">API</span></a><ul class="tiles"><li><a class="tile" href="#cap-api-testing"><b>API and contract testing</b><span>Turn the last run's API calls into tests</span></a></li></ul></div>
398
398
  <div class="area"><a class="area-name" href="#area-quality"><span class="mono">Quality</span></a><ul class="tiles"><li><a class="tile" href="#cap-accessibility-performance"><b>Accessibility and page performance</b><span>Is the checkout page accessible?</span></a></li><li><a class="tile" href="#cap-accessibility-personas"><b>Accessibility testing with personas</b><span>Act as a blind person and use the website to find accessibility issues</span></a></li><li><a class="tile" href="#cap-visual-comparison"><b>Visual comparison with baselines</b><span>What changed visually since the last run?</span></a></li><li><a class="tile" href="#cap-defect-intelligence"><b>Defect intelligence: trends and prediction</b><span>Which defects keep coming back?</span></a></li></ul></div>
@@ -2108,6 +2108,7 @@ forgeqe knowledge landscape # the product's systems and how they talk (
2108
2108
  forgeqe knowledge history # each build: the commits it read, and the endpoints, screens, tables, rules that came and went
2109
2109
  forgeqe knowledge search &quot;cancel an order&quot;
2110
2110
  forgeqe knowledge impact Services/OrderService.cs # what a change reaches: code across repositories, business flows, tests
2111
+ forgeqe knowledge path web/src/pages/Checkout.tsx api:table:orders # how one part reaches another, each step with its line
2111
2112
  forgeqe knowledge flow &quot;cancel an order&quot; # a business flow, step by step, with the code of each step
2112
2113
  forgeqe knowledge gaps # what the build could not settle: calls no route or several fit, other hosts, unknown tables
2113
2114
  forgeqe knowledge check # find each quoted line again in its file: what moved, what is gone
@@ -3648,7 +3649,7 @@ workspace's image.</li>
3648
3649
  provider: docker # or per run: --browser-provider docker
3649
3650
  containers:
3650
3651
  browser: # optional
3651
- image: mcr.microsoft.com/playwright:v1.63.0-noble # default; needs Node.js and /ms-playwright
3652
+ image: mcr.microsoft.com/playwright:v1.65.0-noble # default; needs Node.js and /ms-playwright
3652
3653
  headless: false # default: browser.headless; a visible browser runs on a virtual display (Xvfb)
3653
3654
  </code></pre>
3654
3655
  <ul>
@@ -4748,6 +4749,74 @@ In the shell, &quot;migrate our Selenium tests to Playwright&quot; makes the pla
4748
4749
  </section>
4749
4750
  </div>
4750
4751
  </article>
4752
+ <article class="spec feat" id="cap-tosca-convert">
4753
+ <div class="hd"><span class="mono">Automated tests</span><h3>Convert Tosca test cases</h3></div>
4754
+ <p class="ds">Reads a Tricentis Tosca export (.tsu) and converts its web test cases into Playwright, Cypress, Selenium or WebdriverIO tests with the Tosca agent, after a plan the user confirms; every Tosca step and check is marked in the converted test and checked, secrets become environment variables, and ForgeQE runs each test itself.</p>
4755
+ <div class="facts">
4756
+ <div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Convert the Tosca export tosca/checkout.tsu to Playwright TypeScript</li></ul></div>
4757
+ <div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need req">Required</span><span>The coding agent, Scribe: a live model profile (or code.model) and the agent runtime, which forgeqe setup installs</span></li><li><span class="need input">You give</span><span>a Tosca .tsu export inside a git repository</span></li></ul></div>
4758
+ <div class="fact"><span class="mono">Tools</span><p class="tools"><code>convert_tosca</code></p></div>
4759
+ </div>
4760
+ <div class="detail"><span class="mono">In detail</span>
4761
+ <section class="doc" id="doc-how_to_use-converting-tosca-tests">
4762
+ <h4>Converting Tosca tests</h4>
4763
+ <div class="prose"><p><code>forgeqe tosca</code> converts Tricentis Tosca test cases into Playwright, Cypress, Selenium or WebdriverIO tests, with the
4764
+ Tosca agent. It is a separate agent from <code>forgeqe migrate</code>: a Tosca export is not a folder of code but a graph of test
4765
+ cases, modules, reusable blocks and parameters. Put the export (<code>.tsu</code>) inside the repository, then:</p>
4766
+ <pre><code class="language-bash">forgeqe tosca inspect tosca/checkout.tsu # what the export holds; no model, nothing written
4767
+ forgeqe tosca plan tosca/checkout.tsu --to playwright-typescript [--only 1034698_submit_order] [--test-attribute data-qa]
4768
+ forgeqe tosca confirm tsc-20261105-151116-1f21 --accept-limits # a person at a terminal types the plan's id
4769
+ forgeqe tosca run tsc-20261105-151116-1f21 # here, or as a job:
4770
+ forgeqe jobs add tosca-ui --now -- tosca run tsc-20261105-151116-1f21
4771
+ forgeqe tosca verify tsc-… [--suite Smoke] # run the converted tests again, no model
4772
+ forgeqe tosca fix tsc-… --unit u004 --note &quot;The cart badge is now a span&quot; # one file back to the Tosca agent
4773
+ </code></pre>
4774
+ <ol>
4775
+ <li><strong>Read.</strong> ForgeQE reads the export with no model, through <a href="https://github.com/bermudas/ToscaTSU" rel="noopener">ToscaTSU</a>'s parser
4776
+ (MIT, included unchanged in <code>py/forgeqe_tosca/vendor/toscatsu</code>). It follows folders, reusable blocks with their
4777
+ parameter layers, If and Loop, buffers, and SelfHealingData, and writes each test case as NTIR, a neutral JSON form
4778
+ with numbered steps (<code>.forgeqe/tosca/&lt;plan&gt;/read/</code>). The export is data: nothing in it is run, and its size is capped.</li>
4779
+ <li><strong>Secrets.</strong> Tosca-encrypted values cannot be decrypted outside the Tosca workspace, and ForgeQE never tries. They
4780
+ and configuration parameters (<code>{CP[…]}</code>) become environment variables; the plan and <code>.env.example</code> name each one and
4781
+ where it comes from in Tosca. Values never reach the agent, the plan or the code.</li>
4782
+ <li><strong>Plan.</strong> One page object per Tosca module and one test per web test case, named by the target's conventions and
4783
+ placed under the test case's Tosca folders (<code>tests/orders/cart/…</code>; Tosca's own <code>TestCases</code> and similar folders left
4784
+ out). Tosca's execution lists become suites: each test is tagged with the lists that run it (Playwright
4785
+ <code>{ tag: ['@smoke'] }</code>, <code>@pytest.mark.smoke</code>, JUnit <code>@Tag</code>, NUnit <code>[Category]</code>, <code>@smoke</code> in a Cypress or WebdriverIO
4786
+ title), and ForgeQE checks the tags are there. Test
4787
+ cases whose steps are desktop, SAP, API or mobile are left out for now, and named. A step ForgeQE cannot convert
4788
+ (an unknown ActionMode or token, a TBox module with no web equivalent) is a limit: it stays in the test as a marked
4789
+ comment for a person to finish.</li>
4790
+ <li><strong>Confirm.</strong> As for a migration: a person types the plan's id at a terminal; the confirmation is kept under
4791
+ ForgeQE's home by the plan's digest, and a run refuses a plan whose export changed since.</li>
4792
+ <li><strong>Run.</strong> The setup, then each page object, then each test, each in a fresh session of the Tosca agent, which may edit
4793
+ only the target folder. The agent marks each line that does a Tosca step with its id (<code>// tosca: n12</code>). ForgeQE's
4794
+ fidelity check needs every step and check marked (only the branch that runs of an If that is always true or false),
4795
+ no skipped test, and assertions where Tosca checked; then it runs the test with the target's own command. A failure
4796
+ goes back to the agent with the output, up to <code>code.max_attempts</code> times. At the end every converted test runs again
4797
+ with all files in place.</li>
4798
+ <li><strong>Check again.</strong> <code>forgeqe tosca verify &lt;plan&gt;</code> runs the converted tests again with no model: all of them, one
4799
+ Tosca execution list (<code>--suite</code>), or named tests (<code>--unit</code>). Each test's steps and tags are checked again, it is run
4800
+ with the target's own command, and its outcome and whole output are kept. <code>tosca-suites.json</code> in the target folder
4801
+ lists each suite with its tag and test files, and each test with its Tosca folders, suites and last outcome.</li>
4802
+ <li><strong>Report.</strong> <code>tosca.md</code> in <code>.forgeqe/tosca/&lt;plan&gt;/</code>: each test case's outcome and fidelity (steps marked of steps
4803
+ required), the steps a person has to finish, and the environment variables to set. Running the plan again keeps the
4804
+ files that are done and unchanged.</li>
4805
+ </ol>
4806
+ <p>Exit codes of <code>tosca run</code>: <code>0</code> every test converted, <code>1</code> some or none, <code>2</code> stopped. The Tosca page of <code>forgeqe web</code>
4807
+ (sidebar, Test) does the same in four steps (export, target, instructions, review): it lists the <code>.tsu</code> exports in
4808
+ the project, reads the one you pick and lets you choose its test cases, then follows the job: its stages, every file
4809
+ with how many of its Tosca steps the test does and its whole output (Fix sends one back to the Tosca agent with a note),
4810
+ Run tests again for all of them or Run for one suite, each test case's
4811
+ Tosca steps beside the converted code with a step's lines marked and the locators Tosca recorded, and the activity as it
4812
+ happens. In the shell, &quot;convert
4813
+ tosca/checkout.tsu to Playwright&quot; inspects the export and makes the plan; you confirm it yourself. The Tosca agent
4814
+ knows Tosca from its skill <code>tosca-knowledge</code> (ActionModes, value tokens, expressions, locators, and how each maps to
4815
+ every target).</p>
4816
+ </div>
4817
+ </section>
4818
+ </div>
4819
+ </article>
4751
4820
  <article class="spec feat" id="cap-find-run-tests">
4752
4821
  <div class="hd"><span class="mono">Automated tests</span><h3>Find and run existing tests</h3></div>
4753
4822
  <p class="ds">Finds the automated tests that match a feature, tags, ids, a folder, or a sprint, confirms the selection, and runs it once the user agrees, with a verdict per test.</p>
@@ -0,0 +1,4 @@
1
+ /** The admin list of orders: each order's id and total, newest first as the query gives them. */
2
+ export function summarize(orders: { id: number; total: number }[]) {
3
+ return orders.map((o) => ({ id: o.id, total: o.total }))
4
+ }
@@ -1,10 +1,11 @@
1
1
  import express from "express"
2
2
  import { requireAuth } from "../auth"
3
3
  import { db } from "../db"
4
+ import { summarize } from "../report"
4
5
 
5
6
  export const router = express.Router()
6
7
 
7
8
  router.get("/api/admin/orders", requireAuth, async (req, res) => {
8
9
  const orders = await db.any("SELECT * FROM orders ORDER BY created_at DESC LIMIT 50")
9
- res.json(orders)
10
+ res.json(summarize(orders))
10
11
  })
@@ -0,0 +1,6 @@
1
+ import { db } from "./db"
2
+
3
+ /** Every change of an order's status goes through here, so it is recorded once and in order. */
4
+ export async function cancelOrder(orderId: number) {
5
+ await db.none("UPDATE orders SET status = 'cancelled', cancelled_at = now() WHERE id = $1", [orderId])
6
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "why": "Planted: cancel() is renamed cancelOrder(), and the cancel route still calls cancel().",
3
+ "repo": "orders-api",
4
+ "changes": [
5
+ {
6
+ "path": "src/workflow.ts"
7
+ }
8
+ ],
9
+ "expect": {
10
+ "findings": [
11
+ "dependencies:function-removed"
12
+ ]
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ import { db } from "./db"
2
+
3
+ /** Every change of an order's status goes through here, so it is recorded once and in order. */
4
+ export async function cancel(orderId: number, reason: string) {
5
+ await db.none("UPDATE orders SET status = 'cancelled', cancelled_at = now(), cancel_reason = $2 WHERE id = $1", [orderId, reason])
6
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "why": "Planted: cancel() now needs a reason, and the cancel route, which calls it, is not changed.",
3
+ "repo": "orders-api",
4
+ "changes": [
5
+ {
6
+ "path": "src/workflow.ts"
7
+ }
8
+ ],
9
+ "expect": {
10
+ "findings": [
11
+ "dependencies:signature-changed"
12
+ ]
13
+ }
14
+ }
@@ -1,12 +1,13 @@
1
1
  import express from "express"
2
2
  import { requireAuth } from "../auth"
3
3
  import { db } from "../db"
4
+ import { summarize } from "../report"
4
5
 
5
6
  export const router = express.Router()
6
7
 
7
8
  router.get("/api/admin/orders", requireAuth, async (req, res) => {
8
9
  const orders = await db.any("SELECT * FROM orders ORDER BY created_at DESC LIMIT 50")
9
- res.json(orders)
10
+ res.json(summarize(orders))
10
11
  })
11
12
 
12
13
  router.post("/api/admin/orders/:id/cancel", requireAuth, async (req, res) => {