@runcofactor/cli 0.46.0 → 0.47.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.
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
2
2
  import {
3
3
  WORKFLOW_GUIDE_CONCEPT_SECTIONS
4
- } from "./chunk-IJTIWAY6.js";
4
+ } from "./chunk-BYKQ5N5L.js";
5
5
  import {
6
6
  brandSkillContentFor,
7
7
  command
@@ -1469,18 +1469,18 @@ canary upgrade # Upgrade to latest version
1469
1469
  // src/skill-templates/test-cases-current.ts
1470
1470
  var testCasesRenderCurrent = () => `---
1471
1471
  name: test-cases
1472
- version: 2.5.0
1473
- description: Author high-quality test cases as \`.cofactor.md\` specs that compile straight into Cofactor workflows. Invoke when the user asks to write test cases, draft a test plan, plan QA scenarios, decide what to test, or convert a PRD/ticket/design into tests.
1472
+ version: 2.6.0
1473
+ description: Plan high-quality test journeys and assertions, then create or update Cofactor workflows through the CLI using the caller\u2019s requested output.
1474
1474
  allowed-tools: Read, Grep, Glob, Bash, Write
1475
1475
  ---
1476
1476
 
1477
1477
  # Test Case Authoring (Cofactor)
1478
1478
 
1479
- Use this skill when the user asks for test cases, a test plan, QA scenarios, "what should we test for X", or wants to turn a PRD / ticket / design into tests. The output is one or more **\`.cofactor.md\` spec files** \u2014 each file is one workflow, one journey, one test case. \`cofactor spec compile <file>\` turns them into runnable Cofactor workflows; \`cofactor spec validate <file>\` enforces the structural rules below. (Legacy \`.canary.md\` files still validate and compile; new specs default to \`.cofactor.md\`.)
1479
+ Use this skill to plan high-quality test journeys and assertions. By default, create or update the flow directly through \`cofactor workflow create\`, \`cofactor workflow patch\`, and workflow node commands. Follow the caller\u2019s requested output. Write \`.cofactor.md\` files only when explicitly requested; the file-format sections below apply only to that mode.
1480
1480
 
1481
1481
  The skill has three layers:
1482
1482
  1. **Industry rubric** \u2014 what makes a test case good (ISTQB-aligned).
1483
- 2. **Spec mapping** \u2014 how each rubric piece becomes a section of \`.cofactor.md\`.
1483
+ 2. **Authoring guidance** \u2014 direct CLI flows by default; file-format mapping when requested.
1484
1484
  3. **Domain Context** \u2014 customer-specific sources of truth, filled in once.
1485
1485
 
1486
1486
  Read the Domain Context block at the bottom **first**. If it is unfilled, follow the discovery instructions there before authoring any cases.
@@ -1496,12 +1496,12 @@ A case covers a single coherent journey \u2014 one user objective, possibly with
1496
1496
 
1497
1497
  - Good (coherent journey, multiple checks): "Onboard an org: create org \u2192 invite a user \u2192 claim invite \u2192 land on dashboard." Each step verifies its own outcome inline.
1498
1498
  - Good (single short journey): "Submit a ticket and confirm it appears in the queue."
1499
- - Bad (unrelated jobs): "Submit a ticket, edit a user, generate a report." \u2014 three journeys, three separate \`.cofactor.md\` files.
1499
+ - Bad (unrelated jobs): "Submit a ticket, edit a user, generate a report." \u2014 three journeys, three separate workflows.
1500
1500
 
1501
1501
  **Rule of thumb:** if isolating a check (e.g. "tagging works") would force you to duplicate most of another case's setup, fold it in as an inline assertion on the larger journey instead. Splitting only pays off when the setup is genuinely different or the failure modes are independent.
1502
1502
 
1503
1503
  ### 2. Specific, observable expected results
1504
- Every assertion must be something a stranger could verify without judgement.
1504
+ Every assertion must be something a stranger could verify without judgement. Expected results come from codified requirements or confirmed user intent, not incidental DOM details discovered in exploration. Keep conditions about user-visible behavior; do not invent ARIA/SVG checks, arbitrary pixel thresholds, or signed-in-user checks when identity is only setup. Chosen scroll distances are action inputs; live measurements and tolerances belong in verification code.
1505
1505
  - Good: "URL ends with \`/dashboard\`." / "A row with name \`X\` appears in the table."
1506
1506
  - Bad: "The page looks correct." / "It works."
1507
1507
 
@@ -1556,6 +1556,8 @@ Aim for the smallest set that proves the feature works. Five sharp cases beat tw
1556
1556
 
1557
1557
  ## 3. Authoring \`.cofactor.md\`
1558
1558
 
1559
+ Sections 3\u20135 apply only when the caller explicitly requests file-based specs. For direct CLI authoring, use \`cofactor workflow --help\` and \`cofactor workflow guide\` for supported inputs, and return the workflow URL printed by the CLI.
1560
+
1559
1561
  \`.cofactor.md\` is one workflow per file. Frontmatter sets identity; H2 sections carry prose and structured config; \`## Journey\` is the linear test itself. The compiler validates structure; lint enforces the rubric semantics above.
1560
1562
 
1561
1563
  Run these for the definitive grammar \u2014 do **not** restate them here:
@@ -1615,7 +1617,9 @@ When you need a value (workflow-level \`## Inputs\` or step-level \`- field\`),
1615
1617
 
1616
1618
  ## 4. Output format
1617
1619
 
1618
- For each case, write a \`.cofactor.md\` file alongside a one-row summary line. Default location: \`cofactor/specs/<slug>.cofactor.md\` (confirm with the user if their repo uses a different layout \u2014 check Domain Context below).
1620
+ For direct CLI authoring, return the created or updated workflow link and a concise summary of the journey, assertions, data dependencies, and blockers.
1621
+
1622
+ The file output below applies only when explicitly requested. For each case, write a \`.cofactor.md\` file alongside a one-row summary line. Default location: \`cofactor/specs/<slug>.cofactor.md\` (confirm with the user if their repo uses a different layout \u2014 check Domain Context below).
1619
1623
 
1620
1624
  ### Summary table
1621
1625
 
@@ -1766,12 +1770,12 @@ After writing, run \`cofactor spec validate cofactor/specs/submit-ticket.cofacto
1766
1770
  - **Default environment**: <unfilled \u2014 \`prod\` | \`staging\` | \`dev\`>
1767
1771
  - **Credentials / role matrix** (\`actor:\` is a persona name by default \u2014 list via \`cofactor persona list --application "<application>"\`. Prefix with \`credential \` to bind a specific raw credential \u2014 list via \`cofactor credential list\`. Use the persona form unless the case genuinely needs a fixed named account.): <unfilled \u2014 list the persona names available on the default application, with a one-line note on which to use when. Common shape: \`actor: Admin\` (standard user), \`actor: Superadmin\` (full access).>
1768
1772
  - **Tagging conventions**: <unfilled \u2014 e.g. \`smoke\`, \`regression\`, plus the priority tags \`p0\` / \`p1\` / \`p2\`>
1769
- - **Spec directory**: <unfilled \u2014 where \`.cofactor.md\` files live in this repo, e.g. \`cofactor/specs/\`>
1773
+ - **Spec directory (file mode only)**: <unfilled \u2014 where \`.cofactor.md\` files live in this repo, e.g. \`cofactor/specs/\`>
1770
1774
  - **Existing workflows to extend or avoid duplicating**: <unfilled \u2014 search via \`cofactor workflow list --search <term>\`>
1771
1775
  - **Glossary / domain terms**: <unfilled \u2014 terms that show up in tickets and should appear verbatim in spec names>
1772
1776
  - **Other sources of truth**: <unfilled \u2014 runbooks, support tickets, analytics dashboards>
1773
1777
 
1774
- When this block is fully populated, every case you author should reference at least the **Requirements**, **Default property**, **Spec directory**, and **Credentials** entries.
1778
+ When this block is fully populated, every case you author should reference at least the **Requirements**, **Default property**, and **Credentials** entries. Consult **Spec directory** only for explicitly requested file output; do not ask for it when authoring through the CLI.
1775
1779
  `;
1776
1780
 
1777
1781
  // src/skill-templates/test-cases-v2-3-0.ts
@@ -2065,6 +2069,314 @@ After writing, run \`cofactor spec validate cofactor/specs/submit-ticket.cofacto
2065
2069
  When this block is fully populated, every case you author should reference at least the **Requirements**, **Default property**, **Spec directory**, and **Credentials** entries.
2066
2070
  `;
2067
2071
 
2072
+ // src/skill-templates/test-cases-v2-5-0.ts
2073
+ var testCasesRenderV2_5_0 = () => `---
2074
+ name: test-cases
2075
+ version: 2.5.0
2076
+ description: Author high-quality test cases as \`.cofactor.md\` specs that compile straight into Cofactor workflows. Invoke when the user asks to write test cases, draft a test plan, plan QA scenarios, decide what to test, or convert a PRD/ticket/design into tests.
2077
+ allowed-tools: Read, Grep, Glob, Bash, Write
2078
+ ---
2079
+
2080
+ # Test Case Authoring (Cofactor)
2081
+
2082
+ Use this skill when the user asks for test cases, a test plan, QA scenarios, "what should we test for X", or wants to turn a PRD / ticket / design into tests. The output is one or more **\`.cofactor.md\` spec files** \u2014 each file is one workflow, one journey, one test case. \`cofactor spec compile <file>\` turns them into runnable Cofactor workflows; \`cofactor spec validate <file>\` enforces the structural rules below. (Legacy \`.canary.md\` files still validate and compile; new specs default to \`.cofactor.md\`.)
2083
+
2084
+ The skill has three layers:
2085
+ 1. **Industry rubric** \u2014 what makes a test case good (ISTQB-aligned).
2086
+ 2. **Spec mapping** \u2014 how each rubric piece becomes a section of \`.cofactor.md\`.
2087
+ 3. **Domain Context** \u2014 customer-specific sources of truth, filled in once.
2088
+
2089
+ Read the Domain Context block at the bottom **first**. If it is unfilled, follow the discovery instructions there before authoring any cases.
2090
+
2091
+ ---
2092
+
2093
+ ## 1. The 7-rule rubric
2094
+
2095
+ Each case must satisfy all seven. If a rule cannot be satisfied, say so explicitly and explain why \u2014 don't silently skip.
2096
+
2097
+ ### 1. One coherent journey per case (atomic, but not micro)
2098
+ A case covers a single coherent journey \u2014 one user objective, possibly with several verifications along the way. "Atomic" means *coherent*, not *minimal*: if multiple checks share the same setup and naturally flow from one another, they belong in the same case.
2099
+
2100
+ - Good (coherent journey, multiple checks): "Onboard an org: create org \u2192 invite a user \u2192 claim invite \u2192 land on dashboard." Each step verifies its own outcome inline.
2101
+ - Good (single short journey): "Submit a ticket and confirm it appears in the queue."
2102
+ - Bad (unrelated jobs): "Submit a ticket, edit a user, generate a report." \u2014 three journeys, three separate \`.cofactor.md\` files.
2103
+
2104
+ **Rule of thumb:** if isolating a check (e.g. "tagging works") would force you to duplicate most of another case's setup, fold it in as an inline assertion on the larger journey instead. Splitting only pays off when the setup is genuinely different or the failure modes are independent.
2105
+
2106
+ ### 2. Specific, observable expected results
2107
+ Every assertion must be something a stranger could verify without judgement.
2108
+ - Good: "URL ends with \`/dashboard\`." / "A row with name \`X\` appears in the table."
2109
+ - Bad: "The page looks correct." / "It works."
2110
+
2111
+ Lint enforces this as **R1**: a spec with zero run-failing (\`fail\`/\`fatal\`) assertions warns.
2112
+
2113
+ ### 3. Idempotent, self-owned, isolated \u2014 by default
2114
+ These are strong defaults, not absolutes: a case defaults to the rule, uses the named workaround when the app makes the rule impossible, and says so in \`## Preflight\` / \`## Cleanup\` so the deviation is visible, never silent.
2115
+ - **Idempotent** \u2014 rerunning the case, including after a failed run, passes without a manual reset. Canonical macros (\\$EMAIL(), \\$UUID(), \`QA Test \u2014 \\$RANDOM_STRING(6)\`) make this true even when cleanup never ran. Workaround: if the app forbids duplicates (a singleton setting), revert in \`## Cleanup\` and say so.
2116
+ - **Controls its own data** \u2014 create the records the case operates on **inline** (\`## Inputs\` + \`## Scenarios\`, an action node that creates them). A \`**Seed**\` node is for data that several specs share; a seed with one consumer is overhead. Workaround: pre-existing environment data the case only *reads* is fine \u2014 declare it in \`## Preflight\` and never mutate it.
2117
+ - **Isolated** \u2014 works only on data it created; never modifies shared resources (billing, integrations, API keys, org config) as a side effect. Cases that genuinely depend on one another are ordered as **suite layers** (\`cofactor test-suite \u2026 --layer\`), never by implicit ordering.
2118
+ - **Cleanup survives failure** \u2014 a \`fatal\` assertion halts the run before trailing cleanup nodes execute; seed-paired teardowns run on pass and fail. Inline cleanup is best-effort and pairs with unique naming; a record that must be gone even after a failure is provisioned by a seed with a teardown.
2119
+ - **External dependencies are declared or captured** \u2014 email delivery via a seed credential output with an email inbox; payments, third-party APIs, and feature flags declared in \`## Preflight\`.
2120
+
2121
+ ### 4. Traceable
2122
+ Every case carries \`requirementRef:\` in frontmatter pointing at the ticket / PRD / design. If you can't find one, flag the gap to the user \u2014 untraceable specs rot. Lint **R2** warns when missing.
2123
+
2124
+ ### 5. Risk-prioritized
2125
+ Tag each case with a priority via the \`tags:\` array. Use one of: \`p0\`, \`p1\`, \`p2\`.
2126
+ - **p0** \u2014 happy path of the core promise; if this breaks, the feature is broken.
2127
+ - **p1** \u2014 primary edge cases, validation, role variants, common error states.
2128
+ - **p2** \u2014 rare conditions, visual/agentic checks, low-frequency edges.
2129
+
2130
+ ### 6. Includes preconditions, data, and cleanup
2131
+ - **Auth/role preconditions** \u2192 \`actor:\` in frontmatter.
2132
+ - **Other preconditions** (feature flags, seeded data, sister flows, pre-existing data the case reads but doesn't own, external systems) \u2192 bulleted prose in \`## Preflight\`.
2133
+ - **Test data** \u2192 \`## Inputs\` (with macros) and per-variant \`## Scenarios\`.
2134
+ - **Teardown** \u2192 bulleted prose in \`## Cleanup\`.
2135
+
2136
+ ### 7. Written as human intent, not UI mechanics
2137
+ Action titles describe *what the user is trying to do*; the optional \`> blockquote\` underneath gives just enough context for the recorder/agent. Don't write click-by-click sequences.
2138
+ - Good: \`**Action \u2014 Assign the ticket to Support**\`
2139
+ - Bad: \`**Action \u2014 Click 'Assign' dropdown, scroll, click 'Support', click Save**\`
2140
+
2141
+ Lint **R9** warns when an action reads as click-by-click.
2142
+
2143
+ ---
2144
+
2145
+ ## 2. Coverage checklist
2146
+
2147
+ Before handing back a set of specs, sanity-check coverage. For each, either include a case or note why it doesn't apply:
2148
+ - Happy path (p0)
2149
+ - Primary edges / boundary inputs
2150
+ - Negative paths / validation errors
2151
+ - Permissions and role variants (admin / member / unauthenticated)
2152
+ - Empty, loading, and error states
2153
+ - Cross-entity side effects (does this change something visible elsewhere?)
2154
+ - Cleanup / undo where applicable
2155
+
2156
+ Aim for the smallest set that proves the feature works. Five sharp cases beat twenty fuzzy ones.
2157
+
2158
+ ---
2159
+
2160
+ ## 3. Authoring \`.cofactor.md\`
2161
+
2162
+ \`.cofactor.md\` is one workflow per file. Frontmatter sets identity; H2 sections carry prose and structured config; \`## Journey\` is the linear test itself. The compiler validates structure; lint enforces the rubric semantics above.
2163
+
2164
+ Run these for the definitive grammar \u2014 do **not** restate them here:
2165
+
2166
+ \`\`\`bash
2167
+ cofactor spec --help # validate / compile / diff commands
2168
+ cofactor spec validate <file> # parse + lint offline; enforce the rules in \xA71
2169
+ cofactor spec compile <file> # create or update the workflow (prints the live URL)
2170
+ cofactor workflow guide # node-shape and macro reference
2171
+ \`\`\`
2172
+
2173
+ After \`cofactor spec compile\`, echo the printed \`URL:\` line back to the user verbatim \u2014 it points at the workflow you just created (\`https://app.runcofactor.com/flows/<id>\` for prod, \`https://app.dev.runcofactor.com/flows/<id>\` for dev). Don't construct it yourself.
2174
+
2175
+ Mapping at a glance:
2176
+
2177
+ | Rubric piece | Where it lives in \`.cofactor.md\` |
2178
+ |-----------------------------------------|---------------------------------------------------------------------------|
2179
+ | Case title | \`frontmatter.name\` |
2180
+ | Requirement / ticket ref | \`frontmatter.requirementRef\` |
2181
+ | Priority (rule 5) | \`tags: [p0]\` (or p1/p2) in frontmatter |
2182
+ | Auth role precondition | \`actor: <X>\` + \`authenticated: true\` in frontmatter. \`<X>\` is a **persona** name by default (e.g. \`actor: Admin\` or the explicit \`actor: persona Admin\`), or a specific raw credential via \`actor: credential <name>\` when the case genuinely needs one named account. Personas resolve at run/suite level; raw credentials bind a single fixed account. Legacy \`actor: template Admin\` remains accepted. List personas with \`cofactor persona list --application "<application>"\`; list credentials with \`cofactor credential list\`. |
2183
+ | Feature flag / seeded data / read-only pre-existing data preconditions | Bulleted prose in \`## Preflight\` ("Feature flag X enabled.", "Seed workflow Y published.", "Property 'Acme Demo' exists with \u22651 issue \u2014 read only.") |
2184
+ | One-paragraph user-visible promise | \`## Spirit\` (blockquote) |
2185
+ | Workflow-level declared inputs | \`## Inputs\` (e.g. \`- foo: \\$EMAIL()\`) \u2014 parses to \`workflows.inputs_json\`, surfaces in Workflow Settings \u2192 Inputs. Later values may compose earlier value inputs with \`\\$var.<name>\`; self/forward/unknown references are invalid. |
2186
+ | Per-step bound values | \`- field X: Y\` under an Action \u2014 populates *that* step's Inputs panel with \`Y\` as the default (compiler mirrors fields \u2192 \`dataRequirements\` + \`inputValues\` on the node). Prefer \`## Inputs\` for values shared across actions. |
2187
+ | Variants (free / enterprise, etc.) | \`## Scenarios\` with per-scenario \`values:\` / \`credentials:\` overrides |
2188
+ | Steps (human intent) | \`## Journey\` \u2014 \`**Navigate to** \u2026\`, \`**Action \u2014 \u2026**\`, \`**Seed** \u2026\` |
2189
+ | Inline expected results | \`- assert (fatal \\| fail \\| warn): <condition>\` under the action that produced it. \`fatal\` ends the test now (gating preconditions), \`fail\` marks the run failed but keeps going (feature claims), \`warn\` records without failing (cosmetics) |
2190
+ | Standalone assertion | \`**Assert** <condition>\` node (prefer inline when possible) |
2191
+ | Role change mid-journey | \`**Switch role to** <X>\` \u2014 mirrors \`actor:\`. \`<X>\` is a persona name by default (\`**Switch role to** Admin\`), \`persona <name>\` is the explicit persona form (\`**Switch role to** persona Admin\`), \`credential <name>\` binds a specific raw credential (\`**Switch role to** credential admin-bob\`). Legacy \`template <name>\` remains accepted. Compiles to a login node with \`performLogin: true\`. Repeat as many times as needed in one journey. |
2192
+ | Cross-action data flow | \`- capture: <name>\` on the upstream action, \`\\$var.<name>\` downstream |
2193
+ | Cleanup | Bulleted prose in \`## Cleanup\` |
2194
+
2195
+ When a journey shares setup and naturally flows end-to-end, emit **one** \`.cofactor.md\` with multiple action nodes and inline assertions. When journeys are unrelated, emit **one file per journey**; if one journey depends on data created by another, link them with \`**Seed** <spec-name>\` at the top of the dependent file (setup nodes are deprecated). If the journeys must *run* in order rather than share data, order them as suite layers.
2196
+
2197
+ ### Action altitude \u2014 what each \`**Action \u2014**\` step should cover
2198
+
2199
+ Each \`**Action \u2014**\` is one coherent, intent-level step. The same altitude the Flow Designer and recorder use applies here (see \`cofactor workflow guide action-nodes\`):
2200
+
2201
+ - **One coherent step, usually broader than a single click** \u2014 "Submit the ticket", "Fill out the subscription form". A lone action that stands on its own ("Click Start to open the config modal") is fine; a purely mechanical title ("Click the button") or a stuffed multi-outcome step is not. When the recorder compiles your step it should land around 3\u20138 playbook actions \u2014 if one \`**Action \u2014**\` implies ~20 clicks across several screens, it's two actions.
2202
+ - **End each step at an assertable boundary** (modal gone, URL changed, row appeared) and assert it inline. Relative or temporal checks must reference an upstream \`- capture:\` \u2014 \`assert (fail): current count = \\$var.start_count - 2\`, never "the count dropped by 2" (a cache-replayed action's assertion can be judged with no memory of the "before" state).
2203
+ - **No conditionals inside a step** \u2014 "if patient X isn't there, create X" usually means the data wasn't seeded; stage it in \`## Preflight\` / a \`**Seed**\` instead. If the same steps reach the goal from any starting state (idempotent), just write them unconditionally.
2204
+
2205
+ ### Inputs defaults \u2014 the decision rule
2206
+
2207
+ When you need a value (workflow-level \`## Inputs\` or step-level \`- field\`), pick where it comes from in this order:
2208
+
2209
+ 1. **Names existing data in the target environment** \u2014 a property name, a credential, a seeded record, an existing org/user/team. **Stop and ask the user for the value before writing the spec.** Don't hand-pick. The right sources of truth:
2210
+ - \`cofactor property list\` \u2014 properties (target apps)
2211
+ - \`cofactor persona list --application "<application>"\` \u2014 personas (these are what \`actor:\` and \`- credential \u2026\` reference)
2212
+ - \`cofactor workflow list --search <term>\` \u2014 existing workflows to seed/link to
2213
+ - \`cofactor feature-flag list --env <env>\` \u2014 flag names for Preflight prose
2214
+ 2. **Synthesizable** \u2014 a new email, a UUID, a throwaway string, an ISO date. Pick a macro (\`\\$EMAIL()\`, \`\\$UUID()\`, \`\\$TODAY()\`) and move on without asking. Parentheses are mandatory, including for zero-argument macros. These render as pills in the Inputs panel and resolve at run time.
2215
+ 3. **Prefer personas** for any auth/role-scoped input. \`actor: Admin\` (frontmatter) and \`- credential admin: Admin\` (inputs) are cleaner than passing \`username:\` + \`password:\` and work across environments. Reach for the raw-credential form (\`actor: credential <name>\`, \`**Switch role to** credential <name>\`, \`- credential admin: <name>\`) only when the case genuinely requires a specific fixed account.
2216
+
2217
+ ---
2218
+
2219
+ ## 4. Output format
2220
+
2221
+ For each case, write a \`.cofactor.md\` file alongside a one-row summary line. Default location: \`cofactor/specs/<slug>.cofactor.md\` (confirm with the user if their repo uses a different layout \u2014 check Domain Context below).
2222
+
2223
+ ### Summary table
2224
+
2225
+ | file | name | priority | requirementRef |
2226
+ |-----------------------------------|--------------------------------------------|----------|------------------|
2227
+ | cofactor/specs/submit-ticket.cofactor.md | Submit a ticket and confirm it appears in the queue | p0 | <ticket/PRD ref> |
2228
+
2229
+ ### Per-case file
2230
+
2231
+ \`\`\`markdown
2232
+ ---
2233
+ name: <one user goal, action-oriented>
2234
+ actor: <persona name from Domain Context \u2014 verbatim, e.g. "Admin"; or \`credential <name>\` for a specific raw credential>
2235
+ authenticated: true
2236
+ tags: [p0] # or p1 / p2; add other tags from Domain Context's tagging conventions
2237
+ requirementRef: <ticket id, PRD path, design link>
2238
+ ---
2239
+
2240
+ # <same as name>
2241
+
2242
+ ## Spirit
2243
+ > <one short paragraph: the user-visible promise this case proves>
2244
+
2245
+ ## Preflight
2246
+ - <feature flag / seed / sister flow / role precondition, one per bullet>
2247
+
2248
+ ## Cleanup
2249
+ - <records to delete, flags to reset>
2250
+
2251
+ ## Inputs
2252
+ - <name>: <value or macro>
2253
+
2254
+ ## Journey
2255
+
2256
+ **Navigate to** \\\`/some/path\\\`.
2257
+
2258
+ **Action \u2014 <human intent>**
2259
+ > <one-sentence context for the recorder/agent>
2260
+ - field <name> [(type)]: <value or \\$input>
2261
+ - capture: <name> # optional, only if a later step needs it via \\$var.<name>
2262
+ - assert (fatal): <gating precondition \u2014 test must stop if wrong>
2263
+ - assert (fail): <observable condition \u2014 feature is broken if wrong>
2264
+ - assert (warn): <softer signal \u2014 cosmetic, run still passes>
2265
+
2266
+ **End**.
2267
+ \`\`\`
2268
+
2269
+ A case is one coherent journey \u2014 long or short, with no target node count. If a case grows very long, ask whether it's really several independent journeys: splitting them into separate \`.cofactor.md\` files lets them run in parallel and fail independently. Keep a single coherent journey together \u2014 don't split mid-flow.
2270
+
2271
+ ---
2272
+
2273
+ ## 5. Worked example (generic)
2274
+
2275
+ Request: "Test the support ticket flow."
2276
+
2277
+ | file | name | priority | requirementRef |
2278
+ |-------------------------------------------|-----------------------------------------------------|----------|----------------|
2279
+ | cofactor/specs/submit-ticket.cofactor.md | Submit a ticket and confirm it appears in the queue | p0 | <fill in> |
2280
+ | cofactor/specs/ticket-required-fields.cofactor.md | Required-field validation blocks submit | p1 | <fill in> |
2281
+ | cofactor/specs/ticket-non-admin-reassign.cofactor.md | Non-admin cannot reassign a ticket | p1 | <fill in> |
2282
+
2283
+ \`cofactor/specs/submit-ticket.cofactor.md\`:
2284
+
2285
+ \`\`\`markdown
2286
+ ---
2287
+ name: Submit a ticket and confirm it appears in the queue
2288
+ actor: Admin
2289
+ authenticated: true
2290
+ tags: [p0, smoke, support]
2291
+ requirementRef: <fill in>
2292
+ ---
2293
+
2294
+ # Submit a ticket and confirm it appears in the queue
2295
+
2296
+ ## Spirit
2297
+ > A member can file a support ticket from the in-app form and immediately
2298
+ > see it land in their team's queue without a refresh.
2299
+
2300
+ ## Preflight
2301
+ - At least one Support team exists in the test org (seed workflow \\\`support-team-seed\\\`).
2302
+ - Feature flag \\\`support_inbox_v3\\\` is enabled.
2303
+
2304
+ ## Cleanup
2305
+ - Delete the created ticket.
2306
+
2307
+ ## Inputs
2308
+ - subject: "QA \\$UUID()"
2309
+ - priority: high
2310
+
2311
+ ## Journey
2312
+
2313
+ **Navigate to** \\\`/support/new\\\`.
2314
+
2315
+ **Action \u2014 Submit the ticket**
2316
+ > Fill subject and priority, then submit.
2317
+ - field subject: \\$subject
2318
+ - field priority (select): \\$priority
2319
+ - assert (warn): Toast contains "Ticket created"
2320
+ - assert (fail): URL ends with \\\`/support\\\`
2321
+
2322
+ **Navigate to** \\\`/support/queue\\\`.
2323
+
2324
+ **Action \u2014 Confirm it appears in the queue**
2325
+ > Locate the new ticket in the team queue.
2326
+ - assert (fail): A row matching \\\`\\$subject\\\` is visible
2327
+
2328
+ **End**.
2329
+ \`\`\`
2330
+
2331
+ After writing, run \`cofactor spec validate cofactor/specs/submit-ticket.cofactor.md\` and resolve any errors / warnings before handing back.
2332
+
2333
+ ---
2334
+
2335
+ ## 6. Anti-patterns
2336
+
2337
+ - Mega-files that try to cover five unrelated journeys.
2338
+ - The opposite: splitting one coherent journey into N tiny files that each re-create the same setup. Bundle them into one \`## Journey\` instead.
2339
+ - Click-by-click action titles ("Click X, scroll, click Y").
2340
+ - Conditional steps ("if X isn't set, set it"; "if patient X is missing, create X") \u2014 seed the precondition or write idempotent steps instead.
2341
+ - Relative or temporal assertions ("the count dropped by 2") with no upstream \`- capture:\` to anchor the baseline.
2342
+ - "Looks correct" / "everything works" assertions.
2343
+ - Hardcoded emails, IDs, or names that collide on rerun. Use macros (\\$EMAIL(), \\$UUID()).
2344
+ - Specs that depend on another spec having run first without an explicit \`**Seed**\` node or a suite layer. Setup nodes are deprecated \u2014 don't emit them.
2345
+ - A \`**Seed**\` for data only this spec uses \u2014 create it inline instead.
2346
+ - Mutating data the spec didn't create, or relying on pre-existing data without declaring it in \`## Preflight\`.
2347
+ - Skipping \`requirementRef\` because "it's obvious".
2348
+ - Asserting state via toasts only \u2014 confirm the underlying record changed.
2349
+ - Dropping the priority tag \u2014 risk-rank every case (\`p0\` / \`p1\` / \`p2\`).
2350
+
2351
+ ---
2352
+
2353
+ ## 7. Domain Context
2354
+
2355
+ <!-- AGENT/CUSTOMER: fill in this block on first use of the skill, then commit it. -->
2356
+ <!-- If any field below is "<unfilled>", do a discovery pass before authoring cases: -->
2357
+ <!-- - Read README.md, CLAUDE.md, AGENTS.md, docs/, specs/ for requirement and design pointers. -->
2358
+ <!-- - Scan recent git log for ticket-tracker references (JIRA-123, LIN-456, #issue). -->
2359
+ <!-- - Run \`cofactor property list\` and \`cofactor persona list --application "<application>"\` to learn applications + the personas that map to \`actor:\` values. -->
2360
+ <!-- - (\`cofactor credential list\` shows live credentials \u2014 useful, but the \`actor:\` field references personas, not credentials.) -->
2361
+ <!-- - Run \`cofactor workflow list --search <feature>\` to avoid duplicating existing workflows. -->
2362
+ <!-- - Run \`cofactor feature-flag list\` to confirm flag names referenced in Preflight prose. -->
2363
+ <!-- - Propose values to the user, get confirmation, then edit this block in place. -->
2364
+
2365
+ - **Requirements / PRDs**: <unfilled \u2014 paths or URLs, e.g. \`docs/specs/\`, Notion space, Linear project>
2366
+ - **Designs**: <unfilled \u2014 Figma links, design system doc>
2367
+ - **Ticket tracker**: <unfilled \u2014 Jira/Linear project key + how to format \`requirementRef\` (e.g. \`PROJ-123\` or a URL)>
2368
+ - **Default property**: <unfilled \u2014 the property name to target; find via \`cofactor property list\`>
2369
+ - **Default environment**: <unfilled \u2014 \`prod\` | \`staging\` | \`dev\`>
2370
+ - **Credentials / role matrix** (\`actor:\` is a persona name by default \u2014 list via \`cofactor persona list --application "<application>"\`. Prefix with \`credential \` to bind a specific raw credential \u2014 list via \`cofactor credential list\`. Use the persona form unless the case genuinely needs a fixed named account.): <unfilled \u2014 list the persona names available on the default application, with a one-line note on which to use when. Common shape: \`actor: Admin\` (standard user), \`actor: Superadmin\` (full access).>
2371
+ - **Tagging conventions**: <unfilled \u2014 e.g. \`smoke\`, \`regression\`, plus the priority tags \`p0\` / \`p1\` / \`p2\`>
2372
+ - **Spec directory**: <unfilled \u2014 where \`.cofactor.md\` files live in this repo, e.g. \`cofactor/specs/\`>
2373
+ - **Existing workflows to extend or avoid duplicating**: <unfilled \u2014 search via \`cofactor workflow list --search <term>\`>
2374
+ - **Glossary / domain terms**: <unfilled \u2014 terms that show up in tickets and should appear verbatim in spec names>
2375
+ - **Other sources of truth**: <unfilled \u2014 runbooks, support tickets, analytics dashboards>
2376
+
2377
+ When this block is fully populated, every case you author should reference at least the **Requirements**, **Default property**, **Spec directory**, and **Credentials** entries.
2378
+ `;
2379
+
2068
2380
  // src/skill-templates/test-cases-v2-4-0.ts
2069
2381
  var testCasesRenderV2_4_0 = () => `---
2070
2382
  name: test-cases
@@ -2369,12 +2681,13 @@ When this block is fully populated, every case you author should reference at le
2369
2681
  // src/skill-templates/test-cases.ts
2370
2682
  var testCasesTemplate = {
2371
2683
  name: "test-cases",
2372
- description: "Author high-quality test cases as `.cofactor.md` specs that compile straight into Cofactor workflows. Invoke when the user asks to write test cases, draft a test plan, plan QA scenarios, decide what to test, or convert a PRD/ticket/design into tests.",
2373
- version: "2.5.0",
2684
+ description: "Plan high-quality test journeys and assertions, then create or update Cofactor workflows through the CLI using the caller\u2019s requested output.",
2685
+ version: "2.6.0",
2374
2686
  render: testCasesRenderCurrent,
2375
2687
  previousVersions: {
2376
2688
  "2.3.0": testCasesRenderV2_3_0,
2377
- "2.4.0": testCasesRenderV2_4_0
2689
+ "2.4.0": testCasesRenderV2_4_0,
2690
+ "2.5.0": testCasesRenderV2_5_0
2378
2691
  }
2379
2692
  };
2380
2693
 
@@ -3049,4 +3362,4 @@ export {
3049
3362
  resolveInstallDir,
3050
3363
  runSkill
3051
3364
  };
3052
- //# sourceMappingURL=skill-G2654GLA.js.map
3365
+ //# sourceMappingURL=skill-A4MN7UIT.js.map