@ontrails/trails 1.0.0-beta.15 → 1.0.0-beta.16
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 +197 -2
- package/README.md +27 -0
- package/package.json +19 -8
- package/src/app.ts +15 -5
- package/src/cli.ts +303 -10
- package/src/completions.ts +240 -0
- package/src/load-app-mirror.ts +160 -0
- package/src/local-state-io.ts +153 -0
- package/src/project-writes.ts +320 -0
- package/src/run-collision.ts +125 -0
- package/src/run-completions-install.ts +179 -0
- package/src/run-example.ts +149 -0
- package/src/run-examples.ts +148 -0
- package/src/run-quiet.ts +75 -0
- package/src/run-trace.ts +273 -0
- package/src/run-warden.ts +39 -0
- package/src/run-watch.ts +432 -0
- package/src/scaffold-versions.generated.ts +12 -0
- package/src/trails/add-surface.ts +45 -23
- package/src/trails/add-trail.ts +27 -17
- package/src/trails/add-verify.ts +57 -17
- package/src/trails/completions-complete.ts +165 -0
- package/src/trails/completions.ts +47 -0
- package/src/trails/create-scaffold.ts +86 -33
- package/src/trails/create.ts +11 -3
- package/src/trails/dev-clean.ts +6 -1
- package/src/trails/dev-reset.ts +6 -1
- package/src/trails/dev-stats.ts +6 -1
- package/src/trails/dev-support.ts +29 -17
- package/src/trails/draft-promote.ts +289 -80
- package/src/trails/guide.ts +54 -34
- package/src/trails/load-app.ts +251 -56
- package/src/trails/root-dir.ts +21 -0
- package/src/trails/run-example.ts +482 -0
- package/src/trails/run-examples.ts +141 -0
- package/src/trails/run.ts +403 -0
- package/src/trails/survey.ts +506 -200
- package/src/trails/topo-activation.ts +385 -0
- package/src/trails/topo-compile.ts +55 -0
- package/src/trails/topo-history.ts +6 -1
- package/src/trails/topo-output-schemas.ts +175 -0
- package/src/trails/topo-pin.ts +19 -6
- package/src/trails/topo-read-support.ts +171 -228
- package/src/trails/topo-reports.ts +400 -25
- package/src/trails/topo-store-support.ts +43 -19
- package/src/trails/topo-support.ts +18 -28
- package/src/trails/topo-unpin.ts +6 -1
- package/src/trails/topo-verify.ts +18 -5
- package/src/trails/topo.ts +60 -23
- package/src/trails/warden-guide.ts +121 -0
- package/src/trails/warden.ts +137 -56
- package/src/versions.ts +3 -18
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/__tests__/examples.test.ts +0 -45
- package/dist/bin/trails.d.ts +0 -3
- package/dist/bin/trails.d.ts.map +0 -1
- package/dist/bin/trails.js +0 -4
- package/dist/bin/trails.js.map +0 -1
- package/dist/src/app.d.ts +0 -2
- package/dist/src/app.d.ts.map +0 -1
- package/dist/src/app.js +0 -22
- package/dist/src/app.js.map +0 -1
- package/dist/src/clack.d.ts +0 -9
- package/dist/src/clack.d.ts.map +0 -1
- package/dist/src/clack.js +0 -84
- package/dist/src/clack.js.map +0 -1
- package/dist/src/cli.d.ts +0 -2
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -14
- package/dist/src/cli.js.map +0 -1
- package/dist/src/trails/add-surface.d.ts +0 -13
- package/dist/src/trails/add-surface.d.ts.map +0 -1
- package/dist/src/trails/add-surface.js +0 -110
- package/dist/src/trails/add-surface.js.map +0 -1
- package/dist/src/trails/add-trail.d.ts +0 -12
- package/dist/src/trails/add-trail.d.ts.map +0 -1
- package/dist/src/trails/add-trail.js +0 -104
- package/dist/src/trails/add-trail.js.map +0 -1
- package/dist/src/trails/add-trailhead.d.ts +0 -13
- package/dist/src/trails/add-trailhead.d.ts.map +0 -1
- package/dist/src/trails/add-trailhead.js +0 -88
- package/dist/src/trails/add-trailhead.js.map +0 -1
- package/dist/src/trails/add-verify.d.ts +0 -10
- package/dist/src/trails/add-verify.d.ts.map +0 -1
- package/dist/src/trails/add-verify.js +0 -68
- package/dist/src/trails/add-verify.js.map +0 -1
- package/dist/src/trails/create-scaffold.d.ts +0 -15
- package/dist/src/trails/create-scaffold.d.ts.map +0 -1
- package/dist/src/trails/create-scaffold.js +0 -295
- package/dist/src/trails/create-scaffold.js.map +0 -1
- package/dist/src/trails/create.d.ts +0 -18
- package/dist/src/trails/create.d.ts.map +0 -1
- package/dist/src/trails/create.js +0 -126
- package/dist/src/trails/create.js.map +0 -1
- package/dist/src/trails/dev-clean.d.ts +0 -9
- package/dist/src/trails/dev-clean.d.ts.map +0 -1
- package/dist/src/trails/dev-clean.js +0 -66
- package/dist/src/trails/dev-clean.js.map +0 -1
- package/dist/src/trails/dev-reset.d.ts +0 -6
- package/dist/src/trails/dev-reset.d.ts.map +0 -1
- package/dist/src/trails/dev-reset.js +0 -39
- package/dist/src/trails/dev-reset.js.map +0 -1
- package/dist/src/trails/dev-stats.d.ts +0 -7
- package/dist/src/trails/dev-stats.d.ts.map +0 -1
- package/dist/src/trails/dev-stats.js +0 -61
- package/dist/src/trails/dev-stats.js.map +0 -1
- package/dist/src/trails/dev-support.d.ts +0 -64
- package/dist/src/trails/dev-support.d.ts.map +0 -1
- package/dist/src/trails/dev-support.js +0 -181
- package/dist/src/trails/dev-support.js.map +0 -1
- package/dist/src/trails/draft-promote.d.ts +0 -18
- package/dist/src/trails/draft-promote.d.ts.map +0 -1
- package/dist/src/trails/draft-promote.js +0 -400
- package/dist/src/trails/draft-promote.js.map +0 -1
- package/dist/src/trails/guide.d.ts +0 -21
- package/dist/src/trails/guide.d.ts.map +0 -1
- package/dist/src/trails/guide.js +0 -61
- package/dist/src/trails/guide.js.map +0 -1
- package/dist/src/trails/load-app.d.ts +0 -12
- package/dist/src/trails/load-app.d.ts.map +0 -1
- package/dist/src/trails/load-app.js +0 -415
- package/dist/src/trails/load-app.js.map +0 -1
- package/dist/src/trails/project.d.ts +0 -8
- package/dist/src/trails/project.d.ts.map +0 -1
- package/dist/src/trails/project.js +0 -54
- package/dist/src/trails/project.js.map +0 -1
- package/dist/src/trails/survey.d.ts +0 -18
- package/dist/src/trails/survey.d.ts.map +0 -1
- package/dist/src/trails/survey.js +0 -234
- package/dist/src/trails/survey.js.map +0 -1
- package/dist/src/trails/topo-constants.d.ts +0 -3
- package/dist/src/trails/topo-constants.d.ts.map +0 -1
- package/dist/src/trails/topo-constants.js +0 -3
- package/dist/src/trails/topo-constants.js.map +0 -1
- package/dist/src/trails/topo-export.d.ts +0 -19
- package/dist/src/trails/topo-export.d.ts.map +0 -1
- package/dist/src/trails/topo-export.js +0 -31
- package/dist/src/trails/topo-export.js.map +0 -1
- package/dist/src/trails/topo-history.d.ts +0 -20
- package/dist/src/trails/topo-history.d.ts.map +0 -1
- package/dist/src/trails/topo-history.js +0 -32
- package/dist/src/trails/topo-history.js.map +0 -1
- package/dist/src/trails/topo-pin.d.ts +0 -17
- package/dist/src/trails/topo-pin.d.ts.map +0 -1
- package/dist/src/trails/topo-pin.js +0 -31
- package/dist/src/trails/topo-pin.js.map +0 -1
- package/dist/src/trails/topo-read-support.d.ts +0 -58
- package/dist/src/trails/topo-read-support.d.ts.map +0 -1
- package/dist/src/trails/topo-read-support.js +0 -167
- package/dist/src/trails/topo-read-support.js.map +0 -1
- package/dist/src/trails/topo-reports.d.ts +0 -54
- package/dist/src/trails/topo-reports.d.ts.map +0 -1
- package/dist/src/trails/topo-reports.js +0 -128
- package/dist/src/trails/topo-reports.js.map +0 -1
- package/dist/src/trails/topo-show.d.ts +0 -23
- package/dist/src/trails/topo-show.d.ts.map +0 -1
- package/dist/src/trails/topo-show.js +0 -49
- package/dist/src/trails/topo-show.js.map +0 -1
- package/dist/src/trails/topo-store-support.d.ts +0 -13
- package/dist/src/trails/topo-store-support.d.ts.map +0 -1
- package/dist/src/trails/topo-store-support.js +0 -55
- package/dist/src/trails/topo-store-support.js.map +0 -1
- package/dist/src/trails/topo-support.d.ts +0 -76
- package/dist/src/trails/topo-support.d.ts.map +0 -1
- package/dist/src/trails/topo-support.js +0 -132
- package/dist/src/trails/topo-support.js.map +0 -1
- package/dist/src/trails/topo-unpin.d.ts +0 -20
- package/dist/src/trails/topo-unpin.d.ts.map +0 -1
- package/dist/src/trails/topo-unpin.js +0 -44
- package/dist/src/trails/topo-unpin.js.map +0 -1
- package/dist/src/trails/topo-verify.d.ts +0 -5
- package/dist/src/trails/topo-verify.d.ts.map +0 -1
- package/dist/src/trails/topo-verify.js +0 -24
- package/dist/src/trails/topo-verify.js.map +0 -1
- package/dist/src/trails/topo.d.ts +0 -5
- package/dist/src/trails/topo.d.ts.map +0 -1
- package/dist/src/trails/topo.js +0 -63
- package/dist/src/trails/topo.js.map +0 -1
- package/dist/src/trails/warden.d.ts +0 -20
- package/dist/src/trails/warden.d.ts.map +0 -1
- package/dist/src/trails/warden.js +0 -98
- package/dist/src/trails/warden.js.map +0 -1
- package/dist/src/versions.d.ts +0 -12
- package/dist/src/versions.d.ts.map +0 -1
- package/dist/src/versions.js +0 -23
- package/dist/src/versions.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/__tests__/add-trail.test.ts +0 -97
- package/src/__tests__/create.test.ts +0 -415
- package/src/__tests__/draft-promote.test.ts +0 -144
- package/src/__tests__/guide.test.ts +0 -96
- package/src/__tests__/load-app.test.ts +0 -419
- package/src/__tests__/survey.test.ts +0 -377
- package/src/__tests__/topo-dev.test.ts +0 -426
- package/src/__tests__/warden.test.ts +0 -74
- package/src/trails/topo-export.ts +0 -35
- package/src/trails/topo-show.ts +0 -54
- package/tsconfig.json +0 -9
- package/tsconfig.tests.json +0 -10
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, rmSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { createTopoSnapshot as persistTopoSnapshot, listTopoSnapshots as readTopoSnapshots, pinTopoSnapshot, unpinTopoSnapshot, } from '@ontrails/core';
|
|
6
|
-
import { deriveTrailsDbPath } from '@ontrails/core/internal/trails-db';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
/** Output schema for a topo snapshot record. Shared across topo trails. */
|
|
9
|
-
export const topoSnapshotOutput = z.object({
|
|
10
|
-
createdAt: z.string(),
|
|
11
|
-
gitDirty: z.boolean(),
|
|
12
|
-
gitSha: z.string().optional(),
|
|
13
|
-
id: z.string(),
|
|
14
|
-
pinnedAs: z.string().optional(),
|
|
15
|
-
resourceCount: z.number(),
|
|
16
|
-
signalCount: z.number(),
|
|
17
|
-
trailCount: z.number(),
|
|
18
|
-
});
|
|
19
|
-
export const DEFAULT_APP_MODULE = './src/app.ts';
|
|
20
|
-
export const DEFAULT_TOPO_HISTORY_LIMIT = 10;
|
|
21
|
-
export const LOCK_PATH = '.trails/trails.lock';
|
|
22
|
-
const EXAMPLE_APP_MODULE = fileURLToPath(new URL('../app.ts', import.meta.url));
|
|
23
|
-
export const deriveRootDir = (cwd) => cwd ?? process.cwd();
|
|
24
|
-
const safeGit = (cwd, args) => {
|
|
25
|
-
const proc = Bun.spawnSync({
|
|
26
|
-
cmd: ['git', '-C', cwd, ...args],
|
|
27
|
-
stderr: 'ignore',
|
|
28
|
-
stdout: 'pipe',
|
|
29
|
-
});
|
|
30
|
-
if (!proc.success) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
const text = Buffer.from(proc.stdout).toString('utf8').trim();
|
|
34
|
-
return text.length === 0 ? undefined : text;
|
|
35
|
-
};
|
|
36
|
-
export const readGitState = (rootDir) => {
|
|
37
|
-
const gitSha = safeGit(rootDir, ['rev-parse', 'HEAD']);
|
|
38
|
-
const status = safeGit(rootDir, ['status', '--porcelain']);
|
|
39
|
-
return {
|
|
40
|
-
gitDirty: (status?.length ?? 0) > 0,
|
|
41
|
-
...(gitSha === undefined ? {} : { gitSha }),
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
export const deriveTopoCounts = (app) => ({
|
|
45
|
-
resourceCount: app.resources.size,
|
|
46
|
-
signalCount: app.signals.size,
|
|
47
|
-
trailCount: app.trails.size,
|
|
48
|
-
});
|
|
49
|
-
const emptyTopoHistory = (dbPath, limit) => ({
|
|
50
|
-
dbPath,
|
|
51
|
-
limit,
|
|
52
|
-
pinnedCount: 0,
|
|
53
|
-
snapshotCount: 0,
|
|
54
|
-
snapshots: [],
|
|
55
|
-
});
|
|
56
|
-
const collectTopoHistory = (dbPath, limit, snapshots) => ({
|
|
57
|
-
dbPath,
|
|
58
|
-
limit,
|
|
59
|
-
pinnedCount: snapshots.filter((snapshot) => snapshot.pinnedAs !== undefined)
|
|
60
|
-
.length,
|
|
61
|
-
snapshotCount: snapshots.length,
|
|
62
|
-
snapshots: snapshots.slice(0, limit),
|
|
63
|
-
});
|
|
64
|
-
const buildSnapshotInput = (app, rootDir) => ({
|
|
65
|
-
...readGitState(rootDir),
|
|
66
|
-
...deriveTopoCounts(app),
|
|
67
|
-
});
|
|
68
|
-
export const createIsolatedExampleInput = (name) => {
|
|
69
|
-
const rootDir = join(tmpdir(), 'ontrails-trails-examples', name);
|
|
70
|
-
rmSync(rootDir, { force: true, recursive: true });
|
|
71
|
-
mkdirSync(rootDir, { recursive: true });
|
|
72
|
-
return {
|
|
73
|
-
module: EXAMPLE_APP_MODULE,
|
|
74
|
-
rootDir,
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
export const createCurrentTopoSnapshot = (app, options) => {
|
|
78
|
-
const rootDir = deriveRootDir(options?.rootDir);
|
|
79
|
-
const result = persistTopoSnapshot(app, {
|
|
80
|
-
rootDir,
|
|
81
|
-
...buildSnapshotInput(app, rootDir),
|
|
82
|
-
});
|
|
83
|
-
if (result.isErr()) {
|
|
84
|
-
throw result.error;
|
|
85
|
-
}
|
|
86
|
-
return result.value;
|
|
87
|
-
};
|
|
88
|
-
export const listTopoHistory = (options) => {
|
|
89
|
-
const rootDir = deriveRootDir(options?.rootDir);
|
|
90
|
-
const limit = options?.limit ?? DEFAULT_TOPO_HISTORY_LIMIT;
|
|
91
|
-
const dbPath = deriveTrailsDbPath({ rootDir });
|
|
92
|
-
if (!existsSync(dbPath)) {
|
|
93
|
-
return emptyTopoHistory(dbPath, limit);
|
|
94
|
-
}
|
|
95
|
-
return collectTopoHistory(dbPath, limit, readTopoSnapshots({ rootDir }));
|
|
96
|
-
};
|
|
97
|
-
export const pinCurrentTopoSnapshot = (app, input) => {
|
|
98
|
-
const rootDir = deriveRootDir(input.rootDir);
|
|
99
|
-
const created = persistTopoSnapshot(app, {
|
|
100
|
-
rootDir,
|
|
101
|
-
...buildSnapshotInput(app, rootDir),
|
|
102
|
-
});
|
|
103
|
-
if (created.isErr()) {
|
|
104
|
-
throw created.error;
|
|
105
|
-
}
|
|
106
|
-
const snapshot = pinTopoSnapshot(created.value.id, input.name, {
|
|
107
|
-
rootDir,
|
|
108
|
-
});
|
|
109
|
-
if (snapshot === undefined) {
|
|
110
|
-
throw new Error(`Missing topo snapshot "${created.value.id}" to pin`);
|
|
111
|
-
}
|
|
112
|
-
return { snapshot };
|
|
113
|
-
};
|
|
114
|
-
export const removePinnedTopoSnapshot = (input) => {
|
|
115
|
-
const rootDir = deriveRootDir(input.rootDir);
|
|
116
|
-
if (!existsSync(deriveTrailsDbPath({ rootDir }))) {
|
|
117
|
-
return { dryRun: input.dryRun, removed: false };
|
|
118
|
-
}
|
|
119
|
-
if (input.dryRun) {
|
|
120
|
-
const snapshot = readTopoSnapshots({ pinned: true, rootDir }).find((candidate) => candidate.pinnedAs === input.name);
|
|
121
|
-
return snapshot === undefined
|
|
122
|
-
? { dryRun: true, removed: false }
|
|
123
|
-
: { dryRun: true, removed: false, snapshot };
|
|
124
|
-
}
|
|
125
|
-
const snapshot = unpinTopoSnapshot(input.name, { rootDir });
|
|
126
|
-
return {
|
|
127
|
-
dryRun: false,
|
|
128
|
-
removed: snapshot !== undefined,
|
|
129
|
-
...(snapshot === undefined ? {} : { snapshot }),
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=topo-support.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-support.js","sourceRoot":"","sources":["../../../src/trails/topo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IAC5D,OAAO;QACL,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,QAAQ,KAAK,SAAS;QAC/B,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const topoUnpinTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
dryRun: boolean;
|
|
3
|
-
name: string;
|
|
4
|
-
yes: boolean;
|
|
5
|
-
rootDir?: string | undefined;
|
|
6
|
-
}, {
|
|
7
|
-
dryRun: boolean;
|
|
8
|
-
removed: boolean;
|
|
9
|
-
snapshot?: {
|
|
10
|
-
createdAt: string;
|
|
11
|
-
gitDirty: boolean;
|
|
12
|
-
id: string;
|
|
13
|
-
resourceCount: number;
|
|
14
|
-
signalCount: number;
|
|
15
|
-
trailCount: number;
|
|
16
|
-
gitSha?: string | undefined;
|
|
17
|
-
pinnedAs?: string | undefined;
|
|
18
|
-
} | undefined;
|
|
19
|
-
}, never>;
|
|
20
|
-
//# sourceMappingURL=topo-unpin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-unpin.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;SA8CzB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Result, ValidationError, trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { createIsolatedExampleInput, removePinnedTopoSnapshot, topoSnapshotOutput, } from './topo-support.js';
|
|
4
|
-
export const topoUnpinTrail = trail('topo.unpin', {
|
|
5
|
-
blaze: (input, ctx) => {
|
|
6
|
-
if (input.dryRun !== true && input.yes !== true) {
|
|
7
|
-
return Result.err(new ValidationError('Refusing to remove a pin without `--yes` or `--dry-run`.'));
|
|
8
|
-
}
|
|
9
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
10
|
-
return Result.ok(removePinnedTopoSnapshot({
|
|
11
|
-
dryRun: input.dryRun,
|
|
12
|
-
name: input.name,
|
|
13
|
-
rootDir,
|
|
14
|
-
}));
|
|
15
|
-
},
|
|
16
|
-
description: 'Remove a named topo pin',
|
|
17
|
-
examples: [
|
|
18
|
-
{
|
|
19
|
-
input: {
|
|
20
|
-
...createIsolatedExampleInput('topo-unpin'),
|
|
21
|
-
dryRun: true,
|
|
22
|
-
name: 'before-auth-refactor',
|
|
23
|
-
},
|
|
24
|
-
name: 'Preview pin removal',
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
input: z.object({
|
|
28
|
-
dryRun: z
|
|
29
|
-
.boolean()
|
|
30
|
-
.default(true)
|
|
31
|
-
.describe('Preview the removal without changing state'),
|
|
32
|
-
name: z.string().describe('Pin name'),
|
|
33
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
34
|
-
yes: z.boolean().default(false).describe('Confirm destructive changes'),
|
|
35
|
-
}),
|
|
36
|
-
intent: 'destroy',
|
|
37
|
-
output: z.object({
|
|
38
|
-
dryRun: z.boolean(),
|
|
39
|
-
removed: z.boolean(),
|
|
40
|
-
snapshot: topoSnapshotOutput.optional(),
|
|
41
|
-
}),
|
|
42
|
-
permit: { scopes: ['topo:delete'] },
|
|
43
|
-
});
|
|
44
|
-
//# sourceMappingURL=topo-unpin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-unpin.js","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,GACnB,MA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,SAAS;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;QACnB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;QACpB,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;KACxC,CAAC;IACF,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,aAAa,CAAC,EAAE;CACpC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-verify.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;uDAkB1B,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { loadApp } from './load-app.js';
|
|
4
|
-
import { verifyCurrentTopo } from './topo-read-support.js';
|
|
5
|
-
export const topoVerifyTrail = trail('topo.verify', {
|
|
6
|
-
blaze: async (input, ctx) => {
|
|
7
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
8
|
-
const app = await loadApp(input.module, rootDir);
|
|
9
|
-
return verifyCurrentTopo(app, { rootDir });
|
|
10
|
-
},
|
|
11
|
-
description: 'Verify that the committed lockfile matches the current topo',
|
|
12
|
-
input: z.object({
|
|
13
|
-
module: z.string().optional().describe('Path to the app module'),
|
|
14
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
15
|
-
}),
|
|
16
|
-
intent: 'read',
|
|
17
|
-
output: z.object({
|
|
18
|
-
committedHash: z.string(),
|
|
19
|
-
currentHash: z.string(),
|
|
20
|
-
lockPath: z.string(),
|
|
21
|
-
stale: z.literal(false),
|
|
22
|
-
}),
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=topo-verify.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-verify.js","sourceRoot":"","sources":["../../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oot":"","sources":["../../../src/trails/topo.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,SAAS;;;wDAmBpB,CAAC"}
|
package/dist/src/trails/topo.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Result, trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { loadApp } from './load-app.js';
|
|
4
|
-
import { buildTopoSummary } from './topo-read-support.js';
|
|
5
|
-
const summaryOutput = z.object({
|
|
6
|
-
app: z.object({
|
|
7
|
-
contractVersion: z.string(),
|
|
8
|
-
features: z.object({
|
|
9
|
-
detours: z.boolean(),
|
|
10
|
-
examples: z.boolean(),
|
|
11
|
-
outputSchemas: z.boolean(),
|
|
12
|
-
resources: z.boolean(),
|
|
13
|
-
signals: z.boolean(),
|
|
14
|
-
}),
|
|
15
|
-
name: z.string(),
|
|
16
|
-
resources: z.number(),
|
|
17
|
-
signals: z.number(),
|
|
18
|
-
trails: z.number(),
|
|
19
|
-
version: z.string(),
|
|
20
|
-
}),
|
|
21
|
-
dbPath: z.string(),
|
|
22
|
-
list: z.object({
|
|
23
|
-
count: z.number(),
|
|
24
|
-
entries: z.array(z.object({
|
|
25
|
-
examples: z.number(),
|
|
26
|
-
id: z.string(),
|
|
27
|
-
kind: z.string(),
|
|
28
|
-
safety: z.string(),
|
|
29
|
-
})),
|
|
30
|
-
resourceCount: z.number(),
|
|
31
|
-
resources: z.array(z.object({
|
|
32
|
-
description: z.string().nullable(),
|
|
33
|
-
health: z.enum(['available', 'none']),
|
|
34
|
-
id: z.string(),
|
|
35
|
-
kind: z.literal('resource'),
|
|
36
|
-
lifetime: z.literal('singleton'),
|
|
37
|
-
usedBy: z.array(z.string()),
|
|
38
|
-
})),
|
|
39
|
-
}),
|
|
40
|
-
lockExists: z.boolean(),
|
|
41
|
-
lockPath: z.string(),
|
|
42
|
-
});
|
|
43
|
-
export const topoTrail = trail('topo', {
|
|
44
|
-
blaze: async (input, ctx) => {
|
|
45
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
46
|
-
const app = await loadApp(input.module, rootDir);
|
|
47
|
-
return Result.ok(buildTopoSummary(app, { rootDir }));
|
|
48
|
-
},
|
|
49
|
-
description: 'Show the current topo summary and entry list',
|
|
50
|
-
examples: [
|
|
51
|
-
{
|
|
52
|
-
input: {},
|
|
53
|
-
name: 'Show the current topo summary',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
input: z.object({
|
|
57
|
-
module: z.string().optional().describe('Path to the app module'),
|
|
58
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
59
|
-
}),
|
|
60
|
-
intent: 'read',
|
|
61
|
-
output: summaryOutput,
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=topo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo.js","sourceRoot":"","sources":["../../../src/trails/topo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC;QACZ,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;YACpB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;YACrB,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;YAC1B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;YACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;SACrB,CAAC;QACF,IAAI,EAAE,CAAC,CAAC,MA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AK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,WAAW,EAAE,8CAA8C;IAC3D,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,+BAA+B;SACtC;KACF;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAChE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KACpE,CAAC;IACF,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,aAAa;CACtB,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `warden` trail -- Governance checks.
|
|
3
|
-
*
|
|
4
|
-
* Thin wrapper around `runWarden` and `formatWardenReport` from @ontrails/warden.
|
|
5
|
-
*/
|
|
6
|
-
export declare const wardenTrail: import("@ontrails/core").Trail<{
|
|
7
|
-
driftOnly: boolean;
|
|
8
|
-
format: "text" | "summary" | "json" | "github";
|
|
9
|
-
lintOnly: boolean;
|
|
10
|
-
module?: string | undefined;
|
|
11
|
-
rootDir?: string | undefined;
|
|
12
|
-
}, {
|
|
13
|
-
diagnostics: readonly import("@ontrails/warden").WardenDiagnostic[];
|
|
14
|
-
drift: import("@ontrails/warden").DriftResult | null;
|
|
15
|
-
errorCount: number;
|
|
16
|
-
formatted: string;
|
|
17
|
-
passed: boolean;
|
|
18
|
-
warnCount: number;
|
|
19
|
-
}, never>;
|
|
20
|
-
//# sourceMappingURL=warden.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warden.d.ts","sourceRoot":"","sources":["../../../src/trails/warden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,eAAO,MAAM,WAAW;;;;;;;;;;;;;SA2FtB,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `warden` trail -- Governance checks.
|
|
3
|
-
*
|
|
4
|
-
* Thin wrapper around `runWarden` and `formatWardenReport` from @ontrails/warden.
|
|
5
|
-
*/
|
|
6
|
-
import { Result, trail } from '@ontrails/core';
|
|
7
|
-
import { formatGitHubAnnotations, formatJson, formatSummary, formatWardenReport, runWarden, } from '@ontrails/warden';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import { loadApp } from './load-app.js';
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
// Trail definition
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
export const wardenTrail = trail('warden', {
|
|
14
|
-
blaze: async (input, ctx) => {
|
|
15
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
16
|
-
// oxlint-disable-next-line prefer-await-to-then -- catch preserves graceful degradation
|
|
17
|
-
const topo = await loadApp(input.module, rootDir).catch((error) => {
|
|
18
|
-
ctx.logger?.warn('Could not load app for topo-aware governance', {
|
|
19
|
-
error: error instanceof Error ? error.message : String(error),
|
|
20
|
-
});
|
|
21
|
-
return undefined;
|
|
22
|
-
});
|
|
23
|
-
const report = await runWarden({
|
|
24
|
-
driftOnly: input.driftOnly,
|
|
25
|
-
lintOnly: input.lintOnly,
|
|
26
|
-
rootDir,
|
|
27
|
-
topo,
|
|
28
|
-
});
|
|
29
|
-
const formatters = {
|
|
30
|
-
github: formatGitHubAnnotations,
|
|
31
|
-
json: formatJson,
|
|
32
|
-
summary: formatSummary,
|
|
33
|
-
text: formatWardenReport,
|
|
34
|
-
};
|
|
35
|
-
const formatter = formatters[input.format] ?? formatWardenReport;
|
|
36
|
-
const formatted = formatter(report);
|
|
37
|
-
return Result.ok({
|
|
38
|
-
diagnostics: report.diagnostics,
|
|
39
|
-
drift: report.drift,
|
|
40
|
-
errorCount: report.errorCount,
|
|
41
|
-
formatted,
|
|
42
|
-
passed: report.passed,
|
|
43
|
-
warnCount: report.warnCount,
|
|
44
|
-
});
|
|
45
|
-
},
|
|
46
|
-
description: 'Run governance checks (lint + drift)',
|
|
47
|
-
examples: [
|
|
48
|
-
{
|
|
49
|
-
input: {
|
|
50
|
-
driftOnly: false,
|
|
51
|
-
lintOnly: false,
|
|
52
|
-
},
|
|
53
|
-
name: 'Default warden run',
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
input: {
|
|
57
|
-
format: 'github',
|
|
58
|
-
},
|
|
59
|
-
name: 'GitHub Actions annotations',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
input: z.object({
|
|
63
|
-
driftOnly: z.boolean().default(false).describe('Only run drift detection'),
|
|
64
|
-
format: z
|
|
65
|
-
.enum(['text', 'json', 'github', 'summary'])
|
|
66
|
-
.default('text')
|
|
67
|
-
.describe('Output format: text, json, github, or summary'),
|
|
68
|
-
lintOnly: z.boolean().default(false).describe('Only run lint rules'),
|
|
69
|
-
module: z
|
|
70
|
-
.string()
|
|
71
|
-
.optional()
|
|
72
|
-
.describe('App module path (auto-discovered if omitted)'),
|
|
73
|
-
rootDir: z.string().optional().describe('Root directory to scan'),
|
|
74
|
-
}),
|
|
75
|
-
intent: 'read',
|
|
76
|
-
output: z.object({
|
|
77
|
-
diagnostics: z.array(z.object({
|
|
78
|
-
filePath: z.string(),
|
|
79
|
-
line: z.number(),
|
|
80
|
-
message: z.string(),
|
|
81
|
-
rule: z.string(),
|
|
82
|
-
severity: z.enum(['error', 'warn']),
|
|
83
|
-
})),
|
|
84
|
-
drift: z
|
|
85
|
-
.object({
|
|
86
|
-
blockedReason: z.string().optional(),
|
|
87
|
-
committedHash: z.string().nullable(),
|
|
88
|
-
currentHash: z.string(),
|
|
89
|
-
stale: z.boolean(),
|
|
90
|
-
})
|
|
91
|
-
.nullable(),
|
|
92
|
-
errorCount: z.number(),
|
|
93
|
-
formatted: z.string(),
|
|
94
|
-
passed: z.boolean(),
|
|
95
|
-
warnCount: z.number(),
|
|
96
|
-
}),
|
|
97
|
-
});
|
|
98
|
-
//# sourceMappingURL=warden.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warden.js","sourceRoot":"","sources":["../../../src/trails/warden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,EAAE;IACzC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1D,wFAAwF;QACxF,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,CACrD,CAAC,KAAc,EAAa,EAAE;YAC5B,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,8CAA8C,EAAE;gBAC/D,KAAK,EAAE,KAAK,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;QACrB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;CACH,CAAC,CAAC"}
|
package/dist/src/versions.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const trailsPackageVersion: string;
|
|
2
|
-
export declare const ontrailsPackageRange: string;
|
|
3
|
-
export declare const scaffoldDependencyVersions: {
|
|
4
|
-
readonly bunTypes: string;
|
|
5
|
-
readonly commander: string;
|
|
6
|
-
readonly lefthook: string;
|
|
7
|
-
readonly oxlint: string;
|
|
8
|
-
readonly typescript: string;
|
|
9
|
-
readonly ultracite: string;
|
|
10
|
-
readonly zod: string;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../src/versions.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,oBAAoB,QAGhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,QAA6B,CAAC;AAE/D,eAAO,MAAM,0BAA0B;;;;;;;;CAQ7B,CAAC"}
|
package/dist/src/versions.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const readPackageJson = async (url) => (await Bun.file(url).json());
|
|
2
|
-
const appPackageJson = await readPackageJson(new URL('../package.json', import.meta.url));
|
|
3
|
-
const rootPackageJson = await readPackageJson(new URL('../../../package.json', import.meta.url));
|
|
4
|
-
const requireVersion = (value, label) => {
|
|
5
|
-
if (typeof value !== 'string' || value.length === 0) {
|
|
6
|
-
throw new Error(`Missing version for ${label}`);
|
|
7
|
-
}
|
|
8
|
-
return value;
|
|
9
|
-
};
|
|
10
|
-
const rootCatalog = rootPackageJson.catalog ?? {};
|
|
11
|
-
const rootDevDependencies = rootPackageJson.devDependencies ?? {};
|
|
12
|
-
export const trailsPackageVersion = requireVersion(appPackageJson.version, '@ontrails/trails');
|
|
13
|
-
export const ontrailsPackageRange = `^${trailsPackageVersion}`;
|
|
14
|
-
export const scaffoldDependencyVersions = {
|
|
15
|
-
bunTypes: requireVersion(rootDevDependencies['@types/bun'], '@types/bun'),
|
|
16
|
-
commander: requireVersion(rootCatalog['commander'], 'commander'),
|
|
17
|
-
lefthook: requireVersion(rootDevDependencies['lefthook'], 'lefthook'),
|
|
18
|
-
oxlint: requireVersion(rootDevDependencies['oxlint'], 'oxlint'),
|
|
19
|
-
typescript: requireVersion(rootDevDependencies['typescript'], 'typescript'),
|
|
20
|
-
ultracite: requireVersion(rootDevDependencies['ultracite'], 'ultracite'),
|
|
21
|
-
zod: requireVersion(rootCatalog['zod'], 'zod'),
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=versions.js.map
|
package/dist/src/versions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/versions.ts"],"names":[],"mappings":"AAOA,MAAM,eAAe,GAAG,KAAK,EAAE,GAAQ,EAAwB,EAAE,CAC/D,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAgB,CAAC;AAE9C,MAAM,cAAc,GAAG,MAAM,eAAe,CAC1C,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAC5C,CAAC;AACF,MAAM,eAAe,GAAG,MAAM,eAAe,CAC3C,IAAI,GAAG,CAAC,uBAAuB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAClD,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAyB,EAAE,KAAa,EAAU,EAAE;IAC1E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,IAAI,EAAE,CAAC;AAClD,MAAM,mBAAmB,GAAG,eAAe,CAAC,eAAe,IAAI,EAAE,CAAC;AAElE,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAChD,cAAc,CAAC,OAAO,EACtB,kBAAkB,CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAE/D,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACzE,SAAS,EAAE,cAAc,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IAChE,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACrE,MAAM,EAAE,cAAc,CAAC,mBAAmB,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC/D,UAAU,EAAE,cAAc,CAAC,mBAAmB,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC3E,SAAS,EAAE,cAAc,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACxE,GAAG,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"root":["../src/app.ts","../src/clack.ts","../src/cli.ts","../src/versions.ts","../src/trails/add-surface.ts","../src/trails/add-trail.ts","../src/trails/add-verify.ts","../src/trails/create-scaffold.ts","../src/trails/create.ts","../src/trails/dev-clean.ts","../src/trails/dev-reset.ts","../src/trails/dev-stats.ts","../src/trails/dev-support.ts","../src/trails/draft-promote.ts","../src/trails/guide.ts","../src/trails/load-app.ts","../src/trails/project.ts","../src/trails/survey.ts","../src/trails/topo-constants.ts","../src/trails/topo-export.ts","../src/trails/topo-history.ts","../src/trails/topo-pin.ts","../src/trails/topo-read-support.ts","../src/trails/topo-reports.ts","../src/trails/topo-show.ts","../src/trails/topo-store-support.ts","../src/trails/topo-support.ts","../src/trails/topo-unpin.ts","../src/trails/topo-verify.ts","../src/trails/topo.ts","../src/trails/warden.ts","../bin/trails.ts"],"version":"5.9.3"}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs';
|
|
3
|
-
import { join, resolve } from 'node:path';
|
|
4
|
-
|
|
5
|
-
import type { Result } from '@ontrails/core';
|
|
6
|
-
import { ValidationError, validateInput } from '@ontrails/core';
|
|
7
|
-
|
|
8
|
-
import { addTrail } from '../trails/add-trail.js';
|
|
9
|
-
|
|
10
|
-
const repoTempDir = (): string =>
|
|
11
|
-
join(
|
|
12
|
-
resolve(import.meta.dir, '../..'),
|
|
13
|
-
'.tmp-tests',
|
|
14
|
-
`add-trail-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const expectOk = <T>(result: Result<T, Error>): T => {
|
|
18
|
-
if (result.isErr()) {
|
|
19
|
-
throw result.error;
|
|
20
|
-
}
|
|
21
|
-
return result.value;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const expectValidationError = (
|
|
25
|
-
result: Result<unknown, Error>
|
|
26
|
-
): ValidationError => {
|
|
27
|
-
if (result.isOk()) {
|
|
28
|
-
throw new Error('Expected validation error');
|
|
29
|
-
}
|
|
30
|
-
expect(result.error).toBeInstanceOf(ValidationError);
|
|
31
|
-
return result.error as ValidationError;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const readGeneratedFile = (dir: string, relativePath: string): string => {
|
|
35
|
-
const filePath = join(dir, relativePath);
|
|
36
|
-
expect(existsSync(filePath)).toBe(true);
|
|
37
|
-
return readFileSync(filePath, 'utf8');
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const assertGeneratedScaffold = (dir: string): void => {
|
|
41
|
-
const trailSource = readGeneratedFile(dir, 'src/trails/entity-prepare.ts');
|
|
42
|
-
const testSource = readGeneratedFile(dir, '__tests__/entity-prepare.test.ts');
|
|
43
|
-
|
|
44
|
-
expect(trailSource).toContain('description: "Prepare an entity for export"');
|
|
45
|
-
expect(trailSource).toContain('name: "Prepare a draft entity"');
|
|
46
|
-
expect(trailSource).toContain(
|
|
47
|
-
'expected: { message: "entity.prepare completed" }'
|
|
48
|
-
);
|
|
49
|
-
expect(testSource).toContain('description: "Prepare a draft entity"');
|
|
50
|
-
expect(testSource).toContain(
|
|
51
|
-
'expectValue: { message: "entity.prepare completed" }'
|
|
52
|
-
);
|
|
53
|
-
expect(trailSource).not.toContain('TODO');
|
|
54
|
-
expect(testSource).not.toContain('TODO');
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
describe('add.trail', () => {
|
|
58
|
-
test('requires authored description and example metadata', () => {
|
|
59
|
-
const error = expectValidationError(
|
|
60
|
-
validateInput(addTrail.input, {
|
|
61
|
-
id: 'entity.prepare',
|
|
62
|
-
intent: 'write',
|
|
63
|
-
})
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
expect(error.message).toContain('description');
|
|
67
|
-
expect(error.message).toContain('exampleName');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('writes starter files without TODO placeholders', async () => {
|
|
71
|
-
const dir = repoTempDir();
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
mkdirSync(dir, { recursive: true });
|
|
75
|
-
|
|
76
|
-
const result = expectOk(
|
|
77
|
-
await addTrail.blaze(
|
|
78
|
-
{
|
|
79
|
-
description: 'Prepare an entity for export',
|
|
80
|
-
exampleName: 'Prepare a draft entity',
|
|
81
|
-
id: 'entity.prepare',
|
|
82
|
-
intent: 'write',
|
|
83
|
-
},
|
|
84
|
-
{ cwd: dir } as never
|
|
85
|
-
)
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
expect(result.created).toEqual([
|
|
89
|
-
'src/trails/entity-prepare.ts',
|
|
90
|
-
'__tests__/entity-prepare.test.ts',
|
|
91
|
-
]);
|
|
92
|
-
assertGeneratedScaffold(dir);
|
|
93
|
-
} finally {
|
|
94
|
-
rmSync(dir, { force: true, recursive: true });
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|