carrick 0.3.66 → 0.3.68
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 +51 -0
- package/bin/carrick.mjs +17 -1
- package/dist/cli.d.ts +20 -2
- package/dist/cli.js +24 -2
- package/dist/cli.js.map +1 -1
- package/dist/contract.d.ts +41 -1
- package/dist/contract.js +4 -0
- package/dist/contract.js.map +1 -1
- package/dist/diagnostics.js +21 -2
- package/dist/diagnostics.js.map +1 -1
- package/dist/hook/post-edit.js +5 -1
- package/dist/hook/post-edit.js.map +1 -1
- package/dist/init/doctor.d.ts +143 -0
- package/dist/init/doctor.js +669 -0
- package/dist/init/doctor.js.map +1 -0
- package/dist/init/hosted.d.ts +5 -4
- package/dist/init/hosted.js +8 -0
- package/dist/init/hosted.js.map +1 -1
- package/dist/init/mcp.d.ts +58 -0
- package/dist/init/mcp.js +221 -0
- package/dist/init/mcp.js.map +1 -1
- package/dist/init/output.d.ts +31 -4
- package/dist/init/output.js +55 -16
- package/dist/init/output.js.map +1 -1
- package/dist/init/remove.d.ts +38 -0
- package/dist/init/remove.js +248 -0
- package/dist/init/remove.js.map +1 -0
- package/dist/init/repos.d.ts +12 -0
- package/dist/init/repos.js +31 -2
- package/dist/init/repos.js.map +1 -1
- package/dist/init/run.js +8 -5
- package/dist/init/run.js.map +1 -1
- package/dist/init/settings.d.ts +48 -0
- package/dist/init/settings.js +110 -0
- package/dist/init/settings.js.map +1 -1
- package/dist/render.d.ts +24 -0
- package/dist/render.js +80 -1
- package/dist/render.js.map +1 -1
- package/package.json +6 -6
package/dist/init/output.js
CHANGED
|
@@ -26,6 +26,14 @@
|
|
|
26
26
|
// A spinner writes and rewrites one line, so anything else printing while it
|
|
27
27
|
// spins corrupts it: `step()` owns the terminal for the duration of the work
|
|
28
28
|
// it wraps, and the hosted read is quiet underneath it (see `hosted.ts`).
|
|
29
|
+
//
|
|
30
|
+
// A step also OWNS the line its work is reported on. `spinner.stop(text)` in
|
|
31
|
+
// 1.8.1 takes no status code, so a step that stopped with its own label and
|
|
32
|
+
// left the caller to print the outcome spent two lines on the one thing, and a
|
|
33
|
+
// step that stopped with the outcome printed a warning under a done marker.
|
|
34
|
+
// The spinner's three finishers carry the three markers exactly — `stop` is
|
|
35
|
+
// `◇`, `error` is `▲`, `cancel` is `■` — so the work's report goes to `step`
|
|
36
|
+
// and the spinner stops as whatever the work turned out to be (carrick#1032).
|
|
29
37
|
import readline from "node:readline/promises";
|
|
30
38
|
import * as clack from "@clack/prompts";
|
|
31
39
|
import pc from "picocolors";
|
|
@@ -39,6 +47,7 @@ export function plainOutput(write = (text) => process.stdout.write(text)) {
|
|
|
39
47
|
for (const entry of text.split("\n"))
|
|
40
48
|
write(`${marker} ${entry}\n`);
|
|
41
49
|
};
|
|
50
|
+
const marker = (kind) => kind === "done" ? DONE : kind === "warn" ? WARN : REFUSE;
|
|
42
51
|
return {
|
|
43
52
|
done: (text) => line(DONE, text),
|
|
44
53
|
warn: (text) => line(WARN, text),
|
|
@@ -51,7 +60,15 @@ export function plainOutput(write = (text) => process.stdout.write(text)) {
|
|
|
51
60
|
write(` ${entry}\n`);
|
|
52
61
|
write("\n");
|
|
53
62
|
},
|
|
54
|
-
|
|
63
|
+
// No spinner here, so the label was never printed: the step is exactly the
|
|
64
|
+
// one line its work reports, which is what the plain rendering already
|
|
65
|
+
// spent on it.
|
|
66
|
+
step: async (_label, work, report) => {
|
|
67
|
+
const value = await work();
|
|
68
|
+
const outcome = report(value);
|
|
69
|
+
line(marker(outcome.kind), outcome.text);
|
|
70
|
+
return value;
|
|
71
|
+
},
|
|
55
72
|
// No colour, ever. picocolors turns itself ON when `CI` is set, which is
|
|
56
73
|
// exactly the run whose output is captured as text, so the decision is made
|
|
57
74
|
// here from the terminal rather than by the library from the environment.
|
|
@@ -81,35 +98,57 @@ export function plainOutput(write = (text) => process.stdout.write(text)) {
|
|
|
81
98
|
quiet: false,
|
|
82
99
|
};
|
|
83
100
|
}
|
|
84
|
-
/**
|
|
85
|
-
|
|
101
|
+
/**
|
|
102
|
+
* clack's rendering, for a terminal.
|
|
103
|
+
*
|
|
104
|
+
* `output` is where the rendering goes. It is threaded into every clack call
|
|
105
|
+
* rather than left to the library's default because that is the only way this
|
|
106
|
+
* rendering can be read back: a terminal's own bytes are not capturable, and
|
|
107
|
+
* the plain one — which every executable test spawns — is a different renderer
|
|
108
|
+
* with different lines. A test that hands this a stream is the only thing that
|
|
109
|
+
* sees the interactive markers at all (carrick#1032).
|
|
110
|
+
*/
|
|
111
|
+
export function interactiveOutput(output = process.stdout) {
|
|
86
112
|
return {
|
|
87
|
-
done: (text) => clack.log.step(text),
|
|
88
|
-
warn: (text) => clack.log.warn(text),
|
|
89
|
-
refuse: (text) => clack.log.error(text),
|
|
90
|
-
say: (text) => clack.log.message(text),
|
|
91
|
-
note: (title, body) => clack.note(body.join("\n"), title),
|
|
92
|
-
|
|
93
|
-
|
|
113
|
+
done: (text) => clack.log.step(text, { output }),
|
|
114
|
+
warn: (text) => clack.log.warn(text, { output }),
|
|
115
|
+
refuse: (text) => clack.log.error(text, { output }),
|
|
116
|
+
say: (text) => clack.log.message(text, { output }),
|
|
117
|
+
note: (title, body) => clack.note(body.join("\n"), title, { output }),
|
|
118
|
+
// The spinner's finishers ARE the markers: `stop` prints `◇`, `error`
|
|
119
|
+
// prints `▲` and `cancel` prints `■`, so the step ends on one line with
|
|
120
|
+
// the marker its work earned. Stopping with the label instead cost the
|
|
121
|
+
// hosted read two lines, and stopping with the outcome text alone put
|
|
122
|
+
// warnings and refusals under a done marker (carrick#1032).
|
|
123
|
+
step: async (label, work, report) => {
|
|
124
|
+
const spinner = clack.spinner({ output });
|
|
94
125
|
spinner.start(label);
|
|
126
|
+
let value;
|
|
95
127
|
try {
|
|
96
|
-
|
|
97
|
-
spinner.stop(label);
|
|
98
|
-
return value;
|
|
128
|
+
value = await work();
|
|
99
129
|
}
|
|
100
130
|
catch (error) {
|
|
101
|
-
|
|
131
|
+
// The step did not finish, so it is a refusal: the caller prints why.
|
|
132
|
+
spinner.cancel(label);
|
|
102
133
|
throw error;
|
|
103
134
|
}
|
|
135
|
+
const outcome = report(value);
|
|
136
|
+
if (outcome.kind === "done")
|
|
137
|
+
spinner.stop(outcome.text);
|
|
138
|
+
else if (outcome.kind === "warn")
|
|
139
|
+
spinner.error(outcome.text);
|
|
140
|
+
else
|
|
141
|
+
spinner.cancel(outcome.text);
|
|
142
|
+
return value;
|
|
104
143
|
},
|
|
105
144
|
// A cancelled prompt is a no: `init` returns 0 and writes nothing, which
|
|
106
145
|
// is what answering "n" has always done.
|
|
107
146
|
confirm: async (question) => {
|
|
108
|
-
const answer = await clack.confirm({ message: question, initialValue: true });
|
|
147
|
+
const answer = await clack.confirm({ message: question, initialValue: true, output });
|
|
109
148
|
return clack.isCancel(answer) ? false : answer;
|
|
110
149
|
},
|
|
111
150
|
ask: async (question) => {
|
|
112
|
-
const answer = await clack.text({ message: question });
|
|
151
|
+
const answer = await clack.text({ message: question, output });
|
|
113
152
|
return clack.isCancel(answer) ? "" : answer.trim();
|
|
114
153
|
},
|
|
115
154
|
accent: (text) => pc.dim(text),
|
package/dist/init/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/init/output.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,4DAA4D;AAC5D,4EAA4E;AAC5E,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,mCAAmC;AACnC,0EAA0E;AAC1E,iDAAiD;AACjD,EAAE;AACF,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,+EAA+E;AAC/E,oEAAoE;AACpE,6EAA6E;AAC7E,6EAA6E;AAC7E,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,0EAA0E;
|
|
1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type InitOutput } from "./output.ts";
|
|
3
|
+
export type RemoveOptions = {
|
|
4
|
+
workspace: string;
|
|
5
|
+
/** Leave the saved credential in place: this machine stays signed in. */
|
|
6
|
+
keepLogin: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseArgs(argv: string[], cwd?: string): RemoveOptions | string;
|
|
9
|
+
/** The settings files a workspace can hold our hook entries in. */
|
|
10
|
+
export declare const SETTINGS_FILES: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The files the scaffold pull request adds to a repository.
|
|
13
|
+
*
|
|
14
|
+
* The list is the scaffold tool's own (`carrick-cloud`
|
|
15
|
+
* `lambdas/mcp-server/src/tools/scaffold.ts`): the workflow, the agent skill,
|
|
16
|
+
* the three hook-pack scripts and the config. Only the ones that exist are
|
|
17
|
+
* printed, so the `git rm` line is one a reader can paste.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SCAFFOLD_FILES: string[];
|
|
20
|
+
export type RepoLeftovers = {
|
|
21
|
+
/** Whole files, relative to the workspace, for one `git rm`. */
|
|
22
|
+
files: string[];
|
|
23
|
+
/** What has to be edited by hand, one line each. */
|
|
24
|
+
sections: string[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Everything the scaffold left in the repositories under this workspace.
|
|
28
|
+
*
|
|
29
|
+
* The repositories are `repoRoots`', which `carrick doctor` reads too. Nothing
|
|
30
|
+
* here is opened unless it exists, and nothing here is changed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function repoLeftovers(workspace: string): RepoLeftovers;
|
|
33
|
+
/** One `◇` line per client this run changed, and a warning for what it could not. */
|
|
34
|
+
export declare function mcpRemovalLines(removals: McpRemoval[]): {
|
|
35
|
+
done: string[];
|
|
36
|
+
warn: string[];
|
|
37
|
+
};
|
|
38
|
+
export declare function remove(argv: string[], out?: InitOutput): Promise<number>;
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Undoing `carrick init`, on this machine.
|
|
2
|
+
//
|
|
3
|
+
// An install that can state its own undo is the courtesy that makes people
|
|
4
|
+
// willing to try it (carrick#1034), and init now writes in six places: the
|
|
5
|
+
// hook entries in a workspace's `.claude` settings, an MCP server entry in
|
|
6
|
+
// each agent client's own configuration, the `.carrick` directory, and the
|
|
7
|
+
// credential in the user's configuration directory.
|
|
8
|
+
//
|
|
9
|
+
// Every step here is the inverse of a writer in this folder, and each pair
|
|
10
|
+
// lives in one file so the two cannot drift: `mergeCarrickHooks` /
|
|
11
|
+
// `removeCarrickHooks` in `settings.ts`, `mergeServerEntry` /
|
|
12
|
+
// `removeServerEntry` and `connectMcpClients` / `disconnectMcpClients` in
|
|
13
|
+
// `mcp.ts`, `writeProposal` / the `.carrick` removal below, `saveCredential` /
|
|
14
|
+
// `removeCredential` in `../auth/credentials.ts`.
|
|
15
|
+
//
|
|
16
|
+
// What it does NOT do is edit a tracked file. The scaffold pull request put
|
|
17
|
+
// files in the repository and a repository is version controlled: those are
|
|
18
|
+
// listed with the `git rm` line that removes them, and the sections that were
|
|
19
|
+
// merged into files someone else owns are named for a human to delete. A
|
|
20
|
+
// command that rewrote a committed workflow or an AGENTS.md would be
|
|
21
|
+
// destroying work this command cannot read.
|
|
22
|
+
//
|
|
23
|
+
// It runs no scan and never asks for the scanner binary: everything it touches
|
|
24
|
+
// is a file this package wrote.
|
|
25
|
+
import fs from "node:fs";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import { removeCredential, credentialPath } from "../auth/credentials.js";
|
|
28
|
+
import { disconnectMcpClients } from "./mcp.js";
|
|
29
|
+
import { repoRoots } from "./repos.js";
|
|
30
|
+
import { removeCarrickHooks } from "./settings.js";
|
|
31
|
+
import { createOutput, DOCS } from "./output.js";
|
|
32
|
+
export function parseArgs(argv, cwd = process.cwd()) {
|
|
33
|
+
const options = { workspace: cwd, keepLogin: false };
|
|
34
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
35
|
+
const argument = argv[index];
|
|
36
|
+
switch (argument) {
|
|
37
|
+
case "--keep-login":
|
|
38
|
+
options.keepLogin = true;
|
|
39
|
+
break;
|
|
40
|
+
case "--workspace":
|
|
41
|
+
case "-w": {
|
|
42
|
+
const value = argv[index + 1];
|
|
43
|
+
if (!value)
|
|
44
|
+
return "--workspace needs a directory";
|
|
45
|
+
options.workspace = path.resolve(cwd, value);
|
|
46
|
+
index += 1;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case "--help":
|
|
50
|
+
case "-h":
|
|
51
|
+
return help();
|
|
52
|
+
default:
|
|
53
|
+
if (argument?.startsWith("-"))
|
|
54
|
+
return `unknown option for \`carrick remove\`: ${argument}`;
|
|
55
|
+
options.workspace = path.resolve(cwd, argument ?? ".");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return options;
|
|
59
|
+
}
|
|
60
|
+
function help() {
|
|
61
|
+
return [
|
|
62
|
+
"carrick remove [DIRECTORY] [--keep-login]",
|
|
63
|
+
"",
|
|
64
|
+
"Undo what carrick init wrote on this machine: the Carrick hook entries in",
|
|
65
|
+
"this folder's .claude settings, the carrick MCP server in each agent",
|
|
66
|
+
"client's configuration, the .carrick directory, and the saved credential.",
|
|
67
|
+
"Other hooks, other MCP servers and the settings files themselves are left",
|
|
68
|
+
"as they are. Files the scaffold added to the repository are listed with the",
|
|
69
|
+
"git rm line that removes them; this command never edits a tracked file.",
|
|
70
|
+
"",
|
|
71
|
+
" -w, --workspace DIR The folder init was run in (default: this one)",
|
|
72
|
+
" --keep-login Leave the saved credential; remove everything else",
|
|
73
|
+
"",
|
|
74
|
+
`What each of those things is, and what it does: ${DOCS}`,
|
|
75
|
+
].join("\n");
|
|
76
|
+
}
|
|
77
|
+
/** The settings files a workspace can hold our hook entries in. */
|
|
78
|
+
export const SETTINGS_FILES = [
|
|
79
|
+
path.join(".claude", "settings.json"),
|
|
80
|
+
path.join(".claude", "settings.local.json"),
|
|
81
|
+
];
|
|
82
|
+
/**
|
|
83
|
+
* The files the scaffold pull request adds to a repository.
|
|
84
|
+
*
|
|
85
|
+
* The list is the scaffold tool's own (`carrick-cloud`
|
|
86
|
+
* `lambdas/mcp-server/src/tools/scaffold.ts`): the workflow, the agent skill,
|
|
87
|
+
* the three hook-pack scripts and the config. Only the ones that exist are
|
|
88
|
+
* printed, so the `git rm` line is one a reader can paste.
|
|
89
|
+
*/
|
|
90
|
+
export const SCAFFOLD_FILES = [
|
|
91
|
+
path.join(".github", "workflows", "carrick.yml"),
|
|
92
|
+
path.join(".claude", "skills", "carrick", "SKILL.md"),
|
|
93
|
+
path.join(".claude", "session-start.sh"),
|
|
94
|
+
path.join(".claude", "turn-reminder.sh"),
|
|
95
|
+
path.join(".claude", "search-gate.sh"),
|
|
96
|
+
"carrick.json",
|
|
97
|
+
];
|
|
98
|
+
/** The files the scaffold merged INTO, which only their owner can unpick. */
|
|
99
|
+
const SECTION_CARRIERS = [
|
|
100
|
+
{ file: "AGENTS.md", holds: (body) => /^##\s+Carrick\s*$/m.test(body), what: 'the "## Carrick" section' },
|
|
101
|
+
{ file: "CLAUDE.md", holds: (body) => /^##\s+Carrick\s*$/m.test(body), what: 'the "## Carrick" section' },
|
|
102
|
+
{
|
|
103
|
+
file: path.join(".claude", "settings.json"),
|
|
104
|
+
holds: (body) => body.includes("$CLAUDE_PROJECT_DIR/.claude/"),
|
|
105
|
+
what: "the hook-pack entries the scaffold merged in",
|
|
106
|
+
},
|
|
107
|
+
{ file: ".gitignore", holds: (body) => body.includes("!.claude/"), what: "the .claude negations" },
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* Everything the scaffold left in the repositories under this workspace.
|
|
111
|
+
*
|
|
112
|
+
* The repositories are `repoRoots`', which `carrick doctor` reads too. Nothing
|
|
113
|
+
* here is opened unless it exists, and nothing here is changed.
|
|
114
|
+
*/
|
|
115
|
+
export function repoLeftovers(workspace) {
|
|
116
|
+
const roots = repoRoots(workspace);
|
|
117
|
+
const files = [];
|
|
118
|
+
const sections = [];
|
|
119
|
+
for (const root of roots) {
|
|
120
|
+
for (const relative of SCAFFOLD_FILES) {
|
|
121
|
+
const target = path.join(root, relative);
|
|
122
|
+
if (fs.existsSync(target))
|
|
123
|
+
files.push(path.relative(workspace, target) || relative);
|
|
124
|
+
}
|
|
125
|
+
for (const carrier of SECTION_CARRIERS) {
|
|
126
|
+
const target = path.join(root, carrier.file);
|
|
127
|
+
let body;
|
|
128
|
+
try {
|
|
129
|
+
body = fs.readFileSync(target, "utf8");
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (!carrier.holds(body))
|
|
135
|
+
continue;
|
|
136
|
+
sections.push(`${path.relative(workspace, target) || carrier.file}: ${carrier.what}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { files, sections };
|
|
140
|
+
}
|
|
141
|
+
/** One `◇` line per client this run changed, and a warning for what it could not. */
|
|
142
|
+
export function mcpRemovalLines(removals) {
|
|
143
|
+
const done = [];
|
|
144
|
+
const warn = [];
|
|
145
|
+
for (const removal of removals) {
|
|
146
|
+
if (removal.state === "removed") {
|
|
147
|
+
done.push(removal.client === "Claude Code"
|
|
148
|
+
? `MCP server removed for ${removal.client}`
|
|
149
|
+
: `MCP server removed for ${removal.client}: ${removal.detail}`);
|
|
150
|
+
}
|
|
151
|
+
else if (removal.state === "kept") {
|
|
152
|
+
warn.push(`${removal.client}: ${removal.detail}`);
|
|
153
|
+
}
|
|
154
|
+
else if (removal.state === "failed") {
|
|
155
|
+
warn.push(`MCP server not removed for ${removal.client}: ${removal.detail}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return { done, warn };
|
|
159
|
+
}
|
|
160
|
+
/** Strip our hook entries from one settings file. Null when there was nothing. */
|
|
161
|
+
function removeHooks(file) {
|
|
162
|
+
if (!fs.existsSync(file))
|
|
163
|
+
return null;
|
|
164
|
+
const existing = fs.readFileSync(file, "utf8");
|
|
165
|
+
const cleaned = removeCarrickHooks(existing);
|
|
166
|
+
if (!cleaned.changed)
|
|
167
|
+
return null;
|
|
168
|
+
fs.writeFileSync(file, cleaned.body);
|
|
169
|
+
return file;
|
|
170
|
+
}
|
|
171
|
+
export async function remove(argv, out = createOutput()) {
|
|
172
|
+
const parsed = parseArgs(argv);
|
|
173
|
+
if (typeof parsed === "string") {
|
|
174
|
+
process.stdout.write(`${parsed}\n`);
|
|
175
|
+
return parsed.startsWith("carrick remove") ? 0 : 2;
|
|
176
|
+
}
|
|
177
|
+
const { workspace } = parsed;
|
|
178
|
+
if (!fs.existsSync(workspace)) {
|
|
179
|
+
process.stderr.write(`carrick remove: ${workspace} is not a directory on this machine\n`);
|
|
180
|
+
return 1;
|
|
181
|
+
}
|
|
182
|
+
// Each step reports its own failure and the run carries on: a settings file
|
|
183
|
+
// someone hand-edited into invalid JSON must not leave the credential and
|
|
184
|
+
// the MCP entries behind.
|
|
185
|
+
let removed = 0;
|
|
186
|
+
for (const relative of SETTINGS_FILES) {
|
|
187
|
+
const file = path.join(workspace, relative);
|
|
188
|
+
try {
|
|
189
|
+
if (removeHooks(file) !== null) {
|
|
190
|
+
out.done(`Carrick hook entries removed from ${relative}`);
|
|
191
|
+
removed += 1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
out.refuse(`Could not read ${relative}: ${error.message}. Remove the carrick hook entries there by hand.`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const { done, warn } = mcpRemovalLines(disconnectMcpClients());
|
|
199
|
+
for (const line of done) {
|
|
200
|
+
out.done(line);
|
|
201
|
+
removed += 1;
|
|
202
|
+
}
|
|
203
|
+
for (const line of warn)
|
|
204
|
+
out.warn(line);
|
|
205
|
+
const carrick = path.join(workspace, ".carrick");
|
|
206
|
+
if (fs.existsSync(carrick)) {
|
|
207
|
+
try {
|
|
208
|
+
fs.rmSync(carrick, { recursive: true, force: true });
|
|
209
|
+
out.done(".carrick removed, with the proposal and the index in it");
|
|
210
|
+
removed += 1;
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
out.refuse(`Could not remove ${carrick}: ${error.message}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (parsed.keepLogin) {
|
|
217
|
+
out.say(`This machine stays signed in; the credential is ${credentialPath()}.`);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
try {
|
|
221
|
+
if (removeCredential()) {
|
|
222
|
+
out.done("Signed out: the saved credential is gone");
|
|
223
|
+
removed += 1;
|
|
224
|
+
out.say("Revoke the key itself at https://app.carrick.tools/account.");
|
|
225
|
+
}
|
|
226
|
+
if (process.env["CARRICK_TOKEN"] !== undefined) {
|
|
227
|
+
out.warn("CARRICK_TOKEN still signs this shell in; unset it to finish signing out.");
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
catch (error) {
|
|
231
|
+
out.refuse(error.message);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (removed === 0)
|
|
235
|
+
out.say("Nothing left to remove on this machine.");
|
|
236
|
+
const leftovers = repoLeftovers(workspace);
|
|
237
|
+
if (leftovers.files.length > 0 || leftovers.sections.length > 0) {
|
|
238
|
+
out.say("");
|
|
239
|
+
out.say("In the repository, which this command does not edit:");
|
|
240
|
+
if (leftovers.files.length > 0)
|
|
241
|
+
out.say(` git rm ${leftovers.files.join(" ")}`);
|
|
242
|
+
for (const section of leftovers.sections)
|
|
243
|
+
out.say(` by hand — ${section}`);
|
|
244
|
+
}
|
|
245
|
+
out.note("Last step, when nothing else on this machine needs it", ["npm uninstall -g carrick"]);
|
|
246
|
+
return 0;
|
|
247
|
+
}
|
|
248
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/init/remove.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,oDAAoD;AACpD,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AAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjF,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ;YAAE,GAAG,CAAC,GAAG,CAAC,eAAe,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,GAAG,CAAC,IAAI,CAAC,uDAAuD,EAAE,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAChG,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/init/repos.d.ts
CHANGED
|
@@ -131,6 +131,18 @@ 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
|
+
* The repositories under a workspace, as this package counts them.
|
|
136
|
+
*
|
|
137
|
+
* A workspace is one repository or a folder of them, the same two shapes
|
|
138
|
+
* `init` takes, so the scan is this directory and its immediate children that
|
|
139
|
+
* hold a `.git` — a file counts as well as a directory, because a linked
|
|
140
|
+
* worktree's `.git` is a file (carrick#975). Nothing is opened and nothing is
|
|
141
|
+
* changed; `carrick remove` and `carrick doctor` both walk this list, and one
|
|
142
|
+
* definition is what keeps the command that audits an install and the command
|
|
143
|
+
* that undoes it looking at the same repos.
|
|
144
|
+
*/
|
|
145
|
+
export declare function repoRoots(workspace: string): string[];
|
|
134
146
|
/**
|
|
135
147
|
* What one repository on disk says it is on GitHub, and why it said nothing.
|
|
136
148
|
*
|
package/dist/init/repos.js
CHANGED
|
@@ -41,8 +41,8 @@ export const PROPOSAL_FILE = path.join(".carrick", "proposal.json");
|
|
|
41
41
|
* writes the proposal before any index exists. Same bytes so neither rewrites
|
|
42
42
|
* the other's file. Keep the two in step.
|
|
43
43
|
*/
|
|
44
|
-
const SELF_IGNORE = "# Written by Carrick. Everything here is derived from your source and
|
|
45
|
-
"#
|
|
44
|
+
const SELF_IGNORE = "# Written by Carrick. Everything here is derived from your source and the\n" +
|
|
45
|
+
"# hosted index, and `carrick refresh` rebuilds it.\n*\n";
|
|
46
46
|
/**
|
|
47
47
|
* Write the derived proposal where the scaffold tool's agent reads it.
|
|
48
48
|
*
|
|
@@ -61,6 +61,35 @@ export function writeProposal(workspace, derived) {
|
|
|
61
61
|
fs.writeFileSync(path.join(workspace, PROPOSAL_FILE), document);
|
|
62
62
|
return PROPOSAL_FILE;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* The repositories under a workspace, as this package counts them.
|
|
66
|
+
*
|
|
67
|
+
* A workspace is one repository or a folder of them, the same two shapes
|
|
68
|
+
* `init` takes, so the scan is this directory and its immediate children that
|
|
69
|
+
* hold a `.git` — a file counts as well as a directory, because a linked
|
|
70
|
+
* worktree's `.git` is a file (carrick#975). Nothing is opened and nothing is
|
|
71
|
+
* changed; `carrick remove` and `carrick doctor` both walk this list, and one
|
|
72
|
+
* definition is what keeps the command that audits an install and the command
|
|
73
|
+
* that undoes it looking at the same repos.
|
|
74
|
+
*/
|
|
75
|
+
export function repoRoots(workspace) {
|
|
76
|
+
const roots = [workspace];
|
|
77
|
+
let children = [];
|
|
78
|
+
try {
|
|
79
|
+
children = fs.readdirSync(workspace, { withFileTypes: true });
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
children = [];
|
|
83
|
+
}
|
|
84
|
+
for (const child of children) {
|
|
85
|
+
if (!child.isDirectory() || child.name.startsWith("."))
|
|
86
|
+
continue;
|
|
87
|
+
const candidate = path.join(workspace, child.name);
|
|
88
|
+
if (fs.existsSync(path.join(candidate, ".git")))
|
|
89
|
+
roots.push(candidate);
|
|
90
|
+
}
|
|
91
|
+
return roots;
|
|
92
|
+
}
|
|
64
93
|
function gitOrigin(repo) {
|
|
65
94
|
const result = spawnSync("git", ["-C", repo, "remote", "get-url", "origin"], { encoding: "utf8", timeout: 5000 });
|
|
66
95
|
return result.status === 0 ? result.stdout.trim() : null;
|
package/dist/init/repos.js.map
CHANGED
|
@@ -1 +1 @@
|
|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;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.js
CHANGED
|
@@ -18,7 +18,7 @@ import { connectRepos, reposAreInProject, projectAssignments } from "./connect.j
|
|
|
18
18
|
import { downloadHostedIndex, hostedReport, nativeRunner } from "./hosted.js";
|
|
19
19
|
import { ensureProject, projectStep, SLUG } from "./projects.js";
|
|
20
20
|
import { connectMcpClients, MCP_LINE } from "./mcp.js";
|
|
21
|
-
import { hookCommand, mergeCarrickHooks } from "./settings.js";
|
|
21
|
+
import { hookCommand, mergeCarrickHooks, removeCarrickHooks } from "./settings.js";
|
|
22
22
|
import { createOutput, DOCS } from "./output.js";
|
|
23
23
|
import { renderTemplate } from "../templates.js";
|
|
24
24
|
/**
|
|
@@ -403,7 +403,9 @@ export async function init(argv) {
|
|
|
403
403
|
const settings = fs.existsSync(settingsFile) ? fs.readFileSync(settingsFile, "utf8") : null;
|
|
404
404
|
const otherFile = path.join(workspace, ".claude", command.bare ? "settings.local.json" : "settings.json");
|
|
405
405
|
const other = fs.existsSync(otherFile) ? fs.readFileSync(otherFile, "utf8") : null;
|
|
406
|
-
|
|
406
|
+
// The same removal `carrick remove` runs, so a file holding no entry of
|
|
407
|
+
// ours is left byte for byte rather than reformatted on the way past.
|
|
408
|
+
const cleaned = other === null ? null : removeCarrickHooks(other);
|
|
407
409
|
const hooks = mergeCarrickHooks(settings, command.command);
|
|
408
410
|
// Validate both documents before migrating our entries between them.
|
|
409
411
|
if (cleaned?.changed)
|
|
@@ -433,9 +435,10 @@ export async function init(argv) {
|
|
|
433
435
|
// the whole workspace's row, and `carrick index` from a laptop on a branch
|
|
434
436
|
// replaces it for everyone who queries it (carrick#993 row 2, carrick#1020).
|
|
435
437
|
if (hostedIndex.length > 0) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
438
|
+
// The step reports its own outcome, so the read is one line in a terminal
|
|
439
|
+
// as well as in a pipe: a spinner that stopped with its label spent a
|
|
440
|
+
// second line on the same event (carrick#1032).
|
|
441
|
+
await out.step("Reading the hosted index into .carrick/", () => downloadHostedIndex(plan.workspace, nativeRunner(out.quiet)), hostedReport);
|
|
439
442
|
}
|
|
440
443
|
else {
|
|
441
444
|
out.done("No index yet: your agent runs the one scan");
|