@invarn/cli 0.1.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,148 @@
1
+ # invarn
2
+
3
+ Run builds, check artifacts, and ship from your terminal — with a built-in MCP server so AI agents (Claude Code, Cursor, Claude Desktop) can drive your CI from inside a conversation.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @invarn/cli
9
+ ```
10
+
11
+ This installs the `invarn` command.
12
+
13
+ ## Getting Started
14
+
15
+ ### 1. Authenticate
16
+
17
+ ```bash
18
+ invarn auth login # Browser-based (recommended)
19
+ invarn auth login --device-auth # Device code (headless/SSH)
20
+ invarn auth login --token inv_human_... # Direct token from the dashboard
21
+ ```
22
+
23
+ The token is stored in `~/.config/invarn/config.json`. Check status any time with `invarn auth status`.
24
+
25
+ ### 2. Run a build
26
+
27
+ ```bash
28
+ # Submit a build on Invarn's infrastructure
29
+ invarn build run --pipeline .ci/pipelines/cibuild.yml --workflow primary
30
+
31
+ # Or run a local-* pipeline on your own machine (via @invarn/cibuild)
32
+ invarn run --pipeline .ci/pipelines/agent-verify.yml --workflow test
33
+ ```
34
+
35
+ ### 3. Let AI drive your CI
36
+
37
+ Start the MCP server and your AI coding agent can register agents, run builds, and report results without leaving the conversation:
38
+
39
+ ```bash
40
+ invarn mcp serve
41
+ ```
42
+
43
+ Add it to Claude Code via `~/.claude.json`:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "invarn": {
49
+ "command": "invarn",
50
+ "args": ["mcp", "serve"]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ## Commands
57
+
58
+ | Command | Description |
59
+ |---|---|
60
+ | `invarn auth login` | Authenticate via browser (PKCE) |
61
+ | `invarn auth login --device-auth` | Authenticate via device code (headless) |
62
+ | `invarn auth login --token <token>` | Authenticate with a token directly |
63
+ | `invarn auth logout` | Remove stored credentials |
64
+ | `invarn auth status` | Show current auth state |
65
+ | `invarn build run --pipeline <path> --workflow <name>` | Submit a new proof |
66
+ | `invarn build list [--state <s>]` | List recent proofs |
67
+ | `invarn build status <build-id>` | Show proof details |
68
+ | `invarn build logs <build-id>` | Stream proof logs |
69
+ | `invarn build cancel <build-id>` | Cancel a running proof |
70
+ | `invarn build retry <build-id>` | Retry a failed proof |
71
+ | `invarn artifact list <build-id>` | List artifacts for a proof |
72
+ | `invarn artifact download <build-id> [--out <dir>]` | Download artifact bundle |
73
+ | `invarn secrets list [--pipeline <id>]` | List secrets at org or pipeline scope |
74
+ | `invarn secrets set <KEY> [--pipeline <id>]` | Create or update a secret (stdin-only) |
75
+ | `invarn secrets rm <KEY> [--pipeline <id>]` | Delete a secret |
76
+ | `invarn vars list/set/rm` | Same as `secrets` for plaintext variables |
77
+ | `invarn run --pipeline <path> [--workflow <name>]` | Run a local-* pipeline on this machine |
78
+ | `invarn mcp serve` | Start MCP server for AI agents |
79
+
80
+ ### Options
81
+
82
+ | Flag | Description |
83
+ |---|---|
84
+ | `--json` | Output as JSON |
85
+ | `--no-follow` | Don't follow logs (snapshot only) |
86
+ | `--out <dir>` | Output directory for downloads |
87
+
88
+ ## Local pipelines
89
+
90
+ Pipelines with `stack: local` run on your own machine via the embedded [`@invarn/cibuild`](https://www.npmjs.com/package/@invarn/cibuild) engine — no remote runner, no network round trip. Useful for fast iteration and for AI agents that need to verify changes before a push.
91
+
92
+ ```yaml
93
+ # .ci/pipelines/agent-verify.yml
94
+ format_version: '1'
95
+ meta:
96
+ cibuild.io:
97
+ stack: local
98
+ workflows:
99
+ test:
100
+ steps:
101
+ - script@1.0.0:
102
+ inputs:
103
+ content: npm ci && npm test
104
+ ```
105
+
106
+ ```bash
107
+ invarn run --pipeline .ci/pipelines/agent-verify.yml --workflow test
108
+ ```
109
+
110
+ ## MCP server (for AI agents)
111
+
112
+ `invarn mcp serve` exposes build, artifact, secret, and agent operations as MCP tools:
113
+
114
+ | Tool | Description |
115
+ |---|---|
116
+ | `invarn_agent_find` | Search for an existing agent by intent/type |
117
+ | `invarn_agent_register` | Register a new AI agent with its own pipeline |
118
+ | `invarn_agent_list` | List all agents in the organization |
119
+ | `invarn_agent_unregister` | Delete an agent |
120
+ | `invarn_agent_run` | Run a workflow through an agent (local or remote) |
121
+ | `invarn_agent_result` | Fetch build state, step progress, logs, artifacts |
122
+ | `invarn_build_list` | List recent builds |
123
+ | `invarn_build_logs` | Fetch log output for a build |
124
+ | `invarn_build_cancel` | Cancel a running build |
125
+ | `invarn_build_retry` | Retry a failed build |
126
+ | `invarn_artifact_list` | List artifacts for a build |
127
+ | `invarn_secrets_list` | List secret/variable metadata (never values) |
128
+ | `invarn_secrets_set` | Create or update a secret or variable |
129
+
130
+ Agents are AI-owned pipelines — created on demand by an orchestrator, invoked by AI, and reported back into the conversation. Each agent has its own credentials, its own pipeline file, and short-lived session tokens scoped to one human user.
131
+
132
+ ## Secrets
133
+
134
+ Secrets and variables are scoped to the org or a specific pipeline. Values are piped via stdin — never passed on argv (visible in shell history and `ps` output):
135
+
136
+ ```bash
137
+ echo "sk_live_..." | invarn secrets set STRIPE_KEY
138
+ echo "sk_live_..." | invarn secrets set STRIPE_KEY --pipeline pipe_abc
139
+ invarn secrets list
140
+ invarn secrets rm STRIPE_KEY
141
+ ```
142
+
143
+ There is no read command — once set, values cannot be retrieved through the CLI or MCP.
144
+
145
+ ## Requirements
146
+
147
+ - Node.js 22+
148
+ - A registered Invarn organization (sign up at [invarn.com](https://invarn.com))