aether-colony 3.1.5 → 3.1.16

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 (133) hide show
  1. package/.claude/commands/ant/archaeology.md +12 -0
  2. package/.claude/commands/ant/build.md +382 -319
  3. package/.claude/commands/ant/chaos.md +23 -1
  4. package/.claude/commands/ant/colonize.md +147 -87
  5. package/.claude/commands/ant/continue.md +213 -23
  6. package/.claude/commands/ant/council.md +22 -0
  7. package/.claude/commands/ant/dream.md +18 -0
  8. package/.claude/commands/ant/entomb.md +178 -6
  9. package/.claude/commands/ant/init.md +87 -13
  10. package/.claude/commands/ant/lay-eggs.md +45 -5
  11. package/.claude/commands/ant/oracle.md +82 -9
  12. package/.claude/commands/ant/organize.md +2 -2
  13. package/.claude/commands/ant/pause-colony.md +86 -28
  14. package/.claude/commands/ant/phase.md +26 -0
  15. package/.claude/commands/ant/plan.md +204 -111
  16. package/.claude/commands/ant/resume-colony.md +23 -1
  17. package/.claude/commands/ant/resume.md +159 -0
  18. package/.claude/commands/ant/seal.md +177 -3
  19. package/.claude/commands/ant/swarm.md +78 -97
  20. package/.claude/commands/ant/verify-castes.md +7 -7
  21. package/.claude/commands/ant/watch.md +17 -0
  22. package/.opencode/agents/aether-ambassador.md +97 -0
  23. package/.opencode/agents/aether-archaeologist.md +91 -0
  24. package/.opencode/agents/aether-architect.md +66 -0
  25. package/.opencode/agents/aether-auditor.md +111 -0
  26. package/.opencode/agents/aether-builder.md +28 -10
  27. package/.opencode/agents/aether-chaos.md +98 -0
  28. package/.opencode/agents/aether-chronicler.md +80 -0
  29. package/.opencode/agents/aether-gatekeeper.md +107 -0
  30. package/.opencode/agents/aether-guardian.md +107 -0
  31. package/.opencode/agents/aether-includer.md +108 -0
  32. package/.opencode/agents/aether-keeper.md +106 -0
  33. package/.opencode/agents/aether-measurer.md +119 -0
  34. package/.opencode/agents/aether-probe.md +91 -0
  35. package/.opencode/agents/aether-queen.md +72 -19
  36. package/.opencode/agents/aether-route-setter.md +85 -0
  37. package/.opencode/agents/aether-sage.md +98 -0
  38. package/.opencode/agents/aether-scout.md +33 -15
  39. package/.opencode/agents/aether-surveyor-disciplines.md +334 -0
  40. package/.opencode/agents/aether-surveyor-nest.md +272 -0
  41. package/.opencode/agents/aether-surveyor-pathogens.md +209 -0
  42. package/.opencode/agents/aether-surveyor-provisions.md +277 -0
  43. package/.opencode/agents/aether-tracker.md +91 -0
  44. package/.opencode/agents/aether-watcher.md +30 -12
  45. package/.opencode/agents/aether-weaver.md +87 -0
  46. package/.opencode/agents/workers.md +1034 -0
  47. package/.opencode/commands/ant/archaeology.md +44 -26
  48. package/.opencode/commands/ant/build.md +326 -294
  49. package/.opencode/commands/ant/chaos.md +32 -4
  50. package/.opencode/commands/ant/colonize.md +119 -93
  51. package/.opencode/commands/ant/continue.md +98 -10
  52. package/.opencode/commands/ant/council.md +28 -0
  53. package/.opencode/commands/ant/dream.md +24 -0
  54. package/.opencode/commands/ant/entomb.md +73 -1
  55. package/.opencode/commands/ant/feedback.md +8 -2
  56. package/.opencode/commands/ant/flag.md +9 -3
  57. package/.opencode/commands/ant/flags.md +8 -2
  58. package/.opencode/commands/ant/focus.md +8 -2
  59. package/.opencode/commands/ant/help.md +12 -0
  60. package/.opencode/commands/ant/init.md +49 -4
  61. package/.opencode/commands/ant/lay-eggs.md +30 -2
  62. package/.opencode/commands/ant/oracle.md +39 -7
  63. package/.opencode/commands/ant/organize.md +8 -2
  64. package/.opencode/commands/ant/pause-colony.md +54 -1
  65. package/.opencode/commands/ant/phase.md +36 -4
  66. package/.opencode/commands/ant/plan.md +224 -116
  67. package/.opencode/commands/ant/redirect.md +8 -2
  68. package/.opencode/commands/ant/resume-colony.md +51 -26
  69. package/.opencode/commands/ant/seal.md +76 -0
  70. package/.opencode/commands/ant/status.md +50 -20
  71. package/.opencode/commands/ant/swarm.md +108 -104
  72. package/.opencode/commands/ant/tunnels.md +107 -2
  73. package/CHANGELOG.md +16 -0
  74. package/README.md +199 -86
  75. package/bin/cli.js +142 -25
  76. package/bin/generate-commands.sh +100 -16
  77. package/bin/lib/caste-colors.js +5 -5
  78. package/bin/lib/errors.js +16 -0
  79. package/bin/lib/file-lock.js +279 -44
  80. package/bin/lib/state-sync.js +206 -23
  81. package/bin/lib/update-transaction.js +206 -24
  82. package/bin/sync-to-runtime.sh +138 -0
  83. package/package.json +2 -2
  84. package/runtime/CONTEXT.md +160 -0
  85. package/runtime/aether-utils.sh +1421 -55
  86. package/runtime/docs/AETHER-2.0-IMPLEMENTATION-PLAN.md +1343 -0
  87. package/runtime/docs/AETHER-PHEROMONE-SYSTEM-MASTER-SPEC.md +2642 -0
  88. package/runtime/docs/PHEROMONE-INJECTION.md +240 -0
  89. package/runtime/docs/PHEROMONE-INTEGRATION.md +192 -0
  90. package/runtime/docs/PHEROMONE-SYSTEM-DESIGN.md +426 -0
  91. package/runtime/docs/README.md +94 -0
  92. package/runtime/docs/VISUAL-OUTPUT-SPEC.md +219 -0
  93. package/runtime/docs/biological-reference.md +272 -0
  94. package/runtime/docs/codebase-review.md +399 -0
  95. package/runtime/docs/command-sync.md +164 -0
  96. package/runtime/docs/implementation-learnings.md +89 -0
  97. package/runtime/docs/known-issues.md +217 -0
  98. package/runtime/docs/namespace.md +148 -0
  99. package/runtime/docs/planning-discipline.md +159 -0
  100. package/runtime/exchange/pheromone-xml.sh +574 -0
  101. package/runtime/exchange/registry-xml.sh +269 -0
  102. package/runtime/exchange/wisdom-xml.sh +312 -0
  103. package/runtime/lib/queen-utils.sh +729 -0
  104. package/runtime/model-profiles.yaml +100 -0
  105. package/runtime/recover.sh +136 -0
  106. package/runtime/schemas/aether-types.xsd +255 -0
  107. package/runtime/schemas/colony-registry.xsd +309 -0
  108. package/runtime/schemas/pheromone.xsd +163 -0
  109. package/runtime/schemas/prompt.xsd +416 -0
  110. package/runtime/schemas/queen-wisdom.xsd +325 -0
  111. package/runtime/schemas/worker-priming.xsd +276 -0
  112. package/runtime/templates/QUEEN.md.template +79 -0
  113. package/runtime/utils/atomic-write.sh +5 -5
  114. package/runtime/utils/chamber-utils.sh +6 -3
  115. package/runtime/utils/error-handler.sh +200 -0
  116. package/runtime/utils/queen-to-md.xsl +395 -0
  117. package/runtime/utils/spawn-tree.sh +428 -0
  118. package/runtime/utils/spawn-with-model.sh +56 -0
  119. package/runtime/utils/state-loader.sh +215 -0
  120. package/runtime/utils/swarm-display.sh +5 -5
  121. package/runtime/utils/watch-spawn-tree.sh +90 -22
  122. package/runtime/utils/xml-compose.sh +247 -0
  123. package/runtime/utils/xml-core.sh +186 -0
  124. package/runtime/utils/xml-utils.sh +2196 -0
  125. package/runtime/verification-loop.md +1 -1
  126. package/runtime/workers-new-castes.md +516 -0
  127. package/runtime/workers.md +18 -6
  128. package/.aether/visualizations/anthill-stages/brood-stable.txt +0 -26
  129. package/.aether/visualizations/anthill-stages/crowned-anthill.txt +0 -30
  130. package/.aether/visualizations/anthill-stages/first-mound.txt +0 -18
  131. package/.aether/visualizations/anthill-stages/open-chambers.txt +0 -24
  132. package/.aether/visualizations/anthill-stages/sealed-chambers.txt +0 -28
  133. package/.aether/visualizations/anthill-stages/ventilated-nest.txt +0 -27
@@ -39,6 +39,28 @@ log_error() {
39
39
  echo -e "${RED}[ERROR]${NC} $1"
40
40
  }
41
41
 
42
+ # Compute SHA hash with error handling
43
+ # Returns 0 on success, 1 on failure
44
+ # Echoes hash on success, error message on failure
45
+ compute_hash() {
46
+ local file="$1"
47
+
48
+ if [[ ! -r "$file" ]]; then
49
+ echo "NOT_READABLE"
50
+ return 1
51
+ fi
52
+
53
+ local hash
54
+ hash=$(shasum "$file" 2>/dev/null | cut -d' ' -f1)
55
+ if [[ -z "$hash" ]]; then
56
+ echo "HASH_FAILED"
57
+ return 1
58
+ fi
59
+
60
+ echo "$hash"
61
+ return 0
62
+ }
63
+
42
64
  # Count commands in each directory
43
65
  count_commands() {
44
66
  local dir="$1"
@@ -49,10 +71,17 @@ count_commands() {
49
71
  fi
50
72
  }
51
73
 
52
- # List command files
74
+ # List command files (PLAN-006 fix #13 - warn about non-.md files)
53
75
  list_commands() {
54
76
  local dir="$1"
55
77
  if [[ -d "$dir" ]]; then
78
+ # Check for non-.md files and warn
79
+ local non_md_count
80
+ non_md_count=$(find "$dir" -type f ! -name "*.md" 2>/dev/null | wc -l | tr -d ' ')
81
+ if [[ "$non_md_count" -gt 0 ]]; then
82
+ log_warn "$non_md_count non-.md file(s) found in $dir (ignored)"
83
+ fi
84
+
56
85
  find "$dir" -name "*.md" -exec basename {} \; | sort
57
86
  fi
58
87
  }
@@ -67,6 +96,19 @@ check_sync() {
67
96
  echo "Claude Code commands: $claude_count"
68
97
  echo "OpenCode commands: $opencode_count"
69
98
 
99
+ # PLAN-006 fix #10 - warn about empty directories
100
+ if [[ "$claude_count" -eq 0 ]] && [[ "$opencode_count" -eq 0 ]]; then
101
+ log_warn "Both command directories are empty"
102
+ echo "This may indicate a misconfiguration"
103
+ fi
104
+
105
+ # PLAN-006 fix #11 - warn about large command counts
106
+ local max_commands=500
107
+ if [[ "$claude_count" -gt "$max_commands" ]] || [[ "$opencode_count" -gt "$max_commands" ]]; then
108
+ log_warn "Large number of commands ($claude_count/$opencode_count)"
109
+ echo "This may cause performance issues during sync checks"
110
+ fi
111
+
70
112
  if [[ "$claude_count" != "$opencode_count" ]]; then
71
113
  log_error "Command counts don't match!"
72
114
  return 1
@@ -96,12 +138,16 @@ check_sync() {
96
138
  check_content() {
97
139
  log_info "Checking content-level sync (checksums)..."
98
140
 
99
- local claude_files=$(list_commands "$CLAUDE_DIR")
100
141
  local drift_count=0
142
+ local error_count=0
143
+ local match_count=0
101
144
  local drift_files=""
145
+ local error_files=""
102
146
 
103
- for file in $claude_files; do
104
- local claude_file="$CLAUDE_DIR/$file"
147
+ # Use null delimiter for safe iteration (handles filenames with spaces)
148
+ while IFS= read -r -d '' claude_file; do
149
+ local file
150
+ file=$(basename "$claude_file")
105
151
  local opencode_file="$OPENCODE_DIR/$file"
106
152
 
107
153
  # Skip if OpenCode file doesn't exist (already caught by Pass 1)
@@ -109,10 +155,23 @@ check_content() {
109
155
  continue
110
156
  fi
111
157
 
112
- # Compare SHA-1 checksums (portable across macOS and Linux)
158
+ # Compute hashes with error handling
113
159
  local claude_hash opencode_hash
114
- claude_hash=$(shasum "$claude_file" | cut -d' ' -f1)
115
- opencode_hash=$(shasum "$opencode_file" | cut -d' ' -f1)
160
+ claude_hash=$(compute_hash "$claude_file")
161
+ if [[ $? -ne 0 ]]; then
162
+ log_error "Cannot hash $claude_file ($claude_hash)"
163
+ error_files="${error_files} ${file} (${claude_hash})\n"
164
+ error_count=$((error_count + 1))
165
+ continue
166
+ fi
167
+
168
+ opencode_hash=$(compute_hash "$opencode_file")
169
+ if [[ $? -ne 0 ]]; then
170
+ log_error "Cannot hash $opencode_file ($opencode_hash)"
171
+ error_files="${error_files} ${file} (${opencode_hash})\n"
172
+ error_count=$((error_count + 1))
173
+ continue
174
+ fi
116
175
 
117
176
  if [[ "$claude_hash" != "$opencode_hash" ]]; then
118
177
  drift_count=$((drift_count + 1))
@@ -122,13 +181,34 @@ check_content() {
122
181
  echo " Claude: $claude_hash"
123
182
  echo " OpenCode: $opencode_hash"
124
183
 
125
- # Show first 10 lines of diff for context (|| true to handle set -e)
184
+ # PLAN-006 fix #12 - improved diff error handling
126
185
  echo " ---"
127
- diff -u "$claude_file" "$opencode_file" | head -20 || true
186
+ local diff_output
187
+ if diff_output=$(diff -u "$claude_file" "$opencode_file" 2>&1); then
188
+ # Files are same (shouldn't happen if hashes differ, but handle it)
189
+ echo "$diff_output" | head -20
190
+ else
191
+ local diff_exit=$?
192
+ if [[ "$diff_output" == *"diff:"* && "$diff_output" == *"No such file"* ]]; then
193
+ log_error "diff failed: $diff_output"
194
+ else
195
+ # Normal diff output (exit 1 means files differ)
196
+ echo "$diff_output" | head -20
197
+ fi
198
+ fi
128
199
  echo " ---"
129
200
  echo ""
201
+ else
202
+ match_count=$((match_count + 1))
130
203
  fi
131
- done
204
+ done < <(find "$CLAUDE_DIR" -name "*.md" -type f -print0 2>/dev/null | sort -z)
205
+
206
+ # Report results
207
+ if [[ "$error_count" -gt 0 ]]; then
208
+ echo ""
209
+ log_error "Hash errors in $error_count file(s):"
210
+ echo -e "$error_files"
211
+ fi
132
212
 
133
213
  if [[ "$drift_count" -gt 0 ]]; then
134
214
  echo ""
@@ -137,7 +217,11 @@ check_content() {
137
217
  return 1
138
218
  fi
139
219
 
140
- log_info "All file contents match (checksums verified)"
220
+ if [[ "$error_count" -gt 0 ]]; then
221
+ return 1
222
+ fi
223
+
224
+ log_info "All file contents match (checksums verified: $match_count files)"
141
225
  return 0
142
226
  }
143
227
 
@@ -145,10 +229,10 @@ check_content() {
145
229
  show_diff() {
146
230
  log_info "Comparing command sets..."
147
231
 
148
- local claude_files=$(list_commands "$CLAUDE_DIR")
149
-
150
- for file in $claude_files; do
151
- local claude_file="$CLAUDE_DIR/$file"
232
+ # Use null delimiter for safe iteration (handles filenames with spaces)
233
+ while IFS= read -r -d '' claude_file; do
234
+ local file
235
+ file=$(basename "$claude_file")
152
236
  local opencode_file="$OPENCODE_DIR/$file"
153
237
 
154
238
  if [[ ! -f "$opencode_file" ]]; then
@@ -163,7 +247,7 @@ show_diff() {
163
247
  if [[ "$claude_size" != "$opencode_size" ]]; then
164
248
  echo "$file: $claude_size lines (Claude) vs $opencode_size lines (OpenCode)"
165
249
  fi
166
- done
250
+ done < <(find "$CLAUDE_DIR" -name "*.md" -type f -print0 2>/dev/null | sort -z)
167
251
  }
168
252
 
169
253
  # Display help
@@ -17,11 +17,11 @@ const pc = require('picocolors');
17
17
 
18
18
  // Caste definitions with colors and emojis (per CONTEXT.md decisions)
19
19
  const CASTE_STYLES = {
20
- builder: { color: 'blue', emoji: '🔨', ansi: '\033[34m', pc: pc.blue },
21
- watcher: { color: 'green', emoji: '👁️', ansi: '\033[32m', pc: pc.green },
22
- scout: { color: 'yellow', emoji: '🔍', ansi: '\033[33m', pc: pc.yellow },
23
- chaos: { color: 'red', emoji: '🎲', ansi: '\033[31m', pc: pc.red },
24
- prime: { color: 'magenta',emoji: '👑', ansi: '\033[35m', pc: pc.magenta }
20
+ builder: { color: 'blue', emoji: '🔨🐜', ansi: '\033[34m', pc: pc.blue },
21
+ watcher: { color: 'green', emoji: '👁️🐜', ansi: '\033[32m', pc: pc.green },
22
+ scout: { color: 'yellow', emoji: '🔍🐜', ansi: '\033[33m', pc: pc.yellow },
23
+ chaos: { color: 'red', emoji: '🎲🐜', ansi: '\033[31m', pc: pc.red },
24
+ prime: { color: 'magenta',emoji: '👑🐜', ansi: '\033[35m', pc: pc.magenta }
25
25
  };
26
26
 
27
27
  // Get style for a caste (case-insensitive)
package/bin/lib/errors.js CHANGED
@@ -179,6 +179,21 @@ class ConfigurationError extends AetherError {
179
179
  }
180
180
  }
181
181
 
182
+ /**
183
+ * StateSchemaError - State file schema validation errors (PLAN-007 Fix 3)
184
+ */
185
+ class StateSchemaError extends AetherError {
186
+ constructor(message, details = {}) {
187
+ super(
188
+ ErrorCodes.E_INVALID_STATE,
189
+ message,
190
+ details,
191
+ 'Check state file structure and fix schema errors, or restore from backup'
192
+ );
193
+ this.name = 'StateSchemaError';
194
+ }
195
+ }
196
+
182
197
  /**
183
198
  * Map error codes to sysexits.h exit codes
184
199
  * @param {string} code - Error code
@@ -233,6 +248,7 @@ module.exports = {
233
248
  ValidationError,
234
249
  FileSystemError,
235
250
  ConfigurationError,
251
+ StateSchemaError,
236
252
  ErrorCodes,
237
253
  getExitCode,
238
254
  wrapError,