zugzbot 1.0.31 → 1.0.33
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.
|
@@ -2,14 +2,8 @@
|
|
|
2
2
|
description: Muestra el estado activo actual del ciclo de desarrollo SDD
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
Por favor, muestra y resume de forma muy concisa el siguiente estado activo actual de desarrollo SDD:
|
|
5
|
+
Por favor, muestra y resume de forma muy concisa el siguiente estado activo actual de desarrollo SDD y el índice del Brain obtenido de forma nativa:
|
|
6
6
|
|
|
7
7
|
```json
|
|
8
|
-
!`
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Y resume el índice actual de categorías de memoria del cerebro del proyecto (Brain):
|
|
12
|
-
|
|
13
|
-
```json
|
|
14
|
-
!`npx tsx -e "import { read_memory } from './.opencode/tools/brain.ts'; read_memory.execute({}, {worktree: '.'}).then(res => console.log(JSON.stringify(res, null, 2)))"`
|
|
8
|
+
!`bun -e "import status from './.opencode/tools/sdd_status.ts'; status.execute({}, {worktree: '.'}).then(res => console.log(res))"`
|
|
15
9
|
```
|
|
@@ -508,12 +508,10 @@ const PluginTuiSidebar: TuiPlugin = async (api) => {
|
|
|
508
508
|
}
|
|
509
509
|
|
|
510
510
|
const logoLines = [
|
|
511
|
-
"
|
|
512
|
-
"
|
|
513
|
-
" ███╔╝
|
|
514
|
-
"
|
|
515
|
-
"███████╗╚██████╔╝╚██████╔╝███████╗",
|
|
516
|
-
"╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝"
|
|
511
|
+
" ██████╗ ██╗ ██╗ ██████╗ ███████╗",
|
|
512
|
+
"╚══███╔╝ ██║ ██║██╔════╝ ╚══███╔╝",
|
|
513
|
+
" ███╔╝ ██║ ██║██║ ███╗ ███╔╝ ",
|
|
514
|
+
"███████╗ ╚██████╔╝╚██████╔╝███████╗"
|
|
517
515
|
]
|
|
518
516
|
|
|
519
517
|
updateSessionIds()
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin"
|
|
2
|
+
import fs from "fs"
|
|
3
|
+
import path from "path"
|
|
4
|
+
|
|
5
|
+
const getRoot = (context: any) => {
|
|
6
|
+
if (context?.directory && context.directory !== "/") return context.directory;
|
|
7
|
+
if (context?.worktree && context.worktree !== "/") return context.worktree;
|
|
8
|
+
if (context?.cwd && context.cwd !== "/") return context.cwd;
|
|
9
|
+
return process.cwd();
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default tool({
|
|
13
|
+
description: "Obtiene de forma nativa y unificada el estado del ciclo SDD (.openspec/sdd_state.json) junto con un resumen de las categorías de memoria del cerebro (Brain). Evita llamadas lentas de consola y es multiplataforma.",
|
|
14
|
+
args: {},
|
|
15
|
+
async execute(args, context) {
|
|
16
|
+
const root = getRoot(context)
|
|
17
|
+
const statePath = path.resolve(root, ".openspec/sdd_state.json")
|
|
18
|
+
const brainPath = path.resolve(root, ".openspec/brain.md")
|
|
19
|
+
|
|
20
|
+
let sddState = {
|
|
21
|
+
phase: "F0_DETECT",
|
|
22
|
+
activeContract: "",
|
|
23
|
+
stack: { core: [], databases: [] },
|
|
24
|
+
loopMode: false,
|
|
25
|
+
loopTargetIterations: 1,
|
|
26
|
+
loopCurrentIteration: 1,
|
|
27
|
+
rollbackCount: 0,
|
|
28
|
+
updatedAt: ""
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (fs.existsSync(statePath)) {
|
|
32
|
+
try {
|
|
33
|
+
sddState = JSON.parse(fs.readFileSync(statePath, "utf8"))
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// ignore parsing errors
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const availableCategories: Record<string, { entriesCount: number, preview: string }> = {}
|
|
40
|
+
let brainTitle = "Zugzbot Brain - Memory and Learnings"
|
|
41
|
+
let brainExists = false
|
|
42
|
+
|
|
43
|
+
if (fs.existsSync(brainPath)) {
|
|
44
|
+
brainExists = true
|
|
45
|
+
try {
|
|
46
|
+
const content = fs.readFileSync(brainPath, "utf8") || ""
|
|
47
|
+
const lines = content.split(/\r?\n/)
|
|
48
|
+
let startIndex = 0
|
|
49
|
+
if (lines.length > 0 && lines[0] && lines[0].startsWith("# ")) {
|
|
50
|
+
brainTitle = lines[0].substring(2).trim()
|
|
51
|
+
startIndex = 1
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const sections: Record<string, string[]> = {}
|
|
55
|
+
let currentHeader = ""
|
|
56
|
+
|
|
57
|
+
for (let i = startIndex; i < lines.length; i++) {
|
|
58
|
+
const line = lines[i]
|
|
59
|
+
if (line === undefined || line === null) continue
|
|
60
|
+
if (line.startsWith("# ")) {
|
|
61
|
+
currentHeader = line.substring(2).trim().toLowerCase()
|
|
62
|
+
sections[currentHeader] = []
|
|
63
|
+
} else if (line.trim().length > 0 && currentHeader) {
|
|
64
|
+
sections[currentHeader].push(line)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (const [key, valLines] of Object.entries(sections)) {
|
|
69
|
+
const entriesCount = valLines.filter(l => l.startsWith("- ")).length
|
|
70
|
+
const preview = valLines.slice(-2).join("\n") || "(Sección vacía)"
|
|
71
|
+
availableCategories[key] = {
|
|
72
|
+
entriesCount,
|
|
73
|
+
preview
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch (e) {
|
|
77
|
+
// ignore
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const output = {
|
|
82
|
+
sdd_state: sddState,
|
|
83
|
+
brain: {
|
|
84
|
+
exists: brainExists,
|
|
85
|
+
title: brainTitle,
|
|
86
|
+
categories: availableCategories
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return JSON.stringify(output, null, 2)
|
|
91
|
+
}
|
|
92
|
+
})
|
package/opencode.json
CHANGED
package/package.json
CHANGED