carrick 0.3.62 → 0.3.63
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 +24 -11
- package/bin/carrick.mjs +7 -6
- package/dist/auth/read.d.ts +6 -6
- package/dist/contract.d.ts +102 -0
- package/dist/contract.js +22 -0
- package/dist/contract.js.map +1 -1
- package/dist/init/connect.d.ts +23 -2
- package/dist/init/connect.js +140 -29
- package/dist/init/connect.js.map +1 -1
- package/dist/init/projects.d.ts +59 -0
- package/dist/init/projects.js +66 -3
- package/dist/init/projects.js.map +1 -1
- package/dist/init/repos.d.ts +33 -2
- package/dist/init/repos.js +95 -14
- package/dist/init/repos.js.map +1 -1
- package/dist/init/run.d.ts +29 -10
- package/dist/init/run.js +173 -45
- package/dist/init/run.js.map +1 -1
- package/dist/render.d.ts +20 -8
- package/dist/render.js +65 -16
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
package/dist/init/projects.d.ts
CHANGED
|
@@ -17,6 +17,31 @@ declare const project: z.ZodObject<{
|
|
|
17
17
|
}>;
|
|
18
18
|
/** One project in the signed-in workspace. */
|
|
19
19
|
export type Project = z.infer<typeof project>;
|
|
20
|
+
/** What one repo's assignment did, as the server reports it (carrick#999). */
|
|
21
|
+
declare const placement: z.ZodObject<{
|
|
22
|
+
full_name: z.ZodString;
|
|
23
|
+
/** This repo is in the project now, including one that already was. */
|
|
24
|
+
assigned: z.ZodBoolean;
|
|
25
|
+
/** Whether a write happened. False for a repo that was already there. */
|
|
26
|
+
moved: z.ZodBoolean;
|
|
27
|
+
project_slug: z.ZodNullable<z.ZodString>;
|
|
28
|
+
/** Why this repo was not placed, as a sentence completing its name. */
|
|
29
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
full_name: string;
|
|
32
|
+
project_slug: string | null;
|
|
33
|
+
assigned: boolean;
|
|
34
|
+
moved: boolean;
|
|
35
|
+
reason: string | null;
|
|
36
|
+
}, {
|
|
37
|
+
full_name: string;
|
|
38
|
+
project_slug: string | null;
|
|
39
|
+
assigned: boolean;
|
|
40
|
+
moved: boolean;
|
|
41
|
+
reason: string | null;
|
|
42
|
+
}>;
|
|
43
|
+
/** One repo's outcome inside a successful `assign-repos` answer. */
|
|
44
|
+
export type Placement = z.infer<typeof placement>;
|
|
20
45
|
/** What a create attempt did. `absent` is "this server has no such action". */
|
|
21
46
|
export type CreateOutcome = {
|
|
22
47
|
kind: "created";
|
|
@@ -27,6 +52,23 @@ export type CreateOutcome = {
|
|
|
27
52
|
} | {
|
|
28
53
|
kind: "absent";
|
|
29
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* What an assignment attempt did.
|
|
57
|
+
*
|
|
58
|
+
* `placed` is a 200: the action ran, and every repo in it carries its own
|
|
59
|
+
* outcome. A repo the workspace does not hold, or one whose write failed, is
|
|
60
|
+
* reported there rather than as a refusal, so a partial result is read rather
|
|
61
|
+
* than discarded.
|
|
62
|
+
*/
|
|
63
|
+
export type AssignOutcome = {
|
|
64
|
+
kind: "placed";
|
|
65
|
+
repos: Placement[];
|
|
66
|
+
} | {
|
|
67
|
+
kind: "refused";
|
|
68
|
+
message: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "absent";
|
|
71
|
+
};
|
|
30
72
|
/**
|
|
31
73
|
* Every project in the signed-in workspace, or null when this API has no such
|
|
32
74
|
* action. Throws only on 401.
|
|
@@ -41,8 +83,25 @@ export declare function listProjects(token: string, request?: typeof fetch, sign
|
|
|
41
83
|
* one it has to normalise silently into something the user did not ask for.
|
|
42
84
|
*/
|
|
43
85
|
export declare function createProject(token: string, slug: string, name?: string, request?: typeof fetch, signal?: AbortSignal): Promise<CreateOutcome>;
|
|
86
|
+
/**
|
|
87
|
+
* Put the named repos in the named project, where this API can do it.
|
|
88
|
+
*
|
|
89
|
+
* The second browser step this command used to end on: the GitHub App grant
|
|
90
|
+
* puts a newly connected repo in the workspace's default project, so a run
|
|
91
|
+
* started with `--project` sat waiting for someone to move it on the Repos
|
|
92
|
+
* page (carrick#999). The action is idempotent, which is what makes it safe
|
|
93
|
+
* to call from inside the polling loop as repos arrive from the grant.
|
|
94
|
+
*
|
|
95
|
+
* `absent` is the same wide condition the other two actions use: this client
|
|
96
|
+
* is published ahead of the deploy that serves the action, and until it lands
|
|
97
|
+
* the credential-kind gate answers first. The caller then prints the browser
|
|
98
|
+
* instruction it printed before.
|
|
99
|
+
*/
|
|
100
|
+
export declare function assignRepos(token: string, project: string, repos: string[], request?: typeof fetch, signal?: AbortSignal): Promise<AssignOutcome>;
|
|
44
101
|
/** The slug shape the dashboard enforces, applied before anything is sent. */
|
|
45
102
|
export declare const SLUG: RegExp;
|
|
103
|
+
/** What a project is, said once, above the picker that asks for one. */
|
|
104
|
+
export declare const PROJECT_RULE = "One project per interconnected system: repos that call each other belong together.";
|
|
46
105
|
/** What init asks the terminal during the project step. */
|
|
47
106
|
export type ProjectPrompts = {
|
|
48
107
|
say: (line: string) => void;
|
package/dist/init/projects.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
// Listing and
|
|
1
|
+
// Listing, creating and filling Carrick projects from the terminal
|
|
2
|
+
// (carrick#955, carrick#999).
|
|
2
3
|
//
|
|
3
4
|
// `carrick init --project <slug>` could only ever point at a browser: the
|
|
4
5
|
// workspace read (`resolve-repos`) returns the projects the named repos are
|
|
5
|
-
// already in, never the workspace's project list, and creation
|
|
6
|
-
// the dashboard. These
|
|
6
|
+
// already in, never the workspace's project list, and creation and assignment
|
|
7
|
+
// lived only in the dashboard. These three actions are the terminal half, and
|
|
8
|
+
// they leave the GitHub App grant as the only browser step.
|
|
7
9
|
//
|
|
8
10
|
// **The server may not have them.** They are a separate cloud change, so
|
|
9
11
|
// every call here is a probe: a workspace whose API does not answer them gets
|
|
@@ -36,6 +38,22 @@ const createResponse = z.object({
|
|
|
36
38
|
schema: z.literal("carrick.create-project/0"),
|
|
37
39
|
project,
|
|
38
40
|
});
|
|
41
|
+
/** What one repo's assignment did, as the server reports it (carrick#999). */
|
|
42
|
+
const placement = z.object({
|
|
43
|
+
full_name: z.string(),
|
|
44
|
+
/** This repo is in the project now, including one that already was. */
|
|
45
|
+
assigned: z.boolean(),
|
|
46
|
+
/** Whether a write happened. False for a repo that was already there. */
|
|
47
|
+
moved: z.boolean(),
|
|
48
|
+
project_slug: z.string().nullable(),
|
|
49
|
+
/** Why this repo was not placed, as a sentence completing its name. */
|
|
50
|
+
reason: z.string().nullable(),
|
|
51
|
+
});
|
|
52
|
+
const assignResponse = z.object({
|
|
53
|
+
schema: z.literal("carrick.assign-repos/0"),
|
|
54
|
+
project_slug: z.string(),
|
|
55
|
+
repos: z.array(placement),
|
|
56
|
+
});
|
|
39
57
|
const REJECTED = "Carrick rejected this credential. Run carrick login (unset CARRICK_TOKEN first if it overrides your login).";
|
|
40
58
|
async function post(token, body, request, signal) {
|
|
41
59
|
try {
|
|
@@ -120,8 +138,48 @@ export async function createProject(token, slug, name = slug, request = fetch, s
|
|
|
120
138
|
const parsed = createResponse.safeParse(payload);
|
|
121
139
|
return parsed.success ? { kind: "created", project: parsed.data.project } : { kind: "absent" };
|
|
122
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Put the named repos in the named project, where this API can do it.
|
|
143
|
+
*
|
|
144
|
+
* The second browser step this command used to end on: the GitHub App grant
|
|
145
|
+
* puts a newly connected repo in the workspace's default project, so a run
|
|
146
|
+
* started with `--project` sat waiting for someone to move it on the Repos
|
|
147
|
+
* page (carrick#999). The action is idempotent, which is what makes it safe
|
|
148
|
+
* to call from inside the polling loop as repos arrive from the grant.
|
|
149
|
+
*
|
|
150
|
+
* `absent` is the same wide condition the other two actions use: this client
|
|
151
|
+
* is published ahead of the deploy that serves the action, and until it lands
|
|
152
|
+
* the credential-kind gate answers first. The caller then prints the browser
|
|
153
|
+
* instruction it printed before.
|
|
154
|
+
*/
|
|
155
|
+
export async function assignRepos(token, project, repos, request = fetch, signal) {
|
|
156
|
+
const result = await post(token, { action: "assign-repos", project, repos }, request, signal);
|
|
157
|
+
if (!result)
|
|
158
|
+
return { kind: "absent" };
|
|
159
|
+
if (result.status === 401)
|
|
160
|
+
throw new Error(REJECTED);
|
|
161
|
+
if (!result.ok) {
|
|
162
|
+
const message = await refusal(result);
|
|
163
|
+
return message ? { kind: "refused", message } : { kind: "absent" };
|
|
164
|
+
}
|
|
165
|
+
let payload;
|
|
166
|
+
try {
|
|
167
|
+
payload = await result.json();
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return { kind: "absent" };
|
|
171
|
+
}
|
|
172
|
+
const parsed = assignResponse.safeParse(payload);
|
|
173
|
+
// The schema tag is the handshake, as it is for the list: an answer this
|
|
174
|
+
// client cannot read is the same situation as an API without the action.
|
|
175
|
+
return parsed.success && parsed.data.project_slug === project
|
|
176
|
+
? { kind: "placed", repos: parsed.data.repos }
|
|
177
|
+
: { kind: "absent" };
|
|
178
|
+
}
|
|
123
179
|
/** The slug shape the dashboard enforces, applied before anything is sent. */
|
|
124
180
|
export const SLUG = /^[a-z0-9](?:[a-z0-9]|-(?=[a-z0-9])){2,31}$/;
|
|
181
|
+
/** What a project is, said once, above the picker that asks for one. */
|
|
182
|
+
export const PROJECT_RULE = "One project per interconnected system: repos that call each other belong together.";
|
|
125
183
|
/**
|
|
126
184
|
* Make sure a named project exists, from the terminal where that is possible.
|
|
127
185
|
*
|
|
@@ -191,6 +249,11 @@ export async function projectStep(token, current, prompts) {
|
|
|
191
249
|
const projects = await list(token);
|
|
192
250
|
if (projects === null)
|
|
193
251
|
return { slug: null, exists: false };
|
|
252
|
+
// The one thing someone picking a project has to know, said where the
|
|
253
|
+
// question is asked: a project is the boundary every cross-service answer
|
|
254
|
+
// is computed inside, so repos split across two of them see nothing of each
|
|
255
|
+
// other (carrick#993).
|
|
256
|
+
prompts.say(PROJECT_RULE);
|
|
194
257
|
prompts.say(projects.length === 0 ? "This workspace has no projects yet." : "Projects in this workspace:");
|
|
195
258
|
for (const line of projectLines(projects))
|
|
196
259
|
prompts.say(line);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/init/projects.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/init/projects.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,8BAA8B;AAC9B,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,4DAA4D;AAC5D,EAAE;AACF,yEAAyE;AACzE,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,0EAA0E;AAC1E,8EAA8E;AAC9E,0EAA0E;AAC1E,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,wEAAwE;AACxE,iDAAiD;AAEjD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAKH,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,yBAAyB,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,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AC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;QACrC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CACnD,CAAC;IACF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,MAAM,KAAK,GACT,KAAK,CAAC,UAAU,KAAK,IAAI;YACvB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,KAAK,KAAK,CAAC,UAAU,QAAQ,KAAK,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;QACvE,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;QACjE,OAAO,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/init/repos.d.ts
CHANGED
|
@@ -131,6 +131,37 @@ export declare const PROPOSAL_FILE: string;
|
|
|
131
131
|
* config from a workspace that has since changed.
|
|
132
132
|
*/
|
|
133
133
|
export declare function writeProposal(workspace: string, derived: DerivedWorkspace): string;
|
|
134
|
-
/**
|
|
135
|
-
|
|
134
|
+
/**
|
|
135
|
+
* What one repository on disk says it is on GitHub, and why it said nothing.
|
|
136
|
+
*
|
|
137
|
+
* `problem` is a clause, so a caller can put it after the path it read: it is
|
|
138
|
+
* printed for every repo that contributes no identity, because a repo silently
|
|
139
|
+
* left out of the project and connection steps looked like a complete run
|
|
140
|
+
* (carrick#991).
|
|
141
|
+
*/
|
|
142
|
+
export type RepoIdentity = {
|
|
143
|
+
path: string;
|
|
144
|
+
/** `owner/repo`, or null when this repo names no GitHub repository. */
|
|
145
|
+
name: string | null;
|
|
146
|
+
/** The origin remote as written, for the line that says what was read. */
|
|
147
|
+
remote: string | null;
|
|
148
|
+
problem: string | null;
|
|
149
|
+
};
|
|
150
|
+
/** The two machine reads, injected so tests never spawn anything. */
|
|
151
|
+
export type IdentityProbe = {
|
|
152
|
+
/** `git remote get-url origin`, or null when there is no origin. */
|
|
153
|
+
remote: (repo: string) => string | null;
|
|
154
|
+
/** The `hostname` ssh resolves a host to, or null when ssh cannot say. */
|
|
155
|
+
sshHostname: (host: string) => string | null;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Only GitHub origin identities are sent to the workspace metadata read.
|
|
159
|
+
*
|
|
160
|
+
* A host that is already github.com is taken without spawning anything; an ssh
|
|
161
|
+
* host that is not is resolved through the user's ssh configuration, because a
|
|
162
|
+
* machine with two GitHub accounts writes its remotes through a per-account
|
|
163
|
+
* alias and that repository is an ordinary GitHub repository (carrick#991,
|
|
164
|
+
* carrick#978).
|
|
165
|
+
*/
|
|
166
|
+
export declare function repoIdentity(repo: string, probe?: IdentityProbe): RepoIdentity;
|
|
136
167
|
export {};
|
package/dist/init/repos.js
CHANGED
|
@@ -61,24 +61,105 @@ export function writeProposal(workspace, derived) {
|
|
|
61
61
|
fs.writeFileSync(path.join(workspace, PROPOSAL_FILE), document);
|
|
62
62
|
return PROPOSAL_FILE;
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
export function githubRemote(repo) {
|
|
64
|
+
function gitOrigin(repo) {
|
|
66
65
|
const result = spawnSync("git", ["-C", repo, "remote", "get-url", "origin"], { encoding: "utf8", timeout: 5000 });
|
|
67
|
-
|
|
66
|
+
return result.status === 0 ? result.stdout.trim() : null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The host ssh itself would dial, which for a per-account alias
|
|
70
|
+
* (`Host github.com-work` / `HostName github.com`) is not the host in the
|
|
71
|
+
* remote. `ssh -G` prints the whole resolved configuration and connects to
|
|
72
|
+
* nothing, so this reads the user's own `~/.ssh/config` without a list of
|
|
73
|
+
* alias spellings. An alias no config entry matches is not an error: ssh
|
|
74
|
+
* exits 0 and echoes the name back, which is why an unresolvable alias is
|
|
75
|
+
* detected by the hostname it returns rather than by a status.
|
|
76
|
+
*/
|
|
77
|
+
function sshHostname(host) {
|
|
78
|
+
// Never spawn on a string that could be read as an option, and never on one
|
|
79
|
+
// ssh would reject anyway.
|
|
80
|
+
if (!/^[A-Za-z0-9._-]+$/.test(host) || host.startsWith("-"))
|
|
68
81
|
return null;
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
const result = spawnSync("ssh", ["-G", host], {
|
|
83
|
+
encoding: "utf8",
|
|
84
|
+
timeout: 5000,
|
|
85
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
86
|
+
});
|
|
87
|
+
if (result.error || result.status !== 0 || typeof result.stdout !== "string")
|
|
88
|
+
return null;
|
|
89
|
+
const line = /^hostname (\S+)$/im.exec(result.stdout);
|
|
90
|
+
return line ? line[1] : null;
|
|
91
|
+
}
|
|
92
|
+
const DEFAULT_PROBE = { remote: gitOrigin, sshHostname };
|
|
93
|
+
/** The host and `owner/repo` a remote names, in either spelling git accepts. */
|
|
94
|
+
function splitRemote(remote) {
|
|
95
|
+
let host;
|
|
96
|
+
let repoPath;
|
|
97
|
+
let ssh;
|
|
98
|
+
// The two spellings are told apart by the `//`, not by whether `new URL`
|
|
99
|
+
// throws: a host alias with no user (`host-work:owner/repo`) parses as a URL
|
|
100
|
+
// whose scheme is the host, and would otherwise be read as neither form.
|
|
101
|
+
if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(remote)) {
|
|
102
|
+
let url;
|
|
103
|
+
try {
|
|
104
|
+
url = new URL(remote);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
76
107
|
return null;
|
|
77
|
-
|
|
78
|
-
|
|
108
|
+
}
|
|
109
|
+
if (!["https:", "http:", "ssh:"].includes(url.protocol))
|
|
110
|
+
return null;
|
|
111
|
+
host = url.hostname;
|
|
112
|
+
repoPath = url.pathname;
|
|
113
|
+
ssh = url.protocol === "ssh:";
|
|
79
114
|
}
|
|
80
|
-
|
|
81
|
-
|
|
115
|
+
else {
|
|
116
|
+
// The scp spelling `[user@]host:owner/repo`, which is not a URL.
|
|
117
|
+
const scp = /^(?:[^@\s/]+@)?([^:/\s]+):(\S+)$/.exec(remote);
|
|
118
|
+
if (!scp)
|
|
119
|
+
return null;
|
|
120
|
+
host = scp[1];
|
|
121
|
+
repoPath = scp[2];
|
|
122
|
+
ssh = true;
|
|
123
|
+
}
|
|
124
|
+
const name = repoPath.replace(/^\/+/, "").replace(/\.git$/, "");
|
|
125
|
+
return { host, name: /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(name) ? name : null, ssh };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Only GitHub origin identities are sent to the workspace metadata read.
|
|
129
|
+
*
|
|
130
|
+
* A host that is already github.com is taken without spawning anything; an ssh
|
|
131
|
+
* host that is not is resolved through the user's ssh configuration, because a
|
|
132
|
+
* machine with two GitHub accounts writes its remotes through a per-account
|
|
133
|
+
* alias and that repository is an ordinary GitHub repository (carrick#991,
|
|
134
|
+
* carrick#978).
|
|
135
|
+
*/
|
|
136
|
+
export function repoIdentity(repo, probe = DEFAULT_PROBE) {
|
|
137
|
+
const remote = probe.remote(repo);
|
|
138
|
+
if (remote === null)
|
|
139
|
+
return { path: repo, name: null, remote: null, problem: "it has no origin remote" };
|
|
140
|
+
const parts = splitRemote(remote);
|
|
141
|
+
if (!parts)
|
|
142
|
+
return { path: repo, name: null, remote, problem: `its origin ${remote} is not a GitHub URL` };
|
|
143
|
+
const { host, name, ssh } = parts;
|
|
144
|
+
if (name === null) {
|
|
145
|
+
return { path: repo, name: null, remote, problem: `its origin ${remote} names no owner/repo path` };
|
|
146
|
+
}
|
|
147
|
+
if (host.toLowerCase() === "github.com")
|
|
148
|
+
return { path: repo, name, remote, problem: null };
|
|
149
|
+
if (!ssh) {
|
|
150
|
+
return { path: repo, name: null, remote, problem: `its origin ${remote} is on ${host}, not github.com` };
|
|
151
|
+
}
|
|
152
|
+
const resolved = probe.sshHostname(host);
|
|
153
|
+
if (resolved === null) {
|
|
154
|
+
return { path: repo, name: null, remote, problem: `its origin ${remote} names the host "${host}", which ssh could not resolve` };
|
|
82
155
|
}
|
|
156
|
+
if (resolved.toLowerCase() === "github.com")
|
|
157
|
+
return { path: repo, name, remote, problem: null };
|
|
158
|
+
return {
|
|
159
|
+
path: repo,
|
|
160
|
+
name: null,
|
|
161
|
+
remote,
|
|
162
|
+
problem: `its origin ${remote} names the host "${host}", which ssh resolves to "${resolved}", not github.com`,
|
|
163
|
+
};
|
|
83
164
|
}
|
|
84
165
|
//# sourceMappingURL=repos.js.map
|
package/dist/init/repos.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repos.js","sourceRoot":"","sources":["../../src/init/repos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAE9D,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE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;IAC5F,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,MAAM,UAAU,IAAI,kBAAkB,EAAE,CAAC;IAC3G,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,MAAM,oBAAoB,IAAI,gCAAgC,EAAE,CAAC;IACnI,CAAC;IACD,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,YAAY;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChG,OAAO;QACL,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,MAAM;QACN,OAAO,EAAE,cAAc,MAAM,oBAAoB,IAAI,6BAA6B,QAAQ,mBAAmB;KAC9G,CAAC;AACJ,CAAC"}
|
package/dist/init/run.d.ts
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
|
+
import { type ResolvedRepos } from "../auth/read.ts";
|
|
1
2
|
/**
|
|
2
3
|
* The prompt that makes an agent write this repo's config and setup files.
|
|
3
4
|
*
|
|
4
|
-
* A copy
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
5
|
+
* A copy of the `scaffold` MCP tool's own instructions and the dashboard copy
|
|
6
|
+
* beside them (carrick-cloud#800), whose test checks every filename against
|
|
7
|
+
* what the tool returns. It is printed here so the terminal path ends where
|
|
8
|
+
* the dashboard path ends, and it states the sequence the ruling in
|
|
9
|
+
* carrick-cloud#799 fixed: the agent writes a complete `carrick.json` from the
|
|
10
|
+
* proposal this command derived, `carrick index` proves it for nothing, and
|
|
11
|
+
* only then does the one paid scan run. Keep the two copies in step; the
|
|
12
|
+
* tool's instructions, not this text, decide what gets written.
|
|
13
|
+
*
|
|
14
|
+
* One clause is this side's alone, because only this side knows it: whether
|
|
15
|
+
* the workspace read found a hosted index for these repos. Where there is one,
|
|
16
|
+
* the paid scan has already run in CI and a laptop scan from a branch would
|
|
17
|
+
* replace that row for everyone in the workspace, so the agent is told not to
|
|
18
|
+
* run it (carrick#993, cloud half carrick-cloud#805).
|
|
13
19
|
*/
|
|
14
|
-
export declare
|
|
20
|
+
export declare function agentScaffoldPrompt(hosted: boolean): string;
|
|
15
21
|
export type InitOptions = {
|
|
16
22
|
workspace: string;
|
|
17
23
|
/** Require every proposed GitHub repo to belong to this project. */
|
|
18
24
|
project: string | null;
|
|
25
|
+
/** The `owner/repo` to use when the origin remote names none (carrick#991). */
|
|
26
|
+
repo: string | null;
|
|
19
27
|
/** Answer yes to the repo list rather than asking. */
|
|
20
28
|
assumeYes: boolean;
|
|
21
29
|
};
|
|
22
30
|
export declare function parseArgs(argv: string[], cwd?: string): InitOptions | string;
|
|
31
|
+
/**
|
|
32
|
+
* The repos a project holds that this folder does not, one line per project.
|
|
33
|
+
*
|
|
34
|
+
* Carrick answers across every repo in a project, so a machine holding half of
|
|
35
|
+
* one gets half the answers, and the connection lines above name only what is
|
|
36
|
+
* here. `project_repos` is the workspace read's answer to that: the whole
|
|
37
|
+
* membership of every project the requested repos are in (carrick#993 row 18).
|
|
38
|
+
* Capped and counted like the identity lines, because a project can hold two
|
|
39
|
+
* hundred.
|
|
40
|
+
*/
|
|
41
|
+
export declare function absentRepos(identity: ResolvedRepos, names: string[], project: string | null): string[];
|
|
23
42
|
/**
|
|
24
43
|
* The editor lines, one line per editor that is on the machine.
|
|
25
44
|
*
|