trellis 2.1.9 → 3.0.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 +65 -796
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2948 -182
- package/dist/client/index.js +4 -4
- package/dist/context/heat-map-manager.d.ts +100 -0
- package/dist/context/heat-map-manager.d.ts.map +1 -0
- package/dist/context/manager.d.ts +16 -0
- package/dist/context/manager.d.ts.map +1 -0
- package/dist/context/types.d.ts +20 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/core/agents/harness.d.ts +10 -1
- package/dist/core/agents/harness.d.ts.map +1 -1
- package/dist/core/agents/types.d.ts +18 -2
- package/dist/core/agents/types.d.ts.map +1 -1
- package/dist/core/computation/expr-evaluator.d.ts +52 -0
- package/dist/core/computation/expr-evaluator.d.ts.map +1 -0
- package/dist/core/index.js +93 -5
- package/dist/core/kernel/logic-middleware.d.ts +19 -0
- package/dist/core/kernel/logic-middleware.d.ts.map +1 -0
- package/dist/core/kernel/schema-middleware.d.ts +15 -0
- package/dist/core/kernel/schema-middleware.d.ts.map +1 -0
- package/dist/core/kernel/security-middleware.d.ts +24 -0
- package/dist/core/kernel/security-middleware.d.ts.map +1 -0
- package/dist/core/kernel/sync-provider.d.ts +59 -0
- package/dist/core/kernel/sync-provider.d.ts.map +1 -0
- package/dist/core/kernel/trellis-kernel.d.ts +55 -0
- package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
- package/dist/core/ontology/builtins.d.ts.map +1 -1
- package/dist/core/ontology/core-ontology.d.ts +20 -0
- package/dist/core/ontology/core-ontology.d.ts.map +1 -0
- package/dist/core/ontology/index.d.ts +3 -1
- package/dist/core/ontology/index.d.ts.map +1 -1
- package/dist/core/ontology/types.d.ts +138 -34
- package/dist/core/ontology/types.d.ts.map +1 -1
- package/dist/core/persist/backend.d.ts +2 -0
- package/dist/core/persist/backend.d.ts.map +1 -1
- package/dist/core/persist/better-sqlite-backend.d.ts +33 -0
- package/dist/core/persist/better-sqlite-backend.d.ts.map +1 -0
- package/dist/core/persist/sqlite-backend.d.ts +2 -0
- package/dist/core/persist/sqlite-backend.d.ts.map +1 -1
- package/dist/core/store/eav-store.d.ts +4 -0
- package/dist/core/store/eav-store.d.ts.map +1 -1
- package/dist/db/index.js +10 -8
- package/dist/{deploy-99j5dc9c.js → deploy-999q207z.js} +2 -1
- package/dist/engine.d.ts +3 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/evals/types.d.ts +29 -0
- package/dist/evals/types.d.ts.map +1 -0
- package/dist/{import-fyg5sgq4.js → import-s2b8e0ft.js} +2 -2
- package/dist/{index-3ejh8k6v.js → index-0q7wbasy.js} +18 -4
- package/dist/{index-7t92ej34.js → index-0zk3fx2s.js} +467 -7
- package/dist/{index-xr7rx360.js → index-6n5dcebj.js} +33 -0
- package/dist/{index-4beszbgg.js → index-7e27kvvj.js} +1 -1
- package/dist/index-bmyt7k8n.js +90 -0
- package/dist/{index-k5kf7sd0.js → index-hmdbnd4n.js} +1 -1
- package/dist/{index-czecrvvn.js → index-q31hfjja.js} +858 -48
- package/dist/{index-8fjwnztt.js → index-skhn0agf.js} +1 -1
- package/dist/{index-04sq3h27.js → index-w7ng765c.js} +3 -1
- package/dist/{index-hgd30epa.js → index-wt8rz4gn.js} +4 -21
- package/dist/{index-5p6zgspx.js → index-y3d71wzd.js} +1 -1
- package/dist/index-y6a4kj0p.js +43 -0
- package/dist/{index-5bhe57y9.js → index-yhwjgfvj.js} +16 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -6
- package/dist/llm/provider.d.ts +11 -0
- package/dist/llm/provider.d.ts.map +1 -0
- package/dist/llm/types.d.ts +74 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +7 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/orchestration/types.d.ts +22 -0
- package/dist/orchestration/types.d.ts.map +1 -0
- package/dist/plugins/agent-memory/graph-context-manager.d.ts +75 -0
- package/dist/plugins/agent-memory/graph-context-manager.d.ts.map +1 -0
- package/dist/plugins/agent-memory/index.d.ts +30 -0
- package/dist/plugins/agent-memory/index.d.ts.map +1 -0
- package/dist/plugins/agent-memory/ontology.d.ts +13 -0
- package/dist/plugins/agent-memory/ontology.d.ts.map +1 -0
- package/dist/plugins/agent-memory/plugin.d.ts +17 -0
- package/dist/plugins/agent-memory/plugin.d.ts.map +1 -0
- package/dist/plugins/brand/cache.d.ts +18 -0
- package/dist/plugins/brand/cache.d.ts.map +1 -0
- package/dist/plugins/brand/catalog-generator.d.ts +89 -0
- package/dist/plugins/brand/catalog-generator.d.ts.map +1 -0
- package/dist/plugins/brand/constraints.d.ts +55 -0
- package/dist/plugins/brand/constraints.d.ts.map +1 -0
- package/dist/plugins/brand/index.d.ts +44 -0
- package/dist/plugins/brand/index.d.ts.map +1 -0
- package/dist/plugins/brand/mcp-tools.d.ts +101 -0
- package/dist/plugins/brand/mcp-tools.d.ts.map +1 -0
- package/dist/plugins/brand/ontology.d.ts +13 -0
- package/dist/plugins/brand/ontology.d.ts.map +1 -0
- package/dist/plugins/brand/plugin.d.ts +21 -0
- package/dist/plugins/brand/plugin.d.ts.map +1 -0
- package/dist/plugins/brand/voice-tone.d.ts +24 -0
- package/dist/plugins/brand/voice-tone.d.ts.map +1 -0
- package/dist/plugins/idea-garden/api.d.ts +26 -0
- package/dist/plugins/idea-garden/api.d.ts.map +1 -0
- package/dist/plugins/idea-garden/index.d.ts +12 -0
- package/dist/plugins/idea-garden/index.d.ts.map +1 -0
- package/dist/plugins/idea-garden/plugin.d.ts +16 -0
- package/dist/plugins/idea-garden/plugin.d.ts.map +1 -0
- package/dist/plugins/idea-garden/types.d.ts +22 -0
- package/dist/plugins/idea-garden/types.d.ts.map +1 -0
- package/dist/plugins/plan-approval/index.d.ts +36 -0
- package/dist/plugins/plan-approval/index.d.ts.map +1 -0
- package/dist/plugins/plan-approval/ontology.d.ts +11 -0
- package/dist/plugins/plan-approval/ontology.d.ts.map +1 -0
- package/dist/plugins/plan-approval/plan-manager.d.ts +104 -0
- package/dist/plugins/plan-approval/plan-manager.d.ts.map +1 -0
- package/dist/plugins/plan-approval/plugin.d.ts +110 -0
- package/dist/plugins/plan-approval/plugin.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/index.d.ts +28 -0
- package/dist/plugins/proactive-watcher/index.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/ontology.d.ts +8 -0
- package/dist/plugins/proactive-watcher/ontology.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/plugin.d.ts +20 -0
- package/dist/plugins/proactive-watcher/plugin.d.ts.map +1 -0
- package/dist/plugins/proactive-watcher/watcher-manager.d.ts +36 -0
- package/dist/plugins/proactive-watcher/watcher-manager.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/checkpoint-middleware.d.ts +43 -0
- package/dist/plugins/sprite-tools/checkpoint-middleware.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/index.d.ts +40 -0
- package/dist/plugins/sprite-tools/index.d.ts.map +1 -0
- package/dist/plugins/sprite-tools/plugin.d.ts +69 -0
- package/dist/plugins/sprite-tools/plugin.d.ts.map +1 -0
- package/dist/react/index.js +4 -4
- package/dist/scaffold/index.d.ts +13 -0
- package/dist/scaffold/index.d.ts.map +1 -0
- package/dist/scaffold/infer.d.ts +42 -0
- package/dist/scaffold/infer.d.ts.map +1 -0
- package/dist/scaffold/profile.d.ts +51 -0
- package/dist/scaffold/profile.d.ts.map +1 -0
- package/dist/scaffold/seed.d.ts +27 -0
- package/dist/scaffold/seed.d.ts.map +1 -0
- package/dist/scaffold/write.d.ts +53 -0
- package/dist/scaffold/write.d.ts.map +1 -0
- package/dist/{sdk-sj8rp0m7.js → sdk-snn5gad3.js} +4 -4
- package/dist/server/deploy.d.ts.map +1 -1
- package/dist/server/index.d.ts +5 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +37 -7
- package/dist/server/sprites.d.ts +26 -0
- package/dist/server/sprites.d.ts.map +1 -0
- package/dist/server/vm-config.d.ts +60 -0
- package/dist/server/vm-config.d.ts.map +1 -0
- package/dist/{server-3vkpnpbz.js → server-mrctdwzr.js} +2 -2
- package/dist/sprites-vc4qbrp1.js +16 -0
- package/dist/streaming/types.d.ts +43 -0
- package/dist/streaming/types.d.ts.map +1 -0
- package/dist/{tenancy-tjr7kk2v.js → tenancy-7d1g4ayp.js} +3 -3
- package/dist/ui/client.html +460 -664
- package/dist/ui/server.d.ts +6 -2
- package/dist/ui/server.d.ts.map +1 -1
- package/dist/vcs/decompose.d.ts.map +1 -1
- package/dist/vcs/index.js +2 -2
- package/dist/vcs/issue.d.ts.map +1 -1
- package/dist/vcs/types.d.ts +1 -0
- package/dist/vcs/types.d.ts.map +1 -1
- package/dist/vm-config-6xhsj6b3.js +22 -0
- package/package.json +14 -4
- /package/dist/{index-kbnht9p8.js → index-c9h37r6h.js} +0 -0
package/README.md
CHANGED
|
@@ -1,854 +1,123 @@
|
|
|
1
1
|
# Trellis
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
https://trellis.computer
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
| **
|
|
10
|
-
| **
|
|
5
|
+
> **The Agentic Framework** — A structured runtime for building agents that understand code, remember everything, and explain themselves.
|
|
6
|
+
|
|
7
|
+
| Use Case | How |
|
|
8
|
+
| :----------------------------- | :-------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| **Agentic State Engine** | Tool registry + decision traces + branching — agents operate on state they can fork, audit, and roll back |
|
|
10
|
+
| **Building Agents End-to-End** | Unified LLM abstraction + context management + RAG + orchestration |
|
|
11
|
+
| **Autonomous Code Editing** | Semantic patching + AST-aware tools + causal history |
|
|
12
|
+
| **Auditable Reasoning** | Immutable op log + decision traces + precedent search |
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## Why Trellis?
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
- [Platform Overview](#platform-overview)
|
|
18
|
-
- [Core Capabilities](#core-capabilities)
|
|
19
|
-
- [Project Surfaces](#project-surfaces)
|
|
20
|
-
- [Package Architecture](#package-architecture)
|
|
21
|
-
- [CLI Overview](#cli-overview)
|
|
22
|
-
- [VS Code Extension](#vs-code-extension)
|
|
23
|
-
- [Module & Subpath Guide](#module--subpath-guide)
|
|
24
|
-
- [Development & Releases](#development--releases)
|
|
25
|
-
- [Roadmap](#roadmap)
|
|
18
|
+
Most agent frameworks focus on the _reasoning engine_ (the LLM) but treat _state_ as an afterthought. Trellis reverses this. It is the **System of Record for Decisions**, providing agents with a persistent, queryable, and auditable memory that compounds over time.
|
|
26
19
|
|
|
27
|
-
|
|
20
|
+
**[Read the story →](./THE-STORY.md)**
|
|
28
21
|
|
|
29
|
-
|
|
22
|
+
- **Durable Memory**: Every thought, tool call, and file change is an immutable operation in a causal graph
|
|
23
|
+
- **Explainability by Default**: Decision traces don't just store _what_ happened, but _why_
|
|
24
|
+
- **Safe Exploration**: Agents can "fork" state to explore multiple paths
|
|
30
25
|
|
|
31
|
-
|
|
26
|
+
---
|
|
32
27
|
|
|
33
|
-
|
|
28
|
+
## Quick Start
|
|
34
29
|
|
|
35
30
|
```bash
|
|
31
|
+
# 1. Install
|
|
36
32
|
npm install -g trellis
|
|
37
|
-
trellis -h
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Or use npx:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
npx trellis -h
|
|
44
|
-
```
|
|
45
33
|
|
|
46
|
-
|
|
34
|
+
# 2. Initialize a repository
|
|
35
|
+
mkdir my-project && cd my-project
|
|
36
|
+
trellis init
|
|
47
37
|
|
|
48
|
-
|
|
49
|
-
#
|
|
50
|
-
npx trellis init
|
|
51
|
-
npx trellis watch
|
|
52
|
-
|
|
53
|
-
# Or programmatically
|
|
54
|
-
import { TrellisVcsEngine } from 'trellis';
|
|
55
|
-
const engine = new TrellisVcsEngine({ rootPath: '/my/project' });
|
|
56
|
-
await engine.initRepo();
|
|
57
|
-
```
|
|
38
|
+
# 3. Create content (tracked automatically)
|
|
39
|
+
echo "# My Project" > README.md
|
|
58
40
|
|
|
59
|
-
|
|
41
|
+
# 4. Add structured entities
|
|
42
|
+
trellis issue create --title "Bootstrap Visualization"
|
|
43
|
+
trellis milestone "Initial Release"
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
|
|
45
|
+
# 5. Create coding session with trellis harness
|
|
46
|
+
trellis code
|
|
63
47
|
```
|
|
64
48
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Platform Overview
|
|
68
|
-
|
|
69
|
-
Trellis is an event-sourced causal graph engine that unifies version control, knowledge management, semantic analysis, and intelligent automation. Every action — code changes, agent decisions, wiki-links, embeddings — is an immutable operation in a causal stream, giving you time-travel, branching, and full auditability out of the box.
|
|
70
|
-
|
|
71
|
-
The platform consists of multiple integrated surfaces:
|
|
72
|
-
|
|
73
|
-
- **`trellis` npm package** — the published package exposing all platform APIs through modular subpaths
|
|
74
|
-
- **`trellis` CLI** — command-line interface for repository management, semantic tooling, knowledge operations, and automation
|
|
75
|
-
- **VS Code extension** — visual interface for timeline exploration, issue management, knowledge navigation, and collaborative features
|
|
76
|
-
- **Core platform modules** — reusable building blocks for graph storage, semantic analysis, sync, knowledge graphs, embeddings, and decision traces
|
|
77
|
-
|
|
78
|
-
### Core Capabilities
|
|
79
|
-
|
|
80
|
-
#### 1. **Graph-Native Foundation**
|
|
81
|
-
|
|
82
|
-
- **EAV Store** — Entity-Attribute-Value graph database with SQLite backend
|
|
83
|
-
- **TrellisKernel** — Generic graph CRUD operations independent of VCS
|
|
84
|
-
- **Query Engine** — EQL-S query language and Datalog evaluator
|
|
85
|
-
- **Ontology System** — Schema validation and built-in ontologies
|
|
86
|
-
|
|
87
|
-
#### 2. **Advanced Version Control**
|
|
88
|
-
|
|
89
|
-
- **Causal Stream** — Immutable, content-addressed operations with causal chaining
|
|
90
|
-
- **Semantic Patching** — AST-aware changes enabling conflict-free merges
|
|
91
|
-
- **Narrative Milestones** — Human-readable checkpoints over continuous work streams
|
|
92
|
-
- **Governance** — Op signing, identity management, and policy enforcement
|
|
93
|
-
|
|
94
|
-
#### 3. **Knowledge & Intelligence**
|
|
95
|
-
|
|
96
|
-
- **Wiki-Links** — Bidirectional reference system for cross-linking entities
|
|
97
|
-
- **Embeddings** — Semantic indexing and vector search for intelligent discovery
|
|
98
|
-
- **Decision Traces** — Automated capture and querying of agent decisions
|
|
99
|
-
- **Idea Garden** — Detection and revival of abandoned work clusters
|
|
100
|
-
|
|
101
|
-
#### 4. **Collaboration & Sync**
|
|
102
|
-
|
|
103
|
-
- **Peer Sync** — CRDT-based reconciliation with HTTP/WebSocket transports
|
|
104
|
-
- **Multi-Repo Federation** — Cross-repository entity references and linking
|
|
105
|
-
- **Agent System** — Tool registry and decision trace capture
|
|
106
|
-
- **Plugin Architecture** — Extensible system with event bus and workspace config
|
|
107
|
-
|
|
108
|
-
## Project Surfaces
|
|
109
|
-
|
|
110
|
-
| Surface | Location | Purpose |
|
|
111
|
-
| :-------------------- | :------------------------------------------------------------ | :----------------------------------------------------------------------- |
|
|
112
|
-
| **npm package** | `package.json`, `src/`, `dist/` | Published as `trellis`; exposes all platform APIs via subpaths |
|
|
113
|
-
| **CLI** | `src/cli/index.ts` | Repository lifecycle, semantic tooling, knowledge operations, automation |
|
|
114
|
-
| **VS Code extension** | `vscode-extension/` | Timeline, knowledge navigation, issue management, collaborative UX |
|
|
115
|
-
| **Core platform** | `src/core/` | EAV store, kernel, ontology, query, agents, plugins |
|
|
116
|
-
| **Platform modules** | `src/vcs/`, `src/links/`, `src/embeddings/`, `src/decisions/` | Specialized subsystems for version control, knowledge, and intelligence |
|
|
49
|
+
See the [CLI guide](https://trellis.computer/docs/cli) for complete documentation.
|
|
117
50
|
|
|
118
51
|
---
|
|
119
52
|
|
|
120
|
-
##
|
|
53
|
+
## What is Trellis?
|
|
121
54
|
|
|
122
|
-
|
|
123
|
-
trellis/
|
|
124
|
-
├── src/
|
|
125
|
-
│ ├── core/ # EAV store, kernel, ontology, query, agents, plugins
|
|
126
|
-
│ │ ├── kernel/ # TrellisKernel with entity CRUD and middleware
|
|
127
|
-
│ │ ├── ontology/ # Schema registry, validation, built-in ontologies
|
|
128
|
-
│ │ ├── query/ # EQL-S query engine and Datalog evaluator
|
|
129
|
-
│ │ ├── agents/ # Agent harness, tool registry, decision traces
|
|
130
|
-
│ │ └── plugins/ # Plugin registry, event bus, workspace config
|
|
131
|
-
│ ├── server/ # HTTP+WS server, auth, permissions, tenancy, deploy
|
|
132
|
-
│ │ └── inspector/ # Visual DB inspector (web component)
|
|
133
|
-
│ ├── client/ # Isomorphic SDK (local + remote), config
|
|
134
|
-
│ ├── react/ # React hooks: useTrellis, useEntity, useQuery, useMutation
|
|
135
|
-
│ ├── vcs/ # Version control: ops, branches, milestones, diff, merge
|
|
136
|
-
│ ├── links/ # Wiki-link parsing, resolution, backlink index
|
|
137
|
-
│ ├── embeddings/ # Semantic indexing, vector search, auto-embed, RAG
|
|
138
|
-
│ ├── decisions/ # Decision trace capture and querying
|
|
139
|
-
│ ├── semantic/ # AST parsers, semantic diff, semantic merge
|
|
140
|
-
│ ├── sync/ # Peer sync, CRDT reconciler, HTTP/WebSocket transports, multi-repo
|
|
141
|
-
│ ├── garden/ # Idea Garden: abandoned work detection and revival
|
|
142
|
-
│ ├── git/ # Git import/export bridge
|
|
143
|
-
│ ├── identity/ # Ed25519 identity management and governance
|
|
144
|
-
│ ├── watcher/ # File watching + ingestion pipeline
|
|
145
|
-
│ ├── mcp/ # Model Context Protocol server integration
|
|
146
|
-
│ ├── cli/ # CLI entrypoint
|
|
147
|
-
│ ├── db/ # ⚠️ Deprecated shim — re-exports from server + client
|
|
148
|
-
│ ├── engine.ts # Composition root
|
|
149
|
-
│ └── index.ts # Main package entrypoint
|
|
150
|
-
├── vscode-extension/ # VS Code extension surface
|
|
151
|
-
├── test/ # Comprehensive test suites
|
|
152
|
-
├── DESIGN.md # Detailed architecture specification
|
|
153
|
-
└── justfile # Local build and development recipes
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### The Op Stream
|
|
157
|
-
|
|
158
|
-
Every action in Trellis is an immutable `VcsOp`:
|
|
55
|
+
Trellis is an **event-sourced causal graph engine** that unifies version control, knowledge management, and semantic analysis. Every action is an immutable operation in a causal stream:
|
|
159
56
|
|
|
160
57
|
```typescript
|
|
161
58
|
interface VcsOp {
|
|
162
|
-
hash: string; //
|
|
59
|
+
hash: string; // content-addressed
|
|
163
60
|
kind: VcsOpKind; // e.g. 'vcs:fileModify'
|
|
164
61
|
timestamp: string; // ISO 8601
|
|
165
|
-
agentId: string; // Author identity
|
|
62
|
+
agentId: string; // Author identity
|
|
166
63
|
previousHash?: string; // Causal chain link
|
|
167
|
-
vcs: VcsPayload; // Op-specific data
|
|
168
|
-
signature?: string; // Ed25519 signature
|
|
64
|
+
vcs: VcsPayload; // Op-specific data
|
|
65
|
+
signature?: string; // Ed25519 signature
|
|
169
66
|
}
|
|
170
67
|
```
|
|
171
68
|
|
|
172
|
-
Ops are written to `.trellis/ops.json` and
|
|
69
|
+
Ops are written to `.trellis/ops.json` and **never rewritten or deleted**.
|
|
173
70
|
|
|
174
|
-
###
|
|
71
|
+
### Platform Surfaces
|
|
175
72
|
|
|
176
|
-
|
|
|
177
|
-
|
|
|
178
|
-
|
|
|
179
|
-
|
|
|
180
|
-
|
|
|
73
|
+
| Surface | Purpose |
|
|
74
|
+
| :-------------------- | :--------------------------------------- |
|
|
75
|
+
| `trellis` npm package | Core platform APIs via subpaths |
|
|
76
|
+
| `trellis` CLI | Repository management and automation |
|
|
77
|
+
| VS Code extension | Visual timeline and knowledge navigation |
|
|
181
78
|
|
|
182
79
|
---
|
|
183
80
|
|
|
184
|
-
##
|
|
185
|
-
|
|
186
|
-
The CLI is the operational surface for Trellis repositories. It is the fastest way to initialize repos, inspect history, create milestones, diff/merge work, and script automation around the op stream.
|
|
187
|
-
|
|
188
|
-
### Repository Setup
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
trellis init [--path <dir>] # Initialize a new repo
|
|
192
|
-
trellis import --from <git-repo> # Import Git history as milestones
|
|
193
|
-
trellis export --to <dir> # Export milestones to Git commits
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Working
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
trellis status # Current branch, op count, pending changes
|
|
200
|
-
trellis log [--limit N] [--branch b] # Op stream history
|
|
201
|
-
trellis files [--deleted] # All tracked files
|
|
202
|
-
trellis watch # Start continuous file watching
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### Branches
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
trellis branch # List branches
|
|
209
|
-
trellis branch <name> # Create a branch
|
|
210
|
-
trellis branch -d <name> # Delete a branch
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Milestones & Checkpoints
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
trellis milestone create -m "message" # Create milestone
|
|
217
|
-
trellis milestone create -m "msg" --from <hash> --to <hash> # Over a specific range
|
|
218
|
-
trellis milestone list # List milestones
|
|
219
|
-
trellis checkpoint create # Manual checkpoint
|
|
220
|
-
trellis checkpoint list # List checkpoints
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Diff & Merge
|
|
224
|
-
|
|
225
|
-
```bash
|
|
226
|
-
trellis diff [--from <hash>] [--to <hash>] # File-level diff
|
|
227
|
-
trellis merge --branch <name> [--dry-run] # Three-way merge
|
|
228
|
-
trellis parse <file> # Semantic parse (declarations, imports)
|
|
229
|
-
trellis sdiff <fileA> <fileB> # Semantic diff between two versions
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
### Identity & Governance
|
|
233
|
-
|
|
234
|
-
```bash
|
|
235
|
-
trellis identity [show|create|list] # Manage identities
|
|
236
|
-
trellis governance [list|add|remove] # Manage policy rules
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Idea Garden
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
trellis garden # List abandoned clusters
|
|
243
|
-
trellis garden list [--status <s>] [--file <f>] # Filter clusters
|
|
244
|
-
trellis garden show <cluster-id> # Inspect a cluster
|
|
245
|
-
trellis garden search --keyword <term> # Search by keyword
|
|
246
|
-
trellis garden revive <cluster-id> # Revive cluster as branch
|
|
247
|
-
trellis garden stats # Garden statistics
|
|
248
|
-
```
|
|
81
|
+
## Documentation
|
|
249
82
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
trellis sync reconcile --remote <path> # Reconcile with another local repo
|
|
255
|
-
trellis sync push --peer <id> # Push ops to a peer (HTTP/WebSocket)
|
|
256
|
-
trellis sync pull --peer <id> # Pull ops from a peer
|
|
257
|
-
trellis link-repo <alias> <location> # Link a remote repo for cross-repo refs
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### Query & Search
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
trellis query "find Project where status = 'active'" # EQL-S structured query
|
|
264
|
-
trellis query-repl # Interactive query REPL
|
|
265
|
-
trellis ask "authentication code" # Natural language semantic search
|
|
266
|
-
trellis ask "show me auth code" --rag # Output as RAG context for LLMs
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
### Ontology
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
trellis ontology list # List registered ontologies
|
|
273
|
-
trellis ontology show <id> # Show ontology details
|
|
274
|
-
trellis ontology validate # Validate store against ontologies
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### Agents
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
trellis agent list # List registered agents
|
|
281
|
-
trellis agent create <name> # Create a new agent definition
|
|
282
|
-
trellis agent run <id> --input "task" # Execute an agent run
|
|
283
|
-
trellis agent inspect <run-id> # View run details and decision traces
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Plugins
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
trellis plugin list # List loaded plugins
|
|
290
|
-
trellis plugin add <id> # Register and load a plugin
|
|
291
|
-
trellis plugin remove <id> # Unload and unregister a plugin
|
|
292
|
-
```
|
|
83
|
+
- **[Full documentation](https://trellis.computer)** — Complete guides and API reference
|
|
84
|
+
- **[CLI reference](./README-ARCHIVED.md#cli-overview)** — Command details (archived)
|
|
85
|
+
- **[API modules](./README-ARCHIVED.md#module--subpath-guide)** — Subpath imports (archived)
|
|
86
|
+
- **[DESIGN.md](./DESIGN.md)** — Architecture specification
|
|
293
87
|
|
|
294
88
|
---
|
|
295
89
|
|
|
296
|
-
##
|
|
297
|
-
|
|
298
|
-
The VS Code extension provides a rich visual interface for the entire Trellis platform, making knowledge navigation, collaboration, and project management intuitive and efficient.
|
|
299
|
-
|
|
300
|
-
### Core Features
|
|
301
|
-
|
|
302
|
-
- **Status Dashboard** — Real-time view of repository health, activity metrics, and system state
|
|
303
|
-
- **Causal Timeline** — Interactive exploration of the complete operation history with filtering and search
|
|
304
|
-
- **Knowledge Navigator** — Browse and traverse the wiki-link graph with visual connections
|
|
305
|
-
- **Issue Management** — Full lifecycle issue management with drag-and-drop workflow automation
|
|
306
|
-
- **Semantic Explorer** — Navigate code structure and relationships through AST-aware visualizations
|
|
307
|
-
- **Decision Inspector** — Review decision traces and understand the reasoning behind changes
|
|
308
|
-
- **Collaboration Hub** — Multi-repo federation view and cross-project relationship mapping
|
|
309
|
-
- **Intelligence Panel** — Semantic search, RAG context, and AI-powered insights
|
|
310
|
-
|
|
311
|
-
The extension lives in [`vscode-extension/`](./vscode-extension) and publishes separately from the npm package.
|
|
312
|
-
|
|
313
|
-
---
|
|
314
|
-
|
|
315
|
-
## Module & Subpath Guide
|
|
316
|
-
|
|
317
|
-
The `trellis` package is intentionally split into subpaths so consumers can depend on the specific capabilities they need, from core graph operations to advanced AI features.
|
|
318
|
-
|
|
319
|
-
### Published Package Surface
|
|
90
|
+
## Development
|
|
320
91
|
|
|
321
92
|
```bash
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
// Main entry — full platform engine
|
|
327
|
-
import { TrellisVcsEngine } from 'trellis';
|
|
328
|
-
|
|
329
|
-
// Core graph foundation (independent of VCS)
|
|
330
|
-
import { EAVStore, TrellisKernel } from 'trellis/core';
|
|
331
|
-
import type { Fact, Link, EntityRecord } from 'trellis/core';
|
|
332
|
-
|
|
333
|
-
// Server — HTTP+WS host, auth, permissions, multi-tenancy
|
|
334
|
-
import { startServer, TenantPool } from 'trellis/server';
|
|
335
|
-
|
|
336
|
-
// Client — isomorphic SDK (local or remote)
|
|
337
|
-
import { TrellisClient } from 'trellis/client';
|
|
338
|
-
|
|
339
|
-
// React — reactive hooks for graph subscriptions
|
|
340
|
-
import { TrellisProvider, useEntity, useQuery } from 'trellis/react';
|
|
341
|
-
|
|
342
|
-
// Version control primitives
|
|
343
|
-
import type { VcsOp, VcsOpKind } from 'trellis/vcs';
|
|
344
|
-
|
|
345
|
-
// Knowledge and intelligence
|
|
346
|
-
import { EmbeddingManager } from 'trellis/ai';
|
|
347
|
-
import { parseFileRefs, resolveRef, RefIndex } from 'trellis/links';
|
|
348
|
-
import { recordDecision, queryDecisions } from 'trellis/decisions';
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
### `trellis` — Platform Engine (`TrellisVcsEngine`)
|
|
352
|
-
|
|
353
|
-
The main entry point that orchestrates the entire platform: kernel, file watcher, version control, knowledge graphs, semantic analysis, and collaboration features.
|
|
354
|
-
|
|
355
|
-
```typescript
|
|
356
|
-
import { TrellisVcsEngine } from 'trellis';
|
|
357
|
-
|
|
358
|
-
const engine = new TrellisVcsEngine({ rootPath: '/my/project' });
|
|
359
|
-
|
|
360
|
-
// Repository management
|
|
361
|
-
await engine.initRepo();
|
|
362
|
-
engine.open();
|
|
363
|
-
|
|
364
|
-
// Core operations
|
|
365
|
-
engine.getOps(); // All operations
|
|
366
|
-
engine.status(); // Branch, op count, files
|
|
367
|
-
engine.log(); // Formatted history
|
|
368
|
-
engine.getFiles(); // Currently tracked files
|
|
369
|
-
|
|
370
|
-
// Version control
|
|
371
|
-
await engine.createBranch('feature/x');
|
|
372
|
-
await engine.createMilestone('Implement auth', { fromOpHash, toOpHash });
|
|
373
|
-
|
|
374
|
-
// Semantic analysis
|
|
375
|
-
engine.parseFile(content, 'src/auth.ts');
|
|
376
|
-
engine.semanticDiff(oldContent, newContent, 'src/auth.ts');
|
|
377
|
-
|
|
378
|
-
// Knowledge operations
|
|
379
|
-
const garden = engine.garden();
|
|
380
|
-
garden.listClusters();
|
|
381
|
-
garden.search({ keyword: 'auth' });
|
|
382
|
-
|
|
383
|
-
// Intelligence features
|
|
384
|
-
const embeddings = engine.embeddings();
|
|
385
|
-
await embeddings.search('authentication flow');
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### `trellis/core` — Graph Foundation
|
|
389
|
-
|
|
390
|
-
The core graph layer exposes EAV primitives, ontology schemas, query engine, agent harness, and plugin system. This module is independent of version control and can be used for any graph-based application.
|
|
391
|
-
|
|
392
|
-
```typescript
|
|
393
|
-
import { EAVStore, TrellisKernel } from 'trellis/core';
|
|
394
|
-
import { OntologyRegistry, builtinOntologies } from 'trellis/core';
|
|
395
|
-
import { QueryEngine, parseQuery } from 'trellis/core';
|
|
396
|
-
import { AgentHarness } from 'trellis/core';
|
|
397
|
-
import { PluginRegistry, EventBus } from 'trellis/core';
|
|
398
|
-
import type { Fact, Link, KernelOp, AgentDef, PluginDef } from 'trellis/core';
|
|
399
|
-
|
|
400
|
-
// Graph operations
|
|
401
|
-
const kernel = new TrellisKernel({ backend, agentId: 'me' });
|
|
402
|
-
await kernel.createEntity('proj:1', 'Project', {
|
|
403
|
-
name: 'Trellis',
|
|
404
|
-
status: 'active',
|
|
405
|
-
});
|
|
406
|
-
|
|
407
|
-
// Ontology validation
|
|
408
|
-
const registry = new OntologyRegistry();
|
|
409
|
-
for (const o of builtinOntologies) registry.register(o);
|
|
410
|
-
|
|
411
|
-
// Graph queries
|
|
412
|
-
const query = parseQuery('find Project where status = "active"');
|
|
413
|
-
const results = new QueryEngine(store).eval(query);
|
|
414
|
-
|
|
415
|
-
// Agent orchestration
|
|
416
|
-
const harness = new AgentHarness(kernel);
|
|
417
|
-
await harness.createAgent({ name: 'Reviewer', status: 'active' });
|
|
418
|
-
|
|
419
|
-
// Plugin system
|
|
420
|
-
const plugins = new PluginRegistry();
|
|
421
|
-
plugins.register({ id: 'my:plugin', name: 'My Plugin', version: '1.0.0' });
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
### `trellis/vcs` — Version Control Model
|
|
425
|
-
|
|
426
|
-
The VCS subpath exposes operation types and domain-level building blocks for version control: branches, milestones, checkpoints, issues, diffing, merging, and blob storage.
|
|
427
|
-
|
|
428
|
-
Use this subpath when you want Trellis version control capabilities without the full platform surface.
|
|
429
|
-
|
|
430
|
-
### `trellis/links` — Knowledge Graph & Wiki-Links
|
|
431
|
-
|
|
432
|
-
Parse `[[wiki-links]]` from markdown, doc-comments, and source files. Resolve references to issues, files, symbols, milestones, and decisions. Build a bidirectional knowledge graph that connects all entities in your workspace.
|
|
433
|
-
|
|
434
|
-
```typescript
|
|
435
|
-
import { parseFileRefs, resolveRef, RefIndex } from 'trellis/links';
|
|
93
|
+
# Prerequisites
|
|
94
|
+
# Requires Bun ≥ 1.0
|
|
436
95
|
|
|
437
|
-
|
|
438
|
-
const resolved = resolveRef(ref, context);
|
|
439
|
-
const index = new RefIndex();
|
|
440
|
-
index.indexFile('README.md', refs, context);
|
|
441
|
-
index.getIncoming('issue:TRL-5');
|
|
442
|
-
|
|
443
|
-
// Cross-repository references
|
|
444
|
-
index.addCrossRepoLink('frontend', 'proj:app', 'backend', 'api:users');
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### `trellis/ai` — Semantic Intelligence
|
|
448
|
-
|
|
449
|
-
Advanced semantic capabilities: embed issues, milestones, files, code entities, and decisions into a vector store for intelligent search, discovery, and RAG (Retrieval-Augmented Generation).
|
|
450
|
-
|
|
451
|
-
```typescript
|
|
452
|
-
import { EmbeddingManager } from 'trellis/ai';
|
|
453
|
-
|
|
454
|
-
const manager = new EmbeddingManager(engine, { dbPath: 'embeddings.db' });
|
|
455
|
-
await manager.reindex();
|
|
456
|
-
const results = await manager.search('auth flow');
|
|
457
|
-
|
|
458
|
-
// RAG context for LLMs
|
|
459
|
-
const context = await manager.getRAGContext('authentication implementation');
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
### `trellis/decisions` — Decision Intelligence
|
|
463
|
-
|
|
464
|
-
Automatically capture tool invocations and agent decisions as auditable traces. Enrich them with rationale via hooks and query them later by tool, entity, or decision chain. Perfect for understanding how and why decisions were made.
|
|
465
|
-
|
|
466
|
-
```typescript
|
|
467
|
-
import { recordDecision, queryDecisions } from 'trellis/decisions';
|
|
468
|
-
|
|
469
|
-
const dec = await recordDecision(ctx, {
|
|
470
|
-
toolName: 'trellis_issue_create',
|
|
471
|
-
input: { title: 'Add parser' },
|
|
472
|
-
output: { id: 'TRL-5' },
|
|
473
|
-
rationale: 'Needed for TypeScript support',
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
// Query decision patterns
|
|
477
|
-
const decs = queryDecisions(ctx, { tool: 'trellis_issue_*' });
|
|
478
|
-
const chain = queryDecisions(ctx, { entity: 'TRL-5' }); // Full decision chain
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
### `trellis/server` — HTTP + WebSocket Server
|
|
482
|
-
|
|
483
|
-
Production-grade server host for the Trellis engine: multi-tenancy, auth (JWT + OAuth), permission middleware, realtime subscriptions, file uploads, and deployment tooling.
|
|
484
|
-
|
|
485
|
-
```typescript
|
|
486
|
-
import { startServer, TenantPool } from 'trellis/server';
|
|
487
|
-
|
|
488
|
-
const pool = new TenantPool('/data/tenants');
|
|
489
|
-
await startServer({
|
|
490
|
-
port: 3000,
|
|
491
|
-
dbPath: '/data/trellis',
|
|
492
|
-
apiKey: 'secret',
|
|
493
|
-
tenantPool: pool,
|
|
494
|
-
});
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
### `trellis/client` — Isomorphic SDK
|
|
498
|
-
|
|
499
|
-
TypeScript client that works in two modes — **local** (embeds TrellisKernel, zero network) or **remote** (calls the Trellis Server HTTP API). Includes CRUD, EQL-S queries, file uploads, auth, and WebSocket subscriptions.
|
|
500
|
-
|
|
501
|
-
```typescript
|
|
502
|
-
import { TrellisClient } from 'trellis/client';
|
|
503
|
-
|
|
504
|
-
// Remote mode
|
|
505
|
-
const db = new TrellisClient({ url: 'https://myapp.example.com', apiKey: '...' });
|
|
506
|
-
|
|
507
|
-
// Local mode (Node/Bun only)
|
|
508
|
-
const local = new TrellisClient({ path: './.trellis-db' });
|
|
509
|
-
|
|
510
|
-
// CRUD
|
|
511
|
-
const note = await db.create('Note', { title: 'Hello', body: 'World' });
|
|
512
|
-
const notes = await db.list('Note', { limit: 10 });
|
|
513
|
-
|
|
514
|
-
// Realtime subscriptions
|
|
515
|
-
const sub = db.subscribe("find Note where pinned = 'true'", (results) => {
|
|
516
|
-
console.log('Live update:', results);
|
|
517
|
-
});
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
### `trellis/react` — React Hooks
|
|
521
|
-
|
|
522
|
-
Reactive hooks that turn the Trellis client into a live data layer for React applications. Auto-subscribes via WebSocket and cleans up on unmount.
|
|
523
|
-
|
|
524
|
-
```tsx
|
|
525
|
-
import { TrellisProvider, useEntity, useEntities, useQuery, useMutation } from 'trellis/react';
|
|
526
|
-
|
|
527
|
-
function App() {
|
|
528
|
-
return (
|
|
529
|
-
<TrellisProvider url="http://localhost:3000" apiKey="...">
|
|
530
|
-
<NoteList />
|
|
531
|
-
</TrellisProvider>
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
function NoteList() {
|
|
536
|
-
const { data: notes, loading } = useEntities<Note>('Note', { limit: 20 });
|
|
537
|
-
const { create } = useMutation();
|
|
538
|
-
|
|
539
|
-
if (loading) return <p>Loading...</p>;
|
|
540
|
-
return notes.map(n => <NoteCard key={n.id} note={n} />);
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function NoteDetail({ id }: { id: string }) {
|
|
544
|
-
const { data: note, loading } = useEntity<Note>(id);
|
|
545
|
-
if (loading || !note) return <p>Loading...</p>;
|
|
546
|
-
return <h1>{note.title}</h1>;
|
|
547
|
-
}
|
|
548
|
-
```
|
|
549
|
-
|
|
550
|
-
### `trellis/db` — Deprecated Alias
|
|
551
|
-
|
|
552
|
-
> **⚠️ Deprecated.** Use `trellis/server` and `trellis/client` instead.
|
|
553
|
-
|
|
554
|
-
This subpath re-exports everything from `trellis/server` and `trellis/client` for backward compatibility. It will be removed in a future major version.
|
|
555
|
-
|
|
556
|
-
### `src/garden/` — Idea Garden
|
|
557
|
-
|
|
558
|
-
Detects abandoned work using three heuristics, then exposes a query API.
|
|
559
|
-
|
|
560
|
-
```typescript
|
|
561
|
-
import { detectClusters, IdeaGarden } from './src/garden/index.js';
|
|
562
|
-
|
|
563
|
-
const clusters = detectClusters(ops, milestonedHashes);
|
|
564
|
-
const garden = new IdeaGarden(ops, milestones);
|
|
565
|
-
|
|
566
|
-
garden.search({ file: 'auth.ts', status: 'abandoned', limit: 10 });
|
|
567
|
-
garden.stats(); // { total, abandoned, draft, revived, totalOps, totalFiles }
|
|
568
|
-
garden.revive('cluster:abc');
|
|
569
|
-
```
|
|
570
|
-
|
|
571
|
-
### Platform Subsystem Guides
|
|
572
|
-
|
|
573
|
-
The following sections provide detailed guides for Trellis' internal subsystems. These are useful if you're contributing to the platform or extending its capabilities.
|
|
574
|
-
|
|
575
|
-
#### Knowledge Graph & Wiki-Links (`src/links/`)
|
|
576
|
-
|
|
577
|
-
Builds a bidirectional knowledge graph from wiki-link references across all workspace entities.
|
|
578
|
-
|
|
579
|
-
**Detection heuristics:**
|
|
580
|
-
|
|
581
|
-
| Heuristic | Trigger | Signal |
|
|
582
|
-
| :---------------------- | :------------------ | :---------------------------------------------------------------- |
|
|
583
|
-
| `contextSwitchDetector` | File-set pivot | Group of ops in unrelated dirs followed by a context switch away |
|
|
584
|
-
| `revertDetector` | Complementary ops | Ops undone by a subsequent inverse op (add→delete, modify→revert) |
|
|
585
|
-
| `staleBranchDetector` | Time + no milestone | Ops on non-`main` branches untouched >7 days without a milestone |
|
|
586
|
-
|
|
587
|
-
#### Semantic Intelligence (`src/semantic/`)
|
|
588
|
-
|
|
589
|
-
Advanced TypeScript/JavaScript analysis with structural entity extraction and semantic diffing for intelligent code understanding.
|
|
590
|
-
|
|
591
|
-
```typescript
|
|
592
|
-
import { typescriptParser, semanticMerge } from './src/semantic/index.js';
|
|
593
|
-
|
|
594
|
-
// Parse code into structural entities
|
|
595
|
-
const result = typescriptParser.parse(source, 'file.ts');
|
|
596
|
-
result.declarations; // ASTEntity[] — functions, classes, interfaces, enums, …
|
|
597
|
-
result.imports; // ImportRelation[]
|
|
598
|
-
result.exports; // ExportRelation[]
|
|
599
|
-
|
|
600
|
-
// Compute semantic differences
|
|
601
|
-
const patches = typescriptParser.diff(oldResult, newResult);
|
|
602
|
-
// SemanticPatch[] — symbolAdd | symbolRemove | symbolModify |
|
|
603
|
-
// symbolRename | importAdd | importRemove | …
|
|
604
|
-
|
|
605
|
-
// Intelligent merging with conflict resolution
|
|
606
|
-
const merged = semanticMerge(ourPatches, theirPatches, 'file.ts');
|
|
607
|
-
merged.clean; // true if no conflicts
|
|
608
|
-
merged.patches; // Merged patch list
|
|
609
|
-
merged.conflicts; // SemanticMergeConflict[] — entity-level, with suggestions
|
|
610
|
-
```
|
|
611
|
-
|
|
612
|
-
### `src/sync/` — Peer Sync
|
|
613
|
-
|
|
614
|
-
Implements the have→want→ops→ack protocol with linear and CRDT branch modes.
|
|
615
|
-
|
|
616
|
-
```typescript
|
|
617
|
-
import { SyncEngine, MemoryTransport, reconcile } from './src/sync/index.js';
|
|
618
|
-
|
|
619
|
-
// Standalone CRDT reconciler
|
|
620
|
-
const result = reconcile(localOps, remoteOps);
|
|
621
|
-
result.merged; // Interleaved by timestamp
|
|
622
|
-
result.forkPoint; // Last common op hash
|
|
623
|
-
result.conflicts; // File-level conflicts
|
|
624
|
-
|
|
625
|
-
// Full sync engine
|
|
626
|
-
const transport = new MemoryTransport('peer-a', 'Alice');
|
|
627
|
-
const engine = new SyncEngine({
|
|
628
|
-
localPeerId: 'peer-a',
|
|
629
|
-
transport,
|
|
630
|
-
getLocalOps: () => ops,
|
|
631
|
-
onOpsReceived: (newOps) => {
|
|
632
|
-
/* integrate */
|
|
633
|
-
},
|
|
634
|
-
branchPolicy: { linear: false }, // CRDT mode
|
|
635
|
-
});
|
|
636
|
-
|
|
637
|
-
await engine.pushTo('peer-b');
|
|
638
|
-
await engine.pullFrom('peer-b');
|
|
639
|
-
engine.reconcileWith(remoteOps);
|
|
640
|
-
```
|
|
641
|
-
|
|
642
|
-
#### Collaboration & Sync (`src/sync/`)
|
|
643
|
-
|
|
644
|
-
Enterprise-grade synchronization with CRDT reconciliation, multiple transport protocols, and multi-repo federation for distributed teams.
|
|
645
|
-
|
|
646
|
-
```typescript
|
|
647
|
-
import {
|
|
648
|
-
SyncEngine,
|
|
649
|
-
MemoryTransport,
|
|
650
|
-
reconcile,
|
|
651
|
-
HttpSyncTransport,
|
|
652
|
-
WebSocketSyncTransport,
|
|
653
|
-
MultiRepoManager,
|
|
654
|
-
formatCrossRepoRef,
|
|
655
|
-
} from './src/sync/index.js';
|
|
656
|
-
|
|
657
|
-
// CRDT reconciler for conflict-free merging
|
|
658
|
-
const result = reconcile(localOps, remoteOps);
|
|
659
|
-
result.merged; // Interleaved by timestamp
|
|
660
|
-
result.forkPoint; // Last common op hash
|
|
661
|
-
result.conflicts; // File-level conflicts
|
|
662
|
-
|
|
663
|
-
// HTTP transport for network sync
|
|
664
|
-
const httpTransport = new HttpSyncTransport('peer-a');
|
|
665
|
-
httpTransport.addPeer('peer-b', 'http://192.168.1.10:4200');
|
|
666
|
-
|
|
667
|
-
// WebSocket transport for real-time collaboration
|
|
668
|
-
const wsTransport = new WebSocketSyncTransport('peer-a');
|
|
669
|
-
await wsTransport.connect('peer-b', 'ws://192.168.1.10:4201');
|
|
670
|
-
|
|
671
|
-
// Multi-repo federation — connect knowledge across repositories
|
|
672
|
-
const repoManager = new MultiRepoManager(kernel);
|
|
673
|
-
await repoManager.linkRepo(
|
|
674
|
-
'backend',
|
|
675
|
-
'/path/to/backend-api',
|
|
676
|
-
'Backend service',
|
|
677
|
-
);
|
|
678
|
-
await repoManager.addCrossRepoLink(
|
|
679
|
-
'proj:frontend',
|
|
680
|
-
'dependsOn',
|
|
681
|
-
'backend',
|
|
682
|
-
'lib:api-client',
|
|
683
|
-
);
|
|
684
|
-
// Creates: proj:frontend --dependsOn--> @backend:lib:api-client
|
|
685
|
-
|
|
686
|
-
// Discover cross-repository relationships
|
|
687
|
-
const refs = repoManager.findReferencesTo('backend', 'lib:api-client');
|
|
688
|
-
```
|
|
689
|
-
|
|
690
|
-
These subsystem guides provide insight into Trellis' internal architecture. They're particularly useful for platform contributors, extenders, or those building custom integrations.
|
|
691
|
-
|
|
692
|
-
---
|
|
693
|
-
|
|
694
|
-
## How It Works
|
|
695
|
-
|
|
696
|
-
### Init Flow
|
|
697
|
-
|
|
698
|
-
```
|
|
699
|
-
trellis init
|
|
700
|
-
→ mkdirSync .trellis/
|
|
701
|
-
→ write config.json (agentId, defaultBranch, ignorePatterns)
|
|
702
|
-
→ create vcs:branchCreate op for "main"
|
|
703
|
-
→ scan filesystem → create vcs:fileAdd op per file
|
|
704
|
-
→ flush ops to .trellis/ops.json
|
|
705
|
-
```
|
|
706
|
-
|
|
707
|
-
### Watch Flow
|
|
708
|
-
|
|
709
|
-
```
|
|
710
|
-
trellis watch
|
|
711
|
-
→ FileWatcher.scan() populates known-files map
|
|
712
|
-
→ FileWatcher.start() sets up Bun fs.watch
|
|
713
|
-
→ on change → debounce → SHA-256 hash → emit FileChangeEvent
|
|
714
|
-
→ Ingestion.process(event) → createVcsOp(kind, payload)
|
|
715
|
-
→ engine.applyOp(op) → EAV store + op log
|
|
716
|
-
→ auto-checkpoint if threshold crossed
|
|
717
|
-
```
|
|
718
|
-
|
|
719
|
-
### Milestone Flow
|
|
720
|
-
|
|
721
|
-
```
|
|
722
|
-
trellis milestone create -m "Add auth"
|
|
723
|
-
→ auto-detect fromOpHash (last milestone's toOpHash + 1)
|
|
724
|
-
→ collect affected files from ops in range
|
|
725
|
-
→ createVcsOp('vcs:milestoneCreate', { message, fromOpHash, toOpHash, affectedFiles })
|
|
726
|
-
→ optional: trellis export → Git commit
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
### Semantic Diff Flow
|
|
730
|
-
|
|
731
|
-
```
|
|
732
|
-
trellis sdiff old.ts new.ts
|
|
733
|
-
→ typescriptParser.parse(old) → ParseResult { declarations, imports, exports }
|
|
734
|
-
→ typescriptParser.parse(new) → ParseResult
|
|
735
|
-
→ typescriptParser.diff(old, new) → SemanticPatch[]
|
|
736
|
-
- symbolAdd / symbolRemove / symbolModify
|
|
737
|
-
- symbolRename (detected via signature similarity)
|
|
738
|
-
- importAdd / importRemove / importModify
|
|
739
|
-
```
|
|
740
|
-
|
|
741
|
-
### Sync / Reconcile Flow
|
|
742
|
-
|
|
743
|
-
```
|
|
744
|
-
Engine A sends 'have' { heads: { main: 'h42' }, opCount: 42 }
|
|
745
|
-
→ Engine B compares to its own heads
|
|
746
|
-
→ B sends 'want' { afterHash: 'h38' }
|
|
747
|
-
→ A sends 'ops' [ op39, op40, op41, op42 ]
|
|
748
|
-
→ B integrates new ops (linear: filter dupes; CRDT: reconcile())
|
|
749
|
-
→ B sends 'ack' { integrated: ['h39', …] }
|
|
750
|
-
```
|
|
751
|
-
|
|
752
|
-
---
|
|
753
|
-
|
|
754
|
-
## Design Doc
|
|
755
|
-
|
|
756
|
-
See [`DESIGN.md`](./DESIGN.md) for the complete platform architecture specification, including:
|
|
757
|
-
|
|
758
|
-
- §3 — Causal stream and branch concurrency model
|
|
759
|
-
- §4 — Semantic patching: parser adapter interface, patch types, commutativity
|
|
760
|
-
- §5 — Milestone narrative model
|
|
761
|
-
- §6 — Identity, signing, and governance
|
|
762
|
-
- §7 — Idea Garden cluster detection heuristics
|
|
763
|
-
- §8 — Knowledge graph and wiki-link system
|
|
764
|
-
- §9 — Embeddings and semantic search architecture
|
|
765
|
-
- §10 — Decision trace capture and querying
|
|
766
|
-
- §11 — Sync protocols and multi-repo federation
|
|
767
|
-
- §12 — Core graph kernel and ontology system
|
|
768
|
-
- §13 — Agent harness and plugin architecture
|
|
769
|
-
- §14 — Open questions and architectural trade-offs
|
|
770
|
-
|
|
771
|
-
---
|
|
772
|
-
|
|
773
|
-
## Development & Releases
|
|
774
|
-
|
|
775
|
-
### Prerequisites
|
|
776
|
-
|
|
777
|
-
- [Bun](https://bun.sh) ≥ 1.0
|
|
778
|
-
- No other native dependencies
|
|
779
|
-
|
|
780
|
-
### Install
|
|
781
|
-
|
|
782
|
-
```bash
|
|
96
|
+
# Install dependencies
|
|
783
97
|
bun install
|
|
784
|
-
```
|
|
785
98
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
```bash
|
|
789
|
-
just test-core
|
|
790
|
-
# or run the full suite when working on those areas:
|
|
99
|
+
# Run tests
|
|
791
100
|
bun test
|
|
792
|
-
```
|
|
793
|
-
|
|
794
|
-
**The release flow currently validates against the targeted passing core suite.**
|
|
795
|
-
|
|
796
|
-
### Typecheck
|
|
797
|
-
|
|
798
|
-
```bash
|
|
799
|
-
bun run typecheck
|
|
800
|
-
```
|
|
801
101
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
```bash
|
|
805
|
-
# Build for npm (bun build → dist/)
|
|
102
|
+
# Build for npm
|
|
806
103
|
bun run build
|
|
807
|
-
|
|
808
|
-
# Run CLI directly during development
|
|
809
|
-
bun run src/cli/index.ts <command>
|
|
810
104
|
```
|
|
811
105
|
|
|
812
106
|
---
|
|
813
107
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
```bash
|
|
817
|
-
# Validate locally without publishing
|
|
818
|
-
just publish-dry-run
|
|
819
|
-
|
|
820
|
-
# Publish to npm locally, then tag/push/create release metadata
|
|
821
|
-
just publish
|
|
822
|
-
```
|
|
108
|
+
## Status
|
|
823
109
|
|
|
824
|
-
|
|
110
|
+
| Phase | Deliverable | Status |
|
|
111
|
+
| :---- | :------------------------- | :----- |
|
|
112
|
+
| P0 | Causal stream + CLI | ✅ |
|
|
113
|
+
| P0.5 | VS Code extension | ✅ |
|
|
114
|
+
| P1 | Git import bridge | ✅ |
|
|
115
|
+
| P2 | Branches, milestones | ✅ |
|
|
116
|
+
| P2.5 | Blob store, modularization | ✅ |
|
|
117
|
+
| P3 | File-level diff + merge | ✅ |
|
|
118
|
+
| P4 | Identity + governance | ✅ |
|
|
119
|
+
| P5 | Idea Garden | ✅ |
|
|
825
120
|
|
|
826
121
|
---
|
|
827
122
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
| Phase | Deliverable | Status | Commit |
|
|
831
|
-
| :---- | :------------------------------------------------- | :----- | :---------- |
|
|
832
|
-
| P0 | Causal stream + CLI | ✅ | `51475d3` |
|
|
833
|
-
| P0.5 | VS Code extension / visual timeline | ✅ | `947d5a1` |
|
|
834
|
-
| P1 | Git import bridge | ✅ | `f4cc4a6` |
|
|
835
|
-
| P2 | Branches, milestones, checkpoints | ✅ | `3f91e9a` |
|
|
836
|
-
| P2.5 | Blob store, engine modularization, git exporter | ✅ | `5c43a31` |
|
|
837
|
-
| P3 | File-level diff + text-based merge | ✅ | `c953654` |
|
|
838
|
-
| P4 | Identity + op signing + governance | ✅ | `3acddda` |
|
|
839
|
-
| P5 | Idea Garden — cluster detection + query | ✅ | `105a207` |
|
|
840
|
-
| P6 | Semantic patching — parser adapter + diff/merge | ✅ | `22192ae` |
|
|
841
|
-
| P7 | Peer sync + CRDT reconciler | ✅ | `d02f3f7` |
|
|
842
|
-
| P8 | Wiki-links, embeddings, decision traces | ✅ | `b9cd5b7` |
|
|
843
|
-
| P9 | npm package + VSCode extension publish | ✅ | `57bad37` |
|
|
844
|
-
| P10 | Graph kernel + SQLite backend + entity CRUD | ✅ | |
|
|
845
|
-
| P11 | EQL-S query engine + Datalog evaluator | ✅ | |
|
|
846
|
-
| P12 | Ontology system + validation middleware | ✅ | |
|
|
847
|
-
| P13 | Transformers.js upgrade + auto-embed + RAG | ✅ | |
|
|
848
|
-
| P14 | Agent harness + tool registry + decision traces | ✅ | |
|
|
849
|
-
| P15 | Plugin system + event bus + workspace config | ✅ | |
|
|
850
|
-
| P16 | Sync federation + multi-repo linking | ✅ | |
|
|
851
|
-
| P17 | Advanced knowledge graph + cross-repo intelligence | 🚧 | In Progress |
|
|
852
|
-
| P18 | Agentic State Engine pivot — server/client/react split | ✅ | |
|
|
853
|
-
| P19 | Enterprise collaboration features + RBAC | 📋 | Planned |
|
|
854
|
-
| P20 | Advanced AI capabilities + intelligent automation | 📋 | Planned |
|
|
123
|
+
_For comprehensive documentation including detailed CLI commands, API examples, and subsystem guides, see [README-ARCHIVED.md](./README-ARCHIVED.md)._
|