s9n-devops-agent 1.5.3 → 1.5.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
5
5
  "type": "module",
6
6
  "main": "src/cs-devops-agent-worker.js",
@@ -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.includes(this.sessionId) && file.endsWith('.json')) {
207
- return path.join(this.activeEditsDir, file);
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
- // Try to find by session ID in content
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(`\n${CONFIG.colors.green}To update, run:${CONFIG.colors.reset}`);
178
- console.log(` ${CONFIG.colors.bright}npm install -g s9n-devops-agent@latest${CONFIG.colors.reset}`);
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) {
@@ -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.3 | Build 20251009.5"
44
+ echo " Version 1.5.5 | Build 20251009.7"
45
45
  echo " "
46
46
  echo " Copyright (c) 2024 SecondBrain Labs"
47
47
  echo " Author: Sachin Dev Duggal"
@@ -183,13 +183,36 @@ 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
+ # In zsh, arrays are 1-indexed, so $choice maps directly
186
187
  local selected_file="${session_files[$choice]}"
188
+
189
+ # Validate that the file exists
190
+ if [[ ! -f "$selected_file" ]]; then
191
+ echo -e "${RED}Error: Session file not found: $selected_file${NC}"
192
+ return 1
193
+ fi
194
+
187
195
  local session_data=$(cat "$selected_file")
196
+
197
+ # Validate session data was read
198
+ if [[ -z "$session_data" ]]; then
199
+ echo -e "${RED}Error: Could not read session data from: $selected_file${NC}"
200
+ return 1
201
+ fi
202
+
188
203
  local session_id=$(echo "$session_data" | grep -o '"sessionId"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*: *"\([^"]*\)".*/\1/')
189
204
  local worktree_path=$(echo "$session_data" | grep -o '"worktreePath"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*: *"\([^"]*\)".*/\1/')
190
205
  local task=$(echo "$session_data" | grep -o '"task"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*: *"\([^"]*\)".*/\1/')
191
206
  local branch_name=$(echo "$session_data" | grep -o '"branchName"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*: *"\([^"]*\)".*/\1/')
192
207
 
208
+ # Validate we got a session ID
209
+ if [[ -z "$session_id" ]]; then
210
+ echo -e "${RED}Error: Could not extract session ID from file: $selected_file${NC}"
211
+ echo -e "${YELLOW}File contents:${NC}"
212
+ cat "$selected_file"
213
+ return 1
214
+ fi
215
+
193
216
  echo
194
217
  echo -e "${GREEN}Using existing session: ${session_id}${NC}"
195
218