@workos/oagen 0.0.1

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 (64) hide show
  1. package/.claude-plugin/plugin.json +12 -0
  2. package/LICENSE.txt +21 -0
  3. package/README.md +197 -0
  4. package/dist/chunk-CIX5NOBF.js +263 -0
  5. package/dist/chunk-IJ5E5AE7.js +1040 -0
  6. package/dist/chunk-P5XUDUGY.js +1748 -0
  7. package/dist/cli/index.js +5603 -0
  8. package/dist/compat/index.d.ts +195 -0
  9. package/dist/compat/index.js +4453 -0
  10. package/dist/index.d.ts +300 -0
  11. package/dist/index.js +1733 -0
  12. package/dist/scripts/smoke/baseline.js +1751 -0
  13. package/dist/scripts/smoke/sdk-test.js +93 -0
  14. package/dist/smoke.js +1963 -0
  15. package/dist/types-B5t9O9Wm.d.ts +367 -0
  16. package/dist/verify/index.d.ts +76 -0
  17. package/dist/verify/index.js +336 -0
  18. package/docs/advanced/index.md +11 -0
  19. package/docs/advanced/oagen-ignore.md +144 -0
  20. package/docs/agents/architecture.md +53 -0
  21. package/docs/agents/emitters.md +69 -0
  22. package/docs/agents/testing.md +60 -0
  23. package/docs/architecture/dependency-layers.md +75 -0
  24. package/docs/architecture/emitter-contract.md +160 -0
  25. package/docs/architecture/extractor-contract.md +227 -0
  26. package/docs/architecture/ir-types.md +275 -0
  27. package/docs/architecture/non-additive-changes.md +76 -0
  28. package/docs/architecture/pipeline.md +110 -0
  29. package/docs/architecture/workflows.md +215 -0
  30. package/docs/cli.md +156 -0
  31. package/docs/contributor/index.md +10 -0
  32. package/docs/contributor/public-api.md +59 -0
  33. package/docs/contributor/versioning.md +48 -0
  34. package/docs/core/index.md +12 -0
  35. package/docs/core/minimal-emitter.md +134 -0
  36. package/docs/core/quickstart.md +142 -0
  37. package/docs/diagrams/generate-sdk-workflow.md +50 -0
  38. package/docs/index.md +40 -0
  39. package/examples/reference-emitter/README.md +41 -0
  40. package/examples/reference-emitter/oagen.config.ts +7 -0
  41. package/examples/reference-emitter/spec/github-subset.yml +400 -0
  42. package/examples/reference-emitter/src/emitter.ts +52 -0
  43. package/examples/reference-emitter/src/generators/client.ts +37 -0
  44. package/examples/reference-emitter/src/generators/config.ts +19 -0
  45. package/examples/reference-emitter/src/generators/enums.ts +16 -0
  46. package/examples/reference-emitter/src/generators/errors.ts +39 -0
  47. package/examples/reference-emitter/src/generators/models.ts +29 -0
  48. package/examples/reference-emitter/src/generators/resources.ts +60 -0
  49. package/examples/reference-emitter/src/generators/tests.ts +7 -0
  50. package/examples/reference-emitter/src/index.ts +1 -0
  51. package/examples/reference-emitter/src/naming.ts +21 -0
  52. package/examples/reference-emitter/src/type-mapper.ts +39 -0
  53. package/examples/reference-emitter/tsconfig.json +19 -0
  54. package/package.json +102 -0
  55. package/skills/generate-emitter/SKILL.md +393 -0
  56. package/skills/generate-emitter/references/common-pitfalls.md +23 -0
  57. package/skills/generate-emitter/references/generator-guide.md +201 -0
  58. package/skills/generate-emitter/references/project-scaffold.md +138 -0
  59. package/skills/generate-extractor/SKILL.md +200 -0
  60. package/skills/generate-sdk/SKILL.md +155 -0
  61. package/skills/generate-smoke-test/SKILL.md +185 -0
  62. package/skills/integrate/SKILL.md +108 -0
  63. package/skills/verify-compat/SKILL.md +151 -0
  64. package/skills/verify-smoke-test/SKILL.md +176 -0
@@ -0,0 +1,176 @@
1
+ ---
2
+ name: verify-smoke-test
3
+ description: Run the generate-verify loop to iteratively fix an emitter until smoke tests pass. Use after smoke tests are created, when verify reports findings or compile errors, when you need to fix emitter output, or when debugging smoke test failures. Also triggers for "emitter-fixing loop", "generate-verify loop", "fix smoke test failures", "emitter not passing", or "iterate on emitter".
4
+ ---
5
+
6
+ # /verify-smoke-test
7
+
8
+ ## Purpose
9
+
10
+ Run `oagen generate` → `oagen verify` in a loop, diagnosing and fixing the emitter (or smoke script) after each iteration until verify exits 0.
11
+
12
+ This is the final phase of `/generate-sdk` setup — after the emitter, extractor, compat overlay, and smoke tests are all scaffolded, this loop gets the emitter actually producing correct output.
13
+
14
+ ## Inputs
15
+
16
+ - **language** — target language (e.g., `node`, `ruby`, `python`)
17
+ - **spec** — path to the OpenAPI spec
18
+ - **output** — path to the generated SDK output directory
19
+ - **project** — path to the emitter project
20
+ - **namespace** — SDK namespace/package name
21
+ - **sdk_path** _(optional, Scenario A)_ — path to the live SDK for target integration
22
+ - **api-surface** _(optional, Scenario A)_ — path to `sdk-{language}-surface.json`
23
+
24
+ ## Reference Docs
25
+
26
+ - [Workflows](../../docs/architecture/workflows.md) — emitter-fixing loop and final validation
27
+ - [Emitter Contract](../../docs/architecture/emitter-contract.md) — generator methods and `GeneratedFile` shape
28
+ - [Testing & Smoke Validation](../../docs/agents/testing.md) — smoke testing guide and exit codes
29
+
30
+ ## When to Use
31
+
32
+ - After `/generate-smoke-test` completes and you need to iterate the emitter to passing
33
+ - When `oagen verify` exits 1 (findings) or 2 (compile errors) and you want to fix and retry
34
+ - During any generate → verify cycle where the emitter needs corrections
35
+ - When resuming a previous session that left off mid-loop (the findings file is the handoff state)
36
+
37
+ ## Resolve Paths
38
+
39
+ Collect these values. Use arguments if provided, otherwise ask:
40
+
41
+ 1. **`language`** — target language (e.g., `node`, `ruby`, `python`)
42
+ 2. **`spec`** — path to the OpenAPI spec (e.g., `../openapi.yaml`)
43
+ 3. **`output`** — path to the generated SDK output directory
44
+ 4. **`project`** — path to the emitter project (often the parent of `output`)
45
+ 5. **`namespace`** — SDK namespace/package name (e.g., `WorkOS`)
46
+
47
+ Optional (Scenario A only):
48
+
49
+ - **`sdk_path`** — path to the live SDK for target integration
50
+ - **`api-surface`** — path to `sdk-{language}-surface.json` for compat overlay
51
+
52
+ Check if a previous findings file exists — this indicates a prior loop iteration:
53
+
54
+ ```bash
55
+ ls {output}/smoke-diff-findings.json {output}/smoke-compile-errors.json 2>/dev/null
56
+ ```
57
+
58
+ If findings exist, read them to understand the starting state before running the first iteration.
59
+
60
+ ## The Loop
61
+
62
+ ### Step 1: Generate
63
+
64
+ ```bash
65
+ oagen generate --spec {spec} --lang {language} --output {output} --namespace {namespace}
66
+ ```
67
+
68
+ If Scenario A (compat overlay + live SDK integration), include:
69
+
70
+ ```bash
71
+ oagen generate --spec {spec} --lang {language} --output {output} --namespace {namespace} --api-surface {api-surface} --target {sdk_path}
72
+ ```
73
+
74
+ ### Step 2: Verify
75
+
76
+ ```bash
77
+ oagen verify --spec {spec} --lang {language} --output {output}
78
+ ```
79
+
80
+ If Scenario A, include:
81
+
82
+ ```bash
83
+ oagen verify --spec {spec} --lang {language} --output {output} --api-surface {api-surface}
84
+ ```
85
+
86
+ ### Step 3: Interpret Exit Code
87
+
88
+ | Exit | Meaning | Output file | Next action |
89
+ | ---- | ------------- | --------------------------- | ----------------- |
90
+ | 0 | Clean | — | Done — go to Exit |
91
+ | 1 | Findings | `smoke-diff-findings.json` | Go to Step 4 |
92
+ | 2 | Compile error | `smoke-compile-errors.json` | Go to Step 5 |
93
+
94
+ ### Step 4: Fix Findings (exit 1)
95
+
96
+ Read `{output}/smoke-diff-findings.json`. It contains:
97
+
98
+ - `criticalFindings` — CRITICAL-severity mismatches (blocking)
99
+ - `warningFindings` — WARNING-severity mismatches (review)
100
+ - `infoFindings` — INFO-severity observations (non-blocking)
101
+ - `missingFromSdk` — operations the SDK didn't attempt
102
+ - `missingFromRaw` — operations missing from baseline (non-blocking)
103
+ - `coverage` — summary stats
104
+
105
+ Focus on CRITICAL findings first. Use the remediation table to locate the fix:
106
+
107
+ | Finding | Fix location |
108
+ | -------------------------------- | ------------------------------------------------------ |
109
+ | "HTTP method differs" | Emitter's `resources.ts` — method generation |
110
+ | "Request path structure differs" | Emitter's `resources.ts` — path interpolation |
111
+ | "Query parameters differ" | Emitter's `resources.ts` — query param serialization |
112
+ | "Request body key sets differ" | Emitter's `models.ts` or `resources.ts` — serializers |
113
+ | "Skipped in SDK" | Smoke runner `smoke/sdk-{lang}.ts` — method resolution |
114
+ | "Missing from SDK" | Smoke runner `smoke/sdk-{lang}.ts` — method mapping |
115
+
116
+ After fixing, go back to Step 1.
117
+
118
+ ### Step 5: Fix Compile Errors (exit 2)
119
+
120
+ Read `{output}/smoke-compile-errors.json`. These are TypeScript type errors in the generated SDK. Common causes:
121
+
122
+ - Missing imports or wrong import paths → fix in emitter's file generators
123
+ - Type mismatches → fix in emitter's `type-map.ts` or model generators
124
+ - Missing properties → fix in emitter's `models.ts`
125
+
126
+ After fixing, go back to Step 1.
127
+
128
+ ## Stall Detection
129
+
130
+ Track the count of CRITICAL findings between iterations. If the count doesn't decrease after three consecutive iterations, stop and report:
131
+
132
+ ```
133
+ Stall detected: {N} CRITICAL findings remain after {iteration} iterations.
134
+ Remaining findings:
135
+ - {finding summary}
136
+ - ...
137
+
138
+ These may require a structural emitter change rather than a targeted fix.
139
+ ```
140
+
141
+ Present the remaining findings to the user and ask how to proceed.
142
+
143
+ ## Exit
144
+
145
+ When verify exits 0:
146
+
147
+ ```bash
148
+ # Run the full validation suite
149
+ cd {project} && npx vitest run test/{language}/
150
+ npx tsc --noEmit
151
+ ```
152
+
153
+ Report the result:
154
+
155
+ ```
156
+ === verify-smoke-test: COMPLETE ===
157
+
158
+ Iterations: {N}
159
+ Final verify: exit 0 (clean)
160
+ Unit tests: {pass/fail}
161
+ Type check: {pass/fail}
162
+ ```
163
+
164
+ ## Cross-Session Handoff
165
+
166
+ The findings file (`smoke-diff-findings.json` or `smoke-compile-errors.json`) is the primary handoff state. If resuming from a previous session:
167
+
168
+ 1. Read the existing findings file
169
+ 2. Skip straight to the fix step (Step 4 or 5)
170
+ 3. After fixing, resume the loop from Step 1
171
+
172
+ ## Output
173
+
174
+ - Clean verify exit (exit 0) with all smoke tests passing
175
+ - Unit tests and type check passing in the emitter project
176
+ - Iteration summary showing number of rounds and fixes applied