@krysoworks/kryso 0.0.0-stage → 2.0.0-rc.1
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/LICENSE +21 -0
- package/README.md +152 -2
- package/bin/kryso +31 -0
- package/bin/ship-it-status +14 -0
- package/bin/ship-ledger +14 -0
- package/bin/ship-loop +14 -0
- package/bin/ship-pass +14 -0
- package/bin/warden +14 -0
- package/dist/answer.d.ts +38 -0
- package/dist/answer.js +48 -0
- package/dist/bytes.d.ts +5 -0
- package/dist/bytes.js +35 -0
- package/dist/cleanup.d.ts +1 -0
- package/dist/cleanup.js +629 -0
- package/dist/commands.d.ts +48 -0
- package/dist/commands.js +293 -0
- package/dist/completions.d.ts +24 -0
- package/dist/completions.js +239 -0
- package/dist/daemon.d.ts +15 -0
- package/dist/daemon.js +23 -0
- package/dist/diagnose.d.ts +47 -0
- package/dist/diagnose.js +314 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +241 -0
- package/dist/env.d.ts +9 -0
- package/dist/env.js +17 -0
- package/dist/evidence.d.ts +39 -0
- package/dist/evidence.js +327 -0
- package/dist/home.d.ts +3 -0
- package/dist/home.js +27 -0
- package/dist/install.d.ts +59 -0
- package/dist/install.js +137 -0
- package/dist/isolate.d.ts +28 -0
- package/dist/isolate.js +402 -0
- package/dist/leftovers.d.ts +5 -0
- package/dist/leftovers.js +156 -0
- package/dist/machine.d.ts +6 -0
- package/dist/machine.js +185 -0
- package/dist/palette.d.ts +147 -0
- package/dist/palette.js +167 -0
- package/dist/plan.d.ts +1 -0
- package/dist/plan.js +133 -0
- package/dist/proc.d.ts +23 -0
- package/dist/proc.js +23 -0
- package/dist/read.d.ts +1 -0
- package/dist/read.js +297 -0
- package/dist/readiness.d.ts +5 -0
- package/dist/readiness.js +64 -0
- package/dist/remote.d.ts +6 -0
- package/dist/remote.js +85 -0
- package/dist/self-update.d.ts +1 -0
- package/dist/self-update.js +224 -0
- package/dist/semver.d.ts +7 -0
- package/dist/semver.js +42 -0
- package/dist/style.d.ts +71 -0
- package/dist/style.js +187 -0
- package/dist/update.d.ts +47 -0
- package/dist/update.js +190 -0
- package/dist/work.d.ts +25 -0
- package/dist/work.js +449 -0
- package/dist/workflows.d.ts +4 -0
- package/dist/workflows.js +73 -0
- package/docker/entrypoint.sh +44 -0
- package/docker/runner.Dockerfile +39 -0
- package/package.json +65 -4
- package/scripts/install-skills.sh +607 -0
- package/skills/code-review/SKILL.md +231 -0
- package/skills/kryso/SKILL.md +107 -0
- package/skills/kryso/golden/help.rounded.ansi +23 -0
- package/skills/kryso/golden/help.square.ansi +23 -0
- package/skills/kryso/golden/help.txt +23 -0
- package/skills/kryso/golden/table-narrow.json +11 -0
- package/skills/kryso/golden/table-narrow.rounded.ansi +4 -0
- package/skills/kryso/golden/table-narrow.square.ansi +4 -0
- package/skills/kryso/golden/table.ansi +5 -0
- package/skills/kryso/golden/table.json +11 -0
- package/skills/kryso/ledger.sh +2146 -0
- package/skills/kryso/palette.json +57 -0
- package/skills/kryso/reference/resuming.md +30 -0
- package/skills/kryso/reference/routing.md +23 -0
- package/skills/kryso/reference/stage-1-claim.md +79 -0
- package/skills/kryso/reference/stage-2-build.md +133 -0
- package/skills/kryso/reference/stage-3-prove.md +51 -0
- package/skills/kryso/reference/stage-4-pr.md +76 -0
- package/skills/kryso/reference/stage-5-reconcile.md +81 -0
- package/skills/kryso/reference/stage-6-merge-or-park.md +73 -0
- package/skills/kryso/reference/stage-7-close-out.md +62 -0
- package/skills/kryso/reference/terminal.md +7 -0
- package/skills/kryso/ship-it-status.sh +1503 -0
- package/skills/kryso/ui.py +274 -0
- package/skills/kryso/ui.sh +609 -0
- package/skills/kryso-build/SKILL.md +168 -0
- package/skills/kryso-shift/SKILL.md +167 -0
- package/skills/kryso-shift/archive.py +2784 -0
- package/skills/kryso-shift/archive_checker.py +462 -0
- package/skills/kryso-shift/archive_checker_lambda.py +155 -0
- package/skills/kryso-shift/archive_health.py +364 -0
- package/skills/kryso-shift/archive_launchd.py +140 -0
- package/skills/kryso-shift/archive_remote.py +990 -0
- package/skills/kryso-shift/archiving-checker.md +140 -0
- package/skills/kryso-shift/archiving-keep.md +115 -0
- package/skills/kryso-shift/archiving-recovery.md +112 -0
- package/skills/kryso-shift/archiving-remote.md +166 -0
- package/skills/kryso-shift/archiving.md +146 -0
- package/skills/kryso-shift/coverage.schema.json +225 -0
- package/skills/kryso-shift/deadline.sh +254 -0
- package/skills/kryso-shift/feedback.schema.json +35 -0
- package/skills/kryso-shift/feedback.sh +228 -0
- package/skills/kryso-shift/history-manifest.schema.json +331 -0
- package/skills/kryso-shift/keep-after.sh +55 -0
- package/skills/kryso-shift/measure.sh +611 -0
- package/skills/kryso-shift/merge-ready.sh +207 -0
- package/skills/kryso-shift/outcome.schema.json +16 -0
- package/skills/kryso-shift/pass-rules.md +8 -0
- package/skills/kryso-shift/profile.schema.json +42 -0
- package/skills/kryso-shift/reader.sh +692 -0
- package/skills/kryso-shift/reads.sh +151 -0
- package/skills/kryso-shift/reference/allowance.md +21 -0
- package/skills/kryso-shift/reference/driver.md +95 -0
- package/skills/kryso-shift/reference/measuring.md +67 -0
- package/skills/kryso-shift/reference/outputs.md +21 -0
- package/skills/kryso-shift/reference/pass-script.md +115 -0
- package/skills/kryso-shift/reference/reconcile-and-merge.md +55 -0
- package/skills/kryso-shift/reference/second-reader.md +9 -0
- package/skills/kryso-shift/reference/sweeps.md +83 -0
- package/skills/kryso-shift/repair.schema.json +14 -0
- package/skills/kryso-shift/report-template.html +679 -0
- package/skills/kryso-shift/report.py +389 -0
- package/skills/kryso-shift/report_fixture.py +65 -0
- package/skills/kryso-shift/reporting.md +58 -0
- package/skills/kryso-shift/result.sh +91 -0
- package/skills/kryso-shift/runner.sh +1178 -0
- package/skills/kryso-shift/ship-loop.sh +3977 -0
- package/skills/kryso-shift/ship-pass.sh +4987 -0
- package/skills/kryso-shift/steps.jq +19 -0
- package/skills/kryso-shift/workflow.mjs +830 -0
- package/skills/kryso-shift/workflows/default.json +22 -0
- package/skills/kryso-shift/workflows/ralph.json +13 -0
- package/skills/kryso-watch/SKILL.md +100 -0
- package/skills/kryso-watch/answer.schema.json +23 -0
- package/skills/kryso-watch/base-refs.sh +44 -0
- package/skills/kryso-watch/board.sh +58 -0
- package/skills/kryso-watch/reference/config.md +23 -0
- package/skills/kryso-watch/reference/outputs.md +30 -0
- package/skills/kryso-watch/reference/report.md +29 -0
- package/skills/kryso-watch/reference/scheduler.md +32 -0
- package/skills/kryso-watch/reference/settlement.md +29 -0
- package/skills/kryso-watch/reference/shift.md +44 -0
- package/skills/kryso-watch/reference/shim-limits.md +22 -0
- package/skills/kryso-watch/reference/triage.md +26 -0
- package/skills/kryso-watch/schema.jq +40 -0
- package/skills/kryso-watch/settle.schema.json +36 -0
- package/skills/kryso-watch/stage-common.sh +187 -0
- package/skills/kryso-watch/stages/report.sh +525 -0
- package/skills/kryso-watch/stages/settle.sh +722 -0
- package/skills/kryso-watch/stages/shift.sh +466 -0
- package/skills/kryso-watch/stages/triage.sh +379 -0
- package/skills/kryso-watch/tracker.sh +27 -0
- package/skills/kryso-watch/triage.schema.json +77 -0
- package/skills/kryso-watch/warden.launchd.plist +50 -0
- package/skills/kryso-watch/warden.schema.json +98 -0
- package/skills/kryso-watch/warden.sh +1004 -0
package/dist/diagnose.js
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
// The diagnoses for a scope: the machine, and the repositories it names. kryso doctor prints
|
|
2
|
+
// them, and kryso cleanup and the daemon's doctor route (as kryso/diagnose) read them through
|
|
3
|
+
// this module too, so which programs it starts and which files it reads stay in here. It writes
|
|
4
|
+
// nothing anywhere. A read of GitHub is skipped under the offline switch, and its diagnosis is
|
|
5
|
+
// then unknown, never a guess.
|
|
6
|
+
//
|
|
7
|
+
// The install group: every subcommand's target resolved as the planner resolves it, with each
|
|
8
|
+
// file it names present, every skill installed in ~/.agents/skills the same as the copy this
|
|
9
|
+
// kryso carries, and an update, from the check kryso self-update --check makes. That check asks
|
|
10
|
+
// the registry through the tool that installed kryso, as self-update does, and reads a checkout's
|
|
11
|
+
// remote with git ls-remote rather than a fetch. Under the offline switch it makes neither read.
|
|
12
|
+
// The installer's leftovers in the home directory, the skill backups past the newest five and the
|
|
13
|
+
// skill copies under names 2.0.0 retired, are leftovers.ts's.
|
|
14
|
+
//
|
|
15
|
+
// The tools and images groups are machine.ts's: the tools the drivers run on, their logins, and
|
|
16
|
+
// the kryso-runner images of another version. The work, locks and branches groups are work.ts's,
|
|
17
|
+
// for each repository the scope names. The repository group's readiness lines are readiness.ts's,
|
|
18
|
+
// and its workflow and pin lines are workflows.ts's. The evidence group's sizes are evidence.ts's. Whether that evidence exists
|
|
19
|
+
// anywhere else is the machine's, read once. A scope run outside any repository says so in one
|
|
20
|
+
// line.
|
|
21
|
+
//
|
|
22
|
+
// The scope of --all is every repository kryso status --all reads, by the rule status itself
|
|
23
|
+
// applies, which `kryso status --repos` prints, and every repository the watch schedule's list
|
|
24
|
+
// names. Each is read once, by its main checkout. A listed path that no longer exists, or is in
|
|
25
|
+
// no repository, is one info line.
|
|
26
|
+
import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
27
|
+
import os from "node:os";
|
|
28
|
+
import path from "node:path";
|
|
29
|
+
import { COMMANDS, find, isAnswer, startable, version } from "./commands.js";
|
|
30
|
+
import { findHome, HomeNotFound } from "./home.js";
|
|
31
|
+
import { ADD, detectInstall, formulaOf, packageRoot, pathKind, real, versionLabel } from "./install.js";
|
|
32
|
+
import { imagesGroup, toolsGroup } from "./machine.js";
|
|
33
|
+
import { archiveOf, evidenceOf, pastRetention } from "./evidence.js";
|
|
34
|
+
import { KEEP_BACKUPS, leftovers } from "./leftovers.js";
|
|
35
|
+
import { capture, failure } from "./proc.js";
|
|
36
|
+
import { readiness } from "./readiness.js";
|
|
37
|
+
import { lineOf, planUpdate } from "./update.js";
|
|
38
|
+
import { workGroups } from "./work.js";
|
|
39
|
+
import { workflowsGroup } from "./workflows.js";
|
|
40
|
+
/** The repository of the current directory, by its top-level path, or the directory itself
|
|
41
|
+
* when it is in no repository. */
|
|
42
|
+
export function here(env) {
|
|
43
|
+
const r = capture("git", ["rev-parse", "--show-toplevel"], env, process.cwd());
|
|
44
|
+
return r.ok && r.out ? { repositories: [r.out] } : { repositories: [], outside: process.cwd() };
|
|
45
|
+
}
|
|
46
|
+
/** The main checkout of the repository a path is in: the directory its git common directory
|
|
47
|
+
* sits in, as kryso status --all names a repository. */
|
|
48
|
+
export function mainOf(dir, env) {
|
|
49
|
+
const r = capture("git", ["rev-parse", "--path-format=absolute", "--git-common-dir"], env, dir);
|
|
50
|
+
return r.ok && r.out ? path.dirname(r.out) : undefined;
|
|
51
|
+
}
|
|
52
|
+
/** The watch schedule's list, as warden.sh reads it: one path a line, blank lines and # lines
|
|
53
|
+
* skipped, a leading ~/ the home directory, under its name before the rename where only that one
|
|
54
|
+
* exists. */
|
|
55
|
+
function scheduleList(env) {
|
|
56
|
+
const config = env.XDG_CONFIG_HOME || path.join(env.HOME || os.homedir(), ".config");
|
|
57
|
+
const file = [path.join(config, "kryso", "repos"), path.join(config, "warden", "repos")].find((f) => existsSync(f));
|
|
58
|
+
if (!file)
|
|
59
|
+
return undefined;
|
|
60
|
+
const home = env.HOME || os.homedir();
|
|
61
|
+
const paths = readFileSync(file, "utf8")
|
|
62
|
+
.split("\n")
|
|
63
|
+
.map((l) => l.trim())
|
|
64
|
+
.filter((l) => l !== "" && !l.startsWith("#"))
|
|
65
|
+
.map((l) => (l.startsWith("~/") ? path.join(home, l.slice(2)) : l));
|
|
66
|
+
return { file, paths };
|
|
67
|
+
}
|
|
68
|
+
/** Every repository a session has used, by kryso status's own rule, and every one the watch
|
|
69
|
+
* schedule's list names, each once by its main checkout. */
|
|
70
|
+
export function everywhere(env) {
|
|
71
|
+
const home = homeOf(env);
|
|
72
|
+
const scope = { repositories: [], gone: [] };
|
|
73
|
+
const listed = [];
|
|
74
|
+
const status = typeof home === "string" ? startable(home, "status", ["--repos"], env) : undefined;
|
|
75
|
+
if (status) {
|
|
76
|
+
const r = capture(status.program, [...status.head, "--repos"], env);
|
|
77
|
+
if (r.ok)
|
|
78
|
+
listed.push(...r.out.split("\n").filter(Boolean).map((p) => ({ path: p, listed: "kryso status --all" })));
|
|
79
|
+
else
|
|
80
|
+
scope.unlisted = `kryso status --repos failed: ${failure(r)}`;
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
scope.unlisted = "kryso cannot find kryso status's driver";
|
|
84
|
+
const schedule = scheduleList(env);
|
|
85
|
+
for (const p of schedule?.paths ?? [])
|
|
86
|
+
listed.push({ path: p, listed: `the watch schedule's list ${schedule.file}` });
|
|
87
|
+
const seen = new Set();
|
|
88
|
+
for (const item of listed) {
|
|
89
|
+
const why = !path.isAbsolute(item.path) ? "it is not an absolute path" : !existsSync(item.path) ? "it no longer exists" : undefined;
|
|
90
|
+
const main = why ? undefined : mainOf(item.path, env);
|
|
91
|
+
if (!main) {
|
|
92
|
+
if (!scope.gone.some((g) => g.path === item.path))
|
|
93
|
+
scope.gone.push({ ...item, why: why ?? "it is in no git repository" });
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const key = realpathSync(main);
|
|
97
|
+
if (seen.has(key))
|
|
98
|
+
continue;
|
|
99
|
+
seen.add(key);
|
|
100
|
+
scope.repositories.push(main);
|
|
101
|
+
}
|
|
102
|
+
return scope;
|
|
103
|
+
}
|
|
104
|
+
/** Where each group is reported, in order. A Record, so a group the schema adds is a type error
|
|
105
|
+
* here until it has a place. */
|
|
106
|
+
const ORDER = {
|
|
107
|
+
install: 0,
|
|
108
|
+
tools: 1,
|
|
109
|
+
repository: 2,
|
|
110
|
+
work: 3,
|
|
111
|
+
locks: 4,
|
|
112
|
+
branches: 5,
|
|
113
|
+
evidence: 6,
|
|
114
|
+
images: 7,
|
|
115
|
+
remote: 8,
|
|
116
|
+
};
|
|
117
|
+
/** The groups in the order they are reported. */
|
|
118
|
+
export const GROUPS = Object.keys(ORDER).sort((a, b) => ORDER[a] - ORDER[b]);
|
|
119
|
+
export function diagnose(scope, switches, env) {
|
|
120
|
+
const root = packageRoot();
|
|
121
|
+
const home = homeOf(env);
|
|
122
|
+
const drivers = typeof home === "string" ? home : undefined;
|
|
123
|
+
const mains = scope.repositories.map((repo) => [repo, mainOf(repo, env) ?? repo]);
|
|
124
|
+
const diagnoses = [
|
|
125
|
+
...installGroup(root, home, env),
|
|
126
|
+
...leftovers(drivers, switches.keepBackups ?? KEEP_BACKUPS, env),
|
|
127
|
+
...updateLine(root, switches.offline, env),
|
|
128
|
+
...toolsGroup(drivers, switches.offline, env),
|
|
129
|
+
...(scope.outside === undefined ? [] : [outside(scope.outside)]),
|
|
130
|
+
...(scope.unlisted === undefined ? [] : [unlisted(scope.unlisted)]),
|
|
131
|
+
...(scope.gone ?? []).map(gone),
|
|
132
|
+
...mains.flatMap(([repo, main]) => [
|
|
133
|
+
// Run where the person is, and named by the main checkout, as the work groups name it.
|
|
134
|
+
...(switches.readiness === false ? [] : [...readiness(repo, main, drivers, switches.offline, env), ...workflowsGroup(repo, main, drivers, switches.offline, env)]),
|
|
135
|
+
...workGroups(repo, drivers, switches.offline, env),
|
|
136
|
+
]),
|
|
137
|
+
...evidence(mains.map(([, main]) => main), drivers, switches, env),
|
|
138
|
+
...imagesGroup(version(), env),
|
|
139
|
+
];
|
|
140
|
+
return {
|
|
141
|
+
install: { kind: pathKind(root, env), label: versionLabel(root, env), version: version(), root },
|
|
142
|
+
offline: switches.offline,
|
|
143
|
+
repositories: scope.repositories,
|
|
144
|
+
diagnoses: diagnoses.sort((a, b) => ORDER[a.group] - ORDER[b.group]),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const SKILLS_INSTALL = "kryso skills install";
|
|
148
|
+
const outside = (dir) => ({
|
|
149
|
+
id: "repository.none",
|
|
150
|
+
group: "repository",
|
|
151
|
+
severity: "info",
|
|
152
|
+
fix: "person",
|
|
153
|
+
subject: dir,
|
|
154
|
+
text: `${dir} is in no git repository, so this run read the machine alone; run kryso doctor in a repository to read its work`,
|
|
155
|
+
});
|
|
156
|
+
const unlisted = (why) => ({
|
|
157
|
+
id: "repository.unlisted",
|
|
158
|
+
group: "repository",
|
|
159
|
+
severity: "info",
|
|
160
|
+
fix: "person",
|
|
161
|
+
unknown: true,
|
|
162
|
+
subject: "kryso status --repos",
|
|
163
|
+
text: `the repositories sessions have used are unknown, because ${why}, so this run read the schedule's list alone`,
|
|
164
|
+
});
|
|
165
|
+
const gone = ({ path: at, listed, why }) => ({
|
|
166
|
+
id: "repository.gone",
|
|
167
|
+
group: "repository",
|
|
168
|
+
severity: "info",
|
|
169
|
+
fix: "person",
|
|
170
|
+
subject: at,
|
|
171
|
+
text: `${listed} names ${at}, but ${why}, so this run skipped it`,
|
|
172
|
+
});
|
|
173
|
+
/** Each repository's evidence, then, when there is any, whether it exists anywhere else, and
|
|
174
|
+
* once the archive says what the remote has verified, each copy past the retention. */
|
|
175
|
+
function evidence(repositories, drivers, switches, env) {
|
|
176
|
+
const sizes = repositories.flatMap(evidenceOf);
|
|
177
|
+
if (sizes.length === 0)
|
|
178
|
+
return [];
|
|
179
|
+
const { found, verified } = archiveOf(drivers, env, switches.keepConfig);
|
|
180
|
+
return [...sizes, ...found, ...(verified ? repositories.flatMap((repo) => pastRetention(repo, verified, switches.retentionDays)) : [])];
|
|
181
|
+
}
|
|
182
|
+
/** Where the drivers are, or the reason there are none, which the install group reports. */
|
|
183
|
+
function homeOf(env) {
|
|
184
|
+
try {
|
|
185
|
+
return findHome(env);
|
|
186
|
+
}
|
|
187
|
+
catch (err) {
|
|
188
|
+
if (!(err instanceof HomeNotFound))
|
|
189
|
+
throw err;
|
|
190
|
+
return err;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function installGroup(root, home, env) {
|
|
194
|
+
if (home instanceof HomeNotFound)
|
|
195
|
+
return [missing("kryso", `the drivers are missing: ${home.message}`, repair(root, env))];
|
|
196
|
+
return [...drivers(home, root, env), ...skills(home, env)];
|
|
197
|
+
}
|
|
198
|
+
const UPDATE = { id: "install.update", group: "install", severity: "info", fix: "command", subject: "kryso self-update" };
|
|
199
|
+
/** Whether an update is out, from self-update --check's own plan, or unknown and why. An install
|
|
200
|
+
* of no kind kryso knows has no update to check, and the install line already says so. */
|
|
201
|
+
function updateLine(root, offline, env) {
|
|
202
|
+
const unknown = (why) => ({ ...UPDATE, unknown: true, text: `whether an update is out is unknown, ${why}`, command: "kryso self-update --check" });
|
|
203
|
+
if (offline)
|
|
204
|
+
return [unknown("because --offline reads no registry or remote")];
|
|
205
|
+
const install = detectInstall(root, env);
|
|
206
|
+
if (install.kind === "none")
|
|
207
|
+
return [];
|
|
208
|
+
const plan = planUpdate(install, { fetch: false }, env);
|
|
209
|
+
if ("problem" in plan)
|
|
210
|
+
return [unknown(`because ${lineOf(plan.problem)}`)];
|
|
211
|
+
if (plan.current)
|
|
212
|
+
return [];
|
|
213
|
+
const text = `an update is available: ${plan.available}, and this kryso is ${plan.installed}`;
|
|
214
|
+
// What would refuse the update, as self-update --check names it, so the line names no command
|
|
215
|
+
// that would refuse.
|
|
216
|
+
if (plan.blockers.length > 0) {
|
|
217
|
+
return [{ ...UPDATE, fix: "person", text: `${text}, but kryso self-update would refuse: ${plan.blockers.map(lineOf).join("; ")}` }];
|
|
218
|
+
}
|
|
219
|
+
return [{ ...UPDATE, text, command: "kryso self-update" }];
|
|
220
|
+
}
|
|
221
|
+
/** The repair, told from the path as pathKind tells the kind, so it starts no program: asking a
|
|
222
|
+
* package tool for its global root can download that tool. A checkout install's drivers are its
|
|
223
|
+
* installed skills, which `kryso skills install` puts back while it can find the installer. */
|
|
224
|
+
function repair(root, env) {
|
|
225
|
+
const { name } = JSON.parse(readFileSync(path.join(root, "package.json"), "utf8"));
|
|
226
|
+
const spec = `${name}@${version()}`;
|
|
227
|
+
switch (pathKind(root, env)) {
|
|
228
|
+
case "checkout":
|
|
229
|
+
// Its home is the directory the installed skills and this copy share.
|
|
230
|
+
return isAnswer(find("skills").target(path.dirname(root), ["install"], env))
|
|
231
|
+
? { why: `and ${SKILLS_INSTALL}, which puts the skills back, cannot start either, so install kryso again from a checkout` }
|
|
232
|
+
: { command: SKILLS_INSTALL };
|
|
233
|
+
case "bun":
|
|
234
|
+
return { command: ["bun", ...ADD.bun, spec].join(" ") };
|
|
235
|
+
case "brew":
|
|
236
|
+
return { command: `brew reinstall ${formulaOf(root) ?? name}` };
|
|
237
|
+
case "package":
|
|
238
|
+
return { why: `so install ${spec} again with the tool that installed it, such as ${["npm", ...ADD.npm, spec].join(" ")}` };
|
|
239
|
+
case "none":
|
|
240
|
+
return { why: "and kryso cannot tell how it was installed, so install it again the way you did" };
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const DRIVER_MISSING = { id: "install.driver-missing", group: "install", severity: "error" };
|
|
244
|
+
/** A subcommand that cannot start, with the install's repair. */
|
|
245
|
+
function missing(subject, text, fix) {
|
|
246
|
+
return "command" in fix
|
|
247
|
+
? { ...DRIVER_MISSING, subject, fix: "command", text, command: fix.command }
|
|
248
|
+
: { ...DRIVER_MISSING, subject, fix: "person", text: `${text}, ${fix.why}` };
|
|
249
|
+
}
|
|
250
|
+
function drivers(home, root, env) {
|
|
251
|
+
const found = [];
|
|
252
|
+
let fix;
|
|
253
|
+
for (const command of COMMANDS) {
|
|
254
|
+
for (const args of command.checks ?? [[]]) {
|
|
255
|
+
const subject = ["kryso", command.name, ...args].join(" ");
|
|
256
|
+
const target = command.target(command.withoutDrivers ? "" : home, [...args], env);
|
|
257
|
+
if (isAnswer(target)) {
|
|
258
|
+
// A subcommand kryso refuses to start, in the refusal's own words.
|
|
259
|
+
if (target.status !== 0)
|
|
260
|
+
found.push({ ...DRIVER_MISSING, subject, fix: "person", text: `${subject} cannot start: ${target.line ?? target.text.trim()}` });
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
for (const file of target.head.filter((word) => path.isAbsolute(word))) {
|
|
264
|
+
if (!existsSync(file))
|
|
265
|
+
found.push(missing(subject, `${subject} cannot start: ${file} is missing`, (fix ??= repair(root, env))));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return found;
|
|
270
|
+
}
|
|
271
|
+
/** Whether two trees hold the same names and bytes, as `diff -r` reads them, links followed. The
|
|
272
|
+
* installer replaces a copy exactly when this is false. */
|
|
273
|
+
function same(a, b) {
|
|
274
|
+
let sa, sb;
|
|
275
|
+
try {
|
|
276
|
+
sa = statSync(a);
|
|
277
|
+
sb = statSync(b);
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
if (sa.isDirectory() !== sb.isDirectory())
|
|
283
|
+
return false;
|
|
284
|
+
if (!sa.isDirectory())
|
|
285
|
+
return sa.size === sb.size && readFileSync(a).equals(readFileSync(b));
|
|
286
|
+
const na = readdirSync(a).sort();
|
|
287
|
+
const nb = readdirSync(b).sort();
|
|
288
|
+
return na.length === nb.length && na.every((name, i) => name === nb[i] && same(path.join(a, name), path.join(b, name)));
|
|
289
|
+
}
|
|
290
|
+
/** Each skill this kryso carries that is installed in ~/.agents/skills and differs there. A
|
|
291
|
+
* checkout install's drivers are the installed skills themselves, so it has none to compare. */
|
|
292
|
+
function skills(home, env) {
|
|
293
|
+
const carried = path.join(home, "skills");
|
|
294
|
+
const installed = path.join(env.HOME || os.homedir(), ".agents", "skills");
|
|
295
|
+
if (!existsSync(installed) || real(carried) === real(installed))
|
|
296
|
+
return [];
|
|
297
|
+
const found = [];
|
|
298
|
+
for (const name of readdirSync(carried).sort()) {
|
|
299
|
+
const ours = path.join(carried, name);
|
|
300
|
+
const theirs = path.join(installed, name);
|
|
301
|
+
if (!existsSync(path.join(ours, "SKILL.md")) || !existsSync(theirs) || same(ours, theirs))
|
|
302
|
+
continue;
|
|
303
|
+
found.push({
|
|
304
|
+
id: "install.skill-differs",
|
|
305
|
+
group: "install",
|
|
306
|
+
severity: "warn",
|
|
307
|
+
fix: "command",
|
|
308
|
+
subject: theirs,
|
|
309
|
+
text: `the installed skill ${name} in ${theirs} differs from this kryso's copy in ${ours}`,
|
|
310
|
+
command: SKILLS_INSTALL,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return found;
|
|
314
|
+
}
|
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// kryso doctor: what stops kryso working on this machine, and what is left over, from the
|
|
2
|
+
// diagnoses diagnose.ts builds for this machine and the repository of the current directory, or
|
|
3
|
+
// with --all every repository kryso knows. It
|
|
4
|
+
// changes nothing, so it runs at any time, a live shift included. bin/kryso execs this file, and
|
|
5
|
+
// kryso runs it with the drivers missing, as it does self-update.
|
|
6
|
+
//
|
|
7
|
+
// The plain output is the contract: the version and the install kind, one line per diagnosis
|
|
8
|
+
// in group order, then a count line. Under --all the machine's lines come first, then each
|
|
9
|
+
// repository's under a line naming it. An attended run draws the same list as kryso status draws
|
|
10
|
+
// its report: the brand line, a pill per group and a mark per line. --json prints the document
|
|
11
|
+
// in packages/core/schemas/doctor/ and nothing else.
|
|
12
|
+
//
|
|
13
|
+
// With a remote set (kryso remote), a run asks whether the daemon answers and says so in one
|
|
14
|
+
// line of the remote group, unless --offline, when it does not ask. --remote asks the daemon's
|
|
15
|
+
// doctor route for its machine's diagnoses instead, and prints them after this machine's under a
|
|
16
|
+
// line naming the remote, or under --json prints both documents, each marked with its machine,
|
|
17
|
+
// in packages/core/schemas/doctor-remote/. Nothing here asks the daemon to change anything.
|
|
18
|
+
import { give, helpAnswer, refusal, say } from "./answer.js";
|
|
19
|
+
import { getRoute } from "./daemon.js";
|
|
20
|
+
import { diagnose, everywhere, GROUPS, here } from "./diagnose.js";
|
|
21
|
+
import { EX_SOFTWARE, EX_USAGE } from "./env.js";
|
|
22
|
+
import { readRemote } from "./remote.js";
|
|
23
|
+
const NAME = "kryso doctor";
|
|
24
|
+
const USAGE = `Usage: kryso doctor [--all] [--json] [--offline] [--remote]
|
|
25
|
+
|
|
26
|
+
It reports what stops kryso working on this machine, and what is left over, and
|
|
27
|
+
changes nothing. In a repository it also reads the work there: what the
|
|
28
|
+
shift's and the watch's read-only dry runs stop on, each worktree with what
|
|
29
|
+
its ledger and its pull request say, the pass lock files, a watch lock or
|
|
30
|
+
isolation file whose process has died, the merged local branches, and what
|
|
31
|
+
the evidence holds on disk and whether the archive keeps it anywhere else.
|
|
32
|
+
Each line is one diagnosis: its severity, its group, what it
|
|
33
|
+
found and, where one command settles it, that command after "Fix:". An error
|
|
34
|
+
means kryso cannot work, a warn that something needs action, and an info is a
|
|
35
|
+
count or a size.
|
|
36
|
+
|
|
37
|
+
--all read every repository a session has used, as kryso status --all
|
|
38
|
+
finds them, and every one the watch schedule's list names, each
|
|
39
|
+
under a line of its own after the machine's
|
|
40
|
+
--json print one JSON document, the diagnoses in kryso's doctor schema,
|
|
41
|
+
and nothing else
|
|
42
|
+
--offline read no registry, remote or GitHub, and run no dry run, so a
|
|
43
|
+
diagnosis that needs one is unknown
|
|
44
|
+
--remote also print the diagnoses of the daemon kryso remote names, for
|
|
45
|
+
its machine and the repositories it serves, under a line that
|
|
46
|
+
names it
|
|
47
|
+
-h, --help print this help
|
|
48
|
+
|
|
49
|
+
With a remote set, one line says whether its daemon answers. It exits 0 when
|
|
50
|
+
every diagnosis is an info, 1 when one is a warn or an error, and 64 on a bad
|
|
51
|
+
argument.
|
|
52
|
+
`;
|
|
53
|
+
function parse(argv) {
|
|
54
|
+
const opts = { all: false, json: false, offline: false, remote: false };
|
|
55
|
+
for (const a of argv) {
|
|
56
|
+
if (a === "-h" || a === "--help")
|
|
57
|
+
return helpAnswer(USAGE, "doctor", "help");
|
|
58
|
+
if (a === "--all")
|
|
59
|
+
opts.all = true;
|
|
60
|
+
else if (a === "--json")
|
|
61
|
+
opts.json = true;
|
|
62
|
+
else if (a === "--offline")
|
|
63
|
+
opts.offline = true;
|
|
64
|
+
else if (a === "--remote")
|
|
65
|
+
opts.remote = true;
|
|
66
|
+
else
|
|
67
|
+
return refusal(EX_USAGE, NAME, a.startsWith("-") ? `unknown option ${a}` : `takes no arguments, got '${a}'`, { usage: USAGE });
|
|
68
|
+
}
|
|
69
|
+
if (opts.remote && opts.offline)
|
|
70
|
+
return refusal(EX_USAGE, NAME, "--remote asks the daemon, and --offline asks no remote", { usage: USAGE });
|
|
71
|
+
return opts;
|
|
72
|
+
}
|
|
73
|
+
/** A diagnosis's line: its text, then its command after "Fix:", drawn by show. */
|
|
74
|
+
const line = (d, show = (command) => command) => (d.command ? `${d.text}. Fix: ${show(d.command)}` : d.text);
|
|
75
|
+
/** `3 diagnoses: error 1, warn 2`, naming only the severities there are. */
|
|
76
|
+
function count(diagnoses) {
|
|
77
|
+
const n = diagnoses.length;
|
|
78
|
+
const by = ["error", "warn", "info"]
|
|
79
|
+
.map((severity) => [severity, diagnoses.filter((d) => d.severity === severity).length])
|
|
80
|
+
.filter(([, k]) => k > 0)
|
|
81
|
+
.map(([severity, k]) => `${severity} ${k}`);
|
|
82
|
+
return `${n} diagnos${n === 1 ? "is" : "es"}${by.length > 0 ? `: ${by.join(", ")}` : ""}`;
|
|
83
|
+
}
|
|
84
|
+
/** The sections a report prints: the machine's diagnoses, then under --all each repository's
|
|
85
|
+
* under its path. Without --all it is one section, every diagnosis in group order. */
|
|
86
|
+
function sections(doc, all) {
|
|
87
|
+
if (!all)
|
|
88
|
+
return [{ diagnoses: doc.diagnoses }];
|
|
89
|
+
// A diagnosis about a repository the scope names by another path still gets a section.
|
|
90
|
+
const named = new Set(doc.diagnoses.map((d) => d.repository).filter((r) => r !== undefined));
|
|
91
|
+
const repositories = [...doc.repositories, ...[...named].filter((r) => !doc.repositories.includes(r))];
|
|
92
|
+
return [
|
|
93
|
+
{ diagnoses: doc.diagnoses.filter((d) => d.repository === undefined) },
|
|
94
|
+
...repositories.map((repository) => ({ repository, diagnoses: doc.diagnoses.filter((d) => d.repository === repository) })),
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
/** A machine's report. A remote's names it before the kryso that ran there. */
|
|
98
|
+
function report(doc, all, remote) {
|
|
99
|
+
const { install, diagnoses } = doc;
|
|
100
|
+
const on = remote === undefined ? "" : `on the remote ${remote}: `;
|
|
101
|
+
const head = `${on}kryso ${install.version} (${install.label})`;
|
|
102
|
+
const width = Math.max(0, ...diagnoses.map((d) => d.group.length));
|
|
103
|
+
const parts = sections(doc, all);
|
|
104
|
+
const text = [
|
|
105
|
+
head,
|
|
106
|
+
...parts.flatMap(({ repository, diagnoses: these }) => [
|
|
107
|
+
...(repository === undefined ? [] : [`in ${repository}:`]),
|
|
108
|
+
...these.map((d) => `${d.severity.padEnd(5)} ${d.group.padEnd(width)} ${line(d)}`),
|
|
109
|
+
]),
|
|
110
|
+
count(diagnoses),
|
|
111
|
+
"",
|
|
112
|
+
].join("\n");
|
|
113
|
+
const status = diagnoses.some((d) => d.severity !== "info") ? 1 : 0;
|
|
114
|
+
const draw = (s) => {
|
|
115
|
+
s.brand("doctor", `${on}${install.version} (${install.label})`);
|
|
116
|
+
for (const { repository, diagnoses: section } of parts) {
|
|
117
|
+
if (repository !== undefined) {
|
|
118
|
+
s.write("\n");
|
|
119
|
+
s.pill("secondary", repository);
|
|
120
|
+
}
|
|
121
|
+
for (const group of GROUPS) {
|
|
122
|
+
const these = section.filter((d) => d.group === group);
|
|
123
|
+
if (these.length === 0)
|
|
124
|
+
continue;
|
|
125
|
+
s.write("\n");
|
|
126
|
+
s.pill("primary", group.toUpperCase());
|
|
127
|
+
for (const d of these) {
|
|
128
|
+
const message = line(d, s.val);
|
|
129
|
+
if (d.severity === "error")
|
|
130
|
+
s.fail(message);
|
|
131
|
+
else if (d.severity === "warn")
|
|
132
|
+
s.warn(message);
|
|
133
|
+
else
|
|
134
|
+
s.info(message);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
s.write("\n");
|
|
139
|
+
if (status === 0)
|
|
140
|
+
s.ok(count(diagnoses));
|
|
141
|
+
else if (diagnoses.some((d) => d.severity === "error"))
|
|
142
|
+
s.fail(count(diagnoses));
|
|
143
|
+
else
|
|
144
|
+
s.warn(count(diagnoses));
|
|
145
|
+
};
|
|
146
|
+
// The report goes to stdout whatever the status, so a script reads it the same way either way.
|
|
147
|
+
return { text, status, draw };
|
|
148
|
+
}
|
|
149
|
+
/** What every remote diagnosis shares. */
|
|
150
|
+
const REMOTE_DIAGNOSIS = { group: "remote", severity: "info", fix: "person" };
|
|
151
|
+
/** How long the daemon gets to say it is one. */
|
|
152
|
+
const ROOT_TIMEOUT = 10_000;
|
|
153
|
+
/** How long it gets to build its diagnoses, which runs its dry runs. */
|
|
154
|
+
const DOCTOR_TIMEOUT = 300_000;
|
|
155
|
+
/** GET a route of the daemon: its status and JSON body, or why there is none, as a diagnosis says it. */
|
|
156
|
+
async function get(url, route, timeout) {
|
|
157
|
+
const answer = await getRoute(url, route, timeout);
|
|
158
|
+
if (answer.kind === "unreachable")
|
|
159
|
+
return { why: `the daemon there does not answer: ${answer.why}` };
|
|
160
|
+
if (answer.kind === "not-json")
|
|
161
|
+
return { why: `${route} answered ${answer.status} with no JSON, which is no kryso daemon's answer` };
|
|
162
|
+
return answer;
|
|
163
|
+
}
|
|
164
|
+
/** The remote's one diagnosis, and under --remote the daemon's document when it sent one. The
|
|
165
|
+
* daemon is asked only when the run may read a remote, and only for a read. */
|
|
166
|
+
async function askRemote(url, opts) {
|
|
167
|
+
const setLine = `a remote is set at ${url}`;
|
|
168
|
+
if (opts.offline) {
|
|
169
|
+
return { diagnosis: { ...REMOTE_DIAGNOSIS, id: "remote.unknown", subject: url, unknown: true, text: `${setLine}, and whether the daemon there answers is unknown, because --offline asks no remote` } };
|
|
170
|
+
}
|
|
171
|
+
const answers = { ...REMOTE_DIAGNOSIS, id: "remote.answers", subject: url, text: `${setLine}, and the daemon there answers` };
|
|
172
|
+
const silent = (why) => ({ diagnosis: { ...REMOTE_DIAGNOSIS, id: "remote.silent", subject: url, text: `${setLine}, but ${why}` } });
|
|
173
|
+
if (!opts.remote) {
|
|
174
|
+
const r = await get(url, "/", ROOT_TIMEOUT);
|
|
175
|
+
if ("why" in r)
|
|
176
|
+
return silent(r.why);
|
|
177
|
+
return r.body?.name === "kryso-daemon" ? { diagnosis: answers } : silent(`/ answered ${r.status}, which is no kryso daemon's answer`);
|
|
178
|
+
}
|
|
179
|
+
const r = await get(url, "/doctor", DOCTOR_TIMEOUT);
|
|
180
|
+
if ("why" in r)
|
|
181
|
+
return silent(r.why);
|
|
182
|
+
if (r.status === 404) {
|
|
183
|
+
return {
|
|
184
|
+
diagnosis: {
|
|
185
|
+
...REMOTE_DIAGNOSIS,
|
|
186
|
+
id: "remote.no-route",
|
|
187
|
+
subject: url,
|
|
188
|
+
unknown: true,
|
|
189
|
+
text: `the daemon at ${url} answers, but it has no doctor route, so its diagnoses are unknown; a kryso-daemon of this kryso's version serves them`,
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const body = r.body;
|
|
194
|
+
if (r.status !== 200)
|
|
195
|
+
return silent(`the daemon there answered /doctor with ${r.status}${typeof body?.message === "string" ? `: ${body.message}` : ""}`);
|
|
196
|
+
if (!body?.install || !Array.isArray(body.diagnoses))
|
|
197
|
+
return silent("the daemon there answered /doctor with no doctor document");
|
|
198
|
+
return { diagnosis: answers, theirs: body };
|
|
199
|
+
}
|
|
200
|
+
async function doctor(argv, env) {
|
|
201
|
+
const opts = parse(argv);
|
|
202
|
+
if ("text" in opts) {
|
|
203
|
+
give(opts, env);
|
|
204
|
+
return opts.status;
|
|
205
|
+
}
|
|
206
|
+
const url = readRemote(env);
|
|
207
|
+
if (opts.remote && url === null) {
|
|
208
|
+
const none = refusal(EX_USAGE, NAME, "--remote reads the daemon a remote names, and none is set", { hint: "set one with kryso remote <url>" });
|
|
209
|
+
give(none, env);
|
|
210
|
+
return none.status;
|
|
211
|
+
}
|
|
212
|
+
const doc = diagnose(opts.all ? everywhere(env) : here(env), { offline: opts.offline }, env);
|
|
213
|
+
// The remote group is reported last, so its line goes at the end of the list.
|
|
214
|
+
const asked = url === null ? undefined : await askRemote(url, opts);
|
|
215
|
+
if (asked)
|
|
216
|
+
doc.diagnoses.push(asked.diagnosis);
|
|
217
|
+
const out = report(doc, opts.all);
|
|
218
|
+
const theirs = asked?.theirs && report(asked.theirs, true, url);
|
|
219
|
+
if (opts.json) {
|
|
220
|
+
const machines = [{ machine: "local", doctor: doc }, ...(asked?.theirs ? [{ machine: "remote", url, doctor: asked.theirs }] : [])];
|
|
221
|
+
process.stdout.write(`${JSON.stringify(opts.remote ? { machines } : doc, null, 2)}\n`);
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
const both = {
|
|
225
|
+
text: out.text + (theirs?.text ?? ""),
|
|
226
|
+
draw: (s) => {
|
|
227
|
+
out.draw(s);
|
|
228
|
+
if (theirs) {
|
|
229
|
+
s.write("\n");
|
|
230
|
+
theirs.draw(s);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
say(both, process.stdout, env);
|
|
235
|
+
}
|
|
236
|
+
return Math.max(out.status, theirs?.status ?? 0);
|
|
237
|
+
}
|
|
238
|
+
doctor(process.argv.slice(2), process.env).then((status) => (process.exitCode = status), (err) => {
|
|
239
|
+
process.stderr.write(`${NAME}: ${err instanceof Error ? (err.stack ?? err.message) : String(err)}\n`);
|
|
240
|
+
process.exitCode = EX_SOFTWARE;
|
|
241
|
+
});
|
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const EX_USAGE = 64;
|
|
2
|
+
export declare const EX_UNAVAILABLE = 69;
|
|
3
|
+
export declare const EX_SOFTWARE = 70;
|
|
4
|
+
export declare const EX_TEMPFAIL = 75;
|
|
5
|
+
export declare const EX_CONFIG = 78;
|
|
6
|
+
export declare const EX_NOT_FOUND = 127;
|
|
7
|
+
/** ~/.config/kryso, or $XDG_CONFIG_HOME/kryso when that is set, where the warden's repository
|
|
8
|
+
* list, the remote and the daemon's config live. */
|
|
9
|
+
export declare function configDir(env?: NodeJS.ProcessEnv): string;
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// What the kryso command and the daemon share about their surroundings: where their config
|
|
2
|
+
// lives, and the exit statuses they give themselves. The daemon imports it as `kryso/env`, so
|
|
3
|
+
// the command keeps no runtime dependency of its own.
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
// The exit statuses, in the sysexits(3) values the drivers already use.
|
|
7
|
+
export const EX_USAGE = 64;
|
|
8
|
+
export const EX_UNAVAILABLE = 69;
|
|
9
|
+
export const EX_SOFTWARE = 70;
|
|
10
|
+
export const EX_TEMPFAIL = 75;
|
|
11
|
+
export const EX_CONFIG = 78;
|
|
12
|
+
export const EX_NOT_FOUND = 127;
|
|
13
|
+
/** ~/.config/kryso, or $XDG_CONFIG_HOME/kryso when that is set, where the warden's repository
|
|
14
|
+
* list, the remote and the daemon's config live. */
|
|
15
|
+
export function configDir(env = process.env) {
|
|
16
|
+
return path.join(env.XDG_CONFIG_HOME || path.join(env.HOME || os.homedir(), ".config"), "kryso");
|
|
17
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Diagnosis } from "@krysoworks/core";
|
|
2
|
+
/** How many days evidence stays before kryso cleanup --evidence may remove a copy the remote holds. */
|
|
3
|
+
export declare const RETENTION_DAYS = 90;
|
|
4
|
+
/** The evidence group's diagnoses for the repository at repo, its main checkout. */
|
|
5
|
+
export declare function evidenceOf(repo: string): Diagnosis[];
|
|
6
|
+
/** The keep configuration a run reads: the file, the launch agent that named it when one did, and
|
|
7
|
+
* the archive and remote it names. */
|
|
8
|
+
export interface Keep {
|
|
9
|
+
file: string;
|
|
10
|
+
plist?: string;
|
|
11
|
+
archive: string;
|
|
12
|
+
remote?: string;
|
|
13
|
+
}
|
|
14
|
+
/** Why there is no usable keep configuration: the clause that says so, and doctor's diagnosis. */
|
|
15
|
+
export interface NoKeep {
|
|
16
|
+
why: string;
|
|
17
|
+
diagnosis: Diagnosis;
|
|
18
|
+
}
|
|
19
|
+
/** The keep configuration: the file named, or the one the installed keep launch agent names, read
|
|
20
|
+
* as archive.py's load_keep reads it, or why there is no usable one. */
|
|
21
|
+
export declare function keepOf(env: NodeJS.ProcessEnv, named?: string): Keep | NoKeep;
|
|
22
|
+
/** What an archive snapshot the remote has verified can vouch for: the archive, the remote's
|
|
23
|
+
* kind, such as s3, and the archive snapshots the upload queue records as verified there. */
|
|
24
|
+
export interface Verified {
|
|
25
|
+
archive: string;
|
|
26
|
+
kind: string;
|
|
27
|
+
snapshots: string[];
|
|
28
|
+
}
|
|
29
|
+
/** The archive's diagnoses, the machine's, with archive.py among the drivers, and the snapshots
|
|
30
|
+
* the remote has verified when the status verb said. The keep configuration is the one named, or
|
|
31
|
+
* the one the keep launch agent names. */
|
|
32
|
+
export declare function archiveOf(drivers: string | undefined, env: NodeJS.ProcessEnv, named?: string, now?: number): {
|
|
33
|
+
found: Diagnosis[];
|
|
34
|
+
verified?: Verified;
|
|
35
|
+
};
|
|
36
|
+
/** The repository's shift folders and shipped copies whose newest file is older than the
|
|
37
|
+
* retention: cleanup's under --evidence when the verified snapshots hold every file in one, and a
|
|
38
|
+
* person's, kept whole, when they do not. A copy with no file in it has no age and is left out. */
|
|
39
|
+
export declare function pastRetention(repo: string, verified: Verified, days?: number, now?: number): Diagnosis[];
|