@every-env/spiral-cli 0.2.0 → 1.0.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 CHANGED
@@ -219,17 +219,46 @@ spiral-cli stores local configuration in `~/.config/spiral-cli/`:
219
219
 
220
220
  ## Authentication
221
221
 
222
- spiral-cli automatically extracts your session from Safari cookies. No manual token management needed.
222
+ ### API Key Authentication (Recommended)
223
223
 
224
- **Requirements:**
225
- - Safari must be logged into https://app.writewithspiral.com
226
- - Terminal needs Full Disk Access (macOS Sonoma+)
224
+ The recommended way to authenticate is with an API key:
225
+
226
+ ```bash
227
+ # Login with your API key
228
+ spiral auth login
229
+ # Enter your API key when prompted
230
+
231
+ # Check authentication status
232
+ spiral auth status
233
+
234
+ # Logout
235
+ spiral auth logout
236
+ ```
237
+
238
+ **Get your API key:**
239
+ 1. Go to https://app.writewithspiral.com
240
+ 2. Click your profile → **Account** → **API Keys**
241
+ 3. Create a new key and copy it
227
242
 
228
- ### Granting Full Disk Access
243
+ ### Environment Variable (CI/CD)
244
+
245
+ For scripts and CI/CD pipelines, use the `SPIRAL_TOKEN` environment variable:
246
+
247
+ ```bash
248
+ export SPIRAL_TOKEN=spiral_sk_your_key_here
249
+ spiral send "Generate a summary" --json
250
+ ```
251
+
252
+ ### Browser Cookie Fallback
253
+
254
+ If no API key is configured, spiral-cli can extract your session from browser cookies (Safari/Chrome/Firefox). This requires:
255
+ - Being logged into https://app.writewithspiral.com
256
+ - Terminal needs Full Disk Access (macOS Sonoma+)
229
257
 
258
+ To grant Full Disk Access:
230
259
  1. Open **System Preferences** > **Privacy & Security**
231
260
  2. Click **Full Disk Access**
232
- 3. Add your terminal app (Terminal.app, iTerm2, etc.)
261
+ 3. Add your terminal app
233
262
 
234
263
  ## Security Notes
235
264
 
package/bin/spiral.mjs ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execFileSync } from "node:child_process";
4
+ import { fileURLToPath } from "node:url";
5
+ import { dirname, join } from "node:path";
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+ const cli = join(__dirname, "..", "src", "cli.ts");
9
+
10
+ // Try bun first (handles .ts natively), fall back to error message
11
+ try {
12
+ execFileSync("bun", ["run", cli, ...process.argv.slice(2)], {
13
+ stdio: "inherit",
14
+ env: process.env,
15
+ });
16
+ } catch (err) {
17
+ if (err.status !== undefined) {
18
+ // Command ran but exited non-zero — propagate exit code
19
+ process.exit(err.status);
20
+ }
21
+ // bun not found
22
+ console.error(
23
+ "Spiral CLI requires Bun to run. Install it with: curl -fsSL https://bun.sh/install | bash",
24
+ );
25
+ process.exit(1);
26
+ }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@every-env/spiral-cli",
3
- "version": "0.2.0",
3
+ "version": "1.0.1",
4
4
  "description": "CLI for Spiral API - create content from your terminal",
5
5
  "author": "Kieran Klaassen",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "bin": {
9
- "spiral": "./src/cli.ts"
9
+ "spiral": "./bin/spiral.mjs"
10
10
  },
11
11
  "files": [
12
+ "bin",
12
13
  "src",
13
14
  "README.md"
14
15
  ],
@@ -32,29 +33,22 @@
32
33
  "scripts": {
33
34
  "dev": "bun run src/cli.ts",
34
35
  "build": "bun build src/cli.ts --compile --minify --outfile dist/spiral",
35
- "build:all": "bun run build:darwin-arm64 && bun run build:darwin-x64",
36
+ "build:all": "bun run build:linux-x64 && bun run build:darwin-arm64 && bun run build:darwin-x64",
36
37
  "build:darwin-arm64": "bun build src/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile dist/spiral-darwin-arm64",
37
38
  "build:darwin-x64": "bun build src/cli.ts --compile --minify --target=bun-darwin-x64 --outfile dist/spiral-darwin-x64",
39
+ "build:linux-x64": "bun build src/cli.ts --compile --minify --target=bun-linux-x64 --outfile dist/spiral-linux-x64",
38
40
  "test": "bun test",
39
- "test:watch": "bun test --watch",
40
- "lint": "biome check src",
41
- "lint:fix": "biome check --write src",
42
- "format": "biome format --write src",
43
- "typecheck": "tsc --noEmit",
44
- "prepublishOnly": "bun run typecheck"
41
+ "typecheck": "tsc --noEmit"
45
42
  },
46
43
  "dependencies": {
47
44
  "@inquirer/prompts": "^8.1.0",
48
- "@steipete/sweet-cookie": "^0.1.0",
49
45
  "chalk": "^5.3.0",
50
46
  "conf": "^15.0.2",
51
- "eventsource-parser": "^3.0.0",
52
47
  "marked": "^15.0.0",
53
48
  "marked-terminal": "^7.0.0",
54
49
  "ora": "^8.0.0"
55
50
  },
56
51
  "devDependencies": {
57
- "@biomejs/biome": "^1.9.0",
58
52
  "@types/bun": "latest",
59
53
  "typescript": "^5.6.0"
60
54
  },
@@ -63,7 +57,5 @@
63
57
  },
64
58
  "engines": {
65
59
  "bun": ">=1.1.0"
66
- },
67
- "os": ["darwin"],
68
- "cpu": ["arm64", "x64"]
60
+ }
69
61
  }