@cleanslop/cli 0.1.0-beta.4 → 0.1.0-beta.41
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 +8 -5
- package/assets/skill-core.md +24 -14
- package/dist/action.d.ts +4 -1
- package/dist/action.js +24 -0
- package/dist/action.js.map +1 -1
- package/dist/args.d.ts +1 -1
- package/dist/args.js +45 -11
- package/dist/args.js.map +1 -1
- package/dist/commands/billing.d.ts +9 -0
- package/dist/commands/billing.js +113 -0
- package/dist/commands/billing.js.map +1 -0
- package/dist/commands/credits.d.ts +43 -0
- package/dist/commands/credits.js +268 -24
- package/dist/commands/credits.js.map +1 -1
- package/dist/commands/email.js +22 -0
- package/dist/commands/email.js.map +1 -1
- package/dist/commands/link-identity.js +5 -3
- package/dist/commands/link-identity.js.map +1 -1
- package/dist/commands/link-login.js +34 -11
- package/dist/commands/link-login.js.map +1 -1
- package/dist/commands/login.d.ts +1 -0
- package/dist/commands/login.js +25 -22
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.d.ts +2 -1
- package/dist/commands/logout.js +48 -23
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/plan.d.ts +30 -0
- package/dist/commands/plan.js +278 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/redeem.d.ts +7 -0
- package/dist/commands/redeem.js +33 -0
- package/dist/commands/redeem.js.map +1 -0
- package/dist/commands/report.js +10 -3
- package/dist/commands/report.js.map +1 -1
- package/dist/commands/scan-upload.js +51 -29
- package/dist/commands/scan-upload.js.map +1 -1
- package/dist/commands/scan.js +49 -7
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/whoami.js +27 -0
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config.d.ts +6 -3
- package/dist/config.js +5 -2
- package/dist/config.js.map +1 -1
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +109 -0
- package/dist/connect.js.map +1 -0
- package/dist/credentials.d.ts +18 -4
- package/dist/credentials.js +41 -16
- package/dist/credentials.js.map +1 -1
- package/dist/done-question.d.ts +20 -0
- package/dist/done-question.js +25 -0
- package/dist/done-question.js.map +1 -0
- package/dist/exit.d.ts +29 -0
- package/dist/exit.js +12 -0
- package/dist/exit.js.map +1 -1
- package/dist/git.d.ts +19 -1
- package/dist/git.js +48 -1
- package/dist/git.js.map +1 -1
- package/dist/http.js +86 -4
- package/dist/http.js.map +1 -1
- package/dist/link.d.ts +67 -18
- package/dist/link.js +183 -73
- package/dist/link.js.map +1 -1
- package/dist/main.js +14 -3
- package/dist/main.js.map +1 -1
- package/dist/output.js +6 -1
- package/dist/output.js.map +1 -1
- package/dist/pack.d.ts +20 -3
- package/dist/pack.js +40 -3
- package/dist/pack.js.map +1 -1
- package/dist/report-question.d.ts +12 -0
- package/dist/report-question.js +143 -0
- package/dist/report-question.js.map +1 -0
- package/dist/skill.d.ts +1 -1
- package/dist/skill.js +1 -1
- package/dist/skill.js.map +1 -1
- package/dist/token-rotation.d.ts +11 -0
- package/dist/token-rotation.js +35 -0
- package/dist/token-rotation.js.map +1 -0
- package/dist/top-up.d.ts +27 -0
- package/dist/top-up.js +88 -0
- package/dist/top-up.js.map +1 -0
- package/dist/types.d.ts +27 -1
- package/package.json +1 -1
package/dist/connect.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CliError, EXIT_ACTION } from "./exit.js";
|
|
2
|
+
import { parseGithubRemote } from "./git.js";
|
|
3
|
+
import { asRecord, httpRequest } from "./http.js";
|
|
4
|
+
export const LINK_LOGIN_COMMAND = "cleanslop login --link --no-wait";
|
|
5
|
+
export const GITHUB_LOGIN_COMMAND = "cleanslop login --no-wait";
|
|
6
|
+
const LINK_DESCRIPTION = "No GitHub needed; scans this folder's files. Needs a Link account; US and Canada only.";
|
|
7
|
+
/**
|
|
8
|
+
* The server lists both methods only while `AGENT_CONNECT_CHOICE=ask` and Link
|
|
9
|
+
* sign-up is public. `githubUploads`: a GitHub sign-in can also upload local files.
|
|
10
|
+
*/
|
|
11
|
+
async function offeredMethods(deps, origin) {
|
|
12
|
+
try {
|
|
13
|
+
const result = await httpRequest(deps, origin, "GET", "/api/agent/v1/connect");
|
|
14
|
+
if (result.status !== 200)
|
|
15
|
+
return { both: false, githubUploads: false };
|
|
16
|
+
const methods = asRecord(result.json)?.methods;
|
|
17
|
+
const list = Array.isArray(methods) ? methods.map((m) => asRecord(m)) : [];
|
|
18
|
+
const github = list.find((m) => m?.kind === "github");
|
|
19
|
+
return {
|
|
20
|
+
both: Boolean(github) && list.some((m) => m?.kind === "stripe_link"),
|
|
21
|
+
githubUploads: github?.uploads === true,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return { both: false, githubUploads: false };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function onGithub(deps) {
|
|
29
|
+
const remote = await deps.git(["remote", "get-url", "origin"], deps.env.cwd());
|
|
30
|
+
return remote.ok && parseGithubRemote(remote.stdout.trim()) !== null;
|
|
31
|
+
}
|
|
32
|
+
/** About the account, not this scan's source: the scan asks before a GitHub sign-in uploads. */
|
|
33
|
+
function githubDescription(onGithub, uploads) {
|
|
34
|
+
if (uploads)
|
|
35
|
+
return "Scans what you've pushed to GitHub; can also scan this folder's files when you choose.";
|
|
36
|
+
return onGithub
|
|
37
|
+
? "Scans what you've pushed to GitHub."
|
|
38
|
+
: "Scans what you've pushed to GitHub. This folder isn't on GitHub yet, so you'd push it first.";
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* GitHub is recommended (and listed first) when this folder's origin is on
|
|
42
|
+
* GitHub, where the person most likely already has a GitHub account;
|
|
43
|
+
* otherwise Link is.
|
|
44
|
+
*/
|
|
45
|
+
export function connectQuestion(github, githubUploads = false) {
|
|
46
|
+
const link = {
|
|
47
|
+
value: "stripe_link",
|
|
48
|
+
label: github ? "Stripe Link" : "Stripe Link (Recommended)",
|
|
49
|
+
description: LINK_DESCRIPTION,
|
|
50
|
+
run: LINK_LOGIN_COMMAND,
|
|
51
|
+
};
|
|
52
|
+
const githubOption = {
|
|
53
|
+
value: "github",
|
|
54
|
+
label: github ? "GitHub (Recommended)" : "GitHub",
|
|
55
|
+
description: githubDescription(github, githubUploads),
|
|
56
|
+
run: GITHUB_LOGIN_COMMAND,
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
id: "connect_method",
|
|
60
|
+
header: "Connect",
|
|
61
|
+
question: "How should CleanSlop connect?",
|
|
62
|
+
options: github ? [githubOption, link] : [link, githubOption],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Not connected: ask Link or GitHub (see `connectQuestion` for which is
|
|
67
|
+
* recommended) when the server offers both; otherwise, or if the server
|
|
68
|
+
* cannot say, keep the plain login block.
|
|
69
|
+
*/
|
|
70
|
+
export async function withConnectChoice(deps, err) {
|
|
71
|
+
const offered = await offeredMethods(deps, err.origin);
|
|
72
|
+
if (!offered.both)
|
|
73
|
+
return err;
|
|
74
|
+
const github = await onGithub(deps);
|
|
75
|
+
const link = `Stripe Link (${github ? "" : "recommended; "}${LINK_DESCRIPTION}) runs \`${LINK_LOGIN_COMMAND}\``;
|
|
76
|
+
const githubLine = `GitHub (${github ? "recommended; " : ""}${githubDescription(github, offered.githubUploads)}) runs \`${GITHUB_LOGIN_COMMAND}\``;
|
|
77
|
+
return new CliError(err.message, EXIT_ACTION, {
|
|
78
|
+
kind: "ask_human",
|
|
79
|
+
humanPrompt: `This machine isn't connected to CleanSlop yet. Ask the human how to connect: ${github ? `${githubLine}; ${link}` : `${link}; ${githubLine}`}. If they already said which, use that without asking.`,
|
|
80
|
+
question: connectQuestion(github, offered.githubUploads),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A link-cli failure during `login --link` (no action of its own) offers
|
|
85
|
+
* GitHub, since Link may simply be unavailable to this person.
|
|
86
|
+
*/
|
|
87
|
+
export function offerGithubAfterLinkFailure(err) {
|
|
88
|
+
if (!(err instanceof CliError) || err.action)
|
|
89
|
+
throw err;
|
|
90
|
+
throw new CliError(err.message, err.exitCode, {
|
|
91
|
+
kind: "ask_human",
|
|
92
|
+
humanPrompt: `Link sign-in failed (the error is below). If Link isn't available to the human (Link sign-up is US and Canada only), connect with GitHub instead: run \`${GITHUB_LOGIN_COMMAND}\`.`,
|
|
93
|
+
question: {
|
|
94
|
+
id: "link_failed",
|
|
95
|
+
header: "Connect",
|
|
96
|
+
question: "Link sign-in failed. Connect with GitHub instead?",
|
|
97
|
+
options: [
|
|
98
|
+
{
|
|
99
|
+
value: "github",
|
|
100
|
+
label: "Use GitHub",
|
|
101
|
+
description: "Sign in with GitHub instead",
|
|
102
|
+
run: GITHUB_LOGIN_COMMAND,
|
|
103
|
+
},
|
|
104
|
+
{ value: "retry", label: "Try Link again", run: LINK_LOGIN_COMMAND },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAA+C,MAAM,WAAW,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAElD,MAAM,CAAC,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAC;AAEhE,MAAM,gBAAgB,GACpB,wFAAwF,CAAC;AAE3F;;;GAGG;AACH,KAAK,UAAU,cAAc,CAC3B,IAAa,EACb,MAAc;IAEd,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAA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igin(deps: CliDeps): string;
|
|
|
14
14
|
export declare function configDir(deps: CliDeps): string;
|
|
15
15
|
export declare function credentialsPath(deps: CliDeps): string;
|
|
16
16
|
export declare function pendingLoginPath(deps: CliDeps): string;
|
|
17
|
-
|
|
17
|
+
/** A saved Link spend request buys a credit pack (`credits buy`) or a monthly plan (`plan`). */
|
|
18
|
+
export type SpendKind = "pack" | "plan";
|
|
19
|
+
export declare function pendingSpendPath(deps: CliDeps, kind?: SpendKind): string;
|
|
18
20
|
export type PendingSpendRequest = {
|
|
19
21
|
version: 1;
|
|
20
22
|
origin: string;
|
|
@@ -27,10 +29,14 @@ export type PendingSpendRequest = {
|
|
|
27
29
|
createdAt: number;
|
|
28
30
|
/** Link approval page from spend-request create, re-shown on --no-wait / --resume. */
|
|
29
31
|
approvalUrl?: string;
|
|
32
|
+
/** Created with `link-cli --test`. Absent on files from older CLIs. */
|
|
33
|
+
testMode?: boolean;
|
|
34
|
+
/** Spend-request events already reported to the server (billing Slack). */
|
|
35
|
+
reported?: string[];
|
|
30
36
|
};
|
|
31
|
-
export declare function readPendingSpend(deps: CliDeps): PendingSpendRequest | null;
|
|
32
|
-
export declare function writePendingSpend(deps: CliDeps, pending: PendingSpendRequest): Promise<void>;
|
|
33
|
-
export declare function deletePendingSpend(deps: CliDeps): void;
|
|
37
|
+
export declare function readPendingSpend(deps: CliDeps, kind?: SpendKind): PendingSpendRequest | null;
|
|
38
|
+
export declare function writePendingSpend(deps: CliDeps, pending: PendingSpendRequest, kind?: SpendKind): Promise<void>;
|
|
39
|
+
export declare function deletePendingSpend(deps: CliDeps, kind?: SpendKind): void;
|
|
34
40
|
export type PendingLogin = {
|
|
35
41
|
version: 1;
|
|
36
42
|
origin: string;
|
|
@@ -43,6 +49,14 @@ export type PendingLogin = {
|
|
|
43
49
|
export declare function readPendingLogin(deps: CliDeps): PendingLogin | null;
|
|
44
50
|
export declare function writePendingLogin(deps: CliDeps, pending: PendingLogin): Promise<void>;
|
|
45
51
|
export declare function deletePendingLogin(deps: CliDeps): void;
|
|
52
|
+
/**
|
|
53
|
+
* Removes the pending GitHub login and Link payment saved for `origin`, so a
|
|
54
|
+
* logout leaves nothing for the next command to resume. Another origin's stay;
|
|
55
|
+
* a file that no longer parses goes too.
|
|
56
|
+
*/
|
|
57
|
+
export declare function deletePendingFor(deps: CliDeps, origin: string): void;
|
|
58
|
+
/** Every file the CLI keeps in `configDir`; `logout --all` deletes them all. */
|
|
59
|
+
export declare function deleteAllLocalState(deps: CliDeps): void;
|
|
46
60
|
export declare function assertNotInWorktree(deps: CliDeps, targetPath: string): Promise<void>;
|
|
47
61
|
export declare function readCredentialsFile(deps: CliDeps): CredentialsFile;
|
|
48
62
|
export declare function writeCredentialsFile(deps: CliDeps, file: CredentialsFile): Promise<void>;
|
package/dist/credentials.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { CREDENTIALS_FILE, PENDING_LOGIN_FILE, PENDING_SPEND_FILE, parseOrigin, } from "./config.js";
|
|
3
|
-
import { CliError,
|
|
2
|
+
import { CREDENTIALS_FILE, PENDING_LOGIN_FILE, PENDING_PLAN_FILE, PENDING_SPEND_FILE, parseOrigin, } from "./config.js";
|
|
3
|
+
import { CliError, EXIT_USAGE, NotConnectedError, usageError } from "./exit.js";
|
|
4
4
|
import { gitToplevel, isPathInsideWorktree } from "./git.js";
|
|
5
5
|
import { tokenLast4 } from "./redact.js";
|
|
6
6
|
export function resolveOrigin(deps) {
|
|
@@ -31,8 +31,9 @@ export function credentialsPath(deps) {
|
|
|
31
31
|
export function pendingLoginPath(deps) {
|
|
32
32
|
return join(configDir(deps), PENDING_LOGIN_FILE);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const SPEND_KINDS = ["pack", "plan"];
|
|
35
|
+
export function pendingSpendPath(deps, kind = "pack") {
|
|
36
|
+
return join(configDir(deps), kind === "plan" ? PENDING_PLAN_FILE : PENDING_SPEND_FILE);
|
|
36
37
|
}
|
|
37
38
|
function isPendingSpend(value) {
|
|
38
39
|
if (!value || typeof value !== "object")
|
|
@@ -48,8 +49,8 @@ function isPendingSpend(value) {
|
|
|
48
49
|
typeof rec.purchaseUrl === "string" &&
|
|
49
50
|
typeof rec.createdAt === "number");
|
|
50
51
|
}
|
|
51
|
-
export function readPendingSpend(deps) {
|
|
52
|
-
const path = pendingSpendPath(deps);
|
|
52
|
+
export function readPendingSpend(deps, kind = "pack") {
|
|
53
|
+
const path = pendingSpendPath(deps, kind);
|
|
53
54
|
if (!deps.fs.exists(path))
|
|
54
55
|
return null;
|
|
55
56
|
try {
|
|
@@ -60,15 +61,15 @@ export function readPendingSpend(deps) {
|
|
|
60
61
|
return null;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
export async function writePendingSpend(deps, pending) {
|
|
64
|
+
export async function writePendingSpend(deps, pending, kind = "pack") {
|
|
64
65
|
const dir = configDir(deps);
|
|
65
|
-
const path = pendingSpendPath(deps);
|
|
66
|
+
const path = pendingSpendPath(deps, kind);
|
|
66
67
|
await assertNotInWorktree(deps, path);
|
|
67
68
|
deps.fs.mkdir(dir, 0o700);
|
|
68
69
|
deps.fs.write(path, `${JSON.stringify(pending, null, 2)}\n`, 0o600);
|
|
69
70
|
}
|
|
70
|
-
export function deletePendingSpend(deps) {
|
|
71
|
-
const path = pendingSpendPath(deps);
|
|
71
|
+
export function deletePendingSpend(deps, kind = "pack") {
|
|
72
|
+
const path = pendingSpendPath(deps, kind);
|
|
72
73
|
if (deps.fs.exists(path))
|
|
73
74
|
deps.fs.rm(path);
|
|
74
75
|
}
|
|
@@ -108,6 +109,34 @@ export function deletePendingLogin(deps) {
|
|
|
108
109
|
if (deps.fs.exists(path))
|
|
109
110
|
deps.fs.rm(path);
|
|
110
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Removes the pending GitHub login and Link payment saved for `origin`, so a
|
|
114
|
+
* logout leaves nothing for the next command to resume. Another origin's stay;
|
|
115
|
+
* a file that no longer parses goes too.
|
|
116
|
+
*/
|
|
117
|
+
export function deletePendingFor(deps, origin) {
|
|
118
|
+
const login = pendingLoginPath(deps);
|
|
119
|
+
if (deps.fs.exists(login) && (readPendingLogin(deps)?.origin ?? origin) === origin) {
|
|
120
|
+
deps.fs.rm(login);
|
|
121
|
+
}
|
|
122
|
+
for (const kind of SPEND_KINDS) {
|
|
123
|
+
const spend = pendingSpendPath(deps, kind);
|
|
124
|
+
if (deps.fs.exists(spend) && (readPendingSpend(deps, kind)?.origin ?? origin) === origin) {
|
|
125
|
+
deps.fs.rm(spend);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** Every file the CLI keeps in `configDir`; `logout --all` deletes them all. */
|
|
130
|
+
export function deleteAllLocalState(deps) {
|
|
131
|
+
for (const path of [
|
|
132
|
+
credentialsPath(deps),
|
|
133
|
+
pendingLoginPath(deps),
|
|
134
|
+
...SPEND_KINDS.map((kind) => pendingSpendPath(deps, kind)),
|
|
135
|
+
]) {
|
|
136
|
+
if (deps.fs.exists(path))
|
|
137
|
+
deps.fs.rm(path);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
111
140
|
export async function assertNotInWorktree(deps, targetPath) {
|
|
112
141
|
const top = await gitToplevel(deps, deps.env.cwd());
|
|
113
142
|
if (!top)
|
|
@@ -173,12 +202,8 @@ export function resolveToken(deps, origin) {
|
|
|
173
202
|
}
|
|
174
203
|
export function requireToken(deps, origin) {
|
|
175
204
|
const resolved = resolveToken(deps, origin);
|
|
176
|
-
if (!resolved)
|
|
177
|
-
throw new
|
|
178
|
-
kind: "approve",
|
|
179
|
-
humanPrompt: "Run `cleanslop login` and ask the human to approve the device code.",
|
|
180
|
-
});
|
|
181
|
-
}
|
|
205
|
+
if (!resolved)
|
|
206
|
+
throw new NotConnectedError(origin);
|
|
182
207
|
return resolved;
|
|
183
208
|
}
|
|
184
209
|
export async function storeToken(deps, origin, input) {
|
package/dist/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,GACZ,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAezC,MAAM,UAAU,aAAa,CAAC,IAAa;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAClD,IAAI,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,UAAU,CACd,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC,aAAa,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC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,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3C,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IACD,MAAM,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ActionQuestion } from "./exit.js";
|
|
2
|
+
/** The next step after a `--no-wait` approval when only the agent knows its exact command. */
|
|
3
|
+
export declare const RESUME_SAME_COMMAND = "run the same cleanslop command again, with --resume in place of --no-wait";
|
|
4
|
+
export declare const RERUN_SAME_COMMAND = "run the same cleanslop command again";
|
|
5
|
+
/**
|
|
6
|
+
* "Tell me when you're done" as a question, so agents ask with their question
|
|
7
|
+
* tool instead of improvising "reply done". The question repeats any link and
|
|
8
|
+
* code, because a question tool may show only the question.
|
|
9
|
+
*/
|
|
10
|
+
export declare function doneQuestion(opts: {
|
|
11
|
+
id: string;
|
|
12
|
+
header: string;
|
|
13
|
+
question: string;
|
|
14
|
+
then: {
|
|
15
|
+
run: string;
|
|
16
|
+
} | {
|
|
17
|
+
next: string;
|
|
18
|
+
};
|
|
19
|
+
notNow?: string;
|
|
20
|
+
}): ActionQuestion;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The next step after a `--no-wait` approval when only the agent knows its exact command. */
|
|
2
|
+
export const RESUME_SAME_COMMAND = "run the same cleanslop command again, with --resume in place of --no-wait";
|
|
3
|
+
export const RERUN_SAME_COMMAND = "run the same cleanslop command again";
|
|
4
|
+
const NOT_NOW = {
|
|
5
|
+
value: "stop",
|
|
6
|
+
label: "Not now",
|
|
7
|
+
description: "Stop here",
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* "Tell me when you're done" as a question, so agents ask with their question
|
|
11
|
+
* tool instead of improvising "reply done". The question repeats any link and
|
|
12
|
+
* code, because a question tool may show only the question.
|
|
13
|
+
*/
|
|
14
|
+
export function doneQuestion(opts) {
|
|
15
|
+
return {
|
|
16
|
+
id: opts.id,
|
|
17
|
+
header: opts.header,
|
|
18
|
+
question: opts.question,
|
|
19
|
+
options: [
|
|
20
|
+
{ value: "done", label: "Done", ...opts.then },
|
|
21
|
+
opts.notNow ? { ...NOT_NOW, description: opts.notNow } : NOT_NOW,
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=done-question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"done-question.js","sourceRoot":"","sources":["../src/done-question.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAC9B,2EAA2E,CAAC;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAEzE,MAAM,OAAO,GAAyB;IACpC,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,WAAW;CACzB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,IAM5B;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE;YAC9C,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO;SACjE;KACF,CAAC;AACJ,CAAC"}
|
package/dist/exit.d.ts
CHANGED
|
@@ -8,17 +8,46 @@ export declare const EXIT_SOURCE = 13;
|
|
|
8
8
|
export declare const EXIT_SCAN_FAILED = 20;
|
|
9
9
|
export declare const EXIT_RUNNING = 75;
|
|
10
10
|
export type ActionKind = "approve" | "install" | "top-up" | "beta" | "reauth" | "present_identity" | "link_existing" | "ask_human" | "ask_email" | "wait";
|
|
11
|
+
/**
|
|
12
|
+
* One answer to a structured question. `run` is the exact next command;
|
|
13
|
+
* `next` is a plain instruction (consent answers never carry `--agree`);
|
|
14
|
+
* neither means stop.
|
|
15
|
+
*/
|
|
16
|
+
export type ActionQuestionOption = {
|
|
17
|
+
value: string;
|
|
18
|
+
label: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
run?: string;
|
|
21
|
+
next?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A multiple-choice question for the human. Agents with a question tool
|
|
25
|
+
* (e.g. Claude Code AskUserQuestion: 2–4 options, header ≤12 chars) ask with
|
|
26
|
+
* it; others ask in plain text. The agent never answers it itself.
|
|
27
|
+
*/
|
|
28
|
+
export type ActionQuestion = {
|
|
29
|
+
id: string;
|
|
30
|
+
header: string;
|
|
31
|
+
question: string;
|
|
32
|
+
options: ActionQuestionOption[];
|
|
33
|
+
};
|
|
11
34
|
export type ActionRequired = {
|
|
12
35
|
kind: ActionKind;
|
|
13
36
|
humanPrompt: string;
|
|
14
37
|
url?: string;
|
|
15
38
|
code?: string;
|
|
39
|
+
question?: ActionQuestion;
|
|
16
40
|
};
|
|
17
41
|
export declare class CliError extends Error {
|
|
18
42
|
readonly exitCode: number;
|
|
19
43
|
readonly action: ActionRequired | undefined;
|
|
20
44
|
constructor(message: string, exitCode: number, action?: ActionRequired);
|
|
21
45
|
}
|
|
46
|
+
/** No credentials for `origin`; `runCli` may turn this into a connect question. */
|
|
47
|
+
export declare class NotConnectedError extends CliError {
|
|
48
|
+
readonly origin: string;
|
|
49
|
+
constructor(origin: string);
|
|
50
|
+
}
|
|
22
51
|
export declare function usageError(message: string): CliError;
|
|
23
52
|
export declare function sourceError(message: string, action?: ActionRequired): CliError;
|
|
24
53
|
export declare function actionError(message: string, action: ActionRequired): CliError;
|
package/dist/exit.js
CHANGED
|
@@ -17,6 +17,18 @@ export class CliError extends Error {
|
|
|
17
17
|
this.action = action;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
/** No credentials for `origin`; `runCli` may turn this into a connect question. */
|
|
21
|
+
export class NotConnectedError extends CliError {
|
|
22
|
+
origin;
|
|
23
|
+
constructor(origin) {
|
|
24
|
+
super("Not connected. Run `cleanslop login`.", EXIT_ACTION, {
|
|
25
|
+
kind: "approve",
|
|
26
|
+
humanPrompt: "Run `cleanslop login` and ask the human to approve the device code.",
|
|
27
|
+
});
|
|
28
|
+
this.name = "NotConnectedError";
|
|
29
|
+
this.origin = origin;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
export function usageError(message) {
|
|
21
33
|
return new CliError(message, EXIT_USAGE);
|
|
22
34
|
}
|
package/dist/exit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit.js","sourceRoot":"","sources":["../src/exit.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAC/B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;AAC9B,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;
|
|
1
|
+
{"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,WAAW,CAAC,OAAe,EAAE,MAAuB;IAClE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,MAAsB;IACjE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/git.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CliDeps } from "./deps.js";
|
|
2
|
+
import { type ActionQuestion } from "./exit.js";
|
|
2
3
|
import type { GitSnapshot } from "./types.js";
|
|
3
4
|
export type GithubRemote = {
|
|
4
5
|
owner: string;
|
|
@@ -10,5 +11,22 @@ export declare function parseGithubRemote(raw: string): GithubRemote | null;
|
|
|
10
11
|
export declare function isPathInsideWorktree(targetPath: string, worktreeRoot: string): boolean;
|
|
11
12
|
export declare function gitToplevel(deps: CliDeps, cwd: string): Promise<string | null>;
|
|
12
13
|
export declare function inspectGit(deps: CliDeps): Promise<GitSnapshot>;
|
|
13
|
-
|
|
14
|
+
/** The human commits and pushes; the agent never does. */
|
|
15
|
+
export declare function pushFirstQuestion(): ActionQuestion;
|
|
16
|
+
/** The human chose uploads: rescans in the fix loop keep it without asking again. */
|
|
17
|
+
export declare const UPLOAD_NEXT = "run the same cleanslop command again, adding --upload, and keep --upload on later scans in this session without asking again";
|
|
18
|
+
/** "Scan local files" for a GitHub sign-in, with what it gives up. */
|
|
19
|
+
export declare function uploadOption(description: string): {
|
|
20
|
+
value: string;
|
|
21
|
+
label: string;
|
|
22
|
+
description: string;
|
|
23
|
+
next: string;
|
|
24
|
+
};
|
|
25
|
+
/** GitHub grants that may upload: scan the local files now, or push and scan the commit. */
|
|
26
|
+
export declare function pushOrUploadQuestion(): ActionQuestion;
|
|
27
|
+
/** A GitHub sign-in in a folder with nothing on GitHub: upload only after the human says so. */
|
|
28
|
+
export declare function uploadLocalQuestion(): ActionQuestion;
|
|
29
|
+
export declare function assertGithubReady(git: GitSnapshot, opts?: {
|
|
30
|
+
canUpload?: boolean;
|
|
31
|
+
}): void;
|
|
14
32
|
export declare function detectAgentHint(env: CliDeps["env"]): string;
|
package/dist/git.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, realpathSync } from "node:fs";
|
|
2
2
|
import { basename, isAbsolute, relative, resolve, sep } from "node:path";
|
|
3
|
+
import { doneQuestion, RERUN_SAME_COMMAND } from "./done-question.js";
|
|
3
4
|
import { sourceError } from "./exit.js";
|
|
4
5
|
const OWNER_REPO_RE = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
|
|
5
6
|
function stripGitSuffix(name) {
|
|
@@ -127,7 +128,52 @@ export async function inspectGit(deps) {
|
|
|
127
128
|
github: parseGithubRemote(remote),
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
+
/** The human commits and pushes; the agent never does. */
|
|
132
|
+
export function pushFirstQuestion() {
|
|
133
|
+
return doneQuestion({
|
|
134
|
+
id: "push_first",
|
|
135
|
+
header: "Push",
|
|
136
|
+
question: "Commit and push your changes to GitHub. Done?",
|
|
137
|
+
then: { next: RERUN_SAME_COMMAND },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** The human chose uploads: rescans in the fix loop keep it without asking again. */
|
|
141
|
+
export const UPLOAD_NEXT = "run the same cleanslop command again, adding --upload, and keep --upload on later scans in this session without asking again";
|
|
142
|
+
/** "Scan local files" for a GitHub sign-in, with what it gives up. */
|
|
143
|
+
export function uploadOption(description) {
|
|
144
|
+
return { value: "upload", label: "Scan local files", description, next: UPLOAD_NEXT };
|
|
145
|
+
}
|
|
146
|
+
/** GitHub grants that may upload: scan the local files now, or push and scan the commit. */
|
|
147
|
+
export function pushOrUploadQuestion() {
|
|
148
|
+
return {
|
|
149
|
+
id: "push_or_upload",
|
|
150
|
+
header: "Source",
|
|
151
|
+
question: "Your latest changes are not on GitHub. Scan the local files as they are, or push them and scan the pushed commit?",
|
|
152
|
+
options: [
|
|
153
|
+
uploadOption("Includes uncommitted changes; nothing is pushed. No project history or triage"),
|
|
154
|
+
{
|
|
155
|
+
value: "pushed",
|
|
156
|
+
label: "I pushed",
|
|
157
|
+
description: "Scans the commit on GitHub; keeps project history and triage",
|
|
158
|
+
next: RERUN_SAME_COMMAND,
|
|
159
|
+
},
|
|
160
|
+
{ value: "stop", label: "Not now", description: "Stop here" },
|
|
161
|
+
],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/** A GitHub sign-in in a folder with nothing on GitHub: upload only after the human says so. */
|
|
165
|
+
export function uploadLocalQuestion() {
|
|
166
|
+
return {
|
|
167
|
+
id: "upload_local",
|
|
168
|
+
header: "Source",
|
|
169
|
+
question: "This folder isn't on GitHub. Scan its files by uploading them to CleanSlop?",
|
|
170
|
+
options: [
|
|
171
|
+
uploadOption("Uploads this folder's files. No project history or triage"),
|
|
172
|
+
{ value: "stop", label: "Not now", description: "Stop here" },
|
|
173
|
+
],
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
export function assertGithubReady(git, opts = {}) {
|
|
131
177
|
if (!git.github) {
|
|
132
178
|
throw sourceError("origin is not a github.com remote. Phase 1 only scans GitHub App repos.", {
|
|
133
179
|
kind: "ask_human",
|
|
@@ -144,6 +190,7 @@ export function assertGithubReady(git) {
|
|
|
144
190
|
throw sourceError(`Ask the human before committing or pushing (${why}).`, {
|
|
145
191
|
kind: "ask_human",
|
|
146
192
|
humanPrompt: "This checkout has local changes or an unpushed HEAD. Ask the human to commit and push, then rerun. Do not commit or push yourself.",
|
|
193
|
+
question: opts.canUpload ? pushOrUploadQuestion() : pushFirstQuestion(),
|
|
147
194
|
});
|
|
148
195
|
}
|
|
149
196
|
}
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA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