s9n-devops-agent 1.5.4 → 1.5.6
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/package.json +1 -1
- package/src/file-coordinator.cjs +19 -3
- package/src/session-coordinator.js +31 -2
- package/start-devops-session.sh +11 -1
package/package.json
CHANGED
package/src/file-coordinator.cjs
CHANGED
|
@@ -194,6 +194,8 @@ class FileCoordinator {
|
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
196
|
* Find our current declaration file
|
|
197
|
+
* Matches files like: warp-8sf9-c9ea.json or claude-8sf9-c9ea.json
|
|
198
|
+
* where sessionId is 8sf9-c9ea
|
|
197
199
|
*/
|
|
198
200
|
findOurDeclaration() {
|
|
199
201
|
if (!fs.existsSync(this.activeEditsDir)) {
|
|
@@ -202,13 +204,27 @@ class FileCoordinator {
|
|
|
202
204
|
|
|
203
205
|
const files = fs.readdirSync(this.activeEditsDir);
|
|
204
206
|
|
|
207
|
+
// First try: Look for session ID in filename (with or without agent prefix)
|
|
208
|
+
// Handles: warp-8sf9-c9ea.json, claude-8sf9-c9ea.json, 8sf9-c9ea.json
|
|
205
209
|
for (const file of files) {
|
|
206
|
-
if (file.
|
|
207
|
-
|
|
210
|
+
if (file.endsWith('.json')) {
|
|
211
|
+
// Extract potential session ID from filename
|
|
212
|
+
// Remove .json extension
|
|
213
|
+
const baseName = file.replace('.json', '');
|
|
214
|
+
|
|
215
|
+
// Check if filename ends with our session ID (handles agent-sessionId format)
|
|
216
|
+
if (baseName.endsWith(this.sessionId) || baseName === this.sessionId) {
|
|
217
|
+
return path.join(this.activeEditsDir, file);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Also check if session ID appears anywhere in the filename
|
|
221
|
+
if (file.includes(this.sessionId)) {
|
|
222
|
+
return path.join(this.activeEditsDir, file);
|
|
223
|
+
}
|
|
208
224
|
}
|
|
209
225
|
}
|
|
210
226
|
|
|
211
|
-
//
|
|
227
|
+
// Second try: Look for session ID in file content
|
|
212
228
|
for (const file of files) {
|
|
213
229
|
if (file.endsWith('.json')) {
|
|
214
230
|
try {
|
|
@@ -174,8 +174,37 @@ class SessionCoordinator {
|
|
|
174
174
|
console.log(`\n${CONFIG.colors.yellow}▲ Update Available!${CONFIG.colors.reset}`);
|
|
175
175
|
console.log(`${CONFIG.colors.dim}Current version: ${this.currentVersion}${CONFIG.colors.reset}`);
|
|
176
176
|
console.log(`${CONFIG.colors.bright}Latest version: ${result}${CONFIG.colors.reset}`);
|
|
177
|
-
console.log(
|
|
178
|
-
|
|
177
|
+
console.log();
|
|
178
|
+
|
|
179
|
+
// Ask if user wants to update now
|
|
180
|
+
const rl = readline.createInterface({
|
|
181
|
+
input: process.stdin,
|
|
182
|
+
output: process.stdout
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
const updateNow = await new Promise((resolve) => {
|
|
186
|
+
rl.question(`${CONFIG.colors.green}Would you like to update now? (Y/n):${CONFIG.colors.reset} `, (answer) => {
|
|
187
|
+
rl.close();
|
|
188
|
+
resolve(answer.toLowerCase() !== 'n');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
if (updateNow) {
|
|
193
|
+
console.log(`\n${CONFIG.colors.blue}Updating s9n-devops-agent...${CONFIG.colors.reset}`);
|
|
194
|
+
try {
|
|
195
|
+
execSync('npm install -g s9n-devops-agent@latest', {
|
|
196
|
+
stdio: 'inherit',
|
|
197
|
+
cwd: process.cwd()
|
|
198
|
+
});
|
|
199
|
+
console.log(`\n${CONFIG.colors.green}✓ Update complete! Please restart the agent.${CONFIG.colors.reset}`);
|
|
200
|
+
process.exit(0);
|
|
201
|
+
} catch (err) {
|
|
202
|
+
console.log(`\n${CONFIG.colors.red}✗ Update failed: ${err.message}${CONFIG.colors.reset}`);
|
|
203
|
+
console.log(`${CONFIG.colors.dim}You can manually update with: npm install -g s9n-devops-agent@latest${CONFIG.colors.reset}`);
|
|
204
|
+
}
|
|
205
|
+
} else {
|
|
206
|
+
console.log(`${CONFIG.colors.dim}You can update later with: npm install -g s9n-devops-agent@latest${CONFIG.colors.reset}`);
|
|
207
|
+
}
|
|
179
208
|
console.log();
|
|
180
209
|
}
|
|
181
210
|
} catch (err) {
|
package/start-devops-session.sh
CHANGED
|
@@ -41,7 +41,7 @@ show_copyright() {
|
|
|
41
41
|
echo "======================================================================"
|
|
42
42
|
echo
|
|
43
43
|
echo " CS_DevOpsAgent - Intelligent Git Automation System"
|
|
44
|
-
echo " Version 1.5.
|
|
44
|
+
echo " Version 1.5.6 | Build 20251009.8"
|
|
45
45
|
echo " "
|
|
46
46
|
echo " Copyright (c) 2024 SecondBrain Labs"
|
|
47
47
|
echo " Author: Sachin Dev Duggal"
|
|
@@ -183,12 +183,22 @@ select_session() {
|
|
|
183
183
|
return 0
|
|
184
184
|
elif [[ "$choice" =~ ^[0-9]+$ ]] && [[ "$choice" -ge 1 ]] && [[ "$choice" -le "${#session_files[@]}" ]]; then
|
|
185
185
|
# Use existing session
|
|
186
|
+
# Debug: Show what we're trying to access
|
|
187
|
+
echo -e "${DIM}[Debug] Choice: $choice, Array size: ${#session_files[@]}${NC}"
|
|
188
|
+
echo -e "${DIM}[Debug] Array contents: ${session_files[@]}${NC}"
|
|
189
|
+
|
|
186
190
|
# In zsh, arrays are 1-indexed, so $choice maps directly
|
|
187
191
|
local selected_file="${session_files[$choice]}"
|
|
188
192
|
|
|
193
|
+
echo -e "${DIM}[Debug] Selected file: $selected_file${NC}"
|
|
194
|
+
|
|
189
195
|
# Validate that the file exists
|
|
190
196
|
if [[ ! -f "$selected_file" ]]; then
|
|
191
197
|
echo -e "${RED}Error: Session file not found: $selected_file${NC}"
|
|
198
|
+
echo -e "${YELLOW}All files in array:${NC}"
|
|
199
|
+
for idx in "${!session_files[@]}"; do
|
|
200
|
+
echo -e " [$idx] = ${session_files[$idx]}"
|
|
201
|
+
done
|
|
192
202
|
return 1
|
|
193
203
|
fi
|
|
194
204
|
|