ts-procedures 6.0.2 → 6.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.
- package/agent_config/bin/setup.mjs +0 -0
- package/agent_config/claude-code/skills/ts-procedures/SKILL.md +1 -0
- package/agent_config/claude-code/skills/ts-procedures/api-reference.md +2 -0
- package/agent_config/claude-code/skills/ts-procedures-kotlin/SKILL.md +106 -0
- package/agent_config/copilot/copilot-instructions.md +2 -0
- package/agent_config/cursor/cursorrules +2 -0
- package/build/codegen/bin/cli.d.ts +25 -0
- package/build/codegen/bin/cli.js +88 -0
- package/build/codegen/bin/cli.js.map +1 -1
- package/build/codegen/bin/cli.test.js +180 -1
- package/build/codegen/bin/cli.test.js.map +1 -1
- package/build/codegen/index.d.ts +19 -0
- package/build/codegen/index.js +5 -0
- package/build/codegen/index.js.map +1 -1
- package/build/codegen/pipeline.d.ts +7 -0
- package/build/codegen/pipeline.js +57 -0
- package/build/codegen/pipeline.js.map +1 -1
- package/build/codegen/pipeline.test.js +162 -0
- package/build/codegen/pipeline.test.js.map +1 -1
- package/build/codegen/targets/kotlin/ajsc-adapter.d.ts +6 -4
- package/build/codegen/targets/kotlin/ajsc-adapter.js +12 -7
- package/build/codegen/targets/kotlin/ajsc-adapter.js.map +1 -1
- package/build/codegen/targets/kotlin/ajsc-adapter.test.js +20 -2
- package/build/codegen/targets/kotlin/ajsc-adapter.test.js.map +1 -1
- package/build/codegen/targets/kotlin/e2e-compile.test.js +41 -9
- package/build/codegen/targets/kotlin/e2e-compile.test.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-route-kotlin.d.ts +6 -2
- package/build/codegen/targets/kotlin/emit-route-kotlin.js +18 -11
- package/build/codegen/targets/kotlin/emit-route-kotlin.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-route-kotlin.test.js +120 -1
- package/build/codegen/targets/kotlin/emit-route-kotlin.test.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-scope-kotlin.d.ts +4 -1
- package/build/codegen/targets/kotlin/emit-scope-kotlin.js +9 -4
- package/build/codegen/targets/kotlin/emit-scope-kotlin.js.map +1 -1
- package/build/codegen/targets/kotlin/emit-scope-kotlin.test.js +39 -0
- package/build/codegen/targets/kotlin/emit-scope-kotlin.test.js.map +1 -1
- package/build/codegen/targets/kotlin/format-kotlin.d.ts +11 -0
- package/build/codegen/targets/kotlin/format-kotlin.js +20 -0
- package/build/codegen/targets/kotlin/format-kotlin.js.map +1 -1
- package/build/codegen/targets/kotlin/format-kotlin.test.js +27 -1
- package/build/codegen/targets/kotlin/format-kotlin.test.js.map +1 -1
- package/build/codegen/targets/kotlin/integration.test.js +26 -9
- package/build/codegen/targets/kotlin/integration.test.js.map +1 -1
- package/build/codegen/targets/kotlin/probe-unsupported-unions.test.d.ts +1 -0
- package/build/codegen/targets/kotlin/probe-unsupported-unions.test.js +50 -0
- package/build/codegen/targets/kotlin/probe-unsupported-unions.test.js.map +1 -0
- package/build/codegen/test-helpers/golden.d.ts +15 -0
- package/build/codegen/test-helpers/golden.js +30 -0
- package/build/codegen/test-helpers/golden.js.map +1 -0
- package/build/codegen/test-helpers/golden.test.d.ts +1 -0
- package/build/codegen/test-helpers/golden.test.js +76 -0
- package/build/codegen/test-helpers/golden.test.js.map +1 -0
- package/docs/codegen-kotlin.md +175 -0
- package/docs/superpowers/plans/2026-04-25-ajsc-v7-kotlin-polish.md +1993 -0
- package/docs/superpowers/specs/2026-04-25-ajsc-v7-kotlin-polish-design.md +314 -0
- package/package.json +2 -2
- package/src/codegen/bin/cli.test.ts +200 -1
- package/src/codegen/bin/cli.ts +103 -0
- package/src/codegen/index.ts +27 -0
- package/src/codegen/pipeline.test.ts +175 -0
- package/src/codegen/pipeline.ts +79 -0
- package/src/codegen/targets/kotlin/__fixtures__/users-envelope.json +144 -0
- package/src/codegen/targets/kotlin/__fixtures__/users-golden.kt +121 -0
- package/src/codegen/targets/kotlin/__snapshots__/probe-unsupported-unions.test.ts.snap +27 -0
- package/src/codegen/targets/kotlin/ajsc-adapter.test.ts +47 -0
- package/src/codegen/targets/kotlin/ajsc-adapter.ts +66 -0
- package/src/codegen/targets/kotlin/e2e-compile.test.ts +86 -0
- package/src/codegen/targets/kotlin/emit-route-kotlin.test.ts +239 -0
- package/src/codegen/targets/kotlin/emit-route-kotlin.ts +109 -0
- package/src/codegen/targets/kotlin/emit-scope-kotlin.test.ts +112 -0
- package/src/codegen/targets/kotlin/emit-scope-kotlin.ts +65 -0
- package/src/codegen/targets/kotlin/format-kotlin.test.ts +70 -0
- package/src/codegen/targets/kotlin/format-kotlin.ts +45 -0
- package/src/codegen/targets/kotlin/integration.test.ts +77 -0
- package/src/codegen/targets/kotlin/probe-unsupported-unions.test.ts +64 -0
- package/src/codegen/test-helpers/golden.test.ts +80 -0
- package/src/codegen/test-helpers/golden.ts +34 -0
|
File without changes
|
|
@@ -15,6 +15,7 @@ Load the right reference for your task:
|
|
|
15
15
|
- **Writing new procedures or HTTP routes?** Read [patterns.md](patterns.md) — prescribed code examples for every procedure type and HTTP integration
|
|
16
16
|
- **Reviewing or debugging existing code?** Read [anti-patterns.md](anti-patterns.md) — 20 common mistakes with before/after fixes and severity ratings
|
|
17
17
|
- **Need exact API signatures or type definitions?** Read [api-reference.md](api-reference.md) — complete API documentation with type signatures for every export
|
|
18
|
+
- **Generating a Kotlin client for Android/JVM consumers?** Use the separate `ts-procedures-kotlin` skill — it covers `--target kotlin` end-to-end and won't load unless the user mentions Kotlin/Android.
|
|
18
19
|
|
|
19
20
|
## Core Flow
|
|
20
21
|
|
|
@@ -1013,6 +1013,8 @@ const adapter = createFetchAdapter({ fetch: customFetch })
|
|
|
1013
1013
|
|
|
1014
1014
|
## generateClient(options)
|
|
1015
1015
|
|
|
1016
|
+
> For **Kotlin** client codegen (Android/JVM, types-only output), see the dedicated `ts-procedures-kotlin` skill. The reference below covers TypeScript codegen only.
|
|
1017
|
+
|
|
1016
1018
|
Build-time CLI and programmatic API for generating typed client files from a `DocEnvelope`.
|
|
1017
1019
|
|
|
1018
1020
|
```typescript
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ts-procedures-kotlin
|
|
3
|
+
description: "Kotlin client codegen for ts-procedures — generate types-only Kotlin source from a ts-procedures DocEnvelope for Android/JVM consumers. Use when the user mentions Kotlin, Android, mobile clients, kotlinx-serialization, or asks how to generate non-TypeScript types from a ts-procedures server."
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ts-procedures — Kotlin Client Codegen
|
|
8
|
+
|
|
9
|
+
You are assisting a developer who needs to generate Kotlin types from a `ts-procedures` server's `DocEnvelope`. The Kotlin target is **types-only** — no runtime, no adapter, no error registry. Mobile/Android consumers own the HTTP layer.
|
|
10
|
+
|
|
11
|
+
## When this skill applies
|
|
12
|
+
|
|
13
|
+
- The user mentions Kotlin, Android, kotlinx-serialization, mobile client, or `--target kotlin`.
|
|
14
|
+
- The user wants to share API types between a `ts-procedures` server and a Kotlin/JVM consumer.
|
|
15
|
+
- The user is debugging Kotlin codegen output, Gradle setup, or contextual serializer registration.
|
|
16
|
+
|
|
17
|
+
If the user is generating a **TypeScript** client, redirect them to the main `ts-procedures` skill instead.
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx ts-procedures-codegen \
|
|
23
|
+
--target kotlin \
|
|
24
|
+
--kotlin-package com.example.api \
|
|
25
|
+
--url https://api.example.com/_ts-procedures.json \
|
|
26
|
+
--out ./src/main/kotlin/com/example/api
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
One `.kt` file per scope. Types accessed as `Users.GetUser.Response`, `Users.GetUser.Body.Address` (nested classes via `inlineTypes: true`), `Users.GetUser.Errors.NotFound`.
|
|
30
|
+
|
|
31
|
+
## CLI flags (Kotlin-specific)
|
|
32
|
+
|
|
33
|
+
| Flag | Default | Purpose |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| `--target kotlin` | `ts` | Switch to the Kotlin codegen path |
|
|
36
|
+
| `--kotlin-package <com.example.api>` | required | Sets the `package` declaration on every emitted `.kt` file |
|
|
37
|
+
| `--kotlin-serializer <kotlinx\|none>` | `kotlinx` | `kotlinx` emits `@Serializable`; `none` emits plain data classes for Moshi/Gson/hand-written serialization |
|
|
38
|
+
| `--unsupported-unions <throw\|fallback>` | `throw` | **Currently a no-op for Kotlin** — ajsc v7.2 silently emits an empty `data class` for untagged `oneOf` regardless. CLI warns when set |
|
|
39
|
+
|
|
40
|
+
`--array-item-naming`, `--depluralize`, `--uncountable-words` also apply to the Kotlin target.
|
|
41
|
+
|
|
42
|
+
## Output shape (what consumers see)
|
|
43
|
+
|
|
44
|
+
```kotlin
|
|
45
|
+
package com.example.api
|
|
46
|
+
|
|
47
|
+
import kotlinx.serialization.Serializable
|
|
48
|
+
import kotlinx.serialization.SerialName
|
|
49
|
+
import kotlinx.serialization.Contextual
|
|
50
|
+
import kotlinx.serialization.json.JsonClassDiscriminator
|
|
51
|
+
|
|
52
|
+
object Users {
|
|
53
|
+
object GetUser {
|
|
54
|
+
const val method = "GET"
|
|
55
|
+
const val pathTemplate = "/users/{id}"
|
|
56
|
+
fun path(p: PathParams): String = "/users/${p.id}"
|
|
57
|
+
|
|
58
|
+
@Serializable data class PathParams(val id: String)
|
|
59
|
+
|
|
60
|
+
@Serializable
|
|
61
|
+
data class Response(
|
|
62
|
+
val id: String,
|
|
63
|
+
@SerialName("created-at") @Contextual val createdAt: java.time.Instant,
|
|
64
|
+
val address: Address,
|
|
65
|
+
) {
|
|
66
|
+
@Serializable data class Address(val street: String, val city: String)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
object Errors {
|
|
70
|
+
@Serializable
|
|
71
|
+
data class NotFound(val name: String = "NotFound", val message: String)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
For routes without path params, `path` is a `const val`, not a function.
|
|
78
|
+
|
|
79
|
+
## Consumer-side setup the dev MUST do
|
|
80
|
+
|
|
81
|
+
The generated code requires these on the Android/JVM side. **Don't let the user assume the codegen handles them.**
|
|
82
|
+
|
|
83
|
+
1. **Gradle:** `kotlin("plugin.serialization")` plugin + `org.jetbrains.kotlinx:kotlinx-serialization-json` dependency. (`kotlinx-serialization-core` is a transitive dep; no need to declare it explicitly.)
|
|
84
|
+
|
|
85
|
+
2. **Contextual serializers:** `format: date-time`/`uuid`/`uri`/`date`/`time` map to JVM stdlib types annotated with `@Contextual`. The consumer's `Json` configuration MUST register `contextual(java.time.Instant::class, ...)` etc., otherwise decoding fails. We don't ship the serializers — choice between ISO-8601 and epoch ms is application-specific.
|
|
86
|
+
|
|
87
|
+
3. **Discriminated unions:** `@JsonClassDiscriminator` is read automatically by `kotlinx-serialization-json` — no extra config needed.
|
|
88
|
+
|
|
89
|
+
4. **No runtime dispatch:** error types are emitted as nested data classes (`Users.GetUser.Errors.NotFound`), but there's no `instanceof`-style registry, no `dispatchTypedError`. Consumers catch HTTP failures themselves and inspect `body.name` (a regular `String` field, not a type-system discriminator) to decide which error data class to deserialize against. This is by design; don't suggest implementing it.
|
|
90
|
+
|
|
91
|
+
The full setup guide lives at `docs/codegen-kotlin.md` in the `ts-procedures` repo.
|
|
92
|
+
|
|
93
|
+
## Documented limitations to flag during reviews
|
|
94
|
+
|
|
95
|
+
- **Untagged `oneOf` produces an empty `data class`.** Won't round-trip. Add a server-side discriminator, hand-write a `KSerializer`, or pre-process the envelope.
|
|
96
|
+
- **Tuples > 3 elements throw** at codegen time. Refactor to a struct schema upstream.
|
|
97
|
+
- **`additionalProperties: { type: T }` is silently dropped** with a KDoc note. Add a sibling `Map<String, T>` field by hand if your contract uses extra keys.
|
|
98
|
+
- **Schema-level `examples` are not modeled.** They're documentation-only on the server side; consumers don't see them.
|
|
99
|
+
|
|
100
|
+
## Anti-patterns
|
|
101
|
+
|
|
102
|
+
- Suggesting the Kotlin target ships an HTTP adapter or error registry.
|
|
103
|
+
- Recommending `--kotlin-serializer none` without noting the consumer is responsible for adapter setup.
|
|
104
|
+
- Treating `--unsupported-unions fallback` as functional for Kotlin — it's a no-op (the CLI itself warns when set).
|
|
105
|
+
- Saying KMP (Kotlin Multiplatform) is supported — JVM only for now.
|
|
106
|
+
- Mixing `--target kotlin` flags into a TypeScript-target invocation; some flags are silently ignored, others (like `--kotlin-package`) are required only for kotlin.
|
|
@@ -386,6 +386,8 @@ npx ts-procedures-codegen --url http://localhost:3000/docs --out ./src/generated
|
|
|
386
386
|
# --clean-out-dir # recursively wipe --out before writing (prunes stale scope files)
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
+
For Kotlin codegen (Android/JVM consumers), see `docs/codegen-kotlin.md` in the ts-procedures repo. The Kotlin target is types-only; consumer apps own HTTP/error handling.
|
|
390
|
+
|
|
389
391
|
Generates one `.ts` file per scope plus a root `index.ts` that imports each scope as a namespace and exports a `create${ServiceName}Bindings(client)` factory AND a `create${ServiceName}Client(config)` convenience factory that pre-wires the error registry (defaults to `createApiBindings` / `createApiClient`; pass `--service-name <Name>` to rename). When namespace mode is on (the default), `index.ts` also wraps every scope namespace in an outer `export namespace ${ServiceName} { ... }` block so types are reachable as `Api.Users.GetUser.Params`, `Api.Errors.UseCaseError`, etc. The errors file (`_errors.ts`) emits runtime error classes extending a shared `${ServiceName}ProcedureError` base, each with `static fromResponse(body, meta)`, plus `${ServiceName}ErrorRegistry` (runtime dispatch map) and `${ServiceName}ProcedureErrorUnion` (type union). Defaults: `ApiErrors`, `ApiProcedureError`, `ApiErrorRegistry`, `ApiProcedureErrorUnion`.
|
|
390
392
|
By default, types are wrapped in nested TS namespaces (`Scope.Route.Params`), JSDoc comments are emitted, and output is self-contained (no runtime dependency on `ts-procedures`). Use `--no-namespace-types` to revert to flat type names (`RouteParams`); this also disables the outer service namespace in `index.ts` and skips importing `_errors` from there.
|
|
391
393
|
Note: ajsc formatting options (`--enum-style enum`, `--depluralize`, etc.) only take effect in namespace mode (the default). They are ignored with `--no-namespace-types`.
|
|
@@ -386,6 +386,8 @@ npx ts-procedures-codegen --url http://localhost:3000/docs --out ./src/generated
|
|
|
386
386
|
# --clean-out-dir # recursively wipe --out before writing (prunes stale scope files)
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
+
For Kotlin codegen (Android/JVM consumers), see `docs/codegen-kotlin.md` in the ts-procedures repo. The Kotlin target is types-only; consumer apps own HTTP/error handling.
|
|
390
|
+
|
|
389
391
|
Generates one `.ts` file per scope plus a root `index.ts` that imports each scope as a namespace and exports a `create${ServiceName}Bindings(client)` factory AND a `create${ServiceName}Client(config)` convenience factory that pre-wires the error registry (defaults to `createApiBindings` / `createApiClient`; pass `--service-name <Name>` to rename). When namespace mode is on (the default), `index.ts` also wraps every scope namespace in an outer `export namespace ${ServiceName} { ... }` block so types are reachable as `Api.Users.GetUser.Params`, `Api.Errors.UseCaseError`, etc. The errors file (`_errors.ts`) emits runtime error classes extending a shared `${ServiceName}ProcedureError` base, each with `static fromResponse(body, meta)`, plus `${ServiceName}ErrorRegistry` (runtime dispatch map) and `${ServiceName}ProcedureErrorUnion` (type union). Defaults: `ApiErrors`, `ApiProcedureError`, `ApiErrorRegistry`, `ApiProcedureErrorUnion`.
|
|
390
392
|
By default, types are wrapped in nested TS namespaces (`Scope.Route.Params`), JSDoc comments are emitted, and output is self-contained (no runtime dependency on `ts-procedures`). Use `--no-namespace-types` to revert to flat type names (`RouteParams`); this also disables the outer service namespace in `index.ts` and skips importing `_errors` from there.
|
|
391
393
|
Note: ajsc formatting options (`--enum-style enum`, `--depluralize`, etc.) only take effect in namespace mode (the default). They are ignored with `--no-namespace-types`.
|
|
@@ -13,6 +13,12 @@ export interface CodegenConfig {
|
|
|
13
13
|
selfContained?: boolean;
|
|
14
14
|
serviceName?: string;
|
|
15
15
|
cleanOutDir?: boolean;
|
|
16
|
+
target?: 'ts' | 'kotlin';
|
|
17
|
+
kotlin?: {
|
|
18
|
+
package: string;
|
|
19
|
+
serializer?: 'kotlinx' | 'none';
|
|
20
|
+
};
|
|
21
|
+
unsupportedUnions?: 'throw' | 'fallback';
|
|
16
22
|
}
|
|
17
23
|
export interface ParsedArgs {
|
|
18
24
|
url?: string;
|
|
@@ -27,6 +33,12 @@ export interface ParsedArgs {
|
|
|
27
33
|
selfContained: boolean;
|
|
28
34
|
serviceName?: string;
|
|
29
35
|
cleanOutDir: boolean;
|
|
36
|
+
target?: 'ts' | 'kotlin';
|
|
37
|
+
kotlin?: {
|
|
38
|
+
package: string;
|
|
39
|
+
serializer?: 'kotlinx' | 'none';
|
|
40
|
+
};
|
|
41
|
+
unsupportedUnions?: 'throw' | 'fallback';
|
|
30
42
|
}
|
|
31
43
|
/**
|
|
32
44
|
* Loads a JSON config file. Returns undefined if the file doesn't exist.
|
|
@@ -45,3 +57,16 @@ export declare function parseArgs(argv: string[], config?: CodegenConfig): Parse
|
|
|
45
57
|
* Extracts the --config value from argv without full parsing.
|
|
46
58
|
*/
|
|
47
59
|
export declare function extractConfigPath(argv: string[]): string | undefined;
|
|
60
|
+
export declare function printPostRunHints(parsed: {
|
|
61
|
+
target?: 'ts' | 'kotlin';
|
|
62
|
+
}): void;
|
|
63
|
+
/**
|
|
64
|
+
* Warns about flags that are currently no-ops for the Kotlin target.
|
|
65
|
+
* Currently: `--unsupported-unions` is a no-op because ajsc v7.2's Kotlin
|
|
66
|
+
* emitter silently emits an empty data class for untagged oneOf regardless
|
|
67
|
+
* of the flag (see docs/codegen-kotlin.md#untagged-unions).
|
|
68
|
+
*/
|
|
69
|
+
export declare function warnIfKotlinNoOpFlags(parsed: {
|
|
70
|
+
target?: 'ts' | 'kotlin';
|
|
71
|
+
unsupportedUnions?: 'throw' | 'fallback';
|
|
72
|
+
}): void;
|
package/build/codegen/bin/cli.js
CHANGED
|
@@ -49,6 +49,10 @@ export function parseArgs(argv, config) {
|
|
|
49
49
|
let selfContained = config?.selfContained ?? true;
|
|
50
50
|
let serviceName = config?.serviceName;
|
|
51
51
|
let cleanOutDir = config?.cleanOutDir ?? false;
|
|
52
|
+
let target = config?.target;
|
|
53
|
+
let kotlinPackage = config?.kotlin?.package;
|
|
54
|
+
let kotlinSerializer = config?.kotlin?.serializer;
|
|
55
|
+
let unsupportedUnions = config?.unsupportedUnions;
|
|
52
56
|
let configPath;
|
|
53
57
|
for (let i = 0; i < argv.length; i++) {
|
|
54
58
|
const arg = argv[i];
|
|
@@ -116,6 +120,36 @@ export function parseArgs(argv, config) {
|
|
|
116
120
|
else if (arg === '--no-clean-out-dir') {
|
|
117
121
|
cleanOutDir = false;
|
|
118
122
|
}
|
|
123
|
+
else if (arg === '--target') {
|
|
124
|
+
const val = argv[++i];
|
|
125
|
+
if (val === 'ts' || val === 'kotlin') {
|
|
126
|
+
target = val;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw new Error(`Invalid --target value: ${val ?? '(missing)'} (expected 'ts' or 'kotlin')`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else if (arg === '--kotlin-package') {
|
|
133
|
+
kotlinPackage = argv[++i];
|
|
134
|
+
}
|
|
135
|
+
else if (arg === '--kotlin-serializer') {
|
|
136
|
+
const val = argv[++i];
|
|
137
|
+
if (val === 'kotlinx' || val === 'none') {
|
|
138
|
+
kotlinSerializer = val;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw new Error(`Invalid --kotlin-serializer value: ${val ?? '(missing)'} (expected 'kotlinx' or 'none')`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (arg === '--unsupported-unions') {
|
|
145
|
+
const val = argv[++i];
|
|
146
|
+
if (val === 'throw' || val === 'fallback') {
|
|
147
|
+
unsupportedUnions = val;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
throw new Error(`Invalid --unsupported-unions value: ${val ?? '(missing)'} (expected 'throw' or 'fallback')`);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
119
153
|
else if (arg === '--config') {
|
|
120
154
|
configPath = argv[++i];
|
|
121
155
|
}
|
|
@@ -128,6 +162,9 @@ export function parseArgs(argv, config) {
|
|
|
128
162
|
if (url === undefined && file === undefined) {
|
|
129
163
|
throw new Error('Missing required input source: provide --url <url> or --file <path>');
|
|
130
164
|
}
|
|
165
|
+
if (target === 'kotlin' && (kotlinPackage === undefined || kotlinPackage === '')) {
|
|
166
|
+
throw new Error('Missing required argument: --kotlin-package <pkg> (required when --target kotlin)');
|
|
167
|
+
}
|
|
131
168
|
return {
|
|
132
169
|
url,
|
|
133
170
|
file,
|
|
@@ -141,6 +178,16 @@ export function parseArgs(argv, config) {
|
|
|
141
178
|
selfContained,
|
|
142
179
|
...(serviceName !== undefined ? { serviceName } : {}),
|
|
143
180
|
cleanOutDir,
|
|
181
|
+
...(target !== undefined ? { target } : {}),
|
|
182
|
+
...(kotlinPackage !== undefined
|
|
183
|
+
? {
|
|
184
|
+
kotlin: {
|
|
185
|
+
package: kotlinPackage,
|
|
186
|
+
...(kotlinSerializer !== undefined ? { serializer: kotlinSerializer } : {}),
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
: {}),
|
|
190
|
+
...(unsupportedUnions !== undefined ? { unsupportedUnions } : {}),
|
|
144
191
|
};
|
|
145
192
|
}
|
|
146
193
|
/**
|
|
@@ -172,6 +219,14 @@ async function runWithWatch(parsed) {
|
|
|
172
219
|
serviceName: parsed.serviceName,
|
|
173
220
|
cleanOutDir: parsed.cleanOutDir,
|
|
174
221
|
};
|
|
222
|
+
// Resolve the kotlin emitter once at watch start; it's stateless and reused per tick.
|
|
223
|
+
const kotlinWiring = parsed.target === 'kotlin'
|
|
224
|
+
? {
|
|
225
|
+
target: 'kotlin',
|
|
226
|
+
kotlinPackage: parsed.kotlin.package,
|
|
227
|
+
kotlinEmitter: await (await import('../targets/kotlin/ajsc-adapter.js')).resolveProductionKotlinEmitter(),
|
|
228
|
+
}
|
|
229
|
+
: {};
|
|
175
230
|
let lastHash;
|
|
176
231
|
const run = async () => {
|
|
177
232
|
try {
|
|
@@ -194,6 +249,9 @@ async function runWithWatch(parsed) {
|
|
|
194
249
|
selfContained: parsed.selfContained,
|
|
195
250
|
serviceName: parsed.serviceName,
|
|
196
251
|
cleanOutDir: parsed.cleanOutDir,
|
|
252
|
+
...(parsed.kotlin?.serializer !== undefined ? { kotlinSerializer: parsed.kotlin.serializer } : {}),
|
|
253
|
+
...(parsed.unsupportedUnions !== undefined ? { unsupportedUnions: parsed.unsupportedUnions } : {}),
|
|
254
|
+
...kotlinWiring,
|
|
197
255
|
});
|
|
198
256
|
console.log(`[ts-procedures-codegen] Generated client files → ${parsed.outDir}`);
|
|
199
257
|
}
|
|
@@ -209,6 +267,24 @@ async function runWithWatch(parsed) {
|
|
|
209
267
|
// ---------------------------------------------------------------------------
|
|
210
268
|
// Main
|
|
211
269
|
// ---------------------------------------------------------------------------
|
|
270
|
+
const KOTLIN_SETUP_GUIDE_URL = 'https://bitbucket.org/thermsio/ts-procedures/src/master/docs/codegen-kotlin.md';
|
|
271
|
+
export function printPostRunHints(parsed) {
|
|
272
|
+
if (parsed.target === 'kotlin') {
|
|
273
|
+
console.log(`[ts-procedures-codegen] Kotlin setup guide: ${KOTLIN_SETUP_GUIDE_URL}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Warns about flags that are currently no-ops for the Kotlin target.
|
|
278
|
+
* Currently: `--unsupported-unions` is a no-op because ajsc v7.2's Kotlin
|
|
279
|
+
* emitter silently emits an empty data class for untagged oneOf regardless
|
|
280
|
+
* of the flag (see docs/codegen-kotlin.md#untagged-unions).
|
|
281
|
+
*/
|
|
282
|
+
export function warnIfKotlinNoOpFlags(parsed) {
|
|
283
|
+
if (parsed.target === 'kotlin' && parsed.unsupportedUnions !== undefined) {
|
|
284
|
+
console.warn('[ts-procedures-codegen] Note: --unsupported-unions is currently a no-op for --target kotlin ' +
|
|
285
|
+
'(ajsc v7.2 emits an empty data class regardless). See docs/codegen-kotlin.md#untagged-unions.');
|
|
286
|
+
}
|
|
287
|
+
}
|
|
212
288
|
async function main() {
|
|
213
289
|
const argv = process.argv.slice(2);
|
|
214
290
|
const configPath = extractConfigPath(argv);
|
|
@@ -217,12 +293,20 @@ async function main() {
|
|
|
217
293
|
console.log(`[ts-procedures-codegen] Loaded config from ${configPath ?? DEFAULT_CONFIG_NAME}`);
|
|
218
294
|
}
|
|
219
295
|
const parsed = parseArgs(argv, config);
|
|
296
|
+
warnIfKotlinNoOpFlags(parsed);
|
|
220
297
|
const source = parsed.url ?? parsed.file;
|
|
221
298
|
console.log(`[ts-procedures-codegen] Reading docs from ${source}...`);
|
|
222
299
|
if (parsed.watch) {
|
|
223
300
|
await runWithWatch(parsed);
|
|
224
301
|
}
|
|
225
302
|
else {
|
|
303
|
+
const kotlinWiring = parsed.target === 'kotlin'
|
|
304
|
+
? {
|
|
305
|
+
target: 'kotlin',
|
|
306
|
+
kotlinPackage: parsed.kotlin.package,
|
|
307
|
+
kotlinEmitter: await (await import('../targets/kotlin/ajsc-adapter.js')).resolveProductionKotlinEmitter(),
|
|
308
|
+
}
|
|
309
|
+
: {};
|
|
226
310
|
const result = await generateClient({
|
|
227
311
|
url: parsed.url,
|
|
228
312
|
file: parsed.file,
|
|
@@ -234,12 +318,16 @@ async function main() {
|
|
|
234
318
|
selfContained: parsed.selfContained,
|
|
235
319
|
serviceName: parsed.serviceName,
|
|
236
320
|
cleanOutDir: parsed.cleanOutDir,
|
|
321
|
+
...(parsed.kotlin?.serializer !== undefined ? { kotlinSerializer: parsed.kotlin.serializer } : {}),
|
|
322
|
+
...(parsed.unsupportedUnions !== undefined ? { unsupportedUnions: parsed.unsupportedUnions } : {}),
|
|
323
|
+
...kotlinWiring,
|
|
237
324
|
});
|
|
238
325
|
if (parsed.dryRun) {
|
|
239
326
|
console.log(`[ts-procedures-codegen] Dry run complete — ${result.length} files would be generated`);
|
|
240
327
|
}
|
|
241
328
|
else {
|
|
242
329
|
console.log(`[ts-procedures-codegen] Generated ${result.length} files → ${parsed.outDir}`);
|
|
330
|
+
printPostRunHints(parsed);
|
|
243
331
|
}
|
|
244
332
|
}
|
|
245
333
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/codegen/bin/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,cAAc,EAA8B,MAAM,aAAa,CAAA;AAqCxE,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,MAAM,mBAAmB,GAAG,mCAAmC,CAAA;AAE/D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,UAAmB;IACtD,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,IAAI,mBAAmB,CAAC,CAAA;IAC3D,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkB,CAAA;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,+BAA+B;YAC/B,MAAM,IAAI,KAAK,CAAC,sDAAsD,QAAQ,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAA;QAChI,CAAC;QACD,8CAA8C;QAC9C,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAc,EAAE,MAAsB;IAC9D,IAAI,GAAG,GAAuB,MAAM,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IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AAEnC,IAAI,MAAM,EAAE,CAAC;IACX,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,sCAAsC,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QAC/F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import {
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
import { parseArgs, loadConfigFile, extractConfigPath, printPostRunHints, warnIfKotlinNoOpFlags } from './cli.js';
|
|
3
4
|
describe('parseArgs', () => {
|
|
4
5
|
it('parses --url and --out', () => {
|
|
5
6
|
const result = parseArgs(['--url', 'http://localhost:3000/docs', '--out', './generated']);
|
|
@@ -247,4 +248,182 @@ describe('config file support', () => {
|
|
|
247
248
|
await expect(loadConfigFile('/nonexistent/config.json')).rejects.toThrow('Failed to load config');
|
|
248
249
|
});
|
|
249
250
|
});
|
|
251
|
+
describe('cli — kotlin target', () => {
|
|
252
|
+
it('parses --target kotlin and --kotlin-package from CLI flags', () => {
|
|
253
|
+
const args = parseArgs(['--target', 'kotlin', '--kotlin-package', 'com.example.api', '--out', 'out', '--file', 'env.json']);
|
|
254
|
+
expect(args.target).toBe('kotlin');
|
|
255
|
+
expect(args.kotlin?.package).toBe('com.example.api');
|
|
256
|
+
});
|
|
257
|
+
it('reads kotlin.package from config when no CLI flag is provided', () => {
|
|
258
|
+
const config = {
|
|
259
|
+
target: 'kotlin',
|
|
260
|
+
kotlin: { package: 'com.example.api' },
|
|
261
|
+
outDir: 'out',
|
|
262
|
+
file: 'env.json',
|
|
263
|
+
};
|
|
264
|
+
const args = parseArgs(['--out', 'out', '--file', 'env.json'], config);
|
|
265
|
+
expect(args.target).toBe('kotlin');
|
|
266
|
+
expect(args.kotlin?.package).toBe('com.example.api');
|
|
267
|
+
});
|
|
268
|
+
it('CLI flag overrides config value', () => {
|
|
269
|
+
const config = {
|
|
270
|
+
target: 'kotlin',
|
|
271
|
+
kotlin: { package: 'old.pkg' },
|
|
272
|
+
outDir: 'out',
|
|
273
|
+
file: 'env.json',
|
|
274
|
+
};
|
|
275
|
+
const args = parseArgs(['--kotlin-package', 'new.pkg', '--out', 'out', '--file', 'env.json'], config);
|
|
276
|
+
expect(args.kotlin?.package).toBe('new.pkg');
|
|
277
|
+
});
|
|
278
|
+
it('errors when target is kotlin and no package is provided', () => {
|
|
279
|
+
expect(() => parseArgs(['--target', 'kotlin', '--out', 'out', '--file', 'env.json'])).toThrow(/--kotlin-package/);
|
|
280
|
+
});
|
|
281
|
+
it('--target ts is the default', () => {
|
|
282
|
+
const args = parseArgs(['--out', 'out', '--file', 'env.json']);
|
|
283
|
+
expect(args.target ?? 'ts').toBe('ts');
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
describe('cli — kotlin-serializer flag', () => {
|
|
287
|
+
it('parses --kotlin-serializer kotlinx', () => {
|
|
288
|
+
const args = parseArgs(['--target', 'kotlin', '--kotlin-package', 'p', '--kotlin-serializer', 'kotlinx', '--out', 'o', '--file', 'e.json']);
|
|
289
|
+
expect(args.kotlin?.serializer).toBe('kotlinx');
|
|
290
|
+
});
|
|
291
|
+
it('parses --kotlin-serializer none', () => {
|
|
292
|
+
const args = parseArgs(['--target', 'kotlin', '--kotlin-package', 'p', '--kotlin-serializer', 'none', '--out', 'o', '--file', 'e.json']);
|
|
293
|
+
expect(args.kotlin?.serializer).toBe('none');
|
|
294
|
+
});
|
|
295
|
+
it('reads kotlin.serializer from config', () => {
|
|
296
|
+
const args = parseArgs(['--out', 'o', '--file', 'e.json'], {
|
|
297
|
+
target: 'kotlin', kotlin: { package: 'p', serializer: 'none' }, outDir: 'o', file: 'e.json',
|
|
298
|
+
});
|
|
299
|
+
expect(args.kotlin?.serializer).toBe('none');
|
|
300
|
+
});
|
|
301
|
+
it('CLI overrides config', () => {
|
|
302
|
+
const args = parseArgs(['--kotlin-serializer', 'kotlinx', '--out', 'o', '--file', 'e.json'], {
|
|
303
|
+
target: 'kotlin', kotlin: { package: 'p', serializer: 'none' }, outDir: 'o', file: 'e.json',
|
|
304
|
+
});
|
|
305
|
+
expect(args.kotlin?.serializer).toBe('kotlinx');
|
|
306
|
+
});
|
|
307
|
+
it('throws on invalid value', () => {
|
|
308
|
+
expect(() => parseArgs(['--target', 'kotlin', '--kotlin-package', 'p', '--kotlin-serializer', 'bogus', '--out', 'o', '--file', 'e.json']))
|
|
309
|
+
.toThrow(/--kotlin-serializer/);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
describe('cli — unsupported-unions flag', () => {
|
|
313
|
+
it('parses --unsupported-unions throw', () => {
|
|
314
|
+
const args = parseArgs(['--unsupported-unions', 'throw', '--out', 'o', '--file', 'e.json']);
|
|
315
|
+
expect(args.unsupportedUnions).toBe('throw');
|
|
316
|
+
});
|
|
317
|
+
it('parses --unsupported-unions fallback', () => {
|
|
318
|
+
const args = parseArgs(['--unsupported-unions', 'fallback', '--out', 'o', '--file', 'e.json']);
|
|
319
|
+
expect(args.unsupportedUnions).toBe('fallback');
|
|
320
|
+
});
|
|
321
|
+
it('reads unsupportedUnions from config', () => {
|
|
322
|
+
const args = parseArgs(['--out', 'o', '--file', 'e.json'], {
|
|
323
|
+
unsupportedUnions: 'fallback', outDir: 'o', file: 'e.json',
|
|
324
|
+
});
|
|
325
|
+
expect(args.unsupportedUnions).toBe('fallback');
|
|
326
|
+
});
|
|
327
|
+
it('CLI overrides config', () => {
|
|
328
|
+
const args = parseArgs(['--unsupported-unions', 'throw', '--out', 'o', '--file', 'e.json'], {
|
|
329
|
+
unsupportedUnions: 'fallback', outDir: 'o', file: 'e.json',
|
|
330
|
+
});
|
|
331
|
+
expect(args.unsupportedUnions).toBe('throw');
|
|
332
|
+
});
|
|
333
|
+
it('throws on invalid value', () => {
|
|
334
|
+
expect(() => parseArgs(['--unsupported-unions', 'bogus', '--out', 'o', '--file', 'e.json']))
|
|
335
|
+
.toThrow(/--unsupported-unions/);
|
|
336
|
+
});
|
|
337
|
+
it('default is undefined when not set', () => {
|
|
338
|
+
const args = parseArgs(['--out', 'o', '--file', 'e.json']);
|
|
339
|
+
expect(args.unsupportedUnions).toBeUndefined();
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
describe('cli — printPostRunHints', () => {
|
|
343
|
+
it('prints a setup-guide pointer for the kotlin target', () => {
|
|
344
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
345
|
+
try {
|
|
346
|
+
printPostRunHints({ target: 'kotlin' });
|
|
347
|
+
const matched = logSpy.mock.calls.some((c) => String(c[0]).includes('docs/codegen-kotlin.md'));
|
|
348
|
+
expect(matched).toBe(true);
|
|
349
|
+
}
|
|
350
|
+
finally {
|
|
351
|
+
logSpy.mockRestore();
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
it('prints nothing for the ts target', () => {
|
|
355
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
356
|
+
try {
|
|
357
|
+
printPostRunHints({ target: 'ts' });
|
|
358
|
+
expect(logSpy).not.toHaveBeenCalled();
|
|
359
|
+
}
|
|
360
|
+
finally {
|
|
361
|
+
logSpy.mockRestore();
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
it('prints nothing when target is undefined (default ts)', () => {
|
|
365
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => { });
|
|
366
|
+
try {
|
|
367
|
+
printPostRunHints({});
|
|
368
|
+
expect(logSpy).not.toHaveBeenCalled();
|
|
369
|
+
}
|
|
370
|
+
finally {
|
|
371
|
+
logSpy.mockRestore();
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
describe('cli — warnIfKotlinNoOpFlags', () => {
|
|
376
|
+
it('warns when --unsupported-unions is set with --target kotlin', () => {
|
|
377
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
378
|
+
try {
|
|
379
|
+
warnIfKotlinNoOpFlags({ target: 'kotlin', unsupportedUnions: 'fallback' });
|
|
380
|
+
const matched = warnSpy.mock.calls.some((c) => String(c[0]).includes('--unsupported-unions is currently a no-op'));
|
|
381
|
+
expect(matched).toBe(true);
|
|
382
|
+
}
|
|
383
|
+
finally {
|
|
384
|
+
warnSpy.mockRestore();
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
it('warns when --unsupported-unions is set to throw with --target kotlin', () => {
|
|
388
|
+
// Even 'throw' is a no-op since ajsc never throws on Kotlin untagged oneOf.
|
|
389
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
390
|
+
try {
|
|
391
|
+
warnIfKotlinNoOpFlags({ target: 'kotlin', unsupportedUnions: 'throw' });
|
|
392
|
+
expect(warnSpy).toHaveBeenCalled();
|
|
393
|
+
}
|
|
394
|
+
finally {
|
|
395
|
+
warnSpy.mockRestore();
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
it('does not warn when --unsupported-unions is unset', () => {
|
|
399
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
400
|
+
try {
|
|
401
|
+
warnIfKotlinNoOpFlags({ target: 'kotlin' });
|
|
402
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
|
403
|
+
}
|
|
404
|
+
finally {
|
|
405
|
+
warnSpy.mockRestore();
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
it('does not warn for the ts target even when --unsupported-unions is set', () => {
|
|
409
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
410
|
+
try {
|
|
411
|
+
warnIfKotlinNoOpFlags({ target: 'ts', unsupportedUnions: 'fallback' });
|
|
412
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
|
413
|
+
}
|
|
414
|
+
finally {
|
|
415
|
+
warnSpy.mockRestore();
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
it('does not warn when target is undefined', () => {
|
|
419
|
+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => { });
|
|
420
|
+
try {
|
|
421
|
+
warnIfKotlinNoOpFlags({ unsupportedUnions: 'fallback' });
|
|
422
|
+
expect(warnSpy).not.toHaveBeenCalled();
|
|
423
|
+
}
|
|
424
|
+
finally {
|
|
425
|
+
warnSpy.mockRestore();
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
});
|
|
250
429
|
//# sourceMappingURL=cli.test.js.map
|