@culvii/cli 0.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/COMMANDS.md ADDED
@@ -0,0 +1,119 @@
1
+ # Culvii CLI Commands
2
+
3
+ All commands can be run as `culvii <command>` or `node dist/index.js <command>`.
4
+
5
+ ---
6
+
7
+ ## Authentication
8
+
9
+ | Command | Description |
10
+ |---------|-------------|
11
+ | `culvii login` | Login via browser OAuth. Prompts tenant selection if you belong to multiple tenants. |
12
+ | `culvii logout` | Clear stored tokens. |
13
+ | `culvii auth login` | Alias for `culvii login` |
14
+ | `culvii auth logout` | Alias for `culvii logout` |
15
+ | `culvii whoami [--json] [--env <env>]` | Show current user, active tenant, roles, workspace, and environment. `--json` outputs machine-readable JSON. `--env` overrides the active environment for this query. |
16
+
17
+ ---
18
+
19
+ ## Tenant & Environment Management
20
+
21
+ | Command | Description |
22
+ |---------|-------------|
23
+ | `culvii switch` | List all available tenants with active marker. |
24
+ | `culvii switch <tenant-slug>` | Switch active tenant context. |
25
+ | `culvii env [environment]` | Show the active environment, or switch to a specific one by passing it as an argument. Requires auth. |
26
+
27
+ ---
28
+
29
+ ## Project Scaffolding
30
+
31
+ | Command | Flags | Description |
32
+ |---------|-------|-------------|
33
+ | `culvii init [project-name]` | `[--template <agent-only\|agent-workflow\|agent-workflow-tool\|multi-agent>] [--provider <openai\|anthropic\|gemini\|google-vertex>] [--here] [-y, --yes]` | Scaffold a new Culvii project with working agent and workflow files. Does not require auth. If `project-name` is omitted and `--here` is not passed, prompts interactively. `--yes` accepts all defaults non-interactively. |
34
+
35
+ ---
36
+
37
+ ## AI Agent Skills
38
+
39
+ | Command | Flags | Description |
40
+ |---------|-------|-------------|
41
+ | `culvii skill install` | `[--agent <claude\|cursor\|windsurf\|github\|opencode\|gemini\|kiro\|codex\|agents>] [--global]` | Install the Culvii SDK skill file for your AI coding agent. Auto-detects which agents are present. `--global` installs to your home directory instead of the current project. Does not require auth. |
42
+
43
+ ---
44
+
45
+ ## Workspace Management
46
+
47
+ | Command | Flags | Description |
48
+ |---------|-------|-------------|
49
+ | `culvii workspace list` | `[--env]` | List all workspaces in the active tenant. |
50
+ | `culvii workspace create` | `--name <name> --slug <slug> [--env]` | Create a new workspace. `--name` and `--slug` are required. |
51
+
52
+ ---
53
+
54
+ ## Development
55
+
56
+ | Command | Flags | Description |
57
+ |---------|-------|-------------|
58
+ | `culvii dev` | _(none)_ | Start local file watcher and sync agent/workflow definitions to the platform as drafts over WebSocket. Auto-provisions a dev workspace and API key. Cleans up drafts on exit. |
59
+
60
+ Note: `culvii dev` accepts no flags. The `--workspace` flag shown in older docs does not exist.
61
+
62
+ ---
63
+
64
+ ## Deploy
65
+
66
+ | Command | Flags | Description |
67
+ |---------|-------|-------------|
68
+ | `culvii deploy` | `--env <sandbox\|prod> --workspace-slug <slug> [--allow-destroy]` | Deploy agents and workflows to sandbox or prod. `--env` is required. `--workspace-slug` is required (no implicit fallback). Displays a plan and requires confirmation before applying. |
69
+
70
+ ---
71
+
72
+ ## API Key Management
73
+
74
+ | Command | Flags | Description |
75
+ |---------|-------|-------------|
76
+ | `culvii key list` | `[--env]` | List all API keys for the active tenant. |
77
+ | `culvii key create` | `--name <name> --workspace-slug <slug> --scope <scope> [--env] [--save]` | Create a new API key. `--name`, `--workspace-slug`, and `--scope` are required. `--workspace-slug` takes a slug. `--save` writes the secret to config. |
78
+ | `culvii key rotate <fingerprint>` | `[--env]` | Rotate a key — generates new secret, old key expires in 24h. |
79
+ | `culvii key revoke <fingerprint>` | `[--env]` | Permanently revoke a key. |
80
+
81
+ **Scopes:** `admin`, `developer`, `runner`, `read-only`
82
+
83
+ ---
84
+
85
+ ## Rename
86
+
87
+ | Command | Flags | Description |
88
+ |---------|-------|-------------|
89
+ | `culvii rename <old-slug> <new-slug>` | `--resource-type <agent\|workflow> [--workspace-slug <slug>] [--env]` | Rename an agent or workflow. Preserves UUID and all execution history. `--resource-type` is required. Note: the resource type is `workflow`, not `workbook`. |
90
+
91
+ ---
92
+
93
+ ## Global Flags
94
+
95
+ | Flag | Description |
96
+ |------|-------------|
97
+ | `--help` / `-h` | Show help. |
98
+ | `--version` / `-V` | Show CLI version. |
99
+ | `--debug` | Enable debug logging to `~/.culvii/logs/cli.log`. |
100
+
101
+ ---
102
+
103
+ ## Interactive UI
104
+
105
+ Commands including `deploy`, `rename`, `workspace`, `key`, `dev`, and `init` render a rich terminal UI (Ink) when running in a supported TTY. They automatically fall back to plain text output in CI/CD environments (`CI=1`), pipes, or terminals without color/unicode support.
106
+
107
+ ---
108
+
109
+ ## Internal / Hidden
110
+
111
+ | Command | Description |
112
+ |---------|-------------|
113
+ | `culvii _kitchen-sink` | Render all Ink UI components. Requires TTY. (currently disabled, pending public release) |
114
+ | `culvii start` | Dashboard view (UI shell only, not yet wired to API). (currently disabled, pending public release) |
115
+ | `culvii logs` | Log viewer (UI shell only, not yet wired to API). (currently disabled, pending public release) |
116
+ | `culvii audit query/verify` | Audit trail viewer (UI shell only, not yet wired to API). (currently disabled, pending public release) |
117
+ | `culvii policy validate/check` | Policy commands (UI shell only, not yet wired to API). (currently disabled, pending public release) |
118
+ | `culvii approve list/<id>` | Approval commands (UI shell only, not yet wired to API). (currently disabled, pending public release) |
119
+ | `culvii errors` | Error viewer (UI shell only, not yet wired to API). (currently disabled, pending public release) |
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # Culvii CLI
2
+
3
+ The Culvii CLI is the local development and deployment tool for the Culvii agent platform. It manages authentication, local file watching, WebSocket-based dev synchronization, and Terraform-style declarative deployments.
4
+
5
+ ## Prerequisites
6
+ - Node.js (v22+)
7
+ - pnpm (part of the monorepo)
8
+
9
+ ## Setup & Build
10
+
11
+ To build and run the CLI locally from the monorepo:
12
+
13
+ ```bash
14
+ cd packages/cli
15
+ pnpm install
16
+ pnpm run build
17
+ ```
18
+
19
+ Once built, you can run the CLI locally using `node dist/index.js` or via the monorepo workspace bin depending on your package setup.
20
+
21
+ ---
22
+
23
+ ## Getting Started
24
+
25
+ ### 1. Authenticate
26
+ Before running any commands, authenticate your machine.
27
+
28
+ ```bash
29
+ culvii auth login
30
+ ```
31
+ This opens your browser to log in via OAuth. Upon success, your credentials, tenants, and active context are stored locally in `~/.culvii/`.
32
+
33
+ ### 2. Local Development
34
+ The `dev` command starts a local watcher that hot-syncs your local agent and workflow definitions to a development workspace over WebSockets.
35
+
36
+ ```bash
37
+ culvii dev
38
+ ```
39
+ - **Auto-provisioning:** The CLI automatically creates a developer workspace (`dev-<user-id>`) and a developer API key for you.
40
+ - **Watching:** It watches for changes in `**/*.ts` files (ignoring `node_modules`, `dist`).
41
+ - **Syncing:** Whenever a change is detected, it evaluates your agent definitions and streams the updates to the cloud in real-time.
42
+
43
+ ### 3. Deployment
44
+ Deploys your agents and workflows to a specific environment using a declarative plan/apply flow.
45
+
46
+ ```bash
47
+ culvii deploy --env sandbox --workspace-slug <workspace-slug>
48
+ ```
49
+ - **Targeting:** Requires both `--env` (`sandbox` or `prod`) and `--workspace-slug <slug>`.
50
+ - **Validation:** Checks for missing definitions or dangling agent references.
51
+ - **Plan/Apply:** Displays a diff plan (Created, Updated, Destroyed). Requires manual `[y/N]` confirmation.
52
+ - **Destructive changes:** If the deploy plans to destroy resources, you will be blocked unless you explicitly pass the `--allow-destroy` flag.
53
+
54
+ ---
55
+
56
+ ## File Discovery
57
+
58
+ To determine what to evaluate and sync, the CLI looks in your current working directory:
59
+ 1. **`culvii.yaml`**: If present, it reads the `entrypoints` array.
60
+ 2. **Fallback Globbing**: If no configuration file exists, it recursively finds all `*.culvii.ts` files in your project.
61
+
62
+ ---
63
+
64
+ ## Core Commands Reference
65
+
66
+ | Command | Description |
67
+ |---|---|
68
+ | `culvii auth login` | Authenticate your machine. |
69
+ | `culvii auth logout` | Clear local tokens and state. |
70
+ | `culvii init` | Scaffold a new project with working agent and workflow files. No auth required. |
71
+ | `culvii dev` | Start the development server and live file watcher. |
72
+ | `culvii deploy` | Plan and apply changes to a remote workspace. |
73
+ | `culvii workspace` | Manage workspaces (create, list, delete). |
74
+ | `culvii key` | Manage API keys. |
75
+ | `culvii switch` | Switch active tenant/context. |
76
+ | `culvii whoami` | View your current authenticated identity and active context. Supports --json and --env. |
77
+ | `culvii rename` | Safely rename deployed resources without destroying them. `--resource-type <agent|workflow>` is required. |
78
+ | `culvii skill install` | Install the Culvii SDK skill for your AI coding agent. No auth required. |
79
+
80
+ *Coming soon: audit, policy, approve, logs*
81
+
82
+ *(Run `culvii --help` for the full list of available commands and flags)*
83
+
84
+ ---
85
+
86
+ ## Local State & Configuration
87
+
88
+ The CLI manages state securely in your home directory (`~/.culvii/`):
89
+ - **`config`**: Active contexts, workspace mappings, environment targets, and auto-generated API keys.
90
+ - **`tokens.json`**: Active OAuth access and refresh tokens.
91
+ - **`.lock`**: Lockfile ensuring atomic concurrent reads/writes when multiple CLI instances run.
92
+
93
+ ## Telemetry
94
+
95
+ The CLI sends anonymous crash and usage events to Segment to improve the product. To opt out completely, set the following environment variable:
96
+
97
+ ```bash
98
+ export CULVII_TELEMETRY=false
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Interactive UI
104
+
105
+ Most commands render a rich terminal UI when running in a supported TTY. They automatically fall back to plain text output in CI/CD environments, pipes, or terminals without color/unicode support. Set `CI=1` to force non-interactive mode.
package/USAGE.md ADDED
@@ -0,0 +1,282 @@
1
+ # CLI Usage Guide
2
+
3
+ This guide explains how to build, run, and use the `@culvii/cli` package.
4
+
5
+ ## Development and Build
6
+
7
+ ```bash
8
+ # Build the package
9
+ pnpm run build
10
+
11
+ # Run tests
12
+ pnpm test
13
+
14
+ # Run tests with coverage
15
+ pnpm test:coverage
16
+ ```
17
+
18
+ The build process uses `tsup` to compile TypeScript source into the `dist/` directory.
19
+
20
+ ## Running the CLI
21
+
22
+ ```bash
23
+ node ./dist/index.js <command>
24
+ ```
25
+
26
+ Or if installed globally/linked: `culvii <command>`
27
+
28
+ ---
29
+
30
+ ## Authentication
31
+
32
+ ### Login
33
+ ```bash
34
+ culvii login
35
+ ```
36
+ Opens a browser for OAuth login. If you belong to multiple tenants, you'll be prompted to select one. All your tenant contexts are saved to `~/.culvii/config` and the selected one becomes active.
37
+
38
+ Tokens are stored at `~/.culvii/tokens.json` (mode 0600). Access tokens expire after 1 hour and refresh automatically. Refresh tokens are valid for 30 days.
39
+
40
+ ### Logout
41
+ ```bash
42
+ culvii logout
43
+ culvii auth logout # alias
44
+ ```
45
+
46
+ ### Who am I
47
+ ```bash
48
+ culvii whoami [--json] [--env <env>]
49
+ ```
50
+ Displays current user, active tenant, roles, workspace, and environment. `--json` outputs machine-readable JSON. `--env` overrides the active environment.
51
+
52
+ ---
53
+
54
+ ## Tenant Management
55
+
56
+ ### Switch active tenant
57
+ ```bash
58
+ culvii switch # list available tenants
59
+ culvii switch <tenant-slug> # switch to a specific tenant
60
+ ```
61
+ All subsequent commands operate against the switched tenant via the `x-tenant-id` header. No re-login required.
62
+
63
+ ---
64
+
65
+ ## Environment (`culvii env`)
66
+
67
+ ```bash
68
+ culvii env [environment]
69
+ ```
70
+ Shows the currently active environment. Pass an environment name as an argument to switch to it directly.
71
+
72
+ ---
73
+
74
+ ## Workspace Commands
75
+
76
+ ```bash
77
+ culvii workspace list [--env <env>]
78
+ culvii workspace create --name <name> --slug <slug> [--env <env>]
79
+ ```
80
+
81
+ The `--env` flag targets a specific environment (dev, sandbox, prod). Defaults to the environment in your active context.
82
+
83
+ ---
84
+
85
+ ## Development (`culvii dev`)
86
+
87
+ ```bash
88
+ culvii dev
89
+ ```
90
+
91
+ Starts the local file watcher and connects to the local dev server (`http://localhost:3000`). Always connects to dev — environment flags have no effect on this command.
92
+
93
+ **What it does:**
94
+ - Auto-provisions a `dev-<tenant-slug>` workspace if none exists
95
+ - Auto-creates a developer API key for the workspace
96
+ - Watches `*.culvii.ts` files recursively (or entries from `culvii.yaml`)
97
+ - Syncs agent/workflow definitions to the platform as drafts on every file save
98
+ - Cleans up draft rows on Ctrl+C
99
+
100
+ **File discovery:**
101
+ - Default: recursively finds all `*.culvii.ts` files, skipping `node_modules/`, `dist/`, `.git/`
102
+ - Override: create a `culvii.yaml` with an `entrypoints:` list to specify exact files
103
+
104
+ ```yaml
105
+ entrypoints:
106
+ - src/agents/payment-processor.ts
107
+ - src/workflows/onboarding.ts
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Deploy
113
+
114
+ ```bash
115
+ culvii deploy --env <env> --workspace-slug <slug> [--allow-destroy]
116
+ ```
117
+
118
+ `--env` is required and must be `sandbox` or `prod` (not `dev` — use `culvii dev` for local iteration).
119
+ `--workspace-slug` is required — no implicit fallback to config.
120
+
121
+ **What it does:**
122
+ 1. Evaluates all `*.culvii.ts` files in the current directory
123
+ 2. Calls the plan API to compute a diff against what's currently deployed
124
+ 3. Displays the plan (CREATED / UPDATED / DESTROYED)
125
+ 4. If destructive changes exist, requires `--allow-destroy` to proceed
126
+ 5. Applies the plan
127
+
128
+ **Example:**
129
+ ```bash
130
+ culvii deploy --env sandbox --workspace-slug payments-sandbox
131
+ ```
132
+
133
+ ---
134
+
135
+ ## API Key Commands
136
+
137
+ ```bash
138
+ culvii key list [--env <env>]
139
+ culvii key create --name <name> --workspace-slug <slug> --scope <scope> [--env <env>] [--save]
140
+ culvii key rotate <fingerprint> [--env <env>]
141
+ culvii key revoke <fingerprint> [--env <env>]
142
+ ```
143
+
144
+ **Scopes:** `admin`, `developer`, `runner`, `read-only`
145
+
146
+ `--workspace-slug` takes a slug (not a UUID) and resolves it internally.
147
+ `--save` writes the secret to `~/.culvii/config` as the active API key.
148
+
149
+ ---
150
+
151
+ ## Rename
152
+
153
+ ```bash
154
+ culvii rename <old-slug> <new-slug> --resource-type <agent|workflow> [--workspace-slug <slug>] [--env <env>]
155
+ ```
156
+
157
+ Renames a resource while preserving its UUID and all execution history. Updates both the deployed row and any active draft row atomically.
158
+
159
+ ---
160
+
161
+ ## Project Scaffolding
162
+
163
+ ```bash
164
+ culvii init [project-name] [--template <agent-only|agent-workflow|agent-workflow-tool|multi-agent>] [--provider <openai|anthropic|gemini|google-vertex>] [--here] [-y, --yes]
165
+ ```
166
+ Scaffolds a new Culvii project with a working package.json, tsconfig.json, and .culvii.ts source files ready for culvii dev.
167
+ Does not require authentication.
168
+
169
+ **Templates:**
170
+ - `agent-only` — a single standalone agent
171
+ - `agent-workflow` — an agent triggered by a manual workflow (default)
172
+ - `agent-workflow-tool` — an agent that invokes a workflow as a callable tool
173
+ - `multi-agent` — a coordinator agent that delegates to a specialist
174
+
175
+ **Providers:** `openai` (default), `anthropic`, `gemini`, `google-vertex`
176
+
177
+ **Example:**
178
+ ```bash
179
+ culvii init my-project --template agent-workflow --provider anthropic
180
+ cd my-project
181
+ npm install
182
+ Replace `YOUR_CREDENTIAL_ID` and `YOUR_MODEL_ID` with your actual values from the Culvii console
183
+ culvii dev
184
+ ```
185
+
186
+ ---
187
+
188
+ ## AI Agent Skills
189
+
190
+ ```bash
191
+ culvii skill install [--agent <name>] [--global]
192
+ ```
193
+ Installs the Culvii SDK skill file for your AI coding agent (Claude Code, Cursor, Windsurf, opencode, Gemini CLI, Kiro, GitHub Copilot, Codex CLI). The skill teaches the agent how to write correct Culvii code using @culvii/kit.
194
+ Does not require authentication.
195
+
196
+ Auto-detects which agents are present in your project by checking for their config directories. Always also installs a universal fallback at `.agents/skills/culvii/SKILL.md`.
197
+
198
+ **Supported agents:** `claude`, `cursor`, `windsurf`, `github`, `opencode`, `gemini`, `kiro`, `codex`, `agents`
199
+
200
+ **Flags:**
201
+ - `--agent <name>` — target a specific agent instead of auto-detecting
202
+ - `--global` — install to your home directory instead of the current project
203
+
204
+ **Example:**
205
+ ```bash
206
+ culvii skill install
207
+ culvii skill install --agent cursor
208
+ culvii skill install --global
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Environment Variables
214
+
215
+ | Variable | Effect |
216
+ |----------|--------|
217
+ | `CULVII_DEBUG=1` | Enable structured debug logging to `~/.culvii/logs/cli.log` |
218
+ | `NO_COLOR=1` | Disable color output |
219
+ | `FORCE_COLOR=1` | Force color output |
220
+ | `CI=1` | Non-interactive mode (bypasses Ink UI) |
221
+
222
+ ---
223
+
224
+ ## Debug Logging
225
+
226
+ ```bash
227
+ CULVII_DEBUG=1 culvii <command>
228
+ # or
229
+ culvii <command> --debug
230
+ ```
231
+
232
+ Tail logs in real time:
233
+ ```bash
234
+ tail -f ~/.culvii/logs/cli.log
235
+ ```
236
+
237
+ Logs rotate at 5MB. Sensitive values (tokens, secrets, auth codes) are never written to logs.
238
+
239
+ ---
240
+
241
+ ## Config File
242
+
243
+ Located at `~/.culvii/config` (mode 0600). Structure:
244
+
245
+ ```json
246
+ {
247
+ "active": "culvii-dev",
248
+ "contexts": {
249
+ "culvii-dev": {
250
+ "tenant_id": "<uuid>",
251
+ "tenant_slug": "culvii-dev",
252
+ "workspace_id": "<uuid>",
253
+ "workspace_slug": "dev-culvii-dev",
254
+ "environment": "dev",
255
+ "api_key": "ck_dev_...",
256
+ "workspace_keys": {
257
+ "payments": "ck_dev_..."
258
+ }
259
+ },
260
+ "culvii-test": {
261
+ "tenant_id": "<uuid>",
262
+ "tenant_slug": "culvii-test",
263
+ "workspace_id": null,
264
+ "workspace_slug": null,
265
+ "environment": "dev"
266
+ }
267
+ },
268
+ "anonymousId": "<uuid>"
269
+ }
270
+ ```
271
+
272
+ `active` points to the currently selected tenant context. Use `culvii switch` to change it.
273
+
274
+ ---
275
+
276
+ ## Visual Design System (Internal)
277
+
278
+ ```bash
279
+ culvii _kitchen-sink
280
+ ```
281
+
282
+ Renders the Ink UI component library. Requires a TTY terminal — will not render in CI.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$4}from'./chunk-5NBKYMD7.js';import {a}from'./chunk-R67TA4FU.js';import {a as a$3}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {o,l,c,a as a$2,e,y,d,w}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useState,useEffect}from'react';import {useApp,useInput,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function P(e){if(e.type==="surface")return "Marks inactive; published versions are retained.";let p=e.versionCount??1,a=e.activeVersion??e.previousVersion;return `Deletes all ${p} ${p===1?"version":"versions"}${a?`; active is v${a}`:""}.`}function I(e){if(e.type==="surface"){let d=e.activeVersion??e.previousVersion;return d?`active v${d}`:"active"}let p=e.executions??0,a=e.activeExecutions??0,c=e.activeVersion??e.previousVersion;return `${p} total, active${c?` v${c}`:""}: ${a} executions`}function G({state:e$1,onConfirm:p}){let{exit:a$5}=useApp(),[c$1,d$1]=useState(false);return useEffect(()=>{e$1.type==="confirming"&&d$1(e$1.allowDestroy);},[e$1]),useEffect(()=>{if(e$1.type==="success"||e$1.type==="no_changes"||e$1.type==="aborted"||e$1.type==="error"){let o=setTimeout(()=>a$5(),100);return ()=>clearTimeout(o)}},[e$1.type,a$5]),useInput((o,k)=>{e$1.type==="confirming"&&(o.toLowerCase()==="y"?p?.(true,c$1):o.toLowerCase()==="n"||k.escape?p?.(false,c$1):o.toLowerCase()==="d"&&e$1.plan.destroyed.length>0?d$1(true):o.toLowerCase()==="k"&&e$1.plan.destroyed.length>0&&d$1(false));}),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"deploy"}),e$1.type==="planning"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Planning deploy\u2026"})}),e$1.type==="confirming"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"column",children:[jsxs(Text,{color:o,children:["Plan for ",jsx(Text,{color:l,bold:true,children:e$1.env}),":"]}),jsxs(Box,{flexDirection:"column",marginTop:1,children:[e$1.plan.created.map(o$1=>jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:"+"}),jsx(Text,{color:l,children:o$1.slug}),jsx(Text,{color:o,children:"CREATED"})]},o$1.slug)),e$1.plan.versioned.map(o$1=>jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:a$2,children:"~"}),jsx(Text,{color:l,children:o$1.slug}),jsxs(Text,{color:o,children:["VERSIONED (",I(o$1),")"]})]},o$1.slug)),e$1.plan.destroyed.map(o$1=>jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:e,children:"-"}),jsx(Text,{color:l,children:o$1.slug}),jsxs(Text,{color:o,children:[o$1.type==="surface"?"DEACTIVATE":"DELETE"," CANDIDATE (",I(o$1),")"]})]}),o$1.renameHint&&jsx(Box,{paddingLeft:2,children:jsxs(Text,{color:d,children:[y," Rename hint: ",o$1.renameHint]})})]},o$1.slug))]})]}),e$1.plan.destroyed.length>0&&jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:d,children:y}),jsx(Text,{color:l,children:"Missing resources:"}),jsx(Text,{color:c$1?e:c,bold:true,children:c$1?"delete":"keep active"})]}),!e$1.allowDestroy&&jsx(Text,{color:o,children:"Press d to delete all, k to keep active."}),c$1&&jsx(Box,{flexDirection:"column",marginTop:1,children:e$1.plan.destroyed.map(o=>jsxs(Text,{color:e,children:["- ",o.slug,": ",P(o)]},`delete-detail-${o.slug}`))})]}),jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:o,children:"Deploy to "}),jsx(Text,{color:l,bold:true,children:e$1.env}),jsx(Text,{color:o,children:"?"}),jsx(Text,{color:a$2,bold:true,children:"[y/N]"})]})]}),e$1.type==="applying"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Applying\u2026"})}),e$1.type==="no_changes"&&jsx(Box,{paddingLeft:2,children:jsx(a$3.Dim,{children:"Nothing to deploy. All resources are up to date."})}),e$1.type==="aborted"&&e$1.reason==="user_cancelled"&&jsx(Box,{paddingLeft:2,children:jsx(a$3.Dim,{children:"Deployment cancelled."})}),e$1.type==="aborted"&&e$1.reason==="allow_destroy_required"&&jsx(Box,{paddingLeft:2,children:jsx(a$3.Dim,{children:"Aborted. Re-run with --allow-destroy to confirm destructive changes."})}),e$1.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsx(a$3.Err,{children:e$1.message}),e$1.detail&&jsx(a$3.Dim,{children:e$1.detail})]}),e$1.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w}),jsxs(Text,{color:l,bold:true,children:["Deployed to ",e$1.env]})]}),jsx(a$4,{variant:"ok",content:[{k:"created",v:jsxs(Text,{color:l,children:[e$1.created," resource(s)"]})},{k:"versioned",v:jsxs(Text,{color:l,children:[e$1.versioned," resource(s)"]})},{k:"destroyed",v:jsxs(Text,{color:l,children:[e$1.destroyed," resource(s)"]})}]}),jsxs(Box,{flexDirection:"column",children:[(e$1.createdItems||[]).map(o=>jsxs(Text,{color:c,children:["+ ",o.slug]},`created-${o.slug}`)),(e$1.versionedItems||[]).map(o=>jsxs(Text,{color:a$2,children:["~ ",o.slug]},`versioned-${o.slug}`)),(e$1.destroyedItems||[]).map(o=>jsxs(Text,{color:e,children:["- ",o.slug]},`destroyed-${o.slug}`)),(e$1.skippedDestroyedItems||[]).map(o$1=>jsxs(Text,{color:o,children:["k ",o$1.slug]},`skipped-${o$1.slug}`))]})]})]})}export{G as DeployView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {w,c,l,o,a as a$3,y,d}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function C({state:o$1}){let{exit:g}=useApp();return useEffect(()=>{if(o$1.type==="error"||o$1.type==="disconnected"){let r=setTimeout(()=>g(),100);return ()=>clearTimeout(r)}},[o$1.type,g]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"dev"}),o$1.type==="provisioning"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:o$1.message})}),o$1.type==="error"&&jsx(Box,{flexDirection:"column",paddingLeft:2,children:jsx(a$2.Err,{children:o$1.message})}),o$1.type==="disconnected"&&jsx(Box,{paddingLeft:2,children:jsx(a$2.Dim,{children:"Disconnected. Draft state discarded."})}),o$1.type==="connected"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w}),jsx(Text,{color:l,bold:true,children:o$1.workspace}),jsx(Text,{color:o,children:"\xB7"}),jsx(Text,{color:a$3,children:o$1.env})]}),jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:o,children:"Console:"}),jsx(Text,{color:a$3,children:o$1.consoleUrl})]}),jsx(a$2.Dim,{children:"Watching ./..."}),jsx(Box,{flexDirection:"column",gap:0,children:o$1.log.map((r,y$1)=>jsxs(Box,{flexDirection:"row",gap:1,children:[r.type==="synced"&&jsx(Text,{color:c,children:w}),r.type==="orphaned"&&jsx(Text,{color:c,children:w}),(r.type==="warning"||r.type==="error")&&jsx(Text,{color:d,children:y}),r.type==="info"&&jsx(Text,{color:o,children:"\xB7"}),r.timestamp&&jsxs(Text,{color:o,children:["[",r.timestamp,"]"]}),jsx(Text,{color:r.type==="warning"||r.type==="error"?d:o,children:r.message})]},y$1))})]})]})}export{C as DevView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$2}from'./chunk-MPKGJC7N.js';import {a}from'./chunk-R67TA4FU.js';import {a as a$1}from'./chunk-FQVHJUX4.js';import {l,e,o,w as w$1,c,x as x$1}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function D(e){return e==="prod"?"allow":e==="sandbox"?"warn":"info"}function x({env:e}){return jsx(a$2,{variant:D(e),children:e})}function w({envs:e}){return e.length===0?jsx(Text,{color:o,children:"none"}):jsx(Box,{flexDirection:"row",gap:1,children:e.map(t=>jsx(x,{env:t},t))})}function C({state:e$1}){let{exit:t}=useApp();return useEffect(()=>{let v=setTimeout(()=>t(),100);return ()=>clearTimeout(v)},[t]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"env"}),e$1.type==="show"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:l,children:"current"}),jsx(x,{env:e$1.current}),!e$1.accessible.includes(e$1.current)&&jsx(Text,{color:e,children:"(no access)"})]}),jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:o,children:"tenant:"}),jsx(Text,{color:l,children:e$1.tenant})]}),jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:o,children:"available:"}),jsx(w,{envs:e$1.accessible})]}),!e$1.accessible.includes(e$1.current)&&e$1.accessible.length>0&&jsxs(a$1.Dim,{children:["To switch, run: culvii env ",e$1.accessible[0]]})]}),e$1.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w$1}),jsx(Text,{color:l,bold:true,children:"Switched environment to"}),jsx(x,{env:e$1.env})]}),jsxs(a$1.Dim,{children:["tenant: ",e$1.tenant]})]}),e$1.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:e,children:x$1}),jsx(Text,{color:l,children:e$1.message})]}),e$1.detail&&jsx(Box,{paddingLeft:2,children:jsx(a$1.Dim,{children:e$1.detail})})]})]})}export{C as EnvView};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {p as p$1}from'./chunk-7XZL4X4V.js';import'./chunk-HX54IFSD.js';import {a}from'./chunk-FQVHJUX4.js';import {q,r as r$1}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function p({children:i}){return jsx(Text,{color:q,children:i})}function s({children:i}){return jsx(Text,{color:r$1,children:i})}var r={Flag:p,Arg:s};function P(){let{exit:i}=useApp();return useEffect(()=>{i();},[i]),jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(a.OutStrong,{children:"culvii"}),jsx(a.Dim,{children:"\u2014 the operating system for governed agents"})]}),jsxs(a.Dim,{children:["0.0.1"," \xB7 https://culvii.dev"]}),jsx(a.Sep,{}),jsxs(Box,{paddingBottom:1,children:[jsx(a.OutStrong,{children:"USAGE"}),jsxs(a.Out,{children:[" culvii ","<command>"," [subcommand] [flags]"]})]}),jsxs(Box,{paddingBottom:1,flexDirection:"column",children:[jsx(a.OutStrong,{children:"CORE COMMANDS"}),jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:15,children:jsx(Text,{children:jsx(r.Flag,{children:" auth"})})}),jsx(a.Out,{children:"login, rotate keys, inspect identity"})]}),jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:15,children:jsx(Text,{children:jsx(r.Flag,{children:" init"})})}),jsx(a.Out,{children:"scaffold a new agent from a template"})]}),jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:15,children:jsx(Text,{children:jsx(r.Flag,{children:" deploy"})})}),jsx(a.Out,{children:"push an agent to an environment"})]})]})]}),jsxs(Box,{paddingBottom:1,flexDirection:"column",children:[jsx(a.OutStrong,{children:"FLAGS"}),jsxs(Box,{flexDirection:"column",children:[jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:26,children:jsxs(Text,{children:[jsx(r.Flag,{children:" --env "}),jsx(r.Arg,{children:"<name>"})]})}),jsxs(a.Out,{children:["target environment (default: ",p$1,")"]})]}),jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:26,children:jsx(Text,{children:jsx(r.Flag,{children:" --json"})})}),jsx(a.Out,{children:"machine-readable output"})]}),jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:26,children:jsx(Text,{children:jsx(r.Flag,{children:" --no-color"})})}),jsx(a.Out,{children:"disable ANSI colors"})]}),jsxs(Box,{flexDirection:"row",children:[jsx(Box,{width:26,children:jsx(Text,{children:jsx(r.Flag,{children:" -h, --help"})})}),jsx(a.Out,{children:"help for any command"})]})]})]}),jsxs(a.Dim,{children:["Run `culvii ","<command>"," --help` for more. Everything here respects your policy bundle."]})]})}
3
+ export{P as HelpView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {w,c,l,o}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function R({state:e}){let{exit:p}=useApp();return useEffect(()=>{if(e.type==="success"||e.type==="error"){let m=setTimeout(()=>p(),100);return ()=>clearTimeout(m)}},[e.type,p]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"init"}),e.type==="scaffolding"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:e.message})}),e.type==="error"&&jsx(Box,{flexDirection:"column",paddingLeft:2,children:jsx(a$2.Err,{children:e.message})}),e.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w}),jsx(Text,{color:l,bold:true,children:e.template}),jsx(Text,{color:o,children:"in"}),jsx(Text,{color:l,children:e.projectDir})]}),jsx(Box,{flexDirection:"column",gap:0,children:e.written.map((m,D)=>jsxs(a$2.Dim,{children:["+ ",m]},D))}),jsxs(Box,{flexDirection:"column",gap:0,children:[!e.here&&jsxs(a$2.Dim,{children:["cd ",e.projectName]}),jsx(a$2.Dim,{children:"1. Run `npm install`"}),jsx(a$2.Dim,{children:"2. Replace YOUR_CREDENTIAL_ID and YOUR_MODEL_ID with your actual values from the Culvii console"}),jsx(a$2.Dim,{children:"3. Run `culvii dev`"})]})]})]})}export{R as InitView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {b,a,u,o,l,n,A}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useState,useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';var R="0.1.0",k=[{cmd:"culvii dev",desc:"start local dev server"},{cmd:"culvii deploy",desc:"push agents to sandbox or prod"},{cmd:"culvii whoami",desc:"show current identity"},{cmd:"culvii auth login",desc:"authenticate this machine"},{cmd:"culvii --help",desc:"all commands"}];function G(){let{exit:d}=useApp(),[r,g]=useState(null),[p,h]=useState(false);return useEffect(()=>{async function i(){try{let{ConfigStore:x}=await import('./config-store-WSXGIIJ4.js'),f=await new x().read({exitOnError:!1}),m=f.contexts[f.active];g({tenant:m?.tenant_slug??null,workspace:m?.workspace_slug??null,env:m?.environment??null});}catch{g(null);}finally{h(true);}}i();},[]),useEffect(()=>{p&&d();},[p,d]),jsxs(Box,{flexDirection:"column",borderStyle:"round",borderColor:b,paddingX:2,paddingY:1,marginY:1,children:[jsxs(Box,{flexDirection:"row",gap:2,marginBottom:1,children:[jsx(Text,{color:a,bold:true,children:u+" culvii"}),jsxs(Text,{color:o,children:["v",R]})]}),r?jsxs(Box,{flexDirection:"column",marginBottom:1,children:[jsx(Box,{marginBottom:1,children:jsxs(Text,{color:l,bold:true,children:["Welcome back",r.tenant?`, ${r.tenant}`:"","."]})}),jsxs(Box,{flexDirection:"row",gap:2,children:[jsxs(Box,{flexDirection:"column",gap:0,children:[jsx(Text,{color:n,children:"tenant"}),r.workspace&&jsx(Text,{color:n,children:"workspace"}),jsx(Text,{color:n,children:"env"})]}),jsxs(Box,{flexDirection:"column",gap:0,children:[jsx(Text,{color:l,children:r.tenant??"\u2014"}),r.workspace&&jsx(Text,{color:l,children:r.workspace}),jsx(Text,{color:a,children:r.env??"\u2014"})]})]})]}):jsxs(Box,{marginBottom:1,children:[jsx(Text,{color:o,children:"Not logged in. Run "}),jsx(Text,{color:a,children:"culvii auth login"}),jsx(Text,{color:o,children:" to get started."})]}),jsx(Box,{marginTop:1,marginBottom:1,children:jsx(Text,{color:b,children:A.repeat(60)})}),jsx(Box,{flexDirection:"column",gap:0,children:k.map((i,x)=>jsxs(Box,{flexDirection:"row",gap:2,children:[jsx(Box,{width:22,children:jsx(Text,{color:a,children:i.cmd})}),jsx(Text,{color:o,children:i.desc})]},x))})]})}export{G as OnboardingView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {w as w$1,l,z}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function w({state:e}){let{exit:l$1}=useApp();return useEffect(()=>{if(e.type!=="loading"){let u=setTimeout(()=>l$1(),100);return ()=>clearTimeout(u)}},[e.type,l$1]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"rename"}),e.type==="loading"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Renaming resource\u2026"})}),e.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsx(a$2.Err,{children:e.message}),e.detail&&jsx(a$2.Dim,{children:e.detail})]}),e.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:l,children:w$1}),jsx(Text,{color:l,children:e.oldSlug}),jsx(Text,{color:l,children:z}),jsx(Text,{color:l,bold:true,children:e.newSlug})]}),jsx(a$2.Dim,{children:"Immutable ID preserved. All execution history retained."})]})]})}export{w as RenameView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {w,l}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function b({state:e}){let{exit:m}=useApp();return useEffect(()=>{if(e.type!=="loading"){let n=setTimeout(()=>m(),100);return ()=>clearTimeout(n)}},[e.type,m]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"skill install"}),e.type==="loading"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Installing skill\u2026"})}),e.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsx(a$2.Err,{children:e.message}),e.detail&&jsx(a$2.Dim,{children:e.detail})]}),e.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[e.fallbackWarning&&jsx(a$2.Dim,{children:e.fallbackWarning}),jsx(Box,{flexDirection:"column",gap:0,children:e.installed.map((n,s)=>jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:l,children:w}),jsx(Text,{color:l,children:"Installed skill for"}),jsx(Text,{color:l,bold:true,children:n.agentName}),jsx(Text,{color:l,children:"at"}),jsx(Text,{color:l,children:n.displayPath})]},s))})]})]})}export{b as SkillView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-R67TA4FU.js';import {a as a$1}from'./chunk-FQVHJUX4.js';import {u,a as a$2,o,l,w,c}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function L({state:e}){let{exit:m}=useApp();return useEffect(()=>{let n=setTimeout(()=>m(),100);return ()=>clearTimeout(n)},[m]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"switch"}),e.type==="error"&&jsx(Box,{flexDirection:"column",paddingLeft:2,children:jsx(a$1.Err,{children:e.message})}),e.type==="only_one"&&jsx(Box,{paddingLeft:2,children:jsxs(a$1.Dim,{children:["Only one tenant available: ",e.slug]})}),e.type==="list"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:0,children:[e.tenants.map((n,d)=>jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:n.isActive?a$2:o,children:n.isActive?u:" "}),jsx(Text,{color:n.isActive?l:o,bold:n.isActive,children:n.slug}),jsxs(Text,{color:o,children:["(",n.tenantId,")"]})]},n.slug)),jsx(Box,{marginTop:1,children:jsxs(a$1.Dim,{children:["To switch, run: culvii switch ","<tenant-slug>"]})})]}),e.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w}),jsxs(Text,{color:l,bold:true,children:["Switched to ",e.slug]})]}),jsxs(a$1.Dim,{children:["workspace: ",e.workspaceSlug||"none"," \xB7 env: ",e.environment]})]})]})}export{L as SwitchView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$4}from'./chunk-MPKGJC7N.js';import {a as a$3}from'./chunk-5NBKYMD7.js';import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import'./chunk-57XLDHK6.js';import {x,e,l,w,c,o}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function B(o){return o==="prod"?"allow":o==="sandbox"?"warn":"info"}function G({state:o$1}){let{exit:a$5}=useApp();return useEffect(()=>{if(o$1.type!=="loading"){let u=setTimeout(()=>a$5(),100);return ()=>clearTimeout(u)}},[o$1.type,a$5]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"whoami"}),o$1.type==="loading"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Fetching identity\u2026"})}),o$1.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:e,children:x}),jsx(Text,{color:l,children:o$1.message})]}),o$1.detail&&jsx(Box,{paddingLeft:2,children:jsx(a$2.Dim,{children:o$1.detail})})]}),o$1.type==="success"&&jsxs(Box,{flexDirection:"column",gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:c,children:w}),jsx(Text,{color:l,children:o$1.email})]}),jsx(a$3,{variant:"default",compact:true,content:[{k:"tenant",v:jsxs(Text,{color:l,children:[o$1.tenantName," ",jsxs(Text,{color:o,children:["(",o$1.tenant,")"]})]})},{k:"workspace",v:jsx(Text,{color:l,children:o$1.workspace||jsx(Text,{color:o,children:"none"})})},{k:"env",v:jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(a$4,{variant:B(o$1.env),children:o$1.env}),!o$1.envAccessible&&jsx(Text,{color:e,children:"(no access)"})]})},{k:"access",v:o$1.accessibleEnvs.length>0?jsx(Text,{color:l,children:o$1.accessibleEnvs.join(", ")}):jsx(Text,{color:o,children:"none"})},{k:"roles",v:o$1.roles.length>0?jsx(Text,{color:l,children:o$1.roles.join(", ")}):jsx(Text,{color:o,children:"none"})}]})]})]})}export{G as WhoamiView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$3}from'./chunk-5NBKYMD7.js';import {a}from'./chunk-R67TA4FU.js';import {a as a$2}from'./chunk-FQVHJUX4.js';import {a as a$1}from'./chunk-JYNOILCD.js';import {a as a$4}from'./chunk-57XLDHK6.js';import {w,l,p,n,m}from'./chunk-YKFGEPLO.js';import'./chunk-YPLDPHHD.js';import'./chunk-7UWDMECF.js';import {useEffect}from'react';import {useApp,Box,Text}from'ink';import {jsxs,jsx}from'react/jsx-runtime';function B({columns:e,data:n$1,rowAccent:l$1}){return jsxs(Box,{flexDirection:"column",marginY:1,children:[jsx(Box,{flexDirection:"row",borderBottom:true,borderStyle:"single",borderTop:false,borderLeft:false,borderRight:false,borderColor:p,paddingBottom:0,marginBottom:0,children:e.map((i,c)=>jsx(Box,{width:i.width,flexBasis:i.width?void 0:i.flex||1,flexGrow:i.width?0:i.flex||1,flexShrink:i.width?0:1,paddingRight:c<e.length-1?2:0,justifyContent:i.align==="right"?"flex-end":i.align==="center"?"center":"flex-start",children:jsx(a$4,{color:n,bold:true,children:i.label})},String(i.key)))}),n$1.map((i,c)=>{let C=(l$1?l$1(i,c):false)?l:m;return jsx(Box,{flexDirection:"row",paddingY:0,children:e.map((t,S)=>{let f=i[t.key];return jsx(Box,{width:t.width,flexBasis:t.width?void 0:t.flex||1,flexGrow:t.width?0:t.flex||1,flexShrink:t.width?0:1,paddingRight:S<e.length-1?2:0,justifyContent:t.align==="right"?"flex-end":t.align==="center"?"center":"flex-start",overflow:"hidden",children:t.render?t.render(f,i):jsx(a$4,{color:C,wrap:"truncate-end",children:f!=null?String(f):""})},String(t.key))})},c)})]})}function J({state:e}){let{exit:n}=useApp();return useEffect(()=>{if(e.type!=="loading"){let l=setTimeout(()=>n(),100);return ()=>clearTimeout(l)}},[e.type,n]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"workspace create"}),e.type==="loading"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Creating workspace\u2026"})}),e.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsx(a$2.Err,{children:e.message}),e.detail&&jsx(a$2.Dim,{children:e.detail})]}),e.type==="success"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,gap:1,children:[jsxs(Box,{flexDirection:"row",gap:1,children:[jsx(Text,{color:l,children:w}),jsx(Text,{color:l,bold:true,children:e.name})]}),jsx(a$3,{variant:"default",content:[{k:"id",v:jsx(Text,{color:l,children:e.id})},{k:"slug",v:jsx(Text,{color:l,children:e.slug})}]})]})]})}var W=[{key:"name",label:"name",width:24},{key:"slug",label:"slug",width:24},{key:"id",label:"id",width:32}];function Q({state:e}){let{exit:n}=useApp();return useEffect(()=>{if(e.type!=="loading"){let l=setTimeout(()=>n(),100);return ()=>clearTimeout(l)}},[e.type,n]),jsxs(Box,{flexDirection:"column",children:[jsx(a,{command:"culvii",subcommand:"workspace list"}),e.type==="loading"&&jsx(Box,{paddingLeft:2,children:jsx(a$1,{label:"Fetching workspaces\u2026"})}),e.type==="error"&&jsxs(Box,{flexDirection:"column",paddingLeft:2,children:[jsx(a$2.Err,{children:e.message}),e.detail&&jsx(a$2.Dim,{children:e.detail})]}),e.type==="success"&&e.workspaces.length===0&&jsx(Box,{paddingLeft:2,children:jsx(a$2.Dim,{children:"No workspaces found."})}),e.type==="success"&&e.workspaces.length>0&&jsx(Box,{paddingLeft:2,children:jsx(B,{columns:W,data:e.workspaces})})]})}export{J as WorkspaceCreateView,Q as WorkspaceListView};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {f as f$1,e,d,c,a,n,m}from'./chunk-YKFGEPLO.js';import {Text}from'ink';import {jsx}from'react/jsx-runtime';var f={default:void 0,muted:m,subtle:n,accent:a,success:c,warning:d,danger:e,info:f$1};function g({variant:i="default",color:c,...d}){let x=c||f[i];return jsx(Text,{color:x,...d})}export{g as a};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a as a$2}from'./chunk-57XLDHK6.js';import {g,i,a as a$1,p}from'./chunk-YKFGEPLO.js';import {a}from'./chunk-YPLDPHHD.js';import {Box}from'ink';import {jsxs,jsx}from'react/jsx-runtime';var k={default:p,accent:a$1,err:i,ok:g};function C({variant:g="default",title:s,content:e,children:m,compact:a$1=false}){let p=k[g],h=a().supportsUnicode?"round":"single",u=a$1&&e&&e.length>0?Math.max(...e.map(t=>t.k.length)):0;return jsxs(Box,{flexDirection:"column",borderStyle:h,borderColor:p,paddingX:a$1?2:1,paddingY:a$1?1:0,marginBottom:0,alignSelf:a$1?"flex-start":void 0,children:[s&&jsx(Box,{marginBottom:1,children:jsx(a$2,{variant:"accent",bold:true,children:s})}),e&&e.length>0&&jsx(Box,{flexDirection:"column",children:e.map((t,i)=>a$1?jsxs(Box,{flexDirection:"row",gap:4,marginBottom:i<e.length-1?1:0,children:[jsx(a$2,{variant:"subtle",children:t.k.padEnd(u)}),typeof t.v=="string"?jsx(a$2,{children:t.v}):t.v]},i):jsxs(Box,{flexDirection:"row",justifyContent:"space-between",marginBottom:i<e.length-1?1:0,children:[jsx(Box,{marginRight:2,children:jsx(a$2,{variant:"subtle",children:t.k})}),jsx(Box,{children:typeof t.v=="string"?jsx(a$2,{children:t.v}):t.v})]},i))}),m]})}export{C as a};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:true}):c,b));export{m as a,n as b};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import {a}from'./chunk-HX54IFSD.js';import {Analytics}from'@segment/analytics-node';var P={CLI_INSTALLED:"cli_installed",CLI_VERSION_VIEWED:"cli_version_viewed",CLI_HELP_VIEWED:"cli_help_viewed",CLI_UNHANDLED_ERROR:"cli_unhandled_error",LOGIN_STARTED:"login_started",LOGIN_SUCCEEDED:"login_succeeded",LOGIN_FAILED:"login_failed",LOGOUT:"logout",DEV_STARTED:"dev_started",DEV_STOPPED:"dev_stopped",DEV_FAILED:"dev_failed",DEPLOY_STARTED:"deploy_started",DEPLOY_SUCCEEDED:"deploy_succeeded",DEPLOY_FAILED:"deploy_failed",DEPLOY_ABORTED:"deploy_aborted",API_KEY_CREATED:"api_key_created",API_KEY_LISTED:"api_key_listed",API_KEY_REVOKED:"api_key_revoked",API_KEY_ROTATED:"api_key_rotated",API_KEY_CREATE_FAILED:"api_key_create_failed",API_KEY_LIST_FAILED:"api_key_list_failed",API_KEY_ROTATE_FAILED:"api_key_rotate_failed",API_KEY_REVOKE_FAILED:"api_key_revoke_failed",TENANT_SWITCHED:"tenant_switched",ENV_SWITCHED:"env_switched",ENV_SWITCH_FAILED:"env_switch_failed",WORKSPACE_CREATED:"workspace_created",WORKSPACE_LISTED:"workspace_listed",TENANT_SWITCH_FAILED:"tenant_switch_failed",WORKSPACE_CREATE_FAILED:"workspace_create_failed",WORKSPACE_LIST_FAILED:"workspace_list_failed",WHOAMI_VIEWED:"whoami_viewed",RENAME_STARTED:"rename_started",RENAME_SUCCEEDED:"rename_succeeded",RENAME_FAILED:"rename_failed",INIT_STARTED:"init_started",INIT_SUCCEEDED:"init_succeeded",INIT_FAILED:"init_failed"},D="byn3jQco5axUIlfeohbQYYPGrZgGpw7A",w=process.env.CULVII_TELEMETRY!=="false",o=w?new Analytics({writeKey:D,flushAt:1,flushInterval:0}):null;function m(){return {surface:"cli",cli_version:"0.0.1",node_version:process.version,os:process.platform,arch:process.arch}}var c=null;async function x(){if(c)return c;try{let{ConfigStore:n}=await import('./config-store-WSXGIIJ4.js');c=(await new n().read({exitOnError:!1})).anonymousId??"unknown";}catch{c="unknown";}return c}var d=null,E=null,f=false;function U(){f=false;}async function y(){if(f)return {userId:d,tenantId:E};try{let{ConfigStore:n}=await import('./config-store-WSXGIIJ4.js'),e=await new n().read({exitOnError:!1}),i=e.contexts[e.active];E=i?.tenant_id??null,d=i?.user_id??e.anonymousId??null;}catch{d=null,E=null;}finally{f=true;}return {userId:d,tenantId:E}}async function C(n,t={},e,i){if(o)try{let r=await y(),a=e??r.userId,s=i!==void 0?i:r.tenantId,_=await x();a?o.track({userId:a,event:n,properties:{...m(),...s?{tenant_id:s}:{},...t}}):o.track({anonymousId:_,event:n,properties:{...m(),...t}});}catch{}}async function V(n,t,e,i={}){await C(n,i,t,e);}async function F(n,t={}){if(o)try{o.identify({userId:n,traits:t});}catch{}}async function K(n,t){if(o)try{o.alias({userId:n,previousId:t});}catch{}}async function Y(n,t,e={}){if(o)try{o.group({userId:n,groupId:t,traits:e});}catch{}}var l=null;async function p(){if(o)return l||(l=o.flush({timeout:3e3}).catch(()=>{}).finally(()=>{l=null;}),l)}var u={dev:"development",sandbox:"sandbox",prod:"production"};function L(n){let t=Object.entries(u).find(([,e])=>e===n);return t?t[0]:null}var R=["dev","sandbox","prod"];function W(n){let t=new Set(n.map(L).filter(e=>e!==null));return R.find(e=>t.has(e))??null}var v;function G(n){v=n&&n in u?n:void 0;}function H(){return v}var k="https://api.platform.culvii.com",S={apiBaseUrl:k,clientId:"4h45e9ljrr7qjv9olag0c80fhh",cognitoDomain:"eu-west-21iv4il5iq.auth.eu-west-2.amazoncognito.com"},I=process.env.CULVII_ENV,h=I&&I in u?I:"dev",N={...S,logicalEnvironment:h,scopes:["openid","email","profile"],callbackPorts:[52700,52701,52702,52703,52704,52705,52706,52707,52708,52709],callbackPath:"/callback"};async function M(n){let e=await new a().read(),i=e.contexts[e.active];i||(console.error("Error: Active context key not found in contexts in ~/.culvii/config."),console.error("Please run `culvii login` to authenticate and configure your active context."),await p(),process.exit(1));let r={...i},a$1=n?.env??v;a$1&&(r.environment=a$1);let s=r.environment||"dev";r.environment_id=r.environment_ids?.[s]??r.environment_id,r.workspace_ids&&s in r.workspace_ids&&(r.workspace_id=r.workspace_ids[s]??null),r.workspace_slugs&&s in r.workspace_slugs&&(r.workspace_slug=r.workspace_slugs[s]??null),n?.workspace&&(r.workspace_id=n.workspace);let _=N.apiBaseUrl;return _||(console.error("Error: No API URL found for the configured platform."),await p(),process.exit(1)),{apiUrl:_,context:r}}function j(n){let t=n.environment||"dev",e=n.environment_ids?.[t]??n.environment_id;return {...n.tenant_id?{"x-tenant-id":n.tenant_id}:{},...e?{"x-environment-id":e}:{"x-environment-slug":u[t]}}}
3
+ export{P as a,x as b,U as c,y as d,C as e,V as f,F as g,K as h,Y as i,p as j,u as k,L as l,W as m,G as n,H as o,h as p,N as q,M as r,j as s};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import {a,z,c,w,d as d$1,y as y$1,e,x,p,m,l,o}from'./chunk-YKFGEPLO.js';import N from'react';import {Box,Text}from'ink';import {jsx,jsxs}from'react/jsx-runtime';function t(e,p,l=false){let c=[],f="";return N.Children.forEach(e,u=>{typeof u=="string"||typeof u=="number"?f+=u:(f&&(c.push(jsx(Text,{color:p,bold:l,children:f},c.length)),f=""),c.push(u));}),f&&c.push(jsx(Text,{color:p,bold:l,children:f},c.length)),c}function O({children:e}){return jsx(Box,{flexDirection:"row",children:t(e,m)})}function S({children:e}){return jsx(Box,{flexDirection:"row",children:t(e,l,true)})}function d({children:e}){return jsx(Box,{flexDirection:"row",children:t(e,l)})}function g({children:e}){return jsxs(Box,{flexDirection:"row",children:[jsx(Text,{color:a,children:z+" "}),t(e,l)]})}function h({children:e}){return jsxs(Box,{flexDirection:"row",children:[jsx(Text,{color:c,children:w+" "}),t(e,l)]})}function G({children:e}){return jsxs(Box,{flexDirection:"row",children:[jsx(Text,{color:d$1,children:y$1+" "}),t(e,l)]})}function A({children:e$1}){return jsxs(Box,{flexDirection:"row",children:[jsx(Text,{color:e,children:x+" "}),t(e$1,l)]})}function C({children:e}){return jsx(Box,{flexDirection:"row",children:t(e,o)})}function y(){return jsx(Box,{children:jsx(Text,{color:p,children:"\u2014".repeat(50)})})}var I={Out:O,OutStrong:S,Cmd:d,Step:g,Ok:h,Warn:G,Err:A,Dim:C,Sep:y};export{I as a};