@canaryai/cli 0.2.9 → 0.2.13
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-PWWQGYFG.js → chunk-ACRIE2YR.js} +5 -2
- package/dist/chunk-ACRIE2YR.js.map +1 -0
- package/dist/chunk-BOS2YLKH.js +233 -0
- package/dist/chunk-BOS2YLKH.js.map +1 -0
- package/dist/{chunk-XGO62PO2.js → chunk-IFOJT3A5.js} +1198 -262
- package/dist/chunk-IFOJT3A5.js.map +1 -0
- package/dist/{chunk-LC7ZVXPH.js → chunk-SVU2XTYZ.js} +19 -5
- package/dist/chunk-SVU2XTYZ.js.map +1 -0
- package/dist/{chunk-A44B2PEA.js → chunk-SYPQF57S.js} +40 -8
- package/dist/chunk-SYPQF57S.js.map +1 -0
- package/dist/{chunk-C2PGZRYK.js → chunk-Z3F373YR.js} +37 -11
- package/dist/chunk-Z3F373YR.js.map +1 -0
- package/dist/{debug-workflow-I3F36JBL.js → debug-workflow-K2LL6CO4.js} +10 -12
- package/dist/debug-workflow-K2LL6CO4.js.map +1 -0
- package/dist/{docs-REHST3YB.js → docs-SR7CW24Y.js} +19 -14
- package/dist/docs-SR7CW24Y.js.map +1 -0
- package/dist/{feature-flag-3HB5NTMY.js → feature-flag-BIPFVVNC.js} +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +83 -155
- package/dist/index.js.map +1 -1
- package/dist/init-KXAVWHYE.js +146 -0
- package/dist/init-KXAVWHYE.js.map +1 -0
- package/dist/{issues-YU57CHXS.js → issues-EWVB52CA.js} +37 -18
- package/dist/issues-EWVB52CA.js.map +1 -0
- package/dist/{knobs-QJ4IBLCT.js → knobs-VYABZESR.js} +3 -3
- package/dist/list-RCPYLS36.js +57 -0
- package/dist/list-RCPYLS36.js.map +1 -0
- package/dist/local-34FX3M5K.js +63 -0
- package/dist/local-34FX3M5K.js.map +1 -0
- package/dist/{local-browser-MKTJ36KY.js → local-browser-VPOSJS52.js} +4 -4
- package/dist/login-MSIM2VIH.js +130 -0
- package/dist/login-MSIM2VIH.js.map +1 -0
- package/dist/{mcp-ZOKM2AUE.js → mcp-YBR7G254.js} +7 -132
- package/dist/mcp-YBR7G254.js.map +1 -0
- package/dist/{psql-2YPIRMDY.js → psql-XO5BB5L5.js} +2 -2
- package/dist/{record-TNDBT3NY.js → record-DXXQHPGT.js} +10 -51
- package/dist/record-DXXQHPGT.js.map +1 -0
- package/dist/{redis-A7GWM23E.js → redis-CQTBPZ6F.js} +2 -2
- package/dist/{release-L4IXOHDF.js → release-DW7RPQSQ.js} +9 -5
- package/dist/release-DW7RPQSQ.js.map +1 -0
- package/dist/runner/preload.js +1 -1
- package/dist/{session-RNLKFS2Z.js → session-XQGCLWNC.js} +164 -75
- package/dist/session-XQGCLWNC.js.map +1 -0
- package/dist/skill-2TXI3IKP.js +424 -0
- package/dist/skill-2TXI3IKP.js.map +1 -0
- package/dist/{src-2WSMYBMJ.js → src-F7LQ5PY2.js} +8 -2
- package/dist/start-ZOMUD6LW.js +112 -0
- package/dist/start-ZOMUD6LW.js.map +1 -0
- package/dist/test.js +1 -1
- package/dist/test.js.map +1 -1
- package/dist/workflow-5UZTKX7X.js +624 -0
- package/dist/workflow-5UZTKX7X.js.map +1 -0
- package/package.json +1 -2
- package/dist/chunk-A44B2PEA.js.map +0 -1
- package/dist/chunk-C2PGZRYK.js.map +0 -1
- package/dist/chunk-DXIAHB72.js +0 -340
- package/dist/chunk-DXIAHB72.js.map +0 -1
- package/dist/chunk-LC7ZVXPH.js.map +0 -1
- package/dist/chunk-PWWQGYFG.js.map +0 -1
- package/dist/chunk-QLFSJG5O.js +0 -93
- package/dist/chunk-QLFSJG5O.js.map +0 -1
- package/dist/chunk-XGO62PO2.js.map +0 -1
- package/dist/debug-workflow-I3F36JBL.js.map +0 -1
- package/dist/docs-REHST3YB.js.map +0 -1
- package/dist/issues-YU57CHXS.js.map +0 -1
- package/dist/mcp-ZOKM2AUE.js.map +0 -1
- package/dist/record-TNDBT3NY.js.map +0 -1
- package/dist/release-L4IXOHDF.js.map +0 -1
- package/dist/session-RNLKFS2Z.js.map +0 -1
- package/dist/skill-CZ7SHI3P.js +0 -156
- package/dist/skill-CZ7SHI3P.js.map +0 -1
- /package/dist/{feature-flag-3HB5NTMY.js.map → feature-flag-BIPFVVNC.js.map} +0 -0
- /package/dist/{knobs-QJ4IBLCT.js.map → knobs-VYABZESR.js.map} +0 -0
- /package/dist/{local-browser-MKTJ36KY.js.map → local-browser-VPOSJS52.js.map} +0 -0
- /package/dist/{psql-2YPIRMDY.js.map → psql-XO5BB5L5.js.map} +0 -0
- /package/dist/{redis-A7GWM23E.js.map → redis-CQTBPZ6F.js.map} +0 -0
- /package/dist/{src-2WSMYBMJ.js.map → src-F7LQ5PY2.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
connectTunnel,
|
|
4
|
-
createLocalRun,
|
|
5
|
-
createTunnel,
|
|
6
|
-
runLocalTest,
|
|
7
|
-
runTunnel
|
|
8
|
-
} from "./chunk-DXIAHB72.js";
|
|
9
2
|
import {
|
|
10
3
|
ENV_URLS,
|
|
11
4
|
envToProfile,
|
|
@@ -16,7 +9,7 @@ import {
|
|
|
16
9
|
readStoredToken,
|
|
17
10
|
resolveConfig,
|
|
18
11
|
saveAuth
|
|
19
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-ACRIE2YR.js";
|
|
20
13
|
import {
|
|
21
14
|
makeTempDirSync
|
|
22
15
|
} from "./chunk-XAA5VQ5N.js";
|
|
@@ -27,7 +20,7 @@ import {
|
|
|
27
20
|
// src/index.ts
|
|
28
21
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
29
22
|
import { createRequire as createRequire2 } from "module";
|
|
30
|
-
import
|
|
23
|
+
import process6 from "process";
|
|
31
24
|
import path4 from "path";
|
|
32
25
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
33
26
|
|
|
@@ -185,11 +178,10 @@ function buildReporterArgs(requested, jsonReportPath) {
|
|
|
185
178
|
if (requested && requested !== "default") return requested;
|
|
186
179
|
return `list,json=${jsonReportPath}`;
|
|
187
180
|
}
|
|
188
|
-
function prepareArtifactsDir(
|
|
181
|
+
function prepareArtifactsDir(_cwd) {
|
|
189
182
|
const dir = makeTempDirSync("canary-run-");
|
|
190
183
|
const jsonReportPath = path2.join(dir, "report.json");
|
|
191
184
|
const eventLogPath = path2.join(dir, "events-worker-0.jsonl");
|
|
192
|
-
const artifactsDir = path2.join(cwd, "test-results", "ai-healer");
|
|
193
185
|
return { jsonReportPath, eventLogPath, artifactsDir: dir };
|
|
194
186
|
}
|
|
195
187
|
function buildEnv(params) {
|
|
@@ -244,7 +236,12 @@ async function spawnPlaywright(opts) {
|
|
|
244
236
|
}
|
|
245
237
|
child.on("close", (code) => {
|
|
246
238
|
if (timer) clearTimeout(timer);
|
|
247
|
-
resolve({
|
|
239
|
+
resolve({
|
|
240
|
+
exitCode: code ?? 1,
|
|
241
|
+
output: output || void 0,
|
|
242
|
+
durationMs: Date.now() - started,
|
|
243
|
+
error
|
|
244
|
+
});
|
|
248
245
|
});
|
|
249
246
|
});
|
|
250
247
|
}
|
|
@@ -517,7 +514,7 @@ Choice [1-${orgs.length}]: `);
|
|
|
517
514
|
|
|
518
515
|
// src/orgs.ts
|
|
519
516
|
import process3 from "process";
|
|
520
|
-
async function runOrgs(
|
|
517
|
+
async function runOrgs(_argv) {
|
|
521
518
|
const token = process3.env.CANARY_API_TOKEN ?? await readStoredToken();
|
|
522
519
|
if (!token) {
|
|
523
520
|
console.error("Not logged in. Run: canary login");
|
|
@@ -547,79 +544,10 @@ async function runOrgs(argv) {
|
|
|
547
544
|
console.log("To switch: canary login --org <name>");
|
|
548
545
|
}
|
|
549
546
|
|
|
550
|
-
// src/run-local.ts
|
|
551
|
-
import process4 from "process";
|
|
552
|
-
function getArgValue2(argv, key) {
|
|
553
|
-
const index = argv.indexOf(key);
|
|
554
|
-
if (index === -1) return void 0;
|
|
555
|
-
return argv[index + 1];
|
|
556
|
-
}
|
|
557
|
-
async function runLocalSession(argv) {
|
|
558
|
-
const apiUrl = getArgValue2(argv, "--api-url") ?? process4.env.CANARY_API_URL ?? "https://api.trycanary.ai";
|
|
559
|
-
const token = getArgValue2(argv, "--token") ?? process4.env.CANARY_API_TOKEN ?? await readStoredToken();
|
|
560
|
-
if (!token) {
|
|
561
|
-
console.error("Missing token. Run `canary login` first or set CANARY_API_TOKEN.");
|
|
562
|
-
process4.exit(1);
|
|
563
|
-
}
|
|
564
|
-
const portRaw = getArgValue2(argv, "--port") ?? process4.env.CANARY_LOCAL_PORT;
|
|
565
|
-
const tunnelUrl = getArgValue2(argv, "--tunnel-url");
|
|
566
|
-
const title = getArgValue2(argv, "--title");
|
|
567
|
-
const featureSpec = getArgValue2(argv, "--feature");
|
|
568
|
-
const startUrl = getArgValue2(argv, "--start-url");
|
|
569
|
-
if (!tunnelUrl && !portRaw) {
|
|
570
|
-
console.error("Missing --port or --tunnel-url");
|
|
571
|
-
process4.exit(1);
|
|
572
|
-
}
|
|
573
|
-
let publicUrl = tunnelUrl;
|
|
574
|
-
let ws = null;
|
|
575
|
-
if (!publicUrl && portRaw) {
|
|
576
|
-
const port = Number(portRaw);
|
|
577
|
-
if (Number.isNaN(port) || port <= 0) {
|
|
578
|
-
console.error("Invalid --port value");
|
|
579
|
-
process4.exit(1);
|
|
580
|
-
}
|
|
581
|
-
const tunnel = await createTunnel({ apiUrl, token, port });
|
|
582
|
-
publicUrl = tunnel.publicUrl;
|
|
583
|
-
ws = connectTunnel({
|
|
584
|
-
apiUrl,
|
|
585
|
-
tunnelId: tunnel.tunnelId,
|
|
586
|
-
token: tunnel.token,
|
|
587
|
-
port,
|
|
588
|
-
onReady: () => {
|
|
589
|
-
console.log(`Tunnel connected: ${publicUrl ?? tunnel.tunnelId}`);
|
|
590
|
-
}
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
if (!publicUrl) {
|
|
594
|
-
console.error("Failed to resolve tunnel URL");
|
|
595
|
-
process4.exit(1);
|
|
596
|
-
}
|
|
597
|
-
const run2 = await createLocalRun({
|
|
598
|
-
apiUrl,
|
|
599
|
-
token,
|
|
600
|
-
title,
|
|
601
|
-
featureSpec,
|
|
602
|
-
startUrl,
|
|
603
|
-
tunnelUrl: publicUrl
|
|
604
|
-
});
|
|
605
|
-
console.log(`Local test queued: ${run2.runId}`);
|
|
606
|
-
if (run2.watchUrl) {
|
|
607
|
-
console.log(`Watch: ${run2.watchUrl}`);
|
|
608
|
-
}
|
|
609
|
-
if (ws) {
|
|
610
|
-
console.log("Tunnel active. Press Ctrl+C to stop.");
|
|
611
|
-
process4.on("SIGINT", () => {
|
|
612
|
-
ws?.close();
|
|
613
|
-
process4.exit(0);
|
|
614
|
-
});
|
|
615
|
-
await new Promise(() => void 0);
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
547
|
// src/remote-test.ts
|
|
620
|
-
import
|
|
548
|
+
import process4 from "process";
|
|
621
549
|
import { createParser } from "eventsource-parser";
|
|
622
|
-
function
|
|
550
|
+
function getArgValue2(argv, key) {
|
|
623
551
|
const index = argv.indexOf(key);
|
|
624
552
|
if (index === -1 || index >= argv.length - 1) return void 0;
|
|
625
553
|
return argv[index + 1];
|
|
@@ -708,12 +636,12 @@ ${available}`
|
|
|
708
636
|
return result;
|
|
709
637
|
}
|
|
710
638
|
async function runRemoteTest(argv) {
|
|
711
|
-
const apiUrl =
|
|
712
|
-
const token =
|
|
713
|
-
const tag =
|
|
714
|
-
const namePattern =
|
|
715
|
-
const propertyArg =
|
|
716
|
-
const environmentArg =
|
|
639
|
+
const apiUrl = getArgValue2(argv, "--api-url") ?? process4.env.CANARY_API_URL ?? "https://api.trycanary.ai";
|
|
640
|
+
const token = getArgValue2(argv, "--token") ?? process4.env.CANARY_API_TOKEN ?? await readStoredToken();
|
|
641
|
+
const tag = getArgValue2(argv, "--tag");
|
|
642
|
+
const namePattern = getArgValue2(argv, "--name-pattern");
|
|
643
|
+
const propertyArg = getArgValue2(argv, "--property");
|
|
644
|
+
const environmentArg = getArgValue2(argv, "--environment");
|
|
717
645
|
const verbose = hasFlag2(argv, "--verbose", "-v");
|
|
718
646
|
if (!token) {
|
|
719
647
|
console.error("Error: No API token found.");
|
|
@@ -723,7 +651,7 @@ async function runRemoteTest(argv) {
|
|
|
723
651
|
console.error("");
|
|
724
652
|
console.error("Or create an API key in Settings > API Keys and pass it:");
|
|
725
653
|
console.error(" canary test --remote --token cnry_...");
|
|
726
|
-
|
|
654
|
+
process4.exit(1);
|
|
727
655
|
}
|
|
728
656
|
let resolvedConfig = {};
|
|
729
657
|
if (propertyArg || environmentArg) {
|
|
@@ -731,7 +659,7 @@ async function runRemoteTest(argv) {
|
|
|
731
659
|
resolvedConfig = await resolveTestConfig(apiUrl, token, propertyArg, environmentArg);
|
|
732
660
|
} catch (err) {
|
|
733
661
|
console.error(`${err instanceof Error ? err.message : String(err)}`);
|
|
734
|
-
|
|
662
|
+
process4.exit(1);
|
|
735
663
|
}
|
|
736
664
|
}
|
|
737
665
|
console.log("Starting remote workflow tests...");
|
|
@@ -759,18 +687,18 @@ async function runRemoteTest(argv) {
|
|
|
759
687
|
});
|
|
760
688
|
} catch (err) {
|
|
761
689
|
console.error(`Failed to connect to API: ${err}`);
|
|
762
|
-
|
|
690
|
+
process4.exit(1);
|
|
763
691
|
}
|
|
764
692
|
if (!triggerRes.ok) {
|
|
765
693
|
const errorText = await triggerRes.text();
|
|
766
694
|
console.error(`Failed to start tests: ${triggerRes.status}`);
|
|
767
695
|
console.error(errorText);
|
|
768
|
-
|
|
696
|
+
process4.exit(1);
|
|
769
697
|
}
|
|
770
698
|
const triggerData = await triggerRes.json();
|
|
771
699
|
if (!triggerData.ok || !triggerData.suiteId) {
|
|
772
700
|
console.error(`Failed to start tests: ${triggerData.error ?? "Unknown error"}`);
|
|
773
|
-
|
|
701
|
+
process4.exit(1);
|
|
774
702
|
}
|
|
775
703
|
const { suiteId, jobId, appUrl } = triggerData;
|
|
776
704
|
if (verbose) {
|
|
@@ -789,11 +717,11 @@ async function runRemoteTest(argv) {
|
|
|
789
717
|
});
|
|
790
718
|
} catch (err) {
|
|
791
719
|
console.error(`Failed to connect to event stream: ${err}`);
|
|
792
|
-
|
|
720
|
+
process4.exit(1);
|
|
793
721
|
}
|
|
794
722
|
if (!streamRes.ok || !streamRes.body) {
|
|
795
723
|
console.error(`Failed to connect to event stream: ${streamRes.status}`);
|
|
796
|
-
|
|
724
|
+
process4.exit(1);
|
|
797
725
|
}
|
|
798
726
|
let exitCode = 0;
|
|
799
727
|
let hasCompleted = false;
|
|
@@ -869,7 +797,7 @@ async function runRemoteTest(argv) {
|
|
|
869
797
|
console.log("\u2500".repeat(50));
|
|
870
798
|
if (totalWorkflows === 0) {
|
|
871
799
|
console.log("No workflows found matching the filter criteria.");
|
|
872
|
-
|
|
800
|
+
process4.exit(0);
|
|
873
801
|
}
|
|
874
802
|
const passRate = totalWorkflows > 0 ? Math.round(successfulWorkflows / totalWorkflows * 100) : 0;
|
|
875
803
|
if (failedWorkflows > 0) {
|
|
@@ -886,14 +814,14 @@ async function runRemoteTest(argv) {
|
|
|
886
814
|
if (failedSection) {
|
|
887
815
|
console.log(failedSection);
|
|
888
816
|
}
|
|
889
|
-
|
|
817
|
+
process4.exit(exitCode);
|
|
890
818
|
}
|
|
891
819
|
|
|
892
820
|
// src/debug-session.ts
|
|
893
821
|
import fs3 from "fs/promises";
|
|
894
822
|
import os from "os";
|
|
895
823
|
import path3 from "path";
|
|
896
|
-
import
|
|
824
|
+
import process5 from "process";
|
|
897
825
|
async function writeDebugSession(loginUrl, expiresAt, apiUrl) {
|
|
898
826
|
const dir = path3.join(os.homedir(), ".config", "canary-cli");
|
|
899
827
|
const filePath = path3.join(dir, "debug-session.json");
|
|
@@ -921,17 +849,17 @@ async function runDebugSession(argv) {
|
|
|
921
849
|
if (res.status === 401) {
|
|
922
850
|
console.error("Error: Unauthorized. Your session may have expired.");
|
|
923
851
|
console.error("Run: canary login");
|
|
924
|
-
|
|
852
|
+
process5.exit(1);
|
|
925
853
|
}
|
|
926
854
|
if (res.status === 403) {
|
|
927
855
|
console.error("Error: Forbidden. Debug session creation requires superadmin access.");
|
|
928
|
-
|
|
856
|
+
process5.exit(1);
|
|
929
857
|
}
|
|
930
858
|
if (res.status === 404) {
|
|
931
859
|
console.error(
|
|
932
860
|
"Error: Endpoint not found. The debug-session feature may not be deployed to this environment."
|
|
933
861
|
);
|
|
934
|
-
|
|
862
|
+
process5.exit(1);
|
|
935
863
|
}
|
|
936
864
|
try {
|
|
937
865
|
const errorJson = JSON.parse(text);
|
|
@@ -939,12 +867,12 @@ async function runDebugSession(argv) {
|
|
|
939
867
|
} catch {
|
|
940
868
|
console.error(`Error (${res.status}): ${text || res.statusText}`);
|
|
941
869
|
}
|
|
942
|
-
|
|
870
|
+
process5.exit(1);
|
|
943
871
|
}
|
|
944
872
|
const json = await res.json();
|
|
945
873
|
if (!json.ok || !json.loginUrl) {
|
|
946
874
|
console.error(`Error: ${json.message ?? json.error ?? "Failed to create debug session"}`);
|
|
947
|
-
|
|
875
|
+
process5.exit(1);
|
|
948
876
|
}
|
|
949
877
|
const filePath = await writeDebugSession(json.loginUrl, json.expiresAt ?? "", apiUrl);
|
|
950
878
|
if (jsonOutput) {
|
|
@@ -971,7 +899,7 @@ async function runDebugSession(argv) {
|
|
|
971
899
|
}
|
|
972
900
|
} catch (err) {
|
|
973
901
|
console.error(`Failed to create debug session: ${err}`);
|
|
974
|
-
|
|
902
|
+
process5.exit(1);
|
|
975
903
|
}
|
|
976
904
|
}
|
|
977
905
|
|
|
@@ -1000,11 +928,12 @@ function isSuperadminToken(token) {
|
|
|
1000
928
|
// src/index.ts
|
|
1001
929
|
var require2 = createRequire2(import.meta.url);
|
|
1002
930
|
var pkg = require2("../package.json");
|
|
1003
|
-
var loadMcp = () => import("./mcp-
|
|
1004
|
-
var loadLocalBrowser = () => import("./local-browser-
|
|
1005
|
-
var loadDebugWorkflow = () => import("./debug-workflow-
|
|
1006
|
-
var loadRecord = () => import("./record-
|
|
1007
|
-
var loadSession = () => import("./session-
|
|
931
|
+
var loadMcp = () => import("./mcp-YBR7G254.js").then((m) => m.runMcp);
|
|
932
|
+
var loadLocalBrowser = () => import("./local-browser-VPOSJS52.js").then((m) => m.runLocalBrowser);
|
|
933
|
+
var loadDebugWorkflow = () => import("./debug-workflow-K2LL6CO4.js").then((m) => m.runDebugWorkflow);
|
|
934
|
+
var loadRecord = () => import("./record-DXXQHPGT.js").then((m) => m.runRecord);
|
|
935
|
+
var loadSession = () => import("./session-XQGCLWNC.js").then((m) => m.runSession);
|
|
936
|
+
var loadLocal = () => import("./local-34FX3M5K.js").then((m) => m.runLocal);
|
|
1008
937
|
var canary = { run };
|
|
1009
938
|
var baseDir = typeof __dirname !== "undefined" ? __dirname : path4.dirname(fileURLToPath2(import.meta.url));
|
|
1010
939
|
var preloadPath = path4.join(baseDir, "runner", "preload.js");
|
|
@@ -1012,23 +941,23 @@ var requireFn = makeRequire();
|
|
|
1012
941
|
function runPlaywrightTests(args) {
|
|
1013
942
|
const playwrightCli = requireFn.resolve("@playwright/test/cli");
|
|
1014
943
|
const { runnerBin, preloadFlag } = resolveRunner(preloadPath);
|
|
1015
|
-
const nodeOptions =
|
|
944
|
+
const nodeOptions = process6.env.NODE_OPTIONS && preloadFlag ? `${process6.env.NODE_OPTIONS} ${preloadFlag}` : preloadFlag ?? process6.env.NODE_OPTIONS;
|
|
1016
945
|
const env = {
|
|
1017
|
-
...
|
|
1018
|
-
CANARY_ENABLED:
|
|
946
|
+
...process6.env,
|
|
947
|
+
CANARY_ENABLED: process6.env.CANARY_ENABLED ?? "1",
|
|
1019
948
|
CANARY_RUNNER: "canary",
|
|
1020
949
|
...nodeOptions ? { NODE_OPTIONS: nodeOptions } : {}
|
|
1021
950
|
};
|
|
1022
951
|
const result = spawnSync2(runnerBin, [playwrightCli, "test", ...args], {
|
|
1023
952
|
env,
|
|
1024
953
|
stdio: "inherit",
|
|
1025
|
-
cwd:
|
|
954
|
+
cwd: process6.cwd()
|
|
1026
955
|
});
|
|
1027
956
|
if (result.error) {
|
|
1028
957
|
console.error("canary failed to launch Playwright:", result.error);
|
|
1029
|
-
|
|
958
|
+
process6.exit(1);
|
|
1030
959
|
}
|
|
1031
|
-
|
|
960
|
+
process6.exit(result.status ?? 1);
|
|
1032
961
|
}
|
|
1033
962
|
function printVersion() {
|
|
1034
963
|
console.log(`canary v${pkg.version}`);
|
|
@@ -1040,22 +969,19 @@ function printHelp({ isSuperadmin }) {
|
|
|
1040
969
|
"Usage:",
|
|
1041
970
|
" canary test [playwright options] Run local Playwright tests",
|
|
1042
971
|
" canary test --remote [options] Run remote workflow tests",
|
|
1043
|
-
" canary local-run --tunnel-url <url> [options]",
|
|
1044
|
-
" canary tunnel --port <localPort> [options]",
|
|
1045
|
-
" canary run --port <localPort> [options]",
|
|
1046
972
|
" canary mcp",
|
|
1047
973
|
" canary browser [--mode playwright|cdp] [--cdp-url <url>] [--no-headless]",
|
|
1048
974
|
" canary login [--org <name>] [--app-url https://app.trycanary.ai] [--no-open]",
|
|
1049
975
|
" canary orgs List organizations",
|
|
1050
976
|
" canary debug <workflowId> [options] Debug workflow in local headed browser",
|
|
1051
977
|
" canary record [options] Record browser interactions",
|
|
978
|
+
" canary local <sub-command> Set up and manage local testing",
|
|
1052
979
|
" canary session <sub-command> Manage local browser sessions",
|
|
1053
980
|
" canary issues <sub-command> Search and view issues",
|
|
1054
|
-
" canary
|
|
981
|
+
" canary workflow <sub-command> Inspect workflow definitions",
|
|
982
|
+
" canary skill <name> Install an AI agent skill template"
|
|
1055
983
|
];
|
|
1056
|
-
lines.push(
|
|
1057
|
-
" canary release <sub-command> Release QA gate (CI/CD)"
|
|
1058
|
-
);
|
|
984
|
+
lines.push(" canary release <sub-command> Release QA gate (CI/CD)");
|
|
1059
985
|
if (isSuperadmin) {
|
|
1060
986
|
lines.push(
|
|
1061
987
|
" canary debug-session [--env dev|local] [--json] Create browser debug session",
|
|
@@ -1159,12 +1085,7 @@ function printHelp({ isSuperadmin }) {
|
|
|
1159
1085
|
" Set lifecycle metadata"
|
|
1160
1086
|
);
|
|
1161
1087
|
}
|
|
1162
|
-
lines.push(
|
|
1163
|
-
"",
|
|
1164
|
-
"Flags:",
|
|
1165
|
-
" -h, --help Show help",
|
|
1166
|
-
" -V, --version Show version"
|
|
1167
|
-
);
|
|
1088
|
+
lines.push("", "Flags:", " -h, --help Show help", " -V, --version Show version");
|
|
1168
1089
|
console.log(lines.join("\n"));
|
|
1169
1090
|
}
|
|
1170
1091
|
function printTestHelp() {
|
|
@@ -1204,9 +1125,18 @@ function printTestHelp() {
|
|
|
1204
1125
|
].join("\n")
|
|
1205
1126
|
);
|
|
1206
1127
|
}
|
|
1207
|
-
var COMMANDS_WITH_HELP = /* @__PURE__ */ new Set([
|
|
1128
|
+
var COMMANDS_WITH_HELP = /* @__PURE__ */ new Set([
|
|
1129
|
+
"test",
|
|
1130
|
+
"session",
|
|
1131
|
+
"local",
|
|
1132
|
+
"issues",
|
|
1133
|
+
"workflow",
|
|
1134
|
+
"release",
|
|
1135
|
+
"skill",
|
|
1136
|
+
"skills"
|
|
1137
|
+
]);
|
|
1208
1138
|
async function resolveIsSuperadmin() {
|
|
1209
|
-
const envToken =
|
|
1139
|
+
const envToken = process6.env.CANARY_API_TOKEN;
|
|
1210
1140
|
if (envToken) return isSuperadminToken(envToken);
|
|
1211
1141
|
const tokens = await readAllStoredTokens();
|
|
1212
1142
|
return tokens.some((t) => isSuperadminToken(t));
|
|
@@ -1243,23 +1173,11 @@ async function main(argv) {
|
|
|
1243
1173
|
runPlaywrightTests(rest);
|
|
1244
1174
|
return;
|
|
1245
1175
|
}
|
|
1246
|
-
if (command === "local-run") {
|
|
1247
|
-
await runLocalTest(rest);
|
|
1248
|
-
return;
|
|
1249
|
-
}
|
|
1250
|
-
if (command === "run") {
|
|
1251
|
-
await runLocalSession(rest);
|
|
1252
|
-
return;
|
|
1253
|
-
}
|
|
1254
1176
|
if (command === "mcp") {
|
|
1255
1177
|
const runMcp = await loadMcp();
|
|
1256
1178
|
await runMcp(rest);
|
|
1257
1179
|
return;
|
|
1258
1180
|
}
|
|
1259
|
-
if (command === "tunnel") {
|
|
1260
|
-
await runTunnel(rest);
|
|
1261
|
-
return;
|
|
1262
|
-
}
|
|
1263
1181
|
if (command === "login") {
|
|
1264
1182
|
await runLogin(rest);
|
|
1265
1183
|
return;
|
|
@@ -1288,56 +1206,66 @@ async function main(argv) {
|
|
|
1288
1206
|
await runSession(rest);
|
|
1289
1207
|
return;
|
|
1290
1208
|
}
|
|
1209
|
+
if (command === "local") {
|
|
1210
|
+
const runLocal = await loadLocal();
|
|
1211
|
+
await runLocal(rest);
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1291
1214
|
if (command === "debug-session") {
|
|
1292
1215
|
await runDebugSession(rest);
|
|
1293
1216
|
return;
|
|
1294
1217
|
}
|
|
1295
1218
|
if (command === "psql") {
|
|
1296
|
-
const { runPsql } = await import("./psql-
|
|
1219
|
+
const { runPsql } = await import("./psql-XO5BB5L5.js");
|
|
1297
1220
|
await runPsql(rest);
|
|
1298
1221
|
return;
|
|
1299
1222
|
}
|
|
1300
1223
|
if (command === "redis") {
|
|
1301
|
-
const { runRedis } = await import("./redis-
|
|
1224
|
+
const { runRedis } = await import("./redis-CQTBPZ6F.js");
|
|
1302
1225
|
await runRedis(rest);
|
|
1303
1226
|
return;
|
|
1304
1227
|
}
|
|
1305
1228
|
if (command === "release") {
|
|
1306
|
-
const { runRelease } = await import("./release-
|
|
1229
|
+
const { runRelease } = await import("./release-DW7RPQSQ.js");
|
|
1307
1230
|
await runRelease(rest);
|
|
1308
1231
|
return;
|
|
1309
1232
|
}
|
|
1310
1233
|
if (command === "docs") {
|
|
1311
|
-
const { runDocs } = await import("./docs-
|
|
1234
|
+
const { runDocs } = await import("./docs-SR7CW24Y.js");
|
|
1312
1235
|
await runDocs(rest);
|
|
1313
1236
|
return;
|
|
1314
1237
|
}
|
|
1315
1238
|
if (command === "feature-flag") {
|
|
1316
|
-
const { runFeatureFlag } = await import("./feature-flag-
|
|
1239
|
+
const { runFeatureFlag } = await import("./feature-flag-BIPFVVNC.js");
|
|
1317
1240
|
await runFeatureFlag(rest);
|
|
1318
1241
|
return;
|
|
1319
1242
|
}
|
|
1320
1243
|
if (command === "knobs") {
|
|
1321
|
-
const { runKnobs } = await import("./knobs-
|
|
1244
|
+
const { runKnobs } = await import("./knobs-VYABZESR.js");
|
|
1322
1245
|
await runKnobs(rest);
|
|
1323
1246
|
return;
|
|
1324
1247
|
}
|
|
1325
1248
|
if (command === "issues") {
|
|
1326
|
-
const { runIssues } = await import("./issues-
|
|
1249
|
+
const { runIssues } = await import("./issues-EWVB52CA.js");
|
|
1327
1250
|
await runIssues(rest);
|
|
1328
1251
|
return;
|
|
1329
1252
|
}
|
|
1253
|
+
if (command === "workflow") {
|
|
1254
|
+
const { runWorkflow } = await import("./workflow-5UZTKX7X.js");
|
|
1255
|
+
await runWorkflow(rest);
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1330
1258
|
if (command === "skill" || command === "skills") {
|
|
1331
|
-
const { runSkill } = await import("./skill-
|
|
1259
|
+
const { runSkill } = await import("./skill-2TXI3IKP.js");
|
|
1332
1260
|
await runSkill(rest);
|
|
1333
1261
|
return;
|
|
1334
1262
|
}
|
|
1335
1263
|
console.log(`Unknown command "${command}".`);
|
|
1336
1264
|
printHelp({ isSuperadmin: await resolveIsSuperadmin() });
|
|
1337
|
-
|
|
1265
|
+
process6.exit(1);
|
|
1338
1266
|
}
|
|
1339
|
-
if (import.meta.url === pathToFileURL2(
|
|
1340
|
-
void main(
|
|
1267
|
+
if (import.meta.url === pathToFileURL2(process6.argv[1]).href) {
|
|
1268
|
+
void main(process6.argv.slice(2));
|
|
1341
1269
|
}
|
|
1342
1270
|
export {
|
|
1343
1271
|
canary,
|