@joiner-platform/cli 0.1.16 → 0.1.18
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/package.json +2 -2
- package/skills/tile-creator/references/cli.md +4 -3
- package/src/commands/init/scaffold.ts +2 -9
- package/src/commands/init/sdk-tarball-url.generated.ts +2 -2
- package/src/commands/init/template-names.ts +18 -0
- package/src/commands/schema-input-example.ts +142 -14
- package/bundled-resources/poe-tile-templates/coverage.config.json +0 -6
- package/bundled-resources/poe-tile-templates/index.ts +0 -27
- package/bundled-resources/poe-tile-templates/package.json +0 -31
- package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +0 -10
- package/bundled-resources/poe-tile-templates/scripts/generate.ts +0 -57
- package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +0 -52
- package/bundled-resources/poe-tile-templates/scripts/paths.ts +0 -7
- package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +0 -288
- package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +0 -132
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +0 -30
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +0 -397
- package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +0 -131
- package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +0 -166
- package/bundled-resources/poe-tile-templates/tests/doctor-launcher.test.ts +0 -48
- package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +0 -67
- package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +0 -106
- package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +0 -103
- package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +0 -67
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +0 -85
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +0 -69
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +0 -73
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +0 -54
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +0 -70
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +0 -85
- package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +0 -278
- package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +0 -27
- package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +0 -99
- package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +0 -23
- package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +0 -84
- package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +0 -56
- package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +0 -129
- package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +0 -90
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joiner-platform/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"gitHead": "d9ce5e8decd6d5eac5c4415fac656ac686dbc402",
|
|
5
5
|
"description": "The Joiner CLI: create, test, and publish Joiner tiles, with agent skills for coding agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"joiner",
|
|
@@ -61,7 +61,7 @@ an older pin, so prefer the live result when upgrading:
|
|
|
61
61
|
|
|
62
62
|
<!-- begin: sdk-tarball-snippet (auto-generated by packages/poe-tiles-sdk/scripts/publish-tar.ts — do not edit by hand) -->
|
|
63
63
|
```json
|
|
64
|
-
"joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/
|
|
64
|
+
"joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/7a524cd85ec30b6f07c29659d5c6109df3ca1d9d07d445d1603e9b1b99437336"
|
|
65
65
|
```
|
|
66
66
|
<!-- end: sdk-tarball-snippet -->
|
|
67
67
|
|
|
@@ -485,8 +485,9 @@ table. It exits non-zero when the user is not an active member.
|
|
|
485
485
|
and prints CLI commands for checking access and dispatching each mutator and
|
|
486
486
|
action. Each dispatch command carries an example `--input` built from that
|
|
487
487
|
function's input schema: required fields only, with `"<fieldName>"` string
|
|
488
|
-
placeholders and numbers at
|
|
489
|
-
placeholders before running it. When the input schema can't be read,
|
|
488
|
+
placeholders and numbers at an allowed value near `0`. Replace the
|
|
489
|
+
placeholders before running it. When the input schema can't be read, no number
|
|
490
|
+
fits its bounds, the schema is too large or deeply nested to walk, or the
|
|
490
491
|
example would be too large for one shell argument (an array of more than 32
|
|
491
492
|
items, or more than 1 KiB of JSON), the command shows `--input '<json>'` and
|
|
492
493
|
its `--json` entry has no `inputExample`.
|
|
@@ -35,15 +35,7 @@ import {
|
|
|
35
35
|
applyInternalMonoRepoTypeCheckScripts,
|
|
36
36
|
} from "./package-json-scripts.js";
|
|
37
37
|
import { readSdkTarballUrl } from "./sdk-tarball-url.js";
|
|
38
|
-
|
|
39
|
-
export const TEMPLATES = [
|
|
40
|
-
"react",
|
|
41
|
-
"vanilla-js",
|
|
42
|
-
"solidjs",
|
|
43
|
-
"preact",
|
|
44
|
-
"phaserjs",
|
|
45
|
-
] as const;
|
|
46
|
-
export type TemplateName = (typeof TEMPLATES)[number];
|
|
38
|
+
import { TEMPLATES, type TemplateName } from "./template-names.js";
|
|
47
39
|
|
|
48
40
|
/**
|
|
49
41
|
* Allowed app-name shape and length cap. Re-exported from
|
|
@@ -56,6 +48,7 @@ export {
|
|
|
56
48
|
TILE_HANDLE_MAX_LENGTH as VALID_NAME_MAX_LENGTH,
|
|
57
49
|
TILE_HANDLE_REGEX as VALID_NAME_RE,
|
|
58
50
|
} from "../../poe-tile-config.js";
|
|
51
|
+
export { TEMPLATES, type TemplateName };
|
|
59
52
|
export const INVALID_NAME_HINT =
|
|
60
53
|
"Use lowercase letters, numbers, and hyphens only. Must start and end with a letter or number; 1-100 characters.";
|
|
61
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Auto-generated by poe-tiles-sdk/scripts/publish-tar.ts — do not edit
|
|
2
|
-
// publishedAt: 2026-11-
|
|
2
|
+
// publishedAt: 2026-11-30T17:00:08.574Z
|
|
3
3
|
export const SDK_TARBALL_URL =
|
|
4
|
-
"https://misc-dev-uploads.quora-913.workers.dev/
|
|
4
|
+
"https://misc-dev-uploads.quora-913.workers.dev/7a524cd85ec30b6f07c29659d5c6109df3ca1d9d07d445d1603e9b1b99437336";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
// Kept import-free: scripts/pack-tarball.ts reads it to choose which template
|
|
3
|
+
// directories ship, and runs before the CLI's dependencies are installed.
|
|
4
|
+
export const TEMPLATES = [
|
|
5
|
+
"react",
|
|
6
|
+
"vanilla-js",
|
|
7
|
+
"solidjs",
|
|
8
|
+
"preact",
|
|
9
|
+
"phaserjs",
|
|
10
|
+
] as const;
|
|
11
|
+
export type TemplateName = (typeof TEMPLATES)[number];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The top-level directories of packages/poe-tile-templates the published CLI
|
|
15
|
+
* ships and scaffolds from. The package's own tests, scripts and manifest stay
|
|
16
|
+
* out, and edits to them do not trigger a CLI release.
|
|
17
|
+
*/
|
|
18
|
+
export const BUNDLED_TEMPLATE_DIRS = ["base", ...TEMPLATES] as const;
|
|
@@ -13,6 +13,16 @@ const NO_EXAMPLE = Symbol("no-example");
|
|
|
13
13
|
const MAX_EXAMPLE_JSON_BYTES = 1024;
|
|
14
14
|
const MAX_ITEMS = 32;
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Store authors can pass raw JSON Schema through `jsonSchema()`, so a schema
|
|
18
|
+
* may repeat subtrees or nest arbitrarily deep. These cap the walk; past
|
|
19
|
+
* either, the command falls back to `'<json>'`.
|
|
20
|
+
*/
|
|
21
|
+
const MAX_VISITED_NODES = 10_000;
|
|
22
|
+
const MAX_DEPTH = 64;
|
|
23
|
+
|
|
24
|
+
type Walk = { visited: number };
|
|
25
|
+
|
|
16
26
|
/**
|
|
17
27
|
* Builds a minimal input that matches a mutator or action's JSON Schema, for
|
|
18
28
|
* the copy-paste commands `stores schema` prints. Required object properties
|
|
@@ -26,7 +36,7 @@ const MAX_ITEMS = 32;
|
|
|
26
36
|
export function exampleInputFromJsonSchema(
|
|
27
37
|
schema: unknown,
|
|
28
38
|
): JSONValue | undefined {
|
|
29
|
-
const example = withinLength(exampleFor(schema, "string"));
|
|
39
|
+
const example = withinLength(exampleFor(schema, "string", { visited: 0 }, 0));
|
|
30
40
|
return example === NO_EXAMPLE ? undefined : example;
|
|
31
41
|
}
|
|
32
42
|
|
|
@@ -43,7 +53,11 @@ function withinLength(
|
|
|
43
53
|
function exampleFor(
|
|
44
54
|
schema: unknown,
|
|
45
55
|
label: string,
|
|
56
|
+
walk: Walk,
|
|
57
|
+
depth: number,
|
|
46
58
|
): JSONValue | typeof NO_EXAMPLE {
|
|
59
|
+
walk.visited += 1;
|
|
60
|
+
if (walk.visited > MAX_VISITED_NODES || depth > MAX_DEPTH) return NO_EXAMPLE;
|
|
47
61
|
if (!isSchema(schema) || "def" in schema || "_zod" in schema) {
|
|
48
62
|
return NO_EXAMPLE;
|
|
49
63
|
}
|
|
@@ -53,8 +67,8 @@ function exampleFor(
|
|
|
53
67
|
return enumValues[0] as JSONValue;
|
|
54
68
|
}
|
|
55
69
|
const branch = firstBranch(schema);
|
|
56
|
-
if (branch !== undefined) return exampleFor(branch, label);
|
|
57
|
-
return typedExample(schema, label);
|
|
70
|
+
if (branch !== undefined) return exampleFor(branch, label, walk, depth + 1);
|
|
71
|
+
return typedExample(schema, label, walk, depth);
|
|
58
72
|
}
|
|
59
73
|
|
|
60
74
|
function firstBranch(schema: Schema): unknown {
|
|
@@ -68,6 +82,8 @@ function firstBranch(schema: Schema): unknown {
|
|
|
68
82
|
function typedExample(
|
|
69
83
|
schema: Schema,
|
|
70
84
|
label: string,
|
|
85
|
+
walk: Walk,
|
|
86
|
+
depth: number,
|
|
71
87
|
): JSONValue | typeof NO_EXAMPLE {
|
|
72
88
|
const type = Array.isArray(schema["type"])
|
|
73
89
|
? schema["type"][0]
|
|
@@ -83,16 +99,64 @@ function typedExample(
|
|
|
83
99
|
case "null":
|
|
84
100
|
return null;
|
|
85
101
|
case "array":
|
|
86
|
-
return arrayExample(schema, label);
|
|
102
|
+
return arrayExample(schema, label, walk, depth);
|
|
87
103
|
case "object":
|
|
88
|
-
return objectExample(schema);
|
|
104
|
+
return objectExample(schema, walk, depth);
|
|
89
105
|
default:
|
|
90
106
|
return NO_EXAMPLE;
|
|
91
107
|
}
|
|
92
108
|
}
|
|
93
109
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
110
|
+
/**
|
|
111
|
+
* 0 moved inside `minimum` / `maximum` and their exclusive forms, else the
|
|
112
|
+
* midpoint of both bounds, each tried as is and snapped to `multipleOf`. No
|
|
113
|
+
* example when none of those satisfies every bound.
|
|
114
|
+
*/
|
|
115
|
+
function numberExample(
|
|
116
|
+
schema: Schema,
|
|
117
|
+
integer: boolean,
|
|
118
|
+
): number | typeof NO_EXAMPLE {
|
|
119
|
+
const multipleOf = numberField(schema, "multipleOf");
|
|
120
|
+
const candidates = [clampedZero(schema, integer), midpoint(schema, integer)]
|
|
121
|
+
.filter((value) => value !== undefined)
|
|
122
|
+
.flatMap((value) =>
|
|
123
|
+
multipleOf === undefined || multipleOf <= 0
|
|
124
|
+
? [value]
|
|
125
|
+
: [
|
|
126
|
+
value,
|
|
127
|
+
snap(Math.ceil(value / multipleOf), multipleOf),
|
|
128
|
+
snap(Math.floor(value / multipleOf), multipleOf),
|
|
129
|
+
snap(Math.round(value / multipleOf), multipleOf),
|
|
130
|
+
],
|
|
131
|
+
);
|
|
132
|
+
return (
|
|
133
|
+
candidates.find((value) => satisfiesNumber(schema, integer, value)) ??
|
|
134
|
+
NO_EXAMPLE
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** `steps * multipleOf`, without float noise such as 0.30000000000000004. */
|
|
139
|
+
function snap(steps: number, multipleOf: number): number {
|
|
140
|
+
const value = steps * multipleOf;
|
|
141
|
+
return Number.isInteger(value) ? value : Number(value.toPrecision(15));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Zod's own float-safe check (`floatSafeRemainder`): 0.3 / 0.1 is
|
|
146
|
+
* 2.9999999999999996, and the store accepts 0.3 as a multiple of 0.1.
|
|
147
|
+
* Integers are checked exactly, since that relative tolerance accepts any
|
|
148
|
+
* value once the step count nears 1e15.
|
|
149
|
+
*/
|
|
150
|
+
function isMultipleOf(value: number, multipleOf: number): boolean {
|
|
151
|
+
if (Number.isInteger(value) && Number.isInteger(multipleOf)) {
|
|
152
|
+
return value % multipleOf === 0;
|
|
153
|
+
}
|
|
154
|
+
const steps = value / multipleOf;
|
|
155
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(steps), 1);
|
|
156
|
+
return Math.abs(steps - Math.round(steps)) < tolerance;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function clampedZero(schema: Schema, integer: boolean): number {
|
|
96
160
|
const round = integer ? Math.ceil : (value: number) => value;
|
|
97
161
|
const roundDown = integer ? Math.floor : (value: number) => value;
|
|
98
162
|
const clamps: ReadonlyArray<
|
|
@@ -123,6 +187,52 @@ function numberExample(schema: Schema, integer: boolean): number {
|
|
|
123
187
|
}, 0);
|
|
124
188
|
}
|
|
125
189
|
|
|
190
|
+
function midpoint(schema: Schema, integer: boolean): number | undefined {
|
|
191
|
+
const lower = boundOf(schema, "minimum", "exclusiveMinimum", Math.max);
|
|
192
|
+
const upper = boundOf(schema, "maximum", "exclusiveMaximum", Math.min);
|
|
193
|
+
if (lower === undefined || upper === undefined) return undefined;
|
|
194
|
+
const middle = Number((lower + (upper - lower) / 2).toPrecision(15));
|
|
195
|
+
return integer ? Math.ceil(middle) : middle;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function boundOf(
|
|
199
|
+
schema: Schema,
|
|
200
|
+
inclusive: string,
|
|
201
|
+
exclusive: string,
|
|
202
|
+
tighter: (a: number, b: number) => number,
|
|
203
|
+
): number | undefined {
|
|
204
|
+
const bounds = [
|
|
205
|
+
numberField(schema, inclusive),
|
|
206
|
+
numberField(schema, exclusive),
|
|
207
|
+
].filter((bound) => bound !== undefined);
|
|
208
|
+
return bounds.length === 0 ? undefined : bounds.reduce(tighter);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function satisfiesNumber(
|
|
212
|
+
schema: Schema,
|
|
213
|
+
integer: boolean,
|
|
214
|
+
value: number,
|
|
215
|
+
): boolean {
|
|
216
|
+
const check = (key: string, ok: (bound: number) => boolean) => {
|
|
217
|
+
const bound = numberField(schema, key);
|
|
218
|
+
return bound === undefined || ok(bound);
|
|
219
|
+
};
|
|
220
|
+
return (
|
|
221
|
+
Number.isFinite(value) &&
|
|
222
|
+
(!integer || Number.isInteger(value)) &&
|
|
223
|
+
check("minimum", (bound) => value >= bound) &&
|
|
224
|
+
check("exclusiveMinimum", (bound) => value > bound) &&
|
|
225
|
+
check("maximum", (bound) => value <= bound) &&
|
|
226
|
+
check("exclusiveMaximum", (bound) => value < bound) &&
|
|
227
|
+
check("multipleOf", (bound) => bound > 0 && isMultipleOf(value, bound))
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function numberField(schema: Schema, key: string): number | undefined {
|
|
232
|
+
const value = schema[key];
|
|
233
|
+
return typeof value === "number" ? value : undefined;
|
|
234
|
+
}
|
|
235
|
+
|
|
126
236
|
/**
|
|
127
237
|
* One example per tuple position (`prefixItems`, or a draft-07 `items`
|
|
128
238
|
* array with `additionalItems` as the rest), then `items` examples up to `minItems`, or one when nothing else
|
|
@@ -131,9 +241,11 @@ function numberExample(schema: Schema, integer: boolean): number {
|
|
|
131
241
|
function arrayExample(
|
|
132
242
|
schema: Schema,
|
|
133
243
|
label: string,
|
|
244
|
+
walk: Walk,
|
|
245
|
+
depth: number,
|
|
134
246
|
): JSONValue | typeof NO_EXAMPLE {
|
|
135
247
|
const { prefix, rest } = arrayParts(schema);
|
|
136
|
-
const result = examplesFor(prefix, label);
|
|
248
|
+
const result = examplesFor(prefix, label, walk, depth);
|
|
137
249
|
if (result === NO_EXAMPLE) return NO_EXAMPLE;
|
|
138
250
|
const minItems =
|
|
139
251
|
typeof schema["minItems"] === "number" ? schema["minItems"] : 0;
|
|
@@ -146,7 +258,12 @@ function arrayExample(
|
|
|
146
258
|
return prefix.length === 0 && minItems === 0 ? [] : NO_EXAMPLE;
|
|
147
259
|
}
|
|
148
260
|
if (result.length + restCount > MAX_ITEMS) return NO_EXAMPLE;
|
|
149
|
-
const restExamples = examplesFor(
|
|
261
|
+
const restExamples = examplesFor(
|
|
262
|
+
Array(restCount).fill(rest),
|
|
263
|
+
label,
|
|
264
|
+
walk,
|
|
265
|
+
depth,
|
|
266
|
+
);
|
|
150
267
|
return restExamples === NO_EXAMPLE
|
|
151
268
|
? NO_EXAMPLE
|
|
152
269
|
: withinLength([...result, ...restExamples]);
|
|
@@ -166,25 +283,36 @@ function arrayParts(schema: Schema): { prefix: unknown[]; rest: unknown } {
|
|
|
166
283
|
function examplesFor(
|
|
167
284
|
schemas: readonly unknown[],
|
|
168
285
|
label: string,
|
|
286
|
+
walk: Walk,
|
|
287
|
+
depth: number,
|
|
169
288
|
): JSONValue[] | typeof NO_EXAMPLE {
|
|
170
289
|
if (schemas.length > MAX_ITEMS) return NO_EXAMPLE;
|
|
171
290
|
const result: JSONValue[] = [];
|
|
172
291
|
for (const itemSchema of schemas) {
|
|
173
|
-
const value = exampleFor(itemSchema, label);
|
|
292
|
+
const value = exampleFor(itemSchema, label, walk, depth + 1);
|
|
174
293
|
if (value === NO_EXAMPLE) return NO_EXAMPLE;
|
|
175
294
|
result.push(value);
|
|
176
295
|
}
|
|
177
296
|
return result;
|
|
178
297
|
}
|
|
179
298
|
|
|
180
|
-
function objectExample(
|
|
299
|
+
function objectExample(
|
|
300
|
+
schema: Schema,
|
|
301
|
+
walk: Walk,
|
|
302
|
+
depth: number,
|
|
303
|
+
): JSONValue | typeof NO_EXAMPLE {
|
|
181
304
|
const properties = isSchema(schema["properties"]) ? schema["properties"] : {};
|
|
182
|
-
const
|
|
183
|
-
? schema["required"]
|
|
305
|
+
const rawRequired = Array.isArray(schema["required"])
|
|
306
|
+
? schema["required"]
|
|
184
307
|
: [];
|
|
308
|
+
walk.visited += rawRequired.length;
|
|
309
|
+
if (walk.visited > MAX_VISITED_NODES) return NO_EXAMPLE;
|
|
310
|
+
const required = new Set(
|
|
311
|
+
rawRequired.filter((key) => typeof key === "string"),
|
|
312
|
+
);
|
|
185
313
|
const result: { [key: string]: JSONValue } = {};
|
|
186
314
|
for (const key of required) {
|
|
187
|
-
const value = exampleFor(properties[key], key);
|
|
315
|
+
const value = exampleFor(properties[key], key, walk, depth + 1);
|
|
188
316
|
if (value === NO_EXAMPLE) return NO_EXAMPLE;
|
|
189
317
|
result[key] = value;
|
|
190
318
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// owner: jyoung-q
|
|
2
|
-
/**
|
|
3
|
-
* Poe app templates for scaffolding new apps.
|
|
4
|
-
*
|
|
5
|
-
* Exports template names and a function to resolve template directories.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { resolve } from "node:path";
|
|
9
|
-
|
|
10
|
-
export const TEMPLATES = [
|
|
11
|
-
"react",
|
|
12
|
-
"vanilla-js",
|
|
13
|
-
"solidjs",
|
|
14
|
-
"preact",
|
|
15
|
-
"phaserjs",
|
|
16
|
-
] as const;
|
|
17
|
-
export type TemplateName = (typeof TEMPLATES)[number];
|
|
18
|
-
|
|
19
|
-
/** Resolve the base template directory. */
|
|
20
|
-
export function baseTemplateDir(): string {
|
|
21
|
-
return resolve(import.meta.dir, "base");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** Resolve a framework-specific template directory. */
|
|
25
|
-
export function frameworkTemplateDir(template: TemplateName): string {
|
|
26
|
-
return resolve(import.meta.dir, template);
|
|
27
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@poe-tile/templates",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "index.ts",
|
|
6
|
-
"types": "index.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
"types": "./index.ts",
|
|
10
|
-
"default": "./index.ts"
|
|
11
|
-
},
|
|
12
|
-
"./test-utils/customized-manager": "./tests/fixtures/customized-manager.ts"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"generate-test-apps": "bun scripts/generate.ts && bun install --ignore-scripts --no-save",
|
|
16
|
-
"generate:cleanup": "bun scripts/cleanup.ts",
|
|
17
|
-
"test": "bun test tests/check-source.test.ts tests/playwright-version.test.ts tests/happy-dom-version.test.ts tests/native-gesture-defaults.test.ts tests/visual-check.test.ts tests/install-diagnostics.test.ts tests/render-check-scaffold.test.ts tests/sdk-dependency-key.test.ts tests/doctor-launcher.test.ts",
|
|
18
|
-
"test:generated": "bun test tests/generated-templates.test.ts",
|
|
19
|
-
"test:generated:packaged-sdk": "bun scripts/verify-local-sdk-tarball.ts",
|
|
20
|
-
"test:slow": "bun run generate-test-apps && bun test ./tests/*.test.slow.ts --reporter=junit --reporter-outfile=junit-slow.xml",
|
|
21
|
-
"verify:all-sdks": "bun scripts/verify-all-sdks.ts",
|
|
22
|
-
"lint": "biome lint --error-on-warnings .",
|
|
23
|
-
"format:check": "biome format ."
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/bun": "^1"
|
|
27
|
-
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"typescript": "^6 || ^7"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// owner: jyoung-q
|
|
2
|
-
/**
|
|
3
|
-
* Removes generated template dirs.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { rmSync } from "node:fs";
|
|
7
|
-
import { GENERATED_APPS_DIR } from "./paths.ts";
|
|
8
|
-
|
|
9
|
-
rmSync(GENERATED_APPS_DIR, { recursive: true, force: true });
|
|
10
|
-
console.log(" Removed: generated-apps/");
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// owner: jyoung-q
|
|
2
|
-
/**
|
|
3
|
-
* Scaffolds all templates into generated-apps/template-<name>/.
|
|
4
|
-
* Run this before testing to create workspace-resolvable template instances.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { mkdirSync, rmSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
import { scaffoldApp } from "../../../projects/poe-tiles-cli/src/commands/init/scaffold.ts";
|
|
10
|
-
import { TEMPLATES } from "..";
|
|
11
|
-
import { GENERATED_APPS_DIR } from "./paths.ts";
|
|
12
|
-
|
|
13
|
-
mkdirSync(GENERATED_APPS_DIR, { recursive: true });
|
|
14
|
-
|
|
15
|
-
for (const template of TEMPLATES) {
|
|
16
|
-
const dir = join(GENERATED_APPS_DIR, `template-${template}`);
|
|
17
|
-
rmSync(dir, { recursive: true, force: true });
|
|
18
|
-
scaffoldApp({
|
|
19
|
-
appName: `template-${template}`,
|
|
20
|
-
template,
|
|
21
|
-
outputDir: dir,
|
|
22
|
-
// Generated apps live inside the monorepo workspace, so resolve
|
|
23
|
-
// `joiner-sdk` to `workspace:*` rather than the published tarball.
|
|
24
|
-
// Without this, the base template's mutator tests fail with
|
|
25
|
-
// "Export named 'waitForKeyExists' not found" because the tarball
|
|
26
|
-
// SDK lags the workspace SDK. The tarball path is exercised
|
|
27
|
-
// separately by `bun run test:generated-apps:all-sdks` /
|
|
28
|
-
// `verify-all-sdks.ts`.
|
|
29
|
-
internalMonoRepo: true,
|
|
30
|
-
// Mirror `poe-tiles tiles init` CLI defaults so the generated-apps
|
|
31
|
-
// suite verifies the actual getting-started experience — a user
|
|
32
|
-
// running the CLI with no flags gets `--blank` + `--skills`, and any
|
|
33
|
-
// regression that breaks build/test/e2e for that exact shape (or
|
|
34
|
-
// drops the bundled SDK skills) must fail this suite.
|
|
35
|
-
includeSkill: true,
|
|
36
|
-
blank: true,
|
|
37
|
-
});
|
|
38
|
-
console.log(` Generated: ${template}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// The store-less variant behind `poe-tiles tiles init --no-store`. Generated
|
|
42
|
-
// beside the default so the suite proves each template still installs,
|
|
43
|
-
// type-checks, tests, and builds with synced-store removed.
|
|
44
|
-
for (const template of TEMPLATES) {
|
|
45
|
-
const dir = join(GENERATED_APPS_DIR, `template-${template}-no-store`);
|
|
46
|
-
rmSync(dir, { recursive: true, force: true });
|
|
47
|
-
scaffoldApp({
|
|
48
|
-
appName: `template-${template}-no-store`,
|
|
49
|
-
template,
|
|
50
|
-
outputDir: dir,
|
|
51
|
-
internalMonoRepo: true,
|
|
52
|
-
includeSkill: true,
|
|
53
|
-
blank: true,
|
|
54
|
-
noStore: true,
|
|
55
|
-
});
|
|
56
|
-
console.log(` Generated (no-store): ${template}`);
|
|
57
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
/** Preserve only install evidence, never the scaffold's environment or credentials. */
|
|
6
|
-
export function saveInstallDiagnostics(
|
|
7
|
-
appDir: string,
|
|
8
|
-
outputDir: string,
|
|
9
|
-
): void {
|
|
10
|
-
mkdirSync(outputDir, { recursive: true });
|
|
11
|
-
for (const name of ["package.json", "bun.lock"]) {
|
|
12
|
-
const path = join(appDir, name);
|
|
13
|
-
if (existsSync(path)) copyFileSync(path, join(outputDir, name));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const appRequire = createRequire(join(appDir, "package.json"));
|
|
17
|
-
const resolutions: Record<string, string> = {};
|
|
18
|
-
try {
|
|
19
|
-
const vitePath = appRequire.resolve("vite/package.json");
|
|
20
|
-
resolutions["vite"] = vitePath;
|
|
21
|
-
copyFileSync(vitePath, join(outputDir, "vite-package.json"));
|
|
22
|
-
// Follow Vite's dependency graph, including a nested Rollup installation.
|
|
23
|
-
const rollupPath = createRequire(vitePath).resolve("rollup/package.json");
|
|
24
|
-
resolutions["rollup"] = rollupPath;
|
|
25
|
-
copyFileSync(rollupPath, join(outputDir, "rollup-package.json"));
|
|
26
|
-
const rollupRequire = createRequire(rollupPath);
|
|
27
|
-
const rollup: { optionalDependencies?: Record<string, string> } =
|
|
28
|
-
rollupRequire(rollupPath);
|
|
29
|
-
for (const name of Object.keys(rollup.optionalDependencies ?? {})) {
|
|
30
|
-
try {
|
|
31
|
-
resolutions[name] = rollupRequire.resolve(name);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
resolutions[name] = String(error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
} catch (error) {
|
|
37
|
-
resolutions["error"] = String(error);
|
|
38
|
-
}
|
|
39
|
-
writeFileSync(
|
|
40
|
-
join(outputDir, "resolution.json"),
|
|
41
|
-
JSON.stringify(
|
|
42
|
-
{
|
|
43
|
-
platform: process.platform,
|
|
44
|
-
arch: process.arch,
|
|
45
|
-
bun: Bun.version,
|
|
46
|
-
resolutions,
|
|
47
|
-
},
|
|
48
|
-
null,
|
|
49
|
-
2,
|
|
50
|
-
),
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// owner: jyoung-q
|
|
2
|
-
/** Shared path constants for template generation scripts and tests. */
|
|
3
|
-
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
5
|
-
|
|
6
|
-
export const MONOREPO_ROOT = resolve(import.meta.dir, "../../..");
|
|
7
|
-
export const GENERATED_APPS_DIR = join(MONOREPO_ROOT, "generated-apps");
|