@cluesmith/codev 1.5.26 → 1.5.28

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.
Files changed (35) hide show
  1. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  2. package/dist/agent-farm/commands/tower.js +93 -7
  3. package/dist/agent-farm/commands/tower.js.map +1 -1
  4. package/dist/agent-farm/db/schema.d.ts +1 -1
  5. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  6. package/dist/agent-farm/db/schema.js +2 -1
  7. package/dist/agent-farm/db/schema.js.map +1 -1
  8. package/dist/agent-farm/db/types.d.ts +1 -0
  9. package/dist/agent-farm/db/types.d.ts.map +1 -1
  10. package/dist/agent-farm/db/types.js +1 -0
  11. package/dist/agent-farm/db/types.js.map +1 -1
  12. package/dist/agent-farm/servers/dashboard-server.js +102 -0
  13. package/dist/agent-farm/servers/dashboard-server.js.map +1 -1
  14. package/dist/agent-farm/servers/tower-server.js +37 -5
  15. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  16. package/dist/agent-farm/state.d.ts.map +1 -1
  17. package/dist/agent-farm/state.js +5 -3
  18. package/dist/agent-farm/state.js.map +1 -1
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +23 -5
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/doctor.d.ts.map +1 -1
  23. package/dist/commands/doctor.js +94 -22
  24. package/dist/commands/doctor.js.map +1 -1
  25. package/dist/lib/scaffold.js +1 -1
  26. package/dist/lib/scaffold.js.map +1 -1
  27. package/package.json +1 -1
  28. package/skeleton/roles/architect.md +39 -22
  29. package/skeleton/roles/builder.md +174 -98
  30. package/skeleton/templates/cheatsheet.md +170 -0
  31. package/skeleton/templates/lifecycle.md +147 -0
  32. package/templates/dashboard/css/layout.css +9 -0
  33. package/templates/dashboard/index.html +17 -0
  34. package/templates/dashboard/js/dialogs.js +86 -2
  35. package/templates/dashboard/js/main.js +5 -0
@@ -82,6 +82,23 @@
82
82
  </div>
83
83
  </div>
84
84
 
85
+ <!-- Create file dialog (Bugfix #131) -->
86
+ <div class="dialog-overlay hidden" id="create-file-dialog">
87
+ <div class="dialog">
88
+ <h3>Create New File</h3>
89
+ <div class="quick-paths">
90
+ <button class="quick-path" onclick="setCreateFilePath('codev/specs/')">codev/specs/</button>
91
+ <button class="quick-path" onclick="setCreateFilePath('codev/plans/')">codev/plans/</button>
92
+ <button class="quick-path" onclick="setCreateFilePath('src/')">src/</button>
93
+ </div>
94
+ <input type="text" id="create-file-path-input" placeholder="Enter file path (e.g., src/utils/helper.ts)" />
95
+ <div class="dialog-actions">
96
+ <button class="btn" onclick="hideCreateFileDialog()">Cancel</button>
97
+ <button class="btn btn-primary" onclick="createFile()">Create</button>
98
+ </div>
99
+ </div>
100
+ </div>
101
+
85
102
  <!-- Close confirmation dialog -->
86
103
  <div class="dialog-overlay hidden" id="close-dialog">
87
104
  <div class="dialog">
@@ -1,7 +1,7 @@
1
1
  // Dialog, Context Menu, and Tab Close Functions
2
2
 
3
3
  // Close tab
4
- function closeTab(tabId, event) {
4
+ async function closeTab(tabId, event) {
5
5
  const tab = tabs.find(t => t.id === tabId);
6
6
  if (!tab) return;
7
7
 
@@ -17,7 +17,23 @@ function closeTab(tabId, event) {
17
17
  return;
18
18
  }
19
19
 
20
- // Show confirmation for builders and shells
20
+ // Check if process is still running before showing confirmation (Bugfix #132)
21
+ // If the shell/builder already exited, close immediately without confirmation
22
+ try {
23
+ const response = await fetch(`/api/tabs/${encodeURIComponent(tabId)}/running`);
24
+ if (response.ok) {
25
+ const { running } = await response.json();
26
+ if (!running) {
27
+ // Process already exited, close without confirmation
28
+ doCloseTab(tabId);
29
+ return;
30
+ }
31
+ }
32
+ } catch {
33
+ // On error, fall through to show confirmation (safer default)
34
+ }
35
+
36
+ // Show confirmation for builders and shells with running processes
21
37
  pendingCloseTabId = tabId;
22
38
  const dialog = document.getElementById('close-dialog');
23
39
  const title = document.getElementById('close-dialog-title');
@@ -164,6 +180,74 @@ async function openFile() {
164
180
  await openFileTab(path, { onSuccess: hideFileDialog });
165
181
  }
166
182
 
183
+ // ========================================
184
+ // Create File Dialog (Bugfix #131)
185
+ // ========================================
186
+
187
+ // Show create file dialog
188
+ function showCreateFileDialog() {
189
+ document.getElementById('create-file-dialog').classList.remove('hidden');
190
+ const input = document.getElementById('create-file-path-input');
191
+ input.value = '';
192
+ input.focus();
193
+ }
194
+
195
+ // Hide create file dialog
196
+ function hideCreateFileDialog() {
197
+ document.getElementById('create-file-dialog').classList.add('hidden');
198
+ document.getElementById('create-file-path-input').value = '';
199
+ }
200
+
201
+ // Set quick path for create file dialog
202
+ function setCreateFilePath(path) {
203
+ const input = document.getElementById('create-file-path-input');
204
+ input.value = path;
205
+ input.focus();
206
+ // Move cursor to end
207
+ input.setSelectionRange(path.length, path.length);
208
+ }
209
+
210
+ // Create a new file
211
+ async function createFile() {
212
+ const input = document.getElementById('create-file-path-input');
213
+ const filePath = input.value.trim();
214
+
215
+ if (!filePath) {
216
+ showToast('Please enter a file path', 'error');
217
+ return;
218
+ }
219
+
220
+ // Basic validation - prevent absolute paths and path traversal
221
+ if (filePath.startsWith('/') || filePath.includes('..')) {
222
+ showToast('Invalid file path', 'error');
223
+ return;
224
+ }
225
+
226
+ try {
227
+ const response = await fetch('/api/files', {
228
+ method: 'POST',
229
+ headers: { 'Content-Type': 'application/json' },
230
+ body: JSON.stringify({ path: filePath, content: '' })
231
+ });
232
+
233
+ const result = await response.json();
234
+
235
+ if (!response.ok) {
236
+ showToast(result.error || 'Failed to create file', 'error');
237
+ return;
238
+ }
239
+
240
+ hideCreateFileDialog();
241
+ showToast(`Created ${filePath}`, 'success');
242
+
243
+ // Refresh files tree and open the new file
244
+ await refreshFilesTree();
245
+ await openFileTab(filePath, { showSwitchToast: false });
246
+ } catch (err) {
247
+ showToast('Network error: ' + err.message, 'error');
248
+ }
249
+ }
250
+
167
251
  // Spawn worktree builder
168
252
  async function spawnBuilder() {
169
253
  try {
@@ -128,6 +128,7 @@ function renderDashboardTabContent() {
128
128
  <div class="dashboard-section-header" onclick="toggleSection('files')">
129
129
  <h3><span class="collapse-icon">▼</span> Files</h3>
130
130
  <div class="header-actions" onclick="event.stopPropagation()">
131
+ <button onclick="showCreateFileDialog()" title="Create New File">+</button>
131
132
  <button onclick="refreshFilesTree()" title="Refresh">↻</button>
132
133
  <button onclick="collapseAllFolders()" title="Collapse All">⊟</button>
133
134
  <button onclick="expandAllFolders()" title="Expand All">⊞</button>
@@ -243,6 +244,7 @@ function setupKeyboardShortcuts() {
243
244
  if (e.key === 'Escape') {
244
245
  hideFileDialog();
245
246
  hideCloseDialog();
247
+ hideCreateFileDialog();
246
248
  hideContextMenu();
247
249
  hideOverflowMenu();
248
250
  const activityModal = document.getElementById('activity-modal');
@@ -259,6 +261,9 @@ function setupKeyboardShortcuts() {
259
261
  if (!document.getElementById('file-dialog').classList.contains('hidden')) {
260
262
  openFile();
261
263
  }
264
+ if (!document.getElementById('create-file-dialog').classList.contains('hidden')) {
265
+ createFile();
266
+ }
262
267
  }
263
268
 
264
269
  // Ctrl+Tab / Ctrl+Shift+Tab to switch tabs