@easbot/codebase 0.3.17 → 0.3.19
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.en.md +100 -0
- package/README.md +109 -1
- package/dist/chunks/{chunk-EA3I4MT4.mjs → chunk-22PKTMO5.mjs} +1 -1
- package/dist/chunks/chunk-AGZFRKQ4.mjs +188 -0
- package/dist/chunks/{chunk-ZEWAPZVN.mjs → chunk-CSMSBVAG.mjs} +1 -1
- package/dist/chunks/chunk-GWCRGM4D.mjs +51 -0
- package/dist/chunks/{chunk-GIFXADFP.cjs → chunk-JWTI3BWI.cjs} +1 -1
- package/dist/chunks/{chunk-CIQEJCMT.cjs → chunk-R74KIJM2.cjs} +1 -1
- package/dist/chunks/chunk-TR3DFBJH.mjs +47 -0
- package/dist/chunks/chunk-VFTVDTEY.cjs +188 -0
- package/dist/chunks/chunk-VPWALTY7.cjs +51 -0
- package/dist/chunks/chunk-YYF5OQDS.cjs +47 -0
- package/dist/chunks/cli-handler-3I5JC3HY.cjs +1 -0
- package/dist/chunks/cli-handler-IJ2PNNTK.mjs +1 -0
- package/dist/chunks/code-base-6TM7JDJ6.cjs +1 -0
- package/dist/chunks/code-base-BSRUQYXN.mjs +1 -0
- package/dist/chunks/database-manager-26PY6VTD.mjs +1 -0
- package/dist/chunks/database-manager-U7D7QIHC.cjs +1 -0
- package/dist/chunks/llm-JQV6XWGD.cjs +1 -0
- package/dist/chunks/llm-MPD7FHPM.mjs +1 -0
- package/dist/chunks/{stdio-server-W5XLVZC6.cjs → stdio-server-2GBPZY6J.cjs} +6 -6
- package/dist/chunks/{stdio-server-GGKN6AJG.mjs → stdio-server-BZYPM34X.mjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +62 -1
- package/dist/index.d.ts +62 -1
- package/dist/index.mjs +1 -1
- package/package.json +8 -7
- package/dist/chunks/chunk-2IV4QX2G.cjs +0 -2
- package/dist/chunks/chunk-6CZLTNWG.mjs +0 -48
- package/dist/chunks/chunk-7XCIIOM6.cjs +0 -1
- package/dist/chunks/chunk-CO2Z7GYQ.cjs +0 -234
- package/dist/chunks/chunk-JETXBNZZ.mjs +0 -234
- package/dist/chunks/chunk-QG2XI4TZ.mjs +0 -2
- package/dist/chunks/chunk-UTKA3WG3.mjs +0 -1
- package/dist/chunks/chunk-YOZRKHSG.cjs +0 -48
- package/dist/chunks/cli-handler-4LL2T4JJ.cjs +0 -1
- package/dist/chunks/cli-handler-YHV6VNEW.mjs +0 -1
- package/dist/chunks/code-base-AZUUTXZJ.cjs +0 -1
- package/dist/chunks/code-base-NCHNMM3G.mjs +0 -1
- package/dist/chunks/database-manager-6VPRTKJB.mjs +0 -1
- package/dist/chunks/database-manager-VKVK4F6K.cjs +0 -1
- package/dist/chunks/sync-EN4VOECU.cjs +0 -1
- package/dist/chunks/sync-PXO6JHYL.mjs +0 -1
package/README.en.md
CHANGED
|
@@ -90,6 +90,106 @@ easbot-codebase path <missing> --json
|
|
|
90
90
|
|
|
91
91
|
**Exemptions**: `watch` (service-mode) / `mcp` (JSON-RPC). See [decision 0051](file:///e:/work/apps/eas/easbot/docs/decisions/0051-cli-human-output-unify.md) and [CLI Output Spec v1.3](file:///e:/work/apps/eas/easbot/docs/spec/cli-output-spec.md).
|
|
92
92
|
|
|
93
|
+
## Status / Doctor Unified Output Format (Decision 0073 / CLI Spec v1.4)
|
|
94
|
+
|
|
95
|
+
`codebase status` / `codebase doctor` share the same rendering as `note` / `memory` via `@easbot/terminal`'s `formatKnowledgeStatus` / `formatKnowledgeDoctor`, ensuring consistent visual and field structure across all three packages.
|
|
96
|
+
|
|
97
|
+
### Status Output Example
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
$ easbot codebase status
|
|
101
|
+
─ codebase status ─────────────────────────────────────────────────
|
|
102
|
+
Root directory E:/work/my-project
|
|
103
|
+
Config ✓ E:/work/my-project/.easbot/codebase.json
|
|
104
|
+
DB ✓ E:/work/my-project/.easbot/db/codebase.db (12582912 bytes)
|
|
105
|
+
Index state ready
|
|
106
|
+
Schema version 1
|
|
107
|
+
Extraction version 1
|
|
108
|
+
Backend better-sqlite3
|
|
109
|
+
Last sync 2026-08-31T14:23:11.000Z
|
|
110
|
+
Vector enabled ✓
|
|
111
|
+
Embedding dims 1536
|
|
112
|
+
LLM:
|
|
113
|
+
Initialized ✓
|
|
114
|
+
Provider openai
|
|
115
|
+
Capabilities:
|
|
116
|
+
Embedding ✓ text-embedding-3-small
|
|
117
|
+
Graph LLM ✓ gpt-4o-mini
|
|
118
|
+
Rerank LLM ✗
|
|
119
|
+
Counts:
|
|
120
|
+
nodes 1247
|
|
121
|
+
edges 3891
|
|
122
|
+
Healthy ✓
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Doctor Output Example
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
$ easbot codebase doctor
|
|
129
|
+
─ codebase doctor ─────────────────────────────────────────────────
|
|
130
|
+
Healthy ✓
|
|
131
|
+
Duration 127 ms
|
|
132
|
+
Backend availability:
|
|
133
|
+
- better-sqlite3 ✓
|
|
134
|
+
- node:sqlite ✗
|
|
135
|
+
- @tursodatabase/database ✗
|
|
136
|
+
DB stats:
|
|
137
|
+
page_count 768
|
|
138
|
+
page_size 4096
|
|
139
|
+
freelist_count 0
|
|
140
|
+
Checks 12 total (0 error, 0 warn, 1 info, 11 ok)
|
|
141
|
+
[ok] ✓ database: database file exists and accessible (12 ms)
|
|
142
|
+
[ok] ✓ fts: FTS5 available (8 ms)
|
|
143
|
+
[ok] ✓ vector: vector index usable (23 ms)
|
|
144
|
+
[ok] ✓ schema: schema version matches (2 ms)
|
|
145
|
+
[ok] ✓ lock: no lock contention (1 ms)
|
|
146
|
+
[ok] ✓ disk_space: sufficient (156 MB free) (3 ms)
|
|
147
|
+
[ok] ✓ orphan: no orphan records (18 ms)
|
|
148
|
+
[info] ℹ llm: LLM reachable (ping 42 ms) (42 ms)
|
|
149
|
+
[ok] ✓ fk_integrity: foreign keys consistent (15 ms)
|
|
150
|
+
[ok] ✓ parse_errors: no parse errors in index (21 ms)
|
|
151
|
+
[ok] ✓ extraction_version: extraction version matches config (2 ms)
|
|
152
|
+
[ok] ✓ embedding_dims_consistency: meta=1536 probe=1536 config=1536 (35 ms)
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Key Fields
|
|
156
|
+
|
|
157
|
+
| Field | Description |
|
|
158
|
+
|-------|-------------|
|
|
159
|
+
| `LLM.initialized` | Whether LLM is initialized (valid config + reachable) |
|
|
160
|
+
| `LLM.capabilities` | Three capabilities: `embedding` / `graphLlm` / `rerankLlm`, each shows model name or ✗ |
|
|
161
|
+
| `Vector enabled` | Whether vector index is enabled |
|
|
162
|
+
| `Embedding dims` | **Probed** embedding dimension (not just from config), probed at status end and written back to meta table |
|
|
163
|
+
| `embedding_dims_consistency` | Doctor check #9: compares meta / probe / config dimensions for consistency |
|
|
164
|
+
|
|
165
|
+
### JSON Output (`--json`)
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
$ easbot codebase status --json
|
|
169
|
+
{
|
|
170
|
+
"ok": true,
|
|
171
|
+
"data": {
|
|
172
|
+
"rootDir": "E:/work/my-project",
|
|
173
|
+
"configExists": true,
|
|
174
|
+
"dbExists": true,
|
|
175
|
+
"indexState": "ready",
|
|
176
|
+
"schemaVersion": 1,
|
|
177
|
+
"llm": {
|
|
178
|
+
"initialized": true,
|
|
179
|
+
"capabilities": { "embedding": true, "graphLlm": true, "rerankLlm": false },
|
|
180
|
+
"embeddingModel": "text-embedding-3-small",
|
|
181
|
+
"graphModel": "gpt-4o-mini",
|
|
182
|
+
"providerId": "openai"
|
|
183
|
+
},
|
|
184
|
+
"counts": { "nodes": 1247, "edges": 3891 },
|
|
185
|
+
"healthy": true
|
|
186
|
+
},
|
|
187
|
+
"meta": { "scope": "all" }
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Compatible with [CLI Output Spec v1.4](file:///e:/work/apps/eas/easbot/docs/spec/cli-output-spec.md) / [Decision 0040](file:///e:/work/apps/eas/easbot/docs/decisions/0040-cli-output-unified-json.md).
|
|
192
|
+
|
|
93
193
|
## API Documentation
|
|
94
194
|
|
|
95
195
|
### CodeKnowledgeGraph
|
package/README.md
CHANGED
|
@@ -61,14 +61,22 @@ easbot codebase init --json
|
|
|
61
61
|
# "ok": true,
|
|
62
62
|
# "data": {
|
|
63
63
|
# "configPath": "<worktree>/.easbot/codebase.json",
|
|
64
|
+
# "dbPath": "<worktree>/.easbot/db/codebase.db",
|
|
64
65
|
# "backend": "better-sqlite3",
|
|
65
66
|
# "schemaVersion": 1,
|
|
66
67
|
# "created": true,
|
|
67
68
|
# "skipped": false,
|
|
68
|
-
# "
|
|
69
|
+
# "metaInitialized": true
|
|
69
70
|
# },
|
|
70
71
|
# "meta": { "action": "created" }
|
|
71
72
|
# }
|
|
73
|
+
#
|
|
74
|
+
# 决策 0076:init 现在落地三件套契约(与 memory/note 对齐):
|
|
75
|
+
# 1. <worktree>/.easbot/codebase.json — JSON config
|
|
76
|
+
# 2. <worktree>/.easbot/db/codebase.db — SQLite db(含 schema + meta 表 5 个 KV)
|
|
77
|
+
# 3. db meta 表:version / createdAt / index_state=uninitialized / indexed_with_version=unknown / schema_version
|
|
78
|
+
# 二次 init 不带 --force 时 idempotent 跳过;带 --force 时删旧 db 重建三件套。
|
|
79
|
+
# 不主动跑 sync;用户显式跑 `easbot codebase sync` 触发首次同步。
|
|
72
80
|
|
|
73
81
|
# 错误响应 schema
|
|
74
82
|
easbot codebase path <missing> --json
|
|
@@ -80,6 +88,106 @@ easbot codebase path <missing> --json
|
|
|
80
88
|
|
|
81
89
|
**豁免清单**:`watch`(服务型启动)/ `mcp`(JSON-RPC 协议)。详见 [决策 0051](file:///e:/work/apps/eas/easbot/docs/decisions/0051-cli-human-output-unify.md) + [CLI 输出规范 v1.3](file:///e:/work/apps/eas/easbot/docs/spec/cli-output-spec.md)。
|
|
82
90
|
|
|
91
|
+
## Status / Doctor 统一输出格式(决策 0073 / CLI 规范 v1.4)
|
|
92
|
+
|
|
93
|
+
`codebase status` / `codebase doctor` 与 `note` / `memory` 三包统一走 `@easbot/terminal` 的 `formatKnowledgeStatus` / `formatKnowledgeDoctor` 渲染,视觉与字段结构完全一致。
|
|
94
|
+
|
|
95
|
+
### status 输出示例
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
$ easbot codebase status
|
|
99
|
+
─ codebase status ─────────────────────────────────────────────────
|
|
100
|
+
Root directory E:/work/my-project
|
|
101
|
+
Config ✓ E:/work/my-project/.easbot/codebase.json
|
|
102
|
+
DB ✓ E:/work/my-project/.easbot/db/codebase.db (12582912 bytes)
|
|
103
|
+
Index state ready
|
|
104
|
+
Schema version 1
|
|
105
|
+
Extraction version 1
|
|
106
|
+
Backend better-sqlite3
|
|
107
|
+
Last sync 2026-08-31T14:23:11.000Z
|
|
108
|
+
Vector enabled ✓
|
|
109
|
+
Embedding dims 1536
|
|
110
|
+
LLM:
|
|
111
|
+
Initialized ✓
|
|
112
|
+
Provider openai
|
|
113
|
+
Capabilities:
|
|
114
|
+
Embedding ✓ text-embedding-3-small
|
|
115
|
+
Graph LLM ✓ gpt-4o-mini
|
|
116
|
+
Rerank LLM ✗
|
|
117
|
+
Counts:
|
|
118
|
+
nodes 1247
|
|
119
|
+
edges 3891
|
|
120
|
+
Healthy ✓
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### doctor 输出示例
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
$ easbot codebase doctor
|
|
127
|
+
─ codebase doctor ─────────────────────────────────────────────────
|
|
128
|
+
Healthy ✓
|
|
129
|
+
Duration 127 ms
|
|
130
|
+
Backend availability:
|
|
131
|
+
- better-sqlite3 ✓
|
|
132
|
+
- node:sqlite ✗
|
|
133
|
+
- @tursodatabase/database ✗
|
|
134
|
+
DB stats:
|
|
135
|
+
page_count 768
|
|
136
|
+
page_size 4096
|
|
137
|
+
freelist_count 0
|
|
138
|
+
Checks 12 total (0 error, 0 warn, 1 info, 11 ok)
|
|
139
|
+
[ok] ✓ database: database file exists and accessible (12 ms)
|
|
140
|
+
[ok] ✓ fts: FTS5 available (8 ms)
|
|
141
|
+
[ok] ✓ vector: vector index usable (23 ms)
|
|
142
|
+
[ok] ✓ schema: schema version matches (2 ms)
|
|
143
|
+
[ok] ✓ lock: no lock contention (1 ms)
|
|
144
|
+
[ok] ✓ disk_space: sufficient (156 MB free) (3 ms)
|
|
145
|
+
[ok] ✓ orphan: no orphan records (18 ms)
|
|
146
|
+
[info] ℹ llm: LLM reachable (ping 42 ms) (42 ms)
|
|
147
|
+
[ok] ✓ fk_integrity: foreign keys consistent (15 ms)
|
|
148
|
+
[ok] ✓ parse_errors: no parse errors in index (21 ms)
|
|
149
|
+
[ok] ✓ extraction_version: extraction version matches config (2 ms)
|
|
150
|
+
[ok] ✓ embedding_dims_consistency: meta=1536 probe=1536 config=1536 (35 ms)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 关键字段说明
|
|
154
|
+
|
|
155
|
+
| 字段 | 说明 |
|
|
156
|
+
|------|------|
|
|
157
|
+
| `LLM.initialized` | LLM 是否已初始化(配置有效且可达) |
|
|
158
|
+
| `LLM.capabilities` | 三大能力:`embedding` / `graphLlm` / `rerankLlm`,各显示模型名或 ✗ |
|
|
159
|
+
| `Vector enabled` | 向量索引是否启用 |
|
|
160
|
+
| `Embedding dims` | **实测** embedding 维度(非仅读 config),status 末尾探测并回填 meta 表 |
|
|
161
|
+
| `embedding_dims_consistency` | doctor 第 9 项检查:对比 meta / probe / config 三方维度是否一致 |
|
|
162
|
+
|
|
163
|
+
### JSON 输出(`--json`)
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
$ easbot codebase status --json
|
|
167
|
+
{
|
|
168
|
+
"ok": true,
|
|
169
|
+
"data": {
|
|
170
|
+
"rootDir": "E:/work/my-project",
|
|
171
|
+
"configExists": true,
|
|
172
|
+
"dbExists": true,
|
|
173
|
+
"indexState": "ready",
|
|
174
|
+
"schemaVersion": 1,
|
|
175
|
+
"llm": {
|
|
176
|
+
"initialized": true,
|
|
177
|
+
"capabilities": { "embedding": true, "graphLlm": true, "rerankLlm": false },
|
|
178
|
+
"embeddingModel": "text-embedding-3-small",
|
|
179
|
+
"graphModel": "gpt-4o-mini",
|
|
180
|
+
"providerId": "openai"
|
|
181
|
+
},
|
|
182
|
+
"counts": { "nodes": 1247, "edges": 3891 },
|
|
183
|
+
"healthy": true
|
|
184
|
+
},
|
|
185
|
+
"meta": { "scope": "all" }
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
兼容 [CLI 输出规范 v1.4](file:///e:/work/apps/eas/easbot/docs/spec/cli-output-spec.md) / [决策 0040](file:///e:/work/apps/eas/easbot/docs/decisions/0040-cli-output-unified-json.md)。
|
|
190
|
+
|
|
83
191
|
## 安装
|
|
84
192
|
|
|
85
193
|
```bash
|
|
@@ -151,4 +151,4 @@ import {a}from'./chunk-TMICZT3L.mjs';import {Log,Filesystem}from'@easbot/utils';
|
|
|
151
151
|
`,r=[];for(let i of e)r.push(i.segment,i.name);return this.db.prepare(s).run(...r).changes}setProjectMetadata(e,t){let s=e==="worktree"||e==="project"?c(t):t;return this.db.prepare(`
|
|
152
152
|
INSERT OR REPLACE INTO project_metadata (key, value, updated_at)
|
|
153
153
|
VALUES (?, ?, CURRENT_TIMESTAMP)
|
|
154
|
-
`).run(e,s).changes}getNodeIdsByFile(e){let t=e.replace(/\\/g,"/");return this.db.prepare("SELECT id FROM nodes WHERE file_path = ?").all(t).map(r=>r.id)}deleteFtsByFile(e){let t=e.replace(/\\/g,"/"),s=this.getNodeIdsByFile(t);if(s.length===0)return 0;let r=this.db.prepare("DELETE FROM nodes_fts WHERE id = ?");return this.db.transaction(a=>{for(let i of a)r.run(i);})(s),s.length}initialize(){if(this.closed)throw new g("Cannot initialize closed database","initialize")}close(){if(!this.closed){this.closed=true;try{this.db.close();}catch(e){E.warn("Database close error",{error:String(e)});}}}isClosed(){return this.closed}getDbPath(){return this.dbPath}transaction(e){return this.db.transaction(e)()}getMeta(e){if(!this.db)throw new Error("Database not initialized");return this.db.prepare("SELECT value FROM meta WHERE key = ?").get(e)?.value??null}setMeta(e,t){if(!this.db)throw new Error("Database not initialized");this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)").run(e,t);}deleteMeta(e){if(!this.db)throw new Error("Database not initialized");this.db.prepare("DELETE FROM meta WHERE key = ?").run(e);}};function se(o){return o.isClosed()}function re(o){return o.getDbPath()}function ne(o,e){return o.transaction(e)}export{F as a,g as b,M as c,u as d,A as e,v as f,x as g,w as h,p as i,V as j,X as k,H as l,m,$ as n,se as o,re as p,ne as q};
|
|
154
|
+
`).run(e,s).changes}getNodeIdsByFile(e){let t=e.replace(/\\/g,"/");return this.db.prepare("SELECT id FROM nodes WHERE file_path = ?").all(t).map(r=>r.id)}deleteFtsByFile(e){let t=e.replace(/\\/g,"/"),s=this.getNodeIdsByFile(t);if(s.length===0)return 0;let r=this.db.prepare("DELETE FROM nodes_fts WHERE id = ?");return this.db.transaction(a=>{for(let i of a)r.run(i);})(s),s.length}initialize(){if(this.closed)throw new g("Cannot initialize closed database","initialize")}close(){if(!this.closed){this.closed=true;try{this.db.close();}catch(e){E.warn("Database close error",{error:String(e)});}}}isClosed(){return this.closed}getDbPath(){return this.dbPath}transaction(e){return this.db.transaction(e)()}getMeta(e){if(!this.db)throw new Error("Database not initialized");return this.db.prepare("SELECT value FROM meta WHERE key = ?").get(e)?.value??null}setMeta(e,t){if(!this.db)throw new Error("Database not initialized");this.db.prepare("INSERT OR REPLACE INTO meta (key, value) VALUES (?, ?)").run(e,t);}countSqliteObjects(){if(!this.db)throw new Error("Database not initialized");return this.db.prepare("SELECT COUNT(*) as n FROM sqlite_master WHERE type IN ('table', 'index', 'trigger', 'view')").get()?.n??0}deleteMeta(e){if(!this.db)throw new Error("Database not initialized");this.db.prepare("DELETE FROM meta WHERE key = ?").run(e);}};function se(o){return o.isClosed()}function re(o){return o.getDbPath()}function ne(o,e){return o.transaction(e)}export{F as a,g as b,M as c,u as d,A as e,v as f,x as g,w as h,p as i,V as j,X as k,H as l,m,$ as n,se as o,re as p,ne as q};
|