requirementbot 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +197 -2
  3. package/bin/requirementbot.js +21 -0
  4. package/package.json +53 -4
  5. package/prompts/README.md +18 -0
  6. package/prompts/check.md +15 -0
  7. package/prompts/fix.md +4 -0
  8. package/prompts/from-code.md +12 -0
  9. package/prompts/from-docs.md +11 -0
  10. package/prompts/from-issues.md +14 -0
  11. package/prompts/mdq.md +8 -0
  12. package/prompts/partials/non-interactive.md +1 -0
  13. package/prompts/partials/subagents.md +1 -0
  14. package/prompts/report.md +8 -0
  15. package/prompts/system.md +9 -0
  16. package/skills/SOURCE.md +14 -0
  17. package/skills/catalog-features/SKILL.md +168 -0
  18. package/skills/catalog-features/references/layout.md +87 -0
  19. package/skills/detect-product-mismatches/SKILL.md +147 -0
  20. package/skills/detect-product-mismatches/references/features.md +84 -0
  21. package/skills/detect-product-mismatches/references/layout.md +99 -0
  22. package/skills/pull-request-diff-analyzer/SKILL.md +141 -0
  23. package/skills/qa-explain-behavior/SKILL.md +112 -0
  24. package/skills/qa-explain-behavior/references/answer-shapes.md +116 -0
  25. package/skills/qa-explain-behavior/references/examples.md +157 -0
  26. package/skills/qa-pr-requirements-analyzer/SKILL.md +149 -0
  27. package/skills/qa-pr-requirements-analyzer/references/summary-example.md +54 -0
  28. package/skills/qa-requirement-reviewer/SKILL.md +126 -0
  29. package/skills/qa-requirement-reviewer/references/requirements_reviewer_examples.md +128 -0
  30. package/skills/qa-thinking/SKILL.md +46 -0
  31. package/skills/requirements-from-code/SKILL.md +114 -0
  32. package/skills/requirements-from-code/references/behaviors.md +42 -0
  33. package/skills/requirements-from-code/references/layout.md +100 -0
  34. package/skills/requirements-from-expected/SKILL.md +116 -0
  35. package/skills/requirements-from-expected/references/behaviors.md +49 -0
  36. package/skills/requirements-from-expected/references/layout.md +74 -0
  37. package/skills/requirements-from-expected/references/merge.md +34 -0
  38. package/skills/write-user-story/SKILL.md +42 -0
  39. package/src/agent/agent.js +278 -0
  40. package/src/agent/auth.js +209 -0
  41. package/src/agent/prompt.js +36 -0
  42. package/src/branding.js +27 -0
  43. package/src/cli.js +26 -0
  44. package/src/commands/agent-command.js +61 -0
  45. package/src/commands/check.js +26 -0
  46. package/src/commands/command.js +40 -0
  47. package/src/commands/connect.js +33 -0
  48. package/src/commands/disconnect.js +18 -0
  49. package/src/commands/generate-from-code.js +20 -0
  50. package/src/commands/generate-from-docs.js +38 -0
  51. package/src/commands/generate-from-issues.js +41 -0
  52. package/src/commands/index.js +40 -0
  53. package/src/commands/login.js +44 -0
  54. package/src/commands/logout.js +17 -0
  55. package/src/commands/models.js +11 -0
  56. package/src/commands/pull.js +15 -0
  57. package/src/commands/push.js +29 -0
  58. package/src/commands/query.js +31 -0
  59. package/src/commands/report.js +23 -0
  60. package/src/commands/skills.js +20 -0
  61. package/src/commands/sources.js +16 -0
  62. package/src/commands/update-from-code.js +7 -0
  63. package/src/commands/update-from-docs.js +7 -0
  64. package/src/commands/update-from-issues.js +7 -0
  65. package/src/config.js +90 -0
  66. package/src/files.js +25 -0
  67. package/src/github.js +50 -0
  68. package/src/http.js +19 -0
  69. package/src/requirements.js +139 -0
  70. package/src/sources/adf.js +48 -0
  71. package/src/sources/github.js +81 -0
  72. package/src/sources/index.js +41 -0
  73. package/src/sources/jira.js +135 -0
  74. package/src/sources/pages.js +67 -0
  75. package/src/sources/source.js +60 -0
  76. package/src/transports/confluence.js +114 -0
  77. package/src/transports/git.js +90 -0
  78. package/src/transports/github.js +42 -0
  79. package/src/transports/index.js +36 -0
  80. package/src/transports/notion.js +108 -0
  81. package/src/transports/page-tree.js +119 -0
  82. package/src/transports/transport.js +41 -0
@@ -0,0 +1,87 @@
1
+ # Catalog layout
2
+
3
+ Source folder per source inside `actual/` or `expected/` in `requirements/`.
4
+
5
+ ```
6
+ requirements/
7
+ actual/ # strict name: how it works now
8
+ {source-name}/ # source folder of a source with role Actual
9
+ expected/ # strict name: what was intended to be built
10
+ {source-name}/ # source folder of a source with role Expected
11
+ ```
12
+
13
+ Inside a source folder, the catalog puts the source's features into areas; `.source/` keeps the raw source items the features come from.
14
+
15
+ ```
16
+ {source-name}/ # source folder, inside actual/ or expected/ (above)
17
+ features/
18
+ .catalog/ # the catalog
19
+ README.md # source facts, counts, areas, features without an area
20
+ {feature}.yaml # feature without an area
21
+ {area}/ # area: related features; optional; any depth
22
+ README.md # the area's own link/path, subarea if any, its features
23
+ {feature}.yaml # feature YAML (below)
24
+ {subarea}/ # subarea (optional)
25
+ README.md # the subarea own link/path, name, its features; breadcrumbs
26
+ {feature}.yaml
27
+ {area}/ # NOT written by this skill: feature pages
28
+ {feature}.md # one page per feature YAML: description, behaviors
29
+ .source/ # raw source items (below)
30
+ README.md # every source item, its status and its feature
31
+ {source-item}.md # raw content of one issue, page, etc.
32
+ {area}/ # optional: area, as the source arranges its items
33
+ {source-item}.md
34
+ mismatches/ # NOT written by this skill: mismatches inside this source
35
+ ```
36
+
37
+ Feature pages: the readable side of the catalog. The catalog says which features exist and where they are described; a feature page says what the feature does. They sit in `features/` next to `.catalog/`, in the same areas, one `{feature}.md` per `{feature}.yaml`.
38
+
39
+ ## Formatting
40
+
41
+ Every `.md` should include info about its entity and child entities list (if any). Relative links between pages of the source folder.
42
+
43
+ Source `README.md`: source name, scope, sitemap (links to what exists in the source folder).
44
+
45
+ README.md in catalog root:
46
+
47
+ | Fact | Value |
48
+ | ------- | ----------------------------------------------------------------------------------------------------- |
49
+ | Type | Code, issue tracker, requirements, user docs or any other |
50
+ | Role | Actual or Expected (SKILL.md › Source roles) |
51
+ | Scope | Defined by user (or inferred) |
52
+ | History | Important for sources like issue tracker |
53
+ | Access | MCP, CLI, URL, files |
54
+ | Date | Date of this sync; code: baseline commit and its date; issue tracker: date of creation and resolution |
55
+ | Domain | What the product does and for whom; infer if not given |
56
+
57
+ ## Feature YAML
58
+
59
+ Name: {feature-name}.yaml
60
+
61
+ Feature YAML should include:
62
+
63
+ - Key [optional]. Do not invent. Use only if the source provides one for the feature itself (e.g. its epic).
64
+ - Title: short description of the feature.
65
+ - Status: Expected only (SKILL.md › Status).
66
+ - Links/headings: link(s) to the source items that describe the feature (url, repo path, etc.); headings in case source is a document. Expected: per source item its key, its file in `.source/`, its status; with history: its dates of creation and resolution.
67
+
68
+ No description, requirements or other details.
69
+
70
+ ## Source items
71
+
72
+ Expected only (don't copy source code to the `.source/`).
73
+
74
+ - One file per source item (issue, page, document), named from its key or title: `PAY-112.md`, `saved-cards.md`. Area folders are optional: as the source arranges its items (epic, parent page, nav section).
75
+ - Front matter: what the source gives: key, title, status, updated, url. Issues: Issue item.
76
+ - Body: the item's content as is.
77
+ - `.source/README.md`: one row per source item: the item (key, title, link to its file), its status, its feature (area › title, link to its feature YAML). No feature (task, chore, spike) → `—` and why.
78
+ - `update`: rewrite changed source items, remove the ones gone from scope.
79
+
80
+ ### Issue item
81
+
82
+ Required, when the source has them:
83
+
84
+ - Front matter: key, title, type, status, resolution, created, updated, resolved, url, `parent` (epic or parent issue), `links` (relation, key, title, status), `subtasks` (key, title, status).
85
+ - Body: description, acceptance criteria, every comment with its author and date.
86
+ - Linked issue out of scope → keep the link, don't save the issue.
87
+ - Missing required field → fetch it; no access → open question in the catalog README.
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: detect-product-mismatches
3
+ description: >-
4
+ Compares what different sources say the product does: code (actual behavior), issue tracker, requirements, and user docs (expected behavior), and any other source (test cases, release notes etc.).
5
+ Checks every feature in every source and records mismatches: contradictions and differences, not implemented, unspecified, undocumented.
6
+ Use when the user asks to compare, cross-check, align, validate requirements, specs, wiki, tickets, issues, user docs, or code, codebase against each other, to find mismatches, contradictions, differences, or outdated docs or requirements, or to find what is not implemented, not documented, or not specified.
7
+ metadata:
8
+ author: Testomat.io
9
+ version: 1.0.0
10
+ ---
11
+
12
+ # Detect product mismatches
13
+
14
+ Checks each feature in every source and records where the sources disagree.
15
+
16
+ Output folder: `requirements/mismatches/` (mismatches between sources)
17
+ - `requirements/` is in the repo root, or given by calling skill or the user
18
+ - all paths are relative inside the output folder
19
+
20
+ > `mismatches/` inside a source folder holds mismatches inside that single source: `requirements/actual/{source-name}/mismatches/` is the output of `requirements-from-code` (code vs claims in the repo), `requirements/expected/{source-name}/mismatches/` is the output of `requirements-from-expected` (contradictions inside that source). Don't use them as the output folder and don't use their results.
21
+
22
+ ## Modes
23
+
24
+ `build` (from scratch) or `update` (for changes since the last check).
25
+
26
+ ## Sources
27
+
28
+ Each source has its source folder, by role: `requirements/actual/{source-name}/` or `requirements/expected/{source-name}/`. `actual` and `expected` are strict names: a source folder is never anywhere else. Type, role, scope, and history of each source come from its catalog README in `features/.catalog/` (`catalog-features` › Source roles, Sources).
29
+
30
+ | Source | Role |
31
+ | ------------- | --------------------- |
32
+ | Code | Actual |
33
+ | Requirements | Expected |
34
+ | Issue tracker | Expected |
35
+ | User docs | Expected |
36
+ | Other | As its catalog README |
37
+
38
+ Per feature, what each source says is rewritten as behaviors in one shape ([features.md](references/features.md) › Behaviors), so sources compare line by line:
39
+
40
+ - Two sources say different things about the same behavior → Differs.
41
+ - Another source has a behavior the code lacks → Not implemented. Code is the product: it must do what the other sources say.
42
+ - Several requirements and issue tracker sources: a feature is specified when any of them has it.
43
+ - `History: Yes` (issue tracker by default): the newest issue wins (resolution date, else creation date); older contradicting issues are superseded, not mismatches.
44
+ - Only built issues and current pages state behaviors to compare (`catalog-features` › Status). Unresolved issues and resolved issues that built nothing (Won't Do, Duplicate, etc.) are out of scope: never a behavior, never a mismatch, never a missing feature.
45
+
46
+ **Not a mismatch:**
47
+
48
+ - Same behavior in other words.
49
+ - **Silence on a detail.** A coarser source agrees with a finer one unless it contradicts it (`Customer can save a card.` agrees with `Customer can save up to 5 cards.`).
50
+ - A behavior only the code has, inside a feature the other sources have.
51
+ - Contradictions inside one source: they belong to that source's own `mismatches/`.
52
+ - Superseded issues; behaviors of another version; source items that are not done (open issues, drafts, deprecated pages); content outside a catalog Scope.
53
+ - Can't tell (vague behavior, unreadable content) → open question.
54
+
55
+ ## Likely cause
56
+
57
+ From dates read at the source: issue resolution date (else creation date), page last version, docs "last updated" (else `git log -1 --format=%cs -- {path}`); code: `git log -1 --format=%cs -- {paths}` for the feature's code paths. The same dates decide the newest issue for `History: Yes`.
58
+
59
+ - Code differs from the newest expected behavior (requirements, issues), and nothing newer explains it → Bug.
60
+ - Requirement older than the issue or code change that set the current behavior → Stale requirement.
61
+ - User docs older than that change → Stale docs.
62
+ - Otherwise → Decide (product owner).
63
+
64
+ ## Steps
65
+
66
+ ```
67
+ - [ ] 1. Sources and access
68
+ - [ ] 2. Catalogs: create missing, update stale
69
+ - [ ] 3. Check each feature (one subagent each)
70
+ - [ ] 4. Verify (subagents)
71
+ - [ ] 5. Merge
72
+ - [ ] 6. Validate
73
+ - [ ] 7. Report
74
+ ```
75
+
76
+ Read [references/features.md](references/features.md) and [references/layout.md](references/layout.md) before writing files.
77
+
78
+ ## Rules
79
+
80
+ - **Read-only on sources.** Never edit issues, pages, or code.
81
+ - Source folders (catalogs, `features/`, `.source/`) change only by running their skills.
82
+ - **Report, don't decide.** A mismatch page shows what each source says; its Solution only suggests a fix.
83
+ - Compare behaviors, not wording: different values, conditions, roles, labels, or flows differ.
84
+ - Write only paths, keys, and URLs that exist in the catalogs, the sources, or the repo. Do not invent them.
85
+
86
+ ## 1. Sources and access
87
+
88
+ 1. List the sources to compare: given by the user, else ask; offer the ones already cataloged (source folders in `requirements/actual/` and `requirements/expected/`).
89
+ 2. Check access: one real read per source (MCP tool, `gh`, git, URL, file). The raw source items in a source folder's `.source/` count as access. No access → stop and ask for an MCP connection or an export. A catalog alone is not enough: behaviors are read at the source.
90
+
91
+ ## 2. Catalogs
92
+
93
+ Every listed source needs a catalog in its source folder. Create the missing ones, update the stale ones, before any check:
94
+
95
+ Use `catalog-features` skill to build the catalogs for each source. Use `requirements-from-code` also if **code is the source**.
96
+
97
+ ## 3. Check each feature
98
+
99
+ Features: every feature from catalogs in this order: code, requirements, user docs, issue tracker, other.
100
+
101
+ One subagent per feature, in parallel. Each gets: the feature (its feature YAML), the compared sources (name, type, role, scope, history, access, source folder), the version, the Domain from the catalog READMEs, the source table and rules above, [references/features.md](references/features.md), [references/layout.md](references/layout.md).
102
+
103
+ Subagent:
104
+
105
+ 1. Per source: finds the feature in the catalog, else searches the source ([features.md](references/features.md) › Find).
106
+ 2. Reads every matching feature at its links and states its behaviors ([features.md](references/features.md) › Read, Behaviors).
107
+ 3. Aligns the same behavior across sources.
108
+ 4. Returns one mismatch per disagreement: its kind (Differs or Not implemented) and every section of a mismatch page ([layout.md](references/layout.md) › Page), with code evidence as `path:lines`.
109
+
110
+ Subagent writes nothing. Returns: matched catalog features per source (or `not found` + where searched), mismatches, sources silent on the whole feature, open questions, catalog errors.
111
+
112
+ ## 4. Verify
113
+
114
+ One fresh subagent per batch of mismatches, with the same inputs as step 3. It re-reads each mismatch at its Links and returns it as confirmed, corrected, or dropped (with why). Can't confirm → open question.
115
+
116
+ ## 5. Merge
117
+
118
+ 1. Write the confirmed mismatch pages ([layout.md](references/layout.md) › Page). Same disagreement from several features → one mismatch page, every disagreeing source on it.
119
+ 2. `update`: remove resolved mismatches.
120
+ 3. In the output `README.md`, write the mismatches list ([layout.md](references/layout.md) › README).
121
+ 4. Add a link and purpose for `mismatches/` to the index `requirements/README.md`, when missing.
122
+
123
+ ## 6. Validate
124
+
125
+ ```markdown
126
+ Structure
127
+ - [ ] Every feature of the compared catalogs was checked, or listed as an open question
128
+ - [ ] Mismatches list states compared sources (catalog Date or baseline), version, check date; indexes every page and missing feature
129
+
130
+ Content
131
+ - [ ] Each page has every section of [layout.md](references/layout.md) › Page and one row per compared source; silent sources marked silent with where searched
132
+ - [ ] Difference opens with a one-sentence summary; each bullet is clear alone: sources, condition, what the user gets; the title doesn't say which side is right
133
+ - [ ] Every page was confirmed in Verify; nothing from Not a mismatch is a page
134
+ - [ ] Every behavior on the pages passes the check in [references/features.md](references/features.md)
135
+ - [ ] update: resolved pages removed
136
+ ```
137
+
138
+ ## 7. Report
139
+
140
+ Where to start. Mismatches by highest user impact first. Missing features per source. Catalog errors (→ `catalog-features`; code catalog with `features/` → `requirements-from-code`). Open questions.
141
+
142
+ ## Next actions
143
+
144
+ - Update a catalog → `catalog-features`; feature pages from code → `requirements-from-code`
145
+ - User stories for not-implemented behavior → `write-user-story`
146
+ - Review contradicting requirements → `qa-requirement-reviewer`
147
+ - Test cases for differing behavior → `qa-write-test-cases`
@@ -0,0 +1,84 @@
1
+ # Features
2
+
3
+ A feature is something the product does for its users that they would name: "Pay with saved card", "Export report to CSV". In a catalog, one feature YAML is one feature of its source, with links to the source items (issues, pages, code paths) that describe it. Another source may name it differently or split it differently: e.g. one epic covers three code features, one docs page covers two.
4
+
5
+ A feature is made of behaviors: what someone who uses it (end user, admin, API client, integrated system) can do, see, or get, and when. Sources are compared behavior by behavior, so every source's behaviors are written the same way.
6
+
7
+ Behavior is similar to requirement or acceptance criteria, but those terms describe expected behavior; code gives actual behavior (`catalog-features` › Source roles). "Behavior" fits both roles: what the product does, and what it is expected to do.
8
+
9
+ ## Find
10
+
11
+ Per source:
12
+
13
+ 1. Catalog: key, title, the area it sits in. Links in the feature YAML to other sources help. Expected sources: `.source/README.md` maps every source item to its feature.
14
+ 2. Not in the catalog → search the source, within the catalog's Scope:
15
+
16
+ | Source | Search |
17
+ | ------------- | -------------------------------------------------------------------------------------- |
18
+ | Code | Domain terms, UI labels, messages, routes; start next to related features' code |
19
+ | Issue tracker | Text search inside the catalog's Scope query (JQL `text ~ "term"`, `gh search issues`) |
20
+ | Requirements | Search under the root page or space (CQL `text ~ "term"`); headings of long documents |
21
+ | User docs | Docs site search or nav; `grep` in the docs repo |
22
+ | Other | The source's own search |
23
+
24
+ - Found at the source, missing from the catalog → use it and report a catalog error.
25
+ - Found, but not done (open issue, draft, deprecated page: `catalog-features` › Status) or outside the catalog's Scope (copy, other version) → not a behavior. Mention it on the mismatch page when it explains one.
26
+ - Not found → the source is silent on the feature. Record where you searched.
27
+
28
+ ## Read
29
+
30
+ Read every matching feature at its links (documents: under its headings); Expected sources: its source items in `.source/`, when present. Behaviors come from:
31
+
32
+ | Source | Behaviors from | Not behaviors |
33
+ | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
34
+ | Code | The code at the feature's `code` paths (else its links); Behaviors on its feature page in `features/`, when present, as a start | Claims (comments, docstrings, developer docs, API specs, configs, tests); stubs, routes users cannot reach; internal steps with no visible effect |
35
+ | Issue tracker | Stories and feature issues: acceptance criteria, then the description. Epics: their scope. Bugs: the expected result | A bug's reported actual result; tasks, spikes, chores, tech debt |
36
+ | Requirements | Functional requirements, business rules, acceptance criteria, flows; one behavior per table row and per meaningful matrix cell; exclusions as negative ones | Future phases, nice-to-have, MoSCoW Could and Won't; goals, rationale, personas, metrics, open questions |
37
+ | User docs | Guides, how-tos, limits, notes and warnings; badges (plan, edition, role, platform) as conditions; navigation steps | Screenshots and videos |
38
+ | Test cases | Expected results | Steps, test data |
39
+
40
+ - Code behind a flag or setting that can be turned on → a behavior with that condition (as `requirements-from-code`).
41
+ - Comments and later edits may change the body ("dropped", "moved to PROJ-456", "decided: 3 retries, not 5"): state the final behavior, never the comment.
42
+ - Acceptance criteria may sit in a custom field, a description heading, a checklist, or sub-tasks: find the convention in the first issues.
43
+
44
+ ## Behaviors
45
+
46
+ ### Shape
47
+
48
+ - One behavior per line, one sentence, present tense.
49
+ - No `should`, `shall`, `must`, `will`: state it as a fact. The source's role says whether it is actual or expected.
50
+ - Name who acts or what changes, in domain terms. Never "the system", "it", or "we".
51
+ - Outcome is what the actor can observe (screen, response, file, email, notification), not how the product gets there.
52
+ - Conditions stay in the behavior: role, platform, setting, state.
53
+ - Source key, when the behavior has one, goes first.
54
+ - Negative behaviors count: `Viewer cannot delete a project.`
55
+ - Split on "and" when each part can be checked on its own.
56
+
57
+ ### Values and words
58
+
59
+ - Values as the source states them, with units. No value in the source → none in the behavior. Never round, convert, or fill one in; a vague behavior stays vague (open question).
60
+ - Code: exact values from the code that runs; a value read from config or environment: its default, marked `(configurable)` (as `requirements-from-code`).
61
+ - UI labels and messages verbatim, in quotes; navigation paths with `›`.
62
+ - Domain terms (prefer the user docs' terms), one per concept across sources and `features/`.
63
+ - No class, function, table, file, flag, or library names. Protocol details (endpoints, status codes, fields) only when the API is what users use.
64
+ - Keep the source's level of detail: a coarse behavior stays coarse. Never merge behaviors and drop values or conditions.
65
+ - Restate, never paste. Never people, comments, or customer data.
66
+
67
+ ## Examples
68
+
69
+ | Source says | Behavior |
70
+ | --------------------------------------------------------------------- | ------------------------------------------------------------------- |
71
+ | The system shall allow users to store payment methods (max 5). | `Customer can save up to 5 cards.` |
72
+ | Users can save cards to pay faster. | `Customer can save a card.` (benefit dropped) |
73
+ | AC: if the card is declined, show "Payment failed. Try another card." | `Declined card: Customer sees "Payment failed. Try another card."` |
74
+ | Enterprise customers get SSO; Pro is coming soon. | `Enterprise plan: SSO sign-in is available.` (Pro: future, dropped) |
75
+ | Session times out after a while. | `Session expires after inactivity.` (no value invented) |
76
+ | Bug: saving the same card twice creates a duplicate; expected: one. | `Saving the same card again keeps one saved card.` |
77
+
78
+ ## Check
79
+
80
+ - [ ] Every source either has the feature or records where it was searched
81
+ - [ ] One observable behavior per line, present tense, who or what named
82
+ - [ ] Values, labels, and conditions exactly as in the source; none added
83
+ - [ ] Domain terms, the same term for the same thing
84
+ - [ ] No implementation, plans, rationale, work items, people, or copied text
@@ -0,0 +1,99 @@
1
+ # Mismatches layout
2
+
3
+ Reads source folders: catalogs and `.source/` (layout owned by `catalog-features`), feature pages (code: owned by `requirements-from-code`); changes them only through those skills (SKILL.md › 2. Catalogs). Writes mismatch pages into the output folder only.
4
+
5
+ ```
6
+ requirements/
7
+ README.md # index: every source folder, mismatches
8
+ actual/ # strict name
9
+ {source-name}/ # source folder: code
10
+ features/ # feature pages (requirements-from-code), when present
11
+ .catalog/ # internal: `catalog-features` skill output
12
+ mismatches/ # code vs claims in the repo (requirements-from-code); not used here
13
+ expected/ # strict name
14
+ {source-name}/ # source folder: issue tracker, requirements, user docs, other
15
+ features/ # feature pages, when present
16
+ .catalog/ # internal: `catalog-features` skill output
17
+ .source/ # raw source items; README: every item, its status and its feature
18
+ mismatches/ # contradictions inside this source; not used here
19
+ mismatches/ # output folder: mismatches between sources
20
+ README.md # compared sources, index
21
+ {mismatch}.md # one mismatch per disagreement, every compared source
22
+ ```
23
+
24
+ ## Formatting
25
+
26
+ README: `# Mismatches`, then a breadcrumb to the index, then the body. Mismatch pages: `# Title`, no breadcrumb. Relative links to pages in `requirements/` and to repo paths; source items as key + URL.
27
+
28
+ ## Kinds
29
+
30
+ | Kind | Meaning | Where |
31
+ | ------------------- | ---------------------------------------------------------------------------- | ----------- |
32
+ | Differs | Sources disagree on one behavior: values, conditions, roles, labels, flow | Page |
33
+ | Not implemented | Behavior from another source that the code lacks | Page |
34
+ | Missing in {source} | Feature a source is silent on, within its catalog Scope (SKILL.md › Sources) | README list |
35
+
36
+ ## README
37
+
38
+ Output `README.md` missing → create it: `# Mismatches`, breadcrumb. Write the mismatches list.
39
+
40
+ 1. Compared: one row per source: name, role, scope, history, source folder link, Date (code: baseline commit). Product version. Check date.
41
+ 2. Differs, Not implemented: one list per kind, highest impact first: page link + impact level + sources + likely cause.
42
+ 3. Missing features: one list per silent source (Not implemented, Unspecified, Undocumented, Missing in {source}): feature + where found (catalog feature links) + where searched.
43
+ 4. Open questions: vague behaviors, unread content, or unclear Scope that blocks a comparison.
44
+
45
+ ## Page
46
+
47
+ A reader learns what disagrees from the first lines, without opening the sources.
48
+
49
+ File name: follow existing file name pattern or kebab-case of the title by default.
50
+
51
+ - `# Title`: the behavior in question, as the user meets it.
52
+ - `Feature:` the feature area › title; link to its feature page in a source folder's `features/` (code first), when present.
53
+ - `## Difference`: first a one-sentence summary of how they differ, then one bullet per side, code first when compared; sources that agree grouped on one bullet. Each bullet: the sources (key or name), then their behavior. Write each side so it is clear alone: the condition, then what the user gets. Not implemented: the code bullet says what is missing and where it was searched.
54
+ - `## Impact`: level first: **High** (users blocked, data or money wrong), **Medium** (a workaround exists), **Low** (wording, cosmetic). Then who meets it, when, and what they see or cannot do.
55
+ - `## Likely cause`: SKILL.md › Likely cause, with the dates that decide it.
56
+ - `## Solution`: suggested fix, from the likely cause: Bug → change the code; Stale requirement → update the requirement; Stale docs → update the docs; Decide → the options for the product owner.
57
+ - `## Sources`: evidence, one row per compared source; Code row always, first, when code is compared.
58
+ - Other info required to explain the mismatch.
59
+
60
+ ### Example
61
+
62
+ ```markdown
63
+ # Expired cards at checkout
64
+
65
+ Feature: [Checkout › Pay with saved card](../actual/shop-web/features/checkout/pay-with-saved-card.md)
66
+
67
+ ## Difference
68
+
69
+ The code lists expired saved cards at checkout, greyed out; Confluence says they are not listed.
70
+
71
+ - **Code, PAY-112:** Expired saved cards are listed at checkout, greyed out and not selectable.
72
+ - **Confluence "Saved cards":** Expired saved cards are not listed at checkout.
73
+
74
+ ## Impact
75
+
76
+ Low. A customer with an expired card sees it greyed out at checkout. Support answers based on Confluence say it should not appear.
77
+
78
+ ## Likely cause
79
+
80
+ Stale requirement: PAY-112 (2026-08-28) changed the behavior after the Confluence page (2026-01-10).
81
+
82
+ ## Solution
83
+
84
+ Update the Confluence page "Saved cards": expired saved cards are listed at checkout, greyed out and not selectable.
85
+
86
+ ## Sources
87
+
88
+ | Source | Says | Link | Updated |
89
+ | --------------------- | ------------------------------------------------------- | ------------------------------------------------ | ---------- |
90
+ | Code (actual) | Expired saved cards are listed, greyed out | `src/checkout/cards.ts:48-61` | 2026-08-30 |
91
+ | Jira (expected) | PAY-112: Expired saved cards are listed, not selectable | [PAY-112](https://example.atlassian.net/...) | 2026-08-28 |
92
+ | Confluence (expected) | Expired saved cards are not listed | [Saved cards](https://example.atlassian.net/...) | 2026-01-10 |
93
+ | User docs (expected) | silent | Searched: docs/payments/, site search "expired" | |
94
+ ```
95
+
96
+ - `Says`: the source's behavior, as [features.md](features.md) › Behaviors describes; `silent` when it has none.
97
+ - `Link`: repo file: `path:lines`; issue: key + URL; page: title + URL, with the heading when the page is long; silent: where searched.
98
+ - `Updated`: the date read at the source (SKILL.md › Likely cause).
99
+ - Superseded issues of a source with history: omit, or mark `superseded by {key}` when it explains the mismatch.
@@ -0,0 +1,141 @@
1
+ ---
2
+ name: pull-request-diff-analyzer
3
+ description: Analyze git diff/pull request changes to detect feature implementations and fixes, extract acceptance criteria, and identify related tickets. Use this skill when the user wants to understand what changed in a PR/branch, determine if it's a feature or bug fix, and get acceptance criteria for manual test case generation.
4
+ license: MIT
5
+ metadata:
6
+ author: Testomat.io
7
+ version: 1.0.0
8
+ ---
9
+
10
+ # Pull Request Diff Analyzer
11
+
12
+ Analyze a git diff or PR to detect the change type and extract acceptance criteria for manual testing. **Analysis only** — never modify code.
13
+
14
+ ## Step 1: Detect Branch Context and Scope
15
+
16
+ Get the current branch:
17
+
18
+ ```bash
19
+ git branch --show-current
20
+ ```
21
+
22
+ Detect the base branch, in order:
23
+
24
+ 1. From PR context (preferred). If a PR number is known:
25
+
26
+ ```bash
27
+ gh pr view {PR_NUMBER} --json baseRefName
28
+ ```
29
+
30
+ `baseRefName` in the response is the PR's base branch.
31
+
32
+ - If the base branch cannot be detected, ask the user to specify it.
33
+
34
+ Get changed files:
35
+
36
+ ```bash
37
+ git diff {BASE_BRANCH}...HEAD --name-only
38
+ ```
39
+
40
+ For uncommitted local changes only:
41
+
42
+ ```bash
43
+ git diff --name-only
44
+ ```
45
+
46
+ For a GitHub PR with full diff view:
47
+
48
+ ```bash
49
+ gh pr diff {PR_NUMBER}
50
+ ```
51
+
52
+ **Skip to Step 3 with a short summary only (no acceptance criteria)** if:
53
+ - Current branch is `master`, `main`, `stable`, or the detected default branch in `baseRefName`.
54
+ - No files changed.
55
+ - All changes are non-source-code updates:
56
+ - documentation/requirements (`*.md`, `docs/**`)
57
+ - test updates and test docs (`*.test.md`, `test-flows/**`, `tests/e2e`)
58
+ - CI/CD and infrastructure config (`.github/workflows/**`, `Jenkinsfile`)
59
+ - lint/formatter/tooling configs
60
+ - dependency version bumps without behavior changes
61
+ - No application/source code behavior changed.
62
+
63
+ **Proceed to Step 2** if source code changed (`src/**`, `lib/**`, `app/**`, or root `.ts`/`.js`/`.tsx`/`.jsx`/`.java`/`.py`/`.go`/`.rb`/`.php`/`.cs`/`.kt`/`.swift`/`.rs`, etc).
64
+
65
+ ## Step 2: Analyze PR Context and Files
66
+
67
+ Get PR details:
68
+
69
+ ```bash
70
+ gh pr view {PR_NUMBER} --json title,body,comments,reviews,issues
71
+ ```
72
+
73
+ Extract testing-relevant info:
74
+ - Title — feature/fix name, affected component.
75
+ - Description — criteria, test scenarios.
76
+ - Comments — test notes, edge cases, reproductions.
77
+
78
+ Analyze **source code files only**:
79
+ - Directories: `src/**`, `lib/**`, `app/**`, `controllers/**`, `services/**`, `models/**`, `pages/**`, `components/**`, `handlers/**`, `modules/**`, etc.
80
+ - Extensions: `.ts`, `.js`, `.tsx`, `.jsx`, `.java`, `.py`, `.go`, `.rb`, `.php`, `.cs`, `.kt`, `.swift`, `.rs`
81
+ - Skip configs, dependencies, tests, docs, migrations, and other files not related to source code.
82
+
83
+ Detect PR type:
84
+ - Feature — new files, endpoints, components, modules.
85
+ - Fix — bug fixes, patches, hotfixes (check commits for "fix", "bug", "hotfix").
86
+ - Refactor — code restructure without behavior change.
87
+
88
+ ### Optional: scan-automation-project
89
+
90
+ **Do not run `scan-automation-project` by default.** Run it only when extra project context adds clear value before writing acceptance criteria.
91
+
92
+ Run it if:
93
+ - The PR introduces new functionality or a significant feature change.
94
+ - You need to check whether similar manual tests already exist.
95
+ - The user explicitly asks ("check for duplicates", "what tests already exist", or similar).
96
+
97
+ Skip it if:
98
+ - The PR is a small fix or minor UI/component update.
99
+ - The diff already gives enough context to write ACs confidently.
100
+ - Changes are limited to docs, requirements, tests, configs, or non-source-code updates.
101
+ - The project does not appear to contain manual tests.
102
+ - Existing test inventory is not relevant for the requested task.
103
+
104
+ If it is unavailable:
105
+ - Continue without checking existing tests.
106
+ - Add this note to the AC output: `Manual test inventory not checked — verify existing tests manually if needed.`
107
+
108
+ Use scan results only to:
109
+ - Avoid duplicating existing manual test cases.
110
+ - Understand project structure, frameworks, and test organization.
111
+ - Improve relevance and consistency of generated acceptance criteria.
112
+
113
+ ## Step 3: Summary with Acceptance Criteria
114
+
115
+ Output format:
116
+
117
+ ```md
118
+ ## PR Diff Summary
119
+
120
+ **PR Type:** ... (feature | fix | refactor)
121
+ **Branch:** ... (branch name, e.g. feature/user-auth)
122
+ **Changes:** ... (one sentence describing the overall purpose of this PR)
123
+ **Affected Files:**
124
+ - ... (bullet list of all affected files in this PR)
125
+
126
+ **Impacted Areas:**
127
+ - ... (1-3 bullets, only real impacted files/areas in the PR)
128
+
129
+ **Acceptance Criteria:**
130
+ - action to perform → expected result
131
+ - ...
132
+ ```
133
+
134
+ Summary rules:
135
+ - Keep the summary concise and high-level.
136
+ - "Changes" is ONE sentence. Not a paragraph.
137
+ - "Impacted Areas" lists only meaningful business or technical impact.
138
+ - Omit empty sections instead of writing `None` or `N/A`.
139
+ - **Acceptance criteria MUST be testable and user-oriented.**
140
+ - Avoid generic statements like "code cleanup", "minor fixes", or "various improvements".
141
+ - Do NOT describe implementation details line-by-line.