@tiny-fish/cli 0.1.2 → 0.1.3-next.17

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,87 @@
1
+ # TinyFish CLI
2
+
3
+ Run web automations from your terminal, shell scripts, and CI/CD pipelines.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @tiny-fish/cli
9
+ ```
10
+
11
+ Requires Node.js 24+.
12
+
13
+ ## Authentication
14
+
15
+ Get your API key from [agent.tinyfish.ai](https://agent.tinyfish.ai).
16
+
17
+ ```bash
18
+ # Interactive (opens browser, prompts for key)
19
+ tinyfish auth login
20
+
21
+ # CI/CD safe (pipe key via stdin)
22
+ echo $TINYFISH_API_KEY | tinyfish auth set
23
+
24
+ # Or set via environment variable
25
+ export TINYFISH_API_KEY=sk-tinyfish-...
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ### Run an automation
31
+
32
+ ```bash
33
+ # Stream steps as they happen (default)
34
+ tinyfish agent run "Find the pricing page" --url https://example.com
35
+
36
+ # Human-readable output
37
+ tinyfish agent run "Find the pricing page" --url https://example.com --pretty
38
+
39
+ # Wait for result without streaming
40
+ tinyfish agent run "Find the pricing page" --url https://example.com --sync
41
+
42
+ # Submit and return immediately (don't wait)
43
+ tinyfish agent run "Find the pricing page" --url https://example.com --async
44
+ ```
45
+
46
+ ### Manage runs
47
+
48
+ ```bash
49
+ # List recent runs
50
+ tinyfish agent run list --pretty
51
+
52
+ # Filter by status
53
+ tinyfish agent run list --status RUNNING --pretty
54
+
55
+ # Inspect a run
56
+ tinyfish agent run get <run_id> --pretty
57
+
58
+ # Cancel a run
59
+ tinyfish agent run cancel <run_id> --pretty
60
+ ```
61
+
62
+ ### Output format
63
+
64
+ By default all commands output newline-delimited JSON to stdout — pipe-friendly for agents and scripts. Add `--pretty` for human-readable output.
65
+
66
+ Errors are JSON to stderr with exit code 1. Ctrl+C during a streaming run cancels it automatically.
67
+
68
+ ### Debug
69
+
70
+ ```bash
71
+ TINYFISH_DEBUG=1 tinyfish agent run "..." --url https://example.com
72
+ # or
73
+ tinyfish --debug agent run "..." --url https://example.com
74
+ ```
75
+
76
+ ## CI/CD
77
+
78
+ ```yaml
79
+ - name: Run automation
80
+ env:
81
+ TINYFISH_API_KEY: ${{ secrets.TINYFISH_API_KEY }}
82
+ run: |
83
+ tinyfish agent run "Check that the login flow works" \
84
+ --url https://staging.example.com \
85
+ --sync \
86
+ --pretty
87
+ ```
@@ -2,9 +2,11 @@ import { BASE_URL } from "./constants.js";
2
2
  import { ApiError } from "./output.js";
3
3
  const API_TIMEOUT_MS = 30_000;
4
4
  // ── Debug logging ─────────────────────────────────────────────────────────────
5
- const DEBUG_ENABLED = /^(1|true)$/i.test(process.env["TINYFISH_DEBUG"] ?? "");
5
+ function isDebugEnabled() {
6
+ return /^(1|true)$/i.test(process.env["TINYFISH_DEBUG"] ?? "");
7
+ }
6
8
  function debugLog(msg) {
7
- if (DEBUG_ENABLED) {
9
+ if (isDebugEnabled()) {
8
10
  process.stderr.write(`[debug] ${msg}\n`);
9
11
  }
10
12
  }
@@ -1,5 +1,19 @@
1
- /** Base URL for the TinyFish API. Override with TINYFISH_API_URL for staging/self-hosted. */
1
+ /** Base URL for the TinyFish API. Override with TINYFISH_API_URL for staging/self-hosted (must be https). */
2
2
  const apiUrlOverride = process.env["TINYFISH_API_URL"]?.trim();
3
+ if (apiUrlOverride) {
4
+ let parsed;
5
+ try {
6
+ parsed = new URL(apiUrlOverride);
7
+ }
8
+ catch {
9
+ process.stderr.write("Error: TINYFISH_API_URL must be a valid https URL\n");
10
+ process.exit(1);
11
+ }
12
+ if (parsed.protocol !== "https:") {
13
+ process.stderr.write(`Error: TINYFISH_API_URL must use https:// (got protocol "${parsed.protocol || "unknown"}")\n`);
14
+ process.exit(1);
15
+ }
16
+ }
3
17
  export const BASE_URL = apiUrlOverride || "https://agent.tinyfish.ai";
4
18
  /** URL where users can create and manage API keys */
5
19
  export const DASHBOARD_URL = `${BASE_URL}/api-keys`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.1.2",
4
- "description": "TinyFish CLI \u2014 run web automations from your terminal",
3
+ "version": "0.1.3-next.17",
4
+ "description": "TinyFish CLI run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "tinyfish": "./dist/index.js"
@@ -39,7 +39,6 @@
39
39
  "node": ">=24.0.0"
40
40
  },
41
41
  "publishConfig": {
42
- "registry": "https://registry.npmjs.org/",
43
- "access": "restricted"
42
+ "registry": "https://registry.npmjs.org/"
44
43
  }
45
44
  }