@ontrails/trails 1.0.0-beta.19 → 1.0.0-beta.21
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/CHANGELOG.md +83 -0
- package/README.md +2 -0
- package/package.json +19 -13
- package/src/app.ts +43 -1
- package/src/cli.ts +10 -1
- package/src/load-app-mirror.ts +42 -0
- package/src/mcp-app.ts +30 -0
- package/src/mcp-options.ts +77 -0
- package/src/mcp.ts +8 -0
- package/src/release/bindings.ts +39 -0
- package/src/release/check.ts +818 -0
- package/src/release/config.ts +63 -0
- package/src/release/contract-facts.ts +425 -0
- package/src/release/index.ts +85 -0
- package/src/release/native-bun-publish.ts +651 -0
- package/src/release/native-bun-registry.ts +350 -0
- package/src/release/packed-artifacts-smoke.ts +236 -0
- package/src/release/smoke.ts +46 -0
- package/src/release/wayfinder-dogfood-smoke.ts +226 -0
- package/src/run-release-check.ts +74 -0
- package/src/scaffold-version-sync.ts +183 -0
- package/src/scaffold-versions.generated.ts +1 -1
- package/src/trails/compile.ts +13 -9
- package/src/trails/create-versions.ts +62 -0
- package/src/trails/guide.ts +10 -6
- package/src/trails/load-app.ts +440 -49
- package/src/trails/release-check.ts +104 -0
- package/src/trails/release-smoke.ts +48 -0
- package/src/trails/run-example.ts +17 -13
- package/src/trails/run-examples.ts +16 -12
- package/src/trails/run.ts +22 -18
- package/src/trails/topo-history.ts +12 -8
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `release.smoke` trail -- Local release confidence checks.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Result, trail, ValidationError } from '@ontrails/core';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
|
|
8
|
+
import { releaseSmokeCheckValues, runReleaseSmoke } from '../release/smoke.js';
|
|
9
|
+
|
|
10
|
+
const releaseSmokeCheckSchema = z.enum(releaseSmokeCheckValues);
|
|
11
|
+
|
|
12
|
+
const releaseSmokeInputSchema = z.object({
|
|
13
|
+
check: z.string().default('all').describe('Release smoke check to run'),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const releaseSmokeCheckResultSchema = z.object({
|
|
17
|
+
check: z.enum(['packed-artifacts', 'wayfinder-dogfood']),
|
|
18
|
+
message: z.string(),
|
|
19
|
+
packageCount: z.number().optional(),
|
|
20
|
+
passed: z.literal(true),
|
|
21
|
+
trailCount: z.number().optional(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const releaseSmokeOutputSchema = z.object({
|
|
25
|
+
checks: z.array(releaseSmokeCheckResultSchema).readonly(),
|
|
26
|
+
message: z.string(),
|
|
27
|
+
passed: z.literal(true),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const releaseSmokeTrail = trail('release.smoke', {
|
|
31
|
+
blaze: async (input) => {
|
|
32
|
+
try {
|
|
33
|
+
const check = releaseSmokeCheckSchema.parse(input.check);
|
|
34
|
+
return Result.ok(await runReleaseSmoke(check));
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return Result.err(
|
|
37
|
+
new ValidationError(
|
|
38
|
+
error instanceof Error ? error.message : String(error)
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
description: 'Run local release confidence smoke checks',
|
|
44
|
+
input: releaseSmokeInputSchema,
|
|
45
|
+
intent: 'read',
|
|
46
|
+
output: releaseSmokeOutputSchema,
|
|
47
|
+
permit: 'public',
|
|
48
|
+
});
|
|
@@ -423,9 +423,24 @@ const buildComparisonEnvelope = async (
|
|
|
423
423
|
});
|
|
424
424
|
};
|
|
425
425
|
|
|
426
|
+
const runExampleTrailInputSchema = z.object({
|
|
427
|
+
app: z
|
|
428
|
+
.string()
|
|
429
|
+
.optional()
|
|
430
|
+
.describe(
|
|
431
|
+
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
432
|
+
),
|
|
433
|
+
exampleName: z.string().describe('Name of the example to run'),
|
|
434
|
+
id: z.string().describe('Trail ID whose example should run'),
|
|
435
|
+
module: z.string().optional().describe('Path to the app module'),
|
|
436
|
+
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
type RunExampleTrailInput = z.output<typeof runExampleTrailInputSchema>;
|
|
440
|
+
|
|
426
441
|
export const runExampleTrail = trail('run.example', {
|
|
427
442
|
args: ['id', 'exampleName'],
|
|
428
|
-
blaze: async (input, ctx) => {
|
|
443
|
+
blaze: async (input: RunExampleTrailInput, ctx) => {
|
|
429
444
|
const rootDirResult = resolveTrailRootDir(input.rootDir, ctx.cwd);
|
|
430
445
|
if (rootDirResult.isErr()) {
|
|
431
446
|
return rootDirResult;
|
|
@@ -469,18 +484,7 @@ export const runExampleTrail = trail('run.example', {
|
|
|
469
484
|
name: 'Run named example',
|
|
470
485
|
},
|
|
471
486
|
],
|
|
472
|
-
input:
|
|
473
|
-
app: z
|
|
474
|
-
.string()
|
|
475
|
-
.optional()
|
|
476
|
-
.describe(
|
|
477
|
-
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
478
|
-
),
|
|
479
|
-
exampleName: z.string().describe('Name of the example to run'),
|
|
480
|
-
id: z.string().describe('Trail ID whose example should run'),
|
|
481
|
-
module: z.string().optional().describe('Path to the app module'),
|
|
482
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
483
|
-
}),
|
|
487
|
+
input: runExampleTrailInputSchema,
|
|
484
488
|
intent: 'write',
|
|
485
489
|
output: runExampleComparisonSchema,
|
|
486
490
|
permit: { scopes: ['trails:run'] },
|
|
@@ -84,9 +84,23 @@ const buildExamplesListing = (
|
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
const runExamplesTrailInputSchema = z.object({
|
|
88
|
+
app: z
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe(
|
|
92
|
+
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
93
|
+
),
|
|
94
|
+
id: z.string().describe('Trail ID whose examples should be listed'),
|
|
95
|
+
module: z.string().optional().describe('Path to the app module'),
|
|
96
|
+
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
type RunExamplesTrailInput = z.output<typeof runExamplesTrailInputSchema>;
|
|
100
|
+
|
|
87
101
|
export const runExamplesTrail = trail('run.examples', {
|
|
88
102
|
args: ['id'],
|
|
89
|
-
blaze: async (input, ctx) => {
|
|
103
|
+
blaze: async (input: RunExamplesTrailInput, ctx) => {
|
|
90
104
|
const rootDirResult = resolveTrailRootDir(input.rootDir, ctx.cwd);
|
|
91
105
|
if (rootDirResult.isErr()) {
|
|
92
106
|
return rootDirResult;
|
|
@@ -125,17 +139,7 @@ export const runExamplesTrail = trail('run.examples', {
|
|
|
125
139
|
name: 'List trail examples',
|
|
126
140
|
},
|
|
127
141
|
],
|
|
128
|
-
input:
|
|
129
|
-
app: z
|
|
130
|
-
.string()
|
|
131
|
-
.optional()
|
|
132
|
-
.describe(
|
|
133
|
-
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
134
|
-
),
|
|
135
|
-
id: z.string().describe('Trail ID whose examples should be listed'),
|
|
136
|
-
module: z.string().optional().describe('Path to the app module'),
|
|
137
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
138
|
-
}),
|
|
142
|
+
input: runExamplesTrailInputSchema,
|
|
139
143
|
intent: 'read',
|
|
140
144
|
output: runExamplesListingSchema,
|
|
141
145
|
});
|
package/src/trails/run.ts
CHANGED
|
@@ -313,13 +313,33 @@ const buildAmbiguousExampleInput = (): {
|
|
|
313
313
|
return { id: 'shared.id', rootDir: root };
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
+
const runTrailInputSchema = z.object({
|
|
317
|
+
app: z
|
|
318
|
+
.string()
|
|
319
|
+
.optional()
|
|
320
|
+
.describe(
|
|
321
|
+
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
322
|
+
),
|
|
323
|
+
id: z.string().describe('Trail ID to invoke'),
|
|
324
|
+
input: z
|
|
325
|
+
.unknown()
|
|
326
|
+
.optional()
|
|
327
|
+
.describe(
|
|
328
|
+
'Parsed input for the resolved trail; the CLI surface JSON.parses the inline argument before passing it through'
|
|
329
|
+
),
|
|
330
|
+
module: z.string().optional().describe('Path to the app module'),
|
|
331
|
+
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
type RunTrailInput = z.output<typeof runTrailInputSchema>;
|
|
335
|
+
|
|
316
336
|
// ---------------------------------------------------------------------------
|
|
317
337
|
// Trail definition
|
|
318
338
|
// ---------------------------------------------------------------------------
|
|
319
339
|
|
|
320
340
|
export const runTrail = trail('run', {
|
|
321
341
|
args: ['id'],
|
|
322
|
-
blaze: async (input, ctx) => {
|
|
342
|
+
blaze: async (input: RunTrailInput, ctx) => {
|
|
323
343
|
const rootDirResult = resolveTrailRootDir(input.rootDir, ctx.cwd);
|
|
324
344
|
if (rootDirResult.isErr()) {
|
|
325
345
|
return rootDirResult;
|
|
@@ -383,23 +403,7 @@ export const runTrail = trail('run', {
|
|
|
383
403
|
name: 'Reject ambiguous trail ID without --app',
|
|
384
404
|
},
|
|
385
405
|
],
|
|
386
|
-
input:
|
|
387
|
-
app: z
|
|
388
|
-
.string()
|
|
389
|
-
.optional()
|
|
390
|
-
.describe(
|
|
391
|
-
'Workspace app to resolve the trail ID against; required when the ID is exposed by more than one app'
|
|
392
|
-
),
|
|
393
|
-
id: z.string().describe('Trail ID to invoke'),
|
|
394
|
-
input: z
|
|
395
|
-
.unknown()
|
|
396
|
-
.optional()
|
|
397
|
-
.describe(
|
|
398
|
-
'Parsed input for the resolved trail; the CLI surface JSON.parses the inline argument before passing it through'
|
|
399
|
-
),
|
|
400
|
-
module: z.string().optional().describe('Path to the app module'),
|
|
401
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
402
|
-
}),
|
|
406
|
+
input: runTrailInputSchema,
|
|
403
407
|
intent: 'write',
|
|
404
408
|
output: innerTrailResultSchema,
|
|
405
409
|
permit: { scopes: ['trails:run'] },
|
|
@@ -9,8 +9,18 @@ import {
|
|
|
9
9
|
} from './topo-support.js';
|
|
10
10
|
import { resolveTrailRootDir } from './root-dir.js';
|
|
11
11
|
|
|
12
|
+
const topoHistoryTrailInputSchema = z.object({
|
|
13
|
+
limit: z
|
|
14
|
+
.number()
|
|
15
|
+
.default(DEFAULT_TOPO_HISTORY_LIMIT)
|
|
16
|
+
.describe('Maximum number of snapshots to return'),
|
|
17
|
+
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
type TopoHistoryTrailInput = z.output<typeof topoHistoryTrailInputSchema>;
|
|
21
|
+
|
|
12
22
|
export const topoHistoryTrail = trail('topo.history', {
|
|
13
|
-
blaze: (input, ctx) => {
|
|
23
|
+
blaze: (input: TopoHistoryTrailInput, ctx) => {
|
|
14
24
|
const rootDirResult = resolveTrailRootDir(input.rootDir, ctx.cwd);
|
|
15
25
|
if (rootDirResult.isErr()) {
|
|
16
26
|
return rootDirResult;
|
|
@@ -25,13 +35,7 @@ export const topoHistoryTrail = trail('topo.history', {
|
|
|
25
35
|
name: 'Show topo history',
|
|
26
36
|
},
|
|
27
37
|
],
|
|
28
|
-
input:
|
|
29
|
-
limit: z
|
|
30
|
-
.number()
|
|
31
|
-
.default(DEFAULT_TOPO_HISTORY_LIMIT)
|
|
32
|
-
.describe('Maximum number of snapshots to return'),
|
|
33
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
34
|
-
}),
|
|
38
|
+
input: topoHistoryTrailInputSchema,
|
|
35
39
|
intent: 'read',
|
|
36
40
|
output: z.object({
|
|
37
41
|
dbPath: z.string(),
|