openpond 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cache.d.ts +7 -10
- package/dist/chunks/actions-command-QP3NMDK4.js +2 -0
- package/dist/chunks/app-layer-N7VFRVJ2.js +3 -0
- package/dist/chunks/app-server-runtime-OCLPUI7F.js +2 -0
- package/dist/chunks/apps-AMG75TI4.js +2 -0
- package/dist/chunks/chunk-22UARBPW.js +3 -0
- package/dist/chunks/chunk-3A7HZJNE.js +1 -0
- package/dist/chunks/chunk-3M53YXEI.js +2 -0
- package/dist/chunks/chunk-3NDRIQTI.js +2 -0
- package/dist/chunks/chunk-5BBVEWG3.js +2 -0
- package/dist/chunks/chunk-5O7ZVCMV.js +6 -0
- package/dist/chunks/chunk-6FA3GG5B.js +33 -0
- package/dist/chunks/chunk-6MI4KKWF.js +2 -0
- package/dist/chunks/chunk-BBG546O6.js +6 -0
- package/dist/chunks/chunk-BX4J2VDU.js +2 -0
- package/dist/chunks/chunk-BZMVB3GS.js +2 -0
- package/dist/chunks/chunk-C5LOZSVS.js +2 -0
- package/dist/chunks/chunk-CWQWV2T3.js +2 -0
- package/dist/chunks/chunk-DUA3QP6Y.js +19 -0
- package/dist/chunks/chunk-EAPFMACH.js +10 -0
- package/dist/chunks/chunk-ES2ISFJC.js +66 -0
- package/dist/chunks/chunk-F65NIZLM.js +2199 -0
- package/dist/chunks/chunk-FGJ5LFPL.js +5 -0
- package/dist/chunks/chunk-FTQLQJQV.js +2 -0
- package/dist/chunks/chunk-FY7OQ5RK.js +24 -0
- package/dist/chunks/chunk-FYCJSUFV.js +53 -0
- package/dist/chunks/chunk-GLUWATL5.js +2 -0
- package/dist/chunks/chunk-H7IWJN7L.js +17 -0
- package/dist/chunks/chunk-HZP5U2AA.js +3 -0
- package/dist/chunks/chunk-I5K74TOH.js +3 -0
- package/dist/chunks/chunk-IR3YJWPW.js +7 -0
- package/dist/chunks/chunk-KU7QOHFT.js +2872 -0
- package/dist/chunks/chunk-KV553EWX.js +16 -0
- package/dist/chunks/chunk-MGN6GLNZ.js +2 -0
- package/dist/chunks/chunk-OG5Q6NXK.js +28 -0
- package/dist/chunks/chunk-OGPHXXCD.js +1 -0
- package/dist/chunks/chunk-PI36UHRA.js +18 -0
- package/dist/chunks/chunk-RWSAGQTP.js +2 -0
- package/dist/chunks/chunk-SAE4OIPC.js +2 -0
- package/dist/chunks/chunk-SDO4FC4Q.js +2 -0
- package/dist/chunks/chunk-UKUVMXOW.js +12 -0
- package/dist/chunks/chunk-VCLCFK3O.js +36 -0
- package/dist/chunks/chunk-VYUMTRB3.js +5 -0
- package/dist/chunks/chunk-X37KMV27.js +1 -0
- package/dist/chunks/chunk-XDHAGACI.js +3 -0
- package/dist/chunks/chunk-XEOEKFG6.js +71 -0
- package/dist/chunks/chunk-ZF7TEGY5.js +5 -0
- package/dist/chunks/chunk-ZVOO7FKM.js +2 -0
- package/dist/chunks/cli-M2FG7SSI.js +2 -0
- package/dist/chunks/configuration-command-XBKBIZBO.js +2 -0
- package/dist/chunks/continual-D75WA7E7.js +7 -0
- package/dist/chunks/core-commands-LUZVWXQR.js +2 -0
- package/dist/chunks/database-X2CUV732.js +2 -0
- package/dist/chunks/desktop-test-KGC4JVJ7.js +3 -0
- package/dist/chunks/dist-NKLXFA37.js +2 -0
- package/dist/chunks/extension-NQ7N5LEY.js +5 -0
- package/dist/chunks/help-MWK66XZK.js +8 -0
- package/dist/chunks/module-ES6BEMUI-ZVL3F6NW.js +2 -0
- package/dist/chunks/module-asyncify-2EFITU5U-R7TVXNAE.js +2 -0
- package/dist/chunks/opchat-XJZA3QKZ.js +3 -0
- package/dist/chunks/organizations-UECDFEYE.js +2 -0
- package/dist/chunks/profile-KUMIZURM.js +3 -0
- package/dist/chunks/project-agent-NILMJHLV.js +2 -0
- package/dist/chunks/sandbox-command-QHH65OSE.js +2 -0
- package/dist/chunks/sandbox-template-N7I63PNU.js +10 -0
- package/dist/chunks/src-724HF43W.js +82 -0
- package/dist/chunks/src-VTKTTKQO.js +319 -0
- package/dist/chunks/taskset-PISBOILQ.js +2 -0
- package/dist/chunks/teams-bot-UV4RU53M.js +3 -0
- package/dist/chunks/training-2NDOWH5S.js +2 -0
- package/dist/chunks/workspaces-XXT4KUD3.js +2 -0
- package/dist/cli.js +3 -101
- package/dist/client.d.ts +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/index.js +1 -26305
- package/dist/private-json-file.d.ts +1 -2
- package/dist/sandbox-template/manifest.js +1 -18380
- package/dist/web/assets/App-DxecRQUL.js +176 -0
- package/dist/web/assets/AppDialog-B65Eo3gp.js +1 -0
- package/dist/web/assets/AppTerminalPanel-B2EKQM7W.js +2 -0
- package/dist/web/assets/{AppsView-Ck_OzQWf.js → AppsView-BBoVe7s2.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-CqciX8aL.js → BrowserSidebar-CSM1atSJ.js} +1 -1
- package/dist/web/assets/{CartesianChart-Y0lsL4vC.js → CartesianChart-CJKfXiEG.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BOb9PjvS.js → CollaborationTabs-BMZamWFC.js} +1 -1
- package/dist/web/assets/{CommandMenu-Co6JnmTu.js → CommandMenu-B3U1z2eo.js} +1 -1
- package/dist/web/assets/{CommunityView-BbTSeL7h.js → CommunityView-CTyRUcfy.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-BGzCWVFp.js → ComposerCreateImproveStrip-D7usvRtK.js} +1 -1
- package/dist/web/assets/GetStartedView-Ibu7oKWJ.js +1 -0
- package/dist/web/assets/HostedModelLearningReview-qnzIkT70.js +1 -0
- package/dist/web/assets/HostedModelLearningSettings--PKjpYsy.js +1 -0
- package/dist/web/assets/LabModelVersionDetailPage-s9uUN6fV.js +1 -0
- package/dist/web/assets/{LabSkillSidebar-C5oS6UmH.js → LabSkillSidebar-BKYseMiJ.js} +1 -1
- package/dist/web/assets/LabsRoute-C1FWCoYb.css +1 -0
- package/dist/web/assets/LabsRoute-DoRs0K6v.js +32 -0
- package/dist/web/assets/MainChatThread-DvuyMcMB.js +2 -0
- package/dist/web/assets/MainPane-BWwcxgHD.js +8 -0
- package/dist/web/assets/{MarkdownText-DqJarmTh.js → MarkdownText-D8XC5UT_.js} +1 -1
- package/dist/web/assets/{Messages-BaT7HOzB.js → Messages-e4A8JUjD.js} +6 -6
- package/dist/web/assets/{NativeSkillSidebar-DXp8snN5.js → NativeSkillSidebar-D2Joh8XB.js} +1 -1
- package/dist/web/assets/{NewExperienceSwitcher-CLHuGUN5.js → NewExperienceSwitcher-CzGebt2E.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-CzpHCAaC.js → NewProjectDialog-CdMTSxUE.js} +1 -1
- package/dist/web/assets/{OutputsPage-DIzx-Ge6.js → OutputsPage-m7cSb8dW.js} +1 -1
- package/dist/web/assets/{ProjectsPage-DojwrhOy.js → ProjectsPage-C9mz8W1g.js} +1 -1
- package/dist/web/assets/RightChatPanelStack-B4LEqKEj.js +1 -0
- package/dist/web/assets/{RightSidebarHomePanel-DTzfuEX3.js → RightSidebarHomePanel-DOeUsH7h.js} +1 -1
- package/dist/web/assets/ScheduledWorkPage-UXZSSWgA.js +1 -0
- package/dist/web/assets/SettingsView-CAH0vreE.css +1 -0
- package/dist/web/assets/SettingsView-CQm1ai73.js +9 -0
- package/dist/web/assets/TeamChatView-C4haojB7.js +3 -0
- package/dist/web/assets/{TerminalOverlay-DnNVrCtu.js → TerminalOverlay-p2GZsuyQ.js} +3 -3
- package/dist/web/assets/{TrainingCreationPanel-CDwwyucO.js → TrainingCreationPanel-BYJSlO8X.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-BijDnV_0.js → TrainingDraftPanel-DR5KlayH.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-Y5BFAu1p.js → UsageSettingsSection-BQToNXE4.js} +5 -5
- package/dist/web/assets/{WorkSidebarPanel-CkJlvZKm.js → WorkSidebarPanel--EeytWeg.js} +1 -1
- package/dist/web/assets/WorkspaceDiffPanel-BrovSYhn.js +14 -0
- package/dist/web/assets/{WorkspaceEnvironmentMenu-D8knAy1q.js → WorkspaceEnvironmentMenu-l-keRgvj.js} +3 -3
- package/dist/web/assets/{WorkspaceGitDialogs-_LHTrvh6.js → WorkspaceGitDialogs-aicWzaZu.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-B2B7OM_L.js → WorkspaceMonacoEditor-CO_E74jM.js} +36 -36
- package/dist/web/assets/{arrow-up-right-4nAzMtjW.js → arrow-up-right-rwPXNfVn.js} +1 -1
- package/dist/web/assets/chat-file-links-B3jDstSC.js +1 -0
- package/dist/web/assets/chevron-up-D089nvYQ.js +1 -0
- package/dist/web/assets/{clipboard-BzjUoZFo.js → clipboard-DwEExyU4.js} +1 -1
- package/dist/web/assets/{cloud-upload-CsrrwS-b.js → cloud-upload-D2he0-vQ.js} +1 -1
- package/dist/web/assets/{cssMode-CIbSSHKJ.js → cssMode-DS4k0NcI.js} +1 -1
- package/dist/web/assets/{folder-open-vRTuLzpS.js → folder-open-CAOLduKD.js} +1 -1
- package/dist/web/assets/{folder-plus-hyqwgUnx.js → folder-plus-D56MrxVT.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-CaxKfeYa.js → git-commit-horizontal-CeNM0oKJ.js} +1 -1
- package/dist/web/assets/{htmlMode-C3MGQGam.js → htmlMode-Xkni5erh.js} +1 -1
- package/dist/web/assets/{index-ByQIHpc9.css → index-BGMzUaup.css} +1 -1
- package/dist/web/assets/{index-Dvq7bpBG.js → index-KwyAyscP.js} +1 -1
- package/dist/web/assets/{info-aYWeE1Iw.js → info-CcrBaEE_.js} +1 -1
- package/dist/web/assets/{jsonMode-CpD6UkT7.js → jsonMode-C4YPbQB7.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-DpcK8ZI6.js → lspLanguageFeatures-CF5oMTz6.js} +1 -1
- package/dist/web/assets/{minimize-2-DeYg7XqB.js → minimize-2-DzHQnInk.js} +1 -1
- package/dist/web/assets/{monaco.contribution-CrrdDQgP.js → monaco.contribution-0EN4mGCC.js} +2 -2
- package/dist/web/assets/{monaco.contribution-JWFq0HzV.js → monaco.contribution-B4qcTP0w.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BDTM0ZJq.js → monaco.contribution-CJK_NrBm.js} +2 -2
- package/dist/web/assets/{monaco.contribution-C-_ekTxy.js → monaco.contribution-CkPGKNd-.js} +2 -2
- package/dist/web/assets/{play-BqgRTddV.js → play-p3-AMTPL.js} +1 -1
- package/dist/web/assets/{python-B67wope9.js → python-B0kpTxAZ.js} +1 -1
- package/dist/web/assets/{refresh-cw-DwMA_2On.js → refresh-cw-_jbTIzzr.js} +1 -1
- package/dist/web/assets/{save-B0BKh5oQ.js → save-Cy6hEotx.js} +1 -1
- package/dist/web/assets/{square-LY3oz82L.js → square-DKQkcrOH.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-B2jka5B1.js → toggleHighContrast-Bnk1VVVq.js} +1 -1
- package/dist/web/assets/{tsMode-1MUwluYD.js → tsMode-BDrSVy7V.js} +1 -1
- package/dist/web/assets/{upload-bSKSkFVa.js → upload-COn0my_O.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules--jnnM4Fz.js → useLocalAgentSchedules-iZNB4Oee.js} +1 -1
- package/dist/web/assets/{wifi-off-DA34iPmr.js → wifi-off-Cqt-ZLXY.js} +1 -1
- package/dist/web/assets/{workers-CczIcRcl.js → workers-hu0Ym93h.js} +1 -1
- package/dist/web/assets/{yaml-DwEGoHA9.js → yaml-D-JLDGL6.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/command-reference.md +28 -2
- package/package.json +10 -7
- package/dist/chunks/actions-command-6N5XWMR6.js +0 -185
- package/dist/chunks/app-layer-XEYHFJHI.js +0 -214
- package/dist/chunks/app-server-runtime-FJM2EQPH.js +0 -21
- package/dist/chunks/apps-GSXUDK6V.js +0 -427
- package/dist/chunks/chunk-2JABRRNR.js +0 -183
- package/dist/chunks/chunk-47EIAYI7.js +0 -2162
- package/dist/chunks/chunk-4L3ZJS2T.js +0 -1207
- package/dist/chunks/chunk-5TKZBMQM.js +0 -731
- package/dist/chunks/chunk-6G6MDZLM.js +0 -14509
- package/dist/chunks/chunk-BVY5JYM6.js +0 -512
- package/dist/chunks/chunk-C5TKGE5Y.js +0 -1275
- package/dist/chunks/chunk-CNTM26OW.js +0 -602
- package/dist/chunks/chunk-D7BO5Y5J.js +0 -1531
- package/dist/chunks/chunk-DJL4TJYG.js +0 -70
- package/dist/chunks/chunk-DLQQIWN2.js +0 -648
- package/dist/chunks/chunk-DNXBJZAU.js +0 -630
- package/dist/chunks/chunk-EFET7LB7.js +0 -1331
- package/dist/chunks/chunk-FQS2QL5F.js +0 -14522
- package/dist/chunks/chunk-HFPUR4CQ.js +0 -669
- package/dist/chunks/chunk-J3YDKJFD.js +0 -88
- package/dist/chunks/chunk-J7PYGDRY.js +0 -634
- package/dist/chunks/chunk-JTHL5XJ2.js +0 -1838
- package/dist/chunks/chunk-KSRWKXRB.js +0 -12
- package/dist/chunks/chunk-KWDOAJJI.js +0 -238
- package/dist/chunks/chunk-MUMPWI4O.js +0 -92
- package/dist/chunks/chunk-N3TGCM7J.js +0 -1135
- package/dist/chunks/chunk-NTK22KJD.js +0 -10707
- package/dist/chunks/chunk-O6B6YCMI.js +0 -57688
- package/dist/chunks/chunk-R3C3MNSI.js +0 -140
- package/dist/chunks/chunk-SMNFI2FU.js +0 -113
- package/dist/chunks/chunk-UACZUFIA.js +0 -47
- package/dist/chunks/chunk-W5GKHH77.js +0 -168
- package/dist/chunks/chunk-WBAZFKC7.js +0 -1643
- package/dist/chunks/chunk-X7ZG4TSW.js +0 -3063
- package/dist/chunks/chunk-YVCYVDNP.js +0 -746
- package/dist/chunks/cli-6PFRZ2WV.js +0 -21
- package/dist/chunks/continual-FYDKLCO7.js +0 -803
- package/dist/chunks/core-commands-MAN3CSJQ.js +0 -48
- package/dist/chunks/desktop-test-OE5SST2W.js +0 -146
- package/dist/chunks/extension-J3CIEDP4.js +0 -10041
- package/dist/chunks/help-JNGJJFU5.js +0 -67
- package/dist/chunks/opchat-6HEQJFLL.js +0 -167
- package/dist/chunks/organizations-MWAPNOCK.js +0 -804
- package/dist/chunks/profile-P7HMONTZ.js +0 -1134
- package/dist/chunks/project-agent-2RAK7GAZ.js +0 -514
- package/dist/chunks/sandbox-command-G22CPFNK.js +0 -1659
- package/dist/chunks/sandbox-template-S4WRUWJ6.js +0 -1653
- package/dist/chunks/src-BKBZ7WLO.js +0 -3624
- package/dist/chunks/src-RTGN2O4H.js +0 -65745
- package/dist/chunks/taskset-BMI7KOWP.js +0 -66
- package/dist/chunks/teams-bot-5VBYEN7M.js +0 -144
- package/dist/chunks/training-UPVSGDTB.js +0 -17
- package/dist/chunks/workspaces-IJQPWX3H.js +0 -99
- package/dist/web/assets/App-BOkhmdHu.js +0 -173
- package/dist/web/assets/AppDialog-BCjKFUBn.js +0 -1
- package/dist/web/assets/AppTerminalPanel-DRU8GIfy.js +0 -2
- package/dist/web/assets/GetStartedView-jEogFjxP.js +0 -1
- package/dist/web/assets/LabModelVersionDetailPage-CrudId_1.js +0 -1
- package/dist/web/assets/LabsRoute-9v8qwEBc.js +0 -2
- package/dist/web/assets/LabsRoute-CGFgymTX.css +0 -1
- package/dist/web/assets/MainChatThread-VtMpAxlP.js +0 -2
- package/dist/web/assets/MainPane-BbknUzp3.js +0 -8
- package/dist/web/assets/RightChatPanelStack-CIE5bgmO.js +0 -1
- package/dist/web/assets/ScheduledWorkPage-DdbcQGSv.js +0 -1
- package/dist/web/assets/SettingsView-CC5GXaE1.css +0 -1
- package/dist/web/assets/SettingsView-QT_OLmDh.js +0 -6
- package/dist/web/assets/TeamChatView-C4-nG1tC.js +0 -3
- package/dist/web/assets/WorkspaceDiffPanel-CBgzmBk8.js +0 -14
- package/dist/web/assets/chat-file-links-Bned0MT7.js +0 -1
- package/dist/web/assets/chevron-up-DK7ejCfk.js +0 -1
- package/dist/web/assets/index-66-ohHD5.js +0 -1
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
consumeStream,
|
|
4
|
-
formatStreamItem
|
|
5
|
-
} from "./chunk-W5GKHH77.js";
|
|
6
|
-
import {
|
|
7
|
-
ensureApiKey,
|
|
8
|
-
fetchAppsWithCache,
|
|
9
|
-
fetchToolsWithCache,
|
|
10
|
-
normalizeRepoName,
|
|
11
|
-
pollDeploymentLogs,
|
|
12
|
-
resolveAppTarget
|
|
13
|
-
} from "./chunk-HFPUR4CQ.js";
|
|
14
|
-
import "./chunk-2JABRRNR.js";
|
|
15
|
-
import {
|
|
16
|
-
resolveBaseUrl,
|
|
17
|
-
resolvePublicApiBaseUrl
|
|
18
|
-
} from "./chunk-SMNFI2FU.js";
|
|
19
|
-
import "./chunk-N3TGCM7J.js";
|
|
20
|
-
import "./chunk-4L3ZJS2T.js";
|
|
21
|
-
import "./chunk-JTHL5XJ2.js";
|
|
22
|
-
import {
|
|
23
|
-
createAgentFromPrompt,
|
|
24
|
-
deployApp,
|
|
25
|
-
executeUserTool,
|
|
26
|
-
getAppEnvironment,
|
|
27
|
-
getAppRuntimeSummary,
|
|
28
|
-
getUserPerformance,
|
|
29
|
-
loadConfig,
|
|
30
|
-
runAssistantMode,
|
|
31
|
-
submitBacktestDetail,
|
|
32
|
-
submitBacktestTx,
|
|
33
|
-
updateAppCodeVisibility,
|
|
34
|
-
updateAppEnvironment
|
|
35
|
-
} from "./chunk-D7BO5Y5J.js";
|
|
36
|
-
import "./chunk-KSRWKXRB.js";
|
|
37
|
-
import "./chunk-FQS2QL5F.js";
|
|
38
|
-
import {
|
|
39
|
-
parseBooleanOption,
|
|
40
|
-
parseJsonOption,
|
|
41
|
-
parseTimeOption,
|
|
42
|
-
resolveTemplateEnvironment
|
|
43
|
-
} from "./chunk-MUMPWI4O.js";
|
|
44
|
-
import "./chunk-UACZUFIA.js";
|
|
45
|
-
|
|
46
|
-
// src/cli/apps.ts
|
|
47
|
-
async function runAppsTools() {
|
|
48
|
-
const config = await loadConfig();
|
|
49
|
-
const uiBase = resolveBaseUrl(config);
|
|
50
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
51
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
52
|
-
const tools = await fetchToolsWithCache({ apiBase, apiKey });
|
|
53
|
-
console.log(JSON.stringify(tools, null, 2));
|
|
54
|
-
}
|
|
55
|
-
async function runAppsList(options) {
|
|
56
|
-
const config = await loadConfig();
|
|
57
|
-
const uiBase = resolveBaseUrl(config);
|
|
58
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
59
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
60
|
-
const handle = typeof options.handle === "string" ? String(options.handle) : void 0;
|
|
61
|
-
const normalizedHandle = handle ? normalizeRepoName(handle) : null;
|
|
62
|
-
const forceRefresh = options.refresh !== void 0 ? parseBooleanOption(options.refresh) : void 0;
|
|
63
|
-
const apps = await fetchAppsWithCache({
|
|
64
|
-
apiBase,
|
|
65
|
-
apiKey,
|
|
66
|
-
forceRefresh
|
|
67
|
-
});
|
|
68
|
-
const filtered = normalizedHandle ? apps.filter((app) => {
|
|
69
|
-
const candidate = normalizeRepoName(app.handle || app.gitOwner);
|
|
70
|
-
return candidate === normalizedHandle;
|
|
71
|
-
}) : apps;
|
|
72
|
-
if (filtered.length === 0) {
|
|
73
|
-
console.log("no apps found");
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
if (parseBooleanOption(options.json)) {
|
|
77
|
-
console.log(JSON.stringify({ apps: filtered }, null, 2));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
for (const app of filtered) {
|
|
81
|
-
const owner = app.handle || app.gitOwner || "unknown";
|
|
82
|
-
const repo = app.repo || app.gitRepo || app.id;
|
|
83
|
-
const status = app.latestDeployment?.status || "no-deploy";
|
|
84
|
-
const branch = app.latestDeployment?.gitBranch || app.defaultBranch || "-";
|
|
85
|
-
const codeVisibility = app.codeVisibility || "unknown";
|
|
86
|
-
const sandbox = app.sandbox ? "yes" : "no";
|
|
87
|
-
console.log(
|
|
88
|
-
`${owner}/${repo} ${status} ${branch} code=${codeVisibility} sandbox=${sandbox} ${app.id}`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
async function runAppsCodeVisibility(options, target) {
|
|
93
|
-
const visibility = typeof options.visibility === "string" ? options.visibility.trim() : typeof options.codeVisibility === "string" ? options.codeVisibility.trim() : "";
|
|
94
|
-
if (visibility !== "public" && visibility !== "private") {
|
|
95
|
-
throw new Error(
|
|
96
|
-
"usage: apps code-visibility <handle>/<repo> --visibility public|private"
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
const config = await loadConfig();
|
|
100
|
-
const uiBase = resolveBaseUrl(config);
|
|
101
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
102
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
103
|
-
const { app, handle, repo } = await resolveAppTarget(apiBase, apiKey, target);
|
|
104
|
-
const result = await updateAppCodeVisibility(
|
|
105
|
-
apiBase,
|
|
106
|
-
apiKey,
|
|
107
|
-
app.id,
|
|
108
|
-
visibility
|
|
109
|
-
);
|
|
110
|
-
console.log(
|
|
111
|
-
`${handle}/${repo} code_visibility=${result.app?.codeVisibility ?? visibility} app_id=${app.id}`
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
async function runAppsPerformance(options) {
|
|
115
|
-
const config = await loadConfig();
|
|
116
|
-
const uiBase = resolveBaseUrl(config);
|
|
117
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
118
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
119
|
-
const appId = typeof options.appId === "string" ? String(options.appId) : void 0;
|
|
120
|
-
const performance = await getUserPerformance(apiBase, apiKey, { appId });
|
|
121
|
-
console.log(JSON.stringify(performance, null, 2));
|
|
122
|
-
}
|
|
123
|
-
async function runAppsSummary(_options, target) {
|
|
124
|
-
const config = await loadConfig();
|
|
125
|
-
const uiBase = resolveBaseUrl(config);
|
|
126
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
127
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
128
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
129
|
-
const summary = await getAppRuntimeSummary(apiBase, apiKey, app.id);
|
|
130
|
-
console.log(JSON.stringify(summary, null, 2));
|
|
131
|
-
}
|
|
132
|
-
async function runAppsAssistant(options, mode, target, contentParts) {
|
|
133
|
-
const prompt = (typeof options.prompt === "string" ? options.prompt : null) || contentParts.join(" ");
|
|
134
|
-
if (!prompt.trim()) {
|
|
135
|
-
throw new Error(
|
|
136
|
-
"usage: apps assistant <plan|performance> <handle>/<repo> --prompt <text>"
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
const config = await loadConfig();
|
|
140
|
-
const uiBase = resolveBaseUrl(config);
|
|
141
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
142
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
143
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
144
|
-
const result = await runAssistantMode(apiBase, apiKey, {
|
|
145
|
-
appId: app.id,
|
|
146
|
-
mode,
|
|
147
|
-
prompt: prompt.trim()
|
|
148
|
-
});
|
|
149
|
-
console.log(JSON.stringify(result, null, 2));
|
|
150
|
-
}
|
|
151
|
-
async function runAppsAgentCreate(options, contentParts) {
|
|
152
|
-
const config = await loadConfig();
|
|
153
|
-
const uiBase = resolveBaseUrl(config);
|
|
154
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
155
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
156
|
-
const prompt = (typeof options.prompt === "string" ? options.prompt : null) || contentParts.join(" ");
|
|
157
|
-
if (!prompt.trim()) {
|
|
158
|
-
throw new Error(
|
|
159
|
-
"usage: apps agent create --prompt <text> [--team-id <id>]"
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
const templateRepoUrl = typeof options.templateRepoUrl === "string" ? options.templateRepoUrl : void 0;
|
|
163
|
-
const templateBranch = typeof options.templateBranch === "string" ? options.templateBranch : void 0;
|
|
164
|
-
const templateLocalPath = typeof options.templateLocalPath === "string" ? options.templateLocalPath : void 0;
|
|
165
|
-
const teamId = typeof options.teamId === "string" && options.teamId.trim() ? options.teamId.trim() : void 0;
|
|
166
|
-
if (templateLocalPath && String(templateLocalPath).trim().length > 0) {
|
|
167
|
-
throw new Error("templateLocalPath is not supported; use templateRepoUrl");
|
|
168
|
-
}
|
|
169
|
-
const envVars = typeof options.env === "string" ? parseJsonOption(options.env, "env") : void 0;
|
|
170
|
-
if (envVars) {
|
|
171
|
-
if (typeof envVars !== "object" || Array.isArray(envVars)) {
|
|
172
|
-
throw new Error("env must be a JSON object");
|
|
173
|
-
}
|
|
174
|
-
for (const [key, value] of Object.entries(envVars)) {
|
|
175
|
-
if (typeof value !== "string") {
|
|
176
|
-
throw new Error(`env value for ${key} must be a string`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
const template = templateRepoUrl || templateBranch || envVars ? {
|
|
181
|
-
templateRepoUrl,
|
|
182
|
-
templateBranch,
|
|
183
|
-
envVars
|
|
184
|
-
} : void 0;
|
|
185
|
-
const deployEnvironment = typeof options.deployEnvironment === "string" ? options.deployEnvironment === "preview" ? "preview" : "production" : void 0;
|
|
186
|
-
const deployDisabled = options.deployDisabled !== void 0 ? parseBooleanOption(options.deployDisabled) : void 0;
|
|
187
|
-
const streamDeployLogs = options.streamDeployLogs !== void 0 ? parseBooleanOption(options.streamDeployLogs) : true;
|
|
188
|
-
const response = await createAgentFromPrompt(apiBase, apiKey, {
|
|
189
|
-
prompt: prompt.trim(),
|
|
190
|
-
...teamId ? { teamId } : {},
|
|
191
|
-
...template ? { template } : {},
|
|
192
|
-
...deployEnvironment ? { deployEnvironment } : {},
|
|
193
|
-
...deployDisabled !== void 0 ? { deployDisabled } : {},
|
|
194
|
-
streamDeployLogs
|
|
195
|
-
});
|
|
196
|
-
if (!response.ok) {
|
|
197
|
-
const text = await response.text().catch(() => "");
|
|
198
|
-
throw new Error(`agent create failed: ${response.status} ${text}`);
|
|
199
|
-
}
|
|
200
|
-
let conversationId = null;
|
|
201
|
-
let appId = null;
|
|
202
|
-
let deploymentId = null;
|
|
203
|
-
await consumeStream(response, {
|
|
204
|
-
onConversationId: (id) => {
|
|
205
|
-
conversationId = id;
|
|
206
|
-
},
|
|
207
|
-
onItems: (items) => {
|
|
208
|
-
for (const item of items) {
|
|
209
|
-
const line = formatStreamItem(item);
|
|
210
|
-
if (line) {
|
|
211
|
-
console.log(line);
|
|
212
|
-
}
|
|
213
|
-
const typed = item;
|
|
214
|
-
if (!appId && typeof typed.appId === "string") {
|
|
215
|
-
appId = typed.appId;
|
|
216
|
-
}
|
|
217
|
-
if (!deploymentId && typeof typed.deploymentId === "string") {
|
|
218
|
-
deploymentId = typed.deploymentId;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
if (conversationId) {
|
|
224
|
-
console.log(`conversation_id: ${conversationId}`);
|
|
225
|
-
}
|
|
226
|
-
if (appId) {
|
|
227
|
-
console.log(`app_id: ${appId}`);
|
|
228
|
-
}
|
|
229
|
-
if (deploymentId) {
|
|
230
|
-
console.log(`deployment_id: ${deploymentId}`);
|
|
231
|
-
}
|
|
232
|
-
try {
|
|
233
|
-
await fetchAppsWithCache({ apiBase, apiKey, forceRefresh: true });
|
|
234
|
-
await fetchToolsWithCache({ apiBase, apiKey, forceRefresh: true });
|
|
235
|
-
} catch (error) {
|
|
236
|
-
console.warn("cache refresh failed", error);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async function runAppsToolsExecute(options, appId, deploymentId, toolName) {
|
|
240
|
-
const config = await loadConfig();
|
|
241
|
-
const uiBase = resolveBaseUrl(config);
|
|
242
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
243
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
244
|
-
const methodRaw = typeof options.method === "string" ? String(options.method).toUpperCase() : void 0;
|
|
245
|
-
const method = methodRaw && ["GET", "POST", "PUT", "DELETE"].includes(methodRaw) ? methodRaw : void 0;
|
|
246
|
-
if (methodRaw && !method) {
|
|
247
|
-
throw new Error("method must be GET, POST, PUT, or DELETE");
|
|
248
|
-
}
|
|
249
|
-
const body = typeof options.body === "string" ? parseJsonOption(String(options.body), "body") : void 0;
|
|
250
|
-
const headers = typeof options.headers === "string" ? parseJsonOption(String(options.headers), "headers") : void 0;
|
|
251
|
-
const scheduleId = typeof options.scheduleId === "string" ? String(options.scheduleId) : void 0;
|
|
252
|
-
const notifyEmail = parseBooleanOption(options.notifyEmail);
|
|
253
|
-
const withSummary = parseBooleanOption(options.summary) || parseBooleanOption(options.withSummary);
|
|
254
|
-
const result = await executeUserTool(apiBase, apiKey, {
|
|
255
|
-
appId,
|
|
256
|
-
deploymentId,
|
|
257
|
-
toolName,
|
|
258
|
-
scheduleId,
|
|
259
|
-
method,
|
|
260
|
-
body,
|
|
261
|
-
headers,
|
|
262
|
-
notifyEmail: notifyEmail || void 0
|
|
263
|
-
});
|
|
264
|
-
console.log(JSON.stringify(result, null, 2));
|
|
265
|
-
if (withSummary && result.ok) {
|
|
266
|
-
const summary = await getAppRuntimeSummary(apiBase, apiKey, appId);
|
|
267
|
-
console.log(JSON.stringify({ summary }, null, 2));
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
async function runAppsEnvSet(options, target) {
|
|
271
|
-
const rawEnv = typeof options.env === "string" ? options.env : typeof options.vars === "string" ? options.vars : typeof options.envVars === "string" ? options.envVars : null;
|
|
272
|
-
if (!rawEnv) {
|
|
273
|
-
throw new Error("usage: apps env set <handle>/<repo> --env <json>");
|
|
274
|
-
}
|
|
275
|
-
const parsed = parseJsonOption(rawEnv, "env");
|
|
276
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
277
|
-
throw new Error("env must be a JSON object");
|
|
278
|
-
}
|
|
279
|
-
const envVars = {};
|
|
280
|
-
for (const [key, value] of Object.entries(
|
|
281
|
-
parsed
|
|
282
|
-
)) {
|
|
283
|
-
if (typeof value !== "string") {
|
|
284
|
-
throw new Error(`env value for ${key} must be a string`);
|
|
285
|
-
}
|
|
286
|
-
if (!key.startsWith("OPENTOOL_PUBLIC_")) {
|
|
287
|
-
throw new Error("only OPENTOOL_PUBLIC_ env vars can be set");
|
|
288
|
-
}
|
|
289
|
-
envVars[key] = value;
|
|
290
|
-
}
|
|
291
|
-
const config = await loadConfig();
|
|
292
|
-
const uiBase = resolveBaseUrl(config);
|
|
293
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
294
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
295
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
296
|
-
const result = await updateAppEnvironment(apiBase, apiKey, app.id, {
|
|
297
|
-
envVars
|
|
298
|
-
});
|
|
299
|
-
console.log(JSON.stringify(result, null, 2));
|
|
300
|
-
}
|
|
301
|
-
async function runAppsEnvGet(_options, target) {
|
|
302
|
-
const config = await loadConfig();
|
|
303
|
-
const uiBase = resolveBaseUrl(config);
|
|
304
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
305
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
306
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
307
|
-
const result = await getAppEnvironment(apiBase, apiKey, app.id);
|
|
308
|
-
console.log(JSON.stringify(result, null, 2));
|
|
309
|
-
}
|
|
310
|
-
async function runAppsDeploy(options, target) {
|
|
311
|
-
const config = await loadConfig();
|
|
312
|
-
const uiBase = resolveBaseUrl(config);
|
|
313
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
314
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
315
|
-
const { app, handle, repo } = await resolveAppTarget(apiBase, apiKey, target);
|
|
316
|
-
const envRaw = typeof options.env === "string" ? options.env : typeof options.environment === "string" ? options.environment : void 0;
|
|
317
|
-
const environment = resolveTemplateEnvironment(envRaw);
|
|
318
|
-
const result = await deployApp(apiBase, apiKey, app.id, { environment });
|
|
319
|
-
console.log(JSON.stringify(result, null, 2));
|
|
320
|
-
const shouldWatch = parseBooleanOption(options.watch) || parseBooleanOption(options.wait) || parseBooleanOption(options.follow);
|
|
321
|
-
if (!shouldWatch) return;
|
|
322
|
-
await pollDeploymentLogs({
|
|
323
|
-
baseUrl: apiBase,
|
|
324
|
-
apiKey,
|
|
325
|
-
deploymentId: result.deploymentId,
|
|
326
|
-
prefix: `[${handle}/${repo}] `,
|
|
327
|
-
intervalMs: options.interval ? Number(options.interval) : void 0,
|
|
328
|
-
timeoutMs: options.timeout ? Number(options.timeout) : void 0
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
function resolveBacktestEventsParams(options) {
|
|
332
|
-
let params = {};
|
|
333
|
-
if (typeof options.params === "string") {
|
|
334
|
-
const parsed = parseJsonOption(String(options.params), "params");
|
|
335
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
336
|
-
throw new Error("params must be a JSON object");
|
|
337
|
-
}
|
|
338
|
-
for (const [key, value] of Object.entries(
|
|
339
|
-
parsed
|
|
340
|
-
)) {
|
|
341
|
-
if (value === void 0) continue;
|
|
342
|
-
params[key] = typeof value === "string" ? value : JSON.stringify(value);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
const addParam = (key, value) => {
|
|
346
|
-
if (value === void 0 || value === "") return;
|
|
347
|
-
params[key] = value;
|
|
348
|
-
};
|
|
349
|
-
addParam(
|
|
350
|
-
"source",
|
|
351
|
-
typeof options.source === "string" ? options.source.trim() : void 0
|
|
352
|
-
);
|
|
353
|
-
addParam(
|
|
354
|
-
"symbol",
|
|
355
|
-
typeof options.symbol === "string" ? options.symbol.trim() : void 0
|
|
356
|
-
);
|
|
357
|
-
addParam(
|
|
358
|
-
"cursor",
|
|
359
|
-
typeof options.cursor === "string" ? options.cursor.trim() : void 0
|
|
360
|
-
);
|
|
361
|
-
addParam(
|
|
362
|
-
"status",
|
|
363
|
-
typeof options.status === "string" ? options.status.trim() : void 0
|
|
364
|
-
);
|
|
365
|
-
addParam(
|
|
366
|
-
"backtestRunId",
|
|
367
|
-
typeof options.runId === "string" ? options.runId.trim() : typeof options.backtestRunId === "string" ? options.backtestRunId.trim() : void 0
|
|
368
|
-
);
|
|
369
|
-
addParam("since", parseTimeOption(options.since, "since"));
|
|
370
|
-
addParam("until", parseTimeOption(options.until, "until"));
|
|
371
|
-
if (typeof options.limit === "string" && options.limit.trim().length > 0) {
|
|
372
|
-
const parsed = Number.parseInt(options.limit, 10);
|
|
373
|
-
if (!Number.isFinite(parsed)) {
|
|
374
|
-
throw new Error("limit must be a number");
|
|
375
|
-
}
|
|
376
|
-
addParam("limit", String(parsed));
|
|
377
|
-
}
|
|
378
|
-
return Object.keys(params).length ? params : void 0;
|
|
379
|
-
}
|
|
380
|
-
async function runBacktestEvents(options, target) {
|
|
381
|
-
const config = await loadConfig();
|
|
382
|
-
const uiBase = resolveBaseUrl(config);
|
|
383
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
384
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
385
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
386
|
-
const query = {
|
|
387
|
-
...resolveBacktestEventsParams(options) ?? {},
|
|
388
|
-
appId: app.id
|
|
389
|
-
};
|
|
390
|
-
const result = await submitBacktestTx(apiBase, apiKey, {
|
|
391
|
-
method: "GET",
|
|
392
|
-
query
|
|
393
|
-
});
|
|
394
|
-
console.log(JSON.stringify(result, null, 2));
|
|
395
|
-
}
|
|
396
|
-
async function runBacktestGet(options, target) {
|
|
397
|
-
const runId = typeof options.runId === "string" ? options.runId.trim() : typeof options.backtestRunId === "string" ? options.backtestRunId.trim() : "";
|
|
398
|
-
if (!runId) {
|
|
399
|
-
throw new Error("usage: backtest get <handle>/<repo> --run-id <id>");
|
|
400
|
-
}
|
|
401
|
-
const config = await loadConfig();
|
|
402
|
-
const uiBase = resolveBaseUrl(config);
|
|
403
|
-
const apiKey = await ensureApiKey(config, uiBase);
|
|
404
|
-
const apiBase = resolvePublicApiBaseUrl(config);
|
|
405
|
-
const { app } = await resolveAppTarget(apiBase, apiKey, target);
|
|
406
|
-
const result = await submitBacktestDetail(apiBase, apiKey, {
|
|
407
|
-
appId: app.id,
|
|
408
|
-
runId
|
|
409
|
-
});
|
|
410
|
-
console.log(JSON.stringify(result, null, 2));
|
|
411
|
-
}
|
|
412
|
-
export {
|
|
413
|
-
resolveBacktestEventsParams,
|
|
414
|
-
runAppsAgentCreate,
|
|
415
|
-
runAppsAssistant,
|
|
416
|
-
runAppsCodeVisibility,
|
|
417
|
-
runAppsDeploy,
|
|
418
|
-
runAppsEnvGet,
|
|
419
|
-
runAppsEnvSet,
|
|
420
|
-
runAppsList,
|
|
421
|
-
runAppsPerformance,
|
|
422
|
-
runAppsSummary,
|
|
423
|
-
runAppsTools,
|
|
424
|
-
runAppsToolsExecute,
|
|
425
|
-
runBacktestEvents,
|
|
426
|
-
runBacktestGet
|
|
427
|
-
};
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
CLI_SHORT_OPTION_ALIASES,
|
|
4
|
-
getAnyCliOptionKind,
|
|
5
|
-
getCliCommandDefinition,
|
|
6
|
-
getCliOptionKind
|
|
7
|
-
} from "./chunk-N3TGCM7J.js";
|
|
8
|
-
import {
|
|
9
|
-
parseJsonOption
|
|
10
|
-
} from "./chunk-MUMPWI4O.js";
|
|
11
|
-
|
|
12
|
-
// src/cli/common/args.ts
|
|
13
|
-
var CLI_OPTION_VALUES = /* @__PURE__ */ Symbol("openpondCliOptionValues");
|
|
14
|
-
var CliUsageError = class extends Error {
|
|
15
|
-
exitCode = 2;
|
|
16
|
-
constructor(message) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.name = "CliUsageError";
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var CLI_POSITIVE_INTEGER_OPTIONS = /* @__PURE__ */ new Set(["maxOutputBytes", "timeoutSec"]);
|
|
22
|
-
function parseArgs(argv) {
|
|
23
|
-
const args = [...argv];
|
|
24
|
-
let command = "";
|
|
25
|
-
const options = {};
|
|
26
|
-
const optionValues = {};
|
|
27
|
-
const rest = [];
|
|
28
|
-
while (args.length > 0) {
|
|
29
|
-
const next = args.shift();
|
|
30
|
-
if (next === "--") {
|
|
31
|
-
rest.push(...args);
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
if (next.startsWith("--")) {
|
|
35
|
-
const separatorIndex = next.indexOf("=");
|
|
36
|
-
const rawKey = separatorIndex >= 0 ? next.slice(2, separatorIndex) : next.slice(2);
|
|
37
|
-
const key = normalizeCliOptionKey(rawKey);
|
|
38
|
-
const value = separatorIndex >= 0 ? next.slice(separatorIndex + 1) : readOptionValue(args, key, command);
|
|
39
|
-
setParsedOption(options, optionValues, key, value, command);
|
|
40
|
-
} else if (isShortOptionToken(next)) {
|
|
41
|
-
parseShortOptionToken(next, args, options, optionValues);
|
|
42
|
-
} else {
|
|
43
|
-
if (!command) {
|
|
44
|
-
command = next;
|
|
45
|
-
} else {
|
|
46
|
-
rest.push(next);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
Object.defineProperty(options, CLI_OPTION_VALUES, {
|
|
51
|
-
value: optionValues,
|
|
52
|
-
enumerable: false,
|
|
53
|
-
configurable: false,
|
|
54
|
-
writable: false
|
|
55
|
-
});
|
|
56
|
-
validateCommandOptions(command, options);
|
|
57
|
-
return { command, options, rest };
|
|
58
|
-
}
|
|
59
|
-
function normalizeCliOptionKey(rawKey) {
|
|
60
|
-
return rawKey.replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
61
|
-
}
|
|
62
|
-
function isShortOptionToken(value) {
|
|
63
|
-
return /^-[^-].*/.test(value) && !isNegativeNumber(value);
|
|
64
|
-
}
|
|
65
|
-
function parseShortOptionToken(token, args, options, optionValues) {
|
|
66
|
-
const body = token.slice(1);
|
|
67
|
-
if (!body) return;
|
|
68
|
-
const equalsIndex = body.indexOf("=");
|
|
69
|
-
const aliasBody = equalsIndex >= 0 ? body.slice(0, equalsIndex) : body;
|
|
70
|
-
const inlineValue = equalsIndex >= 0 ? body.slice(equalsIndex + 1) : null;
|
|
71
|
-
if (aliasBody.length !== 1) {
|
|
72
|
-
for (const alias of aliasBody) {
|
|
73
|
-
const key2 = CLI_SHORT_OPTION_ALIASES[alias];
|
|
74
|
-
if (!key2) {
|
|
75
|
-
throw new CliUsageError(`unknown short option -${alias}`);
|
|
76
|
-
}
|
|
77
|
-
const kind = getAnyCliOptionKind(key2);
|
|
78
|
-
if (kind !== "boolean") {
|
|
79
|
-
throw new CliUsageError(`short option -${alias} requires its own value`);
|
|
80
|
-
}
|
|
81
|
-
setParsedOption(options, optionValues, key2, "true");
|
|
82
|
-
}
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const key = CLI_SHORT_OPTION_ALIASES[aliasBody];
|
|
86
|
-
if (!key) {
|
|
87
|
-
throw new CliUsageError(`unknown short option -${aliasBody}`);
|
|
88
|
-
}
|
|
89
|
-
const value = inlineValue ?? readOptionValue(args, key);
|
|
90
|
-
setParsedOption(options, optionValues, key, value);
|
|
91
|
-
}
|
|
92
|
-
function readOptionValue(args, key, command) {
|
|
93
|
-
const kind = typedOptionKind(key, command);
|
|
94
|
-
if (kind === "boolean") {
|
|
95
|
-
if (args[0] && isBooleanLiteral(args[0])) return args.shift();
|
|
96
|
-
return "true";
|
|
97
|
-
}
|
|
98
|
-
if (kind) {
|
|
99
|
-
const next = args.shift();
|
|
100
|
-
if (next === void 0 || isOptionLike(next) && !isNegativeNumber(next)) {
|
|
101
|
-
if (next !== void 0) args.unshift(next);
|
|
102
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
|
|
103
|
-
}
|
|
104
|
-
return next;
|
|
105
|
-
}
|
|
106
|
-
return args[0] && !args[0].startsWith("--") ? args.shift() : "true";
|
|
107
|
-
}
|
|
108
|
-
function setParsedOption(options, optionValues, key, value, command) {
|
|
109
|
-
validateParsedOptionValue(key, value, command);
|
|
110
|
-
options[key] = value;
|
|
111
|
-
(optionValues[key] ??= []).push(value);
|
|
112
|
-
}
|
|
113
|
-
function validateParsedOptionValue(key, value, command) {
|
|
114
|
-
const kind = typedOptionKind(key, command);
|
|
115
|
-
if (!kind) return;
|
|
116
|
-
if (kind === "boolean") {
|
|
117
|
-
if (!isBooleanLiteral(value)) {
|
|
118
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be a boolean`);
|
|
119
|
-
}
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (value.trim().length === 0 || value === "true") {
|
|
123
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
|
|
124
|
-
}
|
|
125
|
-
if (kind === "number" || kind === "integer") {
|
|
126
|
-
const parsed = Number(value);
|
|
127
|
-
if (!Number.isFinite(parsed)) {
|
|
128
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be ${optionKindPhrase(kind)}`);
|
|
129
|
-
}
|
|
130
|
-
if (kind === "integer" && !Number.isInteger(parsed)) {
|
|
131
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be an integer`);
|
|
132
|
-
}
|
|
133
|
-
if (kind === "integer" && CLI_POSITIVE_INTEGER_OPTIONS.has(key) && parsed <= 0) {
|
|
134
|
-
throw new CliUsageError(`${cliOptionLabel(key)} must be a positive integer`);
|
|
135
|
-
}
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (kind === "json") {
|
|
139
|
-
try {
|
|
140
|
-
parseJsonOption(value, cliOptionLabel(key));
|
|
141
|
-
} catch (error) {
|
|
142
|
-
throw new CliUsageError(error instanceof Error ? error.message : String(error));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
function typedOptionKind(key, command) {
|
|
147
|
-
return command ? getCliOptionKind(command, key) : getAnyCliOptionKind(key);
|
|
148
|
-
}
|
|
149
|
-
function cliOptionLabel(key) {
|
|
150
|
-
return key.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
151
|
-
}
|
|
152
|
-
function optionKindLabel(kind) {
|
|
153
|
-
if (kind === "json") return "JSON value";
|
|
154
|
-
return kind;
|
|
155
|
-
}
|
|
156
|
-
function optionKindPhrase(kind) {
|
|
157
|
-
const label = optionKindLabel(kind);
|
|
158
|
-
return /^[aeiou]/i.test(label) ? `an ${label}` : `a ${label}`;
|
|
159
|
-
}
|
|
160
|
-
function isBooleanLiteral(value) {
|
|
161
|
-
return /^(true|false|1|0|yes|no)$/i.test(value);
|
|
162
|
-
}
|
|
163
|
-
function isOptionLike(value) {
|
|
164
|
-
return value.startsWith("-") && value !== "-";
|
|
165
|
-
}
|
|
166
|
-
function isNegativeNumber(value) {
|
|
167
|
-
return /^-\d+(?:\.\d+)?$/.test(value);
|
|
168
|
-
}
|
|
169
|
-
function validateCommandOptions(command, options) {
|
|
170
|
-
const definition = command ? getCliCommandDefinition(command) : null;
|
|
171
|
-
for (const key of Object.keys(options)) {
|
|
172
|
-
if (!getCliOptionKind(command, key)) {
|
|
173
|
-
const label = cliOptionLabel(key);
|
|
174
|
-
const suffix = definition ? ` for ${definition.name}` : "";
|
|
175
|
-
throw new CliUsageError(`unknown option --${label}${suffix}`);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export {
|
|
181
|
-
CliUsageError,
|
|
182
|
-
parseArgs
|
|
183
|
-
};
|