zugzbot 1.0.22 → 1.0.24
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/bin/init.js +40 -2
- package/opencode.json +2 -1
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -13,13 +13,14 @@ const green = '\x1b[32m';
|
|
|
13
13
|
const cyan = '\x1b[36m';
|
|
14
14
|
const yellow = '\x1b[33m';
|
|
15
15
|
const red = '\x1b[31m';
|
|
16
|
+
const orange = '\x1b[38;5;208m';
|
|
16
17
|
const bold = '\x1b[1m';
|
|
17
18
|
|
|
18
19
|
const pkgRoot = join(__dirname, '..');
|
|
19
20
|
const targetDir = process.cwd();
|
|
20
21
|
|
|
21
22
|
const banner = `
|
|
22
|
-
${bold}${
|
|
23
|
+
${bold}${orange}███████╗██╗ ██╗ ██████╗ ███████╗
|
|
23
24
|
╚══███╔╝██║ ██║██╔════╝ ╚══███╔╝
|
|
24
25
|
███╔╝ ██║ ██║██║ ███╗ ███╔╝
|
|
25
26
|
███╔╝ ██║ ██║██║ ██║ ███╔╝
|
|
@@ -87,12 +88,13 @@ for (const item of itemsToCopy) {
|
|
|
87
88
|
console.error(`${red}❌ Error copying ${item.name}: ${error.message}${reset}`);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
// Ensure .openspec directory
|
|
91
|
+
// Ensure .openspec directory, active-brief.md and sdd_state.json exist on target with a clean state
|
|
91
92
|
try {
|
|
92
93
|
const openspecDir = join(targetDir, '.openspec');
|
|
93
94
|
if (!fs.existsSync(openspecDir)) {
|
|
94
95
|
fs.mkdirSync(openspecDir, { recursive: true });
|
|
95
96
|
}
|
|
97
|
+
|
|
96
98
|
const activeBriefPath = join(openspecDir, 'active-brief.md');
|
|
97
99
|
if (!fs.existsSync(activeBriefPath)) {
|
|
98
100
|
fs.writeFileSync(
|
|
@@ -101,10 +103,46 @@ try {
|
|
|
101
103
|
"utf8"
|
|
102
104
|
);
|
|
103
105
|
}
|
|
106
|
+
|
|
107
|
+
const sddStatePath = join(openspecDir, 'sdd_state.json');
|
|
108
|
+
if (!fs.existsSync(sddStatePath)) {
|
|
109
|
+
const cleanState = {
|
|
110
|
+
phase: "F0_DETECT",
|
|
111
|
+
activeContract: "",
|
|
112
|
+
stack: {
|
|
113
|
+
core: [],
|
|
114
|
+
databases: []
|
|
115
|
+
},
|
|
116
|
+
loopMode: false,
|
|
117
|
+
loopTargetIterations: 1,
|
|
118
|
+
loopCurrentIteration: 1,
|
|
119
|
+
rollbackCount: 0,
|
|
120
|
+
updatedAt: new Date().toISOString()
|
|
121
|
+
};
|
|
122
|
+
fs.writeFileSync(sddStatePath, JSON.stringify(cleanState, null, 2), "utf8");
|
|
123
|
+
}
|
|
104
124
|
} catch (error) {
|
|
105
125
|
console.error(`${red}❌ Error creating .openspec directory: ${error.message}${reset}`);
|
|
106
126
|
}
|
|
107
127
|
|
|
128
|
+
// Ensure .openspec/ is ignored in the target's .gitignore to avoid propagating local state
|
|
129
|
+
try {
|
|
130
|
+
const gitignorePath = join(targetDir, '.gitignore');
|
|
131
|
+
let gitignoreContent = '';
|
|
132
|
+
if (fs.existsSync(gitignorePath)) {
|
|
133
|
+
gitignoreContent = fs.readFileSync(gitignorePath, 'utf8');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const ignoreRule = '.openspec/';
|
|
137
|
+
if (!gitignoreContent.split(/\r?\n/).some(line => line.trim() === ignoreRule)) {
|
|
138
|
+
const separator = gitignoreContent.endsWith('\n') || gitignoreContent === '' ? '' : '\n';
|
|
139
|
+
fs.appendFileSync(gitignorePath, `${separator}${ignoreRule}\n`, 'utf8');
|
|
140
|
+
console.log(` ${green}✔ Added .openspec/ to .gitignore${reset}`);
|
|
141
|
+
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
console.error(`${red}❌ Error updating .gitignore: ${error.message}${reset}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
108
146
|
if (copiedCount > 0) {
|
|
109
147
|
console.log(`\n${bold}${green}✨ ¡Arnés de Zugzbot instalado y actualizado con éxito!${reset}`);
|
|
110
148
|
console.log(`🚀 Ejecuta ${bold}${cyan}opencode${reset} para iniciar tu sesión de desarrollo autónomo.\n`);
|
package/opencode.json
CHANGED