@withone/cli 2.3.1 → 2.3.2
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/{chunk-IPAVHPRZ.js → chunk-7FPQOAQ4.js} +1 -1
- package/dist/{chunk-FUCAK5RA.js → chunk-NOFJ4NYD.js} +19 -1
- package/dist/{chunk-SN6WYDOE.js → chunk-XKUTG7JD.js} +1 -1
- package/dist/index.js +140 -140
- package/dist/{migrate-GN3I6EZM.js → migrate-3LSEIPRF.js} +2 -2
- package/dist/{schema-G7XYVIZG.js → schema-FICQRMZ7.js} +1 -1
- package/dist/{sql-6I4LWPZF.js → sql-AKQSXRV2.js} +2 -2
- package/package.json +1 -1
|
@@ -23,13 +23,31 @@ function silenceWarningsInAgentMode() {
|
|
|
23
23
|
process.emitWarning = (() => {
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
+
var SPINNER_CHROME = 6;
|
|
27
|
+
function fitSpinnerMessage(msg, columns) {
|
|
28
|
+
if (!columns || columns <= 0) return msg;
|
|
29
|
+
const room = columns - SPINNER_CHROME;
|
|
30
|
+
const chars = Array.from(msg);
|
|
31
|
+
if (chars.length <= room) return msg;
|
|
32
|
+
return room > 1 ? `${chars.slice(0, room - 1).join("")}\u2026` : "";
|
|
33
|
+
}
|
|
26
34
|
function createSpinner() {
|
|
27
35
|
if (isAgentMode()) {
|
|
28
36
|
return { start() {
|
|
29
37
|
}, stop() {
|
|
30
38
|
} };
|
|
31
39
|
}
|
|
32
|
-
|
|
40
|
+
if (!process.stdout.isTTY) {
|
|
41
|
+
return {
|
|
42
|
+
start: (msg) => p.log.step(msg),
|
|
43
|
+
stop: (msg) => p.log.message(msg)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const spinner2 = p.spinner();
|
|
47
|
+
return {
|
|
48
|
+
start: (msg) => spinner2.start(fitSpinnerMessage(msg, process.stdout.columns)),
|
|
49
|
+
stop: (msg) => spinner2.stop(msg)
|
|
50
|
+
};
|
|
33
51
|
}
|
|
34
52
|
function intro2(msg) {
|
|
35
53
|
if (!isAgentMode()) p.intro(msg);
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from "./chunk-6FA7KUNQ.js";
|
|
32
32
|
import {
|
|
33
33
|
memSqlCommand
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7FPQOAQ4.js";
|
|
35
35
|
import {
|
|
36
36
|
collectIdentityKeys,
|
|
37
37
|
countRecords,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
writeDraftProfile,
|
|
63
63
|
writePageToMemory,
|
|
64
64
|
writeProfile
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-XKUTG7JD.js";
|
|
66
66
|
import {
|
|
67
67
|
getByDotPath
|
|
68
68
|
} from "./chunk-44CV5IMX.js";
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
semanticSearchUpgradeLine,
|
|
87
87
|
setAgentMode,
|
|
88
88
|
silenceWarningsInAgentMode
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-NOFJ4NYD.js";
|
|
90
90
|
import {
|
|
91
91
|
SCHEMA_VERSION,
|
|
92
92
|
addRecord,
|
|
@@ -962,24 +962,24 @@ async function configCommand() {
|
|
|
962
962
|
p.outro("No changes made.");
|
|
963
963
|
return;
|
|
964
964
|
}
|
|
965
|
-
const
|
|
966
|
-
|
|
965
|
+
const spinner = createSpinner();
|
|
966
|
+
spinner.start("Validating API key...");
|
|
967
967
|
let isValid = false;
|
|
968
968
|
try {
|
|
969
969
|
const api = new OneApi(apiKey, `${normalized}/v1`);
|
|
970
970
|
isValid = Boolean(await api.validateApiKey());
|
|
971
971
|
} catch (err) {
|
|
972
|
-
|
|
972
|
+
spinner.stop("Connection failed");
|
|
973
973
|
const msg = err instanceof Error ? err.message : String(err);
|
|
974
974
|
p.log.error(`Could not reach ${pc2.cyan(normalized)}: ${msg}`);
|
|
975
975
|
return;
|
|
976
976
|
}
|
|
977
977
|
if (!isValid) {
|
|
978
|
-
|
|
978
|
+
spinner.stop("Invalid API key");
|
|
979
979
|
p.log.error(`Invalid API key for ${pc2.cyan(normalized)}.`);
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
spinner.stop("API key validated");
|
|
983
983
|
updateApiBase(normalized);
|
|
984
984
|
newApiKey = apiKey;
|
|
985
985
|
} else if (isCustomBase) {
|
|
@@ -998,24 +998,24 @@ async function configCommand() {
|
|
|
998
998
|
p.outro("No changes made.");
|
|
999
999
|
return;
|
|
1000
1000
|
}
|
|
1001
|
-
const
|
|
1002
|
-
|
|
1001
|
+
const spinner = createSpinner();
|
|
1002
|
+
spinner.start("Validating API key...");
|
|
1003
1003
|
let isValid = false;
|
|
1004
1004
|
try {
|
|
1005
1005
|
const api = new OneApi(apiKey, "https://api.withone.ai/v1");
|
|
1006
1006
|
isValid = Boolean(await api.validateApiKey());
|
|
1007
1007
|
} catch (err) {
|
|
1008
|
-
|
|
1008
|
+
spinner.stop("Connection failed");
|
|
1009
1009
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1010
1010
|
p.log.error(`Could not reach ${pc2.cyan("https://api.withone.ai")}: ${msg}`);
|
|
1011
1011
|
return;
|
|
1012
1012
|
}
|
|
1013
1013
|
if (!isValid) {
|
|
1014
|
-
|
|
1014
|
+
spinner.stop("Invalid API key");
|
|
1015
1015
|
p.log.error(`Invalid API key. Get a valid key at ${getApiKeyUrl()}`);
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
|
-
|
|
1018
|
+
spinner.stop("API key validated");
|
|
1019
1019
|
updateApiBase(null);
|
|
1020
1020
|
newApiKey = apiKey;
|
|
1021
1021
|
}
|
|
@@ -1053,16 +1053,16 @@ async function configCommand() {
|
|
|
1053
1053
|
p.outro("Configuration updated.");
|
|
1054
1054
|
}
|
|
1055
1055
|
async function selectConnections(apiKey) {
|
|
1056
|
-
const
|
|
1057
|
-
|
|
1056
|
+
const spinner = createSpinner();
|
|
1057
|
+
spinner.start("Fetching connections...");
|
|
1058
1058
|
let connections;
|
|
1059
1059
|
try {
|
|
1060
1060
|
const api = new OneApi(apiKey, getApiBase());
|
|
1061
1061
|
const rawConnections = await api.listConnections();
|
|
1062
1062
|
connections = rawConnections.map((c) => ({ platform: c.platform, key: c.key }));
|
|
1063
|
-
|
|
1063
|
+
spinner.stop(`Found ${connections.length} connection(s)`);
|
|
1064
1064
|
} catch {
|
|
1065
|
-
|
|
1065
|
+
spinner.stop("Could not fetch connections");
|
|
1066
1066
|
const manual = await p.text({
|
|
1067
1067
|
message: "Enter connection keys manually (comma-separated):",
|
|
1068
1068
|
placeholder: "conn_key_1, conn_key_2",
|
|
@@ -1635,7 +1635,7 @@ ${describeInstallContext(context)}`
|
|
|
1635
1635
|
await open2(authUrl);
|
|
1636
1636
|
} catch {
|
|
1637
1637
|
}
|
|
1638
|
-
spin.start("Waiting for
|
|
1638
|
+
spin.start("Waiting for browser sign-in (5 min timeout)");
|
|
1639
1639
|
const timeout = new Promise((_, reject) => {
|
|
1640
1640
|
const timer = setTimeout(() => {
|
|
1641
1641
|
reject(new Error("timeout"));
|
|
@@ -2109,16 +2109,16 @@ ${pc4.cyan(getApiKeyUrl())}`, `API Key ${scopeLabel(scope)}`);
|
|
|
2109
2109
|
process.exit(0);
|
|
2110
2110
|
}
|
|
2111
2111
|
newKey = inputKey;
|
|
2112
|
-
const
|
|
2113
|
-
|
|
2112
|
+
const spinner = createSpinner();
|
|
2113
|
+
spinner.start("Validating API key...");
|
|
2114
2114
|
const api = new OneApi(newKey, getApiBase());
|
|
2115
2115
|
const validated = await api.validateApiKey();
|
|
2116
2116
|
if (!validated) {
|
|
2117
|
-
|
|
2117
|
+
spinner.stop("Invalid API key");
|
|
2118
2118
|
p3.cancel(`Invalid API key. Get a valid key at ${getApiKeyUrl()}`);
|
|
2119
2119
|
process.exit(1);
|
|
2120
2120
|
}
|
|
2121
|
-
|
|
2121
|
+
spinner.stop("API key validated");
|
|
2122
2122
|
whoamiResult = validated;
|
|
2123
2123
|
}
|
|
2124
2124
|
const env = getEnvFromApiKey(newKey);
|
|
@@ -2335,10 +2335,10 @@ async function promptSkillInstall() {
|
|
|
2335
2335
|
p3.log.info("No agents selected.");
|
|
2336
2336
|
return false;
|
|
2337
2337
|
}
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2338
|
+
const spinner = createSpinner();
|
|
2339
|
+
spinner.start("Installing skill...");
|
|
2340
2340
|
const { installed, failed } = installSkillForAgents(selectedIds);
|
|
2341
|
-
|
|
2341
|
+
spinner.stop(installed.length > 0 ? "Skill installed" : "Installation failed");
|
|
2342
2342
|
for (const name of installed) {
|
|
2343
2343
|
p3.log.success(`${name}: ${pc4.green("\u2713")} skill installed`);
|
|
2344
2344
|
}
|
|
@@ -2434,16 +2434,16 @@ ${pc4.cyan(getApiKeyUrl())}`, `API Key ${scopeLabel(scope)}`);
|
|
|
2434
2434
|
process.exit(0);
|
|
2435
2435
|
}
|
|
2436
2436
|
apiKey = inputKey;
|
|
2437
|
-
const
|
|
2438
|
-
|
|
2437
|
+
const spinner = createSpinner();
|
|
2438
|
+
spinner.start("Validating API key...");
|
|
2439
2439
|
const api = new OneApi(apiKey, getApiBase());
|
|
2440
2440
|
const whoami = await api.validateApiKey();
|
|
2441
2441
|
if (!whoami) {
|
|
2442
|
-
|
|
2442
|
+
spinner.stop("Invalid API key");
|
|
2443
2443
|
p3.cancel(`Invalid API key. Get a valid key at ${getApiKeyUrl()}`);
|
|
2444
2444
|
process.exit(1);
|
|
2445
2445
|
}
|
|
2446
|
-
|
|
2446
|
+
spinner.stop("API key validated");
|
|
2447
2447
|
const env2 = getEnvFromApiKey(apiKey);
|
|
2448
2448
|
const contextParts = [];
|
|
2449
2449
|
if (whoami.organization) contextParts.push(whoami.organization.name);
|
|
@@ -2558,16 +2558,16 @@ async function promptConnectIntegrations(apiKey, connParams) {
|
|
|
2558
2558
|
p3.log.warn("Could not open browser automatically.");
|
|
2559
2559
|
p3.note(url, "Open manually");
|
|
2560
2560
|
}
|
|
2561
|
-
const
|
|
2562
|
-
|
|
2561
|
+
const spinner = createSpinner();
|
|
2562
|
+
spinner.start("Waiting for connection... (complete auth in browser)");
|
|
2563
2563
|
try {
|
|
2564
2564
|
await api.waitForConnection(platform, 5 * 60 * 1e3, 5e3);
|
|
2565
|
-
|
|
2565
|
+
spinner.stop(`${label} connected!`);
|
|
2566
2566
|
p3.log.success(`${pc4.green("\u2713")} ${label} is now available to your AI agents`);
|
|
2567
2567
|
connected.push(platform);
|
|
2568
2568
|
first = false;
|
|
2569
2569
|
} catch (error2) {
|
|
2570
|
-
|
|
2570
|
+
spinner.stop("Connection timed out");
|
|
2571
2571
|
if (error2 instanceof TimeoutError) {
|
|
2572
2572
|
p3.log.warn(`No worries. Connect later with: ${pc4.cyan(`one add ${platform}`)}`);
|
|
2573
2573
|
}
|
|
@@ -2719,14 +2719,14 @@ async function connectionAddCommand(platformArg, options) {
|
|
|
2719
2719
|
process.exit(1);
|
|
2720
2720
|
}
|
|
2721
2721
|
const api = new OneApi(apiKey, getApiBase());
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2722
|
+
const spinner = createSpinner();
|
|
2723
|
+
spinner.start("Loading platforms...");
|
|
2724
2724
|
let platforms;
|
|
2725
2725
|
try {
|
|
2726
2726
|
platforms = await api.listPlatforms();
|
|
2727
|
-
|
|
2727
|
+
spinner.stop(`${platforms.length} platforms available`);
|
|
2728
2728
|
} catch (error2) {
|
|
2729
|
-
|
|
2729
|
+
spinner.stop("Failed to load platforms");
|
|
2730
2730
|
p4.cancel(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
2731
2731
|
process.exit(1);
|
|
2732
2732
|
}
|
|
@@ -2798,14 +2798,14 @@ Run ${pc6.cyan("one platforms")} to see available platforms.`);
|
|
|
2798
2798
|
p4.note(`Open this URL manually:
|
|
2799
2799
|
${url}`);
|
|
2800
2800
|
}
|
|
2801
|
-
const pollSpinner =
|
|
2801
|
+
const pollSpinner = createSpinner();
|
|
2802
2802
|
pollSpinner.start("Waiting for connection... (complete auth in browser)");
|
|
2803
2803
|
try {
|
|
2804
2804
|
const connection2 = await api.waitForConnection(platform, 5 * 60 * 1e3, 5e3);
|
|
2805
2805
|
pollSpinner.stop(`${platform} connected!`);
|
|
2806
2806
|
const tag = options?.tag?.trim();
|
|
2807
2807
|
if (tag) {
|
|
2808
|
-
const tagSpinner =
|
|
2808
|
+
const tagSpinner = createSpinner();
|
|
2809
2809
|
tagSpinner.start(`Tagging connection "${tag}"...`);
|
|
2810
2810
|
try {
|
|
2811
2811
|
await api.updateConnectionTags(connection2.id, [tag]);
|
|
@@ -2844,8 +2844,8 @@ async function connectionListCommand(options) {
|
|
|
2844
2844
|
error("Not configured. Run `one init` first.");
|
|
2845
2845
|
}
|
|
2846
2846
|
const api = new OneApi(apiKey, getApiBase());
|
|
2847
|
-
const
|
|
2848
|
-
|
|
2847
|
+
const spinner = createSpinner();
|
|
2848
|
+
spinner.start("Loading connections...");
|
|
2849
2849
|
try {
|
|
2850
2850
|
const allConnections = await api.listConnections();
|
|
2851
2851
|
const ac = getAccessControlFromAllSources();
|
|
@@ -2887,7 +2887,7 @@ async function connectionListCommand(options) {
|
|
|
2887
2887
|
return;
|
|
2888
2888
|
}
|
|
2889
2889
|
const displayed = limitArg !== void 0 ? filtered.slice(0, limitArg) : filtered;
|
|
2890
|
-
|
|
2890
|
+
spinner.stop(`${filtered.length} connection${filtered.length === 1 ? "" : "s"} found`);
|
|
2891
2891
|
if (filtered.length === 0) {
|
|
2892
2892
|
if (searchQuery) {
|
|
2893
2893
|
p4.note(
|
|
@@ -2949,7 +2949,7 @@ Change it with: ${pc6.cyan("one config")}`, "Access");
|
|
|
2949
2949
|
p4.note(`Add more with: ${pc6.cyan("one connection add <platform>")}`, "Tip");
|
|
2950
2950
|
}
|
|
2951
2951
|
} catch (error2) {
|
|
2952
|
-
|
|
2952
|
+
spinner.stop("Failed to load connections");
|
|
2953
2953
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
2954
2954
|
}
|
|
2955
2955
|
}
|
|
@@ -2959,13 +2959,13 @@ async function connectionDeleteCommand(connectionKey, options) {
|
|
|
2959
2959
|
error("Not configured. Run `one init` first.");
|
|
2960
2960
|
}
|
|
2961
2961
|
const api = new OneApi(apiKey, getApiBase());
|
|
2962
|
-
const
|
|
2963
|
-
|
|
2962
|
+
const spinner = createSpinner();
|
|
2963
|
+
spinner.start("Finding connection...");
|
|
2964
2964
|
let allConnections;
|
|
2965
2965
|
try {
|
|
2966
2966
|
allConnections = await api.listConnections();
|
|
2967
2967
|
} catch (error2) {
|
|
2968
|
-
|
|
2968
|
+
spinner.stop("Failed to load connections");
|
|
2969
2969
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
2970
2970
|
return;
|
|
2971
2971
|
}
|
|
@@ -2974,12 +2974,12 @@ async function connectionDeleteCommand(connectionKey, options) {
|
|
|
2974
2974
|
const connections = allowedKeys.includes("*") ? allConnections : allConnections.filter((conn) => allowedKeys.includes(conn.key));
|
|
2975
2975
|
const match = connections.find((conn) => conn.key === connectionKey);
|
|
2976
2976
|
if (!match) {
|
|
2977
|
-
|
|
2977
|
+
spinner.stop("Connection not found");
|
|
2978
2978
|
error(`No connection found with key: ${connectionKey}`);
|
|
2979
2979
|
return;
|
|
2980
2980
|
}
|
|
2981
2981
|
const connection2 = match;
|
|
2982
|
-
|
|
2982
|
+
spinner.stop(`Found ${connection2.platform} (${connection2.state})`);
|
|
2983
2983
|
if (!isAgentMode() && !options?.force) {
|
|
2984
2984
|
console.log();
|
|
2985
2985
|
console.log(` ${getStatusIndicator(connection2.state)} ${connection2.platform} ${pc6.dim(connection2.key)}`);
|
|
@@ -3068,11 +3068,11 @@ async function platformsCommand(options) {
|
|
|
3068
3068
|
options.json = true;
|
|
3069
3069
|
}
|
|
3070
3070
|
const api = new OneApi(apiKey, getApiBase());
|
|
3071
|
-
const
|
|
3072
|
-
|
|
3071
|
+
const spinner = createSpinner();
|
|
3072
|
+
spinner.start("Loading platforms...");
|
|
3073
3073
|
try {
|
|
3074
3074
|
const platforms = await api.listPlatforms();
|
|
3075
|
-
|
|
3075
|
+
spinner.stop(`${platforms.length} platforms available`);
|
|
3076
3076
|
let filtered = platforms;
|
|
3077
3077
|
if (options.category) {
|
|
3078
3078
|
filtered = platforms.filter((plat) => (plat.category || "Other") === options.category);
|
|
@@ -3126,7 +3126,7 @@ async function platformsCommand(options) {
|
|
|
3126
3126
|
console.log();
|
|
3127
3127
|
p5.note(`Connect with: ${pc7.cyan("one connection add <platform>")}`, "Tip");
|
|
3128
3128
|
} catch (error2) {
|
|
3129
|
-
|
|
3129
|
+
spinner.stop("Failed to load platforms");
|
|
3130
3130
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
3131
3131
|
}
|
|
3132
3132
|
}
|
|
@@ -3954,8 +3954,8 @@ async function actionsFindCommand(pairs, options) {
|
|
|
3954
3954
|
const { apiKey, permissions, connectionKeys, actionIds, knowledgeAgent } = getConfig();
|
|
3955
3955
|
const api = new OneApi(apiKey, getApiBase());
|
|
3956
3956
|
const settings = { knowledgeAgent, permissions, actionIds, connectionKeys, apiBase: getApiBase() };
|
|
3957
|
-
const
|
|
3958
|
-
|
|
3957
|
+
const spinner = createSpinner();
|
|
3958
|
+
spinner.start(`Finding actions for ${requests.length} intent${requests.length === 1 ? "" : "s"}...`);
|
|
3959
3959
|
try {
|
|
3960
3960
|
const result = await find(
|
|
3961
3961
|
requests,
|
|
@@ -3968,12 +3968,12 @@ async function actionsFindCommand(pairs, options) {
|
|
|
3968
3968
|
json(result);
|
|
3969
3969
|
return;
|
|
3970
3970
|
}
|
|
3971
|
-
|
|
3971
|
+
spinner.stop("Found");
|
|
3972
3972
|
console.log();
|
|
3973
3973
|
console.log(renderFind(result));
|
|
3974
3974
|
console.log();
|
|
3975
3975
|
} catch (error2) {
|
|
3976
|
-
|
|
3976
|
+
spinner.stop("Find failed");
|
|
3977
3977
|
error(`Error: ${failure(error2)}`);
|
|
3978
3978
|
}
|
|
3979
3979
|
}
|
|
@@ -4002,20 +4002,20 @@ async function actionsLoadCommand(actionIds, options) {
|
|
|
4002
4002
|
const { apiKey, permissions, connectionKeys, actionIds: allowed, knowledgeAgent } = getConfig();
|
|
4003
4003
|
const api = new OneApi(apiKey, getApiBase());
|
|
4004
4004
|
const settings = { knowledgeAgent, permissions, actionIds: allowed, connectionKeys, apiBase: getApiBase() };
|
|
4005
|
-
const
|
|
4006
|
-
|
|
4005
|
+
const spinner = createSpinner();
|
|
4006
|
+
spinner.start(`Loading ${actionIds.length === 1 ? "the action" : `${actionIds.length} actions`}...`);
|
|
4007
4007
|
try {
|
|
4008
4008
|
const result = await load(actionIds, options, findDeps(api, connectionKeys, options.cache !== false), settings);
|
|
4009
4009
|
if (isAgentMode()) {
|
|
4010
4010
|
json(result);
|
|
4011
4011
|
return;
|
|
4012
4012
|
}
|
|
4013
|
-
|
|
4013
|
+
spinner.stop("Loaded");
|
|
4014
4014
|
console.log();
|
|
4015
4015
|
console.log(renderLoad(result));
|
|
4016
4016
|
console.log();
|
|
4017
4017
|
} catch (error2) {
|
|
4018
|
-
|
|
4018
|
+
spinner.stop("Load failed");
|
|
4019
4019
|
error(`Error: ${failure(error2)}`);
|
|
4020
4020
|
}
|
|
4021
4021
|
}
|
|
@@ -4034,17 +4034,17 @@ async function actionsExecuteCommand(platform, actionId, connectionKey, options)
|
|
|
4034
4034
|
error(`Connection key "${connectionKey}" is not allowed.`);
|
|
4035
4035
|
}
|
|
4036
4036
|
const api = new OneApi(apiKey, getApiBase());
|
|
4037
|
-
const
|
|
4038
|
-
|
|
4037
|
+
const spinner = createSpinner();
|
|
4038
|
+
spinner.start("Resolving action details...");
|
|
4039
4039
|
try {
|
|
4040
4040
|
const { details: actionDetails, cacheHit: preflightCacheHit } = await resolveActionDetails(api, actionId, { useCache: options.cache !== false });
|
|
4041
4041
|
if (!isMethodAllowed(actionDetails.method, permissions)) {
|
|
4042
|
-
|
|
4042
|
+
spinner.stop("Permission denied");
|
|
4043
4043
|
error(
|
|
4044
4044
|
`Method "${actionDetails.method}" is not allowed under "${permissions}" permission level.`
|
|
4045
4045
|
);
|
|
4046
4046
|
}
|
|
4047
|
-
|
|
4047
|
+
spinner.stop(
|
|
4048
4048
|
`Action: ${actionDetails.title} [${actionDetails.method}]` + (preflightCacheHit ? pc8.dim(" (cached)") : "")
|
|
4049
4049
|
);
|
|
4050
4050
|
const data = options.data ? parseJsonArg2(options.data, "--data") : void 0;
|
|
@@ -4054,7 +4054,7 @@ async function actionsExecuteCommand(platform, actionId, connectionKey, options)
|
|
|
4054
4054
|
if (!options.skipValidation) {
|
|
4055
4055
|
const validation = validateActionInput(actionDetails, { data, pathVariables, queryParams });
|
|
4056
4056
|
if (!validation.valid) {
|
|
4057
|
-
|
|
4057
|
+
spinner.stop("Validation failed");
|
|
4058
4058
|
if (isAgentMode()) {
|
|
4059
4059
|
json({
|
|
4060
4060
|
error: "Validation failed: missing required parameters",
|
|
@@ -4075,7 +4075,7 @@ async function actionsExecuteCommand(platform, actionId, connectionKey, options)
|
|
|
4075
4075
|
}
|
|
4076
4076
|
}
|
|
4077
4077
|
if (options.mock) {
|
|
4078
|
-
|
|
4078
|
+
spinner.stop("Mock \u2014 returning example response");
|
|
4079
4079
|
const mockResponse = actionDetails.ioSchema?.ioExample?.output ?? null;
|
|
4080
4080
|
if (isAgentMode()) {
|
|
4081
4081
|
json({
|
|
@@ -4159,7 +4159,7 @@ async function actionsExecuteCommand(platform, actionId, connectionKey, options)
|
|
|
4159
4159
|
}
|
|
4160
4160
|
}
|
|
4161
4161
|
} catch (error2) {
|
|
4162
|
-
|
|
4162
|
+
spinner.stop("Execution failed");
|
|
4163
4163
|
error(
|
|
4164
4164
|
`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`
|
|
4165
4165
|
);
|
|
@@ -5376,8 +5376,8 @@ async function flowExecuteCommand(keyOrPath, options) {
|
|
|
5376
5376
|
intro(pc9.bgCyan(pc9.black(" One Workflow ")));
|
|
5377
5377
|
const { apiKey, permissions, actionIds } = getConfig2();
|
|
5378
5378
|
const api = new OneApi(apiKey, getApiBase());
|
|
5379
|
-
const
|
|
5380
|
-
|
|
5379
|
+
const spinner = createSpinner();
|
|
5380
|
+
spinner.start(`Loading workflow "${keyOrPath}"...`);
|
|
5381
5381
|
let flow2;
|
|
5382
5382
|
let rootDir;
|
|
5383
5383
|
let flowFilePath;
|
|
@@ -5387,11 +5387,11 @@ async function flowExecuteCommand(keyOrPath, options) {
|
|
|
5387
5387
|
rootDir = loaded.rootDir;
|
|
5388
5388
|
flowFilePath = loaded.filePath;
|
|
5389
5389
|
} catch (err) {
|
|
5390
|
-
|
|
5390
|
+
spinner.stop("Workflow not found");
|
|
5391
5391
|
error(err instanceof Error ? err.message : String(err));
|
|
5392
5392
|
return;
|
|
5393
5393
|
}
|
|
5394
|
-
|
|
5394
|
+
spinner.stop(`Workflow: ${flow2.name} (${flow2.steps.length} steps)`);
|
|
5395
5395
|
const preflightErrors = validateFlow(flow2, rootDir);
|
|
5396
5396
|
if (preflightErrors.length > 0) {
|
|
5397
5397
|
if (isAgentMode()) {
|
|
@@ -5596,8 +5596,8 @@ async function flowListCommand() {
|
|
|
5596
5596
|
}
|
|
5597
5597
|
async function flowValidateCommand(keyOrPath) {
|
|
5598
5598
|
intro(pc9.bgCyan(pc9.black(" One Workflow ")));
|
|
5599
|
-
const
|
|
5600
|
-
|
|
5599
|
+
const spinner = createSpinner();
|
|
5600
|
+
spinner.start(`Validating "${keyOrPath}"...`);
|
|
5601
5601
|
let flowData;
|
|
5602
5602
|
let rootDir;
|
|
5603
5603
|
try {
|
|
@@ -5612,12 +5612,12 @@ async function flowValidateCommand(keyOrPath) {
|
|
|
5612
5612
|
rootDir = path7.dirname(flowPath);
|
|
5613
5613
|
}
|
|
5614
5614
|
} catch (err) {
|
|
5615
|
-
|
|
5615
|
+
spinner.stop("Validation failed");
|
|
5616
5616
|
error(`Could not read workflow: ${err instanceof Error ? err.message : String(err)}`);
|
|
5617
5617
|
}
|
|
5618
5618
|
const errors = validateFlow(flowData, rootDir);
|
|
5619
5619
|
if (errors.length > 0) {
|
|
5620
|
-
|
|
5620
|
+
spinner.stop("Validation failed");
|
|
5621
5621
|
if (isAgentMode()) {
|
|
5622
5622
|
json({ valid: false, errors });
|
|
5623
5623
|
process.exit(1);
|
|
@@ -5629,7 +5629,7 @@ async function flowValidateCommand(keyOrPath) {
|
|
|
5629
5629
|
console.log();
|
|
5630
5630
|
error(`${errors.length} validation error(s) found`);
|
|
5631
5631
|
}
|
|
5632
|
-
|
|
5632
|
+
spinner.stop("Workflow is valid");
|
|
5633
5633
|
if (isAgentMode()) {
|
|
5634
5634
|
json({ valid: true, key: flowData.key });
|
|
5635
5635
|
return;
|
|
@@ -5671,15 +5671,15 @@ async function flowResumeCommand(runId, options = {}) {
|
|
|
5671
5671
|
json(event);
|
|
5672
5672
|
}
|
|
5673
5673
|
};
|
|
5674
|
-
const
|
|
5675
|
-
|
|
5674
|
+
const spinner = createSpinner();
|
|
5675
|
+
spinner.start(`Resuming run ${runId} (${state.completedSteps.length} steps already completed)...`);
|
|
5676
5676
|
try {
|
|
5677
5677
|
const context = await runner.resume(flow2, api, permissions, actionIds, {
|
|
5678
5678
|
onEvent,
|
|
5679
5679
|
rootDir,
|
|
5680
5680
|
allowBash: options.allowBash
|
|
5681
5681
|
});
|
|
5682
|
-
|
|
5682
|
+
spinner.stop("Workflow completed");
|
|
5683
5683
|
if (isAgentMode()) {
|
|
5684
5684
|
json({
|
|
5685
5685
|
event: "workflow:result",
|
|
@@ -5693,7 +5693,7 @@ async function flowResumeCommand(runId, options = {}) {
|
|
|
5693
5693
|
console.log(` ${pc9.green("\u2713")} Resumed and completed successfully`);
|
|
5694
5694
|
console.log(` ${pc9.dim(`Log: ${runner.getLogPath()}`)}`);
|
|
5695
5695
|
} catch (error2) {
|
|
5696
|
-
|
|
5696
|
+
spinner.stop("Resume failed");
|
|
5697
5697
|
const errorMsg = error2 instanceof Error ? error2.message : String(error2);
|
|
5698
5698
|
if (isAgentMode()) {
|
|
5699
5699
|
json({ event: "workflow:result", runId, status: "failed", error: errorMsg });
|
|
@@ -6010,8 +6010,8 @@ async function relayCreateCommand(options) {
|
|
|
6010
6010
|
error(`Connection key "${options.connectionKey}" is not allowed.`);
|
|
6011
6011
|
}
|
|
6012
6012
|
const api = new OneApi(apiKey, getApiBase());
|
|
6013
|
-
const
|
|
6014
|
-
|
|
6013
|
+
const spinner = createSpinner();
|
|
6014
|
+
spinner.start("Creating relay endpoint...");
|
|
6015
6015
|
try {
|
|
6016
6016
|
const body = {
|
|
6017
6017
|
connectionKey: options.connectionKey
|
|
@@ -6026,7 +6026,7 @@ async function relayCreateCommand(options) {
|
|
|
6026
6026
|
json(result);
|
|
6027
6027
|
return;
|
|
6028
6028
|
}
|
|
6029
|
-
|
|
6029
|
+
spinner.stop("Relay endpoint created");
|
|
6030
6030
|
console.log();
|
|
6031
6031
|
console.log(` ${pc10.dim("ID:")} ${result.id}`);
|
|
6032
6032
|
console.log(` ${pc10.dim("URL:")} ${result.url}`);
|
|
@@ -6040,15 +6040,15 @@ async function relayCreateCommand(options) {
|
|
|
6040
6040
|
}
|
|
6041
6041
|
console.log();
|
|
6042
6042
|
} catch (error2) {
|
|
6043
|
-
|
|
6043
|
+
spinner.stop("Failed to create relay endpoint");
|
|
6044
6044
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6045
6045
|
}
|
|
6046
6046
|
}
|
|
6047
6047
|
async function relayListCommand(options) {
|
|
6048
6048
|
const { apiKey } = getConfig3();
|
|
6049
6049
|
const api = new OneApi(apiKey, getApiBase());
|
|
6050
|
-
const
|
|
6051
|
-
|
|
6050
|
+
const spinner = createSpinner();
|
|
6051
|
+
spinner.start("Loading relay endpoints...");
|
|
6052
6052
|
try {
|
|
6053
6053
|
const query = {};
|
|
6054
6054
|
if (options.limit) query.limit = options.limit;
|
|
@@ -6071,7 +6071,7 @@ async function relayListCommand(options) {
|
|
|
6071
6071
|
});
|
|
6072
6072
|
return;
|
|
6073
6073
|
}
|
|
6074
|
-
|
|
6074
|
+
spinner.stop(`${endpoints.length} relay endpoint${endpoints.length === 1 ? "" : "s"} found`);
|
|
6075
6075
|
if (endpoints.length === 0) {
|
|
6076
6076
|
console.log("\n No relay endpoints yet.\n");
|
|
6077
6077
|
return;
|
|
@@ -6093,22 +6093,22 @@ async function relayListCommand(options) {
|
|
|
6093
6093
|
}))
|
|
6094
6094
|
);
|
|
6095
6095
|
} catch (error2) {
|
|
6096
|
-
|
|
6096
|
+
spinner.stop("Failed to list relay endpoints");
|
|
6097
6097
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6098
6098
|
}
|
|
6099
6099
|
}
|
|
6100
6100
|
async function relayGetCommand(id) {
|
|
6101
6101
|
const { apiKey } = getConfig3();
|
|
6102
6102
|
const api = new OneApi(apiKey, getApiBase());
|
|
6103
|
-
const
|
|
6104
|
-
|
|
6103
|
+
const spinner = createSpinner();
|
|
6104
|
+
spinner.start("Loading relay endpoint...");
|
|
6105
6105
|
try {
|
|
6106
6106
|
const result = await api.getRelayEndpoint(id);
|
|
6107
6107
|
if (isAgentMode()) {
|
|
6108
6108
|
json(result);
|
|
6109
6109
|
return;
|
|
6110
6110
|
}
|
|
6111
|
-
|
|
6111
|
+
spinner.stop("Relay endpoint loaded");
|
|
6112
6112
|
console.log();
|
|
6113
6113
|
console.log(` ${pc10.dim("ID:")} ${result.id}`);
|
|
6114
6114
|
console.log(` ${pc10.dim("URL:")} ${result.url}`);
|
|
@@ -6124,15 +6124,15 @@ async function relayGetCommand(id) {
|
|
|
6124
6124
|
console.log(` ${pc10.dim("Created:")} ${result.createdAt}`);
|
|
6125
6125
|
console.log();
|
|
6126
6126
|
} catch (error2) {
|
|
6127
|
-
|
|
6127
|
+
spinner.stop("Failed to load relay endpoint");
|
|
6128
6128
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6129
6129
|
}
|
|
6130
6130
|
}
|
|
6131
6131
|
async function relayUpdateCommand(id, options) {
|
|
6132
6132
|
const { apiKey } = getConfig3();
|
|
6133
6133
|
const api = new OneApi(apiKey, getApiBase());
|
|
6134
|
-
const
|
|
6135
|
-
|
|
6134
|
+
const spinner = createSpinner();
|
|
6135
|
+
spinner.start("Updating relay endpoint...");
|
|
6136
6136
|
try {
|
|
6137
6137
|
const body = {};
|
|
6138
6138
|
if (options.description !== void 0) body.description = options.description;
|
|
@@ -6145,40 +6145,40 @@ async function relayUpdateCommand(id, options) {
|
|
|
6145
6145
|
json(result);
|
|
6146
6146
|
return;
|
|
6147
6147
|
}
|
|
6148
|
-
|
|
6148
|
+
spinner.stop("Relay endpoint updated");
|
|
6149
6149
|
console.log(` ${pc10.dim("ID:")} ${result.id}`);
|
|
6150
6150
|
console.log(` ${pc10.dim("Active:")} ${result.active}`);
|
|
6151
6151
|
console.log(` ${pc10.dim("Actions:")} ${result.actions?.length || 0}`);
|
|
6152
6152
|
console.log();
|
|
6153
6153
|
} catch (error2) {
|
|
6154
|
-
|
|
6154
|
+
spinner.stop("Failed to update relay endpoint");
|
|
6155
6155
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6156
6156
|
}
|
|
6157
6157
|
}
|
|
6158
6158
|
async function relayDeleteCommand(id) {
|
|
6159
6159
|
const { apiKey } = getConfig3();
|
|
6160
6160
|
const api = new OneApi(apiKey, getApiBase());
|
|
6161
|
-
const
|
|
6162
|
-
|
|
6161
|
+
const spinner = createSpinner();
|
|
6162
|
+
spinner.start("Deleting relay endpoint...");
|
|
6163
6163
|
try {
|
|
6164
6164
|
const result = await api.deleteRelayEndpoint(id);
|
|
6165
6165
|
if (isAgentMode()) {
|
|
6166
6166
|
json({ deleted: true, id: result.id });
|
|
6167
6167
|
return;
|
|
6168
6168
|
}
|
|
6169
|
-
|
|
6169
|
+
spinner.stop("Relay endpoint deleted");
|
|
6170
6170
|
console.log(` Deleted: ${result.id}`);
|
|
6171
6171
|
console.log();
|
|
6172
6172
|
} catch (error2) {
|
|
6173
|
-
|
|
6173
|
+
spinner.stop("Failed to delete relay endpoint");
|
|
6174
6174
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6175
6175
|
}
|
|
6176
6176
|
}
|
|
6177
6177
|
async function relayActivateCommand(id, options) {
|
|
6178
6178
|
const { apiKey } = getConfig3();
|
|
6179
6179
|
const api = new OneApi(apiKey, getApiBase());
|
|
6180
|
-
const
|
|
6181
|
-
|
|
6180
|
+
const spinner = createSpinner();
|
|
6181
|
+
spinner.start("Activating relay endpoint...");
|
|
6182
6182
|
try {
|
|
6183
6183
|
const actions2 = parseJsonArg3(options.actions, "--actions");
|
|
6184
6184
|
const body = { actions: actions2 };
|
|
@@ -6188,21 +6188,21 @@ async function relayActivateCommand(id, options) {
|
|
|
6188
6188
|
json(result);
|
|
6189
6189
|
return;
|
|
6190
6190
|
}
|
|
6191
|
-
|
|
6191
|
+
spinner.stop("Relay endpoint activated");
|
|
6192
6192
|
console.log(` ${pc10.dim("ID:")} ${result.id}`);
|
|
6193
6193
|
console.log(` ${pc10.dim("Active:")} ${result.active}`);
|
|
6194
6194
|
console.log(` ${pc10.dim("Actions:")} ${result.actions?.length || 0}`);
|
|
6195
6195
|
console.log();
|
|
6196
6196
|
} catch (error2) {
|
|
6197
|
-
|
|
6197
|
+
spinner.stop("Failed to activate relay endpoint");
|
|
6198
6198
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6199
6199
|
}
|
|
6200
6200
|
}
|
|
6201
6201
|
async function relayEventsCommand(options) {
|
|
6202
6202
|
const { apiKey } = getConfig3();
|
|
6203
6203
|
const api = new OneApi(apiKey, getApiBase());
|
|
6204
|
-
const
|
|
6205
|
-
|
|
6204
|
+
const spinner = createSpinner();
|
|
6205
|
+
spinner.start("Loading relay events...");
|
|
6206
6206
|
try {
|
|
6207
6207
|
const query = {};
|
|
6208
6208
|
if (options.limit) query.limit = options.limit;
|
|
@@ -6226,7 +6226,7 @@ async function relayEventsCommand(options) {
|
|
|
6226
6226
|
});
|
|
6227
6227
|
return;
|
|
6228
6228
|
}
|
|
6229
|
-
|
|
6229
|
+
spinner.stop(`${events.length} event${events.length === 1 ? "" : "s"} found`);
|
|
6230
6230
|
if (events.length === 0) {
|
|
6231
6231
|
console.log("\n No events found.\n");
|
|
6232
6232
|
return;
|
|
@@ -6246,22 +6246,22 @@ async function relayEventsCommand(options) {
|
|
|
6246
6246
|
}))
|
|
6247
6247
|
);
|
|
6248
6248
|
} catch (error2) {
|
|
6249
|
-
|
|
6249
|
+
spinner.stop("Failed to list relay events");
|
|
6250
6250
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6251
6251
|
}
|
|
6252
6252
|
}
|
|
6253
6253
|
async function relayEventGetCommand(id) {
|
|
6254
6254
|
const { apiKey } = getConfig3();
|
|
6255
6255
|
const api = new OneApi(apiKey, getApiBase());
|
|
6256
|
-
const
|
|
6257
|
-
|
|
6256
|
+
const spinner = createSpinner();
|
|
6257
|
+
spinner.start("Loading relay event...");
|
|
6258
6258
|
try {
|
|
6259
6259
|
const result = await api.getRelayEvent(id);
|
|
6260
6260
|
if (isAgentMode()) {
|
|
6261
6261
|
json(result);
|
|
6262
6262
|
return;
|
|
6263
6263
|
}
|
|
6264
|
-
|
|
6264
|
+
spinner.stop("Relay event loaded");
|
|
6265
6265
|
console.log();
|
|
6266
6266
|
console.log(` ${pc10.dim("ID:")} ${result.id}`);
|
|
6267
6267
|
console.log(` ${pc10.dim("Platform:")} ${result.platform}`);
|
|
@@ -6271,7 +6271,7 @@ async function relayEventGetCommand(id) {
|
|
|
6271
6271
|
console.log(JSON.stringify(result.payload, null, 2));
|
|
6272
6272
|
console.log();
|
|
6273
6273
|
} catch (error2) {
|
|
6274
|
-
|
|
6274
|
+
spinner.stop("Failed to load relay event");
|
|
6275
6275
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6276
6276
|
}
|
|
6277
6277
|
}
|
|
@@ -6281,8 +6281,8 @@ async function relayDeliveriesCommand(options) {
|
|
|
6281
6281
|
}
|
|
6282
6282
|
const { apiKey } = getConfig3();
|
|
6283
6283
|
const api = new OneApi(apiKey, getApiBase());
|
|
6284
|
-
const
|
|
6285
|
-
|
|
6284
|
+
const spinner = createSpinner();
|
|
6285
|
+
spinner.start("Loading deliveries...");
|
|
6286
6286
|
try {
|
|
6287
6287
|
const deliveries = options.endpointId ? await api.listRelayEndpointDeliveries(options.endpointId) : await api.listRelayEventDeliveries(options.eventId);
|
|
6288
6288
|
const items = Array.isArray(deliveries) ? deliveries : deliveries.rows || [];
|
|
@@ -6290,7 +6290,7 @@ async function relayDeliveriesCommand(options) {
|
|
|
6290
6290
|
json({ deliveries: items });
|
|
6291
6291
|
return;
|
|
6292
6292
|
}
|
|
6293
|
-
|
|
6293
|
+
spinner.stop(`${items.length} deliver${items.length === 1 ? "y" : "ies"} found`);
|
|
6294
6294
|
if (items.length === 0) {
|
|
6295
6295
|
console.log("\n No deliveries found.\n");
|
|
6296
6296
|
return;
|
|
@@ -6312,22 +6312,22 @@ async function relayDeliveriesCommand(options) {
|
|
|
6312
6312
|
}))
|
|
6313
6313
|
);
|
|
6314
6314
|
} catch (error2) {
|
|
6315
|
-
|
|
6315
|
+
spinner.stop("Failed to load deliveries");
|
|
6316
6316
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6317
6317
|
}
|
|
6318
6318
|
}
|
|
6319
6319
|
async function relayPlatformsCommand() {
|
|
6320
6320
|
const { apiKey } = getConfig3();
|
|
6321
6321
|
const api = new OneApi(apiKey, getApiBase());
|
|
6322
|
-
const
|
|
6323
|
-
|
|
6322
|
+
const spinner = createSpinner();
|
|
6323
|
+
spinner.start("Loading relay-capable platforms...");
|
|
6324
6324
|
try {
|
|
6325
6325
|
const platforms = await api.listRelayPlatforms();
|
|
6326
6326
|
if (isAgentMode()) {
|
|
6327
6327
|
json({ platforms });
|
|
6328
6328
|
return;
|
|
6329
6329
|
}
|
|
6330
|
-
|
|
6330
|
+
spinner.stop(`${platforms.length} relay-capable platform${platforms.length === 1 ? "" : "s"} found`);
|
|
6331
6331
|
if (platforms.length === 0) {
|
|
6332
6332
|
console.log("\n No relay-capable platforms available.\n");
|
|
6333
6333
|
return;
|
|
@@ -6348,22 +6348,22 @@ async function relayPlatformsCommand() {
|
|
|
6348
6348
|
)
|
|
6349
6349
|
);
|
|
6350
6350
|
} catch (error2) {
|
|
6351
|
-
|
|
6351
|
+
spinner.stop("Failed to load relay platforms");
|
|
6352
6352
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6353
6353
|
}
|
|
6354
6354
|
}
|
|
6355
6355
|
async function relayEventTypesCommand(platform) {
|
|
6356
6356
|
const { apiKey } = getConfig3();
|
|
6357
6357
|
const api = new OneApi(apiKey, getApiBase());
|
|
6358
|
-
const
|
|
6359
|
-
|
|
6358
|
+
const spinner = createSpinner();
|
|
6359
|
+
spinner.start(`Loading event types for ${pc10.cyan(platform)}...`);
|
|
6360
6360
|
try {
|
|
6361
6361
|
const eventTypes = await api.listRelayEventTypes(platform);
|
|
6362
6362
|
if (isAgentMode()) {
|
|
6363
6363
|
json({ platform, eventTypes });
|
|
6364
6364
|
return;
|
|
6365
6365
|
}
|
|
6366
|
-
|
|
6366
|
+
spinner.stop(`${eventTypes.length} event type${eventTypes.length === 1 ? "" : "s"} found`);
|
|
6367
6367
|
if (eventTypes.length === 0) {
|
|
6368
6368
|
console.log(`
|
|
6369
6369
|
No event types found for ${platform}.
|
|
@@ -6376,7 +6376,7 @@ async function relayEventTypesCommand(platform) {
|
|
|
6376
6376
|
}
|
|
6377
6377
|
console.log();
|
|
6378
6378
|
} catch (error2) {
|
|
6379
|
-
|
|
6379
|
+
spinner.stop("Failed to load event types");
|
|
6380
6380
|
error(`Error: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
6381
6381
|
}
|
|
6382
6382
|
}
|
|
@@ -9179,11 +9179,11 @@ ${profiles.length} built-in profile(s). Run ${pc11.bold("one sync init <platform
|
|
|
9179
9179
|
}
|
|
9180
9180
|
async function syncModelsCommand(platform) {
|
|
9181
9181
|
const api = getApi();
|
|
9182
|
-
const
|
|
9183
|
-
|
|
9182
|
+
const spinner = createSpinner();
|
|
9183
|
+
spinner.start(`Discovering models for ${platform}...`);
|
|
9184
9184
|
try {
|
|
9185
9185
|
const models = await discoverModels(api, platform);
|
|
9186
|
-
|
|
9186
|
+
spinner.stop(`Found ${models.length} models`);
|
|
9187
9187
|
if (isAgentMode()) {
|
|
9188
9188
|
json({ platform, models, total: models.length });
|
|
9189
9189
|
return;
|
|
@@ -9197,15 +9197,15 @@ async function syncModelsCommand(platform) {
|
|
|
9197
9197
|
);
|
|
9198
9198
|
note(lines.join("\n"), `${platform} \u2014 ${models.length} models`);
|
|
9199
9199
|
} catch (err) {
|
|
9200
|
-
|
|
9200
|
+
spinner.stop("Failed");
|
|
9201
9201
|
error(`Error discovering models: ${err instanceof Error ? err.message : String(err)}`);
|
|
9202
9202
|
}
|
|
9203
9203
|
}
|
|
9204
9204
|
async function syncInitCommand(platform, model, options) {
|
|
9205
9205
|
if (!options.config) {
|
|
9206
9206
|
const api = getApi();
|
|
9207
|
-
const
|
|
9208
|
-
|
|
9207
|
+
const spinner = createSpinner();
|
|
9208
|
+
spinner.start(`Looking up ${platform}/${model}...`);
|
|
9209
9209
|
try {
|
|
9210
9210
|
const models = await discoverModels(api, platform);
|
|
9211
9211
|
const match = models.find((m) => m.name === model || m.name.toLowerCase() === model.toLowerCase());
|
|
@@ -9215,9 +9215,9 @@ async function syncInitCommand(platform, model, options) {
|
|
|
9215
9215
|
if (actionId && !actionId.startsWith("conn_mod_def::")) {
|
|
9216
9216
|
actionId = void 0;
|
|
9217
9217
|
}
|
|
9218
|
-
|
|
9218
|
+
spinner.stop(actionId ? "Found model + action ID" : "Found model (action ID not resolved)");
|
|
9219
9219
|
} else {
|
|
9220
|
-
|
|
9220
|
+
spinner.stop("Model not found in available actions");
|
|
9221
9221
|
}
|
|
9222
9222
|
const builtin = loadBuiltinProfile(platform, model);
|
|
9223
9223
|
let template;
|
|
@@ -9317,7 +9317,7 @@ Run with --config to save:
|
|
|
9317
9317
|
}
|
|
9318
9318
|
}
|
|
9319
9319
|
} catch (err) {
|
|
9320
|
-
|
|
9320
|
+
spinner.stop("Failed");
|
|
9321
9321
|
error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
9322
9322
|
}
|
|
9323
9323
|
return;
|
|
@@ -9602,7 +9602,7 @@ ${result.total} results`);
|
|
|
9602
9602
|
}
|
|
9603
9603
|
}
|
|
9604
9604
|
async function syncSqlCommand(platformModel, sql) {
|
|
9605
|
-
const { syncSqlCommand: runSyncSql } = await import("./sql-
|
|
9605
|
+
const { syncSqlCommand: runSyncSql } = await import("./sql-AKQSXRV2.js");
|
|
9606
9606
|
await runSyncSql(platformModel, sql);
|
|
9607
9607
|
}
|
|
9608
9608
|
async function syncDeleteCommand(platformModel, options) {
|
|
@@ -9696,7 +9696,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
|
|
|
9696
9696
|
` detected legacy .one/sync/data/${platform}.db (${dbSize}) \u2014 auto-migrating into memory before sync.
|
|
9697
9697
|
`
|
|
9698
9698
|
);
|
|
9699
|
-
const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-
|
|
9699
|
+
const { memMigrateCommand: memMigrateCommand3 } = await import("./migrate-3LSEIPRF.js");
|
|
9700
9700
|
await memMigrateCommand3({ platform, yes: true });
|
|
9701
9701
|
return;
|
|
9702
9702
|
}
|
|
@@ -9705,7 +9705,7 @@ async function maybeAutoMigrateLegacy(platform, models) {
|
|
|
9705
9705
|
initialValue: true
|
|
9706
9706
|
});
|
|
9707
9707
|
if (p6.isCancel(shouldMigrate) || !shouldMigrate) return;
|
|
9708
|
-
const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-
|
|
9708
|
+
const { memMigrateCommand: memMigrateCommand2 } = await import("./migrate-3LSEIPRF.js");
|
|
9709
9709
|
await memMigrateCommand2({ platform, yes: true });
|
|
9710
9710
|
}
|
|
9711
9711
|
async function syncSuggestSearchableCommand(platformModel, options = {}) {
|
|
@@ -10042,7 +10042,7 @@ function registerSyncSubcommands(sync) {
|
|
|
10042
10042
|
await syncSqlCommand(platformModel, sql);
|
|
10043
10043
|
});
|
|
10044
10044
|
sync.command("schema <platform/model>").description("Inspect the JSON structure of synced records (field paths, types, examples) \u2014 useful before writing `sync sql` queries").action(async (platformModel) => {
|
|
10045
|
-
const { syncSchemaCommand } = await import("./schema-
|
|
10045
|
+
const { syncSchemaCommand } = await import("./schema-FICQRMZ7.js");
|
|
10046
10046
|
await syncSchemaCommand(platformModel);
|
|
10047
10047
|
});
|
|
10048
10048
|
sync.command("delete <platform/model>").description('Delete records from local sync data (e.g. one sync delete notion/pages --id "abc-123")').option("--id <value>", "Delete record by ID").option("--where <conditions>", 'Delete records matching conditions (e.g. "status=archived")').option("--where-sql <predicate>", `Delete using a raw SQL WHERE clause (e.g. "json_extract(data, '$.type') = 'promotion'")`).option("--yes", "Skip confirmation prompt").action(async (platformModel, options) => {
|
|
@@ -11243,8 +11243,8 @@ async function cacheUpdateAllCommand() {
|
|
|
11243
11243
|
console.log("No cached entries to update");
|
|
11244
11244
|
return;
|
|
11245
11245
|
}
|
|
11246
|
-
const
|
|
11247
|
-
|
|
11246
|
+
const spinner = createSpinner();
|
|
11247
|
+
spinner.start(`Updating ${entries.length} cached ${entries.length === 1 ? "entry" : "entries"}...`);
|
|
11248
11248
|
let updated = 0;
|
|
11249
11249
|
let failed = 0;
|
|
11250
11250
|
const errors = [];
|
|
@@ -11261,7 +11261,7 @@ async function cacheUpdateAllCommand() {
|
|
|
11261
11261
|
});
|
|
11262
11262
|
}
|
|
11263
11263
|
}
|
|
11264
|
-
|
|
11264
|
+
spinner.stop(`Updated ${updated} ${updated === 1 ? "entry" : "entries"}${failed > 0 ? `, ${failed} failed` : ""}`);
|
|
11265
11265
|
if (isAgentMode()) {
|
|
11266
11266
|
json({ updated, failed, errors: errors.length > 0 ? errors : void 0 });
|
|
11267
11267
|
return;
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
dotPathToJsonbExpr,
|
|
4
4
|
memMigrateCommand,
|
|
5
5
|
reviveStringifiedJson
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XKUTG7JD.js";
|
|
7
7
|
import "./chunk-44CV5IMX.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-NOFJ4NYD.js";
|
|
9
9
|
import "./chunk-NOPTG4GC.js";
|
|
10
10
|
import "./chunk-3HRC3IPE.js";
|
|
11
11
|
import "./chunk-HTXZZQ6U.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
memSqlCommand,
|
|
3
3
|
syncSqlCommand
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7FPQOAQ4.js";
|
|
5
|
+
import "./chunk-NOFJ4NYD.js";
|
|
6
6
|
import "./chunk-NOPTG4GC.js";
|
|
7
7
|
import "./chunk-3HRC3IPE.js";
|
|
8
8
|
import "./chunk-HTXZZQ6U.js";
|