@workos/oagen 0.6.0 → 0.8.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.
- package/dist/cli/index.mjs +1339 -451
- package/dist/cli/index.mjs.map +1 -1
- package/dist/compat/index.d.mts +144 -57
- package/dist/compat/index.d.mts.map +1 -1
- package/dist/compat/index.mjs +365 -35
- package/dist/compat/index.mjs.map +1 -1
- package/dist/{diff-CltJMcwG.mjs → diff-BaH9qa8k.mjs} +100 -23
- package/dist/diff-BaH9qa8k.mjs.map +1 -0
- package/dist/differ-CTl98yoS.d.mts +116 -0
- package/dist/differ-CTl98yoS.d.mts.map +1 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +177 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{differ-CG5ZErKl.mjs → overlay-TYxHOCow.mjs} +1112 -553
- package/dist/overlay-TYxHOCow.mjs.map +1 -0
- package/dist/scripts/smoke/baseline.mjs +176 -3
- package/dist/scripts/smoke/baseline.mjs.map +1 -1
- package/dist/smoke.d.mts +43 -0
- package/dist/smoke.d.mts.map +1 -1
- package/dist/smoke.mjs +176 -3
- package/dist/smoke.mjs.map +1 -1
- package/dist/tree-sitter-C53w_0WE.mjs.map +1 -1
- package/dist/{types-C7g5sLuX.d.mts → types-mTtkgy_h.d.mts} +213 -2
- package/dist/types-mTtkgy_h.d.mts.map +1 -0
- package/dist/verify/index.d.mts +4 -3
- package/dist/verify/index.d.mts.map +1 -1
- package/dist/verify/index.mjs +12 -10
- package/dist/verify/index.mjs.map +1 -1
- package/docs/architecture/emitter-contract.md +2 -2
- package/docs/architecture/extractor-contract.md +6 -5
- package/docs/architecture/pipeline.md +4 -3
- package/docs/architecture/workflows.md +5 -3
- package/docs/cli.md +148 -6
- package/docs/contributor/public-api.md +1 -1
- package/docs/core/compatibility-ir.md +200 -0
- package/docs/core/compatibility-policy.md +170 -0
- package/docs/core/compatibility.md +83 -0
- package/docs/core/index.md +5 -0
- package/docs/core/manifest-schema.md +76 -0
- package/docs/core/quickstart.md +9 -2
- package/docs/core/verify-compat.md +235 -0
- package/package.json +1 -1
- package/skills/generate-emitter/SKILL.md +12 -7
- package/skills/generate-emitter/references/project-scaffold.md +27 -6
- package/skills/generate-extractor/SKILL.md +14 -8
- package/skills/generate-sdk/SKILL.md +2 -2
- package/skills/generate-smoke-test/SKILL.md +9 -5
- package/skills/review-operations/SKILL.md +2 -2
- package/skills/verify-compat/SKILL.md +1 -1
- package/dist/diff-CltJMcwG.mjs.map +0 -1
- package/dist/differ-CG5ZErKl.mjs.map +0 -1
- package/dist/types-C7g5sLuX.d.mts.map +0 -1
|
@@ -12,7 +12,8 @@ When `{project}/package.json` does **NOT** exist, create the following boilerpla
|
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
14
|
"exports": {
|
|
15
|
-
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" }
|
|
15
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
16
|
+
"./plugin": { "types": "./dist/plugin.d.ts", "import": "./dist/plugin.js" }
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "tsup",
|
|
@@ -76,7 +77,7 @@ export default defineConfig({
|
|
|
76
77
|
```ts
|
|
77
78
|
import { defineConfig } from "tsup";
|
|
78
79
|
export default defineConfig({
|
|
79
|
-
entry: { index: "src/index.ts" },
|
|
80
|
+
entry: { index: "src/index.ts", plugin: "src/plugin.ts" },
|
|
80
81
|
format: ["esm"],
|
|
81
82
|
dts: true,
|
|
82
83
|
clean: true,
|
|
@@ -86,21 +87,41 @@ export default defineConfig({
|
|
|
86
87
|
|
|
87
88
|
## `oagen.config.ts`
|
|
88
89
|
|
|
90
|
+
Minimal config for local emitter development. The canonical consumer config lives in the consumer project.
|
|
91
|
+
|
|
89
92
|
```ts
|
|
90
93
|
import type { OagenConfig } from "@workos/oagen";
|
|
91
|
-
|
|
94
|
+
import { plugin } from "./src/plugin.js";
|
|
95
|
+
const config: OagenConfig = { ...plugin };
|
|
92
96
|
export default config;
|
|
93
97
|
```
|
|
94
98
|
|
|
95
|
-
|
|
99
|
+
## `src/plugin.ts`
|
|
100
|
+
|
|
101
|
+
Plugin bundle export. The consumer project imports this to get all emitters, extractors, and smoke runners.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import type { OagenConfig } from "@workos/oagen";
|
|
105
|
+
export const plugin: Pick<
|
|
106
|
+
OagenConfig,
|
|
107
|
+
"emitters" | "extractors" | "smokeRunners"
|
|
108
|
+
> = {
|
|
109
|
+
emitters: [],
|
|
110
|
+
extractors: [],
|
|
111
|
+
smokeRunners: {},
|
|
112
|
+
};
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
(Step 7 of the main skill adds the emitter to this plugin bundle.)
|
|
96
116
|
|
|
97
117
|
## `src/index.ts`
|
|
98
118
|
|
|
99
119
|
```ts
|
|
100
|
-
// Barrel export — re-exports all emitters
|
|
120
|
+
// Barrel export — re-exports all emitters and the plugin bundle
|
|
121
|
+
export { plugin } from "./plugin.js";
|
|
101
122
|
```
|
|
102
123
|
|
|
103
|
-
(Step
|
|
124
|
+
(Step 7 adds the emitter re-export.)
|
|
104
125
|
|
|
105
126
|
## `.gitignore`
|
|
106
127
|
|
|
@@ -13,7 +13,7 @@ Scaffold a language extractor for oagen's compat verification system. An extract
|
|
|
13
13
|
Live SDK → Extractor → ApiSurface JSON → Differ ← Generated SDK → Violations
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Each language needs its own extractor because public surface detection is language-specific (e.g., TypeScript exports vs. Ruby public methods vs. Python `__all__` vs. Go capitalized identifiers). An extractor implements the `Extractor` interface and is
|
|
16
|
+
Each language needs its own extractor because public surface detection is language-specific (e.g., TypeScript exports vs. Ruby public methods vs. Python `__all__` vs. Go capitalized identifiers). An extractor implements the `Extractor` interface and is exported through the emitter project's plugin bundle (e.g., `workosEmittersPlugin`), which the consumer project's `oagen.config.ts` imports.
|
|
17
17
|
|
|
18
18
|
## Reference Docs
|
|
19
19
|
|
|
@@ -115,16 +115,22 @@ export const {language}Extractor: Extractor = {
|
|
|
115
115
|
|
|
116
116
|
## Step 3: Register the Extractor
|
|
117
117
|
|
|
118
|
-
Add to `
|
|
118
|
+
Add the extractor to the plugin bundle export (e.g., `src/plugin.ts`) and re-export from `src/index.ts`:
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
extractors: [{language}Extractor],
|
|
121
|
+
// src/plugin.ts
|
|
122
|
+
import { {language}Extractor } from './compat/extractors/{language}.js';
|
|
123
|
+
export const workosEmittersPlugin = {
|
|
124
|
+
extractors: [/* existing, */ {language}Extractor],
|
|
125
|
+
// ...
|
|
125
126
|
};
|
|
127
|
+
|
|
128
|
+
// src/index.ts
|
|
129
|
+
export { {language}Extractor } from './compat/extractors/{language}.js';
|
|
126
130
|
```
|
|
127
131
|
|
|
132
|
+
The consumer project's `oagen.config.ts` imports the plugin bundle, so the new extractor is automatically available.
|
|
133
|
+
|
|
128
134
|
## Step 4: Create a Fixture SDK
|
|
129
135
|
|
|
130
136
|
Create a minimal but representative fixture at `test/fixtures/sample-sdk-{language}/` **in the emitter project**. It must include:
|
|
@@ -175,7 +181,7 @@ If `sdk_path` was provided, also test against the real SDK and verify all public
|
|
|
175
181
|
```
|
|
176
182
|
=== Extractor: {language} ===
|
|
177
183
|
Files created: src/compat/extractors/{language}.ts, test suite, fixture SDK
|
|
178
|
-
Modified:
|
|
184
|
+
Modified: src/plugin.ts, src/index.ts
|
|
179
185
|
Validation: Tests / Fixture extract / Determinism / Real SDK extract
|
|
180
186
|
ApiSurface: {N} classes, {N} interfaces, {N} type aliases, {N} enums, {N} exports
|
|
181
187
|
```
|
|
@@ -187,7 +193,7 @@ This skill produces, in the emitter project:
|
|
|
187
193
|
- `src/compat/extractors/{language}.ts` — extractor implementing the `Extractor` interface with `LanguageHints`
|
|
188
194
|
- `test/compat/extractors/{language}.test.ts` — extraction tests against fixture SDK
|
|
189
195
|
- `test/fixtures/sample-sdk-{language}/` — minimal fixture SDK for testing
|
|
190
|
-
- Updated `
|
|
196
|
+
- Updated plugin bundle (`src/plugin.ts`) and `src/index.ts` with the new extractor registered
|
|
191
197
|
|
|
192
198
|
## Common Pitfalls
|
|
193
199
|
|
|
@@ -91,7 +91,7 @@ ls {project}/src/{language}/index.ts
|
|
|
91
91
|
cd {project} && npx vitest run test/{language}/ 2>&1 | tail -5
|
|
92
92
|
|
|
93
93
|
# After /generate-extractor — extractor registered with hints
|
|
94
|
-
grep -l "{language}Extractor\|{language}_extractor" {project}/
|
|
94
|
+
grep -l "{language}Extractor\|{language}_extractor" {project}/src/plugin.ts {project}/src/index.ts
|
|
95
95
|
grep -l "hints" {project}/src/compat/extractors/{language}.ts
|
|
96
96
|
|
|
97
97
|
# After /verify-compat — handled by the skill itself
|
|
@@ -148,7 +148,7 @@ Only include this next section in the output if this is Scenario A:
|
|
|
148
148
|
|
|
149
149
|
This skill produces, via its sub-skills:
|
|
150
150
|
|
|
151
|
-
- A complete language emitter registered in `
|
|
151
|
+
- A complete language emitter registered in the plugin bundle (`src/plugin.ts`)
|
|
152
152
|
- An API surface extractor (Scenario A only)
|
|
153
153
|
- A smoke test script at `smoke/sdk-{language}.ts`
|
|
154
154
|
- Generated SDK code at `{project}/sdk/`
|
|
@@ -136,17 +136,21 @@ Create the script **in the emitter project**:
|
|
|
136
136
|
|
|
137
137
|
## Step 6: Register the Smoke Runner
|
|
138
138
|
|
|
139
|
-
Add to `
|
|
139
|
+
Add the smoke runner path to the plugin bundle export (e.g., `src/plugin.ts`):
|
|
140
140
|
|
|
141
141
|
```typescript
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
// src/plugin.ts
|
|
143
|
+
export const workosEmittersPlugin = {
|
|
144
144
|
smokeRunners: {
|
|
145
|
-
|
|
145
|
+
// existing runners...
|
|
146
|
+
{language}: path.join(smokeDir, 'sdk-{language}.ts'),
|
|
146
147
|
},
|
|
148
|
+
// ...
|
|
147
149
|
};
|
|
148
150
|
```
|
|
149
151
|
|
|
152
|
+
The consumer project's `oagen.config.ts` imports the plugin bundle, so the new smoke runner is automatically available.
|
|
153
|
+
|
|
150
154
|
## Step 7: Validate
|
|
151
155
|
|
|
152
156
|
```bash
|
|
@@ -182,4 +186,4 @@ See `scripts/smoke/README.md` (in oagen core) for the full remediation guide. Se
|
|
|
182
186
|
This skill produces, in the emitter project:
|
|
183
187
|
|
|
184
188
|
- `smoke/sdk-{language}.ts` — self-contained smoke test script
|
|
185
|
-
- Updated `
|
|
189
|
+
- Updated plugin bundle (`src/plugin.ts`) with the smoke runner path registered
|
|
@@ -19,7 +19,7 @@ Accept `--spec <path>` as an optional argument. If not provided, fall back to th
|
|
|
19
19
|
## Step 1: Resolve Paths
|
|
20
20
|
|
|
21
21
|
1. **Spec path**: from argument, `OPENAPI_SPEC_PATH` env, or `../openapi-spec/spec/open-api-spec.yaml`
|
|
22
|
-
2. **
|
|
22
|
+
2. **Consumer config project**: check if `oagen.config.ts` exists in the current directory. If not, try `../openapi-spec/oagen.config.ts`. If neither exists, use `AskUserQuestion`: "Where is your consumer config project (the project with `oagen.config.ts`)?"
|
|
23
23
|
3. Validate the spec file exists before proceeding.
|
|
24
24
|
|
|
25
25
|
## Step 2: Run Resolution
|
|
@@ -80,4 +80,4 @@ Print a summary:
|
|
|
80
80
|
- Algorithm-derived (no action needed)
|
|
81
81
|
- Needs review (may need hints)
|
|
82
82
|
|
|
83
|
-
If there are operations needing review, ask the user: "Would you like me to add hints for any of these operations to `oagen.config.ts`?"
|
|
83
|
+
If there are operations needing review, ask the user: "Would you like me to add hints for any of these operations to the consumer project's `oagen.config.ts`?"
|
|
@@ -44,7 +44,7 @@ All artifacts (surface files, generated output) live **inside the emitter projec
|
|
|
44
44
|
|
|
45
45
|
Determine required paths:
|
|
46
46
|
|
|
47
|
-
1. **Emitter project** (`project`): from argument, or detect from CWD (look for `oagen.config.ts`), or use `AskUserQuestion`
|
|
47
|
+
1. **Emitter project** (`project`): from argument, or detect from CWD (look for `src/plugin.ts` or `oagen.config.ts`), or use `AskUserQuestion`
|
|
48
48
|
2. **Spec** (`spec`): from argument, or use `AskUserQuestion`
|
|
49
49
|
3. **Live SDK** (`sdk_path`): from argument, or use `AskUserQuestion`
|
|
50
50
|
4. **API surface file**: `{project}/sdk-{language}-surface.json` — always in the emitter project root
|