carrick 0.3.84 → 0.3.85
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/README.md +15 -0
- package/bin/carrick.mjs +89 -0
- package/dist/auth/credentials.d.ts +9 -0
- package/dist/auth/credentials.js +13 -2
- package/dist/auth/credentials.js.map +1 -1
- package/dist/auth/read.d.ts +4 -4
- package/dist/global-install.d.ts +183 -0
- package/dist/global-install.js +393 -0
- package/dist/global-install.js.map +1 -0
- package/dist/hook/post-edit.js +10 -0
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/hook/session-start.js +34 -0
- package/dist/hook/session-start.js.map +1 -1
- package/dist/hook/stop.js +18 -4
- package/dist/hook/stop.js.map +1 -1
- package/dist/hook/user-prompt.js +16 -4
- package/dist/hook/user-prompt.js.map +1 -1
- package/dist/init/doctor.d.ts +40 -0
- package/dist/init/doctor.js +125 -0
- package/dist/init/doctor.js.map +1 -1
- package/dist/init/outdated.d.ts +47 -0
- package/dist/init/outdated.js +104 -0
- package/dist/init/outdated.js.map +1 -1
- package/dist/init/projects.d.ts +2 -2
- package/dist/init/run.d.ts +9 -0
- package/dist/init/run.js +57 -12
- package/dist/init/run.js.map +1 -1
- package/dist/scan.d.ts +26 -0
- package/dist/scan.js +92 -0
- package/dist/scan.js.map +1 -1
- package/dist/update-check.d.ts +1 -0
- package/dist/update-check.js +25 -0
- package/dist/update-check.js.map +1 -0
- package/dist/update.d.ts +128 -0
- package/dist/update.js +398 -0
- package/dist/update.js.map +1 -0
- package/package.json +7 -7
- package/sidecar/dist/src/capture/anchors.js +69 -8
- package/sidecar/dist/src/capture/api.d.ts +4 -1
- package/sidecar/dist/src/capture/deep-walk.js +4 -1
- package/sidecar/dist/src/capture/node-builder.d.ts +28 -1
- package/sidecar/dist/src/capture/node-builder.js +89 -3
- package/sidecar/dist/src/capture/unresolved.d.ts +7 -0
- package/sidecar/dist/src/capture/unresolved.js +1 -1
- package/sidecar/dist/src/type-inferrer.d.ts +118 -4
- package/sidecar/dist/src/type-inferrer.js +433 -15
- package/templates/skills/carrick-census.md +3 -1
package/README.md
CHANGED
|
@@ -17,6 +17,21 @@ accepts that credential or a `CARRICK_TOKEN` environment override, and signs in
|
|
|
17
17
|
through the browser itself when a terminal has neither. GitHub CLI credentials
|
|
18
18
|
do not grant Carrick access.
|
|
19
19
|
|
|
20
|
+
An installed `carrick` does not move on its own, and a scan on an old build can
|
|
21
|
+
fail on a defect that is already fixed. So every command reads a cached answer
|
|
22
|
+
to "is there a newer one", refreshes it in the background, and prints a line
|
|
23
|
+
naming the exact update command for the way this copy was installed. It never
|
|
24
|
+
blocks on the network, and `CARRICK_NO_UPDATE_CHECK=1` turns it off for a
|
|
25
|
+
reproducible run. The one thing it installs is an older **global** `carrick`
|
|
26
|
+
when you run through `npx`: that install answers your agent's hooks and every
|
|
27
|
+
new shell, so it is brought level with the version you just ran, using the
|
|
28
|
+
package manager that owns it and nothing that overrides your own npm
|
|
29
|
+
configuration. A machine with no global is never installed onto without a yes —
|
|
30
|
+
`carrick init` asks, and `carrick init --install-global` is the answer for a
|
|
31
|
+
script. In CI it warns
|
|
32
|
+
and continues, so a workflow decides its own version — and
|
|
33
|
+
`carrick-tools/carrick@v1` in a workflow already moves to each release.
|
|
34
|
+
|
|
20
35
|
`init` prints one line per thing it did — `◇` done, `▲` a warning with what to
|
|
21
36
|
do about it, `■` something it could not do and why — and ends on the sentence
|
|
22
37
|
to paste to your agent. Everything else, including the editor extension, how
|
package/bin/carrick.mjs
CHANGED
|
@@ -82,6 +82,82 @@ async function refreshNoticeLine() {
|
|
|
82
82
|
|
|
83
83
|
await refreshNoticeLine();
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* "The carrick you are running is not the carrick that is published."
|
|
87
|
+
*
|
|
88
|
+
* At the start of the command, which is the only moment it is useful: told
|
|
89
|
+
* halfway through a scan, a person has already paid for the scan. An installed
|
|
90
|
+
* `carrick` never moves on its own, so without this the only upgrade path is a
|
|
91
|
+
* human remembering — which is exactly the path that failed a pilot customer,
|
|
92
|
+
* who ran a scan on a build three releases old and hit a defect already fixed.
|
|
93
|
+
*
|
|
94
|
+
* On a laptop this reads one small cache file and starts a detached child to
|
|
95
|
+
* refresh it, so it adds no measurable time; in CI it is one bounded fetch, and
|
|
96
|
+
* only in front of a scan. Either way it prints and continues: nothing here
|
|
97
|
+
* installs anything or changes which binary runs. `src/update.ts` has the
|
|
98
|
+
* reasoning, `docs/reference/update-check.md` the design.
|
|
99
|
+
*
|
|
100
|
+
* Silent for `lsp` and `hook post-edit`: those run on a protocol stream and on
|
|
101
|
+
* every keystroke-ish edit. `hook session-start` prints its own version of this
|
|
102
|
+
* on stdout, where the agent reading the session actually sees it.
|
|
103
|
+
*/
|
|
104
|
+
async function noticeUpdate() {
|
|
105
|
+
try {
|
|
106
|
+
const update = await import("../dist/update.js");
|
|
107
|
+
if (command === "lsp" || command === "hook") {
|
|
108
|
+
// Still worth refreshing the cache: hooks are the most frequent
|
|
109
|
+
// invocation on a developer machine, so they are what keeps the answer
|
|
110
|
+
// the other commands print from going stale.
|
|
111
|
+
if (!update.inCi(process.env)) update.scheduleUpdateCheck(process.env);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const line = update.inCi(process.env)
|
|
115
|
+
? await update.ciUpdateNotice(argv, process.env)
|
|
116
|
+
: update.updateNoticeFromCache(process.env);
|
|
117
|
+
// stderr, always: a `--json` answer and `lsp --stdio` own stdout.
|
|
118
|
+
if (line) process.stderr.write(`${line}\n`);
|
|
119
|
+
} catch {
|
|
120
|
+
// A version check is never a reason for a command not to run.
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
await noticeUpdate();
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Leave no older `carrick` on PATH behind this run (carrick#1372).
|
|
128
|
+
*
|
|
129
|
+
* A run through `npx carrick@latest` is current by construction and changes
|
|
130
|
+
* nothing on the machine, so a global install from an earlier release keeps
|
|
131
|
+
* answering every hook, every script and every new shell afterwards. Where one
|
|
132
|
+
* exists, this brings it level, through the package manager that owns it, and
|
|
133
|
+
* then resolves `carrick` again to check that it took. It installs nothing on a
|
|
134
|
+
* machine that has no global: that offer is `carrick init`'s, where there is
|
|
135
|
+
* somebody to ask.
|
|
136
|
+
*
|
|
137
|
+
* `src/global-install.ts` has the reasoning. Silent unless it does something,
|
|
138
|
+
* and never a reason a command does not run.
|
|
139
|
+
*/
|
|
140
|
+
async function keepGlobalCurrent() {
|
|
141
|
+
try {
|
|
142
|
+
const sync = await import("../dist/global-install.js");
|
|
143
|
+
if (!sync.syncsOnThisRun(command, process.env)) return;
|
|
144
|
+
// stderr throughout, so a `--json` answer on stdout stays parseable.
|
|
145
|
+
const outcome = sync.syncGlobalInstall({
|
|
146
|
+
say: (line) => process.stderr.write(`carrick: ${line}\n`),
|
|
147
|
+
});
|
|
148
|
+
// A run that is ending on an older carrick than it is says so at the END of
|
|
149
|
+
// it. In front of `carrick index` this is the first line of a log that then
|
|
150
|
+
// runs for minutes, and what it names is the state the machine is left in.
|
|
151
|
+
if (outcome.warning) {
|
|
152
|
+
process.once("exit", () => process.stderr.write(`carrick: ${outcome.warning}\n`));
|
|
153
|
+
}
|
|
154
|
+
} catch {
|
|
155
|
+
// An upgrade that could not even be attempted is not a failed command.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
await keepGlobalCurrent();
|
|
160
|
+
|
|
85
161
|
/**
|
|
86
162
|
* Run a build of the index and render it (carrick#1315).
|
|
87
163
|
*
|
|
@@ -127,6 +203,7 @@ async function renderNative(args) {
|
|
|
127
203
|
/** Run the scanner binary, streaming its output and answering with its code. */
|
|
128
204
|
async function runNative(args) {
|
|
129
205
|
const { resolveNativeBinary, nativeEnv, overrideLine } = await import("../dist/native.js");
|
|
206
|
+
const { relaySignals } = await import("../dist/scan.js");
|
|
130
207
|
const lookup = resolveNativeBinary();
|
|
131
208
|
if (!lookup.binary) {
|
|
132
209
|
process.stderr.write(`carrick: ${lookup.problem}\n`);
|
|
@@ -139,11 +216,17 @@ async function runNative(args) {
|
|
|
139
216
|
stdio: "inherit",
|
|
140
217
|
env: nativeEnv(),
|
|
141
218
|
});
|
|
219
|
+
// The streams are inherited here, so a scan this process walks out on keeps
|
|
220
|
+
// writing to the terminal — but it is still a scan nobody told to stop, and
|
|
221
|
+
// a `kill` on this pid reaches this process alone (carrick#1391).
|
|
222
|
+
const stopRelaying = relaySignals(child);
|
|
142
223
|
child.on("error", (error) => {
|
|
224
|
+
stopRelaying();
|
|
143
225
|
process.stderr.write(`carrick: could not run ${lookup.binary}: ${error.message}\n`);
|
|
144
226
|
process.exit(1);
|
|
145
227
|
});
|
|
146
228
|
child.on("exit", (code, signal) => {
|
|
229
|
+
stopRelaying();
|
|
147
230
|
// A signalled child is reported the way a shell reports it, so a Ctrl-C
|
|
148
231
|
// through this shim looks like a Ctrl-C of the scanner.
|
|
149
232
|
if (signal) {
|
|
@@ -212,6 +295,12 @@ function extraHelp() {
|
|
|
212
295
|
" carrick.json",
|
|
213
296
|
" --version the version of this package",
|
|
214
297
|
"",
|
|
298
|
+
"ENVIRONMENT:",
|
|
299
|
+
" CARRICK_NO_UPDATE_CHECK set it to stop carrick checking whether a",
|
|
300
|
+
" newer version is published. The check reads",
|
|
301
|
+
" one cached file and refreshes it in the",
|
|
302
|
+
" background; it never installs anything.",
|
|
303
|
+
"",
|
|
215
304
|
"`carrick init [--project SLUG]` sets this folder up; `carrick init --help`",
|
|
216
305
|
"prints its own arguments. `carrick doctor` re-checks that setup and exits",
|
|
217
306
|
"non-zero on anything it finds. `carrick remove` undoes what init wrote on",
|
|
@@ -32,6 +32,15 @@ export type Credential = {
|
|
|
32
32
|
*/
|
|
33
33
|
scope?: string;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* The per-user directory Carrick keeps its own state in.
|
|
37
|
+
*
|
|
38
|
+
* Exported because more than the credential lives here: the update check's
|
|
39
|
+
* cache (`src/update.ts`) is written beside it, and two spellings of one
|
|
40
|
+
* directory would put a test's temporary state somewhere a later read cannot
|
|
41
|
+
* find it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function configDir(env?: NodeJS.ProcessEnv): string;
|
|
35
44
|
export declare function credentialPath(env?: NodeJS.ProcessEnv): string;
|
|
36
45
|
export declare function readCredential(env?: NodeJS.ProcessEnv): Credential | null;
|
|
37
46
|
export declare function saveCredential(token: string, workspace: string | null, env?: NodeJS.ProcessEnv, scope?: string): void;
|
package/dist/auth/credentials.js
CHANGED
|
@@ -17,13 +17,24 @@ export const APP_BASE = "https://app.carrick.tools";
|
|
|
17
17
|
* `docs/internal/reference/laptop-scan-seam.md` §1.1, §8.1, §9).
|
|
18
18
|
*/
|
|
19
19
|
export const SCOPE = "cli";
|
|
20
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The per-user directory Carrick keeps its own state in.
|
|
22
|
+
*
|
|
23
|
+
* Exported because more than the credential lives here: the update check's
|
|
24
|
+
* cache (`src/update.ts`) is written beside it, and two spellings of one
|
|
25
|
+
* directory would put a test's temporary state somewhere a later read cannot
|
|
26
|
+
* find it.
|
|
27
|
+
*/
|
|
28
|
+
export function configDir(env = process.env) {
|
|
21
29
|
const base = env["XDG_CONFIG_HOME"] ||
|
|
22
30
|
(process.platform === "win32" ? env["APPDATA"] : undefined) ||
|
|
23
31
|
path.join(env["HOME"] || os.homedir(), ".config");
|
|
24
32
|
if (!path.isAbsolute(base))
|
|
25
33
|
throw new Error("Carrick's configuration directory must be an absolute path.");
|
|
26
|
-
return path.join(base, "carrick"
|
|
34
|
+
return path.join(base, "carrick");
|
|
35
|
+
}
|
|
36
|
+
export function credentialPath(env = process.env) {
|
|
37
|
+
return path.join(configDir(env), "credentials.json");
|
|
27
38
|
}
|
|
28
39
|
export function readCredential(env = process.env) {
|
|
29
40
|
if (env["CARRICK_TOKEN"] !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/auth/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC;AAqB3B,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/auth/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AACpD,MAAM,CAAC,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC;AAqB3B;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC5D,MAAM,IAAI,GAAG,GAAG,CAAC,iBAAiB,CAAC;QACjC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACpD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IAC3G,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS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,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IACxD,OAAO,KAAK,EAAE,CAAC;QACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
|
package/dist/auth/read.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ declare const response: z.ZodObject<{
|
|
|
6
6
|
billing_tier: z.ZodEnum<["free", "cross_repo", "paid"]>;
|
|
7
7
|
installed: z.ZodBoolean;
|
|
8
8
|
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
installed: boolean;
|
|
9
10
|
slug: string;
|
|
10
11
|
billing_tier: "free" | "cross_repo" | "paid";
|
|
11
|
-
installed: boolean;
|
|
12
12
|
}, {
|
|
13
|
+
installed: boolean;
|
|
13
14
|
slug: string;
|
|
14
15
|
billing_tier: "free" | "cross_repo" | "paid";
|
|
15
|
-
installed: boolean;
|
|
16
16
|
}>;
|
|
17
17
|
allowance_sentence: z.ZodNullable<z.ZodString>;
|
|
18
18
|
repos: z.ZodArray<z.ZodDiscriminatedUnion<"connected", [z.ZodObject<{
|
|
@@ -81,9 +81,9 @@ declare const response: z.ZodObject<{
|
|
|
81
81
|
}, "strip", z.ZodTypeAny, {
|
|
82
82
|
schema: "carrick.resolve-repos/0";
|
|
83
83
|
workspace: {
|
|
84
|
+
installed: boolean;
|
|
84
85
|
slug: string;
|
|
85
86
|
billing_tier: "free" | "cross_repo" | "paid";
|
|
86
|
-
installed: boolean;
|
|
87
87
|
};
|
|
88
88
|
repos: ({
|
|
89
89
|
connected: false;
|
|
@@ -108,9 +108,9 @@ declare const response: z.ZodObject<{
|
|
|
108
108
|
}, {
|
|
109
109
|
schema: "carrick.resolve-repos/0";
|
|
110
110
|
workspace: {
|
|
111
|
+
installed: boolean;
|
|
111
112
|
slug: string;
|
|
112
113
|
billing_tier: "free" | "cross_repo" | "paid";
|
|
113
|
-
installed: boolean;
|
|
114
114
|
};
|
|
115
115
|
repos: ({
|
|
116
116
|
connected: false;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { InstallShape } from "./update.ts";
|
|
2
|
+
/** The names a `carrick` on PATH goes by, most specific first. */
|
|
3
|
+
export declare function carrickNames(platform?: string): string[];
|
|
4
|
+
/** A `carrick` that is installed on this machine and is not the one running. */
|
|
5
|
+
export type GlobalCarrick = {
|
|
6
|
+
/** What the PATH lookup answers with. */
|
|
7
|
+
binary: string;
|
|
8
|
+
/** Where that leads after symlinks: an npm global bin entry is a link. */
|
|
9
|
+
real: string;
|
|
10
|
+
/** Its version, or null when neither its manifest nor the binary said. */
|
|
11
|
+
version: string | null;
|
|
12
|
+
};
|
|
13
|
+
export type FindOptions = {
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
platform?: string;
|
|
16
|
+
exists?: (target: string) => boolean;
|
|
17
|
+
real?: (target: string) => string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The `carrick` a PATH lookup finds, skipping what only exists during a run.
|
|
21
|
+
*
|
|
22
|
+
* `which carrick` cannot answer this question. npm puts the exec tree's own
|
|
23
|
+
* `node_modules/.bin` at the front of PATH for the child it runs, so inside
|
|
24
|
+
* `npx carrick init` a `which` says `carrick` is on PATH on a machine where it
|
|
25
|
+
* is not — and `carrick init` then wrote a bare `carrick hook post-edit` into a
|
|
26
|
+
* settings file, naming a command that stopped existing when npx exited.
|
|
27
|
+
*
|
|
28
|
+
* File reads only: no `which`, no subprocess, so it costs nothing on a command
|
|
29
|
+
* that runs on every edit.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findCarrick(options?: FindOptions): GlobalCarrick | null;
|
|
32
|
+
export type VersionOptions = {
|
|
33
|
+
env?: NodeJS.ProcessEnv;
|
|
34
|
+
platform?: string;
|
|
35
|
+
read?: (target: string) => string;
|
|
36
|
+
run?: (binary: string) => string | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The version of the install a binary belongs to.
|
|
40
|
+
*
|
|
41
|
+
* Read off the manifest above it wherever the path says — an npm global bin
|
|
42
|
+
* entry links straight into `lib/node_modules/carrick/bin`, so the answer is a
|
|
43
|
+
* file read. A shim that is a real file (volta, a `.cmd` on Windows) leads
|
|
44
|
+
* nowhere, and only then is the binary asked, with the version check turned off
|
|
45
|
+
* in the child so an older build does not fork a registry fetch from our probe.
|
|
46
|
+
*/
|
|
47
|
+
export declare function installedVersion(found: GlobalCarrick, options?: VersionOptions): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* The command that replaces a global install, for the manager that owns it.
|
|
50
|
+
*
|
|
51
|
+
* Null for the two shapes that are not a global: an npx cache directory, which
|
|
52
|
+
* is thrown away and re-resolved, and a project dependency, which belongs to
|
|
53
|
+
* whichever repository pins it and is not this run's to change. Both are
|
|
54
|
+
* reported rather than acted on.
|
|
55
|
+
*
|
|
56
|
+
* The version is pinned rather than `@latest` on purpose. The run knows which
|
|
57
|
+
* version it is, `@latest` is a second question for the registry, and a pinned
|
|
58
|
+
* spec is what makes the verification below a comparison rather than a guess.
|
|
59
|
+
*/
|
|
60
|
+
export declare function globalCommand(kind: InstallShape["kind"], version: string): string[] | null;
|
|
61
|
+
/**
|
|
62
|
+
* The command for a machine that has no global carrick at all.
|
|
63
|
+
*
|
|
64
|
+
* The running copy's own shape names the manager: somebody running through
|
|
65
|
+
* `npx` has npm, and a project dependency says nothing about what its owner
|
|
66
|
+
* would want globally, so both answer npm.
|
|
67
|
+
*/
|
|
68
|
+
export declare function firstGlobalCommand(kind: InstallShape["kind"], version: string): string[];
|
|
69
|
+
export type InstallResult = {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
reason: string | null;
|
|
72
|
+
};
|
|
73
|
+
/** What this file needs from the machine, so every case above can be a test. */
|
|
74
|
+
export type GlobalMachine = {
|
|
75
|
+
/** The global carrick on PATH with its version, or null where there is none. */
|
|
76
|
+
find: () => GlobalCarrick | null;
|
|
77
|
+
/** The shape an installed path is in, for the command that replaces it. */
|
|
78
|
+
shape: (found: GlobalCarrick) => InstallShape;
|
|
79
|
+
/** Run an install. `ok` is the manager's own verdict, nothing more. */
|
|
80
|
+
install: (argv: string[]) => InstallResult;
|
|
81
|
+
};
|
|
82
|
+
/** How long an install is given before it is a refusal with a reason. */
|
|
83
|
+
export declare const INSTALL_TIMEOUT_MS = 180000;
|
|
84
|
+
/** The last thing a failed install said, for a reader who has to act on it. */
|
|
85
|
+
export declare function failureReason(result: {
|
|
86
|
+
status: number | null;
|
|
87
|
+
stderr: string | null;
|
|
88
|
+
stdout: string | null;
|
|
89
|
+
error?: Error;
|
|
90
|
+
}): string;
|
|
91
|
+
export declare function realMachine(env?: NodeJS.ProcessEnv): GlobalMachine;
|
|
92
|
+
/**
|
|
93
|
+
* What a run did about the global install, for the tests and for the log.
|
|
94
|
+
*
|
|
95
|
+
* `warning` is the sentence for a run that is ENDING on an older carrick than
|
|
96
|
+
* it is, and it is returned rather than said because that is where it belongs:
|
|
97
|
+
* a line printed in front of `carrick index` is the first line of a
|
|
98
|
+
* multi-minute log, and what it names is the state the machine is left in. The
|
|
99
|
+
* caller prints it last. Everything else — what is being upgraded, and that it
|
|
100
|
+
* took — is progress, and is said as it happens.
|
|
101
|
+
*/
|
|
102
|
+
export type SyncOutcome = {
|
|
103
|
+
kind: "skipped";
|
|
104
|
+
why: string;
|
|
105
|
+
warning: null;
|
|
106
|
+
} | {
|
|
107
|
+
kind: "current";
|
|
108
|
+
version: string;
|
|
109
|
+
warning: null;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "upgraded";
|
|
112
|
+
from: string;
|
|
113
|
+
to: string;
|
|
114
|
+
warning: null;
|
|
115
|
+
} | {
|
|
116
|
+
kind: "refused";
|
|
117
|
+
from: string;
|
|
118
|
+
to: string;
|
|
119
|
+
reason: string;
|
|
120
|
+
command: string;
|
|
121
|
+
warning: string;
|
|
122
|
+
} | {
|
|
123
|
+
kind: "stale";
|
|
124
|
+
path: string | null;
|
|
125
|
+
version: string | null;
|
|
126
|
+
command: string | null;
|
|
127
|
+
warning: string;
|
|
128
|
+
};
|
|
129
|
+
export type SyncOptions = {
|
|
130
|
+
/** The version this run is. */
|
|
131
|
+
running?: string | null;
|
|
132
|
+
/** Progress, as it happens: what is being upgraded, and that it took. */
|
|
133
|
+
say: (line: string) => void;
|
|
134
|
+
machine?: GlobalMachine;
|
|
135
|
+
env?: NodeJS.ProcessEnv;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Bring an older global carrick level with this run, and say so.
|
|
139
|
+
*
|
|
140
|
+
* The ruling this implements: somebody who installed carrick globally has
|
|
141
|
+
* already chosen to have it on this machine, so bringing that choice up to date
|
|
142
|
+
* is inside what they agreed to and is not asked about. What is NOT inside it
|
|
143
|
+
* is creating an install they never asked for, forcing one past their machine's
|
|
144
|
+
* policy, or leaving them on an older binary without knowing.
|
|
145
|
+
*/
|
|
146
|
+
export declare function syncGlobalInstall(options: SyncOptions): SyncOutcome;
|
|
147
|
+
/**
|
|
148
|
+
* Whether this invocation keeps the global install level.
|
|
149
|
+
*
|
|
150
|
+
* Only a run through npx. Every other shape IS the install a person would be
|
|
151
|
+
* upgrading: a global run of `carrick index` is already the version on PATH,
|
|
152
|
+
* and a project dependency belongs to the repository that pins it. npx is the
|
|
153
|
+
* one that leaves a second, older carrick behind it, and it is also the one the
|
|
154
|
+
* quickstart and the agents use.
|
|
155
|
+
*
|
|
156
|
+
* Never in CI: a build machine is thrown away, nothing on it is on PATH for a
|
|
157
|
+
* next run, and what runs there is the workflow's decision.
|
|
158
|
+
*/
|
|
159
|
+
export declare function syncsOnThisRun(command: string | undefined, env?: NodeJS.ProcessEnv, root?: string): boolean;
|
|
160
|
+
export type OfferOutcome = "present" | "installed" | "declined" | "failed";
|
|
161
|
+
export type OfferOptions = {
|
|
162
|
+
running?: string | null;
|
|
163
|
+
/** `--yes`, which consents to the scaffold and not to an install. */
|
|
164
|
+
assumeYes: boolean;
|
|
165
|
+
/** `--install-global`, which is the consent. */
|
|
166
|
+
install: boolean;
|
|
167
|
+
confirm: (question: string) => Promise<boolean>;
|
|
168
|
+
say: (line: string) => void;
|
|
169
|
+
machine?: GlobalMachine;
|
|
170
|
+
env?: NodeJS.ProcessEnv;
|
|
171
|
+
root?: string;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Offer a global install to a machine that has none, and never take one.
|
|
175
|
+
*
|
|
176
|
+
* The ruling: `--yes` answers for the workspace, so it prints the command and
|
|
177
|
+
* installs nothing; a terminal is asked; `--install-global` is the consent a
|
|
178
|
+
* script gives. What turns on the answer is the hook commands written
|
|
179
|
+
* immediately after this — with a global, they are the bare `carrick`, which
|
|
180
|
+
* survives the end of this npx run; without one, they name this install, which
|
|
181
|
+
* does not.
|
|
182
|
+
*/
|
|
183
|
+
export declare function offerGlobalInstall(options: OfferOptions): Promise<OfferOutcome>;
|