@plexus-ms/lib 0.130.0 → 0.131.0
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/dist/apply.d.ts +25 -0
- package/dist/apply.d.ts.map +1 -0
- package/dist/apply.js +205 -0
- package/dist/apply.js.map +1 -0
- package/dist/bundled.d.ts +15 -0
- package/dist/bundled.d.ts.map +1 -0
- package/dist/bundled.js +42 -0
- package/dist/bundled.js.map +1 -0
- package/dist/consumers.d.ts +8 -21
- package/dist/consumers.d.ts.map +1 -1
- package/dist/consumers.js +62 -58
- package/dist/consumers.js.map +1 -1
- package/dist/doctor.d.ts +17 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +154 -9
- package/dist/doctor.js.map +1 -1
- package/dist/engine.d.ts +2 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +9 -0
- package/dist/engine.js.map +1 -0
- package/dist/frontmatter.d.ts.map +1 -1
- package/dist/frontmatter.js +6 -5
- package/dist/frontmatter.js.map +1 -1
- package/dist/index.d.ts +11 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/marker.d.ts +38 -0
- package/dist/marker.d.ts.map +1 -1
- package/dist/marker.js +269 -16
- package/dist/marker.js.map +1 -1
- package/dist/model.d.ts +5 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +8 -4
- package/dist/model.js.map +1 -1
- package/dist/need.d.ts +1 -1
- package/dist/need.d.ts.map +1 -1
- package/dist/need.js +2 -2
- package/dist/need.js.map +1 -1
- package/dist/newSite.d.ts +31 -0
- package/dist/newSite.d.ts.map +1 -0
- package/dist/newSite.js +185 -0
- package/dist/newSite.js.map +1 -0
- package/dist/overview.d.ts +4 -8
- package/dist/overview.d.ts.map +1 -1
- package/dist/overview.js +9 -32
- package/dist/overview.js.map +1 -1
- package/dist/pull.d.ts +48 -21
- package/dist/pull.d.ts.map +1 -1
- package/dist/pull.js +183 -67
- package/dist/pull.js.map +1 -1
- package/dist/recursive.d.ts.map +1 -1
- package/dist/recursive.js +7 -5
- package/dist/recursive.js.map +1 -1
- package/dist/siteTemplates.d.ts +14 -0
- package/dist/siteTemplates.d.ts.map +1 -0
- package/dist/siteTemplates.js +107 -0
- package/dist/siteTemplates.js.map +1 -0
- package/dist/sites.d.ts +24 -0
- package/dist/sites.d.ts.map +1 -0
- package/dist/sites.js +89 -0
- package/dist/sites.js.map +1 -0
- package/dist/standard-index.json +1 -1
- package/dist/summary.d.ts +1 -1
- package/dist/summary.d.ts.map +1 -1
- package/dist/summary.js +6 -1
- package/dist/summary.js.map +1 -1
- package/dist/sync.d.ts +86 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +227 -0
- package/dist/sync.js.map +1 -0
- package/dist/take.d.ts +20 -25
- package/dist/take.d.ts.map +1 -1
- package/dist/take.js +48 -142
- package/dist/take.js.map +1 -1
- package/dist/templates.d.ts +1 -3
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +5 -9
- package/dist/templates.js.map +1 -1
- package/dist/templatesRoot.d.ts +5 -0
- package/dist/templatesRoot.d.ts.map +1 -0
- package/dist/templatesRoot.js +37 -0
- package/dist/templatesRoot.js.map +1 -0
- package/dist/update.d.ts +18 -9
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +166 -78
- package/dist/update.js.map +1 -1
- package/dist/versionTemplates.d.ts +24 -0
- package/dist/versionTemplates.d.ts.map +1 -0
- package/dist/versionTemplates.js +168 -0
- package/dist/versionTemplates.js.map +1 -0
- package/package.json +2 -1
package/dist/apply.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from './context.ts';
|
|
2
|
+
import { type MarkerSite } from './sites.ts';
|
|
3
|
+
import { type SiteMerge } from './sync.ts';
|
|
4
|
+
export interface ApplyOptions {
|
|
5
|
+
/** The repo, a directory inside git's working tree at its top. */
|
|
6
|
+
repo: string;
|
|
7
|
+
/** The Plexus version of the running plx. */
|
|
8
|
+
plxVersion: string;
|
|
9
|
+
/** The root of the templates; default `templatesRoot()`, the ones this plx bundles. */
|
|
10
|
+
templates?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Applied {
|
|
13
|
+
sites: SiteMerge[];
|
|
14
|
+
conflicted: number;
|
|
15
|
+
/** The changes were written: false for a dry run, a no, and a run with nothing to write. */
|
|
16
|
+
applied: boolean;
|
|
17
|
+
/** The answer to the prompt was no. */
|
|
18
|
+
declined: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Where a repo that still has copier answers is pointed; the cutover writes the runbook's address here, once. */
|
|
21
|
+
export declare const CROSSOVER_RUNBOOK = "the crossover runbook";
|
|
22
|
+
/** The refusal that the root marker's `version` is not the running plx's, at HEAD and in the working tree, naming `verb` in what to do; none when it is. */
|
|
23
|
+
export declare function versionRefusal(now: readonly MarkerSite[], before: readonly MarkerSite[], plxVersion: string, verb?: string): string | undefined;
|
|
24
|
+
export declare function apply(ctx: Context, options: ApplyOptions): Promise<Applied>;
|
|
25
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,EAAa,KAAK,UAAU,EAAe,MAAM,YAAY,CAAC;AACrE,OAAO,EAA6B,KAAK,SAAS,EAA+B,MAAM,WAAW,CAAC;AAGnG,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,kHAAkH;AAClH,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAsCzD,4JAA4J;AAC5J,wBAAgB,cAAc,CAC5B,GAAG,EAAE,SAAS,UAAU,EAAE,EAC1B,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,UAAU,EAAE,MAAM,EAClB,IAAI,SAAU,GACb,MAAM,GAAG,SAAS,CAUpB;AAwDD,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CA4CjF"}
|
package/dist/apply.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// apply: bring a repo's files in line with its markers, at the version the
|
|
2
|
+
// repo is on. It is the second step of edit, apply, commit: a human edits a
|
|
3
|
+
// marker's answers or its `templates` list, and `plx apply` renders what that
|
|
4
|
+
// changes into the working tree. It is how a site adopts or drops a template.
|
|
5
|
+
// It commits nothing and stages nothing; the marker's `version` is never
|
|
6
|
+
// written here (only `plx update` moves it).
|
|
7
|
+
//
|
|
8
|
+
// The procedure.
|
|
9
|
+
// 1. Find the repo's top from the directory given. Refuse, before anything
|
|
10
|
+
// else, a directory in no repo, a repo without a commit (there is no HEAD
|
|
11
|
+
// to compare with), and a repo in which git tracks a `.copier-answers.yml`
|
|
12
|
+
// at any depth (it has not crossed over from copier, and its markers are
|
|
13
|
+
// not yet its configuration), pointing to the crossover runbook.
|
|
14
|
+
// 2. Read the markers twice (sites.ts): old as `HEAD` has them, new as the
|
|
15
|
+
// working tree has them. A site is a directory with a tracked marker, so
|
|
16
|
+
// a new marker needs `git add` before it is a site. Refuse when any
|
|
17
|
+
// marker on either side has a problem (it cannot be read, a nested one
|
|
18
|
+
// carries `version`), naming the marker and the side: one tracked marker
|
|
19
|
+
// with a problem anywhere in the repo, whatever site it belongs to,
|
|
20
|
+
// blocks the run for every site, since a marker that is not read cannot
|
|
21
|
+
// stand for a site with no templates.
|
|
22
|
+
// 3. When any marker lists templates, refuse unless the root marker's
|
|
23
|
+
// `version` is the running plx's both at HEAD and in the working tree:
|
|
24
|
+
// the templates this plx bundles are the ones that version was rendered
|
|
25
|
+
// with, and only `plx update` writes the version.
|
|
26
|
+
// 4. Take each site whose own marker changed (its `templates` or its own
|
|
27
|
+
// answers, or it is new or gone), and each nested site that lists a
|
|
28
|
+
// template which owns or reads a root answer that changed, the root's
|
|
29
|
+
// resolved answers compared, defaults included, so that swapping a
|
|
30
|
+
// template for one with another default counts. A site that
|
|
31
|
+
// listed no templates on either side renders nothing, and one not taken
|
|
32
|
+
// is not rendered at all, so it cannot fail or write back a file its
|
|
33
|
+
// user deleted.
|
|
34
|
+
// 5. Plan (sync.ts): render the old side and the new side of each taken
|
|
35
|
+
// site with the templates below the root of templates, the root first,
|
|
36
|
+
// its resolved answers given to the nested sites; merge them into the
|
|
37
|
+
// site's directory by the engine's rules; and work out the defaults of
|
|
38
|
+
// questions that became applicable. Nothing is written yet, every render
|
|
39
|
+
// error of every site is reported together, and a default that would
|
|
40
|
+
// stand in two markers is refused.
|
|
41
|
+
// 6. Confirm, then perform: write the merges and splice the defaults into
|
|
42
|
+
// the markers. A conflict stays in the file; a file the template dropped
|
|
43
|
+
// and the user had edited is kept; both are reported `conflicted`, and
|
|
44
|
+
// the caller exits non-zero. A dry run, or a no, writes nothing.
|
|
45
|
+
// Birth commands of a template are never run: they belong to creating a repo.
|
|
46
|
+
//
|
|
47
|
+
// A second apply without a commit in between compares with the same HEAD and
|
|
48
|
+
// finds the files as the first left them: the bytes stay as they are, a
|
|
49
|
+
// conflicted file is reported `conflicted` again and the exit is non-zero
|
|
50
|
+
// again, and the other outcomes differ, since the files now hold what the
|
|
51
|
+
// first run wrote (a file it `added` is `clean`, one it `deleted` or a
|
|
52
|
+
// born-once file is `kept`). The defaults are in the marker by then, so none
|
|
53
|
+
// is written twice.
|
|
54
|
+
//
|
|
55
|
+
// The one gap: an answer edited and committed without `apply` is not noticed
|
|
56
|
+
// afterwards. HEAD then already holds the new marker, so apply sees no
|
|
57
|
+
// difference, and no lock file records what the files were rendered from.
|
|
58
|
+
import { join } from 'node:path';
|
|
59
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
60
|
+
import { loadTemplate } from "./bundled.js";
|
|
61
|
+
import { ANSWERS_FILE } from "./copier.js";
|
|
62
|
+
import { crossedOver } from "./doctor.js";
|
|
63
|
+
import { MARKER_FILE } from "./marker.js";
|
|
64
|
+
import { findSites, siteAnswers } from "./sites.js";
|
|
65
|
+
import { planSync, resolvedAnswers } from "./sync.js";
|
|
66
|
+
import { templatesRoot } from "./templatesRoot.js";
|
|
67
|
+
/** Where a repo that still has copier answers is pointed; the cutover writes the runbook's address here, once. */
|
|
68
|
+
export const CROSSOVER_RUNBOOK = 'the crossover runbook';
|
|
69
|
+
/** The templates and answers the site at `dir` among `sites` is rendered from; none where it has no marker. */
|
|
70
|
+
function sourceAt(sites, dir, where) {
|
|
71
|
+
const config = sites.find((s) => s.dir === dir)?.config;
|
|
72
|
+
if (!config)
|
|
73
|
+
return { templates: [], answers: {} };
|
|
74
|
+
try {
|
|
75
|
+
return { templates: config.templates ?? [], answers: siteAnswers(sites, dir) };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
throw new Error(`${error.message} (the markers ${where})`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const AT_HEAD = 'at HEAD';
|
|
82
|
+
const IN_TREE = 'in the working tree';
|
|
83
|
+
/** The top of the repo that `dir` is inside; rejects, saying so, when it is inside none. */
|
|
84
|
+
async function topOf(ctx, dir) {
|
|
85
|
+
try {
|
|
86
|
+
return (await ctx.read('git', ['rev-parse', '--show-toplevel'], { cwd: dir })).trim();
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
throw new Error(`${dir} is not inside a git repository`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Every marker with a problem, as the lines of one refusal; none when all are readable. */
|
|
93
|
+
function problemsOf(now, before) {
|
|
94
|
+
const lines = [...now.map((s) => ({ s, where: IN_TREE })), ...before.map((s) => ({ s, where: AT_HEAD }))]
|
|
95
|
+
.filter(({ s }) => s.problem !== undefined)
|
|
96
|
+
.map(({ s, where }) => `${join(s.dir, MARKER_FILE)} ${where}: ${s.problem}`);
|
|
97
|
+
return lines.length === 0
|
|
98
|
+
? []
|
|
99
|
+
: [
|
|
100
|
+
...lines,
|
|
101
|
+
'apply compares the markers in the working tree with those at HEAD, so every one must be readable: fix it, and commit the fix where HEAD has the problem; nothing was written',
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
/** The refusal that the root marker's `version` is not the running plx's, at HEAD and in the working tree, naming `verb` in what to do; none when it is. */
|
|
105
|
+
export function versionRefusal(now, before, plxVersion, verb = 'apply') {
|
|
106
|
+
const [current, committed] = [now, before].map((sites) => sites.find((s) => s.dir === '.')?.config?.version);
|
|
107
|
+
const root = MARKER_FILE;
|
|
108
|
+
if (current === undefined)
|
|
109
|
+
return `the root ${root} names no version, so plx cannot tell which templates the files were rendered with: set \`version: ${plxVersion}\` there (the plx pin in mise.toml names it) and commit it, then run ${verb} again`;
|
|
110
|
+
if (committed !== current)
|
|
111
|
+
return `the root ${root} names version ${current} in the working tree and ${committed ?? 'none'} at HEAD: the version is not edited by hand, only \`plx update\` writes it; restore it with git checkout HEAD -- ${root} (or undo that line)`;
|
|
112
|
+
if (current !== plxVersion)
|
|
113
|
+
return `the root ${root} names version ${current}, and this plx is ${plxVersion}: ${verb} with the plx that version pins (mise.toml)`;
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
/** The keys whose answer differs between two maps: present in one only, or different. */
|
|
117
|
+
const changedKeys = (a, b) => [...new Set([...Object.keys(a), ...Object.keys(b)])].filter((key) => !isDeepStrictEqual(a[key], b[key]));
|
|
118
|
+
/** Whether a template of `names` owns or reads one of `keys`; a template that cannot be loaded counts, so that the error shows. */
|
|
119
|
+
async function relatesTo(root, names, keys) {
|
|
120
|
+
for (const name of names) {
|
|
121
|
+
try {
|
|
122
|
+
const manifest = await loadTemplate(root, name);
|
|
123
|
+
const mine = [...manifest.questions.map((q) => q.name), ...manifest.reads.map((r) => r.name)];
|
|
124
|
+
if (keys.some((key) => mine.includes(key)))
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The sites to render, each with its two sides: those whose own marker changed
|
|
135
|
+
* (its templates or its own answers, or the marker is new or gone), and the
|
|
136
|
+
* nested sites that list a template which owns or reads a root answer that
|
|
137
|
+
* changed, its resolved answers compared, defaults included. A site with no
|
|
138
|
+
* templates on either side renders nothing. When a site is taken the root is
|
|
139
|
+
* rendered with it for the answers it gives, and merged only if it changed
|
|
140
|
+
* itself.
|
|
141
|
+
*/
|
|
142
|
+
async function sitesToTake(now, before, templates) {
|
|
143
|
+
const configOf = (sites, dir) => sites.find((s) => s.dir === dir)?.config;
|
|
144
|
+
const [oldRoot, newRoot] = [sourceAt(before, '.', AT_HEAD), sourceAt(now, '.', IN_TREE)];
|
|
145
|
+
// Equal root sources resolve to equal answers, so the templates are looked for only once the root changed.
|
|
146
|
+
const rootChanged = isDeepStrictEqual(oldRoot, newRoot)
|
|
147
|
+
? []
|
|
148
|
+
: changedKeys(await resolvedAnswers(templates(), oldRoot), await resolvedAnswers(templates(), newRoot));
|
|
149
|
+
const sides = [];
|
|
150
|
+
for (const dir of new Set([...now, ...before].map((s) => s.dir))) {
|
|
151
|
+
const [old, next] = [sourceAt(before, dir, AT_HEAD), sourceAt(now, dir, IN_TREE)];
|
|
152
|
+
if (next.templates.length + old.templates.length === 0)
|
|
153
|
+
continue;
|
|
154
|
+
const [was, is] = [configOf(before, dir), configOf(now, dir)];
|
|
155
|
+
const own = !isDeepStrictEqual(was?.templates ?? [], is?.templates ?? []) ||
|
|
156
|
+
!isDeepStrictEqual(was?.answers ?? {}, is?.answers ?? {});
|
|
157
|
+
if (own || (rootChanged.length > 0 && (await relatesTo(templates(), next.templates, rootChanged))))
|
|
158
|
+
sides.push({ dir, old, new: next });
|
|
159
|
+
}
|
|
160
|
+
if (sides.length > 0 && !sides.some((s) => s.dir === '.'))
|
|
161
|
+
sides.unshift({ dir: '.', old: oldRoot, new: newRoot, contextOnly: true });
|
|
162
|
+
return sides;
|
|
163
|
+
}
|
|
164
|
+
export async function apply(ctx, options) {
|
|
165
|
+
const { plxVersion } = options;
|
|
166
|
+
const repo = await topOf(ctx, options.repo);
|
|
167
|
+
if (repo !== options.repo)
|
|
168
|
+
ctx.say(`using the top of the repo, ${repo}`);
|
|
169
|
+
const tracked = (await ctx.read('git', ['ls-files', '-z'], { cwd: repo })).split('\0');
|
|
170
|
+
if (!crossedOver(tracked))
|
|
171
|
+
throw new Error(`${repo} still tracks a ${ANSWERS_FILE}, so it has not crossed over from copier to the markers: follow ${CROSSOVER_RUNBOOK}`);
|
|
172
|
+
if (!(await ctx.read('git', ['rev-parse', '--verify', '--quiet', 'HEAD'], { cwd: repo }).then(() => true, () => false)))
|
|
173
|
+
throw new Error(`${repo} has no commit yet: apply compares the markers in the working tree with HEAD, so commit them first`);
|
|
174
|
+
const now = await findSites(ctx, repo);
|
|
175
|
+
const before = await findSites(ctx, repo, 'HEAD');
|
|
176
|
+
const problems = problemsOf(now, before);
|
|
177
|
+
if (problems.length > 0)
|
|
178
|
+
throw new Error(problems.join('\n'));
|
|
179
|
+
if ([...now, ...before].some((s) => s.config?.templates !== undefined)) {
|
|
180
|
+
const refusal = versionRefusal(now, before, plxVersion);
|
|
181
|
+
if (refusal !== undefined)
|
|
182
|
+
throw new Error(refusal);
|
|
183
|
+
}
|
|
184
|
+
const templates = () => options.templates ?? templatesRoot();
|
|
185
|
+
const sides = await sitesToTake(now, before, templates);
|
|
186
|
+
if (sides.length === 0)
|
|
187
|
+
return { sites: [], conflicted: 0, applied: false, declined: false };
|
|
188
|
+
const siblings = now
|
|
189
|
+
.filter((s) => s.dir !== '.')
|
|
190
|
+
.map((s) => ({ dir: s.dir, templates: s.config?.templates ?? [], answers: s.config?.answers ?? {} }));
|
|
191
|
+
const plan = await planSync(ctx, repo, templates(), sides, {
|
|
192
|
+
labels: { old: 'the markers at HEAD', new: 'the markers in the working tree' },
|
|
193
|
+
siblings,
|
|
194
|
+
});
|
|
195
|
+
const changes = plan.sites.reduce((n, s) => n + s.report.length + Object.keys(s.defaults).length, 0);
|
|
196
|
+
const result = { sites: plan.sites, conflicted: plan.conflicted };
|
|
197
|
+
if (changes === 0)
|
|
198
|
+
return { ...result, applied: false, declined: false };
|
|
199
|
+
const where = plan.sites.length === 1 ? 'one site' : `${plan.sites.length} sites`;
|
|
200
|
+
if (!(await ctx.confirm(`apply ${changes} changes in ${where} to ${repo}?`)))
|
|
201
|
+
return { ...result, applied: false, declined: true };
|
|
202
|
+
await plan.perform();
|
|
203
|
+
return { ...result, applied: !ctx.dryRun, declined: false };
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../src/apply.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,yEAAyE;AACzE,6CAA6C;AAC7C,EAAE;AACF,iBAAiB;AACjB,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,sEAAsE;AACtE,6EAA6E;AAC7E,8EAA8E;AAC9E,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAC7E,2CAA2C;AAC3C,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,uDAAuD;AACvD,2EAA2E;AAC3E,yEAAyE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AAQ,CAAC;IAClF,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,OAAO,eAAe,KAAK,OAAO,IAAI,GAAG,CAAC,CAAC;QAC1E,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACvD,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACrB,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Manifest, TemplateDirectory } from '@plexus-ms/cli-template';
|
|
2
|
+
/** The directory of the template `name` below `root`; rejects when `name` is no template name or no such template is there. */
|
|
3
|
+
export declare function templateDirectory(root: string, name: string): Promise<string>;
|
|
4
|
+
/**
|
|
5
|
+
* The template `name` below `root`, read once: its manifest (questions with
|
|
6
|
+
* their defaults and help, reads, policies, birth commands) and its tree for
|
|
7
|
+
* the engine's `render`. Rejects naming the root when the template is not
|
|
8
|
+
* there, listing every problem when its manifest cannot be read, and when it
|
|
9
|
+
* declares a question named like a key of the marker (`RESERVED_KEYS`), which
|
|
10
|
+
* the marker's own keys would shadow.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readTemplate(root: string, name: string): Promise<TemplateDirectory>;
|
|
13
|
+
/** The manifest of the template `name` below `root`, with `readTemplate`'s refusals. */
|
|
14
|
+
export declare function loadTemplate(root: string, name: string): Promise<Manifest>;
|
|
15
|
+
//# sourceMappingURL=bundled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAK3E,+HAA+H;AAC/H,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOnF;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAWzF;AAED,wFAAwF;AACxF,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhF"}
|
package/dist/bundled.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Templates by name below a root directory that holds one directory per
|
|
2
|
+
// template, and the loader of one template's manifest. A verb that renders
|
|
3
|
+
// takes the root as an input and defaults it to `templatesRoot()`, the one
|
|
4
|
+
// place that knows where the bundled templates are; the engine reads them as
|
|
5
|
+
// it reads any template directory (`@plexus-ms/cli-template`).
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import { engine } from "./engine.js";
|
|
8
|
+
import { RESERVED_KEYS } from "./marker.js";
|
|
9
|
+
import { isDirectory } from "./templatesRoot.js";
|
|
10
|
+
/** The directory of the template `name` below `root`; rejects when `name` is no template name or no such template is there. */
|
|
11
|
+
export async function templateDirectory(root, name) {
|
|
12
|
+
const { TEMPLATE_NAME } = await engine();
|
|
13
|
+
if (!TEMPLATE_NAME.test(name))
|
|
14
|
+
throw new Error(`${JSON.stringify(name)} is not a template name: lowercase letters, digits and hyphens`);
|
|
15
|
+
const dir = join(root, name);
|
|
16
|
+
if (!isDirectory(dir))
|
|
17
|
+
throw new Error(`no template ${name} in ${root}`);
|
|
18
|
+
return dir;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The template `name` below `root`, read once: its manifest (questions with
|
|
22
|
+
* their defaults and help, reads, policies, birth commands) and its tree for
|
|
23
|
+
* the engine's `render`. Rejects naming the root when the template is not
|
|
24
|
+
* there, listing every problem when its manifest cannot be read, and when it
|
|
25
|
+
* declares a question named like a key of the marker (`RESERVED_KEYS`), which
|
|
26
|
+
* the marker's own keys would shadow.
|
|
27
|
+
*/
|
|
28
|
+
export async function readTemplate(root, name) {
|
|
29
|
+
const { readTemplateDirectory } = await engine();
|
|
30
|
+
const template = await readTemplateDirectory(await templateDirectory(root, name));
|
|
31
|
+
const reserved = template.manifest.questions
|
|
32
|
+
.map((q) => q.name)
|
|
33
|
+
.filter((q) => RESERVED_KEYS.includes(q));
|
|
34
|
+
if (reserved.length > 0)
|
|
35
|
+
throw new Error(`template ${name} declares ${reserved.map((q) => `\`${q}\``).join(', ')}, which ${reserved.length === 1 ? 'is a key' : 'are keys'} of the marker and no question's name: rename it in the template`);
|
|
36
|
+
return template;
|
|
37
|
+
}
|
|
38
|
+
/** The manifest of the template `name` below `root`, with `readTemplate`'s refusals. */
|
|
39
|
+
export async function loadTemplate(root, name) {
|
|
40
|
+
return (await readTemplate(root, name)).manifest;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=bundled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.js","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,6EAA6E;AAC7E,+DAA+D;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,+HAA+H;AAC/H,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAY,EAAE,IAAY;IAChE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,EAAE,CAAC;IACzC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,GA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,CAAC,QAAQ,CAAC;AACnD,CAAC"}
|
package/dist/consumers.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Context } from './context.ts';
|
|
2
|
-
import { type Answers } from './copier.ts';
|
|
3
2
|
import { type Directory } from './model.ts';
|
|
4
3
|
export interface Site {
|
|
5
4
|
path: string;
|
|
@@ -18,11 +17,18 @@ export interface Consumer {
|
|
|
18
17
|
origin?: string;
|
|
19
18
|
/** Why the consumer is left untouched this run, if it is. */
|
|
20
19
|
skipped?: string;
|
|
21
|
-
/** Its sites in tree order
|
|
20
|
+
/** Its copier-managed sites in tree order, the repo root before its apps; none for a repo found by its markers. */
|
|
22
21
|
sites: Site[];
|
|
23
22
|
}
|
|
24
23
|
/** The branch a consumer is updated on; undefined for a repo without a marker. */
|
|
25
24
|
export declare function expectedBranch(repo: Directory): Consumer['expected'];
|
|
25
|
+
/**
|
|
26
|
+
* The repos under a scanned workspace (`overview` with git facets) that take a
|
|
27
|
+
* version, in tree order: each git repo outside a template directory whose
|
|
28
|
+
* root marker names a version or lists templates, or whose root answers file
|
|
29
|
+
* names one of the templates. A repo without an origin is skipped.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findRepos(ctx: Context, root: Directory): Promise<Consumer[]>;
|
|
26
32
|
/**
|
|
27
33
|
* The consumers under a scanned workspace (`overview` with git facets), for
|
|
28
34
|
* the given templates. A site inside a template directory is the template's own
|
|
@@ -30,23 +36,4 @@ export declare function expectedBranch(repo: Directory): Consumer['expected'];
|
|
|
30
36
|
* a repo without an origin has nowhere to clone from and is skipped.
|
|
31
37
|
*/
|
|
32
38
|
export declare function findConsumers(ctx: Context, root: Directory, templates: readonly string[]): Promise<Consumer[]>;
|
|
33
|
-
/** A site of a tree read from git: its directory relative to the repo (`.` for the root), and its answers. */
|
|
34
|
-
export interface TreeSite {
|
|
35
|
-
dir: string;
|
|
36
|
-
/** Undefined when the answers file does not parse (a conflict in the answers themselves). */
|
|
37
|
-
answers?: Answers;
|
|
38
|
-
/** The template it is generated from; undefined with the answers. */
|
|
39
|
-
template?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* The sites of a commit's tree (a branch's tip, origin's branch), by the
|
|
43
|
-
* walk's rule (`answersDirs`): every answers file the walk would reach that
|
|
44
|
-
* names one of the templates, read from git, root first; and the tree's
|
|
45
|
-
* paths. An answers file that does not parse is a site all the same: one
|
|
46
|
-
* whose version cannot be read.
|
|
47
|
-
*/
|
|
48
|
-
export declare function sitesOfTree(ctx: Context, repo: string, commit: string): Promise<{
|
|
49
|
-
files: string[];
|
|
50
|
-
sites: TreeSite[];
|
|
51
|
-
}>;
|
|
52
39
|
//# sourceMappingURL=consumers.d.ts.map
|
package/dist/consumers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumers.d.ts","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"consumers.d.ts","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,YAAY,CAAC;AAG1D,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,2GAA2G;IAC3G,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mHAAmH;IACnH,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,CAKpE;AAwBD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAWlF;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CA0BpH"}
|
package/dist/consumers.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
// The consumers of the templates:
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
// The consumers of the templates: the repos under a directory that take a
|
|
2
|
+
// version. A consumer is updated in a scratch checkout of its origin's branch,
|
|
3
|
+
// never in its own checkout, on the branch the version lands on: the
|
|
4
|
+
// operations repo rides main, an app repo rides develop (§ 3 PLX-Delivery),
|
|
5
|
+
// and a package repo (its root answers say `publishes_packages`) is
|
|
6
|
+
// trunk-based on main (§ 5 PLX-Delivery). A repo without a marker is taken on
|
|
7
|
+
// the branch its checkout is on.
|
|
8
|
+
//
|
|
9
|
+
// `findRepos` finds them for `plx update`: every git repo whose root marker
|
|
10
|
+
// names a version or lists templates, and every one whose root answers file
|
|
11
|
+
// still names a template, which `update` refuses, pointing to the crossover
|
|
12
|
+
// runbook. `findConsumers` finds the copier-managed sites (tenant repo roots
|
|
13
|
+
// and their apps/*) and the repo each belongs to, for the maintainers'
|
|
14
|
+
// preview of an unreleased version (preview.ts of @plexus-ms/dev), which still
|
|
15
|
+
// runs copier until the cutover.
|
|
16
|
+
import { relative } from 'node:path';
|
|
11
17
|
import { isOperations } from "./model.js";
|
|
12
|
-
import { answersDirs } from "./overview.js";
|
|
13
18
|
import { TEMPLATES, templateOf } from "./templates.js";
|
|
14
19
|
/** The branch a consumer is updated on; undefined for a repo without a marker. */
|
|
15
20
|
export function expectedBranch(repo) {
|
|
@@ -17,7 +22,50 @@ export function expectedBranch(repo) {
|
|
|
17
22
|
return undefined;
|
|
18
23
|
if (isOperations(repo))
|
|
19
24
|
return 'main';
|
|
20
|
-
|
|
25
|
+
const packages = [repo.config?.answers, repo.copier?.answers].some((a) => a?.publishes_packages === true);
|
|
26
|
+
return packages ? 'main' : 'develop';
|
|
27
|
+
}
|
|
28
|
+
/** A consumer of the repo `dir`, named relative to `root`, before its origin is read. */
|
|
29
|
+
const consumerOf = (root, dir) => {
|
|
30
|
+
const expected = expectedBranch(dir);
|
|
31
|
+
return {
|
|
32
|
+
path: dir.path,
|
|
33
|
+
rel: relative(root.path, dir.path) || '.',
|
|
34
|
+
branch: expected ?? dir.git?.branch ?? 'main',
|
|
35
|
+
expected,
|
|
36
|
+
sites: [],
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** Each consumer's origin, which the scratch clone is made from; one without is skipped. */
|
|
40
|
+
async function withOrigins(ctx, consumers) {
|
|
41
|
+
for (const c of consumers) {
|
|
42
|
+
const origin = (await ctx.read('git', ['remote', 'get-url', 'origin'], { cwd: c.path }).catch(() => '')).trim();
|
|
43
|
+
if (origin === '')
|
|
44
|
+
c.skipped = 'no origin remote';
|
|
45
|
+
else
|
|
46
|
+
c.origin = origin;
|
|
47
|
+
}
|
|
48
|
+
return consumers;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The repos under a scanned workspace (`overview` with git facets) that take a
|
|
52
|
+
* version, in tree order: each git repo outside a template directory whose
|
|
53
|
+
* root marker names a version or lists templates, or whose root answers file
|
|
54
|
+
* names one of the templates. A repo without an origin is skipped.
|
|
55
|
+
*/
|
|
56
|
+
export async function findRepos(ctx, root) {
|
|
57
|
+
const found = [];
|
|
58
|
+
const visit = (dir, inTemplate) => {
|
|
59
|
+
const within = inTemplate || Boolean(dir.template);
|
|
60
|
+
const marked = dir.config?.version !== undefined || dir.config?.templates !== undefined;
|
|
61
|
+
const copier = dir.copier?.src !== undefined && templateOf(dir.copier.src, TEMPLATES) !== undefined;
|
|
62
|
+
if (dir.git && !within && (marked || copier))
|
|
63
|
+
found.push(consumerOf(root, dir));
|
|
64
|
+
for (const child of dir.children)
|
|
65
|
+
visit(child, within);
|
|
66
|
+
};
|
|
67
|
+
visit(root, false);
|
|
68
|
+
return withOrigins(ctx, found);
|
|
21
69
|
}
|
|
22
70
|
/**
|
|
23
71
|
* The consumers under a scanned workspace (`overview` with git facets), for
|
|
@@ -39,14 +87,7 @@ export async function findConsumers(ctx, root, templates) {
|
|
|
39
87
|
else {
|
|
40
88
|
let consumer = consumers.get(here.path);
|
|
41
89
|
if (!consumer) {
|
|
42
|
-
|
|
43
|
-
consumer = {
|
|
44
|
-
path: here.path,
|
|
45
|
-
rel: relative(root.path, here.path) || '.',
|
|
46
|
-
branch: expected ?? here.git?.branch ?? 'main',
|
|
47
|
-
expected,
|
|
48
|
-
sites: [],
|
|
49
|
-
};
|
|
90
|
+
consumer = consumerOf(root, here);
|
|
50
91
|
consumers.set(here.path, consumer);
|
|
51
92
|
}
|
|
52
93
|
consumer.sites.push(site);
|
|
@@ -58,43 +99,6 @@ export async function findConsumers(ctx, root, templates) {
|
|
|
58
99
|
visit(root, undefined, false);
|
|
59
100
|
for (const site of orphans)
|
|
60
101
|
ctx.say(`⚠ ${site.rel}: not inside a git repo — skipped`);
|
|
61
|
-
|
|
62
|
-
const origin = (await ctx.read('git', ['remote', 'get-url', 'origin'], { cwd: c.path }).catch(() => '')).trim();
|
|
63
|
-
if (origin === '')
|
|
64
|
-
c.skipped = 'no origin remote';
|
|
65
|
-
else
|
|
66
|
-
c.origin = origin;
|
|
67
|
-
}
|
|
68
|
-
return [...consumers.values()];
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* The sites of a commit's tree (a branch's tip, origin's branch), by the
|
|
72
|
-
* walk's rule (`answersDirs`): every answers file the walk would reach that
|
|
73
|
-
* names one of the templates, read from git, root first; and the tree's
|
|
74
|
-
* paths. An answers file that does not parse is a site all the same: one
|
|
75
|
-
* whose version cannot be read.
|
|
76
|
-
*/
|
|
77
|
-
export async function sitesOfTree(ctx, repo, commit) {
|
|
78
|
-
const files = (await ctx.read('git', ['ls-tree', '-r', '-z', '--name-only', commit], { cwd: repo }))
|
|
79
|
-
.split('\0')
|
|
80
|
-
.filter(Boolean);
|
|
81
|
-
const sites = [];
|
|
82
|
-
for (const dir of answersDirs(files)) {
|
|
83
|
-
const text = await ctx.read('git', ['cat-file', 'blob', `${commit}:${join(dir, ANSWERS_FILE)}`], { cwd: repo });
|
|
84
|
-
let answers;
|
|
85
|
-
try {
|
|
86
|
-
answers = parseAnswers(text);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
sites.push({ dir });
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const template = answers.src ? templateOf(answers.src, TEMPLATES) : undefined;
|
|
93
|
-
if (template)
|
|
94
|
-
sites.push({ dir, answers, template });
|
|
95
|
-
}
|
|
96
|
-
// The root before its apps, as the walk yields them.
|
|
97
|
-
sites.sort((a, b) => Number(b.dir === '.') - Number(a.dir === '.'));
|
|
98
|
-
return { files, sites };
|
|
102
|
+
return withOrigins(ctx, [...consumers.values()]);
|
|
99
103
|
}
|
|
100
104
|
//# sourceMappingURL=consumers.js.map
|
package/dist/consumers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumers.js","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"consumers.js","sourceRoot":"","sources":["../src/consumers.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,+EAA+E;AAC/E,qEAAqE;AACrE,4EAA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AAI,EAAE,IAAI,CAAC,CAAC;oBAClC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBACrC,CAAC;gBACD,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,QAAQ;YAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC;IACF,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAE9B,KAAK,MAAM,IAAI,IAAI,OAAO;QAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,mCAAmC,CAAC,CAAC;IACtF,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/doctor.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Compose, type Mapping } from './compose.ts';
|
|
|
2
2
|
import type { Context } from './context.ts';
|
|
3
3
|
import { type Declaration } from './marker.ts';
|
|
4
4
|
import { type Kind } from './model.ts';
|
|
5
|
+
import { type MarkerSite } from './sites.ts';
|
|
6
|
+
import { type Bundled } from './siteTemplates.ts';
|
|
5
7
|
export type Profile = 'stateless' | 'stateful';
|
|
6
8
|
/** The marker as read: its declaration, or why it cannot be read. */
|
|
7
9
|
export interface MarkerRead {
|
|
@@ -27,6 +29,18 @@ export interface RepoFacts {
|
|
|
27
29
|
conflicted?: string[];
|
|
28
30
|
/** Its apps' directories, relative to the repo (`apps/<name>`). */
|
|
29
31
|
apps: string[];
|
|
32
|
+
/** The `plx` pin of its `mise.toml`: the Plexus version it is on. */
|
|
33
|
+
pin?: string;
|
|
34
|
+
/** Every tracked marker read as configuration, the root first; undefined outside a git checkout. */
|
|
35
|
+
sites?: MarkerSite[];
|
|
36
|
+
/** Why the sites could not be listed or read, when they could not. */
|
|
37
|
+
sitesProblem?: string;
|
|
38
|
+
/** The templates this plx bundles, by name; undefined where they are not given, and the checks against them are skipped. */
|
|
39
|
+
templates?: Bundled;
|
|
40
|
+
/** The root marker's answers with the defaults of its templates, which a nested site's render is given beneath its own. */
|
|
41
|
+
rootAnswers?: Record<string, unknown>;
|
|
42
|
+
/** Why the checks against the templates were skipped, where this plx is not the version the root marker names. */
|
|
43
|
+
templatesSkipped?: string;
|
|
30
44
|
}
|
|
31
45
|
/** What doctor read of an app. */
|
|
32
46
|
export interface AppFacts {
|
|
@@ -67,6 +81,8 @@ interface AppCheck {
|
|
|
67
81
|
}
|
|
68
82
|
/** Every requirement doctor checks, by name: what the contract pages list, in their order. */
|
|
69
83
|
export declare const CHECKS: Readonly<Record<string, RepoCheck | AppCheck | UnitCheck>>;
|
|
84
|
+
/** Whether a repo has left copier behind: git tracks no answers file in it, at any depth. */
|
|
85
|
+
export declare const crossedOver: (tracked?: readonly string[]) => boolean;
|
|
70
86
|
export interface Finding {
|
|
71
87
|
/** The requirement's name, e.g. `PLX-App/LoopbackPort`; none for a conflict marker, which belongs to no requirement. */
|
|
72
88
|
requirement?: string;
|
|
@@ -122,6 +138,6 @@ export interface Examination {
|
|
|
122
138
|
* cannot be read, and a symbolic link to an app or a repo, are named, never
|
|
123
139
|
* fatal.
|
|
124
140
|
*/
|
|
125
|
-
export declare function examine(ctx: Context, dir: string): Promise<Examination>;
|
|
141
|
+
export declare function examine(ctx: Context, dir: string, plxVersion?: string): Promise<Examination>;
|
|
126
142
|
export {};
|
|
127
143
|
//# sourceMappingURL=doctor.d.ts.map
|
package/dist/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAs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