@rashidee/co2 1.2.5

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 (190) hide show
  1. package/dist/index.js +25449 -0
  2. package/drizzle/0000_remarkable_charles_xavier.sql +210 -0
  3. package/drizzle/0001_wise_wolf_cub.sql +13 -0
  4. package/drizzle/0002_secret_spyke.sql +16 -0
  5. package/drizzle/0003_workspace_config_singleton.sql +16 -0
  6. package/drizzle/0004_terminal_claim_v120.sql +11 -0
  7. package/drizzle/0005_brainstorm_v124.sql +10 -0
  8. package/drizzle/0006_project_v140.sql +6 -0
  9. package/drizzle/0007_prd_wizard_v124.sql +14 -0
  10. package/drizzle/0008_workflow_artifact_v126.sql +24 -0
  11. package/drizzle/0009_project_import_v150.sql +7 -0
  12. package/drizzle/0010_quality_v151.sql +3 -0
  13. package/drizzle/meta/0000_snapshot.json +1335 -0
  14. package/drizzle/meta/0001_snapshot.json +1416 -0
  15. package/drizzle/meta/0002_snapshot.json +1510 -0
  16. package/drizzle/meta/_journal.json +83 -0
  17. package/package.json +41 -0
  18. package/plugin/.claude-plugin/marketplace.json +36 -0
  19. package/plugin/.claude-plugin/plugin.json +22 -0
  20. package/plugin/README.md +625 -0
  21. package/plugin/SKILLS.md +350 -0
  22. package/plugin/co2.svg +5 -0
  23. package/plugin/commands/brainstorm-loop.md +129 -0
  24. package/plugin/skills/conductor-defect/SKILL.md +898 -0
  25. package/plugin/skills/conductor-feature-develop/SKILL.md +1383 -0
  26. package/plugin/skills/conductor-feature-develop/references/implementation-domain-template.md +131 -0
  27. package/plugin/skills/conductor-feature-develop/references/implementation-master-template.md +89 -0
  28. package/plugin/skills/conductor-feature-develop/references/playwright-setup.md +224 -0
  29. package/plugin/skills/conductor-feature-prepare/SKILL.md +604 -0
  30. package/plugin/skills/depgen-k8s/SKILL.md +468 -0
  31. package/plugin/skills/depgen-k8s/references/dockerfile-laravel.md +197 -0
  32. package/plugin/skills/depgen-k8s/references/dockerfile-nodejs.md +163 -0
  33. package/plugin/skills/depgen-k8s/references/dockerfile-spring-boot.md +174 -0
  34. package/plugin/skills/depgen-k8s/references/k8s-patterns.md +869 -0
  35. package/plugin/skills/mockgen-shadcn/SKILL.md +1067 -0
  36. package/plugin/skills/mockgen-shadcn/references/admin-layout-template.md +1467 -0
  37. package/plugin/skills/mockgen-shadcn/references/mockup-hub-template.md +498 -0
  38. package/plugin/skills/mockgen-shadcn/references/mockup-index-template.md +216 -0
  39. package/plugin/skills/mockgen-tailwind/SKILL.md +904 -0
  40. package/plugin/skills/mockgen-tailwind/references/admin-layout-template.md +720 -0
  41. package/plugin/skills/mockgen-tailwind/references/mockup-hub-template.md +498 -0
  42. package/plugin/skills/mockgen-tailwind/references/mockup-index-template.md +190 -0
  43. package/plugin/skills/modelgen-nosql/SKILL.md +617 -0
  44. package/plugin/skills/modelgen-nosql/references/model-extraction-methodology.md +497 -0
  45. package/plugin/skills/modelgen-nosql/references/nosql-design-guide.md +258 -0
  46. package/plugin/skills/modelgen-relational/SKILL.md +707 -0
  47. package/plugin/skills/modelgen-relational/references/model-extraction-methodology.md +499 -0
  48. package/plugin/skills/specgen-flutter-riverpod/SKILL.md +898 -0
  49. package/plugin/skills/specgen-flutter-riverpod/references/component-patterns.md +971 -0
  50. package/plugin/skills/specgen-flutter-riverpod/references/notification-patterns.md +457 -0
  51. package/plugin/skills/specgen-flutter-riverpod/references/routing-patterns.md +362 -0
  52. package/plugin/skills/specgen-flutter-riverpod/references/security-patterns.md +709 -0
  53. package/plugin/skills/specgen-flutter-riverpod/references/spec-template.md +1566 -0
  54. package/plugin/skills/specgen-flutter-riverpod/references/state-patterns.md +518 -0
  55. package/plugin/skills/specgen-flutter-riverpod/references/storage-patterns.md +370 -0
  56. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/SKILL.md +984 -0
  57. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/batch-patterns.md +359 -0
  58. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/messaging-patterns.md +468 -0
  59. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/modulith-patterns.md +461 -0
  60. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/reporting-patterns.md +803 -0
  61. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/security-patterns.md +501 -0
  62. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/spec-template.md +1268 -0
  63. package/plugin/skills/specgen-laravel-eloquent-bladehtmx/references/web-patterns.md +301 -0
  64. package/plugin/skills/specgen-node-cli-web/SKILL.md +561 -0
  65. package/plugin/skills/specgen-node-cli-web/references/auth-patterns.md +293 -0
  66. package/plugin/skills/specgen-node-cli-web/references/cli-packaging-patterns.md +250 -0
  67. package/plugin/skills/specgen-node-cli-web/references/server-patterns.md +247 -0
  68. package/plugin/skills/specgen-node-cli-web/references/spec-template.md +401 -0
  69. package/plugin/skills/specgen-node-cli-web/references/testing-patterns.md +174 -0
  70. package/plugin/skills/specgen-react-mui/SKILL.md +789 -0
  71. package/plugin/skills/specgen-react-mui/references/component-patterns.md +1077 -0
  72. package/plugin/skills/specgen-react-mui/references/reporting-patterns.md +1998 -0
  73. package/plugin/skills/specgen-react-mui/references/routing-patterns.md +461 -0
  74. package/plugin/skills/specgen-react-mui/references/security-patterns.md +599 -0
  75. package/plugin/skills/specgen-react-mui/references/spec-template.md +1030 -0
  76. package/plugin/skills/specgen-react-mui/references/state-patterns.md +327 -0
  77. package/plugin/skills/specgen-react-tailwind/SKILL.md +859 -0
  78. package/plugin/skills/specgen-react-tailwind/references/component-patterns.md +1212 -0
  79. package/plugin/skills/specgen-react-tailwind/references/reporting-patterns.md +1529 -0
  80. package/plugin/skills/specgen-react-tailwind/references/routing-patterns.md +669 -0
  81. package/plugin/skills/specgen-react-tailwind/references/security-patterns.md +656 -0
  82. package/plugin/skills/specgen-react-tailwind/references/spec-template.md +1237 -0
  83. package/plugin/skills/specgen-react-tailwind/references/state-patterns.md +327 -0
  84. package/plugin/skills/specgen-sdk-java/SKILL.md +933 -0
  85. package/plugin/skills/specgen-sdk-java/references/api-extraction-patterns.md +247 -0
  86. package/plugin/skills/specgen-sdk-java/references/http-client-patterns.md +495 -0
  87. package/plugin/skills/specgen-sdk-java/references/packaging-patterns.md +366 -0
  88. package/plugin/skills/specgen-sdk-java/references/spec-template.md +956 -0
  89. package/plugin/skills/specgen-spring-jpa-jtehtmx/SKILL.md +1284 -0
  90. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/batch-patterns.md +1224 -0
  91. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/jasper-patterns.md +1638 -0
  92. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/messaging-patterns.md +512 -0
  93. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/modulith-patterns.md +354 -0
  94. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/security-patterns.md +551 -0
  95. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/spec-template.md +2502 -0
  96. package/plugin/skills/specgen-spring-jpa-jtehtmx/references/web-patterns.md +503 -0
  97. package/plugin/skills/specgen-spring-jpa-restapi/SKILL.md +990 -0
  98. package/plugin/skills/specgen-spring-jpa-restapi/references/batch-patterns.md +1224 -0
  99. package/plugin/skills/specgen-spring-jpa-restapi/references/messaging-patterns.md +512 -0
  100. package/plugin/skills/specgen-spring-jpa-restapi/references/modulith-patterns.md +279 -0
  101. package/plugin/skills/specgen-spring-jpa-restapi/references/reporting-patterns.md +1536 -0
  102. package/plugin/skills/specgen-spring-jpa-restapi/references/restapi-patterns.md +722 -0
  103. package/plugin/skills/specgen-spring-jpa-restapi/references/security-patterns.md +351 -0
  104. package/plugin/skills/specgen-spring-jpa-restapi/references/spec-template.md +553 -0
  105. package/plugin/skills/specgen-ts-cli/SKILL.md +861 -0
  106. package/plugin/skills/specgen-ts-cli/references/async-patterns.md +1101 -0
  107. package/plugin/skills/specgen-ts-cli/references/command-patterns.md +383 -0
  108. package/plugin/skills/specgen-ts-cli/references/config-patterns.md +430 -0
  109. package/plugin/skills/specgen-ts-cli/references/database-patterns.md +750 -0
  110. package/plugin/skills/specgen-ts-cli/references/packaging-patterns.md +426 -0
  111. package/plugin/skills/specgen-ts-cli/references/spec-template.md +1391 -0
  112. package/plugin/skills/specgen-ts-cli/references/testing-patterns.md +909 -0
  113. package/plugin/skills/testgen-functional/SKILL.md +1381 -0
  114. package/plugin/skills/tracegen-matrix/SKILL.md +243 -0
  115. package/plugin/skills/util-preparek8senv/SKILL.md +422 -0
  116. package/plugin/skills/util-projectinit/SKILL.md +307 -0
  117. package/plugin/skills/util-projectinit/reference/brainstorm-loop.md +129 -0
  118. package/plugin/skills/util-projectinit/reference/brainstorm-protocol.md +144 -0
  119. package/plugin/skills/util-projectinit/reference/brainstorm-setup-guide.md +153 -0
  120. package/plugin/skills/util-projectinit/reference/brainstorm-template-appdev.md +87 -0
  121. package/plugin/skills/util-projectinit/reference/co2-context-generation-guide.md +761 -0
  122. package/plugin/skills/util-projectsync/SKILL.md +501 -0
  123. package/plugin/skills/util-updprd/SKILL.md +324 -0
  124. package/plugin/skills/util-usanalyzer/SKILL.md +307 -0
  125. package/plugin/skills/util-ustagger/SKILL.md +154 -0
  126. package/static/assets/abnfDiagram-VRR7QNED-DvPuwyCV.js +1 -0
  127. package/static/assets/arc-DRKw7sjs.js +1 -0
  128. package/static/assets/architectureDiagram-ZJ3FMSHR-CaNcxUbC.js +36 -0
  129. package/static/assets/blockDiagram-677ZJIJ3-Demd4AOK.js +132 -0
  130. package/static/assets/c4Diagram-LMCZKHZV-PVKUfc2x.js +10 -0
  131. package/static/assets/channel-C2nVbuwv.js +1 -0
  132. package/static/assets/chunk-2Q5K7J3B-CExf8ww_.js +1 -0
  133. package/static/assets/chunk-32BRIVSS-CFPaoONF.js +1 -0
  134. package/static/assets/chunk-5VM5RSS4-DE2esM67.js +15 -0
  135. package/static/assets/chunk-EX3LRPZG-SON_YdDG.js +231 -0
  136. package/static/assets/chunk-JWPE2WC7-Qxah8LNr.js +1 -0
  137. package/static/assets/chunk-MOJQB5TN-BcWGQV3j.js +88 -0
  138. package/static/assets/chunk-RYQCIY6F-DkDj-OR5.js +1 -0
  139. package/static/assets/chunk-V7JOEXUC-BlI1Mrah.js +206 -0
  140. package/static/assets/chunk-VR4S4FIN-Agf__duj.js +1 -0
  141. package/static/assets/chunk-XXDRQBXY-B5CfAh85.js +1 -0
  142. package/static/assets/classDiagram-OUVF2IWQ-DXJIljsR.js +1 -0
  143. package/static/assets/classDiagram-v2-EOCWNBFH-DXJIljsR.js +1 -0
  144. package/static/assets/cose-bilkent-JH36ORCC-DO0cQkcy.js +1 -0
  145. package/static/assets/cynefin-VYW2F7L2-CfOnsnXc.js +178 -0
  146. package/static/assets/cynefinDiagram-TSTJHNR4-BJ8tULAv.js +62 -0
  147. package/static/assets/cytoscape.esm-DTSO7Bv0.js +331 -0
  148. package/static/assets/dagre-VKFMJZFB-DfjwzHqP.js +4 -0
  149. package/static/assets/defaultLocale-DX6XiGOO.js +1 -0
  150. package/static/assets/diagram-FQU43EPY-CndSOIIM.js +3 -0
  151. package/static/assets/diagram-G47NLZAW-Czf5hN0Z.js +24 -0
  152. package/static/assets/diagram-NH7WQ7WH-COAyojGh.js +24 -0
  153. package/static/assets/diagram-OA4YK3LP-H8PoiN2m.js +30 -0
  154. package/static/assets/diagram-WEI45ONY-DzcaVzjp.js +41 -0
  155. package/static/assets/ebnfDiagram-CCIWWBDH-DPazGYLJ.js +1 -0
  156. package/static/assets/erDiagram-Q63AITRT-Bo-fubgF.js +85 -0
  157. package/static/assets/flowDiagram-23GEKE2U-CSvxUDwh.js +156 -0
  158. package/static/assets/ganttDiagram-NO4QXBWP-DnBveWX6.js +292 -0
  159. package/static/assets/gitGraphDiagram-IHSO6WYX-B3rVL8c-.js +106 -0
  160. package/static/assets/graph-C9eacEi8.js +1 -0
  161. package/static/assets/index-LZSQkLE2.css +41 -0
  162. package/static/assets/index-y7XDSgMG.js +495 -0
  163. package/static/assets/infoDiagram-FWYZ7A6U-CvWV9yy2.js +2 -0
  164. package/static/assets/init-Gi6I4Gst.js +1 -0
  165. package/static/assets/ishikawaDiagram-FXEZZL3T-DF28a1N6.js +70 -0
  166. package/static/assets/journeyDiagram-5HDEW3XC-CB6CugYk.js +139 -0
  167. package/static/assets/kanban-definition-HUTT4EX6-ResSLF6d.js +89 -0
  168. package/static/assets/katex-C5jXJg4s.js +257 -0
  169. package/static/assets/layout-DEXfKzaS.js +1 -0
  170. package/static/assets/linear-CLO--ryk.js +1 -0
  171. package/static/assets/map-Czzmt4hB.js +1 -0
  172. package/static/assets/mindmap-definition-LN4V7U3C-BvW3EbxX.js +96 -0
  173. package/static/assets/ordinal-Cboi1Yqb.js +1 -0
  174. package/static/assets/pegDiagram-2B236MQR-BHCgqrrM.js +1 -0
  175. package/static/assets/pieDiagram-ENE6RG2P-DVmCQ5FA.js +39 -0
  176. package/static/assets/quadrantDiagram-ABIIQ3AL-B3e5KR52.js +7 -0
  177. package/static/assets/railroadDiagram-RFXS5EU6-Csv5ysLc.js +1 -0
  178. package/static/assets/requirementDiagram-TGXJPOKE-DOMVzvnB.js +84 -0
  179. package/static/assets/sankeyDiagram-HTMAVEWB-B1dcTOvy.js +40 -0
  180. package/static/assets/sequenceDiagram-DBY2YBRQ-BY414yeO.js +162 -0
  181. package/static/assets/sizeCapture-X5ZJPWSS-CuJfrfBN.js +1 -0
  182. package/static/assets/stateDiagram-2N3HPSRC-FX4rJkzV.js +1 -0
  183. package/static/assets/stateDiagram-v2-6OUMAXLB-BVufbO_H.js +1 -0
  184. package/static/assets/swimlanes-5IMT3BWC-Sfy58mmv.js +2 -0
  185. package/static/assets/swimlanesDiagram-G3AALYLV-wDCDw08H.js +8 -0
  186. package/static/assets/timeline-definition-FHXFAJF6-CmV7by8p.js +120 -0
  187. package/static/assets/vennDiagram-L72KCM5P-FqIyFZFt.js +34 -0
  188. package/static/assets/wardleyDiagram-EHGQE667-BZ06O45i.js +78 -0
  189. package/static/assets/xychartDiagram-FW5EYKEG-BOkffR06.js +7 -0
  190. package/static/index.html +24 -0
@@ -0,0 +1,247 @@
1
+ # API Surface Extraction — Swagger UI / OpenAPI
2
+
3
+ This reference describes how the skill extracts the upstream API surface from
4
+ `PRD.md` and turns it into the SDK's public method list, model classes, and URL
5
+ constants.
6
+
7
+ The extraction is a **multi-step search**: the skill must look for the Swagger UI
8
+ URL or OpenAPI document FIRST, fall back to inline endpoint tables in the PRD if
9
+ not found, and only then resort to user-stories-only inference (with a `[TODO]`).
10
+
11
+ ---
12
+
13
+ ## Step 1: Scan PRD.md for Swagger / OpenAPI Pointers
14
+
15
+ In priority order, search the entire `PRD.md` for:
16
+
17
+ 1. URLs ending in:
18
+ - `/swagger-ui.html`
19
+ - `/swagger-ui/index.html`
20
+ - `/swagger-ui/`
21
+ - `/swagger`
22
+ - `/api-docs`
23
+ - `/v3/api-docs` (Springdoc default)
24
+ - `/openapi.json`
25
+ - `/openapi.yaml`
26
+ - `/swagger.json`
27
+ - `/swagger.yaml`
28
+
29
+ 2. Section headings:
30
+ - `## Swagger UI`
31
+ - `## OpenAPI Spec`
32
+ - `## OpenAPI`
33
+ - `## API Reference`
34
+ - `## API Documentation`
35
+ - `## API Surface`
36
+
37
+ 3. Phrases inside `# Architecture Principle` such as:
38
+ - "Swagger UI at <url>"
39
+ - "OpenAPI spec is published at <url>"
40
+ - "API documentation: <url>"
41
+
42
+ 4. Relative paths to local files:
43
+ - `openapi.yaml`, `openapi.json`, `swagger.yaml`, `swagger.json`
44
+ - Often inside `<app_folder>/context/api/` or `<app_folder>/context/openapi/`
45
+
46
+ Record the FIRST match found (PRD authoring order is meaningful — the most prominent
47
+ pointer wins).
48
+
49
+ ### Resolution Rules
50
+
51
+ | Found | `apiSource.kind` | `apiSource.value` |
52
+ |--------------------------------------|--------------------------|-------------------------------------------------------------|
53
+ | `https://api.example.com/swagger-ui.html` | `swagger-ui-url` | the URL |
54
+ | `https://api.example.com/v3/api-docs` | `openapi-url` | the URL |
55
+ | `<app_folder>/context/api/openapi.yaml` | `openapi-path` | the absolute path |
56
+ | Endpoint table in PRD with `Method | Path | Description` | `inline-table` | the table content |
57
+ | Nothing relevant | `none` | n/a — emit `[TODO]` and use user stories |
58
+
59
+ ---
60
+
61
+ ## Step 2: Convert Swagger UI URL to OpenAPI URL
62
+
63
+ Swagger UI is a viewer; the underlying OpenAPI document is what the skill needs. For
64
+ each known framework, derive the spec URL from the Swagger UI URL:
65
+
66
+ | Swagger UI URL pattern | OpenAPI URL pattern |
67
+ |-------------------------------------------------------|----------------------------------------------------|
68
+ | `<host>/swagger-ui.html` | `<host>/v3/api-docs` (Springdoc) or `<host>/swagger.json` (Swashbuckle/.NET) |
69
+ | `<host>/swagger-ui/index.html` | `<host>/v3/api-docs` |
70
+ | `<host>/swagger` | `<host>/swagger/v1/swagger.json` (.NET) |
71
+ | `<host>/swagger/index.html` | `<host>/swagger/v1/swagger.json` |
72
+ | `<host>/api-docs` | `<host>/v3/api-docs` |
73
+
74
+ If the underlying URL is reachable from the host running the skill (it usually is for
75
+ Springdoc on `localhost`), fetch it and parse it with a YAML/JSON parser. Otherwise,
76
+ emit a `[TODO]` reminding the team to provide the spec URL or commit `openapi.yaml`
77
+ into the application's context folder.
78
+
79
+ ---
80
+
81
+ ## Step 3: Parse the OpenAPI Spec
82
+
83
+ The skill needs to extract:
84
+
85
+ 1. **`info.title`** → confirms the API name (cross-check against CLAUDE.md)
86
+ 2. **`servers[0].url`** → default base URL for `Config`
87
+ 3. **`securitySchemes`** → drives the Auth determination
88
+ 4. **`paths`** → one operation per HTTP method per path. For each operation:
89
+ - `operationId` → method name on the service (camelCase)
90
+ - `tags[0]` → which module the operation belongs to (matches PRD module headings
91
+ or MODEL.md folders)
92
+ - `parameters` → query / path / header inputs of the SDK method
93
+ - `requestBody.content["application/json"].schema` → request DTO
94
+ - `responses["2xx"].content["application/json"].schema` → response DTO
95
+ - `responses` for 4xx/5xx → error mapping table in the module SPEC.md
96
+ 5. **`components.schemas`** → one immutable model class per schema. Resolve `$ref`s
97
+ into typed Java references. Inline schemas become anonymous inner types ONLY if
98
+ they are simple; otherwise, lift them to a named schema.
99
+
100
+ ### Mapping OpenAPI → Java
101
+
102
+ | OpenAPI | Java type (JDK 8 baseline) |
103
+ |--------------------------------------|----------------------------------------------------|
104
+ | `string` | `String` |
105
+ | `string` + `format: date` | `LocalDate` |
106
+ | `string` + `format: date-time` | `Instant` |
107
+ | `string` + `format: uuid` | `String` (avoid `UUID` to keep wire-format simple) |
108
+ | `string` + `enum` | dedicated `enum` with `wireValue()` mapper |
109
+ | `integer` (`int32`) | `Integer` / `int` (nullable vs not) |
110
+ | `integer` (`int64`) | `Long` / `long` |
111
+ | `number` (`double`) | `Double` / `double` |
112
+ | `boolean` | `Boolean` / `bool` |
113
+ | `array` | `List<T>` (always `Collections.unmodifiableList`) |
114
+ | `object` | dedicated DTO class |
115
+ | `oneOf` / `anyOf` | tagged-union class with explicit subtype methods |
116
+ | `additionalProperties: true` | `Map<String, Object>` |
117
+
118
+ > **Nullability note.** OpenAPI represents nullability via the absence of a property
119
+ > from `required`, not via `nullable: true`. The SDK distinguishes nullable fields by
120
+ > using boxed types (`Integer`) for nullable; primitives (`int`) for required.
121
+
122
+ ---
123
+
124
+ ## Step 4: Cross-Reference With PRD User Stories
125
+
126
+ Once the OpenAPI operations are extracted, MATCH each user story to one operation:
127
+
128
+ 1. The user story's verb hints the HTTP method (`view`, `list` → GET; `create`,
129
+ `submit` → POST; `update` → PUT/PATCH; `delete` → DELETE)
130
+ 2. The user story's noun hints the path resource (`order` → `/orders`)
131
+ 3. The user story's `[USSDKxxxxx]` tag is recorded next to the matched operation in
132
+ the module SPEC.md's "OpenAPI Operation Mapping" table
133
+
134
+ **If a user story has no matching operation:**
135
+ - Emit a `[TODO]` in the module SPEC.md: `[TODO] USSDK00xxx has no matching
136
+ OpenAPI operation. Add the operation to the upstream API or remove the story.`
137
+
138
+ **If an operation has no matching user story:**
139
+ - Still generate the SDK method (downstream consumers may need it) but flag it in
140
+ the module SPEC.md "Operations Without User Story Coverage" subsection.
141
+
142
+ ---
143
+
144
+ ## Step 5: Module Inference from `tags`
145
+
146
+ OpenAPI operations are grouped by the first entry in `tags`. The skill maps:
147
+
148
+ ```
149
+ operation.tags[0] ↔ PRD module name (case-insensitive, kebab/snake/title equivalent)
150
+ ```
151
+
152
+ If `tags` is missing on an operation, infer the module from the URL's first path
153
+ segment (e.g., `/orders/{id}` → `Orders` module). Document this fallback in the
154
+ SPECIFICATION.md "Module Inference" subsection.
155
+
156
+ ---
157
+
158
+ ## Step 6: Default Base URL
159
+
160
+ The default base URL on `{{ClientName}}.Builder` defaults to `servers[0].url`:
161
+
162
+ - If the URL contains template variables (e.g., `{environment}`), substitute the
163
+ defaults documented in `servers[0].variables`.
164
+ - If the URL is relative (`/api/v1`), prefix with the host portion of the Swagger UI
165
+ URL.
166
+ - If `servers` is absent or empty, fall back to `https://api.example.com` and emit a
167
+ `[TODO]` reminding the team to set the real base URL.
168
+
169
+ ---
170
+
171
+ ## Step 7: Security Scheme → Auth Determination
172
+
173
+ | OpenAPI `securitySchemes` entry | SDK Auth |
174
+ |----------------------------------------------------------|---------------------------|
175
+ | `type: http, scheme: bearer` | Bearer token |
176
+ | `type: apiKey, in: header, name: X-API-Key` | API key (header) |
177
+ | `type: apiKey, in: query, name: api_key` | API key (query) |
178
+ | `type: http, scheme: basic` | HTTP Basic |
179
+ | `type: oauth2, flows: clientCredentials` | Bearer token (with refresh — caller supplies the token; SDK does not implement OAuth2 client credentials flow itself) |
180
+ | `type: openIdConnect` | Bearer token (caller supplies) |
181
+ | Empty `security: []` on every operation | None |
182
+ | `mutualTLS` mention in description | mTLS |
183
+
184
+ If multiple schemes are defined, the SDK supports ALL of them via a configurable
185
+ `AuthInterceptor` chain — the consumer picks one in the Builder.
186
+
187
+ ---
188
+
189
+ ## Step 8: Generate Per-Module Operation Mapping Table
190
+
191
+ For each module, the SPEC.md must contain a table like:
192
+
193
+ ```markdown
194
+ | User Story | OpenAPI Op ID | Method | Path | Request | Response |
195
+ |------------|---------------|--------|------------------|---------|----------|
196
+ | USSDK00012 | listOrders | GET | /orders | (query) | OrdersPage |
197
+ | USSDK00013 | getOrderById | GET | /orders/{id} | — | Order |
198
+ | USSDK00014 | createOrder | POST | /orders | OrderCreateRequest | Order |
199
+ ```
200
+
201
+ This table is the **single source of truth** for the module — every service method,
202
+ URL constant, request DTO, and response DTO traces back to one row.
203
+
204
+ ---
205
+
206
+ ## Fallback: No Spec, No Tables (User Stories Only)
207
+
208
+ If neither an OpenAPI spec nor an inline endpoint table is found in PRD.md:
209
+
210
+ 1. Emit at the top of `SPECIFICATION.md`:
211
+
212
+ ```markdown
213
+ > **[TODO]** No Swagger UI URL or OpenAPI spec was found in PRD.md.
214
+ > The SDK API surface below is inferred from user stories alone and may drift
215
+ > from the real API. Provide an OpenAPI document at
216
+ > `<app_folder>/context/api/openapi.yaml` (or a Swagger UI URL in PRD.md) and
217
+ > re-run the skill to refresh paths, schemas, and operation IDs.
218
+ ```
219
+
220
+ 2. For every user story, infer:
221
+ - HTTP method (verb-based, see Step 4)
222
+ - Path (`/<plural-resource>` for list, `/<plural-resource>/{id}` for single)
223
+ - DTO names from MODEL.md (if present) or from the story noun
224
+
225
+ 3. Each per-module SPEC.md gets `[TODO]` markers next to each method declaring "path
226
+ inferred — verify against real API".
227
+
228
+ This path is the LAST RESORT. The SDK is only useful if it talks to a real API; the
229
+ generated spec must make that gap loud and impossible to miss.
230
+
231
+ ---
232
+
233
+ ## Persisting the Source Decision
234
+
235
+ The `SPECIFICATION.md` "Project Overview" → "API Surface Source" subsection MUST
236
+ record:
237
+
238
+ | Field | Value |
239
+ |-------------------|----------------------------------------------------------------|
240
+ | `apiSource.kind` | one of: `swagger-ui-url`, `openapi-url`, `openapi-path`, `inline-table`, `none` |
241
+ | `apiSource.value` | the URL, path, or `n/a` |
242
+ | `apiSource.fetchedAt` | ISO-8601 timestamp if fetched |
243
+ | `apiSource.operationCount` | number of operations parsed (or `unknown`) |
244
+ | `apiSource.schemaCount` | number of schemas parsed (or `unknown`) |
245
+
246
+ This metadata makes it trivial to detect drift on the next regeneration and to
247
+ diagnose stale specs.