delimit-cli 4.1.15 → 4.1.17

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
@@ -1,4 +1,8 @@
1
- # `</>` Delimit\n\nStop re-explaining your codebase every session. Memory, tasks, and governance that persist across Claude Code, Codex, Cursor, and Gemini CLI.\n\n
1
+ # `</>` Delimit
2
+
3
+ Stop re-explaining your codebase every session. Memory, tasks, and governance that persist across Claude Code, Codex, Cursor, and Gemini CLI.
4
+
5
+
2
6
  ---
3
7
 
4
8
  ## Think and Build
@@ -10,5 +14,256 @@ The universal command for the Delimit Swarm. When you say **"Think and Build"**,
10
14
  - **"Vault"**: Manage local secrets and API keys (AES-256 encrypted).
11
15
 
12
16
  Works across any configuration — from a single model on a budget to an enterprise swarm of 4+ models.
13
- \n[![npm](https://img.shields.io/npm/v/delimit-cli)](https://www.npmjs.com/package/delimit-cli)\n[![GitHub Action](https://img.shields.io/badge/GitHub%20Action-v1.6.0-blue)](https://github.com/marketplace/actions/delimit-api-governance)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Glama](https://glama.ai/mcp/servers/delimit-ai/delimit/badge)](https://glama.ai/mcp/servers/delimit-ai/delimit)\n[![API Governance](https://delimit-ai.github.io/badge/pass.svg)](https://github.com/marketplace/actions/delimit-api-governance)\n\n<p align="center">\n <img src="docs/demo.gif" alt="Delimit detecting breaking API changes" width="700">\n</p>\n\n---\n\n## Try it in 2 minutes\n\n```bash\nnpx delimit-cli demo # See governance in action — no setup needed\nnpx delimit-cli init # Set up governance for your project\nnpx delimit-cli setup # Configure your AI assistants\n```\n\nNo API keys. No account. No config files.\n\n### Pick your first win\n\n**Protect my API** — catch breaking changes before merge:\n```bash\nnpx delimit-cli try\n# Creates a sample API, introduces breaking changes, shows what gets blocked.\n# Saves a governance report to delimit-report.md\n```\n\n**Watch for drift** — detect spec changes without review:\n```bash\nnpx delimit-cli init # Sets up governance + drift baseline\n# Weekly drift checks run automatically via GitHub Action\n```\n\n**Run PR copilot** — governance gates on every pull request:\n```yaml\n# .github/workflows/api-governance.yml\n- uses: delimit-ai/delimit-action@v1\n with:\n spec: api/openapi.yaml\n# Posts gate status, violations, and remediation in PR comments\n```\n\n---\n\n## What's New in v4.1\n\n- **TUI** -- terminal-native Ventures panel, real `delimit think` and `delimit build` commands\n- **Security hardening** -- notify.py stubbed in npm, axios pinned against supply chain attacks\n- **Free tier restructure** -- deliberations use Gemini Flash + GPT-4o-mini (cost: <$20/mo)\n- **Zero-config onboarding** -- auto-detect framework, scan, and first evidence in one command\n- **Auto-approve tools** -- `delimit setup` configures permissions for Claude Code, Codex, and Gemini CLI\n\n### v4.0\n\n- **Toolcard Delta Cache** -- SHA256 schema hashing, delta-only transmission, saves tokens\n- **Session Phoenix** -- cross-model session resurrection with soul capture\n- **Handoff Receipts** -- structured acknowledgment protocol between agents\n- **Cross-Model Audit** -- 3 lenses (security, correctness, governance) with deterministic synthesis\n- **4-model deliberation** -- Claude + Grok + Gemini + Codex debate until consensus\n- **Universal Swarm Triggers** -- "Think and Build", "Keep building", "Ask Delimit"
14
- - **176 MCP tools** -- governance, context, shipping, observability, orchestration, and swarm\n\n---\n\n## GitHub Action\n\nZero-config -- auto-detects your OpenAPI spec:\n\n```yaml\n- uses: delimit-ai/delimit-action@v1\n```\n\nOr with full configuration:\n\n```yaml\nname: API Contract Check\non: pull_request\n\njobs:\n delimit:\n runs-on: ubuntu-latest\n permissions:\n pull-requests: write\n steps:\n - uses: actions/checkout@v4\n with:\n fetch-depth: 0\n - uses: delimit-ai/delimit-action@v1\n with:\n spec: api/openapi.yaml\n```\n\nThat's it. Delimit auto-fetches the base branch spec, diffs it, and posts a PR comment with breaking changes, semver classification, migration guides, and governance gate results.\n\n[View on GitHub Marketplace](https://github.com/marketplace/actions/delimit-api-governance) | [See a live demo (23 breaking changes)](https://github.com/delimit-ai/delimit-action-demo/pull/2)\n\n### Example PR comment\n\n> **Breaking Changes Detected**\n>\n> | Change | Path | Severity |\n> |--------|------|----------|\n> | endpoint_removed | `DELETE /pets/{petId}` | error |\n> | type_changed | `/pets:GET:200[].id` (string -> integer) | warning |\n> | enum_value_removed | `/pets:GET:200[].status` | warning |\n>\n> **Semver**: MAJOR (1.0.0 -> 2.0.0)\n>\n> **Migration Guide**: 3 steps to update your integration\n>\n> ### Governance Gates\n> | Gate | Status | Chain |\n> |------|--------|-------|\n> | API Lint | Pass/Fail | lint -> semver -> gov_evaluate |\n> | Policy Compliance | Pass/Fail | policy -> evidence_collect |\n> | Security Audit | Pass | security_audit -> evidence_collect |\n> | Deploy Readiness | Ready/Blocked | deploy_plan -> security_audit |\n\n---\n\n## CLI commands\n\n```bash\nnpx delimit-cli quickstart # Clone demo project + guided walkthrough\nnpx delimit-cli try # Zero-risk demo — saves governance report\nnpx delimit-cli demo # Self-contained governance demo\nnpx delimit-cli init # Guided wizard with compliance templates\nnpx delimit-cli init --preset strict # Initialize with strict policy\nnpx delimit-cli setup # Install into all AI assistants\nnpx delimit-cli setup --dry-run # Preview changes first\nnpx delimit-cli lint api/openapi.yaml # Check for breaking changes\nnpx delimit-cli diff old.yaml new.yaml # Compare two specs\nnpx delimit-cli explain old.yaml new.yaml # Generate migration guide\nnpx delimit-cli doctor # Check setup health\nnpx delimit-cli uninstall --dry-run # Preview removal\n```\n\n### What the MCP toolkit adds\n\nWhen installed into your AI coding assistant, Delimit provides tools across two tiers:\n\n#### Free (no account needed)\n\n- **API governance** -- lint, diff, policy enforcement, semver classification\n- **Persistent ledger** -- track tasks across sessions, shared between all AI assistants\n- **Zero-spec extraction** -- generate OpenAPI specs from FastAPI, Express, or NestJS source\n- **Project scan** -- auto-detect specs, frameworks, security issues, and tests\n- **Quickstart** -- guided first-run that proves value in 60 seconds\n\n#### Pro\n\n- **Multi-model deliberation** -- AI models debate until they agree (free: Gemini Flash + GPT-4o-mini; BYOK: any models)\n- **Security audit** -- dependency scanning, secret detection, SAST analysis\n- **Test verification** -- confirms tests ran, measures coverage, generates new tests\n- **Memory & vault** -- persistent context and encrypted secrets across sessions\n- **Evidence collection** -- governance audit trail for compliance\n- **Deploy pipeline** -- governed build, publish, and rollback\n- **OS layer** -- agent identity, execution plans, approval gates\n\n---\n\n## What It Detects\n\n27 change types (17 breaking, 10 non-breaking) -- deterministic rules, not AI inference. Same input always produces the same result.\n\n### Breaking Changes\n\n| # | Change Type | Example |\n|---|-------------|---------|\n| 1 | `endpoint_removed` | `DELETE /users/{id}` removed entirely |\n| 2 | `method_removed` | `PATCH /orders` no longer exists |\n| 3 | `required_param_added` | New required header on `GET /items` |\n| 4 | `param_removed` | `sort` query parameter removed |\n| 5 | `response_removed` | `200 OK` response dropped |\n| 6 | `required_field_added` | Request body now requires `tenant_id` |\n| 7 | `field_removed` | `email` dropped from response object |\n| 8 | `type_changed` | `id` went from `string` to `integer` |\n| 9 | `format_changed` | `date-time` changed to `date` |\n| 10 | `enum_value_removed` | `status: "pending"` no longer valid |\n| 11 | `param_type_changed` | Query param `limit` changed from `integer` to `string` |\n| 12 | `param_required_changed` | `filter` param became required |\n| 13 | `response_type_changed` | Response `data` changed from `array` to `object` |\n| 14 | `security_removed` | OAuth2 security scheme removed |\n| 15 | `security_scope_removed` | `write:pets` scope removed from OAuth2 |\n| 16 | `max_length_decreased` | `name` maxLength reduced from 255 to 100 |\n| 17 | `min_length_increased` | `code` minLength increased from 1 to 5 |\n\n### Non-Breaking Changes\n\n| # | Change Type | Example |\n|---|-------------|---------|\n| 18 | `endpoint_added` | New `POST /webhooks` endpoint |\n| 19 | `method_added` | `PATCH /users/{id}` method added |\n| 20 | `optional_param_added` | Optional `format` query param added |\n| 21 | `response_added` | `201 Created` response added |\n| 22 | `optional_field_added` | Optional `nickname` field added to response |\n| 23 | `enum_value_added` | `status: "archived"` value added |\n| 24 | `description_changed` | Updated description for `/health` endpoint |\n| 25 | `security_added` | API key security scheme added |\n| 26 | `deprecated_added` | `GET /v1/users` marked as deprecated |\n| 27 | `default_changed` | Default value for `page_size` changed from 10 to 20 |\n\n---\n\n## Policy presets\n\n```bash\nnpx delimit-cli init --preset strict # All violations are errors\nnpx delimit-cli init --preset default # Balanced (default)\nnpx delimit-cli init --preset relaxed # All violations are warnings\n```\n\nOr write custom rules in `.delimit/policies.yml`:\n\n```yaml\nrules:\n - id: freeze_v1\n name: Freeze V1 API\n change_types: [endpoint_removed, method_removed, field_removed]\n severity: error\n action: forbid\n conditions:\n path_pattern: "^/v1/.*"\n message: "V1 API is frozen. Changes must be made in V2."\n```\n\n---\n\n## Supported formats\n\n- OpenAPI 3.0 and 3.1\n- Swagger 2.0\n- YAML and JSON\n\n---\n\n## Links\n\n- [delimit.ai](https://delimit.ai) -- homepage\n- [Dashboard](https://app.delimit.ai) -- governance console\n- [Docs](https://delimit.ai/docs) -- full documentation\n- [GitHub Action](https://github.com/marketplace/actions/delimit-api-governance) -- Marketplace listing\n- [Quickstart](https://github.com/delimit-ai/delimit-mcp-server) -- try it in 2 minutes\n- [npm](https://www.npmjs.com/package/delimit-cli) -- CLI package\n- [Pricing](https://delimit.ai/pricing) -- free tier + Pro\n\nMIT License
17
+
18
+ [![npm](https://img.shields.io/npm/v/delimit-cli)](https://www.npmjs.com/package/delimit-cli)
19
+ [![GitHub Action](https://img.shields.io/badge/GitHub%20Action-v1.6.0-blue)](https://github.com/marketplace/actions/delimit-api-governance)
20
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
21
+ [![Glama](https://glama.ai/mcp/servers/delimit-ai/delimit/badge)](https://glama.ai/mcp/servers/delimit-ai/delimit)
22
+ [![API Governance](https://delimit-ai.github.io/badge/pass.svg)](https://github.com/marketplace/actions/delimit-api-governance)
23
+
24
+ <p align="center">
25
+ <img src="docs/demo.gif" alt="Delimit detecting breaking API changes" width="700">
26
+ </p>
27
+
28
+ ---
29
+
30
+ ## Try it in 2 minutes
31
+
32
+ ```bash
33
+ npx delimit-cli scan # Instant health grade for your API spec
34
+ npx delimit-cli demo # See governance in action — no setup needed
35
+ npx delimit-cli setup # Configure your AI assistants
36
+ ```
37
+
38
+ No API keys. No account. No config files.
39
+
40
+ ### Pick your first win
41
+
42
+ **Protect my API** — catch breaking changes before merge:
43
+ ```bash
44
+ npx delimit-cli try
45
+ # Creates a sample API, introduces breaking changes, shows what gets blocked.
46
+ # Saves a governance report to delimit-report.md
47
+ ```
48
+
49
+ **Watch for drift** — detect spec changes without review:
50
+ ```bash
51
+ npx delimit-cli init # Sets up governance + drift baseline
52
+ # Weekly drift checks run automatically via GitHub Action
53
+ ```
54
+
55
+ **Run PR copilot** — governance gates on every pull request:
56
+ ```yaml
57
+ # .github/workflows/api-governance.yml
58
+ - uses: delimit-ai/delimit-action@v1
59
+ with:
60
+ spec: api/openapi.yaml
61
+ # Posts gate status, violations, and remediation in PR comments
62
+ ```
63
+
64
+ ---
65
+
66
+ ## What's New in v4.1
67
+
68
+ - **TUI** -- terminal-native Ventures panel, real `delimit think` and `delimit build` commands
69
+ - **Security hardening** -- notify.py stubbed in npm, axios pinned against supply chain attacks
70
+ - **Free tier restructure** -- deliberations use Gemini Flash + GPT-4o-mini (cost: <$20/mo)
71
+ - **Zero-config onboarding** -- auto-detect framework, scan, and first evidence in one command
72
+ - **Auto-approve tools** -- `delimit setup` configures permissions for Claude Code, Codex, and Gemini CLI
73
+
74
+ ### v4.0
75
+
76
+ - **Toolcard Delta Cache** -- SHA256 schema hashing, delta-only transmission, saves tokens
77
+ - **Session Phoenix** -- cross-model session resurrection with soul capture
78
+ - **Handoff Receipts** -- structured acknowledgment protocol between agents
79
+ - **Cross-Model Audit** -- 3 lenses (security, correctness, governance) with deterministic synthesis
80
+ - **4-model deliberation** -- Claude + Grok + Gemini + Codex debate until consensus
81
+ - **Universal Swarm Triggers** -- "Think and Build", "Keep building", "Ask Delimit"
82
+ - **187 MCP tools** -- governance, context, shipping, observability, orchestration, and swarm
83
+
84
+ ---
85
+
86
+ ## GitHub Action
87
+
88
+ Zero-config -- auto-detects your OpenAPI spec:
89
+
90
+ ```yaml
91
+ - uses: delimit-ai/delimit-action@v1
92
+ ```
93
+
94
+ Or with full configuration:
95
+
96
+ ```yaml
97
+ name: API Contract Check
98
+ on: pull_request
99
+
100
+ jobs:
101
+ delimit:
102
+ runs-on: ubuntu-latest
103
+ permissions:
104
+ pull-requests: write
105
+ steps:
106
+ - uses: actions/checkout@v4
107
+ with:
108
+ fetch-depth: 0
109
+ - uses: delimit-ai/delimit-action@v1
110
+ with:
111
+ spec: api/openapi.yaml
112
+ ```
113
+
114
+ That's it. Delimit auto-fetches the base branch spec, diffs it, and posts a PR comment with breaking changes, semver classification, migration guides, and governance gate results.
115
+
116
+ [View on GitHub Marketplace](https://github.com/marketplace/actions/delimit-api-governance) | [See a live demo (23 breaking changes)](https://github.com/delimit-ai/delimit-action-demo/pull/2)
117
+
118
+ ### Example PR comment
119
+
120
+ > **Breaking Changes Detected**
121
+ >
122
+ > | Change | Path | Severity |
123
+ > |--------|------|----------|
124
+ > | endpoint_removed | `DELETE /pets/{petId}` | error |
125
+ > | type_changed | `/pets:GET:200[].id` (string -> integer) | warning |
126
+ > | enum_value_removed | `/pets:GET:200[].status` | warning |
127
+ >
128
+ > **Semver**: MAJOR (1.0.0 -> 2.0.0)
129
+ >
130
+ > **Migration Guide**: 3 steps to update your integration
131
+ >
132
+ > ### Governance Gates
133
+ > | Gate | Status | Chain |
134
+ > |------|--------|-------|
135
+ > | API Lint | Pass/Fail | lint -> semver -> gov_evaluate |
136
+ > | Policy Compliance | Pass/Fail | policy -> evidence_collect |
137
+ > | Security Audit | Pass | security_audit -> evidence_collect |
138
+ > | Deploy Readiness | Ready/Blocked | deploy_plan -> security_audit |
139
+
140
+ ---
141
+
142
+ ## CLI commands
143
+
144
+ ```bash
145
+ npx delimit-cli scan # Instant spec health grade + recommendations
146
+ npx delimit-cli quickstart # Clone demo project + guided walkthrough
147
+ npx delimit-cli try # Zero-risk demo — saves governance report
148
+ npx delimit-cli demo # Self-contained governance demo
149
+ npx delimit-cli init # Guided wizard with compliance templates
150
+ npx delimit-cli init --preset strict # Initialize with strict policy
151
+ npx delimit-cli setup # Install into all AI assistants
152
+ npx delimit-cli setup --dry-run # Preview changes first
153
+ npx delimit-cli lint api/openapi.yaml # Check for breaking changes
154
+ npx delimit-cli diff old.yaml new.yaml # Compare two specs
155
+ npx delimit-cli explain old.yaml new.yaml # Generate migration guide
156
+ npx delimit-cli doctor # Check setup health
157
+ npx delimit-cli uninstall --dry-run # Preview removal
158
+ ```
159
+
160
+ ### What the MCP toolkit adds
161
+
162
+ When installed into your AI coding assistant, Delimit provides tools across two tiers:
163
+
164
+ #### Free (no account needed)
165
+
166
+ - **API governance** -- lint, diff, policy enforcement, semver classification
167
+ - **Persistent ledger** -- track tasks across sessions, shared between all AI assistants
168
+ - **Zero-spec extraction** -- generate OpenAPI specs from FastAPI, Express, or NestJS source
169
+ - **Project scan** -- auto-detect specs, frameworks, security issues, and tests
170
+ - **Quickstart** -- guided first-run that proves value in 60 seconds
171
+
172
+ #### Pro
173
+
174
+ - **Multi-model deliberation** -- AI models debate until they agree (free: Gemini Flash + GPT-4o-mini; BYOK: any models)
175
+ - **Security audit** -- dependency scanning, secret detection, SAST analysis
176
+ - **Test verification** -- confirms tests ran, measures coverage, generates new tests
177
+ - **Memory & vault** -- persistent context and encrypted secrets across sessions
178
+ - **Evidence collection** -- governance audit trail for compliance
179
+ - **Deploy pipeline** -- governed build, publish, and rollback
180
+ - **OS layer** -- agent identity, execution plans, approval gates
181
+
182
+ ---
183
+
184
+ ## What It Detects
185
+
186
+ 27 change types (17 breaking, 10 non-breaking) -- deterministic rules, not AI inference. Same input always produces the same result.
187
+
188
+ ### Breaking Changes
189
+
190
+ | # | Change Type | Example |
191
+ |---|-------------|---------|
192
+ | 1 | `endpoint_removed` | `DELETE /users/{id}` removed entirely |
193
+ | 2 | `method_removed` | `PATCH /orders` no longer exists |
194
+ | 3 | `required_param_added` | New required header on `GET /items` |
195
+ | 4 | `param_removed` | `sort` query parameter removed |
196
+ | 5 | `response_removed` | `200 OK` response dropped |
197
+ | 6 | `required_field_added` | Request body now requires `tenant_id` |
198
+ | 7 | `field_removed` | `email` dropped from response object |
199
+ | 8 | `type_changed` | `id` went from `string` to `integer` |
200
+ | 9 | `format_changed` | `date-time` changed to `date` |
201
+ | 10 | `enum_value_removed` | `status: "pending"` no longer valid |
202
+ | 11 | `param_type_changed` | Query param `limit` changed from `integer` to `string` |
203
+ | 12 | `param_required_changed` | `filter` param became required |
204
+ | 13 | `response_type_changed` | Response `data` changed from `array` to `object` |
205
+ | 14 | `security_removed` | OAuth2 security scheme removed |
206
+ | 15 | `security_scope_removed` | `write:pets` scope removed from OAuth2 |
207
+ | 16 | `max_length_decreased` | `name` maxLength reduced from 255 to 100 |
208
+ | 17 | `min_length_increased` | `code` minLength increased from 1 to 5 |
209
+
210
+ ### Non-Breaking Changes
211
+
212
+ | # | Change Type | Example |
213
+ |---|-------------|---------|
214
+ | 18 | `endpoint_added` | New `POST /webhooks` endpoint |
215
+ | 19 | `method_added` | `PATCH /users/{id}` method added |
216
+ | 20 | `optional_param_added` | Optional `format` query param added |
217
+ | 21 | `response_added` | `201 Created` response added |
218
+ | 22 | `optional_field_added` | Optional `nickname` field added to response |
219
+ | 23 | `enum_value_added` | `status: "archived"` value added |
220
+ | 24 | `description_changed` | Updated description for `/health` endpoint |
221
+ | 25 | `security_added` | API key security scheme added |
222
+ | 26 | `deprecated_added` | `GET /v1/users` marked as deprecated |
223
+ | 27 | `default_changed` | Default value for `page_size` changed from 10 to 20 |
224
+
225
+ ---
226
+
227
+ ## Policy presets
228
+
229
+ ```bash
230
+ npx delimit-cli init --preset strict # All violations are errors
231
+ npx delimit-cli init --preset default # Balanced (default)
232
+ npx delimit-cli init --preset relaxed # All violations are warnings
233
+ ```
234
+
235
+ Or write custom rules in `.delimit/policies.yml`:
236
+
237
+ ```yaml
238
+ rules:
239
+ - id: freeze_v1
240
+ name: Freeze V1 API
241
+ change_types: [endpoint_removed, method_removed, field_removed]
242
+ severity: error
243
+ action: forbid
244
+ conditions:
245
+ path_pattern: "^/v1/.*"
246
+ message: "V1 API is frozen. Changes must be made in V2."
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Supported formats
252
+
253
+ - OpenAPI 3.0 and 3.1
254
+ - Swagger 2.0
255
+ - YAML and JSON
256
+
257
+ ---
258
+
259
+ ## Links
260
+
261
+ - [delimit.ai](https://delimit.ai) -- homepage
262
+ - [Dashboard](https://app.delimit.ai) -- governance console
263
+ - [Docs](https://delimit.ai/docs) -- full documentation
264
+ - [GitHub Action](https://github.com/marketplace/actions/delimit-api-governance) -- Marketplace listing
265
+ - [Quickstart](https://github.com/delimit-ai/delimit-mcp-server) -- try it in 2 minutes
266
+ - [npm](https://www.npmjs.com/package/delimit-cli) -- CLI package
267
+ - [Pricing](https://delimit.ai/pricing) -- free tier + Pro
268
+
269
+ MIT License
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+ # Delimit OS — the AI developer operating system
3
+ # Type 'delimit' to launch the TUI, or 'delimit <command>' for CLI tools
4
+ #
5
+ # Usage:
6
+ # delimit → Launch TUI (interactive terminal dashboard)
7
+ # delimit --quick → Quick status (non-interactive)
8
+ # delimit think → Trigger deliberation
9
+ # delimit build → Start autonomous build loop
10
+ # delimit ask <query> → Ask the swarm
11
+ # delimit lint <spec> → Lint an API spec
12
+ # delimit init → Initialize governance in current repo
13
+ # delimit setup → Configure AI assistants
14
+
15
+ set -e
16
+
17
+ DELIMIT_HOME="${DELIMIT_HOME:-$HOME/.delimit}"
18
+ GATEWAY="$DELIMIT_HOME/server/ai"
19
+
20
+ # If no args, launch TUI (interactive if terminal, quick if piped)
21
+ if [ $# -eq 0 ]; then
22
+ if [ -f "$GATEWAY/tui.py" ]; then
23
+ if [ -t 1 ] && [ -t 0 ]; then
24
+ cd "$DELIMIT_HOME/server" && exec python3 -m ai.tui
25
+ else
26
+ cd "$DELIMIT_HOME/server" && exec python3 -m ai.tui --quick
27
+ fi
28
+ else
29
+ # Fallback to npm CLI
30
+ exec delimit-cli "$@"
31
+ fi
32
+ fi
33
+
34
+ # Route commands
35
+ case "$1" in
36
+ --quick|-q)
37
+ if [ -f "$GATEWAY/tui.py" ]; then
38
+ cd "$DELIMIT_HOME/server" && exec python3 -m ai.tui --quick
39
+ else
40
+ exec delimit-cli status
41
+ fi
42
+ ;;
43
+ think|deliberate)
44
+ shift
45
+ QUESTION="${*:-What should we build next based on the current ledger and signals?}"
46
+ echo "[Delimit OS] Triggering deliberation..."
47
+ cd "$DELIMIT_HOME/server" && python3 -c "
48
+ from ai.deliberation import deliberate
49
+ import json
50
+ result = deliberate('''$QUESTION''', mode='dialogue', max_rounds=3)
51
+ if 'error' in result:
52
+ print(f'Error: {result[\"error\"]}')
53
+ elif result.get('mode') == 'single_model_reflection':
54
+ print(f'Model: {result.get(\"model\", \"?\")}')
55
+ print(f'\\nAdvocate:\\n{result.get(\"advocate\", \"\")[:500]}')
56
+ print(f'\\nCritic:\\n{result.get(\"critic\", \"\")[:500]}')
57
+ print(f'\\nSynthesis:\\n{result.get(\"synthesis\", \"\")}')
58
+ else:
59
+ print(f'Verdict: {result.get(\"final_verdict\", \"no consensus\")[:500]}')
60
+ print(f'Rounds: {result.get(\"rounds\", 0)}')
61
+ " 2>&1
62
+ ;;
63
+ build|loop)
64
+ shift
65
+ echo "[Delimit OS] Starting autonomous build loop..."
66
+ echo "Checking ledger for next task..."
67
+ cd "$DELIMIT_HOME/server" && python3 -c "
68
+ from ai.ledger_manager import get_context
69
+ import json
70
+ result = get_context()
71
+ items = result.get('next_up', [])
72
+ if items:
73
+ print(f'Next up: {items[0].get(\"id\", \"?\")} [{items[0].get(\"priority\", \"?\")}] {items[0].get(\"title\", \"?\")[:60]}')
74
+ print(f'Total open: {result.get(\"open_items\", 0)}')
75
+ else:
76
+ print('Ledger is clear — nothing to build.')
77
+ " 2>&1
78
+ ;;
79
+ ask)
80
+ shift
81
+ QUERY="$*"
82
+ if [ -z "$QUERY" ]; then
83
+ echo "Usage: delimit ask <question>"
84
+ exit 1
85
+ fi
86
+ echo "[Delimit OS] Checking context..."
87
+ cd "$DELIMIT_HOME/server" && python3 -c "
88
+ from ai.ledger_manager import get_context
89
+ import json
90
+ result = get_context()
91
+ print(json.dumps(result, indent=2)[:2000])
92
+ " 2>&1
93
+ ;;
94
+ status)
95
+ if [ -f "$GATEWAY/tui.py" ]; then
96
+ cd "$GATEWAY/.." && exec python3 -m ai.tui --quick
97
+ else
98
+ exec delimit-cli status
99
+ fi
100
+ ;;
101
+ *)
102
+ # Pass through to delimit-cli for all other commands
103
+ exec delimit-cli "$@"
104
+ ;;
105
+ esac
@@ -800,11 +800,21 @@ exit 127
800
800
  await logp(` ${green('✓')} Governance shims updated`);
801
801
  } else {
802
802
  log(` ${green('✓')} Governance wrapping enabled`);
803
- log('');
804
- log(` ${bold('To activate now, run:')}`);
805
- log(` ${green('source ~/.bashrc')}`);
806
- log('');
807
- log(` ${dim('Or restart your terminal. The banner appears before each AI session.')}`);
803
+ }
804
+
805
+ // Activate shims in current session by setting PATH
806
+ process.env.PATH = `${shimsDir}:${process.env.PATH}`;
807
+
808
+ // Verify the shim is reachable
809
+ try {
810
+ const which = execSync(`which claude 2>/dev/null`, { encoding: 'utf-8', timeout: 3000 }).trim();
811
+ if (which.includes('.delimit/shims')) {
812
+ log(` ${green('✓')} Shim active: ${dim(which)}`);
813
+ } else {
814
+ log(` ${yellow('⚠')} Shim not in PATH yet — run: ${green('source ~/.bashrc')}`);
815
+ }
816
+ } catch {
817
+ log(` ${dim(' Run')} ${green('source ~/.bashrc')} ${dim('to activate the governance banner')}`);
808
818
  }
809
819
  } else {
810
820
  log(` ${dim(' Skipped. Enable later: delimit shims enable')}`);
@@ -1170,6 +1180,44 @@ exit 127
1170
1180
  log('');
1171
1181
  log(` ${bold('Keep Building.')}`);
1172
1182
  log('');
1183
+
1184
+ // Show governance banner preview
1185
+ const shimFile = path.join(DELIMIT_HOME, 'shims', 'claude');
1186
+ if (fs.existsSync(shimFile)) {
1187
+ log(dim(' --- Governance Banner Preview ---'));
1188
+ try {
1189
+ // Run the shim with DELIMIT_WRAPPED=true so it exits after banner
1190
+ // We simulate the banner directly instead
1191
+ const toolCount = (() => {
1192
+ try {
1193
+ const srv = fs.readFileSync(path.join(DELIMIT_HOME, 'server', 'ai', 'server.py'), 'utf-8');
1194
+ return (srv.match(/@mcp\.tool/g) || []).length + (srv.match(/mcp\.tool\(\)\(/g) || []).length;
1195
+ } catch { return 0; }
1196
+ })();
1197
+ const version = require('../package.json').version;
1198
+ const purple = '\x1b[35m', magenta = '\x1b[91m', orange = '\x1b[33m';
1199
+ const bold2 = '\x1b[1m', dim2 = '\x1b[2m', reset = '\x1b[0m', green2 = '\x1b[32m';
1200
+ console.log('');
1201
+ console.log(` ${purple}${bold2} ____ ________ ______ _____________${reset}`);
1202
+ console.log(` ${purple}${bold2} / __ \\/ ____/ / / _/ |/ / _/_ __/${reset}`);
1203
+ console.log(` ${magenta}${bold2} / / / / __/ / / / // /|_/ // / / / ${reset}`);
1204
+ console.log(` ${magenta}${bold2} / /_/ / /___/ /____/ // / / // / / / ${reset}`);
1205
+ console.log(` ${orange}${bold2}/_____/_____/_____/___/_/ /_/___/ /_/ ${reset}`);
1206
+ console.log(` ${dim2}v${version}${reset}`);
1207
+ console.log('');
1208
+ console.log(` ${purple}${bold2}[Delimit]${reset} ${dim2}Executing governance check...${reset}`);
1209
+ console.log(` ${purple}${bold2}[Delimit]${reset} ${orange}Mode: advisory${reset}`);
1210
+ console.log(` ${purple}${bold2}[Delimit]${reset} ${dim2}MCP server: ${toolCount} tools${reset}`);
1211
+ console.log(` ${magenta}${bold2}[Delimit]${reset} ${magenta}═══════════════════════════════════════════${reset}`);
1212
+ console.log(` ${magenta}${bold2}[Delimit]${reset} ${purple}<${magenta}/${orange}>${reset} ${bold2}GOVERNANCE ACTIVE: CLAUDE${reset}`);
1213
+ console.log(` ${magenta}${bold2}[Delimit]${reset} ${magenta}═══════════════════════════════════════════${reset}`);
1214
+ console.log(` ${green2}${bold2}[Delimit]${reset} ${green2}✓ Allowed${reset}`);
1215
+ console.log('');
1216
+ log(dim(' This banner appears before each AI session.'));
1217
+ log(dim(' If you don\'t see it, run: source ~/.bashrc'));
1218
+ } catch {}
1219
+ log('');
1220
+ }
1173
1221
  }
1174
1222
 
1175
1223
  // LED-213: Import canonical template from shared module