agileflow 2.44.0 → 2.46.0

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.
@@ -4,14 +4,6 @@ description: System health diagnostics
4
4
 
5
5
  # diagnose
6
6
 
7
- <!-- STEP 0: ACTIVATION -->
8
- <function_calls>
9
- <invoke name="Bash">
10
- <parameter name="command">node /home/coder/AgileFlow/scripts/activate-command.js diagnose</parameter>
11
- <parameter name="description">Activate diagnose command and show compact summary</parameter>
12
- </invoke>
13
- </function_calls>
14
-
15
7
  Run comprehensive AgileFlow system health checks to identify potential issues before they cause failures.
16
8
 
17
9
  ## Prompt
@@ -250,9 +242,9 @@ else
250
242
  echo "⚠️ Found $JSON_ERRORS issue(s) that need attention."
251
243
  echo ""
252
244
  echo "Next steps:"
253
- echo "1. Fix JSON validation errors using: bash scripts/validate-json.sh <file>"
245
+ echo "1. Fix JSON validation errors using: jq empty <file> to check, then repair manually"
254
246
  echo "2. Add missing files to .gitignore if needed"
255
- echo "3. Run archival if status.json is too large: bash scripts/archive-completed-stories.sh 7"
247
+ echo "3. Run archival if status.json is too large: bash scripts/archive-completed-stories.sh"
256
248
  echo "4. Re-run diagnostics after fixes: /agileflow:diagnose"
257
249
  exit 1
258
250
  fi
@@ -21,7 +21,7 @@ node scripts/obtain-context.js help
21
21
  **PURPOSE**: Immediately load full context before executing any logic.
22
22
 
23
23
  **ACTIONS**:
24
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/help.md` (this file) in its entirety
24
+ 1. Read this command file (`.agileflow/commands/help.md`) in its entirety
25
25
  2. Absorb all instructions, rules, and examples
26
26
  3. Proceed to execution phase with complete context
27
27
 
@@ -21,7 +21,7 @@ node scripts/obtain-context.js packages
21
21
  **PURPOSE**: Immediately load full context before executing any logic.
22
22
 
23
23
  **ACTIONS**:
24
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/packages.md` (this file) in its entirety
24
+ 1. Read this command file (`.agileflow/commands/packages.md`) in its entirety
25
25
  2. Absorb all instructions, rules, and examples
26
26
  3. Proceed to execution phase with complete context
27
27
 
@@ -22,7 +22,7 @@ node scripts/obtain-context.js readme-sync
22
22
  **PURPOSE**: Immediately load full context before executing any logic.
23
23
 
24
24
  **ACTIONS**:
25
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/readme-sync.md` (this file) in its entirety
25
+ 1. Read this command file (`.agileflow/commands/readme-sync.md`) in its entirety
26
26
  2. Absorb all instructions, rules, and examples
27
27
  3. Proceed to execution phase with complete context
28
28
 
@@ -21,7 +21,7 @@ node scripts/obtain-context.js research
21
21
  **PURPOSE**: Immediately load full context before executing any logic.
22
22
 
23
23
  **ACTIONS**:
24
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/research.md` (this file) in its entirety
24
+ 1. Read this command file (`.agileflow/commands/research.md`) in its entirety
25
25
  2. Absorb all instructions, rules, and examples
26
26
  3. Proceed to execution phase with complete context
27
27
 
@@ -24,7 +24,7 @@ This gathers git status, stories/epics, session state, and registers for PreComp
24
24
  **PURPOSE**: Immediately load full context before executing any logic.
25
25
 
26
26
  **ACTIONS**:
27
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/status.md` (this file) in its entirety
27
+ 1. Read this command file (`.agileflow/commands/status.md`) in its entirety
28
28
  2. Absorb all instructions, rules, and examples
29
29
  3. Proceed to execution phase with complete context
30
30
 
@@ -48,7 +48,7 @@ This gathers git status, stories/epics, session state, and registers for PreComp
48
48
  - **Backup**: Restore from docs/09-agents/status.json.backup if validation fails
49
49
  - **Output**: Diff-first, then YES/NO confirmation
50
50
  - **Critical**: User text automatically escaped by jq
51
- - **Related**: docs/09-agents/status.json, bus/log.jsonl, scripts/validate-json.sh
51
+ - **Related**: docs/09-agents/status.json, bus/log.jsonl
52
52
  <!-- COMPACT_SUMMARY_END -->
53
53
 
54
54
  ---
@@ -69,7 +69,7 @@ ACTIONS
69
69
  # Validate status.json after modification
70
70
  if ! jq empty docs/09-agents/status.json 2>/dev/null; then
71
71
  echo "❌ ERROR: status.json is now invalid JSON after update!"
72
- echo "Run: bash scripts/validate-json.sh docs/09-agents/status.json"
72
+ echo "Fix: Use jq to validate and repair the JSON structure"
73
73
  exit 1
74
74
  fi
75
75
  ```
@@ -22,7 +22,7 @@ node scripts/obtain-context.js story-validate
22
22
  **PURPOSE**: Immediately load full context before executing any logic.
23
23
 
24
24
  **ACTIONS**:
25
- 1. Read `/home/coder/AgileFlow/packages/cli/src/core/commands/story-validate.md` (this file) in its entirety
25
+ 1. Read this command file (`.agileflow/commands/story-validate.md`) in its entirety
26
26
  2. Absorb all instructions, rules, and examples
27
27
  3. Proceed to execution phase with complete context
28
28
 
@@ -155,10 +155,10 @@ EXECUTION
155
155
  Run the validation script:
156
156
  ```bash
157
157
  # All domains
158
- bash .agileflow/scripts/validate-expertise.sh
158
+ bash scripts/validate-expertise.sh
159
159
 
160
160
  # Specific domain
161
- bash .agileflow/scripts/validate-expertise.sh database
161
+ bash scripts/validate-expertise.sh database
162
162
  ```
163
163
 
164
164
  Or manually check using Read tool on expertise files in:
@@ -50,6 +50,22 @@ class Installer {
50
50
  this.packageRoot = getPackageRoot();
51
51
  }
52
52
 
53
+ /**
54
+ * Clean up existing content directories before installing.
55
+ * Removes agents/, commands/, skills/, templates/ but preserves _cfg/ and config.yaml.
56
+ * @param {string} agileflowDir - AgileFlow installation directory
57
+ */
58
+ async cleanup(agileflowDir) {
59
+ const dirsToRemove = ['agents', 'commands', 'skills', 'templates'];
60
+
61
+ for (const dir of dirsToRemove) {
62
+ const dirPath = path.join(agileflowDir, dir);
63
+ if (await fs.pathExists(dirPath)) {
64
+ await fs.remove(dirPath);
65
+ }
66
+ }
67
+ }
68
+
53
69
  /**
54
70
  * Install AgileFlow to a project
55
71
  * @param {Object} config - Installation configuration
@@ -91,10 +107,13 @@ class Installer {
91
107
  backupPath = await this.createBackup(agileflowDir, cfgDir, timestamp);
92
108
  }
93
109
 
94
- const fileIndex = existingFileIndex || { schema: 1, files: {} };
95
- if (!fileIndex.files || typeof fileIndex.files !== 'object') {
96
- fileIndex.files = {};
97
- }
110
+ // Clean up existing content directories to remove stale files
111
+ // This happens AFTER backup so we can restore if needed
112
+ spinner.text = 'Cleaning up old content...';
113
+ await this.cleanup(agileflowDir);
114
+
115
+ // Reset file index since we removed all content - start fresh
116
+ const fileIndex = { schema: 1, files: {} };
98
117
 
99
118
  const fileOps = {
100
119
  created: 0,
@@ -132,6 +151,10 @@ class Installer {
132
151
  });
133
152
  }
134
153
 
154
+ // Copy essential scripts to user's scripts/ directory
155
+ spinner.text = 'Installing scripts...';
156
+ await this.installScripts(directory, { force: effectiveForce });
157
+
135
158
  // Create config.yaml
136
159
  spinner.text = 'Creating configuration...';
137
160
  await this.createConfig(agileflowDir, userName, agileflowFolder, { force: effectiveForce });
@@ -575,6 +598,76 @@ class Installer {
575
598
  return counts;
576
599
  }
577
600
 
601
+ /**
602
+ * Install all scripts from packages/cli/scripts/ to user's project scripts/ directory
603
+ * Copies everything automatically - no manual list to maintain
604
+ * @param {string} directory - Project directory
605
+ * @param {Object} options - Installation options
606
+ * @param {boolean} options.force - Overwrite existing scripts
607
+ */
608
+ async installScripts(directory, options = {}) {
609
+ const { force = false } = options;
610
+ const scriptsSourceDir = path.join(this.packageRoot, 'scripts');
611
+ const scriptsDestDir = path.join(directory, 'scripts');
612
+
613
+ // Skip if source scripts directory doesn't exist
614
+ if (!(await fs.pathExists(scriptsSourceDir))) {
615
+ return;
616
+ }
617
+
618
+ // Ensure destination scripts directory exists
619
+ await fs.ensureDir(scriptsDestDir);
620
+
621
+ // Copy all scripts recursively
622
+ await this.copyScriptsRecursive(scriptsSourceDir, scriptsDestDir, force);
623
+ }
624
+
625
+ /**
626
+ * Recursively copy scripts from source to destination
627
+ * @param {string} srcDir - Source directory
628
+ * @param {string} destDir - Destination directory
629
+ * @param {boolean} force - Overwrite existing files
630
+ */
631
+ async copyScriptsRecursive(srcDir, destDir, force) {
632
+ const entries = await fs.readdir(srcDir, { withFileTypes: true });
633
+
634
+ for (const entry of entries) {
635
+ const srcPath = path.join(srcDir, entry.name);
636
+ const destPath = path.join(destDir, entry.name);
637
+
638
+ if (entry.isDirectory()) {
639
+ // Recursively copy subdirectories
640
+ await fs.ensureDir(destPath);
641
+ await this.copyScriptsRecursive(srcPath, destPath, force);
642
+ } else {
643
+ // Copy file
644
+ const destExists = await fs.pathExists(destPath);
645
+
646
+ // If destination exists and not forcing, check if identical
647
+ if (destExists && !force) {
648
+ const srcContent = await fs.readFile(srcPath);
649
+ const destContent = await fs.readFile(destPath);
650
+ if (srcContent.equals(destContent)) {
651
+ continue; // Identical, skip
652
+ }
653
+ // Different content but not forcing, skip to preserve user changes
654
+ continue;
655
+ }
656
+
657
+ // Copy the file
658
+ await fs.copy(srcPath, destPath);
659
+
660
+ // Make executable on Unix for shell scripts and JS files
661
+ if (process.platform !== 'win32') {
662
+ const ext = path.extname(entry.name).toLowerCase();
663
+ if (['.sh', '.js'].includes(ext)) {
664
+ await fs.chmod(destPath, 0o755);
665
+ }
666
+ }
667
+ }
668
+ }
669
+ }
670
+
578
671
  /**
579
672
  * Get installation status
580
673
  * @param {string} directory - Project directory