@stackmemoryai/stackmemory 0.3.17 → 0.3.19
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/dist/cli/claude-sm.js +51 -5
- package/dist/cli/claude-sm.js.map +2 -2
- package/dist/cli/codex-sm.js +52 -19
- package/dist/cli/codex-sm.js.map +2 -2
- package/dist/cli/commands/db.js +143 -0
- package/dist/cli/commands/db.js.map +7 -0
- package/dist/cli/commands/login.js +50 -0
- package/dist/cli/commands/login.js.map +7 -0
- package/dist/cli/commands/migrate.js +178 -0
- package/dist/cli/commands/migrate.js.map +7 -0
- package/dist/cli/commands/onboard.js +158 -2
- package/dist/cli/commands/onboard.js.map +2 -2
- package/dist/cli/commands/skills.js +15 -2
- package/dist/cli/commands/skills.js.map +2 -2
- package/dist/cli/index.js +118 -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-database.js +1 -0
- package/dist/core/context/frame-database.js.map +2 -2
- package/dist/core/context/frame-manager.js +59 -2
- package/dist/core/context/frame-manager.js.map +2 -2
- package/dist/core/database/database-adapter.js +6 -1
- package/dist/core/database/database-adapter.js.map +2 -2
- package/dist/core/database/sqlite-adapter.js +60 -2
- package/dist/core/database/sqlite-adapter.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/index.js +843 -82
- package/dist/servers/railway/index.js.map +3 -3
- 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 +13 -21
- 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-railway-deployment.sh +37 -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/scripts/verify-railway-schema.ts +35 -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,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Linear OAuth Setup Script
|
|
4
|
+
# Sets up environment variables for Linear OAuth integration
|
|
5
|
+
|
|
6
|
+
echo "🔧 Setting up Linear OAuth environment..."
|
|
7
|
+
|
|
8
|
+
# Load from .env.linear if it exists
|
|
9
|
+
if [ -f ".env.linear" ]; then
|
|
10
|
+
echo "📄 Loading configuration from .env.linear"
|
|
11
|
+
export $(cat .env.linear | grep -v '^#' | xargs)
|
|
12
|
+
else
|
|
13
|
+
echo "❌ .env.linear file not found!"
|
|
14
|
+
echo "Creating template .env.linear file..."
|
|
15
|
+
cat > .env.linear << 'EOF'
|
|
16
|
+
# Linear OAuth Configuration
|
|
17
|
+
# LINEAR_CLIENT_ID=your_client_id_here
|
|
18
|
+
# LINEAR_CLIENT_SECRET=your_client_secret_here
|
|
19
|
+
# LINEAR_OAUTH_TOKEN=your_oauth_token_here
|
|
20
|
+
LINEAR_REDIRECT_URI=http://localhost:3456/auth/linear/callback
|
|
21
|
+
EOF
|
|
22
|
+
echo "⚠️ Please edit .env.linear and add your Linear OAuth credentials"
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Verify environment variables are set
|
|
27
|
+
if [ -z "$LINEAR_CLIENT_ID" ] || [ -z "$LINEAR_CLIENT_SECRET" ]; then
|
|
28
|
+
echo "❌ Error: LINEAR_CLIENT_ID or LINEAR_CLIENT_SECRET not set"
|
|
29
|
+
echo "Please check your .env.linear file"
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
echo "✅ Linear OAuth environment configured:"
|
|
34
|
+
echo " CLIENT_ID: ${LINEAR_CLIENT_ID:0:8}..."
|
|
35
|
+
echo " CLIENT_SECRET: ${LINEAR_CLIENT_SECRET:0:20}..."
|
|
36
|
+
echo " REDIRECT_URI: $LINEAR_REDIRECT_URI"
|
|
37
|
+
echo ""
|
|
38
|
+
echo "📝 Next steps:"
|
|
39
|
+
echo "1. Ensure your Linear OAuth app redirect URI is set to:"
|
|
40
|
+
echo " $LINEAR_REDIRECT_URI"
|
|
41
|
+
echo ""
|
|
42
|
+
echo "2. Run authentication:"
|
|
43
|
+
echo " npx stackmemory linear auth"
|
|
44
|
+
echo ""
|
|
45
|
+
echo "3. Or use this script to set environment in current shell:"
|
|
46
|
+
echo " source scripts/setup-linear-oauth.sh"
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# StackMemory MCP Setup Script
|
|
4
|
+
# This script configures StackMemory as an MCP server for Claude Desktop
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
echo "🔧 StackMemory MCP Setup for Claude Desktop"
|
|
9
|
+
echo "============================================"
|
|
10
|
+
|
|
11
|
+
# Check if npm is installed
|
|
12
|
+
if ! command -v npm &> /dev/null; then
|
|
13
|
+
echo "❌ npm is not installed. Please install Node.js first."
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
# Install or update StackMemory globally
|
|
18
|
+
echo "📦 Installing/updating StackMemory..."
|
|
19
|
+
npm install -g @stackmemoryai/stackmemory@latest
|
|
20
|
+
|
|
21
|
+
# Get the global npm bin directory
|
|
22
|
+
NPM_BIN=$(npm bin -g)
|
|
23
|
+
STACKMEMORY_CMD="$NPM_BIN/stackmemory"
|
|
24
|
+
|
|
25
|
+
# Check if stackmemory was installed
|
|
26
|
+
if [ ! -f "$STACKMEMORY_CMD" ]; then
|
|
27
|
+
echo "❌ StackMemory installation failed"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
echo "✅ StackMemory installed at: $STACKMEMORY_CMD"
|
|
32
|
+
|
|
33
|
+
# Create Claude Desktop config directory if it doesn't exist
|
|
34
|
+
CLAUDE_CONFIG_DIR="$HOME/Library/Application Support/Claude"
|
|
35
|
+
mkdir -p "$CLAUDE_CONFIG_DIR"
|
|
36
|
+
|
|
37
|
+
# Backup existing config if it exists
|
|
38
|
+
CONFIG_FILE="$CLAUDE_CONFIG_DIR/claude_desktop_config.json"
|
|
39
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
40
|
+
echo "📋 Backing up existing Claude config..."
|
|
41
|
+
cp "$CONFIG_FILE" "$CONFIG_FILE.backup.$(date +%Y%m%d_%H%M%S)"
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Get current project directory
|
|
45
|
+
DEFAULT_PROJECT="$PWD"
|
|
46
|
+
read -p "Enter project directory for StackMemory [$DEFAULT_PROJECT]: " PROJECT_DIR
|
|
47
|
+
PROJECT_DIR="${PROJECT_DIR:-$DEFAULT_PROJECT}"
|
|
48
|
+
|
|
49
|
+
# Check for Linear API key
|
|
50
|
+
read -p "Enter your Linear API key (optional, press Enter to skip): " LINEAR_KEY
|
|
51
|
+
|
|
52
|
+
# Create the Claude Desktop configuration
|
|
53
|
+
echo "📝 Creating Claude Desktop configuration..."
|
|
54
|
+
|
|
55
|
+
# Build the config JSON
|
|
56
|
+
CONFIG_JSON=$(cat <<EOF
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"stackmemory": {
|
|
60
|
+
"command": "$STACKMEMORY_CMD",
|
|
61
|
+
"args": ["mcp-server", "--project", "$PROJECT_DIR"],
|
|
62
|
+
"env": {
|
|
63
|
+
"PROJECT_ROOT": "$PROJECT_DIR"
|
|
64
|
+
EOF
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Add Linear API key if provided
|
|
68
|
+
if [ -n "$LINEAR_KEY" ]; then
|
|
69
|
+
CONFIG_JSON+=",
|
|
70
|
+
\"LINEAR_API_KEY\": \"$LINEAR_KEY\""
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
CONFIG_JSON+="
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}"
|
|
78
|
+
|
|
79
|
+
# Write the configuration
|
|
80
|
+
echo "$CONFIG_JSON" > "$CONFIG_FILE"
|
|
81
|
+
|
|
82
|
+
echo "✅ Claude Desktop configuration created!"
|
|
83
|
+
|
|
84
|
+
# Initialize StackMemory in the project if needed
|
|
85
|
+
if [ ! -d "$PROJECT_DIR/.stackmemory" ]; then
|
|
86
|
+
echo "📂 Initializing StackMemory in project..."
|
|
87
|
+
cd "$PROJECT_DIR"
|
|
88
|
+
stackmemory init
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
echo ""
|
|
92
|
+
echo "🎉 Setup complete!"
|
|
93
|
+
echo ""
|
|
94
|
+
echo "📍 Configuration details:"
|
|
95
|
+
echo " - StackMemory: $STACKMEMORY_CMD"
|
|
96
|
+
echo " - Project: $PROJECT_DIR"
|
|
97
|
+
echo " - Config: $CONFIG_FILE"
|
|
98
|
+
if [ -n "$LINEAR_KEY" ]; then
|
|
99
|
+
echo " - Linear: Configured ✅"
|
|
100
|
+
fi
|
|
101
|
+
echo ""
|
|
102
|
+
echo "🚀 Next steps:"
|
|
103
|
+
echo " 1. Restart Claude Desktop"
|
|
104
|
+
echo " 2. StackMemory will be available as an MCP server"
|
|
105
|
+
echo " 3. Use 'stackmemory status' to verify setup"
|
|
106
|
+
echo ""
|
|
107
|
+
echo "📚 Available commands in Claude:"
|
|
108
|
+
echo " - save_context: Save important context"
|
|
109
|
+
echo " - load_context: Retrieve previous context"
|
|
110
|
+
echo " - review_recent: Review recent messages"
|
|
111
|
+
echo " - monitor_check: Manual checkpoint"
|
|
112
|
+
echo ""
|
|
113
|
+
echo "For more info: https://github.com/stackmemoryai/stackmemory"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
echo "🚂 Railway Deployment Setup Script"
|
|
4
|
+
echo "=================================="
|
|
5
|
+
echo ""
|
|
6
|
+
echo "This script will guide you through setting up automatic Railway deployments"
|
|
7
|
+
echo ""
|
|
8
|
+
|
|
9
|
+
# Check if Railway CLI is installed
|
|
10
|
+
if ! command -v railway &> /dev/null; then
|
|
11
|
+
echo "📦 Installing Railway CLI..."
|
|
12
|
+
npm install -g @railway/cli
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# Check if logged in to Railway
|
|
16
|
+
echo "🔐 Checking Railway authentication..."
|
|
17
|
+
if ! railway whoami &> /dev/null; then
|
|
18
|
+
echo "Please log in to Railway:"
|
|
19
|
+
railway login
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Get project ID
|
|
23
|
+
echo ""
|
|
24
|
+
echo "🔍 Getting Railway project information..."
|
|
25
|
+
RAILWAY_PROJECT_ID=$(railway status --json 2>/dev/null | jq -r '.projectId' 2>/dev/null)
|
|
26
|
+
|
|
27
|
+
if [ -z "$RAILWAY_PROJECT_ID" ]; then
|
|
28
|
+
echo "No Railway project linked. Would you like to:"
|
|
29
|
+
echo "1) Link an existing project"
|
|
30
|
+
echo "2) Create a new project"
|
|
31
|
+
read -p "Choose option (1 or 2): " option
|
|
32
|
+
|
|
33
|
+
if [ "$option" = "1" ]; then
|
|
34
|
+
railway link
|
|
35
|
+
else
|
|
36
|
+
railway init
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
RAILWAY_PROJECT_ID=$(railway status --json | jq -r '.projectId')
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Get Railway token
|
|
43
|
+
echo ""
|
|
44
|
+
echo "🔑 To enable GitHub Actions deployment, you need a Railway API token."
|
|
45
|
+
echo " Visit: https://railway.app/account/tokens"
|
|
46
|
+
echo " Create a new token and copy it."
|
|
47
|
+
echo ""
|
|
48
|
+
read -p "Enter your Railway API token (it will be hidden): " -s RAILWAY_TOKEN
|
|
49
|
+
echo ""
|
|
50
|
+
|
|
51
|
+
# Display GitHub secrets to add
|
|
52
|
+
echo ""
|
|
53
|
+
echo "✅ Setup complete! Now add these secrets to your GitHub repository:"
|
|
54
|
+
echo ""
|
|
55
|
+
echo "1. Go to: https://github.com/$(git remote get-url origin | sed 's/.*github.com[:/]\(.*\)\.git/\1/')/settings/secrets/actions"
|
|
56
|
+
echo ""
|
|
57
|
+
echo "2. Add these repository secrets:"
|
|
58
|
+
echo " • RAILWAY_TOKEN = (your token - hidden for security)"
|
|
59
|
+
echo " • RAILWAY_PROJECT_ID = $RAILWAY_PROJECT_ID"
|
|
60
|
+
echo ""
|
|
61
|
+
echo "3. Railway deployments will trigger automatically on:"
|
|
62
|
+
echo " • Push to main/master branch → Production deployment"
|
|
63
|
+
echo " • Pull requests → Preview deployments"
|
|
64
|
+
echo ""
|
|
65
|
+
|
|
66
|
+
# Optional: Test deployment
|
|
67
|
+
read -p "Would you like to test the deployment now? (y/n): " test_deploy
|
|
68
|
+
if [ "$test_deploy" = "y" ]; then
|
|
69
|
+
echo ""
|
|
70
|
+
echo "🚀 Testing deployment..."
|
|
71
|
+
railway up --detach
|
|
72
|
+
echo "✅ Deployment initiated! Check your Railway dashboard for status."
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
echo ""
|
|
76
|
+
echo "📝 Additional configuration:"
|
|
77
|
+
echo " • Edit railway.json to customize build/deploy settings"
|
|
78
|
+
echo " • Edit .github/workflows/railway-deploy.yml to customize CI/CD"
|
|
79
|
+
echo " • Visit Railway dashboard to configure environment variables"
|
|
80
|
+
echo ""
|
|
81
|
+
echo "🎉 Railway deployment setup complete!"
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Auto-handoff script for Claude session termination
|
|
3
|
+
# Captures context and creates handoff file when Claude is killed
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Configuration
|
|
8
|
+
STACKMEMORY_DIR="${HOME}/.stackmemory"
|
|
9
|
+
HANDOFF_DIR="${STACKMEMORY_DIR}/handoffs"
|
|
10
|
+
CURRENT_HANDOFF="${HANDOFF_DIR}/current.json"
|
|
11
|
+
HANDOFF_ARCHIVE="${HANDOFF_DIR}/archive"
|
|
12
|
+
|
|
13
|
+
# Colors for output
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
BLUE='\033[0;34m'
|
|
18
|
+
NC='\033[0m' # No Color
|
|
19
|
+
|
|
20
|
+
# Ensure directories exist
|
|
21
|
+
mkdir -p "$HANDOFF_DIR" "$HANDOFF_ARCHIVE"
|
|
22
|
+
|
|
23
|
+
# Function to capture current context
|
|
24
|
+
capture_context() {
|
|
25
|
+
local timestamp=$(date +%Y%m%d_%H%M%S)
|
|
26
|
+
local handoff_file="${HANDOFF_DIR}/handoff_${timestamp}.json"
|
|
27
|
+
|
|
28
|
+
echo -e "${BLUE}📸 Capturing session context...${NC}"
|
|
29
|
+
|
|
30
|
+
# Capture git status
|
|
31
|
+
local git_status=""
|
|
32
|
+
local git_branch=""
|
|
33
|
+
local uncommitted_files=""
|
|
34
|
+
|
|
35
|
+
if git rev-parse --git-dir > /dev/null 2>&1; then
|
|
36
|
+
git_branch=$(git branch --show-current)
|
|
37
|
+
git_status=$(git status --short)
|
|
38
|
+
uncommitted_files=$(git diff --name-only)
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Capture StackMemory context if available
|
|
42
|
+
local sm_context=""
|
|
43
|
+
local recent_traces=""
|
|
44
|
+
local active_tasks=""
|
|
45
|
+
|
|
46
|
+
if command -v stackmemory &> /dev/null; then
|
|
47
|
+
sm_context=$(stackmemory context show --json 2>/dev/null || echo "{}")
|
|
48
|
+
recent_traces=$(stackmemory trace list --limit 5 --json 2>/dev/null || echo "[]")
|
|
49
|
+
active_tasks=$(stackmemory tasks list --status in_progress --json 2>/dev/null || echo "[]")
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Get current working directory and recent commands
|
|
53
|
+
local cwd=$(pwd)
|
|
54
|
+
local recent_commands=$(history | tail -20 | awk '{$1=""; print $0}' | sed 's/^ //')
|
|
55
|
+
|
|
56
|
+
# Get modified files in last hour
|
|
57
|
+
local recent_files=$(find . -type f -mmin -60 2>/dev/null | head -20 || echo "")
|
|
58
|
+
|
|
59
|
+
# Create handoff JSON
|
|
60
|
+
cat > "$handoff_file" << EOF
|
|
61
|
+
{
|
|
62
|
+
"timestamp": "$timestamp",
|
|
63
|
+
"session": {
|
|
64
|
+
"cwd": "$cwd",
|
|
65
|
+
"user": "$USER",
|
|
66
|
+
"hostname": "$(hostname)",
|
|
67
|
+
"pid": "$$"
|
|
68
|
+
},
|
|
69
|
+
"git": {
|
|
70
|
+
"branch": "$git_branch",
|
|
71
|
+
"status": $(echo "$git_status" | jq -R -s -c 'split("\n") | map(select(length > 0))'),
|
|
72
|
+
"uncommitted": $(echo "$uncommitted_files" | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
|
73
|
+
},
|
|
74
|
+
"stackmemory": {
|
|
75
|
+
"context": $sm_context,
|
|
76
|
+
"recent_traces": $recent_traces,
|
|
77
|
+
"active_tasks": $active_tasks
|
|
78
|
+
},
|
|
79
|
+
"files": {
|
|
80
|
+
"recently_modified": $(echo "$recent_files" | jq -R -s -c 'split("\n") | map(select(length > 0))'),
|
|
81
|
+
"open_in_editor": $(lsof -c vim -c nvim -c code 2>/dev/null | grep REG | awk '{print $NF}' | jq -R -s -c 'split("\n") | map(select(length > 0))' || echo "[]")
|
|
82
|
+
},
|
|
83
|
+
"commands": {
|
|
84
|
+
"recent": $(echo "$recent_commands" | jq -R -s -c 'split("\n") | map(select(length > 0))')
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
EOF
|
|
88
|
+
|
|
89
|
+
# Create symlink to current handoff
|
|
90
|
+
ln -sf "$handoff_file" "$CURRENT_HANDOFF"
|
|
91
|
+
|
|
92
|
+
echo -e "${GREEN}✅ Context captured: ${handoff_file}${NC}"
|
|
93
|
+
|
|
94
|
+
# Generate handoff prompt
|
|
95
|
+
generate_handoff_prompt "$handoff_file"
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Function to generate handoff prompt from captured context
|
|
99
|
+
generate_handoff_prompt() {
|
|
100
|
+
local handoff_file=$1
|
|
101
|
+
local prompt_file="${HANDOFF_DIR}/handoff_prompt.md"
|
|
102
|
+
|
|
103
|
+
echo -e "${BLUE}📝 Generating handoff prompt...${NC}"
|
|
104
|
+
|
|
105
|
+
# Parse JSON data
|
|
106
|
+
local timestamp=$(jq -r '.timestamp' "$handoff_file")
|
|
107
|
+
local cwd=$(jq -r '.session.cwd' "$handoff_file")
|
|
108
|
+
local git_branch=$(jq -r '.git.branch' "$handoff_file")
|
|
109
|
+
local uncommitted=$(jq -r '.git.uncommitted[]' "$handoff_file" 2>/dev/null | head -10)
|
|
110
|
+
local active_tasks=$(jq -r '.stackmemory.active_tasks[].content' "$handoff_file" 2>/dev/null)
|
|
111
|
+
local recent_files=$(jq -r '.files.recently_modified[]' "$handoff_file" 2>/dev/null | head -10)
|
|
112
|
+
|
|
113
|
+
# Create handoff prompt
|
|
114
|
+
cat > "$prompt_file" << EOF
|
|
115
|
+
# Session Handoff - $timestamp
|
|
116
|
+
|
|
117
|
+
## Context
|
|
118
|
+
Continuing work from previous session in \`$cwd\` on branch \`$git_branch\`.
|
|
119
|
+
|
|
120
|
+
## Uncommitted Changes
|
|
121
|
+
$(if [ -n "$uncommitted" ]; then
|
|
122
|
+
echo "The following files have uncommitted changes:"
|
|
123
|
+
echo "$uncommitted" | while read -r file; do
|
|
124
|
+
echo "- $file"
|
|
125
|
+
done
|
|
126
|
+
else
|
|
127
|
+
echo "No uncommitted changes."
|
|
128
|
+
fi)
|
|
129
|
+
|
|
130
|
+
## Active Tasks
|
|
131
|
+
$(if [ -n "$active_tasks" ]; then
|
|
132
|
+
echo "Tasks in progress:"
|
|
133
|
+
echo "$active_tasks" | while read -r task; do
|
|
134
|
+
echo "- $task"
|
|
135
|
+
done
|
|
136
|
+
else
|
|
137
|
+
echo "No active tasks recorded."
|
|
138
|
+
fi)
|
|
139
|
+
|
|
140
|
+
## Recently Modified Files
|
|
141
|
+
$(if [ -n "$recent_files" ]; then
|
|
142
|
+
echo "Files modified in the last hour:"
|
|
143
|
+
echo "$recent_files" | while read -r file; do
|
|
144
|
+
echo "- $file"
|
|
145
|
+
done | head -10
|
|
146
|
+
else
|
|
147
|
+
echo "No recently modified files."
|
|
148
|
+
fi)
|
|
149
|
+
|
|
150
|
+
## Instructions
|
|
151
|
+
Please continue the work from where we left off. Check the uncommitted changes and active tasks to understand what needs to be completed.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
*Generated by auto-handoff on $(date)*
|
|
155
|
+
EOF
|
|
156
|
+
|
|
157
|
+
echo -e "${GREEN}✅ Handoff prompt saved: ${prompt_file}${NC}"
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# Function to restore from handoff
|
|
161
|
+
restore_handoff() {
|
|
162
|
+
if [ ! -f "$CURRENT_HANDOFF" ]; then
|
|
163
|
+
echo -e "${YELLOW}⚠️ No handoff file found${NC}"
|
|
164
|
+
return 1
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
echo -e "${BLUE}🔄 Restoring from handoff...${NC}"
|
|
168
|
+
|
|
169
|
+
# Display handoff prompt if it exists
|
|
170
|
+
local prompt_file="${HANDOFF_DIR}/handoff_prompt.md"
|
|
171
|
+
if [ -f "$prompt_file" ]; then
|
|
172
|
+
echo -e "${GREEN}📋 Handoff Prompt:${NC}"
|
|
173
|
+
echo "----------------------------------------"
|
|
174
|
+
cat "$prompt_file"
|
|
175
|
+
echo "----------------------------------------"
|
|
176
|
+
|
|
177
|
+
# Copy to clipboard if possible
|
|
178
|
+
if command -v pbcopy &> /dev/null; then
|
|
179
|
+
cat "$prompt_file" | pbcopy
|
|
180
|
+
echo -e "${GREEN}✅ Handoff prompt copied to clipboard${NC}"
|
|
181
|
+
elif command -v xclip &> /dev/null; then
|
|
182
|
+
cat "$prompt_file" | xclip -selection clipboard
|
|
183
|
+
echo -e "${GREEN}✅ Handoff prompt copied to clipboard${NC}"
|
|
184
|
+
fi
|
|
185
|
+
fi
|
|
186
|
+
|
|
187
|
+
# Show git status
|
|
188
|
+
local git_branch=$(jq -r '.git.branch' "$CURRENT_HANDOFF")
|
|
189
|
+
if [ -n "$git_branch" ]; then
|
|
190
|
+
echo -e "${BLUE}Git branch: ${git_branch}${NC}"
|
|
191
|
+
git status --short
|
|
192
|
+
fi
|
|
193
|
+
|
|
194
|
+
# Show active tasks
|
|
195
|
+
local active_tasks=$(jq -r '.stackmemory.active_tasks[].content' "$CURRENT_HANDOFF" 2>/dev/null)
|
|
196
|
+
if [ -n "$active_tasks" ]; then
|
|
197
|
+
echo -e "${BLUE}Active tasks:${NC}"
|
|
198
|
+
echo "$active_tasks" | while read -r task; do
|
|
199
|
+
echo " • $task"
|
|
200
|
+
done
|
|
201
|
+
fi
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# Function to clean old handoffs
|
|
205
|
+
cleanup_handoffs() {
|
|
206
|
+
echo -e "${BLUE}🧹 Cleaning old handoffs...${NC}"
|
|
207
|
+
|
|
208
|
+
# Archive handoffs older than 7 days
|
|
209
|
+
find "$HANDOFF_DIR" -name "handoff_*.json" -mtime +7 -exec mv {} "$HANDOFF_ARCHIVE" \; 2>/dev/null
|
|
210
|
+
|
|
211
|
+
# Delete archives older than 30 days
|
|
212
|
+
find "$HANDOFF_ARCHIVE" -name "handoff_*.json" -mtime +30 -delete 2>/dev/null
|
|
213
|
+
|
|
214
|
+
echo -e "${GREEN}✅ Cleanup complete${NC}"
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
# Signal handler for graceful shutdown
|
|
218
|
+
handle_termination() {
|
|
219
|
+
echo -e "\n${YELLOW}⚠️ Session terminating...${NC}"
|
|
220
|
+
capture_context
|
|
221
|
+
echo -e "${GREEN}✨ Handoff complete! Run 'auto-handoff restore' to continue${NC}"
|
|
222
|
+
exit 0
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
# Main script logic
|
|
226
|
+
case "${1:-}" in
|
|
227
|
+
capture)
|
|
228
|
+
capture_context
|
|
229
|
+
;;
|
|
230
|
+
restore)
|
|
231
|
+
restore_handoff
|
|
232
|
+
;;
|
|
233
|
+
cleanup)
|
|
234
|
+
cleanup_handoffs
|
|
235
|
+
;;
|
|
236
|
+
watch)
|
|
237
|
+
# Set up signal handlers
|
|
238
|
+
trap handle_termination SIGINT SIGTERM SIGHUP
|
|
239
|
+
|
|
240
|
+
echo -e "${BLUE}👀 Watching session... Press Ctrl+C to capture handoff${NC}"
|
|
241
|
+
echo -e "${YELLOW}Run this in your Claude session to enable auto-handoff${NC}"
|
|
242
|
+
|
|
243
|
+
# Keep script running
|
|
244
|
+
while true; do
|
|
245
|
+
sleep 1
|
|
246
|
+
done
|
|
247
|
+
;;
|
|
248
|
+
*)
|
|
249
|
+
echo "Usage: $0 {capture|restore|cleanup|watch}"
|
|
250
|
+
echo ""
|
|
251
|
+
echo "Commands:"
|
|
252
|
+
echo " capture - Manually capture current context"
|
|
253
|
+
echo " restore - Restore from last handoff"
|
|
254
|
+
echo " cleanup - Clean old handoff files"
|
|
255
|
+
echo " watch - Watch session and capture on termination"
|
|
256
|
+
echo ""
|
|
257
|
+
echo "Example:"
|
|
258
|
+
echo " $0 watch # Run in Claude session for auto-capture"
|
|
259
|
+
echo " $0 restore # Run in new session to get context"
|
|
260
|
+
exit 1
|
|
261
|
+
;;
|
|
262
|
+
esac
|