@rulemetric/cli 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dev.js +7 -0
- package/dist/base-command.js +4 -4
- package/dist/{chunk-7DRLX3DN.js → chunk-3POYC5NA.js} +3 -3
- package/dist/{chunk-TJ2M5QVL.js → chunk-3QH73QOQ.js} +2 -2
- package/dist/{chunk-CXWY5XKD.js → chunk-4LHEN2FS.js} +8 -8
- package/dist/{chunk-CROYS75W.js → chunk-7K4ILWS7.js} +3 -3
- package/dist/{chunk-TDTHAOXO.js → chunk-DR5WLIOU.js} +2 -2
- package/dist/{chunk-T76YQCKX.js → chunk-IATQXFJA.js} +2 -2
- package/dist/{chunk-AUUHXCJU.js → chunk-JEJ3J5J6.js} +2 -2
- package/dist/{chunk-OAQG5WBV.js → chunk-LAKZUE35.js} +2 -2
- package/dist/{chunk-346TGPVR.js → chunk-LTT2YMYY.js} +2 -2
- package/dist/{chunk-CCSR73HF.js → chunk-N5A2IQAK.js} +2 -2
- package/dist/{chunk-VCG4Q53B.js → chunk-OTOWLUOJ.js} +2 -2
- package/dist/{chunk-OKCFYPIQ.js → chunk-RCMXTLQF.js} +2 -2
- package/dist/{chunk-CGUV6TUA.js → chunk-RUCSRN7F.js} +2 -2
- package/dist/{chunk-4UJATBTG.js → chunk-SLL3OBKN.js} +4 -4
- package/dist/{chunk-CB43W53J.js → chunk-SZ7VDCD6.js} +3 -3
- package/dist/{chunk-N52AHNBH.js → chunk-W4MZXKZ2.js} +6 -2
- package/dist/chunk-W4MZXKZ2.js.map +7 -0
- package/dist/{chunk-KHJUQFIK.js → chunk-YSEQWCN4.js} +2 -2
- package/dist/{chunk-CWFVBGX2.js → chunk-ZRLYHBPN.js} +4 -2
- package/dist/chunk-ZRLYHBPN.js.map +7 -0
- package/dist/{chunk-ER5DPPHB.js → chunk-ZSGKRCKD.js} +6 -3
- package/dist/chunk-ZSGKRCKD.js.map +7 -0
- package/dist/commands/antigravity/backfill.js +5 -5
- package/dist/commands/auth/create-key.js +4 -4
- package/dist/commands/auth/login.js +4 -4
- package/dist/commands/auth/logout.js +4 -4
- package/dist/commands/auth/revoke-key.js +4 -4
- package/dist/commands/auth/status.js +4 -4
- package/dist/commands/catalog/index.js +4 -4
- package/dist/commands/catalog/recommend.js +4 -4
- package/dist/commands/convert.js +6 -5
- package/dist/commands/convert.js.map +2 -2
- package/dist/commands/converters.js +4 -4
- package/dist/commands/crons/list.js +4 -4
- package/dist/commands/crons/run.js +4 -4
- package/dist/commands/dashboard.js +4 -4
- package/dist/commands/eval-targets/create.js +4 -4
- package/dist/commands/eval-targets/list.js +4 -4
- package/dist/commands/evals/agent.js +12 -12
- package/dist/commands/evals/benchmark.js +5 -5
- package/dist/commands/evals/compare.js +4 -4
- package/dist/commands/evals/create.js +4 -4
- package/dist/commands/evals/optimize-description.js +4 -4
- package/dist/commands/evals/optimize.js +4 -4
- package/dist/commands/evals/run.js +4 -4
- package/dist/commands/gateway/ensure.js +4 -4
- package/dist/commands/hooks/install.js +4 -4
- package/dist/commands/hooks/run.js +4 -4
- package/dist/commands/hooks/uninstall.js +4 -4
- package/dist/commands/import.js +4 -4
- package/dist/commands/instructions/create.js +4 -4
- package/dist/commands/instructions/delete.js +4 -4
- package/dist/commands/instructions/fork.js +4 -4
- package/dist/commands/instructions/get.js +4 -4
- package/dist/commands/instructions/list.js +4 -4
- package/dist/commands/instructions/promote.js +4 -4
- package/dist/commands/instructions/pull.js +4 -4
- package/dist/commands/instructions/upstream.js +4 -4
- package/dist/commands/instructions/versions.js +4 -4
- package/dist/commands/launcher.js +4 -4
- package/dist/commands/org/current.js +9 -9
- package/dist/commands/org/list.js +6 -6
- package/dist/commands/org/switch.js +7 -7
- package/dist/commands/packs/add-instruction.js +4 -4
- package/dist/commands/packs/apply.js +4 -4
- package/dist/commands/packs/create.js +4 -4
- package/dist/commands/packs/fork.js +4 -4
- package/dist/commands/packs/get.js +4 -4
- package/dist/commands/packs/list.js +4 -4
- package/dist/commands/packs/remove-instruction.js +4 -4
- package/dist/commands/proxy/env.js +4 -4
- package/dist/commands/proxy/logs.js +4 -4
- package/dist/commands/proxy/restart.js +4 -4
- package/dist/commands/proxy/setup.js +4 -4
- package/dist/commands/proxy/start.js +4 -4
- package/dist/commands/proxy/status.js +4 -4
- package/dist/commands/proxy/stop.js +4 -4
- package/dist/commands/research/backfill.js +5 -5
- package/dist/commands/research/tail-transcript.js +5 -5
- package/dist/commands/service/install.js +4 -4
- package/dist/commands/service/status.js +4 -4
- package/dist/commands/service/uninstall.js +4 -4
- package/dist/commands/sessions/analyze.js +4 -4
- package/dist/commands/sessions/end.js +4 -4
- package/dist/commands/sessions/import.js +4 -4
- package/dist/commands/sessions/list.js +4 -4
- package/dist/commands/sessions/start.js +6 -6
- package/dist/commands/setup.js +5 -5
- package/dist/commands/skills/export-approved.js +4 -4
- package/dist/commands/skills/install.js +4 -4
- package/dist/commands/skills/list.js +4 -4
- package/dist/commands/skills/publish.js +4 -4
- package/dist/commands/skills/search.js +4 -4
- package/dist/commands/skills/update.js +4 -4
- package/dist/commands/suggestions/accept.js +4 -4
- package/dist/commands/suggestions/dismiss.js +4 -4
- package/dist/commands/suggestions/list.js +4 -4
- package/dist/commands/suggestions/refresh.js +4 -4
- package/dist/dashboard/Dashboard.js +6 -4
- package/dist/dashboard/Dashboard.js.map +1 -1
- package/dist/dashboard/data.js +3 -1
- package/dist/dashboard/launcher/LauncherOverlay.js +5 -3
- package/dist/dashboard/launcher/api.js +3 -1
- package/dist/dashboard/launcher/useLaunchJobs.js +4 -2
- package/dist/lib/active-org-refresh.js +3 -3
- package/dist/lib/agent-loop.js +9 -9
- package/dist/lib/antigravity-transcript.js +2 -2
- package/dist/lib/api-client.js +3 -1
- package/dist/lib/eval-benchmark.js +2 -2
- package/dist/lib/eval-conversation-handler.js +2 -2
- package/dist/lib/handlers/cron-suggest-instructions.js +2 -2
- package/dist/lib/handlers/process-conversation.js +3 -3
- package/dist/lib/handlers/process-eval.js +2 -2
- package/dist/lib/handlers/process-insights.js +2 -2
- package/dist/lib/handlers/process-launch.js +2 -2
- package/dist/lib/manual-tasks.js +2 -2
- package/dist/lib/research-client.js +2 -2
- package/dist/lib/setup-steps.js +2 -2
- package/dist/lib/terminal-target-heartbeat.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-CWFVBGX2.js.map +0 -7
- package/dist/chunk-ER5DPPHB.js.map +0 -7
- package/dist/chunk-N52AHNBH.js.map +0 -7
- /package/dist/{chunk-7DRLX3DN.js.map → chunk-3POYC5NA.js.map} +0 -0
- /package/dist/{chunk-TJ2M5QVL.js.map → chunk-3QH73QOQ.js.map} +0 -0
- /package/dist/{chunk-CXWY5XKD.js.map → chunk-4LHEN2FS.js.map} +0 -0
- /package/dist/{chunk-CROYS75W.js.map → chunk-7K4ILWS7.js.map} +0 -0
- /package/dist/{chunk-TDTHAOXO.js.map → chunk-DR5WLIOU.js.map} +0 -0
- /package/dist/{chunk-T76YQCKX.js.map → chunk-IATQXFJA.js.map} +0 -0
- /package/dist/{chunk-AUUHXCJU.js.map → chunk-JEJ3J5J6.js.map} +0 -0
- /package/dist/{chunk-OAQG5WBV.js.map → chunk-LAKZUE35.js.map} +0 -0
- /package/dist/{chunk-346TGPVR.js.map → chunk-LTT2YMYY.js.map} +0 -0
- /package/dist/{chunk-CCSR73HF.js.map → chunk-N5A2IQAK.js.map} +0 -0
- /package/dist/{chunk-VCG4Q53B.js.map → chunk-OTOWLUOJ.js.map} +0 -0
- /package/dist/{chunk-OKCFYPIQ.js.map → chunk-RCMXTLQF.js.map} +0 -0
- /package/dist/{chunk-CGUV6TUA.js.map → chunk-RUCSRN7F.js.map} +0 -0
- /package/dist/{chunk-4UJATBTG.js.map → chunk-SLL3OBKN.js.map} +0 -0
- /package/dist/{chunk-CB43W53J.js.map → chunk-SZ7VDCD6.js.map} +0 -0
- /package/dist/{chunk-KHJUQFIK.js.map → chunk-YSEQWCN4.js.map} +0 -0
package/bin/dev.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node --import tsx --no-warnings=ExperimentalWarning
|
|
2
2
|
import {execute} from '@oclif/core'
|
|
3
|
+
|
|
4
|
+
// Dev entry point: default to the LOCAL API so a repo checkout talks to the
|
|
5
|
+
// dev server unless the developer overrides RULEMETRIC_API_URL. The production
|
|
6
|
+
// default (https://rulemetric.com) lives in api-client.ts and applies to the
|
|
7
|
+
// globally-installed CLI (bin/run.js), which end users hit on a fresh install.
|
|
8
|
+
process.env.RULEMETRIC_API_URL ||= 'http://localhost:3000'
|
|
9
|
+
|
|
3
10
|
await execute({development: true, dir: import.meta.url})
|
package/dist/base-command.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SZ7VDCD6.js";
|
|
4
4
|
import "./chunk-R56PH7YE.js";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-CWFVBGX2.js";
|
|
7
|
-
import "./chunk-W2YERO7E.js";
|
|
5
|
+
import "./chunk-SLL3OBKN.js";
|
|
8
6
|
import "./chunk-EKJ2CABV.js";
|
|
7
|
+
import "./chunk-ZRLYHBPN.js";
|
|
8
|
+
import "./chunk-W2YERO7E.js";
|
|
9
9
|
import "./chunk-NSBPE2FW.js";
|
|
10
10
|
export {
|
|
11
11
|
BaseCommand
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processConversationJob
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DR5WLIOU.js";
|
|
4
4
|
import {
|
|
5
5
|
apiPatch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
7
7
|
|
|
8
8
|
// src/lib/handlers/process-conversation.ts
|
|
9
9
|
async function processConversation(payload, helpers) {
|
|
@@ -20,4 +20,4 @@ async function processConversation(payload, helpers) {
|
|
|
20
20
|
export {
|
|
21
21
|
processConversation
|
|
22
22
|
};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-3POYC5NA.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
apiGet,
|
|
3
3
|
apiPost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/eval-benchmark.ts
|
|
7
7
|
function computeStats(values) {
|
|
@@ -89,4 +89,4 @@ export {
|
|
|
89
89
|
aggregateBenchmark,
|
|
90
90
|
postBenchmark
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-3QH73QOQ.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startTerminalTargetHeartbeat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JEJ3J5J6.js";
|
|
4
4
|
import {
|
|
5
5
|
processLaunch
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OTOWLUOJ.js";
|
|
7
7
|
import {
|
|
8
8
|
processRunCleanup
|
|
9
9
|
} from "./chunk-WLFX4PYR.js";
|
|
@@ -18,19 +18,19 @@ import {
|
|
|
18
18
|
} from "./chunk-RQ2TMLKG.js";
|
|
19
19
|
import {
|
|
20
20
|
cronSuggestInstructions
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-IATQXFJA.js";
|
|
22
22
|
import {
|
|
23
23
|
processAnnouncement
|
|
24
24
|
} from "./chunk-BCIUSUEV.js";
|
|
25
25
|
import {
|
|
26
26
|
processConversation
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-3POYC5NA.js";
|
|
28
28
|
import {
|
|
29
29
|
processEval
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-RCMXTLQF.js";
|
|
31
31
|
import {
|
|
32
32
|
processInsights
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-N5A2IQAK.js";
|
|
34
34
|
import {
|
|
35
35
|
isPermanentJobError
|
|
36
36
|
} from "./chunk-DGHWRQXL.js";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
ApiError,
|
|
39
39
|
apiGet,
|
|
40
40
|
apiPost
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
42
42
|
|
|
43
43
|
// src/lib/agent-loop.ts
|
|
44
44
|
var HANDLERS = {
|
|
@@ -267,4 +267,4 @@ export {
|
|
|
267
267
|
pollForWork,
|
|
268
268
|
runAgentLoop
|
|
269
269
|
};
|
|
270
|
-
//# sourceMappingURL=chunk-
|
|
270
|
+
//# sourceMappingURL=chunk-4LHEN2FS.js.map
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./chunk-DTFXCHHI.js";
|
|
4
4
|
import {
|
|
5
5
|
useLaunchJobs
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YSEQWCN4.js";
|
|
7
7
|
import {
|
|
8
8
|
cancelLaunchJob,
|
|
9
9
|
createLaunchJob,
|
|
10
10
|
listLaunchers
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-W4MZXKZ2.js";
|
|
12
12
|
import {
|
|
13
13
|
ActiveJobsList
|
|
14
14
|
} from "./chunk-QD6X4L4L.js";
|
|
@@ -158,4 +158,4 @@ function LauncherOverlay({
|
|
|
158
158
|
export {
|
|
159
159
|
LauncherOverlay
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-7K4ILWS7.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
apiGet,
|
|
12
12
|
apiPost
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
14
14
|
|
|
15
15
|
// src/lib/eval-conversation-handler.ts
|
|
16
16
|
async function processConversationJob(jobConfig, evalTargetId, logger) {
|
|
@@ -217,4 +217,4 @@ async function handleAnalyzeAndPropose(target, evalCases, messages, userFeedback
|
|
|
217
217
|
export {
|
|
218
218
|
processConversationJob
|
|
219
219
|
};
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-DR5WLIOU.js.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
apiGet,
|
|
16
16
|
apiPost
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
18
18
|
|
|
19
19
|
// src/lib/handlers/cron-suggest-instructions.ts
|
|
20
20
|
import { readFileSync } from "node:fs";
|
|
@@ -164,4 +164,4 @@ var cronSuggestInstructions = async (_payload, helpers) => {
|
|
|
164
164
|
export {
|
|
165
165
|
cronSuggestInstructions
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
167
|
+
//# sourceMappingURL=chunk-IATQXFJA.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
apiGet,
|
|
7
7
|
apiPatch
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
9
9
|
|
|
10
10
|
// src/lib/terminal-target-heartbeat.ts
|
|
11
11
|
var DEFAULT_INTERVAL_MS = 6e4;
|
|
@@ -96,4 +96,4 @@ export {
|
|
|
96
96
|
runOneHeartbeatCycle,
|
|
97
97
|
startTerminalTargetHeartbeat
|
|
98
98
|
};
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
99
|
+
//# sourceMappingURL=chunk-JEJ3J5J6.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
apiPost
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/research-client.ts
|
|
7
7
|
function serializeDate(v) {
|
|
@@ -46,4 +46,4 @@ export {
|
|
|
46
46
|
postObservation,
|
|
47
47
|
postObservations
|
|
48
48
|
};
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-LAKZUE35.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-FTJRMUID.js";
|
|
7
7
|
import {
|
|
8
8
|
apiGet
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
10
10
|
import {
|
|
11
11
|
getDefaultConfigDir,
|
|
12
12
|
isAuthenticated
|
|
@@ -306,4 +306,4 @@ export {
|
|
|
306
306
|
isStepId,
|
|
307
307
|
computeStatus
|
|
308
308
|
};
|
|
309
|
-
//# sourceMappingURL=chunk-
|
|
309
|
+
//# sourceMappingURL=chunk-LTT2YMYY.js.map
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
apiGet,
|
|
16
16
|
apiPatch,
|
|
17
17
|
apiPost
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
19
19
|
|
|
20
20
|
// src/lib/handlers/process-insights.ts
|
|
21
21
|
async function processInsights(payload, helpers) {
|
|
@@ -240,4 +240,4 @@ async function buildDataSummaryFromApi(projectPath, projectId) {
|
|
|
240
240
|
export {
|
|
241
241
|
processInsights
|
|
242
242
|
};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-N5A2IQAK.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-DGHWRQXL.js";
|
|
7
7
|
import {
|
|
8
8
|
apiPatch
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
10
10
|
|
|
11
11
|
// src/lib/handlers/process-launch.ts
|
|
12
12
|
async function resolveWorktreeForLaunch(config) {
|
|
@@ -58,4 +58,4 @@ export {
|
|
|
58
58
|
resolveWorktreeForLaunch,
|
|
59
59
|
processLaunch
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-OTOWLUOJ.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
apiGet,
|
|
18
18
|
apiPatch,
|
|
19
19
|
apiPost
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
21
21
|
|
|
22
22
|
// src/lib/handlers/process-eval.ts
|
|
23
23
|
async function processEval(payload, helpers) {
|
|
@@ -188,4 +188,4 @@ function buildSummary(results) {
|
|
|
188
188
|
export {
|
|
189
189
|
processEval
|
|
190
190
|
};
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-RCMXTLQF.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
api
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
5
5
|
|
|
6
6
|
// src/lib/antigravity-transcript.ts
|
|
7
7
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmdirSync, writeFileSync } from "node:fs";
|
|
@@ -304,4 +304,4 @@ export {
|
|
|
304
304
|
tailAntigravityTranscript,
|
|
305
305
|
stateApi
|
|
306
306
|
};
|
|
307
|
-
//# sourceMappingURL=chunk-
|
|
307
|
+
//# sourceMappingURL=chunk-RUCSRN7F.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
apiGet
|
|
3
|
-
} from "./chunk-CWFVBGX2.js";
|
|
4
1
|
import {
|
|
5
2
|
clearActiveOrg,
|
|
6
3
|
isStale,
|
|
7
4
|
readActiveOrg,
|
|
8
5
|
writeActiveOrg
|
|
9
6
|
} from "./chunk-EKJ2CABV.js";
|
|
7
|
+
import {
|
|
8
|
+
apiGet
|
|
9
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
10
10
|
|
|
11
11
|
// src/lib/active-org-refresh.ts
|
|
12
12
|
var attempted = false;
|
|
@@ -56,4 +56,4 @@ export {
|
|
|
56
56
|
bootstrapActiveOrg,
|
|
57
57
|
_resetRefreshAttempt
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-SLL3OBKN.js.map
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-R56PH7YE.js";
|
|
5
5
|
import {
|
|
6
6
|
maybeRefreshActiveOrg
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SLL3OBKN.js";
|
|
8
8
|
import {
|
|
9
9
|
ApiError
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
11
11
|
import {
|
|
12
12
|
isAuthenticated
|
|
13
13
|
} from "./chunk-W2YERO7E.js";
|
|
@@ -60,4 +60,4 @@ ${banner}
|
|
|
60
60
|
export {
|
|
61
61
|
BaseCommand
|
|
62
62
|
};
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
63
|
+
//# sourceMappingURL=chunk-SZ7VDCD6.js.map
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_API_URL
|
|
3
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
4
|
+
|
|
1
5
|
// src/dashboard/launcher/api.ts
|
|
2
6
|
function apiUrl() {
|
|
3
|
-
return process.env.RULEMETRIC_API_URL ??
|
|
7
|
+
return process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;
|
|
4
8
|
}
|
|
5
9
|
function authToken() {
|
|
6
10
|
const t = process.env.RULEMETRIC_API_KEY ?? process.env.RULEMETRIC_ACCESS_TOKEN;
|
|
@@ -44,4 +48,4 @@ export {
|
|
|
44
48
|
cancelLaunchJob,
|
|
45
49
|
listLaunchers
|
|
46
50
|
};
|
|
47
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-W4MZXKZ2.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/dashboard/launcher/api.ts"],
|
|
4
|
+
"sourcesContent": ["import { DEFAULT_API_URL } from '../../lib/api-client.js';\nimport type { LaunchJob, AvailableLauncher, CreateLaunchPayload } from './types.js';\n\nfunction apiUrl(): string {\n return process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;\n}\n\nfunction authToken(): string {\n const t = process.env.RULEMETRIC_API_KEY ?? process.env.RULEMETRIC_ACCESS_TOKEN;\n if (!t) throw new Error('not signed in \u2014 run `rulemetric auth login`');\n return t;\n}\n\nasync function request<T>(path: string, init?: RequestInit): Promise<T> {\n const resp = await fetch(`${apiUrl()}${path}`, {\n ...init,\n headers: {\n Authorization: `Bearer ${authToken()}`,\n 'Content-Type': 'application/json',\n ...(init?.headers ?? {}),\n },\n signal: AbortSignal.timeout(10_000),\n });\n if (!resp.ok) {\n throw new Error(`${resp.status} ${resp.statusText}`);\n }\n return (await resp.json()) as T;\n}\n\nexport function fetchLaunchJobs({ limit }: { limit: number }): Promise<LaunchJob[]> {\n return request<LaunchJob[]>(`/api/launch-jobs?limit=${limit}`);\n}\n\nexport function createLaunchJob(payload: CreateLaunchPayload): Promise<LaunchJob> {\n return request<LaunchJob>('/api/launch-jobs', {\n method: 'POST',\n body: JSON.stringify(payload),\n });\n}\n\nexport function cancelLaunchJob(id: string): Promise<{ ok: true }> {\n return request<{ ok: true }>(`/api/launch-jobs/${id}/cancel`, { method: 'POST' });\n}\n\nexport function listLaunchers(): Promise<AvailableLauncher[]> {\n return request<AvailableLauncher[]>('/api/launchers');\n}\n"],
|
|
5
|
+
"mappings": ";;;;;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
6
6
|
import { useEffect, useState, useCallback, useRef } from "react";
|
|
@@ -48,4 +48,4 @@ function useLaunchJobs(limit = 20) {
|
|
|
48
48
|
export {
|
|
49
49
|
useLaunchJobs
|
|
50
50
|
};
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-YSEQWCN4.js.map
|
|
@@ -25,6 +25,7 @@ function readCliVersion() {
|
|
|
25
25
|
return "0.0.0";
|
|
26
26
|
}
|
|
27
27
|
var version = readCliVersion();
|
|
28
|
+
var DEFAULT_API_URL = "https://rulemetric.com";
|
|
28
29
|
var ApiError = class extends Error {
|
|
29
30
|
constructor(statusCode, message) {
|
|
30
31
|
super(message);
|
|
@@ -33,7 +34,7 @@ var ApiError = class extends Error {
|
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
36
|
function getBaseUrl() {
|
|
36
|
-
const url = process.env.RULEMETRIC_API_URL ?? loadEnvFileAuth().apiUrl ??
|
|
37
|
+
const url = process.env.RULEMETRIC_API_URL ?? loadEnvFileAuth().apiUrl ?? DEFAULT_API_URL;
|
|
37
38
|
const parsed = new URL(url);
|
|
38
39
|
if (parsed.protocol === "http:" && parsed.hostname !== "localhost" && parsed.hostname !== "127.0.0.1") {
|
|
39
40
|
throw new Error(`API URL must use HTTPS for non-localhost hosts: ${url}`);
|
|
@@ -94,6 +95,7 @@ var apiPatch = (path, body) => api(path, { method: "PATCH", body });
|
|
|
94
95
|
var apiDelete = (path) => api(path, { method: "DELETE" });
|
|
95
96
|
|
|
96
97
|
export {
|
|
98
|
+
DEFAULT_API_URL,
|
|
97
99
|
ApiError,
|
|
98
100
|
api,
|
|
99
101
|
apiGet,
|
|
@@ -102,4 +104,4 @@ export {
|
|
|
102
104
|
apiPatch,
|
|
103
105
|
apiDelete
|
|
104
106
|
};
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-ZRLYHBPN.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lib/api-client.ts"],
|
|
4
|
+
"sourcesContent": ["import { fileURLToPath } from 'node:url';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { loadToken, loadEnvFileAuth } from './auth.js';\n\n/**\n * Read the CLI's own version. Walks up from this module's location to find\n * `@rulemetric/cli`'s package.json \u2014 robust whether running unbundled from\n * `src/lib/` (dev) or from a bundled chunk at a different `dist/` depth (prod),\n * where a fixed relative `../../package.json` would resolve to the wrong file.\n */\nfunction readCliVersion(): string {\n let dir = dirname(fileURLToPath(import.meta.url));\n for (let i = 0; i < 8; i++) {\n const pj = join(dir, 'package.json');\n if (existsSync(pj)) {\n try {\n const parsed = JSON.parse(readFileSync(pj, 'utf8')) as { name?: string; version?: string };\n if (parsed.name === '@rulemetric/cli' && parsed.version) return parsed.version;\n } catch {\n /* unreadable/parse error \u2014 keep walking up */\n }\n }\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return '0.0.0';\n}\n\nconst version = readCliVersion();\n\n/**\n * Default API base URL for the CLI. Points at PRODUCTION so a fresh `npm i -g\n * @rulemetric/cli` (no config, no env vars) can `auth login` out of the box.\n * Dev opts into localhost by setting `RULEMETRIC_API_URL` \u2014 `bin/dev.js` sets\n * it to `http://localhost:3000` automatically, and `scripts/start.sh` exports\n * it for the launchd services.\n */\nexport const DEFAULT_API_URL = 'https://rulemetric.com';\n\nexport class ApiError extends Error {\n constructor(\n public statusCode: number,\n message: string,\n ) {\n super(message);\n this.name = 'ApiError';\n }\n}\n\ninterface ApiOptions {\n method?: string;\n body?: unknown;\n headers?: Record<string, string>;\n}\n\nfunction getBaseUrl(): string {\n // Additive fallback to the env file's URL so a key/token read from that same\n // file (see the auth header below) is sent to the SERVER it belongs to,\n // not the localhost default.\n const url = process.env.RULEMETRIC_API_URL ?? loadEnvFileAuth().apiUrl ?? DEFAULT_API_URL;\n\n // Enforce HTTPS for non-localhost URLs\n const parsed = new URL(url);\n if (parsed.protocol === 'http:' && parsed.hostname !== 'localhost' && parsed.hostname !== '127.0.0.1') {\n throw new Error(`API URL must use HTTPS for non-localhost hosts: ${url}`);\n }\n\n return url;\n}\n\nexport async function api<T>(path: string, options: ApiOptions = {}): Promise<T> {\n const baseUrl = getBaseUrl();\n const url = `${baseUrl}${path}`;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'User-Agent': `rulemetric-cli/${version}`,\n ...options.headers,\n };\n\n // Auth header resolution, first match wins:\n // 1. process.env.RULEMETRIC_API_KEY \u2014 exported long-lived key\n // 2. env-file RULEMETRIC_API_KEY \u2014 long-lived key on disk (create-key)\n // 3. auth.json OAuth accessToken \u2014 fresh right after `auth login`\n // 4. env-file RULEMETRIC_ACCESS_TOKEN \u2014 token persisted by login\n // The long-lived API key is preferred over the OAuth token because the latter\n // EXPIRES \u2014 auth.json can hold a stale token, so trying it first would 401\n // (\"Session expired\") even when a valid key sits right there in the env file.\n const envAuth = loadEnvFileAuth();\n const bearer =\n process.env.RULEMETRIC_API_KEY ||\n envAuth.apiKey ||\n loadToken()?.accessToken ||\n envAuth.accessToken;\n if (bearer) {\n headers['Authorization'] = `Bearer ${bearer}`;\n }\n\n // Bypass proxy for localhost API calls \u2014 HTTPS_PROXY is for Claude Code \u2192 Anthropic,\n // not for CLI \u2192 local API. Node.js fetch doesn't respect NO_PROXY reliably, so we\n // temporarily unset the proxy env vars for localhost calls.\n const parsed = new URL(url);\n const isLocalhost = parsed.hostname === 'localhost' || parsed.hostname === '127.0.0.1';\n const savedProxy = process.env.HTTPS_PROXY;\n const savedHttpProxy = process.env.HTTP_PROXY;\n if (isLocalhost) {\n delete process.env.HTTPS_PROXY;\n delete process.env.HTTP_PROXY;\n }\n\n let response: Response;\n try {\n response = await fetch(url, {\n method: options.method ?? 'GET',\n headers,\n body: options.body ? JSON.stringify(options.body) : undefined,\n });\n } finally {\n // Restore proxy vars so claude -p calls still route through the proxy\n if (isLocalhost) {\n if (savedProxy !== undefined) process.env.HTTPS_PROXY = savedProxy;\n if (savedHttpProxy !== undefined) process.env.HTTP_PROXY = savedHttpProxy;\n }\n }\n\n let responseBody: unknown;\n const contentType = response.headers.get('content-type');\n if (contentType?.includes('application/json')) {\n responseBody = await response.json();\n } else {\n responseBody = await response.text();\n }\n\n if (!response.ok) {\n // Extract only the error message, not the full response body\n const message =\n responseBody && typeof responseBody === 'object' && 'error' in responseBody\n ? String((responseBody as { error: string }).error)\n : `HTTP ${response.status}`;\n throw new ApiError(response.status, message);\n }\n\n return responseBody as T;\n}\n\nexport const apiGet = <T>(path: string): Promise<T> => api<T>(path);\nexport const apiPost = <T>(path: string, body: unknown): Promise<T> => api<T>(path, { method: 'POST', body });\nexport const apiPut = <T>(path: string, body: unknown): Promise<T> => api<T>(path, { method: 'PUT', body });\nexport const apiPatch = <T>(path: string, body: unknown): Promise<T> => api<T>(path, { method: 'PATCH', body });\nexport const apiDelete = <T>(path: string): Promise<T> => api<T>(path, { method: 'DELETE' });\n"],
|
|
5
|
+
"mappings": ";;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,YAAY,oBAAoB;AACzC,SAAS,SAAS,YAAY;AAS9B,SAAS,iBAAyB;AAChC,MAAI,MAAM,QAAQ,cAAc,YAAY,GAAG,CAAC;AAChD,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,KAAK,KAAK,KAAK,cAAc;AACnC,QAAI,WAAW,EAAE,GAAG;AAClB,UAAI;AACF,cAAM,SAAS,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC;AAClD,YAAI,OAAO,SAAS,qBAAqB,OAAO,QAAS,QAAO,OAAO;AAAA,MACzE,QAAQ;AAAA,MAER;AAAA,IACF;AACA,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK;AACpB,UAAM;AAAA,EACR;AACA,SAAO;AACT;AAEA,IAAM,UAAU,eAAe;AASxB,IAAM,kBAAkB;AAExB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AQ,IAAI,cAAc;AACxD,UAAI,mBAAmB,OAAW,SAAQ,IAAI,aAAa;AAAA,IAC7D;AAAA,EACF;AAEA,MAAI;AACJ,QAAM,cAAc,SAAS,QAAQ,IAAI,cAAc;AACvD,MAAI,aAAa,SAAS,kBAAkB,GAAG;AAC7C,mBAAe,MAAM,SAAS,KAAK;AAAA,EACrC,OAAO;AACL,mBAAe,MAAM,SAAS,KAAK;AAAA,EACrC;AAEA,MAAI,CAAC,SAAS,IAAI;AAEhB,UAAM,UACJ,gBAAgB,OAAO,iBAAiB,YAAY,WAAW,eAC3D,OAAQ,aAAmC,KAAK,IAChD,QAAQ,SAAS,MAAM;AAC7B,UAAM,IAAI,SAAS,SAAS,QAAQ,OAAO;AAAA,EAC7C;AAEA,SAAO;AACT;AAEO,IAAM,SAAS,CAAI,SAA6B,IAAO,IAAI;AAC3D,IAAM,UAAU,CAAI,MAAc,SAA8B,IAAO,MAAM,EAAE,QAAQ,QAAQ,KAAK,CAAC;AACrG,IAAM,SAAS,CAAI,MAAc,SAA8B,IAAO,MAAM,EAAE,QAAQ,OAAO,KAAK,CAAC;AACnG,IAAM,WAAW,CAAI,MAAc,SAA8B,IAAO,MAAM,EAAE,QAAQ,SAAS,KAAK,CAAC;AACvG,IAAM,YAAY,CAAI,SAA6B,IAAO,MAAM,EAAE,QAAQ,SAAS,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
ClaudeCodeAdapter,
|
|
3
3
|
discoverAllSessions
|
|
4
4
|
} from "./chunk-F5N6CLJJ.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_API_URL
|
|
7
|
+
} from "./chunk-ZRLYHBPN.js";
|
|
5
8
|
|
|
6
9
|
// src/dashboard/data.ts
|
|
7
10
|
import * as fs from "node:fs";
|
|
@@ -77,7 +80,7 @@ async function loadLocalStats(providerFilter) {
|
|
|
77
80
|
return stats;
|
|
78
81
|
}
|
|
79
82
|
async function loadApiInsights(projectPath) {
|
|
80
|
-
const apiUrl = process.env.RULEMETRIC_API_URL ??
|
|
83
|
+
const apiUrl = process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;
|
|
81
84
|
const apiKey = process.env.RULEMETRIC_API_KEY;
|
|
82
85
|
const accessToken = process.env.RULEMETRIC_ACCESS_TOKEN;
|
|
83
86
|
const token = apiKey ?? accessToken;
|
|
@@ -96,7 +99,7 @@ async function loadApiInsights(projectPath) {
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
async function loadLinkedInstructions(projectPath) {
|
|
99
|
-
const apiUrl = process.env.RULEMETRIC_API_URL ??
|
|
102
|
+
const apiUrl = process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;
|
|
100
103
|
const token = process.env.RULEMETRIC_API_KEY ?? process.env.RULEMETRIC_ACCESS_TOKEN;
|
|
101
104
|
if (!token) return null;
|
|
102
105
|
const params = new URLSearchParams();
|
|
@@ -118,4 +121,4 @@ export {
|
|
|
118
121
|
loadApiInsights,
|
|
119
122
|
loadLinkedInstructions
|
|
120
123
|
};
|
|
121
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-ZSGKRCKD.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/dashboard/data.ts"],
|
|
4
|
+
"sourcesContent": ["import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as os from 'node:os';\nimport { discoverAllSessions, ClaudeCodeAdapter } from '@rulemetric/session';\nimport { DEFAULT_API_URL } from '../lib/api-client.js';\nimport type { LocalStats, ApiInsights } from './types.js';\n\n/** Load auth config from env vars \u2192 ~/.config/rulemetric/env \u2192 .env.local */\nfunction ensureEnv(): void {\n if (process.env.RULEMETRIC_API_KEY || process.env.RULEMETRIC_ACCESS_TOKEN) return;\n\n // Try ~/.config/rulemetric/env\n const globalEnv = path.join(os.homedir(), '.config', 'rulemetric', 'env');\n if (loadEnvFile(globalEnv)) return;\n\n // Try .env.local in cwd\n loadEnvFile(path.join(process.cwd(), '.env.local'));\n}\n\nfunction loadEnvFile(filePath: string): boolean {\n try {\n const content = fs.readFileSync(filePath, 'utf-8');\n for (const line of content.split('\\n')) {\n const trimmed = line.trim();\n if (!trimmed || trimmed.startsWith('#')) continue;\n const eqIdx = trimmed.indexOf('=');\n if (eqIdx < 0) continue;\n const key = trimmed.slice(0, eqIdx).trim();\n const value = trimmed.slice(eqIdx + 1).trim();\n if (!process.env[key]) {\n process.env[key] = value;\n }\n }\n return !!(process.env.RULEMETRIC_API_KEY || process.env.RULEMETRIC_ACCESS_TOKEN);\n } catch {\n return false;\n }\n}\n\n// Load on import\nensureEnv();\n\n/** Read local JSONL files and compute basic stats. */\nexport async function loadLocalStats(providerFilter?: string): Promise<LocalStats> {\n const stats: LocalStats = {\n totalSessions: 0,\n totalCalls: 0,\n totalInputTokens: 0,\n totalOutputTokens: 0,\n totalCacheReadTokens: 0,\n totalCacheWriteTokens: 0,\n totalCostUSD: 0,\n providers: {},\n };\n\n const sources = await discoverAllSessions(providerFilter);\n stats.providers = {};\n for (const s of sources) {\n stats.providers[s.provider] = (stats.providers[s.provider] || 0) + 1;\n }\n\n // Parse Claude Code sessions from local JSONL files\n const adapter = new ClaudeCodeAdapter();\n const claudeSources = sources.filter(s => s.provider === 'claude');\n\n for (const source of claudeSources) {\n try {\n const files = fs.readdirSync(source.path).filter(f => f.endsWith('.jsonl'));\n stats.totalSessions += files.length;\n\n for (const file of files) {\n const content = fs.readFileSync(path.join(source.path, file), 'utf-8');\n const parsed = adapter.parse(content);\n\n for (const event of parsed.events) {\n if (event.tokenUsage) {\n stats.totalCalls++;\n stats.totalInputTokens += event.tokenUsage.input;\n stats.totalOutputTokens += event.tokenUsage.output;\n stats.totalCacheReadTokens += event.tokenUsage.cacheRead ?? 0;\n stats.totalCacheWriteTokens += event.tokenUsage.cacheWrite ?? 0;\n }\n }\n }\n } catch {\n // Skip unreadable directories\n }\n }\n\n // Estimate cost (Opus pricing as default)\n const inputCostPerM = 15;\n const outputCostPerM = 75;\n stats.totalCostUSD = Math.round((\n (stats.totalInputTokens / 1_000_000) * inputCostPerM +\n (stats.totalOutputTokens / 1_000_000) * outputCostPerM +\n (stats.totalCacheReadTokens / 1_000_000) * (inputCostPerM * 0.1) +\n (stats.totalCacheWriteTokens / 1_000_000) * (inputCostPerM * 1.25)\n ) * 100) / 100;\n\n return stats;\n}\n\n/** Fetch enriched insights from the API. Returns null if API is unreachable. */\nexport async function loadApiInsights(projectPath?: string): Promise<ApiInsights | null> {\n const apiUrl = process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;\n const apiKey = process.env.RULEMETRIC_API_KEY;\n const accessToken = process.env.RULEMETRIC_ACCESS_TOKEN;\n const token = apiKey ?? accessToken;\n if (!token) return null;\n\n const params = new URLSearchParams();\n if (projectPath) params.set('projectPath', projectPath);\n\n try {\n const resp = await fetch(`${apiUrl}/api/insights/compute?${params}`, {\n headers: { Authorization: `Bearer ${token}` },\n signal: AbortSignal.timeout(5000),\n });\n if (!resp.ok) return null;\n return await resp.json() as ApiInsights;\n } catch {\n return null;\n }\n}\n\n/** Fetch linked instructions from the API. */\nexport async function loadLinkedInstructions(projectPath?: string): Promise<Array<{ name: string; linkedSessions: number }> | null> {\n const apiUrl = process.env.RULEMETRIC_API_URL ?? DEFAULT_API_URL;\n const token = process.env.RULEMETRIC_API_KEY ?? process.env.RULEMETRIC_ACCESS_TOKEN;\n if (!token) return null;\n\n const params = new URLSearchParams();\n if (projectPath) params.set('projectPath', projectPath);\n\n try {\n const resp = await fetch(`${apiUrl}/api/insights/linked-instructions?${params}`, {\n headers: { Authorization: `Bearer ${token}` },\n signal: AbortSignal.timeout(5000),\n });\n if (!resp.ok) return null;\n return await resp.json() as Array<{ name: string; linkedSessions: number }>;\n } catch {\n return null;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA,YAAY,QAAQ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AAAA,MACnE,SAAS,EAAE,eAAe,UAAU,KAAK,GAAG;AAAA,MAC5C,QAAQ,YAAY,QAAQ,GAAI;AAAA,IAClC,CAAC;AACD,QAAI,CAAC,KAAK,GAAI,QAAO;AACrB,WAAO,MAAM,KAAK,KAAK;AAAA,EACzB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,eAAsB,uBAAuB,aAAuF;AAClI,QAAM,SAAS,QAAQ,IAAI,sBAAsB;AACjD,QAAM,QAAQ,QAAQ,IAAI,sBAAsB,QAAQ,IAAI;AAC5D,MAAI,CAAC,MAAO,QAAO;AAEnB,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,YAAa,QAAO,IAAI,eAAe,WAAW;AAEtD,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,GAAG,MAAM,qCAAqC,MAAM,IAAI;AAAA,MAC/E,SAAS,EAAE,eAAe,UAAU,KAAK,GAAG;AAAA,MAC5C,QAAQ,YAAY,QAAQ,GAAI;AAAA,IAClC,CAAC;AACD,QAAI,CAAC,KAAK,GAAI,QAAO;AACrB,WAAO,MAAM,KAAK,KAAK;AAAA,EACzB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
findMaxStepIndex,
|
|
4
4
|
readNewRecords,
|
|
5
5
|
stateApi
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-RUCSRN7F.js";
|
|
7
7
|
import {
|
|
8
8
|
BaseCommand
|
|
9
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
10
10
|
import "../../chunk-R56PH7YE.js";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-CWFVBGX2.js";
|
|
13
|
-
import "../../chunk-W2YERO7E.js";
|
|
11
|
+
import "../../chunk-SLL3OBKN.js";
|
|
14
12
|
import "../../chunk-EKJ2CABV.js";
|
|
13
|
+
import "../../chunk-ZRLYHBPN.js";
|
|
14
|
+
import "../../chunk-W2YERO7E.js";
|
|
15
15
|
import "../../chunk-NSBPE2FW.js";
|
|
16
16
|
|
|
17
17
|
// src/commands/antigravity/backfill.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
4
4
|
import "../../chunk-R56PH7YE.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-SLL3OBKN.js";
|
|
6
|
+
import "../../chunk-EKJ2CABV.js";
|
|
6
7
|
import {
|
|
7
8
|
apiPost
|
|
8
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-ZRLYHBPN.js";
|
|
9
10
|
import {
|
|
10
11
|
getDefaultConfigDir,
|
|
11
12
|
saveApiKey
|
|
12
13
|
} from "../../chunk-W2YERO7E.js";
|
|
13
|
-
import "../../chunk-EKJ2CABV.js";
|
|
14
14
|
import "../../chunk-NSBPE2FW.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/auth/create-key.ts
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
4
4
|
import "../../chunk-R56PH7YE.js";
|
|
5
5
|
import {
|
|
6
6
|
bootstrapActiveOrg
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-SLL3OBKN.js";
|
|
8
|
+
import "../../chunk-EKJ2CABV.js";
|
|
8
9
|
import {
|
|
9
10
|
apiPost
|
|
10
|
-
} from "../../chunk-
|
|
11
|
+
} from "../../chunk-ZRLYHBPN.js";
|
|
11
12
|
import {
|
|
12
13
|
saveEnvFile,
|
|
13
14
|
saveToken
|
|
14
15
|
} from "../../chunk-W2YERO7E.js";
|
|
15
|
-
import "../../chunk-EKJ2CABV.js";
|
|
16
16
|
import "../../chunk-NSBPE2FW.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/auth/login.ts
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
4
4
|
import "../../chunk-R56PH7YE.js";
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-SLL3OBKN.js";
|
|
6
|
+
import "../../chunk-EKJ2CABV.js";
|
|
7
|
+
import "../../chunk-ZRLYHBPN.js";
|
|
7
8
|
import {
|
|
8
9
|
clearEnvFile,
|
|
9
10
|
clearToken
|
|
10
11
|
} from "../../chunk-W2YERO7E.js";
|
|
11
|
-
import "../../chunk-EKJ2CABV.js";
|
|
12
12
|
import "../../chunk-NSBPE2FW.js";
|
|
13
13
|
|
|
14
14
|
// src/commands/auth/logout.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
4
4
|
import "../../chunk-R56PH7YE.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-SLL3OBKN.js";
|
|
6
|
+
import "../../chunk-EKJ2CABV.js";
|
|
6
7
|
import {
|
|
7
8
|
apiDelete
|
|
8
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-ZRLYHBPN.js";
|
|
9
10
|
import "../../chunk-W2YERO7E.js";
|
|
10
|
-
import "../../chunk-EKJ2CABV.js";
|
|
11
11
|
import "../../chunk-NSBPE2FW.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/auth/revoke-key.ts
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "../../chunk-BZDKEQKU.js";
|
|
4
4
|
import {
|
|
5
5
|
BaseCommand
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
7
7
|
import "../../chunk-R56PH7YE.js";
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
import "../../chunk-SLL3OBKN.js";
|
|
9
|
+
import "../../chunk-EKJ2CABV.js";
|
|
10
|
+
import "../../chunk-ZRLYHBPN.js";
|
|
10
11
|
import {
|
|
11
12
|
getDefaultConfigDir,
|
|
12
13
|
isAuthenticated,
|
|
13
14
|
loadToken
|
|
14
15
|
} from "../../chunk-W2YERO7E.js";
|
|
15
|
-
import "../../chunk-EKJ2CABV.js";
|
|
16
16
|
import "../../chunk-NSBPE2FW.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/auth/status.ts
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
} from "../../chunk-BZDKEQKU.js";
|
|
6
6
|
import {
|
|
7
7
|
BaseCommand
|
|
8
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
9
9
|
import "../../chunk-R56PH7YE.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-SLL3OBKN.js";
|
|
11
|
+
import "../../chunk-EKJ2CABV.js";
|
|
11
12
|
import {
|
|
12
13
|
apiGet
|
|
13
|
-
} from "../../chunk-
|
|
14
|
+
} from "../../chunk-ZRLYHBPN.js";
|
|
14
15
|
import "../../chunk-W2YERO7E.js";
|
|
15
|
-
import "../../chunk-EKJ2CABV.js";
|
|
16
16
|
import "../../chunk-NSBPE2FW.js";
|
|
17
17
|
|
|
18
18
|
// src/commands/catalog/index.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseCommand
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-SZ7VDCD6.js";
|
|
4
4
|
import "../../chunk-R56PH7YE.js";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-SLL3OBKN.js";
|
|
6
|
+
import "../../chunk-EKJ2CABV.js";
|
|
6
7
|
import {
|
|
7
8
|
apiPost
|
|
8
|
-
} from "../../chunk-
|
|
9
|
+
} from "../../chunk-ZRLYHBPN.js";
|
|
9
10
|
import "../../chunk-W2YERO7E.js";
|
|
10
|
-
import "../../chunk-EKJ2CABV.js";
|
|
11
11
|
import "../../chunk-NSBPE2FW.js";
|
|
12
12
|
|
|
13
13
|
// src/commands/catalog/recommend.ts
|