vibe-forge 0.8.1 → 0.8.2

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 (51) hide show
  1. package/.claude/commands/configure-vcs.md +102 -102
  2. package/.claude/commands/forge.md +218 -218
  3. package/.claude/hooks/worker-loop.js +220 -217
  4. package/.claude/settings.json +89 -89
  5. package/README.md +149 -191
  6. package/agents/aegis/personality.md +303 -303
  7. package/agents/anvil/personality.md +278 -278
  8. package/agents/architect/personality.md +260 -260
  9. package/agents/crucible/personality.md +362 -362
  10. package/agents/crucible-x/personality.md +210 -210
  11. package/agents/ember/personality.md +293 -293
  12. package/agents/flux/personality.md +248 -248
  13. package/agents/furnace/personality.md +342 -342
  14. package/agents/herald/personality.md +249 -249
  15. package/agents/oracle/personality.md +284 -284
  16. package/agents/pixel/personality.md +140 -140
  17. package/agents/planning-hub/personality.md +473 -473
  18. package/agents/scribe/personality.md +253 -253
  19. package/agents/slag/personality.md +268 -268
  20. package/agents/temper/personality.md +270 -270
  21. package/bin/cli.js +372 -372
  22. package/bin/forge-daemon.sh +477 -477
  23. package/bin/forge-setup.sh +662 -661
  24. package/bin/forge-spawn.sh +164 -164
  25. package/bin/forge.sh +566 -566
  26. package/docs/commands.md +8 -8
  27. package/package.json +77 -77
  28. package/{bin → src}/lib/agents.sh +177 -177
  29. package/{bin → src}/lib/check-aliases.js +50 -50
  30. package/{bin → src}/lib/colors.sh +45 -44
  31. package/{bin → src}/lib/config.sh +347 -347
  32. package/{bin → src}/lib/constants.sh +241 -241
  33. package/{bin → src}/lib/daemon/budgets.sh +107 -107
  34. package/{bin → src}/lib/daemon/dependencies.sh +146 -146
  35. package/{bin → src}/lib/daemon/display.sh +128 -128
  36. package/{bin → src}/lib/daemon/notifications.sh +273 -273
  37. package/{bin → src}/lib/daemon/routing.sh +93 -93
  38. package/{bin → src}/lib/daemon/state.sh +163 -163
  39. package/{bin → src}/lib/daemon/sync.sh +103 -103
  40. package/{bin → src}/lib/database.sh +357 -357
  41. package/{bin → src}/lib/frontmatter.js +106 -106
  42. package/{bin → src}/lib/heimdall-setup.js +113 -113
  43. package/{bin → src}/lib/heimdall.js +265 -265
  44. package/src/lib/index.sh +25 -0
  45. package/{bin → src}/lib/json.sh +264 -264
  46. package/{bin → src}/lib/terminal.js +452 -452
  47. package/{bin → src}/lib/util.sh +126 -126
  48. package/{bin → src}/lib/vcs.js +349 -349
  49. package/{context → templates}/project-context-template.md +122 -122
  50. package/config/task-template.md +0 -159
  51. package/config/templates/handoff-template.md +0 -40
@@ -1,103 +1,103 @@
1
- #!/usr/bin/env bash
2
- #
3
- # bin/lib/daemon/sync.sh
4
- #
5
- # Agent status synchronization functions - JSON files to SQLite
6
- #
7
- # Dependencies: json.sh, database.sh, constants.sh
8
- # Globals required: FORGE_ROOT, FORGE_DB, AGENT_STATUS_DIR, LOG_FILE,
9
- # STALE_STATUS_THRESHOLD
10
-
11
- # Prevent double-sourcing
12
- [[ -n "${_DAEMON_SYNC_LOADED:-}" ]] && return 0
13
- _DAEMON_SYNC_LOADED=1
14
-
15
- # Sync agent status from JSON files to SQLite (with mtime filtering)
16
- sync_agent_status_to_db() {
17
- local status_dir="$FORGE_ROOT/$AGENT_STATUS_DIR"
18
-
19
- if [[ ! -d "$status_dir" ]]; then
20
- return 0
21
- fi
22
-
23
- for status_file in "$status_dir"/*.json; do
24
- if [[ -f "$status_file" && ! -L "$status_file" ]]; then
25
- # Get file modification time
26
- local file_mtime
27
- file_mtime=$(stat -c %Y "$status_file" 2>/dev/null || stat -f %m "$status_file" 2>/dev/null || echo "0")
28
-
29
- # Get agent name from filename
30
- local agent_name
31
- agent_name=$(basename "$status_file" .json)
32
-
33
- # Check if file has changed since last read
34
- local stored_mtime
35
- stored_mtime=$(db_get_agent_mtime "$agent_name")
36
-
37
- if [[ "$file_mtime" -gt "$stored_mtime" ]]; then
38
- # File changed - parse and update DB
39
- local agent status task message updated
40
- agent=$(json_read "$status_file" "agent" "unknown")
41
- status=$(json_read "$status_file" "status" "unknown")
42
- task=$(json_read "$status_file" "task" "")
43
- message=$(json_read "$status_file" "message" "" | head -c 80)
44
- updated=$(json_read "$status_file" "updated" "")
45
-
46
- # Check if status actually changed (T1-D3: record transitions)
47
- local old_status
48
- old_status=$(sqlite3 "$FORGE_DB" \
49
- "SELECT status FROM agent_status WHERE agent = '$(db_escape "$agent")';" 2>/dev/null || echo "")
50
- if [[ "$old_status" != "$status" && -n "$status" ]]; then
51
- db_record_status_history "$agent" "$status" "$task"
52
- fi
53
-
54
- # Upsert to database
55
- db_upsert_agent_status "$agent" "$status" "$task" "$message" "$updated" "$file_mtime"
56
-
57
- echo "[$(date -Iseconds)] Synced status for $agent: $status" >> "$LOG_FILE"
58
- fi
59
- fi
60
- done
61
- }
62
-
63
- # Build worker status from SQLite (for YAML output)
64
- build_worker_status() {
65
- local now_epoch
66
- now_epoch=$(date +%s)
67
- local stale_threshold=$STALE_STATUS_THRESHOLD
68
-
69
- # Check if we have any agent status in DB
70
- local agent_count
71
- agent_count=$(sqlite3 "$FORGE_DB" "SELECT COUNT(*) FROM agent_status;" 2>/dev/null || echo "0")
72
-
73
- if [[ "$agent_count" -eq 0 ]]; then
74
- return 0
75
- fi
76
-
77
- echo "workers:"
78
-
79
- # Read from database
80
- while IFS='|' read -r agent status task message updated; do
81
- local stale_marker=""
82
-
83
- # Check if stale
84
- if [[ -n "$updated" ]]; then
85
- local updated_epoch age
86
- updated_epoch=$(date -d "$updated" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "${updated%Z}" +%s 2>/dev/null || echo "0")
87
- age=$((now_epoch - updated_epoch))
88
- if [[ "$age" -gt "$stale_threshold" ]]; then
89
- stale_marker=" (stale)"
90
- fi
91
- fi
92
-
93
- echo " - agent: $agent"
94
- echo " status: $status$stale_marker"
95
- if [[ -n "$task" ]]; then
96
- echo " task: $task"
97
- fi
98
- if [[ -n "$message" ]]; then
99
- echo " message: \"$message\""
100
- fi
101
- echo " updated: $updated"
102
- done < <(db_get_all_agent_statuses)
103
- }
1
+ #!/usr/bin/env bash
2
+ #
3
+ # src/lib/daemon/sync.sh
4
+ #
5
+ # Agent status synchronization functions - JSON files to SQLite
6
+ #
7
+ # Dependencies: json.sh, database.sh, constants.sh
8
+ # Globals required: FORGE_ROOT, FORGE_DB, AGENT_STATUS_DIR, LOG_FILE,
9
+ # STALE_STATUS_THRESHOLD
10
+
11
+ # Prevent double-sourcing
12
+ [[ -n "${_DAEMON_SYNC_LOADED:-}" ]] && return 0
13
+ _DAEMON_SYNC_LOADED=1
14
+
15
+ # Sync agent status from JSON files to SQLite (with mtime filtering)
16
+ sync_agent_status_to_db() {
17
+ local status_dir="$FORGE_ROOT/$AGENT_STATUS_DIR"
18
+
19
+ if [[ ! -d "$status_dir" ]]; then
20
+ return 0
21
+ fi
22
+
23
+ for status_file in "$status_dir"/*.json; do
24
+ if [[ -f "$status_file" && ! -L "$status_file" ]]; then
25
+ # Get file modification time
26
+ local file_mtime
27
+ file_mtime=$(stat -c %Y "$status_file" 2>/dev/null || stat -f %m "$status_file" 2>/dev/null || echo "0")
28
+
29
+ # Get agent name from filename
30
+ local agent_name
31
+ agent_name=$(basename "$status_file" .json)
32
+
33
+ # Check if file has changed since last read
34
+ local stored_mtime
35
+ stored_mtime=$(db_get_agent_mtime "$agent_name")
36
+
37
+ if [[ "$file_mtime" -gt "$stored_mtime" ]]; then
38
+ # File changed - parse and update DB
39
+ local agent status task message updated
40
+ agent=$(json_read "$status_file" "agent" "unknown")
41
+ status=$(json_read "$status_file" "status" "unknown")
42
+ task=$(json_read "$status_file" "task" "")
43
+ message=$(json_read "$status_file" "message" "" | head -c 80)
44
+ updated=$(json_read "$status_file" "updated" "")
45
+
46
+ # Check if status actually changed (T1-D3: record transitions)
47
+ local old_status
48
+ old_status=$(sqlite3 "$FORGE_DB" \
49
+ "SELECT status FROM agent_status WHERE agent = '$(db_escape "$agent")';" 2>/dev/null || echo "")
50
+ if [[ "$old_status" != "$status" && -n "$status" ]]; then
51
+ db_record_status_history "$agent" "$status" "$task"
52
+ fi
53
+
54
+ # Upsert to database
55
+ db_upsert_agent_status "$agent" "$status" "$task" "$message" "$updated" "$file_mtime"
56
+
57
+ echo "[$(date -Iseconds)] Synced status for $agent: $status" >> "$LOG_FILE"
58
+ fi
59
+ fi
60
+ done
61
+ }
62
+
63
+ # Build worker status from SQLite (for YAML output)
64
+ build_worker_status() {
65
+ local now_epoch
66
+ now_epoch=$(date +%s)
67
+ local stale_threshold=$STALE_STATUS_THRESHOLD
68
+
69
+ # Check if we have any agent status in DB
70
+ local agent_count
71
+ agent_count=$(sqlite3 "$FORGE_DB" "SELECT COUNT(*) FROM agent_status;" 2>/dev/null || echo "0")
72
+
73
+ if [[ "$agent_count" -eq 0 ]]; then
74
+ return 0
75
+ fi
76
+
77
+ echo "workers:"
78
+
79
+ # Read from database
80
+ while IFS='|' read -r agent status task message updated; do
81
+ local stale_marker=""
82
+
83
+ # Check if stale
84
+ if [[ -n "$updated" ]]; then
85
+ local updated_epoch age
86
+ updated_epoch=$(date -d "$updated" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "${updated%Z}" +%s 2>/dev/null || echo "0")
87
+ age=$((now_epoch - updated_epoch))
88
+ if [[ "$age" -gt "$stale_threshold" ]]; then
89
+ stale_marker=" (stale)"
90
+ fi
91
+ fi
92
+
93
+ echo " - agent: $agent"
94
+ echo " status: $status$stale_marker"
95
+ if [[ -n "$task" ]]; then
96
+ echo " task: $task"
97
+ fi
98
+ if [[ -n "$message" ]]; then
99
+ echo " message: \"$message\""
100
+ fi
101
+ echo " updated: $updated"
102
+ done < <(db_get_all_agent_statuses)
103
+ }