@canaryai/cli 0.1.1-alpha.0

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 ADDED
@@ -0,0 +1,82 @@
1
+ # Canary CLI
2
+
3
+ Run local test runs, expose your local app via a tunnel, and stream results into Canary.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @canaryai/cli
9
+ # or
10
+ bun add -g @canaryai/cli
11
+ ```
12
+
13
+ ## Login
14
+
15
+ ```bash
16
+ canary login
17
+ ```
18
+
19
+ ## Quickstart (local testing)
20
+
21
+ 1) Start your app locally.
22
+ 2) Start a run (auto-tunnel + run):
23
+
24
+ ```bash
25
+ canary run --port 5173 --title "Login smoke"
26
+ ```
27
+
28
+ 3) Open the watch URL printed in the terminal.
29
+
30
+ ## Tunnel only
31
+
32
+ ```bash
33
+ canary tunnel --port 5173
34
+ ```
35
+
36
+ ## MCP server
37
+
38
+ ```bash
39
+ canary mcp
40
+ ```
41
+
42
+ Tools:
43
+ - `local_run_tests` (port, instructions, title)
44
+ - `local_wait_for_results` (runId)
45
+
46
+ ## Environment variables
47
+
48
+ - `CANARY_API_URL` (default `https://api.trycanary.ai`)
49
+ - `CANARY_APP_URL` (default `https://app.trycanary.ai`)
50
+ - `CANARY_API_TOKEN` (optional; `canary login` stores a token automatically)
51
+ - `CANARY_LOCAL_PORT` (optional default port for `canary run` / `canary tunnel`)
52
+
53
+ ## Programmatic usage
54
+
55
+ You can trigger a suite programmatically without shelling out to the CLI:
56
+
57
+ ```ts
58
+ import { canary } from "@canaryai/cli";
59
+
60
+ const result = await canary.run({
61
+ projectRoot: "/path/to/repo",
62
+ testDir: ["tests/smoke"],
63
+ cliArgs: ["--grep", "login"],
64
+ healing: {
65
+ apiKey: process.env.AI_API_KEY,
66
+ provider: "openai",
67
+ model: "gpt-4o-mini",
68
+ timeoutMs: 120_000,
69
+ maxActions: 50,
70
+ warnOnly: true,
71
+ },
72
+ stdio: "pipe",
73
+ });
74
+
75
+ if (!result.ok) {
76
+ console.error("suite failed", result.summary);
77
+ }
78
+ ```
79
+
80
+ Notes:
81
+ - Defaults mirror the CLI: healing on, Playwright config respected.
82
+ - `result.summary` is derived from Playwright’s JSON reporter plus healed counts from the AI event log.
Binary file
@@ -0,0 +1,53 @@
1
+ type HealingOptions = {
2
+ apiKey?: string;
3
+ provider?: string;
4
+ model?: string;
5
+ timeoutMs?: number;
6
+ maxActions?: number;
7
+ vision?: boolean;
8
+ dryRun?: boolean;
9
+ warnOnly?: boolean;
10
+ debug?: boolean;
11
+ readOnly?: boolean;
12
+ allowEvaluate?: boolean;
13
+ allowRunCode?: boolean;
14
+ maxPayloadBytes?: number;
15
+ };
16
+ type RunRequest = {
17
+ projectRoot?: string;
18
+ testDir?: string | string[];
19
+ configFile?: string;
20
+ cliArgs?: string[];
21
+ env?: Record<string, string>;
22
+ healing?: HealingOptions;
23
+ reporter?: "default" | "json" | string;
24
+ timeoutMs?: number;
25
+ nodeBin?: string;
26
+ stdio?: "inherit" | "pipe";
27
+ };
28
+ type RunResult = {
29
+ ok: boolean;
30
+ exitCode: number;
31
+ summary: {
32
+ total: number;
33
+ passed: number;
34
+ failed: number;
35
+ flaky: number;
36
+ skipped: number;
37
+ healed?: number;
38
+ warned?: number;
39
+ durationMs: number;
40
+ };
41
+ artifactsDir?: string;
42
+ rawOutput?: string;
43
+ error?: Error;
44
+ };
45
+ declare function run(request?: RunRequest): Promise<RunResult>;
46
+
47
+ declare const canary: {
48
+ run: typeof run;
49
+ };
50
+
51
+ declare function main(argv: string[]): Promise<void>;
52
+
53
+ export { canary, main, run };