@caffeineai/cli 0.1.0-dev.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/LICENSE ADDED
@@ -0,0 +1 @@
1
+ © Caffeine Labs AG. All rights reserved. Use is subject to the Caffeine AI [Terms of Use](https://caffeine.ai/terms-of-use)
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @caffeineai/cli
2
+
3
+ Command-line interface for the Caffeine platform.
4
+
5
+ ## Development Release
6
+
7
+ This is a DEV release. It is published under the npm `dev` dist-tag and is subject to a rapid release cadence. Expect frequent updates while the CLI and MCP packages settle.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install -g @caffeineai/cli@dev
13
+ ```
14
+
15
+ Three equivalent command names are installed: `caffeine`, `caf`, and `cfn`.
16
+
17
+ ```bash
18
+ caffeine --version
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ ```bash
24
+ caffeine auth login # Sign in
25
+ caffeine projects list # List your Caffeine projects
26
+ caffeine projects clone <id> # Clone one locally
27
+ caffeine build # Build the current project
28
+ caffeine preview # Upload a draft to Caffeine cloud
29
+ ```
30
+
31
+ ## Supported Platforms
32
+
33
+ Native binaries ship for:
34
+
35
+ - macOS arm64 and x64
36
+ - Linux arm64 and x64, glibc and musl
37
+ - Windows arm64 and x64
38
+
39
+ ## Commands
40
+
41
+ | Group | Command | Description |
42
+ | --- | --- | --- |
43
+ | Auth | `auth login [--device]` | Sign in via OAuth loopback or device flow |
44
+ | Auth | `auth logout` | Sign out |
45
+ | Auth | `auth status` | Show current session |
46
+ | Projects | `projects list` | List your projects |
47
+ | Projects | `projects show <id>` | Show project details |
48
+ | Projects | `projects create <name>` | Create a new project |
49
+ | Projects | `projects clone <id> [--dest <path>] [--include-wip]` | Clone a project locally |
50
+ | Projects | `projects delete <id>` | Delete a project |
51
+ | Local | `import` | Import a project from a .zip |
52
+ | Local | `export` | Export the current project to a .zip |
53
+ | Build | `install` | Install build dependencies |
54
+ | Build | `build` | Build the current project |
55
+ | Build | `check` | Validate code and configuration |
56
+ | Build | `preview` | Upload a built project as a draft |
57
+ | Config | `config list` / `get <key>` / `set <key> <value>` | Manage CLI config |
58
+ | Env | `doctor [--fix]` | Diagnose local build prerequisites |
59
+ | Meta | `update` | Check for or install a newer CLI |
60
+ | Meta | `version` | Show version info |
61
+
62
+ Run `caffeine <command> --help` for the full flag list.
63
+
64
+ ## JSON And Non-Interactive Mode
65
+
66
+ Every command accepts `--json`. JSON output uses a stable envelope:
67
+
68
+ ```json
69
+ { "ok": true, "data": {} }
70
+ { "ok": false, "error": { "code": "...", "message": "..." } }
71
+ ```
72
+
73
+ Use `--non-interactive` in scripts and CI.
74
+
75
+ ## Authentication
76
+
77
+ `caffeine auth login` opens your browser for an OAuth flow. For CI or remote SSH, add `--device` to use the device flow instead.
78
+
79
+ Tokens are stored in your OS credential store. The `@caffeineai/mcp` server reads the same credentials, so one login covers both packages.
80
+
81
+ ## MCP Server
82
+
83
+ Drive Caffeine from Claude Code, Cursor, VS Code, Codex, Windsurf, or another MCP host with the companion MCP server:
84
+
85
+ ```bash
86
+ npx -y @caffeineai/mcp@dev --version
87
+ ```
88
+
89
+ See the `@caffeineai/mcp` README for host configuration.
90
+
91
+ ## Links
92
+
93
+ - Caffeine platform: https://caffeine.ai
94
+
95
+ This package installs the matching platform binary through npm optional dependencies. Install the main package rather than a platform package directly.
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { spawn, spawnSync } = require("node:child_process");
5
+
6
+ const packages = {
7
+ "darwin-arm64": {
8
+ "packageName": "@caffeineai/cli-darwin-arm64",
9
+ "binary": "caffeine"
10
+ },
11
+ "darwin-x64": {
12
+ "packageName": "@caffeineai/cli-darwin-x64",
13
+ "binary": "caffeine"
14
+ },
15
+ "linux-arm64-glibc": {
16
+ "packageName": "@caffeineai/cli-linux-arm64-glibc",
17
+ "binary": "caffeine"
18
+ },
19
+ "linux-x64-glibc": {
20
+ "packageName": "@caffeineai/cli-linux-x64-glibc",
21
+ "binary": "caffeine"
22
+ },
23
+ "linux-arm64-musl": {
24
+ "packageName": "@caffeineai/cli-linux-arm64-musl",
25
+ "binary": "caffeine"
26
+ },
27
+ "linux-x64-musl": {
28
+ "packageName": "@caffeineai/cli-linux-x64-musl",
29
+ "binary": "caffeine"
30
+ },
31
+ "win32-arm64": {
32
+ "packageName": "@caffeineai/cli-win32-arm64",
33
+ "binary": "caffeine.exe"
34
+ },
35
+ "win32-x64": {
36
+ "packageName": "@caffeineai/cli-win32-x64",
37
+ "binary": "caffeine.exe"
38
+ }
39
+ };
40
+
41
+ function linuxLibc() {
42
+ if (process.platform !== "linux") return "";
43
+
44
+ try {
45
+ const report = process.report && process.report.getReport && process.report.getReport();
46
+ if (report && report.header && report.header.glibcVersionRuntime) return "glibc";
47
+ } catch {}
48
+
49
+ try {
50
+ const result = spawnSync("ldd", ["--version"], { encoding: "utf8" });
51
+ const text = String(result.stdout || "") + String(result.stderr || "");
52
+ if (text.toLowerCase().includes("musl")) return "musl";
53
+ } catch {}
54
+
55
+ return "glibc";
56
+ }
57
+
58
+ function platformKey() {
59
+ switch (process.platform) {
60
+ case "darwin":
61
+ return `darwin-${process.arch}`;
62
+ case "linux":
63
+ return `linux-${process.arch}-${linuxLibc()}`;
64
+ case "win32":
65
+ return `win32-${process.arch}`;
66
+ default:
67
+ return "";
68
+ }
69
+ }
70
+
71
+ const key = platformKey();
72
+ const selected = packages[key];
73
+
74
+ if (!selected) {
75
+ console.error("caffeine: unsupported platform " + process.platform + "/" + process.arch);
76
+ process.exit(1);
77
+ }
78
+
79
+ let bin;
80
+ try {
81
+ bin = require.resolve(selected.packageName + "/bin/" + selected.binary);
82
+ } catch {
83
+ console.error("caffeine: missing platform package " + selected.packageName);
84
+ console.error("Reinstall without --omit=optional.");
85
+ process.exit(1);
86
+ }
87
+
88
+ const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
89
+
90
+ child.on("exit", (code, signal) => {
91
+ if (signal) {
92
+ console.error("caffeine: terminated by " + signal);
93
+ process.exit(1);
94
+ }
95
+
96
+ process.exit(code ?? 0);
97
+ });
98
+
99
+ child.on("error", (err) => {
100
+ console.error(err.message);
101
+ process.exit(1);
102
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@caffeineai/cli",
3
+ "version": "0.1.0-dev.0",
4
+ "description": "Caffeine CLI",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/caffeinelabs/caffeine-cli.git"
8
+ },
9
+ "license": "SEE LICENSE IN LICENSE",
10
+ "bin": {
11
+ "caffeine": "bin/caffeine.js",
12
+ "caf": "bin/caffeine.js",
13
+ "cfn": "bin/caffeine.js"
14
+ },
15
+ "files": [
16
+ "bin",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "optionalDependencies": {
21
+ "@caffeineai/cli-darwin-arm64": "0.1.0-dev.0",
22
+ "@caffeineai/cli-darwin-x64": "0.1.0-dev.0",
23
+ "@caffeineai/cli-linux-arm64-glibc": "0.1.0-dev.0",
24
+ "@caffeineai/cli-linux-x64-glibc": "0.1.0-dev.0",
25
+ "@caffeineai/cli-linux-arm64-musl": "0.1.0-dev.0",
26
+ "@caffeineai/cli-linux-x64-musl": "0.1.0-dev.0",
27
+ "@caffeineai/cli-win32-arm64": "0.1.0-dev.0",
28
+ "@caffeineai/cli-win32-x64": "0.1.0-dev.0"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }