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