setclaw 1.0.5 → 1.0.7

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
@@ -39,9 +39,23 @@ Connect [Claude Code](https://docs.anthropic.com/en/docs/claude-code) and [Facto
39
39
 
40
40
  ### Install & Configure
41
41
 
42
+ Pass your API key during install — everything configures automatically in one command:
43
+
44
+ **Windows (PowerShell):**
45
+ ```powershell
46
+ $env:QUATARLY_API_KEY="qua_your-key-here"; npm i -g setclaw --foreground-scripts
47
+ ```
48
+
49
+ **macOS / Linux:**
50
+ ```bash
51
+ QUATARLY_API_KEY=qua_your-key-here npm i -g setclaw --foreground-scripts
52
+ ```
53
+
54
+ Or install first, then run the `setclaw` command separately:
55
+
42
56
  ```bash
43
57
  npm i -g setclaw
44
- setclaw <your-quatarly-api-key>
58
+ setclaw qua_your-key-here
45
59
  ```
46
60
 
47
61
  That's it. When you run `setclaw`, it will:
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { join } from "path";
4
+ import { homedir } from "os";
5
+ import { writeFileSync, mkdirSync } from "fs";
6
+
7
+ const markerDir = join(homedir(), ".setclaw");
8
+ const markerFile = join(markerDir, "pending");
9
+
10
+ try {
11
+ mkdirSync(markerDir, { recursive: true });
12
+ wf(markerFile, "1", "utf-8");
13
+ } catch {}
14
+
15
+ const apiKey = process.env.QUATARLY_API_KEY;
16
+ if (apiKey) {
17
+ await import("./setclaw.js");
18
+ }
package/bin/setclaw.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * setclaw (prompts interactively)
10
10
  */
11
11
 
12
- import { readFileSync, writeFileSync, copyFileSync, appendFileSync, existsSync } from "fs";
12
+ import { readFileSync, writeFileSync, copyFileSync, appendFileSync, existsSync, rmSync, mkdirSync } from "fs";
13
13
  import { join } from "path";
14
14
  import { homedir, platform } from "os";
15
15
  import { execSync } from "child_process";
@@ -27,33 +27,41 @@ function ask(question) {
27
27
  );
28
28
  }
29
29
 
30
- function log(msg) {
31
- process.stderr.write(`\x1b[36m>\x1b[0m ${msg}\n`);
32
- }
30
+ const out = (msg) => process.stdout.write(msg + "\n");
31
+ const err = (msg) => process.stderr.write(msg + "\n");
33
32
 
34
- function success(msg) {
35
- process.stderr.write(`\x1b[32m✔\x1b[0m ${msg}\n`);
36
- }
33
+ function log(msg) { err(`\x1b[36m>\x1b[0m ${msg}`); }
34
+ function success(msg) { err(`\x1b[32m✔\x1b[0m ${msg}`); }
35
+ function warn(msg) { err(`\x1b[33m!\x1b[0m ${msg}`); }
36
+ function fail(msg) { err(`\x1b[31m✖\x1b[0m ${msg}`); }
37
37
 
38
- function warn(msg) {
39
- process.stderr.write(`\x1b[33m!\x1b[0m ${msg}\n`);
40
- }
38
+ // ─── First-run detection ──────────────────────────────────────────────
41
39
 
42
- function fail(msg) {
43
- process.stderr.write(`\x1b[31m✖\x1b[0m ${msg}\n`);
44
- }
40
+ const markerFile = join(homedir(), ".setclaw", "pending");
41
+ const isFirstRun = existsSync(markerFile);
45
42
 
46
43
  // ─── Banner ──────────────────────────────────────────────────────────
47
44
 
48
- process.stderr.write("\n");
49
- process.stderr.write("\x1b[1m setclaw\x1b[0m — BOA & Quatarly setup for Claude Code & Factory\n");
50
- process.stderr.write(" ─────────────────────────────────────────────────\n");
51
- process.stderr.write("\n");
45
+ out("");
46
+ out("\x1b[1m setclaw\x1b[0m — BOA & Quatarly setup for Claude Code & Factory");
47
+ out(" \x1b[2m─────────────────────────────────────────────────\x1b[0m");
48
+ out("");
52
49
 
53
50
  // ─── Get API key ─────────────────────────────────────────────────────
54
51
 
55
52
  let apiKey = process.env.QUATARLY_API_KEY || process.argv[2];
56
53
 
54
+ // If no key and this is first run (just installed), show clear instructions
55
+ if (!apiKey && isFirstRun) {
56
+ out(" \x1b[33m⚡ Setup required!\x1b[0m Run with your Quatarly API key:");
57
+ out("");
58
+ out(" \x1b[36msetclaw\x1b[0m \x1b[33m<your-api-key>\x1b[0m");
59
+ out("");
60
+ out(" Get your key at \x1b[4mhttps://api.quatarly.cloud\x1b[0m");
61
+ out("");
62
+ process.exit(0);
63
+ }
64
+
57
65
  if (!apiKey) {
58
66
  try {
59
67
  apiKey = await ask(" Enter your Quatarly API key: ");
@@ -202,12 +210,15 @@ if (os === "win32") {
202
210
 
203
211
  // ─── Done ────────────────────────────────────────────────────────────
204
212
 
205
- process.stderr.write("\n");
206
- process.stderr.write(" \x1b[1mEnvironment variables set:\x1b[0m\n");
213
+ // Clear the first-run marker
214
+ try { rmSync(markerFile); } catch {}
215
+
216
+ out("");
217
+ out(" \x1b[1mEnvironment variables set:\x1b[0m");
207
218
  for (const [key, value] of Object.entries(vars)) {
208
219
  const display = key === "ANTHROPIC_AUTH_TOKEN" ? value.slice(0, 8) + "..." : value;
209
- process.stderr.write(` ${key} = ${display}\n`);
220
+ out(` ${key} = ${display}`);
210
221
  }
211
- process.stderr.write("\n");
222
+ out("");
212
223
  success("All done! Restart your terminal, then launch Claude Code.");
213
- process.stderr.write("\n");
224
+ out("");
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "setclaw",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "BOA & Quatarly setup for Claude Code and Factory",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "setclaw": "bin/setclaw.js"
8
8
  },
9
+ "scripts": {
10
+ "postinstall": "node bin/postinstall.mjs"
11
+ },
9
12
  "files": [
10
- "bin/setclaw.js"
13
+ "bin/setclaw.js",
14
+ "bin/postinstall.mjs"
11
15
  ],
12
16
  "keywords": [
13
17
  "claude",