prae-cli 0.1.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/lib/index.d.ts ADDED
@@ -0,0 +1,61 @@
1
+ import { PreflightFinding } from "dsh-overlay-check";
2
+
3
+ //#region src/cli.d.ts
4
+
5
+ /**
6
+ * The PRAE command line.
7
+ *
8
+ * Four verbs, and the one that writes defaults to not writing. `init` prints
9
+ * the diff and stops unless `--apply` is passed, because the thing it edits is
10
+ * the file that decides whether the harness boots at all.
11
+ */
12
+ declare function main(argv: string[]): Promise<void>;
13
+ //#endregion
14
+ //#region src/profile.d.ts
15
+
16
+ interface Profile {
17
+ /** The directory holding `cordis.yml`, e.g. `~/.dsh/profiles/web`. */
18
+ readonly dir: string;
19
+ readonly patchPath: string;
20
+ }
21
+ /** Where dsh keeps its home, honouring the same env var the CLI does. */
22
+ declare function dshHome(): string;
23
+ declare function profileAt(dir: string): Profile;
24
+ /** The default profile, unless a caller names one. */
25
+ declare function defaultProfile(name?: string): Profile;
26
+ /**
27
+ * The overlay row that mounts PRAE with a policy.
28
+ *
29
+ * The pack is embedded rather than referenced by path. A row pointing at a
30
+ * file that later moves or changes is a policy nobody can reconstruct from the
31
+ * profile alone, and the whole point of this plugin is being able to say what
32
+ * was in force at the time.
33
+ */
34
+ declare function praeRow(options: {
35
+ readonly pack: string;
36
+ readonly ledger?: string;
37
+ readonly approver?: string;
38
+ }): string;
39
+ interface WritePlan {
40
+ readonly patchPath: string;
41
+ readonly before: string;
42
+ readonly after: string;
43
+ readonly revision: string;
44
+ readonly findings: readonly PreflightFinding[];
45
+ readonly blocking: boolean;
46
+ }
47
+ /** Compose the write and check it, without touching the file. */
48
+ declare function planWrite(profile: Profile, row: string): Promise<WritePlan>;
49
+ /**
50
+ * Apply a plan, snapshotting first.
51
+ *
52
+ * `expectedRevision` is a precondition rather than a formality: between
53
+ * previewing and applying, the user may have edited the file, and writing over
54
+ * an edit they made after reviewing our diff would hand them a profile nobody
55
+ * chose.
56
+ */
57
+ declare function applyWrite(profile: Profile, plan: WritePlan, expectedRevision: string): Promise<{
58
+ readonly snapshot: string;
59
+ }>;
60
+ //#endregion
61
+ export { type Profile, type WritePlan, applyWrite, defaultProfile, dshHome, main, planWrite, praeRow, profileAt };
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ import { a as planWrite, i as dshHome, n as applyWrite, o as praeRow, r as defaultProfile, s as profileAt, t as main } from "./cli-DGVWMDT0.js";
2
+
3
+ export { applyWrite, defaultProfile, dshHome, main, planWrite, praeRow, profileAt };