carrick 0.3.89 → 0.3.91
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 +5 -3
- package/dist/auth/oauth.d.ts +8 -0
- package/dist/auth/oauth.js +65 -11
- package/dist/auth/oauth.js.map +1 -1
- package/dist/init/connect.d.ts +42 -3
- package/dist/init/connect.js +172 -113
- package/dist/init/connect.js.map +1 -1
- package/dist/init/doctor.js +2 -2
- package/dist/init/doctor.js.map +1 -1
- package/dist/init/mcp.d.ts +11 -0
- package/dist/init/mcp.js +14 -8
- package/dist/init/mcp.js.map +1 -1
- package/dist/init/output.d.ts +6 -0
- package/dist/init/output.js +37 -2
- package/dist/init/output.js.map +1 -1
- package/dist/init/projects.d.ts +56 -5
- package/dist/init/projects.js +124 -17
- package/dist/init/projects.js.map +1 -1
- package/dist/init/remove.js +2 -2
- package/dist/init/remove.js.map +1 -1
- package/dist/init/repos.d.ts +33 -0
- package/dist/init/repos.js +8 -1
- package/dist/init/repos.js.map +1 -1
- package/dist/init/run.d.ts +64 -36
- package/dist/init/run.js +268 -166
- package/dist/init/run.js.map +1 -1
- package/package.json +6 -6
- package/sidecar/dist/src/capture/api.d.ts +13 -1
- package/sidecar/dist/src/capture/check-classify.js +12 -7
- package/sidecar/dist/src/capture/check-probe.d.ts +10 -0
- package/sidecar/dist/src/capture/check-probe.js +21 -3
- package/sidecar/dist/src/capture/check.js +1 -0
- package/sidecar/dist/src/capture/index.d.ts +1 -0
- package/sidecar/dist/src/capture/index.js +1 -0
- package/sidecar/dist/src/index.js +37 -9
- package/sidecar/dist/src/retype.d.ts +67 -0
- package/sidecar/dist/src/retype.js +813 -0
- package/sidecar/dist/src/type-inferrer.d.ts +85 -1
- package/sidecar/dist/src/type-inferrer.js +384 -1
- package/sidecar/dist/src/types.d.ts +58 -2
- package/sidecar/dist/src/validators.d.ts +153 -20
- package/sidecar/dist/src/validators.js +17 -0
package/README.md
CHANGED
|
@@ -34,9 +34,11 @@ and continues, so a workflow decides its own version — and
|
|
|
34
34
|
|
|
35
35
|
`init` prints one line per thing it did — `◇` done, `▲` a warning with what to
|
|
36
36
|
do about it, `■` something it could not do and why — and ends on the sentence
|
|
37
|
-
to paste to your agent.
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
to paste to your agent. What it installs, the hooks included, is in the
|
|
38
|
+
[CLI reference](https://docs.carrick.tools/cli#workspace-initialisation). The CI
|
|
39
|
+
check and a `carrick.json` written by hand are in
|
|
40
|
+
[Building the index](https://docs.carrick.tools/building-the-index), and the
|
|
41
|
+
editor extension is in [In your editor](https://docs.carrick.tools/editor). Without a terminal — CI, an
|
|
40
42
|
agent's shell, a pipe — the same lines are written as plain text, with no colour
|
|
41
43
|
and no spinner.
|
|
42
44
|
|
package/dist/auth/oauth.d.ts
CHANGED
|
@@ -5,7 +5,15 @@ export type OAuthOptions = {
|
|
|
5
5
|
open?: (url: string) => Promise<boolean>;
|
|
6
6
|
say?: (message: string) => void;
|
|
7
7
|
timeoutMs?: number;
|
|
8
|
+
/** Bound on the workspace lookup that names the page. Default 3 s. */
|
|
9
|
+
lookupTimeoutMs?: number;
|
|
8
10
|
signal?: AbortSignal;
|
|
9
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* The page the browser lands on after the loopback redirect (carrick#1488).
|
|
14
|
+
* Self-contained: inline CSS, no external assets. Kept deliberately plain:
|
|
15
|
+
* the word "carrick", one heading, one line. Every argument is escaped here.
|
|
16
|
+
*/
|
|
17
|
+
export declare function callbackPage(heading: string, line: string): string;
|
|
10
18
|
/** RFC 8252 loopback + S256 PKCE against Carrick's existing public OAuth client flow. */
|
|
11
19
|
export declare function authorize(options?: OAuthOptions): Promise<string>;
|
package/dist/auth/oauth.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
|
2
2
|
import http from "node:http";
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
4
|
import { APP_BASE, API_BASE, SCOPE } from "./credentials.js";
|
|
5
|
+
import { resolveRepos } from "./read.js";
|
|
5
6
|
/** Launch a URL as an argument, never through a shell. */
|
|
6
7
|
export async function openBrowser(url) {
|
|
7
8
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32.exe" : "xdg-open";
|
|
@@ -12,6 +13,41 @@ export async function openBrowser(url) {
|
|
|
12
13
|
child.on("exit", (code) => resolve(code === 0));
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
function escapeHtml(value) {
|
|
17
|
+
return value.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The page the browser lands on after the loopback redirect (carrick#1488).
|
|
21
|
+
* Self-contained: inline CSS, no external assets. Kept deliberately plain:
|
|
22
|
+
* the word "carrick", one heading, one line. Every argument is escaped here.
|
|
23
|
+
*/
|
|
24
|
+
export function callbackPage(heading, line) {
|
|
25
|
+
return `<!doctype html>
|
|
26
|
+
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
|
|
27
|
+
<title>Carrick</title>
|
|
28
|
+
<style>
|
|
29
|
+
body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#0b0d10;color:#e6e8eb;font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}
|
|
30
|
+
main{max-width:32rem;padding:2rem}
|
|
31
|
+
.brand{font-weight:600;letter-spacing:.02em;color:#9aa3ad;margin:0 0 1.5rem}
|
|
32
|
+
h1{font-size:1.5rem;font-weight:600;margin:0 0 .5rem}
|
|
33
|
+
p{margin:0;color:#b8c0c8}
|
|
34
|
+
code{font:.95em ui-monospace,SFMono-Regular,Menlo,monospace;color:#e6e8eb}
|
|
35
|
+
</style></head>
|
|
36
|
+
<body><main><p class="brand">carrick</p><h1>${escapeHtml(heading)}</h1><p>${escapeHtml(line).replace(/`([^`]+)`/g, "<code>$1</code>")}</p></main></body></html>
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
/** Send the page; resolves once it has been flushed or the browser went away. */
|
|
40
|
+
function answer(res, status, heading, line) {
|
|
41
|
+
if (res.writableEnded)
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
const done = new Promise((resolve) => {
|
|
44
|
+
res.once("finish", resolve);
|
|
45
|
+
res.once("close", resolve);
|
|
46
|
+
});
|
|
47
|
+
res.writeHead(status, { "Content-Type": "text/html; charset=utf-8" }).end(callbackPage(heading, line));
|
|
48
|
+
return done;
|
|
49
|
+
}
|
|
50
|
+
const TRY_AGAIN = "Run `carrick login` again.";
|
|
15
51
|
/** RFC 8252 loopback + S256 PKCE against Carrick's existing public OAuth client flow. */
|
|
16
52
|
export async function authorize(options = {}) {
|
|
17
53
|
const request = options.fetch ?? fetch;
|
|
@@ -22,15 +58,18 @@ export async function authorize(options = {}) {
|
|
|
22
58
|
let settle;
|
|
23
59
|
const received = new Promise((resolve) => { settle = resolve; });
|
|
24
60
|
let consumed = false;
|
|
61
|
+
// The browser that delivered the code waits on this response until the
|
|
62
|
+
// exchange has finished, so the page states the real outcome.
|
|
63
|
+
let pending = null;
|
|
64
|
+
let delivered = Promise.resolve();
|
|
25
65
|
const server = http.createServer((req, res) => {
|
|
26
66
|
res.setHeader("Cache-Control", "no-store");
|
|
27
|
-
res.setHeader("Content-Type", "text/plain; charset=utf-8");
|
|
28
67
|
let url;
|
|
29
68
|
try {
|
|
30
69
|
url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
31
70
|
}
|
|
32
71
|
catch {
|
|
33
|
-
res
|
|
72
|
+
answer(res, 400, "Sign-in failed", `This is not a valid sign-in link. ${TRY_AGAIN}`);
|
|
34
73
|
return;
|
|
35
74
|
}
|
|
36
75
|
const supplied = url.searchParams.get("state") ?? "";
|
|
@@ -38,22 +77,22 @@ export async function authorize(options = {}) {
|
|
|
38
77
|
url.searchParams.getAll("state").length !== 1 ||
|
|
39
78
|
Buffer.byteLength(supplied) !== Buffer.byteLength(state) ||
|
|
40
79
|
!timingSafeEqual(Buffer.from(supplied), Buffer.from(state))) {
|
|
41
|
-
res
|
|
80
|
+
answer(res, 400, "Sign-in failed", `This is not a valid sign-in link. ${TRY_AGAIN}`);
|
|
42
81
|
return;
|
|
43
82
|
}
|
|
44
83
|
if (url.searchParams.has("error")) {
|
|
45
84
|
consumed = true;
|
|
46
|
-
res
|
|
85
|
+
answer(res, 400, "Sign-in declined", `Carrick authorization was declined. ${TRY_AGAIN}`);
|
|
47
86
|
settle(new Error("Carrick authorization was declined. Run carrick login to try again."));
|
|
48
87
|
return;
|
|
49
88
|
}
|
|
50
89
|
const code = url.searchParams.get("code");
|
|
51
90
|
if (!code || url.searchParams.getAll("code").length !== 1) {
|
|
52
|
-
res
|
|
91
|
+
answer(res, 400, "Sign-in failed", `The sign-in link carried no authorization code. ${TRY_AGAIN}`);
|
|
53
92
|
return;
|
|
54
93
|
}
|
|
55
94
|
consumed = true;
|
|
56
|
-
|
|
95
|
+
pending = res;
|
|
57
96
|
settle(code);
|
|
58
97
|
});
|
|
59
98
|
server.requestTimeout = 10_000;
|
|
@@ -103,18 +142,33 @@ export async function authorize(options = {}) {
|
|
|
103
142
|
typeof body.token_type !== "string" || body.token_type.toLowerCase() !== "bearer" || body.scope !== SCOPE) {
|
|
104
143
|
throw new Error("Carrick returned an invalid OAuth token response.");
|
|
105
144
|
}
|
|
145
|
+
if (pending) {
|
|
146
|
+
// The workspace name is for the page only. A failed lookup must not
|
|
147
|
+
// lose an issued token: the caller saves it and reports the lookup.
|
|
148
|
+
// Bounded: a hung lookup must not hold the token back from the caller.
|
|
149
|
+
const lookup = AbortSignal.any([signal, AbortSignal.timeout(options.lookupTimeoutMs ?? 3_000)]);
|
|
150
|
+
const workspace = await resolveRepos(body.access_token, [], request, lookup).then((r) => r.workspace.slug, () => null);
|
|
151
|
+
delivered = answer(pending, 200, workspace ? `Signed in to ${workspace}` : "Signed in to Carrick", "You can close this tab. Next, run `carrick init` in the folder that holds your repos.");
|
|
152
|
+
}
|
|
106
153
|
return body.access_token;
|
|
107
154
|
}
|
|
108
155
|
catch (error) {
|
|
109
|
-
if (signal.aborted)
|
|
110
|
-
throw new Error("Carrick login was cancelled or timed out. Run carrick login to try again.");
|
|
111
156
|
// Never include a remote body, token, verifier or callback URL in an error.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
157
|
+
const failure = signal.aborted
|
|
158
|
+
? new Error("Carrick login was cancelled or timed out. Run carrick login to try again.")
|
|
159
|
+
: error instanceof Error && error.message.startsWith("Carrick")
|
|
160
|
+
? error
|
|
161
|
+
: new Error("Carrick login could not complete. Check the connection and loopback listener, then run carrick login.");
|
|
162
|
+
if (pending) {
|
|
163
|
+
const said = failure.message.replace(/ Run carrick login.*$/, "").replace(/, then run carrick login\.$/, ".");
|
|
164
|
+
delivered = answer(pending, 400, "Sign-in failed", `${said} ${TRY_AGAIN}`);
|
|
165
|
+
}
|
|
166
|
+
throw failure;
|
|
115
167
|
}
|
|
116
168
|
finally {
|
|
117
169
|
signal.removeEventListener("abort", cancel);
|
|
170
|
+
// Let the page finish writing before connections are torn down.
|
|
171
|
+
await delivered;
|
|
118
172
|
server.closeAllConnections();
|
|
119
173
|
if (server.listening)
|
|
120
174
|
await new Promise((resolve) => server.close(() => resolve()));
|
package/dist/auth/oauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../src/auth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","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
|
package/dist/init/connect.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type ResolvedRepos } from "../auth/read.ts";
|
|
2
2
|
import { type AssignOutcome } from "./projects.ts";
|
|
3
|
+
import type { StepProgress, StepReport } from "./output.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Show a status that updates in place while `work` runs, then its report.
|
|
6
|
+
*
|
|
7
|
+
* `InitOutput.step` in a run: a spinner on a terminal, one line per change on
|
|
8
|
+
* a pipe. The default is the pipe's behaviour, for a caller with no output.
|
|
9
|
+
*/
|
|
10
|
+
export type Track = <T>(label: string, work: (progress: StepProgress) => Promise<T>, report: (value: T) => StepReport) => Promise<T>;
|
|
3
11
|
type ConnectOptions = {
|
|
4
12
|
interactive: boolean;
|
|
5
13
|
say: (message: string) => void;
|
|
@@ -17,6 +25,12 @@ type ConnectOptions = {
|
|
|
17
25
|
* the grant finishing rather than a move out of a project anyone chose.
|
|
18
26
|
*/
|
|
19
27
|
movable?: Set<string>;
|
|
28
|
+
/**
|
|
29
|
+
* The movable repos whose move is said, lowercased: the ones in a project
|
|
30
|
+
* somebody chose. A repo the App grant has just put in the default project
|
|
31
|
+
* moves silently, because nobody chose where it was (carrick#1489).
|
|
32
|
+
*/
|
|
33
|
+
announce?: Set<string>;
|
|
20
34
|
/** How a project is printed: display name beside slug, where one is known. */
|
|
21
35
|
label?: (slug: string) => string;
|
|
22
36
|
open?: (url: string) => Promise<boolean>;
|
|
@@ -24,6 +38,8 @@ type ConnectOptions = {
|
|
|
24
38
|
/** Placing repos in the project, injected so tests state the server (carrick#999). */
|
|
25
39
|
assign?: (repos: string[], signal?: AbortSignal) => Promise<AssignOutcome>;
|
|
26
40
|
wait?: (signal: AbortSignal) => Promise<void>;
|
|
41
|
+
/** The live status line the wait is shown on (carrick#1489). */
|
|
42
|
+
track?: Track;
|
|
27
43
|
signal?: AbortSignal;
|
|
28
44
|
};
|
|
29
45
|
/**
|
|
@@ -35,6 +51,12 @@ type ConnectOptions = {
|
|
|
35
51
|
* the friction this says out loud (carrick#993).
|
|
36
52
|
*/
|
|
37
53
|
export declare const ADMIN_WAIT = "A workspace owner or admin must do this; Ctrl-C and run init again once they have.";
|
|
54
|
+
/** The dashboard pages init sends a reader to, for one workspace. */
|
|
55
|
+
export declare function workspaceUrls(slug: string): {
|
|
56
|
+
connect: string;
|
|
57
|
+
projects: string;
|
|
58
|
+
repos: string;
|
|
59
|
+
};
|
|
38
60
|
/** Every requested repo must be present, connected, and assigned to this project. */
|
|
39
61
|
export declare function reposAreInProject(identity: ResolvedRepos, repos: string[], project: string): boolean;
|
|
40
62
|
/**
|
|
@@ -45,15 +67,32 @@ export declare function reposAreInProject(identity: ResolvedRepos, repos: string
|
|
|
45
67
|
* in a project answers the question on its own (carrick#987).
|
|
46
68
|
*/
|
|
47
69
|
export declare function projectAssignments(identity: ResolvedRepos, repos: string[]): Array<string | null>;
|
|
70
|
+
/** The requested repos this read says are not connected, as the server spells them. */
|
|
71
|
+
export declare function unconnectedRepos(identity: ResolvedRepos, repos: string[]): string[];
|
|
72
|
+
/**
|
|
73
|
+
* The one line that sends a reader to the GitHub App, naming the repos it is
|
|
74
|
+
* for. Printed only for repos a read taken just now says are unconnected: the
|
|
75
|
+
* grant page re-asks GitHub for the whole repo list, which is wasted on a repo
|
|
76
|
+
* that is already connected (carrick#1489).
|
|
77
|
+
*/
|
|
78
|
+
export declare function connectLine(unconnected: string[], total: number, url: string): string;
|
|
48
79
|
/**
|
|
49
80
|
* The GitHub App grant is the only browser step; the CLI places the repos.
|
|
50
81
|
*
|
|
51
82
|
* Assignment is a server action on this credential (carrick#999), tried for
|
|
52
83
|
* every connected repo the moment the poll sees it, so nobody has to open the
|
|
53
|
-
* Repos page and move it by hand. An API that does not serve the action yet
|
|
54
|
-
*
|
|
55
|
-
* browser instruction this command printed before is what it falls back to.
|
|
84
|
+
* Repos page and move it by hand. An API that does not serve the action yet
|
|
85
|
+
* answers an absence, and the browser instruction is what it falls back to.
|
|
56
86
|
* Ctrl-C stops verification.
|
|
87
|
+
*
|
|
88
|
+
* What it prints is the state and the next step, not the traffic
|
|
89
|
+
* (carrick#1489): the wait is one status line that updates in place, a move
|
|
90
|
+
* the run was allowed to make is not announced (the first one out of an
|
|
91
|
+
* untouched default project is the App grant finishing, not a decision), and
|
|
92
|
+
* a repo gets a line of its own only when something about it failed.
|
|
93
|
+
*
|
|
94
|
+
* `initial` must be a read taken just before this call: it decides which
|
|
95
|
+
* repos are sent to the grant page and whether there is anything to wait for.
|
|
57
96
|
*/
|
|
58
97
|
export declare function connectRepos(token: string, repos: string[], initial: ResolvedRepos, options: ConnectOptions): Promise<ResolvedRepos>;
|
|
59
98
|
export {};
|