@aiaiai-pt/martha-cli 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -2,12 +2,39 @@
2
2
 
3
3
  All notable changes to `@aiaiai-pt/martha-cli`. Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project adheres to semver — `0.x` releases may include breaking changes between minor versions.
4
4
 
5
+ ## [Unreleased]
6
+
7
+ ### Changed — 0.5.1 CLI onboarding feedback
8
+ - `martha init` now defaults to the local preset; the hosted Martha cloud profile remains available through explicit `--preset cloud` and uses `keycloak.frank.nomadriver.co`.
9
+ - CLI version output now reads `martha-cli/package.json` instead of a second hardcoded literal.
10
+ - `martha agents create` exposes `--system-prompt` as the primary inline flag and keeps `--prompt` as a compatibility alias.
11
+ - CLI docs and bundled agent skill now explain explicit customer profile setup, `system_prompt`, and the normal chat-client agent grant-as-tool path.
12
+
13
+ ### Added — #407 connections command (service-account Drive auth)
14
+ - `martha connections create|list|update|test|delete` — manage Vault-backed integration connections from the CLI (previously admin-UI / raw-curl only). `create` mirrors `POST /api/admin/connections`; `update` mirrors `PUT`.
15
+ - Service-account Google Drive: `martha connections create --integration google_drive --auth-type service_account --credential-value @sa-key.json --config '{"subject":"...","scopes":[...]}'` reads enterprise Shared Drives without CASA (#407). The SA key shape (`type`, `client_email`) is validated before submit; `--credential-value` accepts `@file` / `-` (stdin) / literal.
16
+ - **SA key rotation** (#407 key-rotation story): `martha connections update <id> --credential-value @new-sa.json` rotates the key in Vault in place and drops the cached SA token so the new key takes effect immediately (no ~1h staleness window).
17
+ - OAuth2 connections are rejected with a clear error (they need interactive browser consent — use the admin UI).
18
+
19
+ ### Added — #372 PR5 inbound Drive folder sync
20
+ - `document-sync reconcile-tree --source <id> | --all [--dry-run]` — backfills the collection tree from a Google Drive source's folder hierarchy. Stamps `drive_folder_id` on existing collections matching `(parent, name)` and creates sub-collections for unmapped Drive folders. Runs server-side against the source's live OAuth token; idempotent on re-run. `--dry-run` previews link/create/skip counts without writing.
21
+
22
+ ## [0.5.0] — 2026-05-20
23
+
24
+ ### Added — #372 PR4 collection-hierarchy CLI parity
25
+ - `documents collections --tree` renders the parent → child hierarchy as ASCII, mirroring the admin tree UX from #372 PR3.
26
+ - `documents create-collection --parent <slug-or-id>` creates a sub-collection under the named parent. Same slug/name/UUID resolution the agent uses.
27
+ - `documents move-collection <id> --parent <slug-or-id> | --root` moves a collection atomically. Cycle prevention is server-side; CLI rejects self-as-parent eagerly.
28
+ - `clients grant <c> function <fn> --collection <slug-or-id>` and the matching `clients revoke ... --collection`. Scoped grants only apply to functions (#372 PR2 cascade); passing `--collection` to a workflow or agent grant is a clean Validation error.
29
+ - `agents add-function <a> <fn> --collection <slug-or-id>` and `agents remove-function <a> <fn> --collection` likewise. Omit the flag to target the root grant (`collection_id IS NULL` per the allowlist semantics).
30
+ - Shared `lib/collections.ts:resolveCollectionIdForGrant` resolves UUID, slug, or name with a single `GET /api/admin/collections` round-trip.
31
+
5
32
  ## [0.3.0] — 2026-05-10
6
33
 
7
34
  First-run UX for third-party developers and agent runtimes.
8
35
 
9
36
  ### Added
10
- - `martha init` — interactive wizard that writes a profile to `~/.martha/config.yaml`. Two presets: `cloud` (martha.nomadriver.co + auth.nomadriver.co) and `local` (localhost:8080 + 8180). Idempotent with `--force`; rejects overwrites without it.
37
+ - `martha init` — interactive wizard that writes a profile to `~/.martha/config.yaml`. Two presets: `cloud` (martha.nomadriver.co + keycloak.frank.nomadriver.co) and `local` (localhost:8080 + 8180). Idempotent with `--force`; rejects overwrites without it.
11
38
  - `martha doctor` — five-check diagnostic: API health, API/CLI version skew (via the new `GET /api/version` endpoint), Keycloak OIDC discovery, stored token validity, authenticated request. Exits non-zero only on FAIL, not WARN.
12
39
  - `martha skill` — prints the bundled `SKILL.md` to stdout. Agent runtimes that don't read filesystems by convention can now seed prompt context with `npx -y @aiaiai-pt/martha-cli@0.3.0 skill | head -200`.
13
40
 
package/README.md CHANGED
@@ -15,7 +15,7 @@ npx -y @aiaiai-pt/martha-cli@latest --help
15
15
  Pin a version when calling from CI or agent runtimes:
16
16
 
17
17
  ```bash
18
- npx -y @aiaiai-pt/martha-cli@0.2.0 agents list --json
18
+ npx -y @aiaiai-pt/martha-cli@0.5.1 agents list --json
19
19
  ```
20
20
 
21
21
  ### Install globally
@@ -31,9 +31,12 @@ Requires Node.js >= 22.
31
31
 
32
32
  ```bash
33
33
  # 1. Configure a profile — writes ~/.martha/config.yaml
34
- martha init # interactive (defaults to cloud preset)
35
- martha init --preset local # localhost dev stack
36
- martha init --no-interactive --name staging --api-url https://... # scripted
34
+ martha init # interactive, local preset by default
35
+ martha init --preset cloud # martha.nomadriver.co + keycloak.frank.nomadriver.co
36
+ martha init --no-interactive --name acme \
37
+ --api-url https://martha.acme.example \
38
+ --keycloak-url https://auth.acme.example \
39
+ --keycloak-realm acme # scripted customer profile
37
40
 
38
41
  # 2. Authenticate
39
42
  martha auth login # browser flow (PKCE)
@@ -56,15 +59,19 @@ Full command reference: `martha --help` (or any subcommand `--help`).
56
59
  Profiles live at `~/.martha/config.yaml`. Each profile defines:
57
60
 
58
61
  ```yaml
59
- current_profile: default
62
+ current_profile: local
60
63
  profiles:
61
- default:
62
- api_url: https://martha.nomadriver.co
63
- keycloak_url: https://auth.nomadriver.co
64
+ local:
65
+ api_url: http://localhost:8080
66
+ keycloak_url: http://localhost:8180
64
67
  keycloak_realm: frank
65
68
  auth_type: oidc
66
69
  ```
67
70
 
71
+ Install does not create or mutate `~/.martha/config.yaml`. Run `martha init`
72
+ or set `MARTHA_API_URL`, `MARTHA_KEYCLOAK_URL`, and
73
+ `MARTHA_KEYCLOAK_REALM` explicitly for your deployment.
74
+
68
75
  Override per-command:
69
76
 
70
77
  ```bash
@@ -102,12 +109,32 @@ martha skill
102
109
  npx -y @aiaiai-pt/martha-cli@latest skill | head -200
103
110
  ```
104
111
 
112
+ Agent YAML should use `system_prompt` for the durable agent instruction. To
113
+ make an agent callable from a chat client, grant the agent to that client; the
114
+ chat model will call it as a tool:
115
+
116
+ ```yaml
117
+ kind: Agent
118
+ name: support-bot
119
+ system_prompt: You help customers resolve support tickets.
120
+ llm_config:
121
+ provider: anthropic
122
+ model: claude-sonnet-4-6
123
+ loop_config:
124
+ max_iterations: 10
125
+ ```
126
+
127
+ ```bash
128
+ martha definitions apply -f support-bot.yaml --yes
129
+ martha clients grant web-chat agent support-bot
130
+ ```
131
+
105
132
  ## Stability
106
133
 
107
134
  `0.x` releases may change CLI flags or JSON output between minor versions. Pin a version in CI/agent contexts:
108
135
 
109
136
  ```bash
110
- npx -y @aiaiai-pt/martha-cli@0.3.0 ...
137
+ npx -y @aiaiai-pt/martha-cli@0.5.1 ...
111
138
  ```
112
139
 
113
140
  `1.0.0` will commit to a stable contract — see the [tracking issue](https://github.com/westeuropeco/martha/issues/292).