agentlip 0.1.0

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 ADDED
@@ -0,0 +1,74 @@
1
+ # agentlip
2
+
3
+ Stateless CLI for Agentlip workspaces. Provides:
4
+
5
+ - **Workspace discovery** - finds `.agentlip/db.sqlite3` by walking upward from cwd
6
+ - **Read-only DB access** - opens DB with `PRAGMA query_only=ON` for safe concurrent reads
7
+
8
+ ## Installation
9
+
10
+ Part of the agentlip monorepo. Link via workspace dependencies.
11
+
12
+ ## Library Usage
13
+
14
+ ```typescript
15
+ import {
16
+ discoverWorkspaceRoot,
17
+ openWorkspaceDbReadonly,
18
+ isQueryOnly,
19
+ WorkspaceNotFoundError,
20
+ } from "agentlip";
21
+
22
+ // Discover workspace (returns null if not found)
23
+ const discovered = await discoverWorkspaceRoot("/path/to/start");
24
+ if (!discovered) {
25
+ console.log("No workspace found");
26
+ }
27
+
28
+ // Open DB read-only
29
+ try {
30
+ const { db, workspaceRoot, dbPath } = await openWorkspaceDbReadonly();
31
+
32
+ // Verify query_only is on
33
+ console.log("Query only:", isQueryOnly(db)); // true
34
+
35
+ // Safe to read while hub is running
36
+ const row = db.query("SELECT * FROM messages LIMIT 1").get();
37
+
38
+ db.close();
39
+ } catch (err) {
40
+ if (err instanceof WorkspaceNotFoundError) {
41
+ console.log("No workspace found");
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## CLI Usage
47
+
48
+ ```bash
49
+ # Run diagnostics on workspace
50
+ agentlip doctor
51
+
52
+ # With explicit workspace path
53
+ agentlip doctor --workspace /path/to/workspace
54
+
55
+ # JSON output
56
+ agentlip doctor --json
57
+ ```
58
+
59
+ ## Safety Guarantees
60
+
61
+ 1. **Discovery never initializes** - `discoverWorkspaceRoot` only searches, never creates
62
+ 2. **Read-only enforced** - `openWorkspaceDbReadonly` sets `PRAGMA query_only=ON`
63
+ 3. **Concurrent safe** - Multiple CLI readers can coexist with hub (single writer)
64
+ 4. **Boundary safe** - Discovery stops at filesystem root and user home directory
65
+
66
+ ## Testing
67
+
68
+ ```bash
69
+ # Run tests
70
+ bun test
71
+
72
+ # Run verification script
73
+ bun verify.ts
74
+ ```
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "agentlip",
3
+ "version": "0.1.0",
4
+ "description": "CLI for Agentlip workspace management",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/phosphorco/agentlip",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/phosphorco/agentlip.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "engines": {
14
+ "bun": ">=1.0.0"
15
+ },
16
+ "files": [
17
+ "src/",
18
+ "!src/**/*.test.ts"
19
+ ],
20
+ "exports": {
21
+ ".": "./src/index.ts"
22
+ },
23
+ "bin": {
24
+ "agentlip": "./src/agentlip.ts"
25
+ },
26
+ "dependencies": {
27
+ "@agentlip/workspace": "workspace:*",
28
+ "@agentlip/kernel": "workspace:*"
29
+ },
30
+ "devDependencies": {
31
+ "@agentlip/hub": "workspace:*"
32
+ },
33
+ "scripts": {
34
+ "test": "bun test",
35
+ "verify": "bun verify.ts"
36
+ }
37
+ }