looply-cli 0.5.2 → 0.5.4
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/dist/.src-hash +1 -1
- package/dist/agent-contained.d.ts +2 -0
- package/dist/agent-contained.d.ts.map +1 -1
- package/dist/agent-contained.js +22 -5
- package/dist/agent-contained.js.map +1 -1
- package/dist/agent-exec.d.ts +10 -5
- package/dist/agent-exec.d.ts.map +1 -1
- package/dist/agent-exec.js +1 -0
- package/dist/agent-exec.js.map +1 -1
- package/dist/autonomy-tick.d.ts +46 -0
- package/dist/autonomy-tick.d.ts.map +1 -1
- package/dist/autonomy-tick.js +67 -2
- package/dist/autonomy-tick.js.map +1 -1
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +82 -16
- package/dist/bin.js.map +1 -1
- package/dist/brain-advice.js +2 -2
- package/dist/brain-advice.js.map +1 -1
- package/dist/command-runner.d.ts.map +1 -1
- package/dist/command-runner.js +1 -0
- package/dist/command-runner.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -1
- package/dist/config.js.map +1 -1
- package/dist/connect-node.d.ts.map +1 -1
- package/dist/connect-node.js +8 -4
- package/dist/connect-node.js.map +1 -1
- package/dist/connect.d.ts +8 -0
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +22 -0
- package/dist/connect.js.map +1 -1
- package/dist/contained-node.d.ts +51 -0
- package/dist/contained-node.d.ts.map +1 -0
- package/dist/contained-node.js +116 -0
- package/dist/contained-node.js.map +1 -0
- package/dist/daemon-cmd.d.ts.map +1 -1
- package/dist/daemon-cmd.js +56 -1
- package/dist/daemon-cmd.js.map +1 -1
- package/dist/daemon.d.ts +23 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +32 -4
- package/dist/daemon.js.map +1 -1
- package/dist/exec-domains.d.ts +4 -0
- package/dist/exec-domains.d.ts.map +1 -1
- package/dist/exec-domains.js +7 -2
- package/dist/exec-domains.js.map +1 -1
- package/dist/gate-draft.d.ts +99 -0
- package/dist/gate-draft.d.ts.map +1 -0
- package/dist/gate-draft.js +544 -0
- package/dist/gate-draft.js.map +1 -0
- package/dist/git-driver.d.ts.map +1 -1
- package/dist/git-driver.js +1 -0
- package/dist/git-driver.js.map +1 -1
- package/dist/init-detect.d.ts +20 -10
- package/dist/init-detect.d.ts.map +1 -1
- package/dist/init-detect.js +28 -86
- package/dist/init-detect.js.map +1 -1
- package/dist/model-routing.d.ts +52 -7
- package/dist/model-routing.d.ts.map +1 -1
- package/dist/model-routing.js +84 -14
- package/dist/model-routing.js.map +1 -1
- package/dist/model-settings.d.ts +67 -0
- package/dist/model-settings.d.ts.map +1 -0
- package/dist/model-settings.js +177 -0
- package/dist/model-settings.js.map +1 -0
- package/dist/model-transport.d.ts +8 -0
- package/dist/model-transport.d.ts.map +1 -1
- package/dist/model-transport.js +31 -11
- package/dist/model-transport.js.map +1 -1
- package/dist/notify-channel.d.ts.map +1 -1
- package/dist/notify-channel.js +1 -0
- package/dist/notify-channel.js.map +1 -1
- package/dist/provider-cmd.d.ts +65 -0
- package/dist/provider-cmd.d.ts.map +1 -0
- package/dist/provider-cmd.js +360 -0
- package/dist/provider-cmd.js.map +1 -0
- package/dist/provider-discovery.d.ts +75 -0
- package/dist/provider-discovery.d.ts.map +1 -0
- package/dist/provider-discovery.js +235 -0
- package/dist/provider-discovery.js.map +1 -0
- package/dist/provider-identity.d.ts +3 -3
- package/dist/provider-identity.d.ts.map +1 -1
- package/dist/provider-identity.js +4 -5
- package/dist/provider-identity.js.map +1 -1
- package/dist/provider-preflight.d.ts.map +1 -1
- package/dist/provider-preflight.js +1 -0
- package/dist/provider-preflight.js.map +1 -1
- package/dist/provider-ready.d.ts +79 -0
- package/dist/provider-ready.d.ts.map +1 -0
- package/dist/provider-ready.js +149 -0
- package/dist/provider-ready.js.map +1 -0
- package/dist/provider-state.d.ts.map +1 -1
- package/dist/provider-state.js +1 -0
- package/dist/provider-state.js.map +1 -1
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +4 -0
- package/dist/providers.js.map +1 -1
- package/dist/refresh-gates.d.ts +47 -0
- package/dist/refresh-gates.d.ts.map +1 -0
- package/dist/refresh-gates.js +128 -0
- package/dist/refresh-gates.js.map +1 -0
- package/dist/repo-init.d.ts +5 -1
- package/dist/repo-init.d.ts.map +1 -1
- package/dist/repo-init.js +19 -3
- package/dist/repo-init.js.map +1 -1
- package/dist/run-cmd.js +4 -4
- package/dist/run-cmd.js.map +1 -1
- package/dist/run-launcher.d.ts +13 -0
- package/dist/run-launcher.d.ts.map +1 -1
- package/dist/run-launcher.js +29 -0
- package/dist/run-launcher.js.map +1 -1
- package/dist/serve-cmd.d.ts.map +1 -1
- package/dist/serve-cmd.js +14 -5
- package/dist/serve-cmd.js.map +1 -1
- package/dist/serve.d.ts +19 -7
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +28 -12
- package/dist/serve.js.map +1 -1
- package/dist/server-client.d.ts +23 -2
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +18 -2
- package/dist/server-client.js.map +1 -1
- package/dist/session-checkpoint-runtime.d.ts.map +1 -1
- package/dist/session-checkpoint-runtime.js +1 -0
- package/dist/session-checkpoint-runtime.js.map +1 -1
- package/dist/setup.d.ts +7 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +13 -13
- package/dist/setup.js.map +1 -1
- package/dist/shared-grants.js +2 -2
- package/dist/shared-grants.js.map +1 -1
- package/dist/toolchain-mirror.js +1 -1
- package/dist/toolchain-mirror.js.map +1 -1
- package/dist/untrusted-exec.d.ts +23 -0
- package/dist/untrusted-exec.d.ts.map +1 -1
- package/dist/untrusted-exec.js +18 -1
- package/dist/untrusted-exec.js.map +1 -1
- package/dist/untrusted-gate.d.ts.map +1 -1
- package/dist/untrusted-gate.js +4 -0
- package/dist/untrusted-gate.js.map +1 -1
- package/package.json +2 -2
- package/win/appcontainer.ps1 +97 -4
- package/win/contained-node.cjs +530 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type ProviderDiscovery } from './provider-discovery';
|
|
2
|
+
import { type ProviderReadiness } from './provider-ready';
|
|
3
|
+
import { type ProviderAuthState } from './provider-state';
|
|
4
|
+
/**
|
|
5
|
+
* `looply provider` — IS CLAUDE CODE READY ON THIS MACHINE, AND IF NOT, FIX IT.
|
|
6
|
+
*
|
|
7
|
+
* looply provider [status] where Claude Code was found, and whether Looply's profile is logged in
|
|
8
|
+
* looply provider install [--yes] install Claude Code (`npm i -g @anthropic-ai/claude-code@latest`)
|
|
9
|
+
* looply provider update [--yes] update Claude Code (the same npm command) — an outdated one
|
|
10
|
+
* refuses the models Looply asks for (`MIN_CLAUDE_CODE_VERSION`)
|
|
11
|
+
* looply provider login sign Looply's own Claude Code profile in
|
|
12
|
+
*
|
|
13
|
+
* `looply connect` runs the same check up front (`ensureProviderReady`), so a
|
|
14
|
+
* machine is not left serving repositories it can never run anything in. This
|
|
15
|
+
* command exists so it can be fixed later without running `connect` again.
|
|
16
|
+
*
|
|
17
|
+
* ⚠️ LOOPLY'S PROFILE, NOT THE PERSON'S. The login lands in
|
|
18
|
+
* `~/.looply/provider-profile` (`CLAUDE_CONFIG_DIR`), the profile every run
|
|
19
|
+
* uses — logging into Claude Code in a terminal the ordinary way does NOT make
|
|
20
|
+
* Looply ready, which is exactly what tripped the first real user.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROVIDER_USAGE: string;
|
|
23
|
+
/** `@latest`, so an install never lands a version too old for the configured models. */
|
|
24
|
+
export declare const INSTALL_COMMAND = "npm i -g @anthropic-ai/claude-code@latest";
|
|
25
|
+
/** An update is the same command: npm replaces the global install with the latest. */
|
|
26
|
+
export declare const UPDATE_COMMAND = "npm i -g @anthropic-ai/claude-code@latest";
|
|
27
|
+
export interface ProviderDeps {
|
|
28
|
+
readonly platform: NodeJS.Platform;
|
|
29
|
+
readonly interactive: boolean;
|
|
30
|
+
ask?(prompt: string): Promise<string>;
|
|
31
|
+
/** Where Looply's own provider profile is (`~/.looply/provider-profile`). */
|
|
32
|
+
readonly profile: string;
|
|
33
|
+
discover(): ProviderDiscovery;
|
|
34
|
+
checkAuth(executable: string): ProviderAuthState;
|
|
35
|
+
/** `<exe> --version`'s first `x.y.z`, or null when it cannot be read (never treated as outdated). */
|
|
36
|
+
version(executable: string): string | null;
|
|
37
|
+
/** Run the npm install (also the update) in the foreground; its exit code. */
|
|
38
|
+
install(): Promise<number>;
|
|
39
|
+
/** Run `<exe> auth login` in the foreground with CLAUDE_CONFIG_DIR=<profile>; its exit code. */
|
|
40
|
+
login(executable: string): Promise<number>;
|
|
41
|
+
out(line: string): void;
|
|
42
|
+
err(line: string): void;
|
|
43
|
+
}
|
|
44
|
+
export declare function readinessOf(deps: Pick<ProviderDeps, 'discover' | 'checkAuth' | 'version'>): ProviderReadiness;
|
|
45
|
+
/** The exact command a person types to log Looply's profile in, in their own shell. */
|
|
46
|
+
export declare function loginCommandLine(executable: string, profile: string, platform: NodeJS.Platform): string;
|
|
47
|
+
/**
|
|
48
|
+
* Make the provider ready, as far as this terminal allows. Never throws; the
|
|
49
|
+
* readiness at the end is the answer.
|
|
50
|
+
*
|
|
51
|
+
* - Not installed: explain, then install — asking y/N on a terminal, without
|
|
52
|
+
* asking under `yes`, and otherwise printing the exact command.
|
|
53
|
+
* - Outdated (older than `MIN_CLAUDE_CODE_VERSION`): explain, then update —
|
|
54
|
+
* asked, automatic or printed exactly as for an install — and check again.
|
|
55
|
+
* - Not logged in: run the login on a terminal; otherwise print the command.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ensureProviderReady(deps: ProviderDeps, opts: {
|
|
58
|
+
yes: boolean;
|
|
59
|
+
}): Promise<ProviderReadiness>;
|
|
60
|
+
export declare function providerCommand(argv: readonly string[], deps: ProviderDeps): Promise<number>;
|
|
61
|
+
export declare function nodeProviderDeps(opts?: {
|
|
62
|
+
configured?: string;
|
|
63
|
+
ask?: (prompt: string) => Promise<string>;
|
|
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ACzB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG,iBAAiB,CAK7G;AAgCD,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAIvG;AAaD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAuFhH;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA0ElG;AAgDD,wBAAgB,gBAAgB,CAAC,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAAO,GAAG,YAAY,CAuC5H"}
|
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UPDATE_COMMAND = exports.INSTALL_COMMAND = exports.PROVIDER_USAGE = void 0;
|
|
4
|
+
exports.readinessOf = readinessOf;
|
|
5
|
+
exports.loginCommandLine = loginCommandLine;
|
|
6
|
+
exports.ensureProviderReady = ensureProviderReady;
|
|
7
|
+
exports.providerCommand = providerCommand;
|
|
8
|
+
exports.nodeProviderDeps = nodeProviderDeps;
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const exec_domains_1 = require("./exec-domains");
|
|
14
|
+
const model_transport_1 = require("./model-transport");
|
|
15
|
+
const provider_discovery_1 = require("./provider-discovery");
|
|
16
|
+
const provider_ready_1 = require("./provider-ready");
|
|
17
|
+
const provider_state_1 = require("./provider-state");
|
|
18
|
+
const setup_prompt_1 = require("./setup-prompt");
|
|
19
|
+
/**
|
|
20
|
+
* `looply provider` — IS CLAUDE CODE READY ON THIS MACHINE, AND IF NOT, FIX IT.
|
|
21
|
+
*
|
|
22
|
+
* looply provider [status] where Claude Code was found, and whether Looply's profile is logged in
|
|
23
|
+
* looply provider install [--yes] install Claude Code (`npm i -g @anthropic-ai/claude-code@latest`)
|
|
24
|
+
* looply provider update [--yes] update Claude Code (the same npm command) — an outdated one
|
|
25
|
+
* refuses the models Looply asks for (`MIN_CLAUDE_CODE_VERSION`)
|
|
26
|
+
* looply provider login sign Looply's own Claude Code profile in
|
|
27
|
+
*
|
|
28
|
+
* `looply connect` runs the same check up front (`ensureProviderReady`), so a
|
|
29
|
+
* machine is not left serving repositories it can never run anything in. This
|
|
30
|
+
* command exists so it can be fixed later without running `connect` again.
|
|
31
|
+
*
|
|
32
|
+
* ⚠️ LOOPLY'S PROFILE, NOT THE PERSON'S. The login lands in
|
|
33
|
+
* `~/.looply/provider-profile` (`CLAUDE_CONFIG_DIR`), the profile every run
|
|
34
|
+
* uses — logging into Claude Code in a terminal the ordinary way does NOT make
|
|
35
|
+
* Looply ready, which is exactly what tripped the first real user.
|
|
36
|
+
*/
|
|
37
|
+
exports.PROVIDER_USAGE = [
|
|
38
|
+
'looply provider [status] where Claude Code was found, and whether Looply is signed in to it',
|
|
39
|
+
'looply provider install [--yes] install Claude Code (npm i -g @anthropic-ai/claude-code@latest)',
|
|
40
|
+
'looply provider update [--yes] update Claude Code to the latest version (the same npm command)',
|
|
41
|
+
'looply provider login sign Looply’s own Claude Code profile in (opens your browser)',
|
|
42
|
+
].join('\n');
|
|
43
|
+
/** `@latest`, so an install never lands a version too old for the configured models. */
|
|
44
|
+
exports.INSTALL_COMMAND = 'npm i -g @anthropic-ai/claude-code@latest';
|
|
45
|
+
/** An update is the same command: npm replaces the global install with the latest. */
|
|
46
|
+
exports.UPDATE_COMMAND = exports.INSTALL_COMMAND;
|
|
47
|
+
/** Windows: npm cannot replace claude.exe while any Claude Code process holds it open. */
|
|
48
|
+
const UPDATE_FAILED_HINT = 'close any running Claude Code windows and run `looply provider update` again';
|
|
49
|
+
function readinessOf(deps) {
|
|
50
|
+
const discovery = deps.discover();
|
|
51
|
+
if (discovery.found === null)
|
|
52
|
+
return (0, provider_ready_1.readinessFrom)(discovery, null);
|
|
53
|
+
const exe = discovery.found.executable;
|
|
54
|
+
return (0, provider_ready_1.readinessFrom)(discovery, deps.checkAuth(exe), deps.version(exe));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Run the npm update in the foreground and check again. Null when it did not
|
|
58
|
+
* finish — and then it has said why, and what to do.
|
|
59
|
+
*/
|
|
60
|
+
async function runUpdate(deps) {
|
|
61
|
+
deps.out(`provider: updating — ${exports.UPDATE_COMMAND}`);
|
|
62
|
+
const code = await deps.install().catch((e) => {
|
|
63
|
+
deps.err(`provider: the update could not start — ${e.message}`);
|
|
64
|
+
return 1;
|
|
65
|
+
});
|
|
66
|
+
if (code !== 0) {
|
|
67
|
+
deps.err(`provider: the update did not finish (exit ${code}). ` +
|
|
68
|
+
(deps.platform === 'win32'
|
|
69
|
+
? `Claude Code cannot be replaced while it is running: ${UPDATE_FAILED_HINT}.`
|
|
70
|
+
: 'Run `looply provider update` again.'));
|
|
71
|
+
deps.err(` (or run it yourself: ${exports.UPDATE_COMMAND})`);
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const r = readinessOf(deps);
|
|
75
|
+
if (r.reason === 'outdated') {
|
|
76
|
+
deps.err(`provider: updated, but the Claude Code Looply finds is still outdated — ${r.detail}. ` +
|
|
77
|
+
'Another, older copy may come first; `looply provider status` shows which one Looply uses.');
|
|
78
|
+
}
|
|
79
|
+
return r;
|
|
80
|
+
}
|
|
81
|
+
/** The exact command a person types to log Looply's profile in, in their own shell. */
|
|
82
|
+
function loginCommandLine(executable, profile, platform) {
|
|
83
|
+
return platform === 'win32'
|
|
84
|
+
? `$env:CLAUDE_CONFIG_DIR="${profile}"; & "${executable}" auth login`
|
|
85
|
+
: `CLAUDE_CONFIG_DIR="${profile}" "${executable}" auth login`;
|
|
86
|
+
}
|
|
87
|
+
function describe(r, deps, version) {
|
|
88
|
+
if (r.executable !== null && r.source !== null) {
|
|
89
|
+
deps.out(`provider: Claude Code found at ${r.executable}`);
|
|
90
|
+
deps.out(` (from ${provider_discovery_1.SOURCE_WORDS[r.source]})`);
|
|
91
|
+
if (version !== undefined)
|
|
92
|
+
deps.out(` version: ${version ?? 'could not be read'}`);
|
|
93
|
+
}
|
|
94
|
+
deps.out(` Looply's profile: ${deps.profile}`);
|
|
95
|
+
if (r.ready)
|
|
96
|
+
deps.out(`provider: READY — ${r.detail}.`);
|
|
97
|
+
else
|
|
98
|
+
deps.out(`provider: NOT READY (${r.reason}) — ${r.detail}.`);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Make the provider ready, as far as this terminal allows. Never throws; the
|
|
102
|
+
* readiness at the end is the answer.
|
|
103
|
+
*
|
|
104
|
+
* - Not installed: explain, then install — asking y/N on a terminal, without
|
|
105
|
+
* asking under `yes`, and otherwise printing the exact command.
|
|
106
|
+
* - Outdated (older than `MIN_CLAUDE_CODE_VERSION`): explain, then update —
|
|
107
|
+
* asked, automatic or printed exactly as for an install — and check again.
|
|
108
|
+
* - Not logged in: run the login on a terminal; otherwise print the command.
|
|
109
|
+
*/
|
|
110
|
+
async function ensureProviderReady(deps, opts) {
|
|
111
|
+
let r = readinessOf(deps);
|
|
112
|
+
if (r.ready) {
|
|
113
|
+
deps.out(`provider: Claude Code is ready (${r.executable}).`);
|
|
114
|
+
return r;
|
|
115
|
+
}
|
|
116
|
+
if (r.reason === 'not_installed') {
|
|
117
|
+
deps.out('provider: Claude Code is not installed where Looply can find it. Looply needs it to do any work —');
|
|
118
|
+
deps.out(' without it, work you start stays waiting on this machine.');
|
|
119
|
+
let go = opts.yes;
|
|
120
|
+
if (!go && deps.interactive && deps.ask) {
|
|
121
|
+
const answer = await deps.ask(`Install it now with \`${exports.INSTALL_COMMAND}\`? [y/N] `);
|
|
122
|
+
go = /^(y|yes)$/i.test(answer.trim());
|
|
123
|
+
}
|
|
124
|
+
if (!go) {
|
|
125
|
+
deps.out(` To install it later: ${exports.INSTALL_COMMAND} (or: looply provider install)`);
|
|
126
|
+
return r;
|
|
127
|
+
}
|
|
128
|
+
deps.out(`provider: installing — ${exports.INSTALL_COMMAND}`);
|
|
129
|
+
const code = await deps.install().catch((e) => {
|
|
130
|
+
deps.err(`provider: the install could not start — ${e.message}`);
|
|
131
|
+
return 1;
|
|
132
|
+
});
|
|
133
|
+
if (code !== 0) {
|
|
134
|
+
deps.err(`provider: the install did not finish (exit ${code}). Run it yourself: ${exports.INSTALL_COMMAND}`);
|
|
135
|
+
return readinessOf(deps);
|
|
136
|
+
}
|
|
137
|
+
r = readinessOf(deps);
|
|
138
|
+
if (r.reason === 'not_installed') {
|
|
139
|
+
deps.err('provider: installed, but Looply still cannot find Claude Code. `looply provider status` shows where it looked.');
|
|
140
|
+
return r;
|
|
141
|
+
}
|
|
142
|
+
if (r.ready) {
|
|
143
|
+
deps.out(`provider: Claude Code is ready (${r.executable}).`);
|
|
144
|
+
return r;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (r.reason === 'outdated') {
|
|
148
|
+
deps.out(`provider: ${r.detail}. Every call Looply makes to it would be refused —`);
|
|
149
|
+
deps.out(' without an update, work you start fails on this machine.');
|
|
150
|
+
let go = opts.yes;
|
|
151
|
+
if (!go && deps.interactive && deps.ask) {
|
|
152
|
+
const answer = await deps.ask(`Update it now with \`${exports.UPDATE_COMMAND}\`? [y/N] `);
|
|
153
|
+
go = /^(y|yes)$/i.test(answer.trim());
|
|
154
|
+
}
|
|
155
|
+
if (!go) {
|
|
156
|
+
deps.out(` To update it later: ${exports.UPDATE_COMMAND} (or: looply provider update)`);
|
|
157
|
+
return r;
|
|
158
|
+
}
|
|
159
|
+
const after = await runUpdate(deps);
|
|
160
|
+
if (after === null)
|
|
161
|
+
return readinessOf(deps);
|
|
162
|
+
r = after;
|
|
163
|
+
if (r.reason === 'outdated')
|
|
164
|
+
return r;
|
|
165
|
+
if (r.ready) {
|
|
166
|
+
deps.out(`provider: updated — Claude Code is ready (${r.executable}).`);
|
|
167
|
+
return r;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (r.reason === 'not_logged_in' && r.executable !== null) {
|
|
171
|
+
deps.out("provider: Claude Code is installed, but Looply's own profile is not signed in to your Claude account.");
|
|
172
|
+
if (!deps.interactive) {
|
|
173
|
+
deps.out(' Sign it in from a terminal: looply provider login');
|
|
174
|
+
deps.out(` (which runs: ${loginCommandLine(r.executable, deps.profile, deps.platform)})`);
|
|
175
|
+
return r;
|
|
176
|
+
}
|
|
177
|
+
deps.out('provider: signing in — follow the steps Claude Code shows (it may open your browser).');
|
|
178
|
+
const code = await deps.login(r.executable).catch((e) => {
|
|
179
|
+
deps.err(`provider: the sign-in could not start — ${e.message}`);
|
|
180
|
+
return 1;
|
|
181
|
+
});
|
|
182
|
+
r = readinessOf(deps);
|
|
183
|
+
if (r.ready) {
|
|
184
|
+
deps.out(`provider: signed in — Claude Code is ready (${r.detail}).`);
|
|
185
|
+
return r;
|
|
186
|
+
}
|
|
187
|
+
deps.err(`provider: still not signed in${code === 0 ? '' : ` (exit ${code})`}. Try again with \`looply provider login\`, or run: ` +
|
|
188
|
+
loginCommandLine(r.executable ?? '', deps.profile, deps.platform));
|
|
189
|
+
return r;
|
|
190
|
+
}
|
|
191
|
+
if (!r.ready)
|
|
192
|
+
deps.out(`provider: NOT READY (${r.reason}) — ${r.detail}. ${(0, provider_ready_1.fixFor)(r.reason)}.`);
|
|
193
|
+
return r;
|
|
194
|
+
}
|
|
195
|
+
async function providerCommand(argv, deps) {
|
|
196
|
+
const [verb = 'status', ...rest] = argv;
|
|
197
|
+
const yes = rest.includes('--yes') || rest.includes('-y');
|
|
198
|
+
const unknown = rest.filter((a) => a !== '--yes' && a !== '-y');
|
|
199
|
+
if (unknown.length > 0) {
|
|
200
|
+
deps.err(`looply provider: ${JSON.stringify(unknown[0])} — no idea what that means\n\n${exports.PROVIDER_USAGE}`);
|
|
201
|
+
return 64;
|
|
202
|
+
}
|
|
203
|
+
switch (verb) {
|
|
204
|
+
case 'status': {
|
|
205
|
+
const discovery = deps.discover();
|
|
206
|
+
const exe = discovery.found?.executable ?? null;
|
|
207
|
+
const version = exe === null ? null : deps.version(exe);
|
|
208
|
+
const r = (0, provider_ready_1.readinessFrom)(discovery, exe === null ? null : deps.checkAuth(exe), version);
|
|
209
|
+
if (discovery.found === null) {
|
|
210
|
+
deps.out('provider: Claude Code was not found. Looked in:');
|
|
211
|
+
for (const s of discovery.searched)
|
|
212
|
+
deps.out(` ${s}`);
|
|
213
|
+
}
|
|
214
|
+
describe(r, deps, version);
|
|
215
|
+
if (!r.ready)
|
|
216
|
+
deps.out(` to fix: ${(0, provider_ready_1.fixFor)(r.reason)}`);
|
|
217
|
+
return r.ready ? 0 : 1;
|
|
218
|
+
}
|
|
219
|
+
case 'install': {
|
|
220
|
+
const before = readinessOf(deps);
|
|
221
|
+
if (before.reason !== 'not_installed') {
|
|
222
|
+
deps.out(`provider: Claude Code is already installed (${before.executable}).`);
|
|
223
|
+
if (!before.ready)
|
|
224
|
+
deps.out(` ${(0, provider_ready_1.fixFor)(before.reason)}.`);
|
|
225
|
+
return 0;
|
|
226
|
+
}
|
|
227
|
+
if (!yes && !deps.interactive) {
|
|
228
|
+
deps.err(`looply provider install: there is no terminal to confirm on. Re-run with --yes, or run: ${exports.INSTALL_COMMAND}`);
|
|
229
|
+
return 1;
|
|
230
|
+
}
|
|
231
|
+
const r = await ensureProviderReady(deps, { yes });
|
|
232
|
+
return r.reason === 'not_installed' ? 1 : 0;
|
|
233
|
+
}
|
|
234
|
+
case 'update': {
|
|
235
|
+
const before = readinessOf(deps);
|
|
236
|
+
if (before.reason === 'not_installed') {
|
|
237
|
+
deps.err('looply provider update: Claude Code is not installed yet — run `looply provider install`.');
|
|
238
|
+
return 1;
|
|
239
|
+
}
|
|
240
|
+
if (!yes && !deps.interactive) {
|
|
241
|
+
deps.err(`looply provider update: there is no terminal to confirm on. Re-run with --yes, or run: ${exports.UPDATE_COMMAND}`);
|
|
242
|
+
return 1;
|
|
243
|
+
}
|
|
244
|
+
// Run even when it is new enough: the person asked for the latest.
|
|
245
|
+
const after = await runUpdate(deps);
|
|
246
|
+
if (after === null)
|
|
247
|
+
return 1;
|
|
248
|
+
describe(after, deps, after.executable === null ? null : deps.version(after.executable));
|
|
249
|
+
if (!after.ready && after.reason !== 'outdated')
|
|
250
|
+
deps.out(` to fix: ${(0, provider_ready_1.fixFor)(after.reason)}`);
|
|
251
|
+
return after.reason === 'outdated' ? 1 : 0;
|
|
252
|
+
}
|
|
253
|
+
case 'login': {
|
|
254
|
+
const r = readinessOf(deps);
|
|
255
|
+
if (r.reason === 'not_installed' || r.executable === null) {
|
|
256
|
+
deps.err('looply provider login: Claude Code is not installed yet — run `looply provider install` first.');
|
|
257
|
+
return 1;
|
|
258
|
+
}
|
|
259
|
+
if (!deps.interactive) {
|
|
260
|
+
deps.err('looply provider login: signing in needs a terminal. Run this in one:');
|
|
261
|
+
deps.err(` ${loginCommandLine(r.executable, deps.profile, deps.platform)}`);
|
|
262
|
+
return 1;
|
|
263
|
+
}
|
|
264
|
+
// Run even when already signed in: the person asked, perhaps for another account.
|
|
265
|
+
const code = await deps.login(r.executable);
|
|
266
|
+
const after = readinessOf(deps);
|
|
267
|
+
describe(after, deps);
|
|
268
|
+
return after.ready ? 0 : code === 0 ? 1 : code;
|
|
269
|
+
}
|
|
270
|
+
default:
|
|
271
|
+
deps.err(`looply provider: unknown action ${JSON.stringify(verb)}\n\n${exports.PROVIDER_USAGE}`);
|
|
272
|
+
return 64;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/* ───────────────────────────────────────────────────────── the real machine ── */
|
|
276
|
+
/**
|
|
277
|
+
* `npm-cli.js` of the node running Looply — run with this node, never `npm` by
|
|
278
|
+
* name: on Windows that is a `.cmd` needing a shell, looked up in the current
|
|
279
|
+
* directory first.
|
|
280
|
+
*/
|
|
281
|
+
/* istanbul ignore next — real fs */
|
|
282
|
+
function npmCli() {
|
|
283
|
+
const p = process.platform === 'win32' ? node_path_1.win32 : node_path_1.posix;
|
|
284
|
+
let nodeDir;
|
|
285
|
+
try {
|
|
286
|
+
nodeDir = p.dirname((0, node_fs_1.realpathSync)(process.execPath));
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
nodeDir = p.dirname(process.execPath);
|
|
290
|
+
}
|
|
291
|
+
return ([
|
|
292
|
+
p.join(nodeDir, 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
293
|
+
p.join(p.dirname(nodeDir), 'lib', 'node_modules', 'npm', 'bin', 'npm-cli.js'),
|
|
294
|
+
].find((c) => (0, node_fs_1.existsSync)(c)) ?? null);
|
|
295
|
+
}
|
|
296
|
+
/* istanbul ignore next — real tty */
|
|
297
|
+
async function askOnce(prompt) {
|
|
298
|
+
const asker = (0, setup_prompt_1.nodeAsker)();
|
|
299
|
+
try {
|
|
300
|
+
return await asker.question(prompt);
|
|
301
|
+
}
|
|
302
|
+
finally {
|
|
303
|
+
asker.close();
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/* istanbul ignore next — real process */
|
|
307
|
+
function foreground(exe, args, env) {
|
|
308
|
+
return new Promise((resolve, reject) => {
|
|
309
|
+
// In the person's own terminal (inherited stdio), from their home rather
|
|
310
|
+
// than whatever project they stood in. `windowsHide` opens no extra window.
|
|
311
|
+
const child = (0, node_child_process_1.spawn)(exe, [...args], { stdio: 'inherit', env, cwd: (0, node_os_1.homedir)(), windowsHide: true });
|
|
312
|
+
child.on('error', reject);
|
|
313
|
+
child.on('exit', (code) => resolve(code ?? 1));
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/* istanbul ignore next — real fs, tty and processes; the logic is above */
|
|
317
|
+
function nodeProviderDeps(opts = {}) {
|
|
318
|
+
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
319
|
+
const profile = (0, provider_state_1.providerProfileDir)();
|
|
320
|
+
return {
|
|
321
|
+
platform: process.platform,
|
|
322
|
+
interactive,
|
|
323
|
+
...(interactive ? { ask: opts.ask ?? askOnce } : {}),
|
|
324
|
+
profile,
|
|
325
|
+
discover: () => (0, provider_discovery_1.discoverProvider)(opts.configured),
|
|
326
|
+
checkAuth: (exe) => {
|
|
327
|
+
// The SAME environment and profile a run uses (as `doctor --provider` does).
|
|
328
|
+
const env = { ...(0, exec_domains_1.buildProviderEnv)((0, model_transport_1.providerSessionDir)((0, node_os_1.homedir)(), 'implementer')), CLAUDE_CONFIG_DIR: profile };
|
|
329
|
+
return (0, provider_state_1.checkProviderAuth)(exe, env);
|
|
330
|
+
},
|
|
331
|
+
version: (exe) => {
|
|
332
|
+
// Local and cheap: prints e.g. `2.1.197 (Claude Code)`, costs no model turn.
|
|
333
|
+
try {
|
|
334
|
+
const res = (0, node_child_process_1.spawnSync)(exe, ['--version'], {
|
|
335
|
+
encoding: 'utf8',
|
|
336
|
+
timeout: 15_000,
|
|
337
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
338
|
+
windowsHide: true,
|
|
339
|
+
});
|
|
340
|
+
if (res.error || res.status !== 0)
|
|
341
|
+
return null;
|
|
342
|
+
const v = (0, provider_ready_1.parseVersion)(`${res.stdout ?? ''}`);
|
|
343
|
+
return v === null ? null : v.join('.');
|
|
344
|
+
}
|
|
345
|
+
catch {
|
|
346
|
+
return null;
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
install: async () => {
|
|
350
|
+
const cli = npmCli();
|
|
351
|
+
if (cli === null)
|
|
352
|
+
throw new Error(`npm was not found beside ${process.execPath}`);
|
|
353
|
+
return foreground(process.execPath, [cli, 'i', '-g', '@anthropic-ai/claude-code@latest'], process.env);
|
|
354
|
+
},
|
|
355
|
+
login: (exe) => foreground(exe, ['auth', 'login'], { ...process.env, CLAUDE_CONFIG_DIR: profile }),
|
|
356
|
+
out: (line) => process.stdout.write(`${line}\n`),
|
|
357
|
+
err: (line) => process.stderr.write(`${line}\n`),
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
//# sourceMappingURL=provider-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-cmd.js","sourceRoot":"","sources":["../src/provider-cmd.ts"],"names":[],"mappings":";;;AA+DA,kCAKC;AAiCD,4CAIC;AAuBD,kDAuFC;AAED,0CA0EC;AAgDD,4CAuCC;AA1XD,2DAAsD;AACtD,qCAAmD;AACnD,qCAAkC;AAClC,yCAAyC;AACzC,iDAAkD;AAClD,uDAAuD;AACvD,6DAA8F;AAC9F,qDAA+F;AAC/F,qDAAiG;AACjG,iDAA2C;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AAEU,QAAA,cAAc,GAAG;IAC5B,uGAAuG;IACvG,oGAAoG;IACpG,oGAAoG;IACpG,kGAAkG;CACnG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,wFAAwF;AAC3E,QAAA,eAAe,GAAG,2CAA2C,CAAC;AAC3E,sFAAsF;AACzE,QAAA,cAAc,GAAG,uBAAe,CAAC;AAE9C,0FAA0F;AAC1F,MAAM,kBAAkB,GAAG,8EAA8E,CAAC;AAoB1G,SAAgB,WAAW,CAAC,IAA8D;IACxF,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClC,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,IAAA,8BAAa,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACpE,MAAM,GAAG,GAA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C,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;YACrB,IAAI,GAAG,KAAK,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YAClF,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,kCAAkC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QACzG,CAAC;QACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClG,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;QAChD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHERE CLAUDE CODE IS ON THIS MACHINE.
|
|
3
|
+
*
|
|
4
|
+
* Looply used to look in exactly one place — `<dir of realpath(node.exe)>/
|
|
5
|
+
* node_modules/@anthropic-ai/claude-code/bin/claude.exe` — and MEASURED ON A
|
|
6
|
+
* REAL MACHINE (2026-10-14/15) that missed it: nvm-managed node, a different
|
|
7
|
+
* npm prefix, and Anthropic's own native installer all put the provider
|
|
8
|
+
* somewhere else, and the person was told nothing.
|
|
9
|
+
*
|
|
10
|
+
* So the search is a list, in a fixed order, and the first hit wins:
|
|
11
|
+
*
|
|
12
|
+
* 1. `config` `agent.executable`, when a person named one
|
|
13
|
+
* 2. `npm_global` `npm root -g` (cached per process), plus `%APPDATA%\npm` on Windows
|
|
14
|
+
* 3. `beside_node` the npm prefix of the node that runs Looply (the old, only, lookup)
|
|
15
|
+
* 4. `native_installer` `~/.local/bin/claude(.exe)` and the legacy `~/.claude/local` install
|
|
16
|
+
* 5. `path` `claude` on PATH — `.cmd`/`.ps1` shims resolved to the real executable
|
|
17
|
+
*
|
|
18
|
+
* ⚠️ PATH IS SEARCHED BY HAND, NEVER BY `where`/`which`. `where` (and Windows'
|
|
19
|
+
* own lookup) tries the CURRENT DIRECTORY first, and a daemon's current
|
|
20
|
+
* directory is a project the model may write to — the same hole `gitBinary`
|
|
21
|
+
* and the absolute `taskkill.exe` close. Relative PATH entries are skipped for
|
|
22
|
+
* the same reason.
|
|
23
|
+
*
|
|
24
|
+
* Every package hit keeps its PACKAGE DIRECTORY: the contained agent is granted
|
|
25
|
+
* that directory and nothing beside it (see `agent-contained.ts`). A native
|
|
26
|
+
* installer's binary has no package; `packageDir` is then null and the caller
|
|
27
|
+
* grants the executable file alone.
|
|
28
|
+
*/
|
|
29
|
+
export type ProviderSource = 'config' | 'npm_global' | 'beside_node' | 'native_installer' | 'path';
|
|
30
|
+
export interface ProviderLocation {
|
|
31
|
+
/** The executable a run spawns. */
|
|
32
|
+
readonly executable: string;
|
|
33
|
+
/** The npm package it lives in, or null for a self-contained (native) binary. */
|
|
34
|
+
readonly packageDir: string | null;
|
|
35
|
+
readonly source: ProviderSource;
|
|
36
|
+
}
|
|
37
|
+
export interface ProviderDiscovery {
|
|
38
|
+
readonly found: ProviderLocation | null;
|
|
39
|
+
/** Every place looked, in order — for `looply provider status` when nothing was found. */
|
|
40
|
+
readonly searched: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
export interface DiscoveryDeps {
|
|
43
|
+
platform: NodeJS.Platform;
|
|
44
|
+
env: Record<string, string | undefined>;
|
|
45
|
+
home: string;
|
|
46
|
+
/** `process.execPath`. */
|
|
47
|
+
nodeExe: string;
|
|
48
|
+
isFile(path: string): boolean;
|
|
49
|
+
/** Throws when the path does not resolve. */
|
|
50
|
+
realpath(path: string): string;
|
|
51
|
+
/** A small text file's contents, or null. */
|
|
52
|
+
readText(path: string): string | null;
|
|
53
|
+
/** `npm root -g`, or null when npm could not answer. */
|
|
54
|
+
npmRoot(): string | null;
|
|
55
|
+
}
|
|
56
|
+
/** Human words for a source, for `provider status` and `doctor --provider`. */
|
|
57
|
+
export declare const SOURCE_WORDS: Readonly<Record<ProviderSource, string>>;
|
|
58
|
+
/**
|
|
59
|
+
* The package directory an executable lives in, when it is `…/@anthropic-ai/claude-code/bin/claude.exe`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function packageDirOf(executable: string, platform?: NodeJS.Platform): string | null;
|
|
62
|
+
export declare function discoverProvider(configured: string | undefined, deps?: DiscoveryDeps): ProviderDiscovery;
|
|
63
|
+
/**
|
|
64
|
+
* `npm root -g`, asked once per process.
|
|
65
|
+
*
|
|
66
|
+
* Run as `node npm-cli.js root -g` with this node — never `npm` by name, which
|
|
67
|
+
* on Windows is a `.cmd` that needs a shell and is looked up from the current
|
|
68
|
+
* directory first. Hidden, bounded, from the home directory. An npm that
|
|
69
|
+
* cannot be found or does not answer is null, and the other sources still run.
|
|
70
|
+
*/
|
|
71
|
+
export declare function nodeNpmRoot(): string | null;
|
|
72
|
+
export declare function nodeDiscoveryDeps(): DiscoveryDeps;
|
|
73
|
+
/** The built-in provider's executable, wherever it is installed; null when none was found. */
|
|
74
|
+
export declare function claudeExecutable(configured?: string): string | null;
|
|
75
|
+
//# sourceMappingURL=provider-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-discovery.d.ts","sourceRoot":"","sources":["../src/provider-discovery.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;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