@stackmemoryai/stackmemory 0.3.16 ā 0.3.18
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/README.md +48 -2
- package/dist/cli/commands/skills.js +15 -2
- package/dist/cli/commands/skills.js.map +2 -2
- package/dist/cli/index.js +113 -834
- package/dist/cli/index.js.map +3 -3
- package/dist/core/context/dual-stack-manager.js +1 -1
- package/dist/core/context/dual-stack-manager.js.map +1 -1
- package/dist/core/context/frame-manager.js +3 -0
- package/dist/core/context/frame-manager.js.map +2 -2
- package/dist/integrations/claude-code/subagent-client.js +106 -3
- package/dist/integrations/claude-code/subagent-client.js.map +2 -2
- package/dist/servers/railway/config.js +51 -0
- package/dist/servers/railway/config.js.map +7 -0
- package/dist/servers/railway/index-enhanced.js +156 -0
- package/dist/servers/railway/index-enhanced.js.map +7 -0
- package/dist/servers/railway/minimal.js +48 -3
- package/dist/servers/railway/minimal.js.map +2 -2
- package/dist/servers/railway/storage-test.js +455 -0
- package/dist/servers/railway/storage-test.js.map +7 -0
- package/dist/skills/claude-skills.js +13 -12
- package/dist/skills/claude-skills.js.map +2 -2
- package/dist/skills/recursive-agent-orchestrator.js +27 -18
- package/dist/skills/recursive-agent-orchestrator.js.map +2 -2
- package/dist/skills/unified-rlm-orchestrator.js.map +2 -2
- package/package.json +6 -18
- package/scripts/README-TESTING.md +186 -0
- package/scripts/analyze-cli-security.js +288 -0
- package/scripts/archive/add-phase-tasks-to-linear.js +163 -0
- package/scripts/archive/analyze-linear-duplicates.js +214 -0
- package/scripts/archive/analyze-remaining-duplicates.js +230 -0
- package/scripts/archive/analyze-sta-duplicates.js +292 -0
- package/scripts/archive/analyze-sta-graphql.js +399 -0
- package/scripts/archive/cancel-duplicate-tasks.ts +246 -0
- package/scripts/archive/check-all-duplicates.ts +419 -0
- package/scripts/archive/clean-duplicate-tasks.js +114 -0
- package/scripts/archive/cleanup-duplicate-tasks.ts +286 -0
- package/scripts/archive/create-phase-tasks.js +387 -0
- package/scripts/archive/delete-linear-duplicates.js +182 -0
- package/scripts/archive/delete-remaining-duplicates.js +158 -0
- package/scripts/archive/delete-sta-duplicates.js +201 -0
- package/scripts/archive/delete-sta-oauth.js +201 -0
- package/scripts/archive/export-sta-tasks.js +62 -0
- package/scripts/archive/install-auto-sync.js +266 -0
- package/scripts/archive/install-chromadb-hooks.sh +133 -0
- package/scripts/archive/install-enhanced-clear-hooks.sh +431 -0
- package/scripts/archive/install-post-task-hooks.sh +289 -0
- package/scripts/archive/install-stackmemory-hooks.sh +420 -0
- package/scripts/archive/merge-linear-duplicates-safe.ts +362 -0
- package/scripts/archive/merge-linear-duplicates.ts +180 -0
- package/scripts/archive/remove-sta-tasks.js +70 -0
- package/scripts/archive/setup-background-sync.sh +168 -0
- package/scripts/archive/setup-claude-auto-triggers.sh +181 -0
- package/scripts/archive/setup-claude-autostart.sh +305 -0
- package/scripts/archive/setup-git-hooks.sh +25 -0
- package/scripts/archive/setup-linear-oauth.sh +46 -0
- package/scripts/archive/setup-mcp.sh +113 -0
- package/scripts/archive/setup-railway-deployment.sh +81 -0
- package/scripts/auto-handoff.sh +262 -0
- package/scripts/background-sync-manager.js +416 -0
- package/scripts/benchmark-performance.ts +57 -0
- package/scripts/check-redis.ts +48 -0
- package/scripts/chromadb-auto-loader.sh +128 -0
- package/scripts/chromadb-context-loader.js +479 -0
- package/scripts/claude-chromadb-hook.js +460 -0
- package/scripts/claude-code-wrapper.sh +66 -0
- package/scripts/claude-linear-skill.js +455 -0
- package/scripts/claude-pre-commit.sh +302 -0
- package/scripts/claude-sm-autostart.js +532 -0
- package/scripts/claude-sm-setup.sh +367 -0
- package/scripts/claude-with-chromadb.sh +69 -0
- package/scripts/claude-worktree-manager.sh +323 -0
- package/scripts/claude-worktree-monitor.sh +371 -0
- package/scripts/claude-worktree-setup.sh +327 -0
- package/scripts/clean-linear-backlog.js +273 -0
- package/scripts/cleanup-old-sessions.sh +57 -0
- package/scripts/codex-wrapper.sh +88 -0
- package/scripts/create-sandbox.sh +269 -0
- package/scripts/debug-linear-update.js +174 -0
- package/scripts/delete-linear-tasks.js +167 -0
- package/scripts/deploy.sh +89 -0
- package/scripts/deployment/railway.sh +352 -0
- package/scripts/deployment/test-deployment.js +194 -0
- package/scripts/detect-and-rehydrate.js +162 -0
- package/scripts/detect-and-rehydrate.mjs +165 -0
- package/scripts/development/create-demo-tasks.js +143 -0
- package/scripts/development/debug-frame-test.js +16 -0
- package/scripts/development/demo-auto-sync.js +128 -0
- package/scripts/development/fix-all-imports.js +213 -0
- package/scripts/development/fix-imports.js +229 -0
- package/scripts/development/fix-lint-loop.cjs +103 -0
- package/scripts/development/fix-project-id.ts +161 -0
- package/scripts/development/fix-strict-mode-issues.ts +291 -0
- package/scripts/development/reorganize-structure.sh +228 -0
- package/scripts/development/test-persistence-direct.js +148 -0
- package/scripts/development/test-persistence.js +114 -0
- package/scripts/development/test-tasks.js +93 -0
- package/scripts/development/update-imports.js +212 -0
- package/scripts/fetch-linear-status.js +125 -0
- package/scripts/git-hooks/README.md +310 -0
- package/scripts/git-hooks/branch-context-manager.sh +342 -0
- package/scripts/git-hooks/post-checkout-stackmemory.sh +63 -0
- package/scripts/git-hooks/post-commit-stackmemory.sh +305 -0
- package/scripts/git-hooks/pre-commit-stackmemory.sh +275 -0
- package/scripts/hooks/cleanup-shell.sh +130 -0
- package/scripts/hooks/task-complete.sh +114 -0
- package/scripts/initialize.ts +129 -0
- package/scripts/install-claude-hooks-auto.js +104 -0
- package/scripts/install-claude-hooks.sh +133 -0
- package/scripts/install-global.sh +296 -0
- package/scripts/install.sh +235 -0
- package/scripts/linear-auto-sync.js +262 -0
- package/scripts/linear-auto-sync.sh +161 -0
- package/scripts/linear-sync-daemon.js +150 -0
- package/scripts/linear-task-review.js +237 -0
- package/scripts/list-linear-tasks.ts +178 -0
- package/scripts/mcp-proxy.js +66 -0
- package/scripts/opencode-wrapper.sh +85 -0
- package/scripts/publish-local.js +74 -0
- package/scripts/query-chromadb.ts +201 -0
- package/scripts/railway-env-setup.sh +39 -0
- package/scripts/reconcile-local-tasks.js +170 -0
- package/scripts/recreate-frames-db.js +89 -0
- package/scripts/setup/claude-integration.js +138 -0
- package/scripts/setup/configure-alias.js +125 -0
- package/scripts/setup/configure-codex-alias.js +161 -0
- package/scripts/setup/configure-opencode-alias.js +175 -0
- package/scripts/setup-claude-integration.js +204 -0
- package/scripts/setup-claude-integration.sh +183 -0
- package/scripts/setup.sh +31 -0
- package/scripts/show-linear-summary.ts +172 -0
- package/scripts/stackmemory-auto-handoff.sh +231 -0
- package/scripts/stackmemory-daemon.sh +40 -0
- package/scripts/start-linear-sync-daemon.sh +141 -0
- package/scripts/start-temporal-paradox.sh +214 -0
- package/scripts/status.ts +159 -0
- package/scripts/sync-and-clean-tasks.js +258 -0
- package/scripts/sync-frames-from-railway.js +228 -0
- package/scripts/sync-linear-graphql.js +303 -0
- package/scripts/sync-linear-tasks.js +186 -0
- package/scripts/test-auto-triggers.sh +57 -0
- package/scripts/test-browser-mcp.js +74 -0
- package/scripts/test-chromadb-full.js +115 -0
- package/scripts/test-chromadb-hooks.sh +28 -0
- package/scripts/test-chromadb-sync.ts +245 -0
- package/scripts/test-cli-security.js +293 -0
- package/scripts/test-hooks-persistence.sh +220 -0
- package/scripts/test-installation-scenarios.sh +359 -0
- package/scripts/test-installation.sh +224 -0
- package/scripts/test-mcp.js +163 -0
- package/scripts/test-pre-publish-quick.sh +75 -0
- package/scripts/test-quality-gates.sh +263 -0
- package/scripts/test-railway-db.js +222 -0
- package/scripts/test-redis-storage.ts +490 -0
- package/scripts/test-rlm-basic.sh +122 -0
- package/scripts/test-rlm-comprehensive.sh +260 -0
- package/scripts/test-rlm-e2e.sh +268 -0
- package/scripts/test-rlm-simple.js +90 -0
- package/scripts/test-rlm.js +110 -0
- package/scripts/test-session-handoff.sh +165 -0
- package/scripts/test-shell-integration.sh +275 -0
- package/scripts/testing/ab-test-runner.ts +508 -0
- package/scripts/testing/collect-metrics.ts +457 -0
- package/scripts/testing/quick-effectiveness-demo.js +187 -0
- package/scripts/testing/real-performance-test.js +422 -0
- package/scripts/testing/run-effectiveness-tests.sh +176 -0
- package/scripts/testing/scripts/testing/ab-test-runner.js +363 -0
- package/scripts/testing/scripts/testing/collect-metrics.js +292 -0
- package/scripts/testing/simple-effectiveness-test.js +310 -0
- package/scripts/testing/src/core/context/context-bridge.js +253 -0
- package/scripts/testing/src/core/context/frame-manager.js +746 -0
- package/scripts/testing/src/core/context/shared-context-layer.js +437 -0
- package/scripts/testing/src/core/database/database-adapter.js +54 -0
- package/scripts/testing/src/core/errors/index.js +291 -0
- package/scripts/testing/src/core/errors/recovery.js +268 -0
- package/scripts/testing/src/core/monitoring/logger.js +145 -0
- package/scripts/testing/src/core/retrieval/context-retriever.js +516 -0
- package/scripts/testing/src/core/session/index.js +1 -0
- package/scripts/testing/src/core/session/session-manager.js +323 -0
- package/scripts/testing/src/core/trace/cli-trace-wrapper.js +140 -0
- package/scripts/testing/src/core/trace/db-trace-wrapper.js +251 -0
- package/scripts/testing/src/core/trace/debug-trace.js +398 -0
- package/scripts/testing/src/core/trace/index.js +120 -0
- package/scripts/testing/src/core/trace/linear-api-wrapper.js +204 -0
- package/scripts/update-linear-status.js +268 -0
- package/scripts/update-linear-tasks-fixed.js +284 -0
- package/templates/claude-hooks/hooks.json +5 -0
- package/templates/claude-hooks/on-clear.js +56 -0
- package/templates/claude-hooks/on-startup.js +56 -0
- package/templates/claude-hooks/tool-use-trace.js +67 -0
- package/dist/features/tui/components/analytics-panel.js +0 -157
- package/dist/features/tui/components/analytics-panel.js.map +0 -7
- package/dist/features/tui/components/frame-visualizer.js +0 -377
- package/dist/features/tui/components/frame-visualizer.js.map +0 -7
- package/dist/features/tui/components/pr-tracker.js +0 -135
- package/dist/features/tui/components/pr-tracker.js.map +0 -7
- package/dist/features/tui/components/session-monitor.js +0 -299
- package/dist/features/tui/components/session-monitor.js.map +0 -7
- package/dist/features/tui/components/subagent-fleet.js +0 -395
- package/dist/features/tui/components/subagent-fleet.js.map +0 -7
- package/dist/features/tui/components/task-board.js +0 -1139
- package/dist/features/tui/components/task-board.js.map +0 -7
- package/dist/features/tui/index.js +0 -408
- package/dist/features/tui/index.js.map +0 -7
- package/dist/features/tui/services/data-service.js +0 -641
- package/dist/features/tui/services/data-service.js.map +0 -7
- package/dist/features/tui/services/linear-task-reader.js +0 -102
- package/dist/features/tui/services/linear-task-reader.js.map +0 -7
- package/dist/features/tui/services/websocket-client.js +0 -162
- package/dist/features/tui/services/websocket-client.js.map +0 -7
- package/dist/features/tui/terminal-compat.js +0 -220
- package/dist/features/tui/terminal-compat.js.map +0 -7
- package/dist/features/tui/types.js +0 -1
- package/dist/features/tui/types.js.map +0 -7
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Linear Sync Daemon Launcher
|
|
4
|
+
# Starts the Linear sync daemon in the background
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
|
8
|
+
PID_FILE="$PROJECT_DIR/.stackmemory/linear-sync.pid"
|
|
9
|
+
LOG_FILE="$PROJECT_DIR/.stackmemory/linear-sync.log"
|
|
10
|
+
|
|
11
|
+
# Function to check if daemon is running
|
|
12
|
+
is_running() {
|
|
13
|
+
if [ -f "$PID_FILE" ]; then
|
|
14
|
+
PID=$(cat "$PID_FILE")
|
|
15
|
+
if ps -p $PID > /dev/null 2>&1; then
|
|
16
|
+
return 0
|
|
17
|
+
fi
|
|
18
|
+
fi
|
|
19
|
+
return 1
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Function to start the daemon
|
|
23
|
+
start_daemon() {
|
|
24
|
+
if is_running; then
|
|
25
|
+
echo "ā ļø Linear sync daemon is already running (PID: $(cat "$PID_FILE"))"
|
|
26
|
+
return 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
echo "š Starting Linear sync daemon..."
|
|
30
|
+
|
|
31
|
+
# Start the Node.js daemon in background
|
|
32
|
+
cd "$PROJECT_DIR"
|
|
33
|
+
nohup node scripts/linear-sync-daemon.js >> "$LOG_FILE" 2>&1 &
|
|
34
|
+
PID=$!
|
|
35
|
+
|
|
36
|
+
# Save PID
|
|
37
|
+
echo $PID > "$PID_FILE"
|
|
38
|
+
|
|
39
|
+
# Wait a moment and check if it started successfully
|
|
40
|
+
sleep 2
|
|
41
|
+
if is_running; then
|
|
42
|
+
echo "ā
Linear sync daemon started successfully (PID: $PID)"
|
|
43
|
+
echo "š Log file: $LOG_FILE"
|
|
44
|
+
echo "ā° Syncing every hour in the background"
|
|
45
|
+
return 0
|
|
46
|
+
else
|
|
47
|
+
echo "ā Failed to start Linear sync daemon"
|
|
48
|
+
rm -f "$PID_FILE"
|
|
49
|
+
return 1
|
|
50
|
+
fi
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Function to stop the daemon
|
|
54
|
+
stop_daemon() {
|
|
55
|
+
if ! is_running; then
|
|
56
|
+
echo "ā ļø Linear sync daemon is not running"
|
|
57
|
+
return 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
PID=$(cat "$PID_FILE")
|
|
61
|
+
echo "š Stopping Linear sync daemon (PID: $PID)..."
|
|
62
|
+
|
|
63
|
+
kill $PID 2>/dev/null
|
|
64
|
+
|
|
65
|
+
# Wait for process to stop
|
|
66
|
+
for i in {1..10}; do
|
|
67
|
+
if ! ps -p $PID > /dev/null 2>&1; then
|
|
68
|
+
break
|
|
69
|
+
fi
|
|
70
|
+
sleep 1
|
|
71
|
+
done
|
|
72
|
+
|
|
73
|
+
# Force kill if still running
|
|
74
|
+
if ps -p $PID > /dev/null 2>&1; then
|
|
75
|
+
echo "ā ļø Process didn't stop gracefully, forcing..."
|
|
76
|
+
kill -9 $PID 2>/dev/null
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
rm -f "$PID_FILE"
|
|
80
|
+
echo "ā
Linear sync daemon stopped"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# Function to check daemon status
|
|
84
|
+
status_daemon() {
|
|
85
|
+
if is_running; then
|
|
86
|
+
PID=$(cat "$PID_FILE")
|
|
87
|
+
echo "ā
Linear sync daemon is running (PID: $PID)"
|
|
88
|
+
|
|
89
|
+
# Show last few log lines
|
|
90
|
+
if [ -f "$LOG_FILE" ]; then
|
|
91
|
+
echo ""
|
|
92
|
+
echo "š Recent activity:"
|
|
93
|
+
tail -n 5 "$LOG_FILE"
|
|
94
|
+
fi
|
|
95
|
+
else
|
|
96
|
+
echo "ā Linear sync daemon is not running"
|
|
97
|
+
fi
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
# Function to show logs
|
|
101
|
+
show_logs() {
|
|
102
|
+
if [ -f "$LOG_FILE" ]; then
|
|
103
|
+
tail -f "$LOG_FILE"
|
|
104
|
+
else
|
|
105
|
+
echo "ā Log file not found: $LOG_FILE"
|
|
106
|
+
fi
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
# Parse command
|
|
110
|
+
case "$1" in
|
|
111
|
+
start)
|
|
112
|
+
start_daemon
|
|
113
|
+
;;
|
|
114
|
+
stop)
|
|
115
|
+
stop_daemon
|
|
116
|
+
;;
|
|
117
|
+
restart)
|
|
118
|
+
stop_daemon
|
|
119
|
+
sleep 2
|
|
120
|
+
start_daemon
|
|
121
|
+
;;
|
|
122
|
+
status)
|
|
123
|
+
status_daemon
|
|
124
|
+
;;
|
|
125
|
+
logs)
|
|
126
|
+
show_logs
|
|
127
|
+
;;
|
|
128
|
+
*)
|
|
129
|
+
echo "Linear Sync Daemon Manager"
|
|
130
|
+
echo ""
|
|
131
|
+
echo "Usage: $0 {start|stop|restart|status|logs}"
|
|
132
|
+
echo ""
|
|
133
|
+
echo "Commands:"
|
|
134
|
+
echo " start - Start the sync daemon"
|
|
135
|
+
echo " stop - Stop the sync daemon"
|
|
136
|
+
echo " restart - Restart the sync daemon"
|
|
137
|
+
echo " status - Check daemon status"
|
|
138
|
+
echo " logs - Show and follow logs"
|
|
139
|
+
exit 1
|
|
140
|
+
;;
|
|
141
|
+
esac
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# š Temporal Paradox Chamber - Mission Launcher
|
|
4
|
+
# STA-101: Stack Merge Conflict Resolution
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for dramatic effect
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
BLUE='\033[0;34m'
|
|
12
|
+
PURPLE='\033[0;35m'
|
|
13
|
+
CYAN='\033[0;36m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
NC='\033[0m' # No Color
|
|
16
|
+
BOLD='\033[1m'
|
|
17
|
+
|
|
18
|
+
# ASCII Art Welcome
|
|
19
|
+
clear
|
|
20
|
+
echo -e "${PURPLE}"
|
|
21
|
+
cat << "EOF"
|
|
22
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
23
|
+
ā ā
|
|
24
|
+
ā āāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāā āāāāāāā āāāāāāā ā
|
|
25
|
+
ā āāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
|
|
26
|
+
ā āāā āāāāāā āāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāā ā
|
|
27
|
+
ā āāā āāāāāā āāāāāāāāāāāāāāāāāā āāā āāāāāāāāāāā ā
|
|
28
|
+
ā āāā āāāāāāāāāāā āāā āāāāāā āāāāāāāāāāāā āāā ā
|
|
29
|
+
ā āāā āāāāāāāāāāā āāāāāā āāāāāāā āāā āāā ā
|
|
30
|
+
ā ā
|
|
31
|
+
ā P A R A D O X C H A M B E R ā
|
|
32
|
+
ā ā
|
|
33
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
34
|
+
EOF
|
|
35
|
+
echo -e "${NC}"
|
|
36
|
+
|
|
37
|
+
# Mission briefing
|
|
38
|
+
echo -e "${CYAN}${BOLD}MISSION BRIEFING:${NC}"
|
|
39
|
+
echo -e "${YELLOW}āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā${NC}"
|
|
40
|
+
echo -e "š ${BOLD}Task:${NC} STA-101 - Stack Merge Conflict Resolution"
|
|
41
|
+
echo -e "ā” ${BOLD}Difficulty:${NC} āāāāā (4/5)"
|
|
42
|
+
echo -e "ā±ļø ${BOLD}Est. Time:${NC} 8 hours"
|
|
43
|
+
echo -e "šÆ ${BOLD}Objective:${NC} Build the Temporal Reconciliation Engine"
|
|
44
|
+
echo -e "${YELLOW}āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā${NC}"
|
|
45
|
+
echo
|
|
46
|
+
|
|
47
|
+
# Check prerequisites
|
|
48
|
+
echo -e "${BLUE}${BOLD}Checking temporal stability...${NC}"
|
|
49
|
+
sleep 1
|
|
50
|
+
|
|
51
|
+
# Check if on correct branch
|
|
52
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
53
|
+
if [ "$CURRENT_BRANCH" != "feature/STA-101-merge-conflicts" ]; then
|
|
54
|
+
echo -e "${YELLOW}ā ļø Not on mission branch. Creating temporal branch...${NC}"
|
|
55
|
+
git checkout -b feature/STA-101-merge-conflicts 2>/dev/null || git checkout feature/STA-101-merge-conflicts
|
|
56
|
+
echo -e "${GREEN}ā Temporal branch established${NC}"
|
|
57
|
+
else
|
|
58
|
+
echo -e "${GREEN}ā Already in temporal branch${NC}"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Initialize mission structure
|
|
62
|
+
echo -e "${BLUE}${BOLD}Initializing Temporal Reconciliation System...${NC}"
|
|
63
|
+
sleep 1
|
|
64
|
+
|
|
65
|
+
# Create directory structure
|
|
66
|
+
mkdir -p src/core/merge
|
|
67
|
+
mkdir -p src/core/merge/__tests__
|
|
68
|
+
mkdir -p src/core/merge/strategies
|
|
69
|
+
mkdir -p src/core/merge/visualizers
|
|
70
|
+
|
|
71
|
+
# Create initial files if they don't exist
|
|
72
|
+
if [ ! -f "src/core/merge/types.ts" ]; then
|
|
73
|
+
cat > src/core/merge/types.ts << 'TYPESCRIPT'
|
|
74
|
+
/**
|
|
75
|
+
* Temporal Paradox Resolution Types
|
|
76
|
+
* STA-101: Stack Merge Conflict Resolution
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export interface MergeConflict {
|
|
80
|
+
id: string;
|
|
81
|
+
type: 'parallel_solution' | 'conflicting_decision' | 'structural_divergence';
|
|
82
|
+
frameId1: string;
|
|
83
|
+
frameId2: string;
|
|
84
|
+
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
85
|
+
description: string;
|
|
86
|
+
detectedAt: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ResolutionStrategy {
|
|
90
|
+
type: 'keep_both' | 'team_vote' | 'senior_override' | 'ai_suggest' | 'hybrid';
|
|
91
|
+
confidence: number;
|
|
92
|
+
reasoning?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface StackDiff {
|
|
96
|
+
baseFrame: string;
|
|
97
|
+
branch1: string;
|
|
98
|
+
branch2: string;
|
|
99
|
+
divergencePoint: number;
|
|
100
|
+
conflicts: MergeConflict[];
|
|
101
|
+
commonAncestor?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// TODO: Implement the rest of the type system
|
|
105
|
+
TYPESCRIPT
|
|
106
|
+
echo -e "${GREEN}ā Created types.ts${NC}"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
if [ ! -f "src/core/merge/conflict-detector.ts" ]; then
|
|
110
|
+
cat > src/core/merge/conflict-detector.ts << 'TYPESCRIPT'
|
|
111
|
+
/**
|
|
112
|
+
* Conflict Detection Engine
|
|
113
|
+
* Detects paradoxes in parallel frame timelines
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
import { MergeConflict, StackDiff } from './types.js';
|
|
117
|
+
|
|
118
|
+
export class ConflictDetector {
|
|
119
|
+
/**
|
|
120
|
+
* Detect conflicts between two frame stacks
|
|
121
|
+
* TODO: Implement detection algorithm
|
|
122
|
+
*/
|
|
123
|
+
detectConflicts(stack1: any, stack2: any): MergeConflict[] {
|
|
124
|
+
// Your implementation here
|
|
125
|
+
throw new Error('Temporal paradox detected! Implement detection algorithm.');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
TYPESCRIPT
|
|
129
|
+
echo -e "${GREEN}ā Created conflict-detector.ts${NC}"
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Create test file
|
|
133
|
+
if [ ! -f "src/core/merge/__tests__/conflict-scenarios.test.ts" ]; then
|
|
134
|
+
cat > src/core/merge/__tests__/conflict-scenarios.test.ts << 'TYPESCRIPT'
|
|
135
|
+
/**
|
|
136
|
+
* Temporal Paradox Test Scenarios
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
import { describe, it, expect } from 'vitest';
|
|
140
|
+
import { ConflictDetector } from '../conflict-detector.js';
|
|
141
|
+
|
|
142
|
+
describe('Temporal Paradox Resolution', () => {
|
|
143
|
+
describe('Level 1: Conflict Detection', () => {
|
|
144
|
+
it('should detect parallel solution conflicts', () => {
|
|
145
|
+
// TODO: Implement test
|
|
146
|
+
expect(true).toBe(false); // This will fail until you implement it!
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should detect conflicting decisions', () => {
|
|
150
|
+
// TODO: Implement test
|
|
151
|
+
expect(true).toBe(false);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('should detect structural divergence', () => {
|
|
155
|
+
// TODO: Implement test
|
|
156
|
+
expect(true).toBe(false);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
// More test levels to be implemented...
|
|
161
|
+
});
|
|
162
|
+
TYPESCRIPT
|
|
163
|
+
echo -e "${GREEN}ā Created test scenarios${NC}"
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
# Status display
|
|
167
|
+
echo
|
|
168
|
+
echo -e "${PURPLE}${BOLD}āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā${NC}"
|
|
169
|
+
echo -e "${PURPLE}${BOLD}ā TEMPORAL CHAMBER STATUS: INITIALIZED ā${NC}"
|
|
170
|
+
echo -e "${PURPLE}${BOLD}āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā${NC}"
|
|
171
|
+
echo
|
|
172
|
+
|
|
173
|
+
# Progress tracker
|
|
174
|
+
echo -e "${CYAN}${BOLD}Progress Tracker:${NC}"
|
|
175
|
+
echo -e "Level 1: Conflict Detector [${RED}āāāāāāāāāā${NC}] 0%"
|
|
176
|
+
echo -e "Level 2: Stack Diff Visualizer [${RED}āāāāāāāāāā${NC}] 0%"
|
|
177
|
+
echo -e "Level 3: Resolution Strategist [${RED}āāāāāāāāāā${NC}] 0%"
|
|
178
|
+
echo -e "Level 4: Merge Orchestrator [${RED}āāāāāāāāāā${NC}] 0%"
|
|
179
|
+
echo -e "Level 5: Paradox Prevention [${RED}āāāāāāāāāā${NC}] 0%"
|
|
180
|
+
echo
|
|
181
|
+
|
|
182
|
+
# Available commands
|
|
183
|
+
echo -e "${YELLOW}${BOLD}Available Commands:${NC}"
|
|
184
|
+
echo -e " ${GREEN}npm test -- src/core/merge${NC} - Run temporal tests"
|
|
185
|
+
echo -e " ${GREEN}npm run build${NC} - Compile the timeline"
|
|
186
|
+
echo -e " ${GREEN}npm run lint${NC} - Check temporal stability"
|
|
187
|
+
echo -e " ${GREEN}cat ESCAPE_ROOM_TEMPORAL_PARADOX.md${NC} - Review mission details"
|
|
188
|
+
echo
|
|
189
|
+
|
|
190
|
+
# Start timer
|
|
191
|
+
echo -e "${RED}${BOLD}ā±ļø Mission Timer Started!${NC}"
|
|
192
|
+
echo -e "${CYAN}Time: $(date '+%H:%M:%S')${NC}"
|
|
193
|
+
echo
|
|
194
|
+
|
|
195
|
+
# Final message
|
|
196
|
+
echo -e "${PURPLE}${BOLD}The timelines are diverging... ${NC}"
|
|
197
|
+
echo -e "${PURPLE}${BOLD}Two realities cannot coexist... ${NC}"
|
|
198
|
+
echo -e "${PURPLE}${BOLD}Only you can restore temporal harmony!${NC}"
|
|
199
|
+
echo
|
|
200
|
+
echo -e "${GREEN}${BOLD}>>> BEGIN MISSION <<<${NC}"
|
|
201
|
+
echo
|
|
202
|
+
echo -e "${YELLOW}Hint: Start by implementing the ConflictDetector class${NC}"
|
|
203
|
+
echo -e "${YELLOW}Next step: ${CYAN}code src/core/merge/conflict-detector.ts${NC}"
|
|
204
|
+
echo
|
|
205
|
+
|
|
206
|
+
# Store mission start time
|
|
207
|
+
echo "$(date +%s)" > .temporal-mission-start
|
|
208
|
+
|
|
209
|
+
# Optional: Open VS Code
|
|
210
|
+
read -p "Open VS Code in the merge directory? (y/n) " -n 1 -r
|
|
211
|
+
echo
|
|
212
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
213
|
+
code src/core/merge/
|
|
214
|
+
fi
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Check StackMemory status and statistics
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Database from 'better-sqlite3';
|
|
7
|
+
import { existsSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import chalk from 'chalk';
|
|
10
|
+
|
|
11
|
+
interface CountResult {
|
|
12
|
+
count: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ContextRow {
|
|
16
|
+
type: string;
|
|
17
|
+
preview: string;
|
|
18
|
+
importance: number;
|
|
19
|
+
access_count: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface FrameRow {
|
|
23
|
+
task: string;
|
|
24
|
+
started: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AttentionRow {
|
|
28
|
+
query_preview: string;
|
|
29
|
+
count: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const projectRoot = process.cwd();
|
|
33
|
+
const dbPath = join(projectRoot, '.stackmemory', 'context.db');
|
|
34
|
+
|
|
35
|
+
if (!existsSync(dbPath)) {
|
|
36
|
+
console.log(chalk.red('ā StackMemory not initialized in this project'));
|
|
37
|
+
console.log(chalk.gray('Run: npm run init'));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const db = new Database(dbPath, { readonly: true });
|
|
42
|
+
|
|
43
|
+
console.log(chalk.blue.bold('\nš StackMemory Status\n'));
|
|
44
|
+
|
|
45
|
+
// Get statistics
|
|
46
|
+
const stats = {
|
|
47
|
+
contexts: db
|
|
48
|
+
.prepare('SELECT COUNT(*) as count FROM contexts')
|
|
49
|
+
.get() as CountResult,
|
|
50
|
+
frames: db
|
|
51
|
+
.prepare('SELECT COUNT(*) as count FROM frames')
|
|
52
|
+
.get() as CountResult,
|
|
53
|
+
attention: db
|
|
54
|
+
.prepare('SELECT COUNT(*) as count FROM attention_log')
|
|
55
|
+
.get() as CountResult,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
console.log(chalk.green('Database:') + ` ${dbPath}`);
|
|
59
|
+
console.log(chalk.green('Contexts:') + ` ${stats.contexts.count}`);
|
|
60
|
+
console.log(chalk.green('Frames:') + ` ${stats.frames.count}`);
|
|
61
|
+
console.log(chalk.green('Attention logs:') + ` ${stats.attention.count}`);
|
|
62
|
+
|
|
63
|
+
// Get top contexts by importance
|
|
64
|
+
console.log(chalk.blue('\nšÆ Top Contexts by Importance:\n'));
|
|
65
|
+
|
|
66
|
+
const topContexts = db
|
|
67
|
+
.prepare(
|
|
68
|
+
`
|
|
69
|
+
SELECT type, substr(content, 1, 60) as preview, importance, access_count
|
|
70
|
+
FROM contexts
|
|
71
|
+
ORDER BY importance DESC, access_count DESC
|
|
72
|
+
LIMIT 5
|
|
73
|
+
`
|
|
74
|
+
)
|
|
75
|
+
.all() as ContextRow[];
|
|
76
|
+
|
|
77
|
+
topContexts.forEach((ctx, i) => {
|
|
78
|
+
const importance = 'ā'.repeat(Math.round(ctx.importance * 5));
|
|
79
|
+
console.log(
|
|
80
|
+
chalk.cyan(`${i + 1}.`) +
|
|
81
|
+
` [${ctx.type}] ` +
|
|
82
|
+
chalk.gray(`(${ctx.access_count} uses)`) +
|
|
83
|
+
` ${importance}`
|
|
84
|
+
);
|
|
85
|
+
console.log(chalk.gray(` ${ctx.preview}...`));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Get active frames
|
|
89
|
+
const activeFrames = db
|
|
90
|
+
.prepare(
|
|
91
|
+
`
|
|
92
|
+
SELECT task, datetime(created_at, 'unixepoch') as started
|
|
93
|
+
FROM frames
|
|
94
|
+
WHERE status = 'active'
|
|
95
|
+
ORDER BY created_at DESC
|
|
96
|
+
LIMIT 3
|
|
97
|
+
`
|
|
98
|
+
)
|
|
99
|
+
.all() as FrameRow[];
|
|
100
|
+
|
|
101
|
+
if (activeFrames.length > 0) {
|
|
102
|
+
console.log(chalk.blue('\nš Active Tasks:\n'));
|
|
103
|
+
activeFrames.forEach((frame) => {
|
|
104
|
+
console.log(chalk.green('ā¢') + ` ${frame.task}`);
|
|
105
|
+
console.log(chalk.gray(` Started: ${frame.started}`));
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Get recent attention patterns
|
|
110
|
+
const recentAttention = db
|
|
111
|
+
.prepare(
|
|
112
|
+
`
|
|
113
|
+
SELECT
|
|
114
|
+
substr(query, 1, 50) as query_preview,
|
|
115
|
+
COUNT(*) as count
|
|
116
|
+
FROM attention_log
|
|
117
|
+
WHERE timestamp > unixepoch() - 86400
|
|
118
|
+
GROUP BY query_preview
|
|
119
|
+
ORDER BY count DESC
|
|
120
|
+
LIMIT 3
|
|
121
|
+
`
|
|
122
|
+
)
|
|
123
|
+
.all() as AttentionRow[];
|
|
124
|
+
|
|
125
|
+
if (recentAttention.length > 0) {
|
|
126
|
+
console.log(chalk.blue('\nšļø Recent Query Patterns:\n'));
|
|
127
|
+
recentAttention.forEach((pattern) => {
|
|
128
|
+
console.log(
|
|
129
|
+
chalk.yellow('?') + ` "${pattern.query_preview}..." (${pattern.count}x)`
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Show context decay
|
|
135
|
+
const oldContexts = db
|
|
136
|
+
.prepare(
|
|
137
|
+
`
|
|
138
|
+
SELECT COUNT(*) as count
|
|
139
|
+
FROM contexts
|
|
140
|
+
WHERE last_accessed < unixepoch() - 86400 * 7
|
|
141
|
+
`
|
|
142
|
+
)
|
|
143
|
+
.get() as CountResult;
|
|
144
|
+
|
|
145
|
+
if (oldContexts.count > 0) {
|
|
146
|
+
console.log(
|
|
147
|
+
chalk.yellow(
|
|
148
|
+
`\nā ļø ${oldContexts.count} contexts haven't been accessed in 7+ days`
|
|
149
|
+
)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
console.log(
|
|
154
|
+
chalk.gray(
|
|
155
|
+
'\nš” Tip: Run "npm run analyze" for detailed attention analysis\n'
|
|
156
|
+
)
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
db.close();
|