@apilift/cli 1.4.15 → 1.4.18
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/apilift.js
CHANGED
|
@@ -34327,12 +34327,21 @@ function command5(binary, args) {
|
|
|
34327
34327
|
}
|
|
34328
34328
|
}
|
|
34329
34329
|
function active(agent2, expected) {
|
|
34330
|
+
const args = agent2 === "codex" ? ["plugin", "list", "--marketplace", "personal", "--json"] : ["plugin", "list", "--json"];
|
|
34330
34331
|
try {
|
|
34331
|
-
const listed = command5(agent2,
|
|
34332
|
-
const entries = agent2 === "codex" ? listed
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
return false;
|
|
34332
|
+
const listed = command5(agent2, args);
|
|
34333
|
+
const entries = agent2 === "codex" ? listed?.installed : listed;
|
|
34334
|
+
if (!Array.isArray(entries) || entries.some((entry2) => typeof entry2 !== "object" || entry2 === null || typeof (agent2 === "codex" ? entry2.pluginId : entry2.id) !== "string")) return { ready: false, known: false, detail: `${agent2} plugin status could not be checked: plugin list returned an unexpected response` };
|
|
34335
|
+
const plugin = entries.find((entry2) => (agent2 === "codex" ? entry2.pluginId : entry2.id) === "apilift@personal");
|
|
34336
|
+
if (!plugin) return { ready: false, known: true, detail: "Apilift is not installed in this agent" };
|
|
34337
|
+
if (typeof plugin.enabled !== "boolean" || typeof plugin.version !== "string") return { ready: false, known: false, detail: `${agent2} plugin status could not be checked: Apilift status is incomplete` };
|
|
34338
|
+
if (!plugin.enabled) return { ready: false, known: true, detail: "Apilift is disabled in this agent" };
|
|
34339
|
+
if (plugin.version !== expected) return { ready: false, known: true, detail: "The active Apilift plugin does not match the packaged version" };
|
|
34340
|
+
return { ready: true, known: true, detail: "Agent setup skill is active" };
|
|
34341
|
+
} catch (error62) {
|
|
34342
|
+
const code = typeof error62 === "object" && error62 && "code" in error62 ? error62.code : void 0;
|
|
34343
|
+
const reason = code === "ETIMEDOUT" ? "plugin list timed out after 10 seconds" : code === "ENOENT" ? `${agent2} executable was not found` : "plugin list failed";
|
|
34344
|
+
return { ready: false, known: false, detail: `${agent2} plugin status could not be checked: ${reason}` };
|
|
34336
34345
|
}
|
|
34337
34346
|
}
|
|
34338
34347
|
function inspectAgentPlugin(agent2, env, sourceOverride) {
|
|
@@ -34349,7 +34358,8 @@ function inspectAgentPlugin(agent2, env, sourceOverride) {
|
|
|
34349
34358
|
const staged = marker?.package === "apilift" && marker.bundleDigest === bundleDigest && marker.version === version2 && existsSync4(join12(plugin, "skills", "setup", "SKILL.md"));
|
|
34350
34359
|
if (!staged) return { ready: false, version: expected, detail: "Agent setup skill is missing or stale" };
|
|
34351
34360
|
if (env.APILIFT_AGENT_HOME || env.APILIFT_AGENT_NO_ACTIVATE === "1") return { ready: false, version: expected, detail: "Agent setup skill is staged; activation is unverified" };
|
|
34352
|
-
|
|
34361
|
+
const activation = active(agent2, expected);
|
|
34362
|
+
return { ready: activation.ready, version: expected, detail: activation.detail, checkFailed: !activation.known };
|
|
34353
34363
|
}
|
|
34354
34364
|
function ensureAgentPlugin(agent2, env, sourceOverride) {
|
|
34355
34365
|
if (env.APILIFT_DEV_PLUGIN_ROOT) {
|
|
@@ -34400,7 +34410,10 @@ function ensureAgentPlugin(agent2, env, sourceOverride) {
|
|
|
34400
34410
|
writeJson(marketplacePath, document);
|
|
34401
34411
|
writeJson(join12(marketplace, ".claude-plugin", "marketplace.json"), { "$schema": "https://anthropic.com/claude-code/marketplace.schema.json", name: "personal", description: "Personal agent plugins", owner: { name: "Local" }, plugins: [{ name: "apilift", description: "Apilift setup", source: "./plugins/apilift", category: "development" }] });
|
|
34402
34412
|
if (env.APILIFT_AGENT_HOME || env.APILIFT_AGENT_NO_ACTIVATE === "1") return { ready: false, version: expected, detail: `Plugin staged at ${plugin}; activation is disabled` };
|
|
34403
|
-
|
|
34413
|
+
const initial = active(agent2, expected);
|
|
34414
|
+
if (!initial.known) return { ready: false, version: expected, detail: initial.detail, checkFailed: true };
|
|
34415
|
+
if (initial.ready) return { ready: true, version: expected, detail: initial.detail };
|
|
34416
|
+
{
|
|
34404
34417
|
if (agent2 === "codex") command5("codex", ["plugin", "add", "apilift@personal"]);
|
|
34405
34418
|
else {
|
|
34406
34419
|
let marketplaces;
|
|
@@ -34416,8 +34429,8 @@ function ensureAgentPlugin(agent2, env, sourceOverride) {
|
|
|
34416
34429
|
command5("claude", ["plugin", "enable", "apilift@personal", "--scope", "user"]);
|
|
34417
34430
|
}
|
|
34418
34431
|
}
|
|
34419
|
-
|
|
34420
|
-
return { ready:
|
|
34432
|
+
const activation = active(agent2, expected);
|
|
34433
|
+
return { ready: activation.ready, version: expected, detail: activation.detail, checkFailed: !activation.known };
|
|
34421
34434
|
}
|
|
34422
34435
|
var markerName;
|
|
34423
34436
|
var init_plugin = __esm({
|
|
@@ -37304,6 +37317,37 @@ var init_setup_check = __esm({
|
|
|
37304
37317
|
}
|
|
37305
37318
|
});
|
|
37306
37319
|
|
|
37320
|
+
// src/setup-guidance.ts
|
|
37321
|
+
function extensionUserMessage(extensionPath) {
|
|
37322
|
+
const installation = extensionPath ? `1. In Chrome, open \`chrome://extensions\`.
|
|
37323
|
+
2. Turn on **Developer mode**, click **Load unpacked**, and select \`${extensionPath}\`.` : `1. In Chrome, open [Apilift in the Chrome Web Store](${extensionUrl}).
|
|
37324
|
+
2. Click **Add to Chrome**, then **Add extension**.`;
|
|
37325
|
+
return `Add Apilift to Chrome so it can work with the apps you\u2019re signed in to.
|
|
37326
|
+
|
|
37327
|
+
${installation}
|
|
37328
|
+
3. Keep Chrome open in that profile.
|
|
37329
|
+
4. Return to this chat and say **Continue Apilift setup**.
|
|
37330
|
+
|
|
37331
|
+
If Apilift is already installed, open \`chrome://extensions\`, turn on its switch, then return here and say **Continue Apilift setup**.`;
|
|
37332
|
+
}
|
|
37333
|
+
function browserUserMessage(agent2) {
|
|
37334
|
+
const instructions = agent2 === "codex" ? "1. In Codex, click **Settings \u2192 Computer Use \u2192 Google Chrome** (under **More browsers** if needed).\n2. Click **Install**. In Chrome, click **Add to Chrome**, then **Add extension** for ChatGPT. If Chrome already shows **Manage**, skip this step.\n3. Return to **Computer Use**, confirm Chrome shows **Manage**, and turn on its toggle. Use the Chrome profile where Apilift is installed." : "1. In Claude Code, enter `/chrome`.\n2. Choose **Install extension**. In Chrome, click **Add to Chrome**, then **Add extension**. If it is already installed, choose **Reconnect extension** instead.\n3. Run `/chrome` again and confirm **Status: Enabled** and **Extension: Installed**.";
|
|
37335
|
+
const docs = agent2 === "codex" ? "https://learn.chatgpt.com/docs/chrome-extension" : "https://code.claude.com/docs/en/chrome";
|
|
37336
|
+
return `Connect Chrome to ${agent2 === "codex" ? "Codex" : "Claude Code"} so your agent can finish the setup check.
|
|
37337
|
+
|
|
37338
|
+
${instructions}
|
|
37339
|
+
4. Keep Chrome open, return to this chat, and ${agent2 === "codex" ? "select **@Chrome** and send **Continue Apilift setup**" : "say **Continue Apilift setup**"}.
|
|
37340
|
+
|
|
37341
|
+
[Official instructions](${docs}).`;
|
|
37342
|
+
}
|
|
37343
|
+
var extensionUrl;
|
|
37344
|
+
var init_setup_guidance = __esm({
|
|
37345
|
+
"src/setup-guidance.ts"() {
|
|
37346
|
+
"use strict";
|
|
37347
|
+
extensionUrl = "https://chromewebstore.google.com/detail/fcndhdoedflmfmckkgpkdhmglgepbhnd";
|
|
37348
|
+
}
|
|
37349
|
+
});
|
|
37350
|
+
|
|
37307
37351
|
// src/cli.ts
|
|
37308
37352
|
var cli_exports = {};
|
|
37309
37353
|
__export(cli_exports, {
|
|
@@ -37443,11 +37487,16 @@ Fix the agent plugin installation and retry:
|
|
|
37443
37487
|
${prefix} setup continue
|
|
37444
37488
|
`);
|
|
37445
37489
|
}
|
|
37446
|
-
if (!plugin.ready)
|
|
37447
|
-
|
|
37448
|
-
|
|
37490
|
+
if (!plugin.ready) {
|
|
37491
|
+
const checkCommand = session.agent === "codex" ? "codex plugin list --marketplace personal --json" : "claude plugin list --json";
|
|
37492
|
+
const next = plugin.checkFailed ? `Activation is unknown. Diagnose the check before changing the installation:
|
|
37493
|
+
${checkCommand}
|
|
37494
|
+
Then retry:` : "Agent setup skill readiness has not been recorded. Activate the installed Apilift plugin, then retry:";
|
|
37495
|
+
return result2("", 5, `${plugin.checkFailed ? "plugin-check-failed" : "plugin-not-ready"} \u2014 ${plugin.detail}.
|
|
37496
|
+
${next}
|
|
37449
37497
|
${prefix} setup continue
|
|
37450
37498
|
`);
|
|
37499
|
+
}
|
|
37451
37500
|
await api.call("updateReadiness", { body: { agent: session.agent, agentState: { skillsReady: true, skillsVersion: plugin.version } } });
|
|
37452
37501
|
try {
|
|
37453
37502
|
await hostRegistrar(dataRoot(env), site, env);
|
|
@@ -37458,11 +37507,8 @@ Fix the local Chrome registration and retry:
|
|
|
37458
37507
|
`);
|
|
37459
37508
|
}
|
|
37460
37509
|
const readiness2 = await api.call("updateReadiness", { body: {} });
|
|
37461
|
-
if (!readiness2.machine.nativeHostReady || !readiness2.machine.extensionReady) return result2(
|
|
37462
|
-
|
|
37463
|
-
Then run:
|
|
37464
|
-
${prefix} setup continue
|
|
37465
|
-
`);
|
|
37510
|
+
if (!readiness2.machine.nativeHostReady || !readiness2.machine.extensionReady) return { ...result2(`${JSON.stringify({ action: "user", userMessage: extensionUserMessage(env.APILIFT_DEV_EXTENSION_PATH), resumeCommand: `${prefix} setup continue` })}
|
|
37511
|
+
`), stdoutJson: true };
|
|
37466
37512
|
const agentState = readiness2.agents[session.agent];
|
|
37467
37513
|
if (agentState?.verified) return result2(`Setup is verified for this agent. Continue the app work you were working on.
|
|
37468
37514
|
`);
|
|
@@ -37473,14 +37519,8 @@ Then run:
|
|
|
37473
37519
|
} catch (error62) {
|
|
37474
37520
|
check2 = { ok: false, reason: `Browser bridge check failed (${typeof error62 === "object" && error62 && "code" in error62 ? String(error62.code) : "unavailable"})` };
|
|
37475
37521
|
}
|
|
37476
|
-
if (!check2.ok) return result2(
|
|
37477
|
-
|
|
37478
|
-
Use this agent's browser tool to open this exact check URL in Chrome and keep the tab open:
|
|
37479
|
-
${challenge.url}
|
|
37480
|
-
Then run:
|
|
37481
|
-
${prefix} setup continue
|
|
37482
|
-
The check uses one safe GET request and changes no app state.
|
|
37483
|
-
`);
|
|
37522
|
+
if (!check2.ok) return { ...result2(`${JSON.stringify({ action: "agent", reason: check2.reason, instruction: "Use this agent's browser tool to open the exact check URL in Chrome, wait for it to load, keep the tab open, then run resumeCommand. The check uses one safe GET request and changes no app state.", browserUrl: challenge.url, resumeCommand: `${prefix} setup continue`, onBrowserUnavailable: { action: "user", userMessage: browserUserMessage(session.agent) } })}
|
|
37523
|
+
`), stdoutJson: true };
|
|
37484
37524
|
await recordVerified(api, session.agent);
|
|
37485
37525
|
return result2(`The exact check tab responded to a safe browser replay. Setup is verified for this agent. Continue the app work you were working on.
|
|
37486
37526
|
`);
|
|
@@ -37624,6 +37664,7 @@ var init_cli = __esm({
|
|
|
37624
37664
|
init_update();
|
|
37625
37665
|
init_version();
|
|
37626
37666
|
init_setup_check();
|
|
37667
|
+
init_setup_guidance();
|
|
37627
37668
|
}
|
|
37628
37669
|
});
|
|
37629
37670
|
|
|
@@ -7,4 +7,6 @@ description: Link Apilift to this agent and check installation readiness.
|
|
|
7
7
|
|
|
8
8
|
Run `apilift` and follow the commands it prints. If it reports that linking is needed, run `apilift setup` and follow its returned step. Only a person can sign in, enter a one-time link code, provision a credential, or complete browser login. Use `apilift doctor` when setup or a selected app reports an installation problem.
|
|
9
9
|
|
|
10
|
+
Only a person installs or enables browser extensions and configures the agent’s Chrome connection. Never attempt those actions through browser tools. When setup returns `action: "user"`, send its `userMessage` unchanged as your entire response and wait. Resume with its `resumeCommand` when the user returns. For `action: "agent"`, perform the browser check yourself; if Chrome tools are unavailable, send `onBrowserUnavailable.userMessage` unchanged and wait.
|
|
11
|
+
|
|
10
12
|
Keep the user's authorized outcome as the completion condition. Use a first-party CLI, SDK, MCP server, or documented API when it already covers the work. Do not copy credential values into commands, definitions, files, or messages. Do not repeat a possibly dispatched mutation after lost output; follow the exact recovery command and inspect app state through an authorized read. If the runtime lacks a stable agent identity, put the same root `--session <worker-label>` before every command in this worker's session; independent workers need different labels.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apilift/cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.18",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=24.16.0 <27"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "9e58defbcf686d3c286905b6d1e24cc20b09ce08",
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
42
|
"url": "git+https://github.com/egor-sergeev/apilift.git",
|