@ontrails/trails 1.0.0-beta.13 → 1.0.0-beta.15
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/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +29 -0
- package/__tests__/examples.test.ts +39 -0
- package/dist/src/app.d.ts.map +1 -1
- package/dist/src/app.js +12 -1
- package/dist/src/app.js.map +1 -1
- package/dist/src/cli.js +4 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/trails/add-surface.d.ts +3 -3
- package/dist/src/trails/add-surface.d.ts.map +1 -1
- package/dist/src/trails/add-surface.js +46 -24
- package/dist/src/trails/add-surface.js.map +1 -1
- package/dist/src/trails/add-trail.d.ts +3 -1
- package/dist/src/trails/add-trail.d.ts.map +1 -1
- package/dist/src/trails/add-trail.js +49 -22
- package/dist/src/trails/add-trail.js.map +1 -1
- package/dist/src/trails/add-trailhead.d.ts +13 -0
- package/dist/src/trails/add-trailhead.d.ts.map +1 -0
- package/dist/src/trails/add-trailhead.js +88 -0
- package/dist/src/trails/add-trailhead.js.map +1 -0
- package/dist/src/trails/add-verify.d.ts +1 -1
- package/dist/src/trails/add-verify.d.ts.map +1 -1
- package/dist/src/trails/add-verify.js +17 -16
- package/dist/src/trails/add-verify.js.map +1 -1
- package/dist/src/trails/create-scaffold.d.ts +1 -1
- package/dist/src/trails/create-scaffold.d.ts.map +1 -1
- package/dist/src/trails/create-scaffold.js +34 -27
- package/dist/src/trails/create-scaffold.js.map +1 -1
- package/dist/src/trails/create.d.ts +9 -13
- package/dist/src/trails/create.d.ts.map +1 -1
- package/dist/src/trails/create.js +40 -35
- package/dist/src/trails/create.js.map +1 -1
- package/dist/src/trails/dev-clean.d.ts +9 -0
- package/dist/src/trails/dev-clean.d.ts.map +1 -0
- package/dist/src/trails/dev-clean.js +66 -0
- package/dist/src/trails/dev-clean.js.map +1 -0
- package/dist/src/trails/dev-reset.d.ts +6 -0
- package/dist/src/trails/dev-reset.d.ts.map +1 -0
- package/dist/src/trails/dev-reset.js +39 -0
- package/dist/src/trails/dev-reset.js.map +1 -0
- package/dist/src/trails/dev-stats.d.ts +7 -0
- package/dist/src/trails/dev-stats.d.ts.map +1 -0
- package/dist/src/trails/dev-stats.js +61 -0
- package/dist/src/trails/dev-stats.js.map +1 -0
- package/dist/src/trails/dev-support.d.ts +64 -0
- package/dist/src/trails/dev-support.d.ts.map +1 -0
- package/dist/src/trails/dev-support.js +181 -0
- package/dist/src/trails/dev-support.js.map +1 -0
- package/dist/src/trails/draft-promote.d.ts +18 -0
- package/dist/src/trails/draft-promote.d.ts.map +1 -0
- package/dist/src/trails/draft-promote.js +400 -0
- package/dist/src/trails/draft-promote.js.map +1 -0
- package/dist/src/trails/guide.d.ts +14 -4
- package/dist/src/trails/guide.d.ts.map +1 -1
- package/dist/src/trails/guide.js +22 -41
- package/dist/src/trails/guide.js.map +1 -1
- package/dist/src/trails/load-app.d.ts +9 -1
- package/dist/src/trails/load-app.d.ts.map +1 -1
- package/dist/src/trails/load-app.js +404 -13
- package/dist/src/trails/load-app.js.map +1 -1
- package/dist/src/trails/project.d.ts.map +1 -1
- package/dist/src/trails/project.js +14 -3
- package/dist/src/trails/project.js.map +1 -1
- package/dist/src/trails/survey.d.ts +6 -60
- package/dist/src/trails/survey.d.ts.map +1 -1
- package/dist/src/trails/survey.js +83 -182
- package/dist/src/trails/survey.js.map +1 -1
- package/dist/src/trails/topo-constants.d.ts +3 -0
- package/dist/src/trails/topo-constants.d.ts.map +1 -0
- package/dist/src/trails/topo-constants.js +3 -0
- package/dist/src/trails/topo-constants.js.map +1 -0
- package/dist/src/trails/topo-export.d.ts +19 -0
- package/dist/src/trails/topo-export.d.ts.map +1 -0
- package/dist/src/trails/topo-export.js +31 -0
- package/dist/src/trails/topo-export.js.map +1 -0
- package/dist/src/trails/topo-history.d.ts +20 -0
- package/dist/src/trails/topo-history.d.ts.map +1 -0
- package/dist/src/trails/topo-history.js +32 -0
- package/dist/src/trails/topo-history.js.map +1 -0
- package/dist/src/trails/topo-pin.d.ts +17 -0
- package/dist/src/trails/topo-pin.d.ts.map +1 -0
- package/dist/src/trails/topo-pin.js +31 -0
- package/dist/src/trails/topo-pin.js.map +1 -0
- package/dist/src/trails/topo-read-support.d.ts +58 -0
- package/dist/src/trails/topo-read-support.d.ts.map +1 -0
- package/dist/src/trails/topo-read-support.js +167 -0
- package/dist/src/trails/topo-read-support.js.map +1 -0
- package/dist/src/trails/topo-reports.d.ts +54 -0
- package/dist/src/trails/topo-reports.d.ts.map +1 -0
- package/dist/src/trails/topo-reports.js +128 -0
- package/dist/src/trails/topo-reports.js.map +1 -0
- package/dist/src/trails/topo-show.d.ts +23 -0
- package/dist/src/trails/topo-show.d.ts.map +1 -0
- package/dist/src/trails/topo-show.js +49 -0
- package/dist/src/trails/topo-show.js.map +1 -0
- package/dist/src/trails/topo-store-support.d.ts +13 -0
- package/dist/src/trails/topo-store-support.d.ts.map +1 -0
- package/dist/src/trails/topo-store-support.js +55 -0
- package/dist/src/trails/topo-store-support.js.map +1 -0
- package/dist/src/trails/topo-support.d.ts +76 -0
- package/dist/src/trails/topo-support.d.ts.map +1 -0
- package/dist/src/trails/topo-support.js +132 -0
- package/dist/src/trails/topo-support.js.map +1 -0
- package/dist/src/trails/topo-unpin.d.ts +20 -0
- package/dist/src/trails/topo-unpin.d.ts.map +1 -0
- package/dist/src/trails/topo-unpin.js +44 -0
- package/dist/src/trails/topo-unpin.js.map +1 -0
- package/dist/src/trails/topo-verify.d.ts +5 -0
- package/dist/src/trails/topo-verify.d.ts.map +1 -0
- package/dist/src/trails/topo-verify.js +24 -0
- package/dist/src/trails/topo-verify.js.map +1 -0
- package/dist/src/trails/topo.d.ts +5 -0
- package/dist/src/trails/topo.d.ts.map +1 -0
- package/dist/src/trails/topo.js +63 -0
- package/dist/src/trails/topo.js.map +1 -0
- package/dist/src/trails/warden.d.ts +3 -2
- package/dist/src/trails/warden.d.ts.map +1 -1
- package/dist/src/trails/warden.js +37 -27
- package/dist/src/trails/warden.js.map +1 -1
- package/dist/src/versions.d.ts +12 -0
- package/dist/src/versions.d.ts.map +1 -0
- package/dist/src/versions.js +23 -0
- package/dist/src/versions.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
- package/src/__tests__/add-trail.test.ts +97 -0
- package/src/__tests__/create.test.ts +91 -27
- package/src/__tests__/draft-promote.test.ts +144 -0
- package/src/__tests__/guide.test.ts +10 -5
- package/src/__tests__/load-app.test.ts +406 -2
- package/src/__tests__/survey.test.ts +221 -60
- package/src/__tests__/topo-dev.test.ts +426 -0
- package/src/app.ts +24 -2
- package/src/clack.ts +1 -1
- package/src/cli.ts +4 -3
- package/src/trails/add-surface.ts +150 -0
- package/src/trails/add-trail.ts +46 -10
- package/src/trails/add-verify.ts +11 -6
- package/src/trails/create-scaffold.ts +16 -3
- package/src/trails/create.ts +76 -71
- package/src/trails/dev-clean.ts +77 -0
- package/src/trails/dev-reset.ts +45 -0
- package/src/trails/dev-stats.ts +67 -0
- package/src/trails/dev-support.ts +328 -0
- package/src/trails/draft-promote.ts +739 -0
- package/src/trails/guide.ts +23 -41
- package/src/trails/load-app.ts +556 -14
- package/src/trails/project.ts +17 -3
- package/src/trails/survey.ts +110 -285
- package/src/trails/topo-constants.ts +2 -0
- package/src/trails/topo-export.ts +35 -0
- package/src/trails/topo-history.ts +38 -0
- package/src/trails/topo-pin.ts +38 -0
- package/src/trails/topo-read-support.ts +329 -0
- package/src/trails/topo-reports.ts +228 -0
- package/src/trails/topo-show.ts +54 -0
- package/src/trails/topo-store-support.ts +104 -0
- package/src/trails/topo-support.ts +230 -0
- package/src/trails/topo-unpin.ts +56 -0
- package/src/trails/topo-verify.ts +25 -0
- package/src/trails/topo.ts +69 -0
- package/src/trails/warden.ts +13 -3
- package/src/versions.ts +43 -0
- package/tsconfig.tests.json +10 -0
- package/src/trails/add-trailhead.ts +0 -121
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Topo, TopoSnapshot } from '@ontrails/core';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { BriefReport, SurveyListReport } from './topo-reports.js';
|
|
4
|
+
/** Output schema for a topo snapshot record. Shared across topo trails. */
|
|
5
|
+
export declare const topoSnapshotOutput: z.ZodObject<{
|
|
6
|
+
createdAt: z.ZodString;
|
|
7
|
+
gitDirty: z.ZodBoolean;
|
|
8
|
+
gitSha: z.ZodOptional<z.ZodString>;
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
pinnedAs: z.ZodOptional<z.ZodString>;
|
|
11
|
+
resourceCount: z.ZodNumber;
|
|
12
|
+
signalCount: z.ZodNumber;
|
|
13
|
+
trailCount: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const DEFAULT_APP_MODULE = "./src/app.ts";
|
|
16
|
+
export declare const DEFAULT_TOPO_HISTORY_LIMIT = 10;
|
|
17
|
+
export declare const LOCK_PATH = ".trails/trails.lock";
|
|
18
|
+
export interface TopoSummaryReport {
|
|
19
|
+
readonly app: BriefReport;
|
|
20
|
+
readonly dbPath: string;
|
|
21
|
+
readonly list: SurveyListReport;
|
|
22
|
+
readonly lockExists: boolean;
|
|
23
|
+
readonly lockPath: string;
|
|
24
|
+
}
|
|
25
|
+
export interface TopoHistoryReport {
|
|
26
|
+
readonly dbPath: string;
|
|
27
|
+
readonly limit: number;
|
|
28
|
+
readonly pinnedCount: number;
|
|
29
|
+
readonly snapshotCount: number;
|
|
30
|
+
readonly snapshots: TopoSnapshot[];
|
|
31
|
+
}
|
|
32
|
+
export interface TopoExportReport {
|
|
33
|
+
readonly hash: string;
|
|
34
|
+
readonly lockPath: string;
|
|
35
|
+
readonly mapPath: string;
|
|
36
|
+
readonly snapshot: TopoSnapshot;
|
|
37
|
+
}
|
|
38
|
+
export interface TopoVerifyReport {
|
|
39
|
+
readonly committedHash: string;
|
|
40
|
+
readonly currentHash: string;
|
|
41
|
+
readonly lockPath: string;
|
|
42
|
+
readonly stale: false;
|
|
43
|
+
}
|
|
44
|
+
export declare const deriveRootDir: (cwd?: string) => string;
|
|
45
|
+
export declare const readGitState: (rootDir: string) => {
|
|
46
|
+
readonly gitDirty: boolean;
|
|
47
|
+
readonly gitSha?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const deriveTopoCounts: (app: Topo) => Pick<TopoSnapshot, "resourceCount" | "signalCount" | "trailCount">;
|
|
50
|
+
export declare const createIsolatedExampleInput: (name: string) => {
|
|
51
|
+
readonly module: string;
|
|
52
|
+
readonly rootDir: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const createCurrentTopoSnapshot: (app: Topo, options?: {
|
|
55
|
+
readonly rootDir?: string;
|
|
56
|
+
}) => TopoSnapshot;
|
|
57
|
+
export declare const listTopoHistory: (options?: {
|
|
58
|
+
readonly limit?: number;
|
|
59
|
+
readonly rootDir?: string;
|
|
60
|
+
}) => TopoHistoryReport;
|
|
61
|
+
export declare const pinCurrentTopoSnapshot: (app: Topo, input: {
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly rootDir?: string;
|
|
64
|
+
}) => {
|
|
65
|
+
readonly snapshot: TopoSnapshot;
|
|
66
|
+
};
|
|
67
|
+
export declare const removePinnedTopoSnapshot: (input: {
|
|
68
|
+
readonly dryRun: boolean;
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly rootDir?: string;
|
|
71
|
+
}) => {
|
|
72
|
+
readonly dryRun: boolean;
|
|
73
|
+
readonly removed: boolean;
|
|
74
|
+
readonly snapshot?: TopoSnapshot;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=topo-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo-support.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-support.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,KA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AC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;CAsBlC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo-support.js","sourceRoot":"","sources":["../../../src/trails/topo-support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,kBAAkB,IAAI,mBAAmB,EACzC,iBAAiB,IAAI,iBAAiB,EACtC,eAAe,EACf,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,CAAC,CAAC,MAAM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,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,IAAI,CAChE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,CACjD,CAAC;QACF,OAAO,QAAQ,KAAK,SAAS;YAC3B,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE;YAClC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo-unpin.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-unpin.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;SA8CzB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,mBAAmB,CAAC;AAE3B,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,YAAY,EAAE;IAChD,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACpB,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC;YAChD,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,eAAe,CACjB,0DAA0D,CAC3D,CACF,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC1D,OAAO,MAAM,CAAC,EAAE,CACd,wBAAwB,CAAC;YACvB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO;SACR,CAAC,CACH,CAAC;IACJ,CAAC;IACD,WAAW,EAAE,yBAAyB;IACtC,QAAQ,EAAE;QACR;YACE,KAAK,EAAE;gBACL,GAAG,0BAA0B,CAAC,YAAY,CAAC;gBAC3C,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,sBAAsB;aAC7B;YACD,IAAI,EAAE,qBAAqB;SAC5B;KACF;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,MAAM,EAAE,CAAC;aACN,OAAO,EAAE;aACT,OAAO,CAAC,IAAI,CAAC;aACb,QAAQ,CAAC,4CAA4C,CAAC;QACzD,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;QACnE,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,6BAA6B,CAAC;KACxE,CAAC;IACF,MAAM,EAAE,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo-verify.d.ts","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,eAAe;;;uDAkB1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo-verify.js","sourceRoot":"","sources":["../../../src/trails/topo-verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,EAAE;IAClD,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,iBAAiB,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,WAAW,EAAE,6DAA6D;IAC1E,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,CAAC,CAAC,MAAM,CAAC;QACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;QACzB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;KACxB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"topo.d.ts","sourceRoot":"","sources":["../../../src/trails/topo.ts"],"names":[],"mappings":"AAiDA,eAAO,MAAM,SAAS;;;wDAmBpB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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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@@
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const wardenTrail: import("@ontrails/core").Trail<{
|
|
7
7
|
driftOnly: boolean;
|
|
8
|
-
format: "
|
|
8
|
+
format: "text" | "summary" | "json" | "github";
|
|
9
9
|
lintOnly: boolean;
|
|
10
|
+
module?: string | undefined;
|
|
10
11
|
rootDir?: string | undefined;
|
|
11
12
|
}, {
|
|
12
13
|
diagnostics: readonly import("@ontrails/warden").WardenDiagnostic[];
|
|
@@ -15,5 +16,5 @@ export declare const wardenTrail: import("@ontrails/core").Trail<{
|
|
|
15
16
|
formatted: string;
|
|
16
17
|
passed: boolean;
|
|
17
18
|
warnCount: number;
|
|
18
|
-
}>;
|
|
19
|
+
}, never>;
|
|
19
20
|
//# sourceMappingURL=warden.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warden.d.ts","sourceRoot":"","sources":["../../../src/trails/warden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"warden.d.ts","sourceRoot":"","sources":["../../../src/trails/warden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,eAAO,MAAM,WAAW;;;;;;;;;;;;;SA2FtB,CAAC"}
|
|
@@ -11,6 +11,38 @@ import { loadApp } from './load-app.js';
|
|
|
11
11
|
// Trail definition
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
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
|
+
},
|
|
14
46
|
description: 'Run governance checks (lint + drift)',
|
|
15
47
|
examples: [
|
|
16
48
|
{
|
|
@@ -34,6 +66,10 @@ export const wardenTrail = trail('warden', {
|
|
|
34
66
|
.default('text')
|
|
35
67
|
.describe('Output format: text, json, github, or summary'),
|
|
36
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)'),
|
|
37
73
|
rootDir: z.string().optional().describe('Root directory to scan'),
|
|
38
74
|
}),
|
|
39
75
|
intent: 'read',
|
|
@@ -47,6 +83,7 @@ export const wardenTrail = trail('warden', {
|
|
|
47
83
|
})),
|
|
48
84
|
drift: z
|
|
49
85
|
.object({
|
|
86
|
+
blockedReason: z.string().optional(),
|
|
50
87
|
committedHash: z.string().nullable(),
|
|
51
88
|
currentHash: z.string(),
|
|
52
89
|
stale: z.boolean(),
|
|
@@ -57,32 +94,5 @@ export const wardenTrail = trail('warden', {
|
|
|
57
94
|
passed: z.boolean(),
|
|
58
95
|
warnCount: z.number(),
|
|
59
96
|
}),
|
|
60
|
-
run: async (input, ctx) => {
|
|
61
|
-
const rootDir = input.rootDir ?? ctx.cwd ?? process.cwd();
|
|
62
|
-
// oxlint-disable-next-line prefer-await-to-then -- catch converts rejection to undefined cleanly
|
|
63
|
-
const topo = await loadApp('./src/app.ts', rootDir).catch(() => undefined);
|
|
64
|
-
const report = await runWarden({
|
|
65
|
-
driftOnly: input.driftOnly,
|
|
66
|
-
lintOnly: input.lintOnly,
|
|
67
|
-
rootDir,
|
|
68
|
-
topo,
|
|
69
|
-
});
|
|
70
|
-
const formatters = {
|
|
71
|
-
github: formatGitHubAnnotations,
|
|
72
|
-
json: formatJson,
|
|
73
|
-
summary: formatSummary,
|
|
74
|
-
text: formatWardenReport,
|
|
75
|
-
};
|
|
76
|
-
const formatter = formatters[input.format] ?? formatWardenReport;
|
|
77
|
-
const formatted = formatter(report);
|
|
78
|
-
return Result.ok({
|
|
79
|
-
diagnostics: report.diagnostics,
|
|
80
|
-
drift: report.drift,
|
|
81
|
-
errorCount: report.errorCount,
|
|
82
|
-
formatted,
|
|
83
|
-
passed: report.passed,
|
|
84
|
-
warnCount: report.warnCount,
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
97
|
});
|
|
88
98
|
//# sourceMappingURL=warden.js.map
|
|
@@ -1 +1 @@
|
|
|
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,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C,8CAA8C,CAAC;QAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;KAClE,CAAC;IACF,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,WAAW,EAAE,CAAC,CAAC,KAAK,CAClB,CAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;YACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;YAChB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SACpC,CAAC,CACH;QACD,KAAK,EAAE,CAAC;aACL,MAAM,CAAC;YACN,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACpC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;YACvB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;SACnB,CAAC;aACD,QAAQ,EAAE;QACb,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;KACtB,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"root":["../src/app.ts","../src/clack.ts","../src/cli.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/guide.ts","../src/trails/load-app.ts","../src/trails/project.ts","../src/trails/survey.ts","../src/trails/warden.ts","../bin/trails.ts"],"version":"5.9.3"}
|
|
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"}
|