@ontrails/trails 1.0.0-beta.14 → 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 +208 -0
- package/README.md +27 -0
- package/package.json +19 -8
- package/src/app.ts +17 -7
- package/src/clack.ts +1 -1
- package/src/cli.ts +304 -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 +172 -0
- package/src/trails/add-trail.ts +73 -27
- package/src/trails/add-verify.ts +68 -23
- package/src/trails/completions-complete.ts +165 -0
- package/src/trails/completions.ts +47 -0
- package/src/trails/create-scaffold.ts +101 -35
- package/src/trails/create.ts +87 -74
- package/src/trails/dev-clean.ts +31 -22
- package/src/trails/dev-reset.ts +9 -3
- package/src/trails/dev-stats.ts +28 -20
- package/src/trails/dev-support.ts +109 -95
- package/src/trails/draft-promote.ts +351 -107
- package/src/trails/guide.ts +55 -38
- package/src/trails/load-app.ts +712 -38
- 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 +517 -186
- package/src/trails/topo-activation.ts +385 -0
- package/src/trails/topo-compile.ts +55 -0
- package/src/trails/topo-history.ts +14 -11
- package/src/trails/topo-output-schemas.ts +175 -0
- package/src/trails/topo-pin.ts +25 -16
- package/src/trails/topo-read-support.ts +178 -238
- package/src/trails/topo-reports.ts +445 -63
- package/src/trails/topo-store-support.ts +67 -35
- package/src/trails/topo-support.ts +93 -147
- package/src/trails/topo-unpin.ts +17 -7
- package/src/trails/topo-verify.ts +19 -10
- package/src/trails/topo.ts +64 -31
- package/src/trails/warden-guide.ts +121 -0
- package/src/trails/warden.ts +137 -47
- package/src/versions.ts +28 -0
- 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 -20
- 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 -13
- 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 -88
- package/dist/src/trails/add-surface.js.map +0 -1
- package/dist/src/trails/add-trail.d.ts +0 -10
- package/dist/src/trails/add-trail.d.ts.map +0 -1
- package/dist/src/trails/add-trail.js +0 -77
- 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 -67
- 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 -288
- package/dist/src/trails/create-scaffold.js.map +0 -1
- package/dist/src/trails/create.d.ts +0 -22
- package/dist/src/trails/create.d.ts.map +0 -1
- package/dist/src/trails/create.js +0 -121
- 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 -65
- 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 -38
- 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 -178
- 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 -386
- 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 -64
- package/dist/src/trails/guide.js.map +0 -1
- package/dist/src/trails/load-app.d.ts +0 -6
- package/dist/src/trails/load-app.d.ts.map +0 -1
- package/dist/src/trails/load-app.js +0 -67
- 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 -212
- 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 -18
- package/dist/src/trails/topo-export.d.ts.map +0 -1
- package/dist/src/trails/topo-export.js +0 -34
- package/dist/src/trails/topo-export.js.map +0 -1
- package/dist/src/trails/topo-history.d.ts +0 -24
- package/dist/src/trails/topo-history.d.ts.map +0 -1
- package/dist/src/trails/topo-history.js +0 -33
- package/dist/src/trails/topo-history.js.map +0 -1
- package/dist/src/trails/topo-pin.d.ts +0 -21
- package/dist/src/trails/topo-pin.d.ts.map +0 -1
- package/dist/src/trails/topo-pin.js +0 -35
- package/dist/src/trails/topo-pin.js.map +0 -1
- package/dist/src/trails/topo-read-support.d.ts +0 -54
- package/dist/src/trails/topo-read-support.d.ts.map +0 -1
- package/dist/src/trails/topo-read-support.js +0 -178
- package/dist/src/trails/topo-read-support.js.map +0 -1
- package/dist/src/trails/topo-reports.d.ts +0 -50
- package/dist/src/trails/topo-reports.d.ts.map +0 -1
- package/dist/src/trails/topo-reports.js +0 -122
- 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 -53
- 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 -87
- package/dist/src/trails/topo-support.d.ts.map +0 -1
- package/dist/src/trails/topo-support.js +0 -165
- package/dist/src/trails/topo-support.js.map +0 -1
- package/dist/src/trails/topo-unpin.d.ts +0 -15
- package/dist/src/trails/topo-unpin.d.ts.map +0 -1
- package/dist/src/trails/topo-unpin.js +0 -39
- 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 -28
- 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 -67
- package/dist/src/trails/topo.js.map +0 -1
- package/dist/src/trails/warden.d.ts +0 -19
- package/dist/src/trails/warden.d.ts.map +0 -1
- package/dist/src/trails/warden.js +0 -89
- package/dist/src/trails/warden.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/__tests__/create.test.ts +0 -351
- package/src/__tests__/draft-promote.test.ts +0 -144
- package/src/__tests__/guide.test.ts +0 -91
- package/src/__tests__/load-app.test.ts +0 -58
- package/src/__tests__/survey.test.ts +0 -301
- package/src/__tests__/topo-dev.test.ts +0 -424
- package/src/__tests__/warden.test.ts +0 -74
- package/src/trails/add-trailhead.ts +0 -121
- package/src/trails/topo-export.ts +0 -39
- package/src/trails/topo-show.ts +0 -58
- package/tsconfig.json +0 -9
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare const topoHistoryTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
limit: number;
|
|
3
|
-
rootDir?: string | undefined;
|
|
4
|
-
}, {
|
|
5
|
-
dbPath: string;
|
|
6
|
-
limit: number;
|
|
7
|
-
pinCount: number;
|
|
8
|
-
pins: {
|
|
9
|
-
createdAt: string;
|
|
10
|
-
name: string;
|
|
11
|
-
saveId: string;
|
|
12
|
-
}[];
|
|
13
|
-
saveCount: number;
|
|
14
|
-
saves: {
|
|
15
|
-
createdAt: string;
|
|
16
|
-
gitDirty: boolean;
|
|
17
|
-
id: string;
|
|
18
|
-
provisionCount: number;
|
|
19
|
-
signalCount: number;
|
|
20
|
-
trailCount: number;
|
|
21
|
-
gitSha?: string | undefined;
|
|
22
|
-
}[];
|
|
23
|
-
}>;
|
|
24
|
-
//# sourceMappingURL=topo-history.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-history.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-history.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EA4B3B,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Result, trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { DEFAULT_TOPO_HISTORY_LIMIT, isolatedExampleInput, listTopoHistory, topoPinOutput, topoSaveOutput, } from './topo-support.js';
|
|
4
|
-
export const topoHistoryTrail = trail('topo.history', {
|
|
5
|
-
blaze: (input, ctx) => {
|
|
6
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
7
|
-
return Result.ok(listTopoHistory({ limit: input.limit, rootDir }));
|
|
8
|
-
},
|
|
9
|
-
description: 'List saved topo metadata, including pins and recent autosaves',
|
|
10
|
-
examples: [
|
|
11
|
-
{
|
|
12
|
-
input: isolatedExampleInput('topo-history'),
|
|
13
|
-
name: 'Show topo history',
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
input: z.object({
|
|
17
|
-
limit: z
|
|
18
|
-
.number()
|
|
19
|
-
.default(DEFAULT_TOPO_HISTORY_LIMIT)
|
|
20
|
-
.describe('Maximum number of autosaves to return'),
|
|
21
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
22
|
-
}),
|
|
23
|
-
intent: 'read',
|
|
24
|
-
output: z.object({
|
|
25
|
-
dbPath: z.string(),
|
|
26
|
-
limit: z.number(),
|
|
27
|
-
pinCount: z.number(),
|
|
28
|
-
pins: z.array(topoPinOutput),
|
|
29
|
-
saveCount: z.number(),
|
|
30
|
-
saves: z.array(topoSaveOutput),
|
|
31
|
-
}),
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=top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,CAAC,CAAC,MAAM,EAAE;QACpB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;QAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;KAC/B,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare const topoPinTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
module: string;
|
|
3
|
-
name: string;
|
|
4
|
-
rootDir?: string | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
pin: {
|
|
7
|
-
createdAt: string;
|
|
8
|
-
name: string;
|
|
9
|
-
saveId: string;
|
|
10
|
-
};
|
|
11
|
-
save: {
|
|
12
|
-
createdAt: string;
|
|
13
|
-
gitDirty: boolean;
|
|
14
|
-
id: string;
|
|
15
|
-
provisionCount: number;
|
|
16
|
-
signalCount: number;
|
|
17
|
-
trailCount: number;
|
|
18
|
-
gitSha?: string | undefined;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
//# sourceMappingURL=topo-pin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-pin.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-pin.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;EA6BvB,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Result, trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { loadApp } from './load-app.js';
|
|
4
|
-
import { DEFAULT_APP_MODULE, isolatedExampleInput, pinCurrentTopo, topoPinOutput, topoSaveOutput, } from './topo-support.js';
|
|
5
|
-
export const topoPinTrail = trail('topo.pin', {
|
|
6
|
-
blaze: async (input, ctx) => {
|
|
7
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
8
|
-
const app = await loadApp(input.module, rootDir);
|
|
9
|
-
return Result.ok(pinCurrentTopo(app, { name: input.name, rootDir }));
|
|
10
|
-
},
|
|
11
|
-
description: 'Pin the current topo under a durable name',
|
|
12
|
-
examples: [
|
|
13
|
-
{
|
|
14
|
-
input: {
|
|
15
|
-
...isolatedExampleInput('topo-pin'),
|
|
16
|
-
name: 'before-auth-refactor',
|
|
17
|
-
},
|
|
18
|
-
name: 'Pin the current topo',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
input: z.object({
|
|
22
|
-
module: z
|
|
23
|
-
.string()
|
|
24
|
-
.default(DEFAULT_APP_MODULE)
|
|
25
|
-
.describe('Path to the app module'),
|
|
26
|
-
name: z.string().describe('Pin name'),
|
|
27
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
28
|
-
}),
|
|
29
|
-
intent: 'write',
|
|
30
|
-
output: z.object({
|
|
31
|
-
pin: topoPinOutput,
|
|
32
|
-
save: topoSaveOutput,
|
|
33
|
-
}),
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=topo-pin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-pin.js","sourceRoot":"","sources":["../../../src/trails/topo-pin.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,EACL,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,EAAE;IAC5C,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,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,WAAW,EAAE,2CAA2C;IACxD,QAAQ,EAAE;QACR;YACE,KAAK,EAAE;gBACL,GAAG,oBAAoB,CAAC,UAAU,CAAC;gBACnC,IAAI,EAAE,sBAAsB;aAC7B;YACD,IAAI,EAAE,sBAAsB;SAC7B;KACF;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC;aACN,MAAM,EAAE;aACR,OAAO,CAAC,kBAAkB,CAAC;aAC3B,QAAQ,CAAC,wBAAwB,CAAC;QACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;QACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;KACpE,CAAC;IACF,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,GAAG,EAAE,aAAa;QAClB,IAAI,EAAE,cAAc;KACrB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Read-only topo store consumer helpers.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from topo-support.ts so this branch (trl-132) owns its own file,
|
|
5
|
-
* keeping absorb routing clean across the stack.
|
|
6
|
-
*/
|
|
7
|
-
import type { Topo } from '@ontrails/core';
|
|
8
|
-
import { Result } from '@ontrails/core';
|
|
9
|
-
import type { BriefReport, SurveyListReport } from './topo-reports.js';
|
|
10
|
-
import type { TopoSummaryReport, TopoVerifyReport } from './topo-support.js';
|
|
11
|
-
interface CurrentTrailDetail {
|
|
12
|
-
readonly crosses: string[];
|
|
13
|
-
readonly description: string | null;
|
|
14
|
-
readonly detours: Readonly<Record<string, readonly string[]>> | null;
|
|
15
|
-
readonly examples: unknown[];
|
|
16
|
-
readonly id: string;
|
|
17
|
-
readonly intent: 'destroy' | 'read' | 'write';
|
|
18
|
-
readonly kind: string;
|
|
19
|
-
readonly provisions: string[];
|
|
20
|
-
readonly safety: string;
|
|
21
|
-
}
|
|
22
|
-
interface CurrentProvisionDetail {
|
|
23
|
-
readonly description: string | null;
|
|
24
|
-
readonly health: 'available' | 'none';
|
|
25
|
-
readonly id: string;
|
|
26
|
-
readonly kind: 'provision';
|
|
27
|
-
readonly lifetime: 'singleton';
|
|
28
|
-
readonly usedBy: string[];
|
|
29
|
-
}
|
|
30
|
-
export declare const buildTopoSummary: (app: Topo, options?: {
|
|
31
|
-
readonly rootDir?: string;
|
|
32
|
-
}) => TopoSummaryReport;
|
|
33
|
-
export declare const buildCurrentTopoBrief: (app: Topo, options?: {
|
|
34
|
-
readonly rootDir?: string;
|
|
35
|
-
}) => BriefReport;
|
|
36
|
-
export declare const buildCurrentTopoList: (app: Topo, options?: {
|
|
37
|
-
readonly rootDir?: string;
|
|
38
|
-
}) => SurveyListReport;
|
|
39
|
-
export declare const buildCurrentGuideEntries: (app: Topo, options?: {
|
|
40
|
-
readonly rootDir?: string;
|
|
41
|
-
}) => readonly {
|
|
42
|
-
readonly description: string;
|
|
43
|
-
readonly exampleCount: number;
|
|
44
|
-
readonly id: string;
|
|
45
|
-
readonly kind: string;
|
|
46
|
-
}[];
|
|
47
|
-
export declare const buildCurrentTopoDetail: (app: Topo, id: string, options?: {
|
|
48
|
-
readonly rootDir?: string;
|
|
49
|
-
}) => CurrentProvisionDetail | CurrentTrailDetail | undefined;
|
|
50
|
-
export declare const verifyCurrentTopo: (app: Topo, options?: {
|
|
51
|
-
readonly rootDir?: string;
|
|
52
|
-
}) => Promise<Result<TopoVerifyReport, Error>>;
|
|
53
|
-
export {};
|
|
54
|
-
//# sourceMappingURL=topo-read-support.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-read-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-read-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAKL,MAAM,EACP,MAAM,gBAAgB,CAAC;AAUxB,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAiB7E,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;IACrE,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAAC;IACtC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;I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store consumer helpers.
|
|
3
|
-
*
|
|
4
|
-
* Extracted from topo-support.ts so this branch (trl-132) owns its own file,
|
|
5
|
-
* keeping absorb routing clean across the stack.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync } from 'node:fs';
|
|
8
|
-
import { join } from 'node:path';
|
|
9
|
-
import { ConflictError, createTopoStore, InternalError, NotFoundError, Result, } from '@ontrails/core';
|
|
10
|
-
import { listTopoSaves } from '@ontrails/core/internal/topo-saves';
|
|
11
|
-
import { openReadTrailsDb, resolveTrailsDbPath, resolveTrailsDir, } from '@ontrails/core/internal/trails-db';
|
|
12
|
-
import { readTrailheadLockData } from '@ontrails/schema';
|
|
13
|
-
import { REPORT_CONTRACT_VERSION, REPORT_VERSION } from './topo-constants.js';
|
|
14
|
-
import { createCurrentTopoSave, LOCK_PATH, resolveRootDir, } from './topo-support.js';
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Store helpers
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
const topoStoreRef = (saveId) => ({ saveId });
|
|
19
|
-
const hasCommittedLock = (trailsDir) => existsSync(join(trailsDir, 'trails.lock')) ||
|
|
20
|
-
existsSync(join(trailsDir, 'trailhead.lock'));
|
|
21
|
-
const readTrailheadEntries = (trailheadMapJson) => JSON.parse(trailheadMapJson).entries;
|
|
22
|
-
const buildBriefReportFromStore = (app, store, ref, save) => {
|
|
23
|
-
const trails = store.trails.list({ save: ref });
|
|
24
|
-
const exportRecord = store.exports.get(ref);
|
|
25
|
-
const trailEntries = exportRecord === undefined
|
|
26
|
-
? []
|
|
27
|
-
: readTrailheadEntries(exportRecord.trailheadMapJson).filter((entry) => entry.kind === 'trail');
|
|
28
|
-
return {
|
|
29
|
-
contractVersion: REPORT_CONTRACT_VERSION,
|
|
30
|
-
features: {
|
|
31
|
-
detours: trailEntries.some((entry) => (Object.keys(entry.detours ?? {}).length ?? 0) > 0),
|
|
32
|
-
examples: trails.some((trail) => trail.hasExamples),
|
|
33
|
-
outputSchemas: trails.some((trail) => trail.hasOutput),
|
|
34
|
-
provisions: save.provisionCount > 0,
|
|
35
|
-
signals: save.signalCount > 0,
|
|
36
|
-
},
|
|
37
|
-
name: app.name,
|
|
38
|
-
provisions: save.provisionCount,
|
|
39
|
-
signals: save.signalCount,
|
|
40
|
-
trails: save.trailCount,
|
|
41
|
-
version: REPORT_VERSION,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const buildSurveyListFromStore = (store, ref) => {
|
|
45
|
-
const trails = store.trails.list({ save: ref });
|
|
46
|
-
const provisions = store.provisions.list({ save: ref });
|
|
47
|
-
return {
|
|
48
|
-
count: trails.length,
|
|
49
|
-
entries: trails.map((trail) => ({
|
|
50
|
-
examples: trail.exampleCount,
|
|
51
|
-
id: trail.id,
|
|
52
|
-
kind: trail.kind,
|
|
53
|
-
safety: trail.safety,
|
|
54
|
-
})),
|
|
55
|
-
provisionCount: provisions.length,
|
|
56
|
-
provisions: provisions.map((provision) => ({
|
|
57
|
-
description: provision.description,
|
|
58
|
-
health: provision.health,
|
|
59
|
-
id: provision.id,
|
|
60
|
-
kind: provision.kind,
|
|
61
|
-
lifetime: provision.lifetime,
|
|
62
|
-
usedBy: provision.usedBy,
|
|
63
|
-
})),
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
const buildTrailDetailFromStore = (detail) => ({
|
|
67
|
-
crosses: [...(detail?.crosses ?? [])],
|
|
68
|
-
description: detail?.description ?? null,
|
|
69
|
-
detours: detail?.detours ?? null,
|
|
70
|
-
examples: [...(detail?.examples ?? [])],
|
|
71
|
-
id: detail?.id ?? '',
|
|
72
|
-
intent: detail?.intent ?? 'write',
|
|
73
|
-
kind: detail?.kind ?? 'trail',
|
|
74
|
-
provisions: [...(detail?.provisions ?? [])],
|
|
75
|
-
safety: detail?.safety ?? '-',
|
|
76
|
-
});
|
|
77
|
-
const buildProvisionDetailFromStore = (provision) => ({
|
|
78
|
-
description: provision.description,
|
|
79
|
-
health: provision.health,
|
|
80
|
-
id: provision.id,
|
|
81
|
-
kind: provision.kind,
|
|
82
|
-
lifetime: provision.lifetime,
|
|
83
|
-
usedBy: [...provision.usedBy],
|
|
84
|
-
});
|
|
85
|
-
// ---------------------------------------------------------------------------
|
|
86
|
-
// withCurrentTopoStore
|
|
87
|
-
// ---------------------------------------------------------------------------
|
|
88
|
-
/**
|
|
89
|
-
* Run a read callback against the latest topo store state.
|
|
90
|
-
*
|
|
91
|
-
* Uses the most recent existing save when available, only creating a new save
|
|
92
|
-
* when no prior save exists. This avoids unbounded save accumulation from
|
|
93
|
-
* read-only operations like survey, guide, and show.
|
|
94
|
-
*/
|
|
95
|
-
const withCurrentTopoStore = (app, rootDir, read) => {
|
|
96
|
-
const dbPath = resolveTrailsDbPath({ rootDir });
|
|
97
|
-
const existingSave = existsSync(dbPath)
|
|
98
|
-
? (() => {
|
|
99
|
-
const db = openReadTrailsDb({ rootDir });
|
|
100
|
-
try {
|
|
101
|
-
return listTopoSaves(db)[0];
|
|
102
|
-
}
|
|
103
|
-
finally {
|
|
104
|
-
db.close();
|
|
105
|
-
}
|
|
106
|
-
})()
|
|
107
|
-
: undefined;
|
|
108
|
-
const save = existingSave ?? createCurrentTopoSave(app, { rootDir });
|
|
109
|
-
const store = createTopoStore({ rootDir });
|
|
110
|
-
return read(store, topoStoreRef(save.id), save);
|
|
111
|
-
};
|
|
112
|
-
// ---------------------------------------------------------------------------
|
|
113
|
-
// Public read-only consumers
|
|
114
|
-
// ---------------------------------------------------------------------------
|
|
115
|
-
export const buildTopoSummary = (app, options) => {
|
|
116
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
117
|
-
const trailsDir = resolveTrailsDir({ rootDir });
|
|
118
|
-
return withCurrentTopoStore(app, rootDir, (store, ref, save) => ({
|
|
119
|
-
app: buildBriefReportFromStore(app, store, ref, save),
|
|
120
|
-
dbPath: resolveTrailsDbPath({ rootDir }),
|
|
121
|
-
list: buildSurveyListFromStore(store, ref),
|
|
122
|
-
lockExists: hasCommittedLock(trailsDir),
|
|
123
|
-
lockPath: LOCK_PATH,
|
|
124
|
-
}));
|
|
125
|
-
};
|
|
126
|
-
export const buildCurrentTopoBrief = (app, options) => {
|
|
127
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
128
|
-
return withCurrentTopoStore(app, rootDir, (store, ref, save) => buildBriefReportFromStore(app, store, ref, save));
|
|
129
|
-
};
|
|
130
|
-
export const buildCurrentTopoList = (app, options) => {
|
|
131
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
132
|
-
return withCurrentTopoStore(app, rootDir, (store, ref) => buildSurveyListFromStore(store, ref));
|
|
133
|
-
};
|
|
134
|
-
export const buildCurrentGuideEntries = (app, options) => {
|
|
135
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
136
|
-
return withCurrentTopoStore(app, rootDir, (store, ref) => store.trails.list({ save: ref }).map((trail) => ({
|
|
137
|
-
description: trail.description ?? '(no description)',
|
|
138
|
-
exampleCount: trail.exampleCount,
|
|
139
|
-
id: trail.id,
|
|
140
|
-
kind: trail.kind,
|
|
141
|
-
})));
|
|
142
|
-
};
|
|
143
|
-
export const buildCurrentTopoDetail = (app, id, options) => {
|
|
144
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
145
|
-
return withCurrentTopoStore(app, rootDir, (store, ref) => {
|
|
146
|
-
const trail = store.trails.get(id, { save: ref });
|
|
147
|
-
if (trail !== undefined) {
|
|
148
|
-
return buildTrailDetailFromStore(trail);
|
|
149
|
-
}
|
|
150
|
-
const provision = store.provisions.get(id, { save: ref });
|
|
151
|
-
return provision === undefined
|
|
152
|
-
? undefined
|
|
153
|
-
: buildProvisionDetailFromStore(provision);
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
export const verifyCurrentTopo = async (app, options) => {
|
|
157
|
-
const rootDir = resolveRootDir(options?.rootDir);
|
|
158
|
-
const committedLock = await readTrailheadLockData({
|
|
159
|
-
dir: resolveTrailsDir({ rootDir }),
|
|
160
|
-
});
|
|
161
|
-
if (committedLock === null) {
|
|
162
|
-
return Result.err(new NotFoundError('No committed trails.lock found. Run `trails topo export` first.'));
|
|
163
|
-
}
|
|
164
|
-
const currentHash = withCurrentTopoStore(app, rootDir, (store, ref) => store.exports.get(ref)?.trailheadHash);
|
|
165
|
-
if (currentHash === undefined) {
|
|
166
|
-
return Result.err(new InternalError('No stored topo export found for the current topo save'));
|
|
167
|
-
}
|
|
168
|
-
if (committedLock.hash !== currentHash) {
|
|
169
|
-
return Result.err(new ConflictError('trails.lock is stale. Run `trails topo export` to refresh it.'));
|
|
170
|
-
}
|
|
171
|
-
return Result.ok({
|
|
172
|
-
committedHash: committedLock.hash,
|
|
173
|
-
currentHash,
|
|
174
|
-
lockPath: LOCK_PATH,
|
|
175
|
-
stale: false,
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
//# sourceMappingURL=topo-read-support.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-read-support.js","sourceRoot":"","sources":["../../../src/trails/topo-read-support.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,MAAM,GACP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAIzD,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,cAAc,GACf,MAAM,mBAAmB,CAAC;AAgC3B,8EAA8E;AAC9E,gBAAgB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P,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,aAAa,CACtD,CAAC;IAEF,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,aAAa,CAAC,uDAAuD,CAAC,CAC3E,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACvC,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,aAAa,CACf,+DAA+D,CAChE,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC;QACf,aAAa,EAAE,aAAa,CAAC,IAAI;QACjC,WAAW;QACX,QAAQ,EAAE,SAAS;QACnB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { Topo, Trail } from '@ontrails/core';
|
|
2
|
-
export interface BriefReport {
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly version: string;
|
|
5
|
-
readonly contractVersion: string;
|
|
6
|
-
readonly features: {
|
|
7
|
-
readonly provisions: boolean;
|
|
8
|
-
readonly outputSchemas: boolean;
|
|
9
|
-
readonly examples: boolean;
|
|
10
|
-
readonly detours: boolean;
|
|
11
|
-
readonly signals: boolean;
|
|
12
|
-
};
|
|
13
|
-
readonly trails: number;
|
|
14
|
-
readonly signals: number;
|
|
15
|
-
readonly provisions: number;
|
|
16
|
-
}
|
|
17
|
-
export interface SurveyListReport {
|
|
18
|
-
readonly count: number;
|
|
19
|
-
readonly entries: readonly {
|
|
20
|
-
readonly examples: number;
|
|
21
|
-
readonly id: string;
|
|
22
|
-
readonly kind: string;
|
|
23
|
-
readonly safety: string;
|
|
24
|
-
}[];
|
|
25
|
-
readonly provisionCount: number;
|
|
26
|
-
readonly provisions: readonly {
|
|
27
|
-
readonly description: string | null;
|
|
28
|
-
readonly health: 'available' | 'none';
|
|
29
|
-
readonly id: string;
|
|
30
|
-
readonly kind: 'provision';
|
|
31
|
-
readonly lifetime: 'singleton';
|
|
32
|
-
readonly usedBy: readonly string[];
|
|
33
|
-
}[];
|
|
34
|
-
}
|
|
35
|
-
export interface TrailDetailReport {
|
|
36
|
-
readonly description: string | null;
|
|
37
|
-
readonly detours: Trail<unknown, unknown>['detours'] | null;
|
|
38
|
-
readonly examples: readonly unknown[];
|
|
39
|
-
readonly crosses: readonly string[];
|
|
40
|
-
readonly id: string;
|
|
41
|
-
readonly intent: 'read' | 'write' | 'destroy';
|
|
42
|
-
readonly kind: string;
|
|
43
|
-
readonly safety: string;
|
|
44
|
-
readonly provisions: readonly string[];
|
|
45
|
-
}
|
|
46
|
-
export declare const generateBriefReport: (app: Topo) => BriefReport;
|
|
47
|
-
export declare const formatProvisionDetail: (app: Topo, provisionId: string) => object;
|
|
48
|
-
export declare const generateSurveyList: (app: Topo) => SurveyListReport;
|
|
49
|
-
export declare const generateTrailDetail: (item: Trail<unknown, unknown>) => TrailDetailReport;
|
|
50
|
-
//# sourceMappingURL=topo-reports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-reports.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-reports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE;QACjB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;QAChC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC3B,QAAQ,C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AAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC;AAgCD,eAAO,MAAM,mBAAmB,GAAI,KAAK,IAAI,KAAG,WAmB/C,CAAC;AAwCF,eAAO,MAAM,qBAAqB,GAChC,KAAK,IAAI,EACT,aAAa,MAAM,KAClB,MAYF,CAAC;AAiBF,eAAO,MAAM,kBAAkB,GAAI,KAAK,IAAI,KAAG,gBA4B9C,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,MAAM,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAC5B,iBAgBF,CAAC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { REPORT_CONTRACT_VERSION, REPORT_VERSION } from './topo-constants.js';
|
|
2
|
-
const trailHas = (raw, key) => {
|
|
3
|
-
if (key === 'examples') {
|
|
4
|
-
return Array.isArray(raw[key]) && raw[key].length > 0;
|
|
5
|
-
}
|
|
6
|
-
return Boolean(raw[key]);
|
|
7
|
-
};
|
|
8
|
-
const detectFeatures = (app) => {
|
|
9
|
-
const trails = [...app.trails.values()].map((item) => item);
|
|
10
|
-
return {
|
|
11
|
-
hasDetours: trails.some((r) => trailHas(r, 'detours')),
|
|
12
|
-
hasExamples: trails.some((r) => trailHas(r, 'examples')),
|
|
13
|
-
hasOutputSchemas: trails.some((r) => trailHas(r, 'output')),
|
|
14
|
-
hasProvisions: trails.some((r) => Array.isArray(r['provisions']) &&
|
|
15
|
-
r['provisions'].length > 0),
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export const generateBriefReport = (app) => {
|
|
19
|
-
const { hasDetours, hasExamples, hasOutputSchemas, hasProvisions } = detectFeatures(app);
|
|
20
|
-
return {
|
|
21
|
-
contractVersion: REPORT_CONTRACT_VERSION,
|
|
22
|
-
features: {
|
|
23
|
-
detours: hasDetours,
|
|
24
|
-
examples: hasExamples,
|
|
25
|
-
outputSchemas: hasOutputSchemas,
|
|
26
|
-
provisions: hasProvisions,
|
|
27
|
-
signals: app.signals.size > 0,
|
|
28
|
-
},
|
|
29
|
-
name: app.name,
|
|
30
|
-
provisions: app.provisions.size,
|
|
31
|
-
signals: app.signals.size,
|
|
32
|
-
trails: app.trails.size,
|
|
33
|
-
version: REPORT_VERSION,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const safetyLabel = (entry) => {
|
|
37
|
-
if (entry.intent === 'destroy') {
|
|
38
|
-
return 'destroy';
|
|
39
|
-
}
|
|
40
|
-
if (entry.intent === 'write') {
|
|
41
|
-
return 'write';
|
|
42
|
-
}
|
|
43
|
-
if (entry.intent === 'read') {
|
|
44
|
-
return 'read';
|
|
45
|
-
}
|
|
46
|
-
return '-';
|
|
47
|
-
};
|
|
48
|
-
const buildProvisionUsage = (app) => {
|
|
49
|
-
const usage = new Map();
|
|
50
|
-
for (const trailDef of app.list()) {
|
|
51
|
-
for (const declaredProvision of trailDef.provisions) {
|
|
52
|
-
const users = usage.get(declaredProvision.id) ?? [];
|
|
53
|
-
users.push(trailDef.id);
|
|
54
|
-
usage.set(declaredProvision.id, users);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return new Map([...usage.entries()].map(([id, users]) => [id, users.toSorted()]));
|
|
58
|
-
};
|
|
59
|
-
const provisionHealthStatus = (provision) => provision.health === undefined ? 'none' : 'available';
|
|
60
|
-
export const formatProvisionDetail = (app, provisionId) => {
|
|
61
|
-
const item = app.getProvision(provisionId);
|
|
62
|
-
const usedBy = buildProvisionUsage(app).get(provisionId) ?? [];
|
|
63
|
-
return {
|
|
64
|
-
description: item?.description ?? null,
|
|
65
|
-
health: item ? provisionHealthStatus(item) : 'none',
|
|
66
|
-
id: provisionId,
|
|
67
|
-
kind: 'provision',
|
|
68
|
-
lifetime: 'singleton',
|
|
69
|
-
usedBy,
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
const formatProvisionList = (app) => {
|
|
73
|
-
const usage = buildProvisionUsage(app);
|
|
74
|
-
return app
|
|
75
|
-
.listProvisions()
|
|
76
|
-
.map((provision) => ({
|
|
77
|
-
description: provision.description ?? null,
|
|
78
|
-
health: provisionHealthStatus(provision),
|
|
79
|
-
id: provision.id,
|
|
80
|
-
kind: provision.kind,
|
|
81
|
-
lifetime: 'singleton',
|
|
82
|
-
usedBy: usage.get(provision.id) ?? [],
|
|
83
|
-
}))
|
|
84
|
-
.toSorted((a, b) => a.id.localeCompare(b.id));
|
|
85
|
-
};
|
|
86
|
-
export const generateSurveyList = (app) => {
|
|
87
|
-
const items = app.list();
|
|
88
|
-
const entries = items.map((item) => {
|
|
89
|
-
const safety = safetyLabel(item);
|
|
90
|
-
const examples = Array.isArray(item.examples)
|
|
91
|
-
? item.examples.length
|
|
92
|
-
: 0;
|
|
93
|
-
return {
|
|
94
|
-
examples,
|
|
95
|
-
id: item.id,
|
|
96
|
-
kind: item.kind,
|
|
97
|
-
safety,
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
const provisions = formatProvisionList(app);
|
|
101
|
-
return {
|
|
102
|
-
count: items.length,
|
|
103
|
-
entries,
|
|
104
|
-
provisionCount: provisions.length,
|
|
105
|
-
provisions,
|
|
106
|
-
};
|
|
107
|
-
};
|
|
108
|
-
export const generateTrailDetail = (item) => {
|
|
109
|
-
const safety = safetyLabel(item);
|
|
110
|
-
return {
|
|
111
|
-
crosses: item.crosses.toSorted(),
|
|
112
|
-
description: item.description ?? null,
|
|
113
|
-
detours: item.detours ?? null,
|
|
114
|
-
examples: item.examples ?? [],
|
|
115
|
-
id: item.id,
|
|
116
|
-
intent: item.intent,
|
|
117
|
-
kind: item.kind,
|
|
118
|
-
provisions: item.provisions.map((provision) => provision.id).toSorted(),
|
|
119
|
-
safety,
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
//# sourceMappingURL=topo-reports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-reports.js","sourceRoot":"","sources":["../../../src/trails/topo-reports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAiD9E,MAAM,QAAQ,GAAG,CAAC,GAA4B,EAAE,GAAW,EAAW,EAAE;IACtE,IAAI,GAAG,KAAK,UAAU,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAK,GAAG,CAAC,GAAG,CAAe,CAAC,MAAM,GAAG,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,GAAS,EAMT,EAAE;IACF,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAA0C,CACrD,CAAC;IACF,OAAO;QACL,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;QACtD,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACxD,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAC3D,aAAa,EAAE,MAAM,CAAC,IAAI,CACxB,CAAC,CAAC,EAAE,EAAE,CACJ,KAAK,CAAC,OAAO,CAAC,CAAC,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,CAAC;IAE5C,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,OAAO;QACP,cAAc,EAAE,UAAU,CAAC,MAAM;QACjC,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,IAA6B,EACV,EAAE;IACrB,MAAM,MAAM,GAAG,WAAW,CACxB,IAA4D,CAC7D,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;QAChC,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI;QACrC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;QAC7B,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;QACvE,MAAM;KACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const topoShowTrail: import("@ontrails/core").Trail<{
|
|
2
|
-
id: string;
|
|
3
|
-
module: string;
|
|
4
|
-
rootDir?: string | undefined;
|
|
5
|
-
}, {
|
|
6
|
-
crosses: string[];
|
|
7
|
-
description: unknown;
|
|
8
|
-
detours: unknown;
|
|
9
|
-
examples: unknown[];
|
|
10
|
-
id: string;
|
|
11
|
-
intent: "read" | "write" | "destroy";
|
|
12
|
-
kind: string;
|
|
13
|
-
provisions: string[];
|
|
14
|
-
safety: string;
|
|
15
|
-
} | {
|
|
16
|
-
description: string | null;
|
|
17
|
-
health: "available" | "none";
|
|
18
|
-
id: string;
|
|
19
|
-
kind: "provision";
|
|
20
|
-
lifetime: "singleton";
|
|
21
|
-
usedBy: string[];
|
|
22
|
-
}>;
|
|
23
|
-
//# sourceMappingURL=topo-show.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topo-show.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-show.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;EA6BxB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { NotFoundError, Result, trail } from '@ontrails/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { loadApp } from './load-app.js';
|
|
4
|
-
import { buildCurrentTopoDetail } from './topo-read-support.js';
|
|
5
|
-
import { DEFAULT_APP_MODULE } from './topo-support.js';
|
|
6
|
-
const trailDetailOutput = z.object({
|
|
7
|
-
crosses: z.array(z.string()),
|
|
8
|
-
description: z.unknown().nullable(),
|
|
9
|
-
detours: z.unknown().nullable(),
|
|
10
|
-
examples: z.array(z.unknown()),
|
|
11
|
-
id: z.string(),
|
|
12
|
-
intent: z.enum(['read', 'write', 'destroy']),
|
|
13
|
-
kind: z.string(),
|
|
14
|
-
provisions: z.array(z.string()),
|
|
15
|
-
safety: z.string(),
|
|
16
|
-
});
|
|
17
|
-
const provisionDetailOutput = z.object({
|
|
18
|
-
description: z.string().nullable(),
|
|
19
|
-
health: z.enum(['available', 'none']),
|
|
20
|
-
id: z.string(),
|
|
21
|
-
kind: z.literal('provision'),
|
|
22
|
-
lifetime: z.literal('singleton'),
|
|
23
|
-
usedBy: z.array(z.string()),
|
|
24
|
-
});
|
|
25
|
-
export const topoShowTrail = trail('topo.show', {
|
|
26
|
-
blaze: async (input, ctx) => {
|
|
27
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
28
|
-
const app = await loadApp(input.module, rootDir);
|
|
29
|
-
const detail = buildCurrentTopoDetail(app, input.id, { rootDir });
|
|
30
|
-
if (detail !== undefined) {
|
|
31
|
-
return Result.ok(detail);
|
|
32
|
-
}
|
|
33
|
-
return Result.err(new NotFoundError(`Trail or provision not found: ${input.id}`));
|
|
34
|
-
},
|
|
35
|
-
description: 'Show detail for a current trail or provision',
|
|
36
|
-
examples: [
|
|
37
|
-
{
|
|
38
|
-
input: { id: 'topo' },
|
|
39
|
-
name: 'Show current trail detail',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
input: z.object({
|
|
43
|
-
id: z.string().describe('Trail or provision ID to inspect'),
|
|
44
|
-
module: z
|
|
45
|
-
.string()
|
|
46
|
-
.default(DEFAULT_APP_MODULE)
|
|
47
|
-
.describe('Path to the app module'),
|
|
48
|
-
rootDir: z.string().optional().describe('Workspace root directory'),
|
|
49
|
-
}),
|
|
50
|
-
intent: 'read',
|
|
51
|
-
output: z.union([trailDetailOutput, provisionDetailOutput]),
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=topo-show.js.map
|