@semiont/cli 0.4.1 → 0.4.3
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 +108 -455
- package/dist/cli.mjs +1516 -551
- package/package.json +8 -10
package/README.md
CHANGED
|
@@ -4,546 +4,199 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@semiont/cli)
|
|
5
5
|
[](https://github.com/The-AI-Alliance/semiont/blob/main/LICENSE)
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The Semiont CLI provides four categories of commands:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Category | Commands | Auth model |
|
|
10
|
+
|----------|----------|------------|
|
|
11
|
+
| **Credential** | `login` | Writes a cached token |
|
|
12
|
+
| **Knowledge Work** | `browse`, `gather`, `mark`, `match`, `bind`, `listen`, `yield`, `beckon` | Reads the cached token (`--bus`) |
|
|
13
|
+
| **Knowledge Base** | `init`, `backup`, `restore`, `verify`, `export`, `import` | None / `--environment` |
|
|
14
|
+
| **Infrastructure** | `local`, `provision`, `start`, `stop`, `check`, `mv`, `useradd`, `clean`, `watch` | `--environment` |
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
### Core Concepts
|
|
14
|
-
|
|
15
|
-
1. **Environment** - The primary configuration context (dev, staging, production)
|
|
16
|
-
2. **Service** - Business entities managed by the CLI (backend, frontend, database)
|
|
17
|
-
3. **Service Type** - High-level service categories declared by services (frontend, backend, database, filesystem, worker, mcp, etc.)
|
|
18
|
-
4. **Command** - Operations you can perform (start, stop, check, deploy)
|
|
19
|
-
5. **Platform Type** - Infrastructure targets where services run (posix, container, aws, external, mock)
|
|
20
|
-
|
|
21
|
-
### Key Capabilities
|
|
22
|
-
|
|
23
|
-
- **Environment-Driven Configuration**: All operations require an environment context
|
|
24
|
-
- **Service Management**: start, stop, restart, check services based on environment
|
|
25
|
-
- **Infrastructure Operations**: provision, configure, backup across platforms
|
|
26
|
-
- **Development Workflows**: publish, update, test with platform awareness
|
|
27
|
-
- **Safety Features**: comprehensive `--dry-run` support for all operations
|
|
28
|
-
|
|
29
|
-
## Quick Links
|
|
30
|
-
|
|
31
|
-
- [**Architecture Overview**](./docs/ARCHITECTURE.md) - Understanding the CLI architecture and core concepts
|
|
32
|
-
- [**Managing Environments**](./docs/ADDING_ENVIRONMENTS.md) - Guide for configuring and managing environments
|
|
33
|
-
- [**Adding New Commands**](./docs/ADDING_COMMANDS.md) - Step-by-step guide for adding new CLI commands
|
|
34
|
-
- [**Adding New Platforms**](./docs/ADDING_PLATFORMS.md) - Guide for implementing new platform strategies
|
|
35
|
-
- [**Adding New Services**](./docs/ADDING_SERVICES.md) - Guide for adding new service implementations
|
|
36
|
-
- [**Adding New Service Types**](./docs/ADDING_SERVICE_TYPES.md) - Guide for adding new service type categories
|
|
16
|
+
---
|
|
37
17
|
|
|
38
18
|
## Installation
|
|
39
19
|
|
|
40
|
-
Install globally from npm:
|
|
41
|
-
|
|
42
20
|
```bash
|
|
43
|
-
# Latest stable release
|
|
44
21
|
npm install -g @semiont/cli
|
|
45
|
-
|
|
46
|
-
# Or latest development build
|
|
47
|
-
npm install -g @semiont/cli@dev
|
|
48
|
-
|
|
49
|
-
# After installation, the 'semiont' command is available globally
|
|
50
22
|
semiont --help
|
|
51
23
|
```
|
|
52
24
|
|
|
53
|
-
Or
|
|
25
|
+
Or from source:
|
|
54
26
|
|
|
55
27
|
```bash
|
|
56
|
-
|
|
57
|
-
cd apps/cli
|
|
58
|
-
npm run build # Build the CLI
|
|
59
|
-
npm link # Install globally
|
|
28
|
+
cd apps/cli && npm run build && npm link
|
|
60
29
|
```
|
|
61
30
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
All commands support these common options:
|
|
31
|
+
---
|
|
65
32
|
|
|
66
|
-
|
|
67
|
-
- **Service Selection**: `-s, --service <service>` - Target specific service(s) (default: "all")
|
|
68
|
-
- **Safety**: `--dry-run` - Preview changes without applying (comprehensive support)
|
|
69
|
-
- **Output**: `-v, --verbose` - Show detailed output and debug information
|
|
70
|
-
- **Help**: `-h, --help` - Show help for the command
|
|
71
|
-
|
|
72
|
-
### Environment Configuration (Required)
|
|
73
|
-
|
|
74
|
-
Every command requires an environment to be specified:
|
|
75
|
-
|
|
76
|
-
```bash
|
|
77
|
-
# Via command-line flag (highest priority)
|
|
78
|
-
semiont start backend --environment production
|
|
79
|
-
|
|
80
|
-
# Via environment variable
|
|
81
|
-
export SEMIONT_ENV=staging
|
|
82
|
-
semiont start backend
|
|
33
|
+
## Common Options
|
|
83
34
|
|
|
84
|
-
|
|
85
|
-
semiont start backend
|
|
86
|
-
# Error: Environment is required. Specify --environment flag or set SEMIONT_ENV
|
|
87
|
-
```
|
|
35
|
+
All commands support:
|
|
88
36
|
|
|
89
|
-
|
|
37
|
+
| Flag | Short | Description |
|
|
38
|
+
|------|-------|-------------|
|
|
39
|
+
| `--dry-run` | | Preview changes without applying |
|
|
40
|
+
| `--verbose` | `-v` | Show detailed output |
|
|
41
|
+
| `--quiet` | `-q` | Suppress progress output |
|
|
42
|
+
| `--output <format>` | `-o` | `summary` \| `table` \| `json` \| `yaml` |
|
|
90
43
|
|
|
91
|
-
|
|
44
|
+
---
|
|
92
45
|
|
|
93
|
-
|
|
94
|
-
2. **Detail Level**: Shows specific actions that would be taken for each service
|
|
46
|
+
## Quick Start
|
|
95
47
|
|
|
96
48
|
```bash
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
ℹ️ Starting services in production environment
|
|
100
|
-
ℹ️ [DRY RUN] Would start the following services:
|
|
101
|
-
- frontend (aws)
|
|
102
|
-
- backend (aws)
|
|
103
|
-
- database (aws)
|
|
104
|
-
- filesystem (aws)
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Service Selection
|
|
108
|
-
|
|
109
|
-
Flexible service targeting:
|
|
110
|
-
- `all` - All services in the environment (default)
|
|
111
|
-
- `frontend` - Frontend web application
|
|
112
|
-
- `backend` - Backend API service
|
|
113
|
-
- `database` - PostgreSQL database
|
|
114
|
-
- `graph` - Graph database (Neo4j/Neptune)
|
|
115
|
-
- `event-store` - Event Store (immutable event log)
|
|
116
|
-
- `projection` - Projection Store (materialized views)
|
|
117
|
-
- `filesystem` - File storage service
|
|
118
|
-
- `inference` - AI/ML inference service
|
|
119
|
-
- `mcp` - Model Context Protocol server
|
|
120
|
-
- Service combinations and patterns (future extension)
|
|
49
|
+
# 1. Log in (once — token cached for 24 hours)
|
|
50
|
+
semiont login --bus http://localhost:4000 --user alice@example.com
|
|
121
51
|
|
|
122
|
-
|
|
52
|
+
# 2. Browse the knowledge base
|
|
53
|
+
semiont browse resources
|
|
123
54
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- **Specify platform assignments** for each service (posix, container, aws)
|
|
127
|
-
- **Configure service settings** (ports, environment variables, resources)
|
|
128
|
-
- **No special environment names** - all environments are treated equally
|
|
129
|
-
- **Required for all operations** via `--environment` or `SEMIONT_ENV`
|
|
55
|
+
# 3. Gather LLM context for a resource
|
|
56
|
+
semiont gather resource <resourceId>
|
|
130
57
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
The CLI follows a unified architecture built on five core concepts:
|
|
134
|
-
|
|
135
|
-
```
|
|
136
|
-
Environment (configuration context)
|
|
137
|
-
↓ defines
|
|
138
|
-
Services (what exists)
|
|
139
|
-
↓ declare their
|
|
140
|
-
Service Type (what they are: frontend, backend, database, etc.)
|
|
141
|
-
↓ deployed to
|
|
142
|
-
Platform (where they run: aws, container, posix, etc.)
|
|
143
|
-
↓ operated via
|
|
144
|
-
Commands (what you can do)
|
|
58
|
+
# 4. Create an annotation
|
|
59
|
+
semiont mark <resourceId> --motivation highlighting --quote "key phrase"
|
|
145
60
|
```
|
|
146
61
|
|
|
147
|
-
|
|
62
|
+
---
|
|
148
63
|
|
|
149
|
-
|
|
64
|
+
## Command Categories
|
|
150
65
|
|
|
151
|
-
|
|
152
|
-
environments/ # Environment configurations (primary config)
|
|
153
|
-
├── dev.json # Development environment
|
|
154
|
-
├── staging.json # Staging environment
|
|
155
|
-
└── production.json # Production environment
|
|
156
|
-
|
|
157
|
-
src/
|
|
158
|
-
├── cli.ts # CLI entry point
|
|
159
|
-
├── core/ # Core execution engine
|
|
160
|
-
│ ├── multi-service-executor.ts # Multi-service command execution
|
|
161
|
-
│ ├── command-descriptor.ts # Command configuration
|
|
162
|
-
│ ├── command-result.ts # Unified result type
|
|
163
|
-
│ ├── platform.ts # Abstract Platform class
|
|
164
|
-
│ ├── service-interface.ts # Service contracts
|
|
165
|
-
│ ├── service-types.ts # Service type definitions
|
|
166
|
-
│ ├── service-cli-behaviors.ts # CLI behavior capabilities
|
|
167
|
-
│ ├── service-command-capabilities.ts # Command support declarations
|
|
168
|
-
│ └── handlers/ # Handler management
|
|
169
|
-
│ ├── registry.ts # Handler registration
|
|
170
|
-
│ └── types.ts # Handler types
|
|
171
|
-
├── commands/ # Command implementations
|
|
172
|
-
│ ├── start.ts # Start services
|
|
173
|
-
│ ├── stop.ts # Stop services
|
|
174
|
-
│ ├── check.ts # Health checks
|
|
175
|
-
│ └── ... # Other commands
|
|
176
|
-
├── services/ # Service implementations
|
|
177
|
-
│ ├── base-service.ts # Base service class
|
|
178
|
-
│ └── ... # Service implementations
|
|
179
|
-
├── platforms/ # Platform implementations
|
|
180
|
-
│ ├── posix/handlers/ # POSIX system handlers
|
|
181
|
-
│ ├── container/handlers/ # Docker/Podman handlers
|
|
182
|
-
│ ├── aws/handlers/ # AWS service handlers
|
|
183
|
-
│ └── ... # Other platforms
|
|
184
|
-
├── lib/ # Shared utilities
|
|
185
|
-
└── docs/ # Documentation
|
|
186
|
-
├── ARCHITECTURE.md # Architecture & concepts
|
|
187
|
-
├── ADDING_ENVIRONMENTS.md # Environment guide
|
|
188
|
-
├── ADDING_COMMANDS.md # Commands guide
|
|
189
|
-
├── ADDING_PLATFORMS.md # Platforms guide
|
|
190
|
-
├── ADDING_SERVICES.md # Services guide
|
|
191
|
-
└── ADDING_SERVICE_TYPES.md # Service types guide
|
|
192
|
-
```
|
|
66
|
+
### Credential — `login`
|
|
193
67
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
Environments are JSON files that define:
|
|
197
|
-
- Which services exist
|
|
198
|
-
- Platform assignments for each service
|
|
199
|
-
- Service-specific configuration
|
|
200
|
-
- Platform settings (AWS regions, Docker registries, etc.)
|
|
201
|
-
|
|
202
|
-
#### Example Environment File (environments/staging.json)
|
|
203
|
-
|
|
204
|
-
```json
|
|
205
|
-
{
|
|
206
|
-
"platform": {
|
|
207
|
-
"default": "container"
|
|
208
|
-
},
|
|
209
|
-
"services": {
|
|
210
|
-
"backend": {
|
|
211
|
-
"platform": "container",
|
|
212
|
-
"image": "myorg/backend:staging",
|
|
213
|
-
"port": 3000,
|
|
214
|
-
"env": {
|
|
215
|
-
"NODE_ENV": "staging"
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
"database": {
|
|
219
|
-
"platform": "aws",
|
|
220
|
-
"instanceClass": "db.t3.medium"
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
#### Environment Resolution
|
|
227
|
-
|
|
228
|
-
The CLI determines the environment using:
|
|
229
|
-
|
|
230
|
-
1. **Command-line flag** (`--environment`) - highest priority
|
|
231
|
-
2. **Environment variable** (`SEMIONT_ENV`) - fallback
|
|
232
|
-
3. **Error** - if neither is provided
|
|
68
|
+
Authenticates against a Semiont backend and caches a token. Run this once before using any API command.
|
|
233
69
|
|
|
234
70
|
```bash
|
|
235
|
-
|
|
236
|
-
semiont
|
|
237
|
-
|
|
238
|
-
# Via environment variable
|
|
239
|
-
export SEMIONT_ENV=staging
|
|
240
|
-
semiont start backend
|
|
241
|
-
|
|
242
|
-
# Error if neither
|
|
243
|
-
semiont start backend
|
|
244
|
-
# Error: Environment is required
|
|
71
|
+
semiont login --bus http://localhost:4000 --user alice@example.com
|
|
72
|
+
semiont login --bus https://api.acme.com # prompts for password interactively
|
|
73
|
+
semiont login --refresh --bus https://api.acme.com
|
|
245
74
|
```
|
|
246
75
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
Services declare their type and capabilities through annotations in their requirements:
|
|
250
|
-
|
|
251
|
-
### Service Types
|
|
252
|
-
Each service declares what it is (not where it runs):
|
|
253
|
-
- **frontend** - User-facing web applications
|
|
254
|
-
- **backend** - API servers and application logic
|
|
255
|
-
- **database** - Data persistence layers
|
|
256
|
-
- **filesystem** - File storage and management
|
|
257
|
-
- **worker** - Background job processors
|
|
258
|
-
- **mcp** - Model Context Protocol services
|
|
259
|
-
- **inference** - AI/ML model serving
|
|
260
|
-
- **generic** - General-purpose services
|
|
261
|
-
|
|
262
|
-
### Service Capabilities
|
|
263
|
-
Services can declare special behaviors and command support:
|
|
264
|
-
- **CLI behaviors** - Output suppression, process lifecycle, interactive mode
|
|
265
|
-
- **Command support** - Which commands the service supports (publish, update, backup, etc.)
|
|
266
|
-
|
|
267
|
-
## Platform Support
|
|
268
|
-
|
|
269
|
-
Platforms determine where services run, configured per environment:
|
|
270
|
-
|
|
271
|
-
- **POSIX** (`posix`): Services running as local OS processes
|
|
272
|
-
- **Container** (`container`): Services in Docker/Podman containers
|
|
273
|
-
- **AWS** (`aws`): Services on AWS infrastructure
|
|
274
|
-
- Maps service types to AWS services (frontend → S3+CloudFront, backend → ECS, database → RDS)
|
|
275
|
-
- **External** (`external`): Third-party or existing services
|
|
276
|
-
- **Mock** (`mock`): Simulated services for testing
|
|
277
|
-
|
|
278
|
-
Each service's platform is specified in the environment configuration file.
|
|
279
|
-
|
|
280
|
-
## Key Design Principles
|
|
281
|
-
|
|
282
|
-
1. **Environment-First Configuration** - All configuration flows from environment files
|
|
283
|
-
2. **Unified Execution Pattern** - All commands use MultiServiceExecutor for consistency
|
|
284
|
-
3. **Handler-Based Architecture** - Platform-specific logic in self-contained handlers
|
|
285
|
-
4. **Service Requirements Pattern** - Services declare needs, platforms provide resources
|
|
286
|
-
5. **Comprehensive Dry-Run Support** - All commands support `--dry-run` with detailed previews
|
|
287
|
-
6. **Type Safety** - Full TypeScript and Zod validation throughout
|
|
288
|
-
7. **No Special Environment Names** - All environments treated equally
|
|
289
|
-
8. **Extensible Architecture** - Easy to add new services, platforms, handlers, and commands
|
|
290
|
-
|
|
291
|
-
## Command Overview
|
|
76
|
+
Token is cached at `$XDG_STATE_HOME/semiont/auth/<bus-slug>.json` and is valid for 24 hours. Multiple backends can be logged into simultaneously.
|
|
292
77
|
|
|
293
|
-
|
|
78
|
+
See [Knowledge Work Commands](./docs/KNOWLEDGE-WORK.md) for the full credential resolution order.
|
|
294
79
|
|
|
295
|
-
|
|
80
|
+
---
|
|
296
81
|
|
|
297
|
-
###
|
|
82
|
+
### Knowledge Work Commands
|
|
298
83
|
|
|
299
|
-
|
|
300
|
-
- `start` - Start services
|
|
301
|
-
- `stop` - Stop services
|
|
302
|
-
- `restart` - Restart services
|
|
303
|
-
- `check` - Health check services
|
|
304
|
-
- `watch` - Monitor services with live dashboard
|
|
84
|
+
These commands call the Semiont backend. They require a cached token from `semiont login`.
|
|
305
85
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
- `backup` - Create service backups
|
|
310
|
-
- `restore` - Restore from backups
|
|
86
|
+
| Flag | Short | Description |
|
|
87
|
+
|------|-------|-------------|
|
|
88
|
+
| `--bus <url>` | `-b` | Backend URL. Fallback: `$SEMIONT_BUS` |
|
|
311
89
|
|
|
312
|
-
|
|
313
|
-
- `backup` - Create a lossless backup of the knowledge base
|
|
314
|
-
- `restore` - Restore a knowledge base from a backup archive
|
|
315
|
-
- `verify` - Verify a backup archive's integrity without restoring
|
|
90
|
+
For full details see [Knowledge Work Commands](./docs/KNOWLEDGE-WORK.md).
|
|
316
91
|
|
|
317
|
-
**
|
|
318
|
-
- `publish` - Build and publish artifacts (creates new versions, does not deploy)
|
|
319
|
-
- `update` - Deploy new versions to running services (deploys what publish created)
|
|
320
|
-
- `test` - Run test suites
|
|
321
|
-
- `exec` - Execute commands in service context
|
|
322
|
-
- `init` - Initialize new Semiont project
|
|
92
|
+
**browse** — inspect resources, annotations, references, events
|
|
323
93
|
|
|
324
|
-
Each command automatically detects the platform for each service and executes the appropriate implementation. See the documentation links above for detailed guides on extending the CLI.
|
|
325
|
-
|
|
326
|
-
### Publish and Update Workflow
|
|
327
|
-
|
|
328
|
-
The `publish` and `update` commands work together to deploy new versions:
|
|
329
|
-
|
|
330
|
-
**Publish** - Prepares artifacts for deployment:
|
|
331
|
-
- Builds applications and Docker images
|
|
332
|
-
- Pushes images to registries (ECR, Docker Hub, etc.)
|
|
333
|
-
- Creates new task definitions (for ECS) or deployment manifests
|
|
334
|
-
- Does NOT deploy to running services
|
|
335
|
-
- Respects `imageTagStrategy` configuration (mutable vs immutable tags)
|
|
336
|
-
|
|
337
|
-
**Update** - Deploys prepared artifacts:
|
|
338
|
-
- Checks for newer versions created by `publish`
|
|
339
|
-
- Updates running services to use new versions
|
|
340
|
-
- For mutable tags (`:latest`), can force redeployment to pull updated images
|
|
341
|
-
- Monitors deployment progress and reports success/failure
|
|
342
|
-
|
|
343
|
-
**Typical workflow:**
|
|
344
94
|
```bash
|
|
345
|
-
|
|
346
|
-
semiont
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
semiont update --service frontend --environment production
|
|
95
|
+
semiont browse resources
|
|
96
|
+
semiont browse resource <resourceId> --annotations
|
|
97
|
+
semiont browse annotation <resourceId> <annotationId>
|
|
98
|
+
semiont browse entity-types
|
|
350
99
|
```
|
|
351
100
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
### Knowledge Base Backup, Restore, and Verify
|
|
355
|
-
|
|
356
|
-
The `backup`, `restore`, and `verify` commands provide lossless whole-KB backup and restore:
|
|
357
|
-
|
|
358
|
-
- Streams a tar.gz archive containing `.semiont/manifest.jsonl`, per-resource event streams (`.semiont/events/*.jsonl`), and content blobs at the archive root (`{checksum}.{ext}`)
|
|
359
|
-
- Preserves full event history, hash chains, and all metadata
|
|
360
|
-
- On restore, events replay through the EventBus and Stower actor so materialized views and graph rebuild naturally
|
|
361
|
-
|
|
362
|
-
#### Backup
|
|
101
|
+
**gather** — fetch LLM-optimised context
|
|
363
102
|
|
|
364
103
|
```bash
|
|
365
|
-
semiont
|
|
104
|
+
semiont gather resource <resourceId>
|
|
105
|
+
semiont gather annotation <resourceId> <annotationId>
|
|
366
106
|
```
|
|
367
107
|
|
|
368
|
-
|
|
369
|
-
- `--out <path>`, `-o <path>` — Output file path (required)
|
|
370
|
-
|
|
371
|
-
#### Restore
|
|
108
|
+
**mark** — create W3C annotations (manual or AI-delegate)
|
|
372
109
|
|
|
373
110
|
```bash
|
|
374
|
-
semiont
|
|
111
|
+
semiont mark <resourceId> --motivation highlighting --quote "key phrase"
|
|
112
|
+
semiont mark <resourceId> --motivation linking --delegate --entity-type Person
|
|
375
113
|
```
|
|
376
114
|
|
|
377
|
-
|
|
378
|
-
- `--file <path>`, `-f <path>` — Input file path (required)
|
|
379
|
-
|
|
380
|
-
Restore bootstraps a full EventBus + Stower pipeline so events flow through the normal actor system. Materialized views and graph rebuild naturally from the replayed events.
|
|
381
|
-
|
|
382
|
-
#### Verify
|
|
115
|
+
**match / bind** — find and resolve linking annotations
|
|
383
116
|
|
|
384
117
|
```bash
|
|
385
|
-
|
|
386
|
-
semiont
|
|
118
|
+
semiont match <resourceId> <annotationId>
|
|
119
|
+
semiont bind <resourceId> <annotationId> <targetResourceId>
|
|
387
120
|
```
|
|
388
121
|
|
|
389
|
-
|
|
390
|
-
- `--file <path>`, `-f <path>` — Backup file to verify (required)
|
|
391
|
-
|
|
392
|
-
Verify checks:
|
|
393
|
-
- Manifest format and version
|
|
394
|
-
- Hash chain integrity per event stream
|
|
395
|
-
- First/last checksum match against stream summaries
|
|
396
|
-
- Event count match per stream
|
|
397
|
-
- Content blob count match
|
|
398
|
-
|
|
399
|
-
Does not require an environment — reads the archive standalone.
|
|
400
|
-
|
|
401
|
-
## MCP (Model Context Protocol) Server
|
|
402
|
-
|
|
403
|
-
The Semiont CLI includes built-in support for MCP, allowing AI assistants to interact with Semiont APIs.
|
|
404
|
-
|
|
405
|
-
### MCP Setup
|
|
406
|
-
|
|
407
|
-
MCP requires one-time OAuth provisioning per environment:
|
|
122
|
+
**listen** — stream domain events as NDJSON
|
|
408
123
|
|
|
409
124
|
```bash
|
|
410
|
-
|
|
411
|
-
semiont
|
|
412
|
-
|
|
413
|
-
# This will:
|
|
414
|
-
# 1. Open your browser for OAuth authentication
|
|
415
|
-
# 2. Store refresh token in ~/.config/semiont/mcp-auth-production.json
|
|
416
|
-
# 3. Display AI application configuration
|
|
125
|
+
semiont listen
|
|
126
|
+
semiont listen resource <resourceId>
|
|
417
127
|
```
|
|
418
128
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
After provisioning, the MCP server can be started:
|
|
129
|
+
**yield** — upload or AI-generate a resource
|
|
422
130
|
|
|
423
131
|
```bash
|
|
424
|
-
|
|
425
|
-
semiont
|
|
426
|
-
|
|
427
|
-
# Or with environment variable
|
|
428
|
-
SEMIONT_ENV=production semiont start --service mcp
|
|
132
|
+
semiont yield --upload ./paper.pdf
|
|
133
|
+
semiont yield --delegate --resource <resourceId> --annotation <annotationId> --storage-uri file://out.md
|
|
429
134
|
```
|
|
430
135
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
After provisioning, add this configuration to your AI application:
|
|
434
|
-
|
|
435
|
-
```json
|
|
436
|
-
{
|
|
437
|
-
"semiont": {
|
|
438
|
-
"command": "semiont",
|
|
439
|
-
"args": ["start", "--service", "mcp"],
|
|
440
|
-
"env": {
|
|
441
|
-
"SEMIONT_ROOT": "/path/to/semiont",
|
|
442
|
-
"SEMIONT_ENV": "production"
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
```
|
|
447
|
-
|
|
448
|
-
### Available MCP Tools
|
|
449
|
-
|
|
450
|
-
The MCP server currently provides:
|
|
451
|
-
- `semiont_hello` - Get a personalized greeting from Semiont API
|
|
452
|
-
|
|
453
|
-
Future capabilities will include graph retrieval for GraphRAG-like systems.
|
|
454
|
-
|
|
455
|
-
### Authentication Flow
|
|
456
|
-
|
|
457
|
-
1. **Initial Setup**: Browser-based OAuth during `provision` command
|
|
458
|
-
2. **Refresh Tokens**: Stored locally, valid for 30 days
|
|
459
|
-
3. **Access Tokens**: Automatically refreshed on startup, valid for 1 hour
|
|
460
|
-
4. **Unattended Operation**: No user interaction required after initial setup
|
|
461
|
-
|
|
462
|
-
### Troubleshooting MCP
|
|
463
|
-
|
|
464
|
-
- **Authentication Failed**: Re-run `semiont provision --service mcp --environment <env>`
|
|
465
|
-
- **Token Expired**: Refresh tokens expire after 30 days, re-provision if needed
|
|
466
|
-
- **Server Won't Start**: Check that the environment was provisioned first
|
|
467
|
-
|
|
468
|
-
## Development
|
|
469
|
-
|
|
470
|
-
### Building
|
|
136
|
+
**beckon** — direct a participant's attention
|
|
471
137
|
|
|
472
138
|
```bash
|
|
473
|
-
|
|
474
|
-
npm run watch # Watch mode for development
|
|
475
|
-
npm test # Run tests
|
|
139
|
+
semiont beckon <resourceId>
|
|
476
140
|
```
|
|
477
141
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
The CLI has comprehensive test coverage:
|
|
142
|
+
---
|
|
481
143
|
|
|
482
|
-
|
|
483
|
-
npm test # Run all tests
|
|
484
|
-
npm run test:unit # Unit tests only
|
|
485
|
-
npm run test:integration # Integration tests
|
|
486
|
-
npm run test:coverage # Generate coverage report
|
|
487
|
-
```
|
|
144
|
+
### Knowledge Base Commands
|
|
488
145
|
|
|
489
|
-
|
|
146
|
+
These commands manage the knowledge base itself. `init` needs no flags; the others take `--environment`.
|
|
490
147
|
|
|
491
|
-
|
|
148
|
+
For full details see [Knowledge Base Commands](./docs/KNOWLEDGE-BASE.md).
|
|
492
149
|
|
|
493
150
|
```bash
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
151
|
+
semiont init
|
|
152
|
+
semiont backup -e production --out backup.tar.gz
|
|
153
|
+
semiont restore -e production --file backup.tar.gz
|
|
154
|
+
semiont verify --file backup.tar.gz
|
|
155
|
+
semiont export -e local --out export.json
|
|
156
|
+
semiont import -e local --file export.json
|
|
497
157
|
```
|
|
498
158
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
### Common Issues
|
|
502
|
-
|
|
503
|
-
**Service won't start**
|
|
504
|
-
- Check if port is already in use: `lsof -i :PORT`
|
|
505
|
-
- Verify environment configuration exists
|
|
506
|
-
- Check service logs with `semiont watch`
|
|
159
|
+
---
|
|
507
160
|
|
|
508
|
-
|
|
509
|
-
- Ensure AWS credentials are configured: `aws configure`
|
|
510
|
-
- Check AWS region matches environment config
|
|
511
|
-
- Verify IAM permissions for ECS/RDS operations
|
|
161
|
+
### Infrastructure Commands
|
|
512
162
|
|
|
513
|
-
|
|
514
|
-
- Verify Docker/Podman is installed and running
|
|
515
|
-
- Check container runtime detection: `docker version` or `podman version`
|
|
516
|
-
- Ensure user has permissions for container operations
|
|
163
|
+
These commands manage service lifecycle and deployment. They require `--environment` (or a default set in `~/.semiontconfig`).
|
|
517
164
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
- Verify environment was provisioned before starting
|
|
165
|
+
| Flag | Short | Description |
|
|
166
|
+
|------|-------|-------------|
|
|
167
|
+
| `--environment <env>` | `-e` | Target environment. Fallback: `$SEMIONT_ENV` → `defaults.environment` in `~/.semiontconfig` |
|
|
522
168
|
|
|
523
|
-
|
|
169
|
+
For full details see [Infrastructure Commands](./docs/INFRASTRUCTURE.md).
|
|
524
170
|
|
|
525
|
-
|
|
171
|
+
```bash
|
|
172
|
+
# Service lifecycle
|
|
173
|
+
semiont provision -e local
|
|
174
|
+
semiont start -e local
|
|
175
|
+
semiont check -e local
|
|
176
|
+
semiont stop -e local
|
|
177
|
+
semiont watch -e local
|
|
526
178
|
|
|
527
|
-
|
|
528
|
-
-
|
|
529
|
-
-
|
|
530
|
-
|
|
179
|
+
# Administration
|
|
180
|
+
semiont useradd -e local --email user@example.com
|
|
181
|
+
semiont clean -e local
|
|
182
|
+
```
|
|
531
183
|
|
|
532
|
-
|
|
184
|
+
---
|
|
533
185
|
|
|
534
|
-
|
|
535
|
-
2. **Commands**: See [Adding Commands Guide](./docs/ADDING_COMMANDS.md)
|
|
536
|
-
3. **Services**: See [Adding Services Guide](./docs/ADDING_SERVICES.md)
|
|
537
|
-
4. **Platforms**: See [Adding Platforms Guide](./docs/ADDING_PLATFORMS.md)
|
|
186
|
+
## Further Reading
|
|
538
187
|
|
|
539
|
-
|
|
188
|
+
- [Knowledge Work Commands](./docs/KNOWLEDGE-WORK.md) — login, browse, gather, mark, match, bind, listen, yield, beckon
|
|
189
|
+
- [Knowledge Base Commands](./docs/KNOWLEDGE-BASE.md) — init, backup, restore, verify, export, import
|
|
190
|
+
- [Infrastructure Commands](./docs/INFRASTRUCTURE.md) — service lifecycle, deployment, administration
|
|
191
|
+
- [Architecture Overview](./docs/ARCHITECTURE.md)
|
|
192
|
+
- [Managing Environments](./docs/ADDING_ENVIRONMENTS.md)
|
|
193
|
+
- [Adding Commands](./docs/ADDING_COMMANDS.md)
|
|
194
|
+
- [Adding Platforms](./docs/ADDING_PLATFORMS.md)
|
|
195
|
+
- [Adding Services](./docs/ADDING_SERVICES.md)
|
|
196
|
+
- [Adding Service Types](./docs/ADDING_SERVICE_TYPES.md)
|
|
540
197
|
|
|
541
|
-
|
|
542
|
-
2. Create a feature branch
|
|
543
|
-
3. Make your changes with tests
|
|
544
|
-
4. Update documentation
|
|
545
|
-
5. Submit a pull request
|
|
198
|
+
---
|
|
546
199
|
|
|
547
200
|
## License
|
|
548
201
|
|
|
549
|
-
|
|
202
|
+
Apache License 2.0 — see the LICENSE file for details.
|