ygl-trees 0.73.0 → 0.74.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.74.0(2026-10-17)export-markdown + v2 测试 + 技能同步
4
+ - **db export-markdown**:一键生成工作区 Markdown 报告(Summary/Projects/Claims/Knowledge/Trees)
5
+ - **v2 功能测试**:6 项新单测覆盖 time-travel/timeline/workspace/obsidian/help-suggestions/llms-sections
6
+ - **技能同步 v0.73.0**:quickstart/knowledge/research/techtree 全部更新到最新命令面
7
+ - **141 单测**(+6)
8
+
3
9
  ## 0.73.0(2026-10-17)引导增强 + Token 优化 + A2A 修复
4
10
  - **首启引导**:无数据库时显示 Welcome + 3 步入门指南
5
11
  - **空态引导**:列表为空时显示具体命令建议(kb/project/task)
@@ -4670,6 +4670,84 @@ function run$12(env, action, rest, args) {
4670
4670
  });
4671
4671
  return 0;
4672
4672
  }
4673
+ case "export-markdown": {
4674
+ const lines = [];
4675
+ lines.push(`# ygl-trees Workspace Report`);
4676
+ lines.push(`> Generated: ${(/* @__PURE__ */ new Date()).toISOString()}`);
4677
+ lines.push("");
4678
+ const counts = {};
4679
+ for (const t of [
4680
+ "projects",
4681
+ "sources",
4682
+ "evidence",
4683
+ "claims",
4684
+ "kb_notes",
4685
+ "skills",
4686
+ "trees",
4687
+ "nodes",
4688
+ "artifacts",
4689
+ "events"
4690
+ ]) try {
4691
+ counts[t] = db.get(`SELECT COUNT(*) as n FROM ${t}`)?.n || 0;
4692
+ } catch {
4693
+ counts[t] = 0;
4694
+ }
4695
+ lines.push(`## Summary`);
4696
+ lines.push("");
4697
+ lines.push(`| Entity | Count |`);
4698
+ lines.push(`|---|---|`);
4699
+ const labels = {
4700
+ projects: "项目",
4701
+ sources: "来源",
4702
+ evidence: "证据",
4703
+ claims: "断言",
4704
+ kb_notes: "知识",
4705
+ skills: "技能",
4706
+ trees: "树",
4707
+ nodes: "节点",
4708
+ artifacts: "产出",
4709
+ events: "事件"
4710
+ };
4711
+ for (const [k, v] of Object.entries(counts)) lines.push(`| ${labels[k] || k} | ${v} |`);
4712
+ lines.push("");
4713
+ lines.push(`## Projects`);
4714
+ const projects = db.all("SELECT name, question, created FROM projects ORDER BY created DESC LIMIT 10");
4715
+ for (const p of projects) lines.push(`- **${p.name}**: ${p.question || "(no question)"}`);
4716
+ lines.push("");
4717
+ lines.push(`## Recent Claims`);
4718
+ const claims = db.all("SELECT text, status, confidence FROM claims ORDER BY created DESC LIMIT 10");
4719
+ for (const c of claims) lines.push(`- [${c.status}] ${String(c.text).slice(0, 80)}... (${c.confidence})`);
4720
+ lines.push("");
4721
+ lines.push(`## Knowledge Notes`);
4722
+ const kb = db.all("SELECT title, tags, confidence FROM kb_notes ORDER BY created DESC LIMIT 10");
4723
+ for (const k of kb) lines.push(`- **${String(k.title).slice(0, 50)}** ${k.tags ? `(${k.tags})` : ""} [${k.confidence}]`);
4724
+ lines.push("");
4725
+ lines.push(`## Trees`);
4726
+ const trees = db.all("SELECT name FROM trees");
4727
+ for (const t of trees) {
4728
+ const nodes = db.get("SELECT COUNT(*) as n FROM nodes WHERE tree_id=(SELECT id FROM trees WHERE name=?)", [t.name])?.n || 0;
4729
+ lines.push(`- **${t.name}** (${nodes} nodes)`);
4730
+ }
4731
+ lines.push("");
4732
+ lines.push(`---`);
4733
+ lines.push(`*Auto-generated by ygl-trees db export-markdown*`);
4734
+ const md = lines.join("\n");
4735
+ const outPath = rest[0];
4736
+ if (outPath) {
4737
+ node_fs.writeFileSync(outPath, md);
4738
+ ok(ctx, `markdown report saved: ${outPath} (${md.length} chars)`);
4739
+ } else {
4740
+ if (ctx.json) {
4741
+ console.log(JSON.stringify({
4742
+ markdown: md,
4743
+ chars: md.length
4744
+ }, null, 2));
4745
+ return 0;
4746
+ }
4747
+ out(ctx, md);
4748
+ }
4749
+ return 0;
4750
+ }
4673
4751
  case "time-travel": {
4674
4752
  const when = rest[0];
4675
4753
  if (!when) {
@@ -133,6 +133,76 @@ function run(env, action, rest, args) {
133
133
  (0, fmt_1.show)(ctx, { file, size_kb: (fs.statSync(file).size / 1024).toFixed(1), ...s });
134
134
  return 0;
135
135
  }
136
+ case "export-markdown": {
137
+ // v2: auto-generated workspace report in markdown
138
+ const lines = [];
139
+ lines.push(`# ygl-trees Workspace Report`);
140
+ lines.push(`> Generated: ${new Date().toISOString()}`);
141
+ lines.push("");
142
+ // Metrics
143
+ const counts = {};
144
+ for (const t of ["projects", "sources", "evidence", "claims", "kb_notes", "skills", "trees", "nodes", "artifacts", "events"]) {
145
+ try {
146
+ counts[t] = db.get(`SELECT COUNT(*) as n FROM ${t}`)?.n || 0;
147
+ }
148
+ catch {
149
+ counts[t] = 0;
150
+ }
151
+ }
152
+ lines.push(`## Summary`);
153
+ lines.push("");
154
+ lines.push(`| Entity | Count |`);
155
+ lines.push(`|---|---|`);
156
+ const labels = { projects: "项目", sources: "来源", evidence: "证据", claims: "断言", kb_notes: "知识", skills: "技能", trees: "树", nodes: "节点", artifacts: "产出", events: "事件" };
157
+ for (const [k, v] of Object.entries(counts))
158
+ lines.push(`| ${labels[k] || k} | ${v} |`);
159
+ lines.push("");
160
+ // Projects
161
+ lines.push(`## Projects`);
162
+ const projects = db.all("SELECT name, question, created FROM projects ORDER BY created DESC LIMIT 10");
163
+ for (const p of projects) {
164
+ lines.push(`- **${p.name}**: ${p.question || "(no question)"}`);
165
+ }
166
+ lines.push("");
167
+ // Recent claims
168
+ lines.push(`## Recent Claims`);
169
+ const claims = db.all("SELECT text, status, confidence FROM claims ORDER BY created DESC LIMIT 10");
170
+ for (const c of claims) {
171
+ lines.push(`- [${c.status}] ${String(c.text).slice(0, 80)}... (${c.confidence})`);
172
+ }
173
+ lines.push("");
174
+ // Knowledge
175
+ lines.push(`## Knowledge Notes`);
176
+ const kb = db.all("SELECT title, tags, confidence FROM kb_notes ORDER BY created DESC LIMIT 10");
177
+ for (const k of kb) {
178
+ lines.push(`- **${String(k.title).slice(0, 50)}** ${k.tags ? `(${k.tags})` : ""} [${k.confidence}]`);
179
+ }
180
+ lines.push("");
181
+ // Trees
182
+ lines.push(`## Trees`);
183
+ const trees = db.all("SELECT name FROM trees");
184
+ for (const t of trees) {
185
+ const nodes = db.get("SELECT COUNT(*) as n FROM nodes WHERE tree_id=(SELECT id FROM trees WHERE name=?)", [t.name])?.n || 0;
186
+ lines.push(`- **${t.name}** (${nodes} nodes)`);
187
+ }
188
+ lines.push("");
189
+ lines.push(`---`);
190
+ lines.push(`*Auto-generated by ygl-trees db export-markdown*`);
191
+ const md = lines.join("\n");
192
+ const outPath = rest[0];
193
+ if (outPath) {
194
+ fs.writeFileSync(outPath, md);
195
+ (0, fmt_1.ok)(ctx, `markdown report saved: ${outPath} (${md.length} chars)`);
196
+ }
197
+ else {
198
+ if (ctx.json) {
199
+ console.log(JSON.stringify({ markdown: md, chars: md.length }, null, 2));
200
+ return 0;
201
+ }
202
+ (0, fmt_1.out)(ctx, md);
203
+ }
204
+ return 0;
205
+ }
136
206
  case "time-travel": {
137
207
  // v2: query workspace state at a past moment using entity created_at
138
208
  const when = rest[0];
package/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # ygl-trees v0.73.0 — AI Agent Research Workbench
1
+ # ygl-trees v0.74.0 — AI Agent Research Workbench
2
2
 
3
3
  > Single SQLite source of truth. Research → Production → Knowledge Reuse + Tech Tree.
4
4
  > CLI for AI agents: every command supports --json (machine-readable, including errors).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ygl-trees",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
4
4
  "description": "猿光 · 科技树 — database-centric CLI for research → production → knowledge reuse, built for AI agents.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/apps/cli/index.js",
@@ -25,9 +25,9 @@
25
25
  "reflect-metadata": "^0.2.2",
26
26
  "typeorm": "^1.1.2",
27
27
  "@deepseek-ai/cordis": "~4.0.5-alpha.2",
28
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.2",
28
29
  "@deepseek-ai/cordis-plugin-timer": "~1.1.7-alpha.2",
29
- "@deepseek-ai/cosmokit": "~1.8.6-alpha.2",
30
- "@deepseek-ai/schemastery": "~3.18.5-alpha.2"
30
+ "@deepseek-ai/cosmokit": "~1.8.6-alpha.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^20.0.0",