@stackmemoryai/stackmemory 0.3.17 ā 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/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,88 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Codex CLI wrapper with StackMemory integration
|
|
4
|
+
# Usage: Add alias to your shell: alias codex-sm='~/Dev/stackmemory/scripts/codex-wrapper.sh'
|
|
5
|
+
|
|
6
|
+
# Check for auto-sync flag
|
|
7
|
+
AUTO_SYNC=false
|
|
8
|
+
SYNC_INTERVAL=5
|
|
9
|
+
for arg in "$@"; do
|
|
10
|
+
case $arg in
|
|
11
|
+
--auto-sync)
|
|
12
|
+
AUTO_SYNC=true
|
|
13
|
+
shift
|
|
14
|
+
;;
|
|
15
|
+
--sync-interval=*)
|
|
16
|
+
SYNC_INTERVAL="${arg#*=}"
|
|
17
|
+
shift
|
|
18
|
+
;;
|
|
19
|
+
esac
|
|
20
|
+
done
|
|
21
|
+
|
|
22
|
+
# Auto-initialize StackMemory if in git repo without it
|
|
23
|
+
if [ -d ".git" ] && [ ! -d ".stackmemory" ]; then
|
|
24
|
+
echo "š¦ Initializing StackMemory for this project..."
|
|
25
|
+
stackmemory init --silent 2>/dev/null || true
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
# Load existing context if available
|
|
29
|
+
if [ -d ".stackmemory" ]; then
|
|
30
|
+
echo "š§ Loading StackMemory context..."
|
|
31
|
+
stackmemory status --brief 2>/dev/null || true
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
# Start Linear auto-sync in background if requested
|
|
35
|
+
SYNC_PID=""
|
|
36
|
+
if [ "$AUTO_SYNC" = true ] && [ -n "$LINEAR_API_KEY" ]; then
|
|
37
|
+
echo "š Starting Linear auto-sync (${SYNC_INTERVAL}min intervals)..."
|
|
38
|
+
(
|
|
39
|
+
while true; do
|
|
40
|
+
sleep $((SYNC_INTERVAL * 60))
|
|
41
|
+
if [ -d ".stackmemory" ]; then
|
|
42
|
+
stackmemory linear sync --quiet 2>/dev/null || true
|
|
43
|
+
fi
|
|
44
|
+
done
|
|
45
|
+
) &
|
|
46
|
+
SYNC_PID=$!
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
cleanup() {
|
|
50
|
+
echo ""
|
|
51
|
+
echo "š Saving StackMemory context..."
|
|
52
|
+
|
|
53
|
+
# Kill auto-sync if running
|
|
54
|
+
if [ -n "$SYNC_PID" ] && kill -0 $SYNC_PID 2>/dev/null; then
|
|
55
|
+
echo "š Stopping auto-sync..."
|
|
56
|
+
kill $SYNC_PID 2>/dev/null || true
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Check if in a git repo with stackmemory
|
|
60
|
+
if [ -d ".stackmemory" ]; then
|
|
61
|
+
# Save current context
|
|
62
|
+
stackmemory status 2>/dev/null
|
|
63
|
+
|
|
64
|
+
# If Linear API key is set, final sync
|
|
65
|
+
if [ -n "$LINEAR_API_KEY" ]; then
|
|
66
|
+
echo "š Final Linear sync..."
|
|
67
|
+
stackmemory linear sync 2>/dev/null
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
echo "ā
StackMemory context saved"
|
|
71
|
+
fi
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Set trap for exit signals
|
|
75
|
+
# shellcheck disable=SC2064
|
|
76
|
+
trap cleanup EXIT INT TERM
|
|
77
|
+
|
|
78
|
+
# Run Codex CLI
|
|
79
|
+
if command -v codex &> /dev/null; then
|
|
80
|
+
codex "$@"
|
|
81
|
+
elif command -v codex-cli &> /dev/null; then
|
|
82
|
+
codex-cli "$@"
|
|
83
|
+
else
|
|
84
|
+
echo "ā Codex CLI not found. Please install it first."
|
|
85
|
+
echo " See: https://github.com/openai/codex-cli"
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# StackMemory Sandbox Environment Creator
|
|
4
|
+
# Creates an isolated test environment for local development
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
echo "šļø StackMemory Sandbox Environment Creator"
|
|
15
|
+
echo "==========================================="
|
|
16
|
+
|
|
17
|
+
# Configuration
|
|
18
|
+
SANDBOX_BASE="/tmp/stackmemory-sandbox"
|
|
19
|
+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
20
|
+
SANDBOX_DIR="${SANDBOX_BASE}/${TIMESTAMP}"
|
|
21
|
+
SOURCE_DIR="$(pwd)"
|
|
22
|
+
|
|
23
|
+
# Parse arguments
|
|
24
|
+
PROJECT_PATH="${1:-/tmp/test-project}"
|
|
25
|
+
CLEAN_INSTALL="${2:-true}"
|
|
26
|
+
|
|
27
|
+
echo -e "\n${GREEN}Configuration:${NC}"
|
|
28
|
+
echo " Source: $SOURCE_DIR"
|
|
29
|
+
echo " Sandbox: $SANDBOX_DIR"
|
|
30
|
+
echo " Test Project: $PROJECT_PATH"
|
|
31
|
+
echo ""
|
|
32
|
+
|
|
33
|
+
# Create sandbox directory
|
|
34
|
+
echo -e "${YELLOW}š Creating sandbox directory...${NC}"
|
|
35
|
+
mkdir -p "$SANDBOX_DIR"
|
|
36
|
+
mkdir -p "$PROJECT_PATH"
|
|
37
|
+
|
|
38
|
+
# Copy source files (excluding node_modules, dist, .git)
|
|
39
|
+
echo -e "${YELLOW}š Copying source files...${NC}"
|
|
40
|
+
rsync -av \
|
|
41
|
+
--exclude='node_modules' \
|
|
42
|
+
--exclude='dist' \
|
|
43
|
+
--exclude='.git' \
|
|
44
|
+
--exclude='*.tgz' \
|
|
45
|
+
--exclude='.stackmemory' \
|
|
46
|
+
--exclude='package-lock.json' \
|
|
47
|
+
"$SOURCE_DIR/" "$SANDBOX_DIR/"
|
|
48
|
+
|
|
49
|
+
# Navigate to sandbox
|
|
50
|
+
cd "$SANDBOX_DIR"
|
|
51
|
+
|
|
52
|
+
# Create sandbox-specific configuration
|
|
53
|
+
echo -e "${YELLOW}āļø Creating sandbox configuration...${NC}"
|
|
54
|
+
cat > sandbox.config.json << EOF
|
|
55
|
+
{
|
|
56
|
+
"environment": "sandbox",
|
|
57
|
+
"timestamp": "$TIMESTAMP",
|
|
58
|
+
"sourceDir": "$SOURCE_DIR",
|
|
59
|
+
"projectPath": "$PROJECT_PATH",
|
|
60
|
+
"port": 3333,
|
|
61
|
+
"features": {
|
|
62
|
+
"autoUpdate": false,
|
|
63
|
+
"telemetry": false,
|
|
64
|
+
"production": false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
EOF
|
|
68
|
+
|
|
69
|
+
# Update package.json for sandbox
|
|
70
|
+
echo -e "${YELLOW}š¦ Updating package.json for sandbox...${NC}"
|
|
71
|
+
node -e "
|
|
72
|
+
const fs = require('fs');
|
|
73
|
+
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
|
74
|
+
pkg.name = '@stackmemory-sandbox/stackmemory';
|
|
75
|
+
pkg.version = pkg.version + '-sandbox.$TIMESTAMP';
|
|
76
|
+
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
|
|
77
|
+
console.log('Updated package name to:', pkg.name);
|
|
78
|
+
console.log('Updated version to:', pkg.version);
|
|
79
|
+
"
|
|
80
|
+
|
|
81
|
+
# Install dependencies
|
|
82
|
+
if [ "$CLEAN_INSTALL" = "true" ]; then
|
|
83
|
+
echo -e "${YELLOW}š„ Installing dependencies...${NC}"
|
|
84
|
+
npm install --silent
|
|
85
|
+
else
|
|
86
|
+
echo -e "${YELLOW}š„ Copying node_modules from source...${NC}"
|
|
87
|
+
cp -r "$SOURCE_DIR/node_modules" .
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Build the sandbox version
|
|
91
|
+
echo -e "${YELLOW}šØ Building sandbox version...${NC}"
|
|
92
|
+
npm run build
|
|
93
|
+
|
|
94
|
+
# Create test environment script
|
|
95
|
+
echo -e "${YELLOW}š§Ŗ Creating test environment...${NC}"
|
|
96
|
+
cat > run-sandbox.sh << 'EOF'
|
|
97
|
+
#!/bin/bash
|
|
98
|
+
|
|
99
|
+
# Sandbox Test Runner
|
|
100
|
+
echo "š§Ŗ StackMemory Sandbox Test Environment"
|
|
101
|
+
echo "======================================="
|
|
102
|
+
|
|
103
|
+
# Set sandbox environment variables
|
|
104
|
+
export STACKMEMORY_ENV=sandbox
|
|
105
|
+
export STACKMEMORY_DEBUG=true
|
|
106
|
+
export PROJECT_ROOT="$1"
|
|
107
|
+
|
|
108
|
+
# Available commands
|
|
109
|
+
show_help() {
|
|
110
|
+
echo ""
|
|
111
|
+
echo "Available commands:"
|
|
112
|
+
echo " ./run-sandbox.sh init [project_path] - Initialize StackMemory in project"
|
|
113
|
+
echo " ./run-sandbox.sh status - Show status"
|
|
114
|
+
echo " ./run-sandbox.sh mcp-server - Start MCP server"
|
|
115
|
+
echo " ./run-sandbox.sh linear-sync - Test Linear sync"
|
|
116
|
+
echo " ./run-sandbox.sh test - Run all tests"
|
|
117
|
+
echo " ./run-sandbox.sh cli [command] - Run any CLI command"
|
|
118
|
+
echo " ./run-sandbox.sh clean - Clean sandbox"
|
|
119
|
+
echo ""
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
case "$1" in
|
|
123
|
+
init)
|
|
124
|
+
PROJECT="${2:-/tmp/test-project}"
|
|
125
|
+
echo "Initializing StackMemory in: $PROJECT"
|
|
126
|
+
mkdir -p "$PROJECT"
|
|
127
|
+
cd "$PROJECT"
|
|
128
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" init
|
|
129
|
+
;;
|
|
130
|
+
|
|
131
|
+
status)
|
|
132
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" status
|
|
133
|
+
;;
|
|
134
|
+
|
|
135
|
+
mcp-server)
|
|
136
|
+
echo "Starting MCP server on sandbox..."
|
|
137
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" mcp-server --project "${2:-/tmp/test-project}"
|
|
138
|
+
;;
|
|
139
|
+
|
|
140
|
+
linear-sync)
|
|
141
|
+
echo "Testing Linear sync..."
|
|
142
|
+
export LINEAR_API_KEY="${LINEAR_API_KEY:-test_key}"
|
|
143
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" linear sync
|
|
144
|
+
;;
|
|
145
|
+
|
|
146
|
+
test)
|
|
147
|
+
echo "Running tests..."
|
|
148
|
+
cd "$SANDBOX_DIR"
|
|
149
|
+
npm test
|
|
150
|
+
;;
|
|
151
|
+
|
|
152
|
+
cli)
|
|
153
|
+
shift
|
|
154
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" "$@"
|
|
155
|
+
;;
|
|
156
|
+
|
|
157
|
+
clean)
|
|
158
|
+
echo "Cleaning sandbox..."
|
|
159
|
+
rm -rf "$SANDBOX_DIR"
|
|
160
|
+
echo "Sandbox cleaned!"
|
|
161
|
+
;;
|
|
162
|
+
|
|
163
|
+
*)
|
|
164
|
+
show_help
|
|
165
|
+
;;
|
|
166
|
+
esac
|
|
167
|
+
EOF
|
|
168
|
+
|
|
169
|
+
chmod +x run-sandbox.sh
|
|
170
|
+
|
|
171
|
+
# Create test project structure
|
|
172
|
+
echo -e "${YELLOW}šļø Setting up test project...${NC}"
|
|
173
|
+
mkdir -p "$PROJECT_PATH/.stackmemory"
|
|
174
|
+
cd "$PROJECT_PATH"
|
|
175
|
+
|
|
176
|
+
# Initialize git repo for testing
|
|
177
|
+
git init --quiet
|
|
178
|
+
echo "# Test Project" > README.md
|
|
179
|
+
echo "node_modules/" > .gitignore
|
|
180
|
+
git add .
|
|
181
|
+
git commit -m "Initial commit" --quiet
|
|
182
|
+
|
|
183
|
+
# Initialize StackMemory in test project
|
|
184
|
+
echo -e "${YELLOW}š Initializing StackMemory in test project...${NC}"
|
|
185
|
+
node "$SANDBOX_DIR/dist/src/cli/cli.js" init
|
|
186
|
+
|
|
187
|
+
# Create sandbox info file
|
|
188
|
+
echo -e "${YELLOW}š Creating sandbox info...${NC}"
|
|
189
|
+
cat > "$SANDBOX_DIR/SANDBOX_INFO.md" << EOF
|
|
190
|
+
# StackMemory Sandbox Environment
|
|
191
|
+
|
|
192
|
+
Created: $TIMESTAMP
|
|
193
|
+
Location: $SANDBOX_DIR
|
|
194
|
+
Test Project: $PROJECT_PATH
|
|
195
|
+
|
|
196
|
+
## Quick Start
|
|
197
|
+
|
|
198
|
+
\`\`\`bash
|
|
199
|
+
cd $SANDBOX_DIR
|
|
200
|
+
|
|
201
|
+
# Run commands
|
|
202
|
+
./run-sandbox.sh status
|
|
203
|
+
./run-sandbox.sh mcp-server
|
|
204
|
+
./run-sandbox.sh test
|
|
205
|
+
|
|
206
|
+
# Clean up
|
|
207
|
+
./run-sandbox.sh clean
|
|
208
|
+
\`\`\`
|
|
209
|
+
|
|
210
|
+
## Files
|
|
211
|
+
|
|
212
|
+
- Source: $SOURCE_DIR
|
|
213
|
+
- Build: $SANDBOX_DIR/dist
|
|
214
|
+
- Config: $SANDBOX_DIR/sandbox.config.json
|
|
215
|
+
- Test Project: $PROJECT_PATH
|
|
216
|
+
|
|
217
|
+
## Environment Variables
|
|
218
|
+
|
|
219
|
+
- STACKMEMORY_ENV=sandbox
|
|
220
|
+
- STACKMEMORY_DEBUG=true
|
|
221
|
+
- PROJECT_ROOT=$PROJECT_PATH
|
|
222
|
+
|
|
223
|
+
EOF
|
|
224
|
+
|
|
225
|
+
# Create VS Code workspace for sandbox
|
|
226
|
+
cat > "$SANDBOX_DIR/sandbox.code-workspace" << EOF
|
|
227
|
+
{
|
|
228
|
+
"folders": [
|
|
229
|
+
{
|
|
230
|
+
"path": ".",
|
|
231
|
+
"name": "StackMemory Sandbox"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"path": "$PROJECT_PATH",
|
|
235
|
+
"name": "Test Project"
|
|
236
|
+
}
|
|
237
|
+
],
|
|
238
|
+
"settings": {
|
|
239
|
+
"terminal.integrated.env.osx": {
|
|
240
|
+
"STACKMEMORY_ENV": "sandbox",
|
|
241
|
+
"PROJECT_ROOT": "$PROJECT_PATH"
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
EOF
|
|
246
|
+
|
|
247
|
+
# Summary
|
|
248
|
+
echo ""
|
|
249
|
+
echo -e "${GREEN}ā
Sandbox environment created successfully!${NC}"
|
|
250
|
+
echo ""
|
|
251
|
+
echo "š Locations:"
|
|
252
|
+
echo " Sandbox: $SANDBOX_DIR"
|
|
253
|
+
echo " Test Project: $PROJECT_PATH"
|
|
254
|
+
echo ""
|
|
255
|
+
echo "š Quick Start:"
|
|
256
|
+
echo " cd $SANDBOX_DIR"
|
|
257
|
+
echo " ./run-sandbox.sh status"
|
|
258
|
+
echo " ./run-sandbox.sh mcp-server"
|
|
259
|
+
echo ""
|
|
260
|
+
echo "š§¹ Clean up:"
|
|
261
|
+
echo " $SANDBOX_DIR/run-sandbox.sh clean"
|
|
262
|
+
echo ""
|
|
263
|
+
echo "š Full documentation: $SANDBOX_DIR/SANDBOX_INFO.md"
|
|
264
|
+
echo ""
|
|
265
|
+
|
|
266
|
+
# Save sandbox path for easy access
|
|
267
|
+
echo "$SANDBOX_DIR" > /tmp/stackmemory-sandbox-latest
|
|
268
|
+
|
|
269
|
+
echo -e "${GREEN}Sandbox ready! Path saved to: /tmp/stackmemory-sandbox-latest${NC}"
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Debug why Linear updates are failing
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import 'dotenv/config';
|
|
8
|
+
|
|
9
|
+
const API_KEY = process.env.LINEAR_OAUTH_TOKEN || process.env.LINEAR_API_KEY;
|
|
10
|
+
if (!API_KEY) {
|
|
11
|
+
console.error('ā LINEAR_OAUTH_TOKEN or LINEAR_API_KEY environment variable not set');
|
|
12
|
+
console.log('Please set LINEAR_OAUTH_TOKEN or LINEAR_API_KEY in your .env file or export it in your shell');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function debugLinearUpdate() {
|
|
17
|
+
console.log('š Debugging Linear update issues...\n');
|
|
18
|
+
|
|
19
|
+
// First, test basic API access
|
|
20
|
+
console.log('1. Testing API authentication:');
|
|
21
|
+
const testQuery = `
|
|
22
|
+
query TestAuth {
|
|
23
|
+
viewer {
|
|
24
|
+
id
|
|
25
|
+
email
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
let response = await fetch('https://api.linear.app/graphql', {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
'Authorization': `Bearer ${API_KEY}`,
|
|
34
|
+
'Content-Type': 'application/json'
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify({ query: testQuery })
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
let result = await response.json();
|
|
40
|
+
console.log('Auth result:', JSON.stringify(result, null, 2));
|
|
41
|
+
|
|
42
|
+
// Get workflow states
|
|
43
|
+
console.log('\n2. Fetching workflow states:');
|
|
44
|
+
const statesQuery = `
|
|
45
|
+
query GetStates {
|
|
46
|
+
workflowStates {
|
|
47
|
+
nodes {
|
|
48
|
+
id
|
|
49
|
+
name
|
|
50
|
+
type
|
|
51
|
+
team {
|
|
52
|
+
id
|
|
53
|
+
key
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
response = await fetch('https://api.linear.app/graphql', {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: {
|
|
63
|
+
'Authorization': `Bearer ${API_KEY}`,
|
|
64
|
+
'Content-Type': 'application/json'
|
|
65
|
+
},
|
|
66
|
+
body: JSON.stringify({ query: statesQuery })
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
result = await response.json();
|
|
70
|
+
console.log('States:', JSON.stringify(result.data?.workflowStates?.nodes || [], null, 2));
|
|
71
|
+
|
|
72
|
+
// Try to get a specific task
|
|
73
|
+
console.log('\n3. Fetching specific task STA-279:');
|
|
74
|
+
const taskQuery = `
|
|
75
|
+
query GetIssue {
|
|
76
|
+
issue(id: "STA-279") {
|
|
77
|
+
id
|
|
78
|
+
identifier
|
|
79
|
+
title
|
|
80
|
+
state {
|
|
81
|
+
id
|
|
82
|
+
name
|
|
83
|
+
type
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
response = await fetch('https://api.linear.app/graphql', {
|
|
90
|
+
method: 'POST',
|
|
91
|
+
headers: {
|
|
92
|
+
'Authorization': `Bearer ${API_KEY}`,
|
|
93
|
+
'Content-Type': 'application/json'
|
|
94
|
+
},
|
|
95
|
+
body: JSON.stringify({ query: taskQuery })
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
result = await response.json();
|
|
99
|
+
console.log('Task result:', JSON.stringify(result, null, 2));
|
|
100
|
+
|
|
101
|
+
// If task exists, try to update it
|
|
102
|
+
if (result.data?.issue) {
|
|
103
|
+
const task = result.data.issue;
|
|
104
|
+
console.log('\n4. Attempting to update task:', task.identifier);
|
|
105
|
+
|
|
106
|
+
// Find Done state for the same team
|
|
107
|
+
const statesResponse = await fetch('https://api.linear.app/graphql', {
|
|
108
|
+
method: 'POST',
|
|
109
|
+
headers: {
|
|
110
|
+
'Authorization': `Bearer ${API_KEY}`,
|
|
111
|
+
'Content-Type': 'application/json'
|
|
112
|
+
},
|
|
113
|
+
body: JSON.stringify({ query: statesQuery })
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const statesResult = await statesResponse.json();
|
|
117
|
+
const doneState = statesResult.data?.workflowStates?.nodes?.find(s =>
|
|
118
|
+
s.type === 'completed' && s.team?.key === 'STA'
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
if (!doneState) {
|
|
122
|
+
console.log('ā Could not find Done state for STA team');
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
console.log('Found Done state:', doneState.id, doneState.name);
|
|
127
|
+
|
|
128
|
+
const updateMutation = `
|
|
129
|
+
mutation UpdateIssue($issueId: String!, $stateId: String!) {
|
|
130
|
+
issueUpdate(
|
|
131
|
+
id: $issueId,
|
|
132
|
+
input: {
|
|
133
|
+
stateId: $stateId
|
|
134
|
+
}
|
|
135
|
+
) {
|
|
136
|
+
success
|
|
137
|
+
issue {
|
|
138
|
+
identifier
|
|
139
|
+
state {
|
|
140
|
+
name
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const updateResponse = await fetch('https://api.linear.app/graphql', {
|
|
148
|
+
method: 'POST',
|
|
149
|
+
headers: {
|
|
150
|
+
'Authorization': `Bearer ${API_KEY}`,
|
|
151
|
+
'Content-Type': 'application/json'
|
|
152
|
+
},
|
|
153
|
+
body: JSON.stringify({
|
|
154
|
+
query: updateMutation,
|
|
155
|
+
variables: {
|
|
156
|
+
issueId: task.id,
|
|
157
|
+
stateId: doneState.id
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const updateResult = await updateResponse.json();
|
|
163
|
+
console.log('\nUpdate result:', JSON.stringify(updateResult, null, 2));
|
|
164
|
+
|
|
165
|
+
if (updateResult.errors) {
|
|
166
|
+
console.log('\nā Update failed with errors:', updateResult.errors);
|
|
167
|
+
} else if (updateResult.data?.issueUpdate?.success) {
|
|
168
|
+
console.log('\nā
Update successful!');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Run
|
|
174
|
+
debugLinearUpdate().catch(console.error);
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delete duplicate and low-value tasks from Linear to free up capacity
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import 'dotenv/config';
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import readline from 'readline';
|
|
10
|
+
|
|
11
|
+
const API_KEY = process.env.LINEAR_API_KEY;
|
|
12
|
+
if (!API_KEY) {
|
|
13
|
+
console.error('ā LINEAR_API_KEY environment variable not set');
|
|
14
|
+
console.log('Please set LINEAR_API_KEY in your .env file or export it in your shell');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const DELAY_BETWEEN_DELETES = 2000; // 2 seconds to avoid rate limits
|
|
18
|
+
|
|
19
|
+
const delay = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
20
|
+
|
|
21
|
+
async function deleteLinearTasks() {
|
|
22
|
+
try {
|
|
23
|
+
// Load deletion list
|
|
24
|
+
const deleteFile = `linear-deletion-list-${new Date().toISOString().split('T')[0]}.json`;
|
|
25
|
+
if (!fs.existsSync(deleteFile)) {
|
|
26
|
+
console.error(`ā Deletion list not found: ${deleteFile}`);
|
|
27
|
+
console.log('Run analyze-linear-duplicates.js first to generate the list.');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const deleteList = JSON.parse(fs.readFileSync(deleteFile, 'utf8'));
|
|
32
|
+
console.log('š Deletion Summary:');
|
|
33
|
+
console.log(` Total tasks in workspace: ${deleteList.summary.total}`);
|
|
34
|
+
console.log(` Tasks to delete: ${deleteList.summary.toDelete}`);
|
|
35
|
+
console.log(` Tasks remaining after: ${deleteList.summary.remaining}\n`);
|
|
36
|
+
|
|
37
|
+
// Show categories
|
|
38
|
+
console.log('š Tasks to delete by category:');
|
|
39
|
+
Object.entries(deleteList.categories).forEach(([category, tasks]) => {
|
|
40
|
+
if (tasks.length > 0) {
|
|
41
|
+
console.log(` ⢠${category}: ${tasks.length} tasks`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// Confirm deletion
|
|
46
|
+
console.log('\nā ļø WARNING: This will permanently delete these tasks from Linear!');
|
|
47
|
+
console.log('Type "DELETE" to confirm, or press Ctrl+C to cancel:\n');
|
|
48
|
+
|
|
49
|
+
const rl = readline.createInterface({
|
|
50
|
+
input: process.stdin,
|
|
51
|
+
output: process.stdout
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const confirmation = await new Promise(resolve => {
|
|
55
|
+
rl.question('Confirmation: ', resolve);
|
|
56
|
+
});
|
|
57
|
+
rl.close();
|
|
58
|
+
|
|
59
|
+
if (confirmation !== 'DELETE') {
|
|
60
|
+
console.log('ā Deletion cancelled');
|
|
61
|
+
process.exit(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log('\nšļø Starting deletion process...\n');
|
|
65
|
+
|
|
66
|
+
let deleted = 0;
|
|
67
|
+
let failed = 0;
|
|
68
|
+
const results = [];
|
|
69
|
+
|
|
70
|
+
// Process tasks in batches
|
|
71
|
+
for (const task of deleteList.tasks) {
|
|
72
|
+
try {
|
|
73
|
+
console.log(`Deleting ${task.identifier}: ${task.title.substring(0, 50)}...`);
|
|
74
|
+
|
|
75
|
+
const deleteQuery = `
|
|
76
|
+
mutation DeleteIssue($id: String!) {
|
|
77
|
+
issueDelete(id: $id) {
|
|
78
|
+
success
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
const response = await fetch('https://api.linear.app/graphql', {
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: {
|
|
86
|
+
'Authorization': API_KEY,
|
|
87
|
+
'Content-Type': 'application/json'
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
query: deleteQuery,
|
|
91
|
+
variables: { id: task.id }
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const result = await response.json();
|
|
96
|
+
|
|
97
|
+
if (result.data?.issueDelete?.success) {
|
|
98
|
+
console.log(` ā
Deleted ${task.identifier}`);
|
|
99
|
+
deleted++;
|
|
100
|
+
results.push({ ...task, deleted: true });
|
|
101
|
+
} else if (result.errors?.[0]?.message?.includes('not found')) {
|
|
102
|
+
console.log(` ā ļø ${task.identifier} already deleted or not found`);
|
|
103
|
+
deleted++; // Count as successful since it's gone
|
|
104
|
+
results.push({ ...task, deleted: true, note: 'Already deleted' });
|
|
105
|
+
} else {
|
|
106
|
+
throw new Error(result.errors?.[0]?.message || 'Unknown error');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Delay to avoid rate limits
|
|
110
|
+
if (deleted < deleteList.tasks.length) {
|
|
111
|
+
await delay(DELAY_BETWEEN_DELETES);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Show progress every 10 tasks
|
|
115
|
+
if (deleted % 10 === 0) {
|
|
116
|
+
console.log(`\nš Progress: ${deleted}/${deleteList.tasks.length} deleted\n`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.log(` ā Failed to delete ${task.identifier}: ${error.message}`);
|
|
121
|
+
failed++;
|
|
122
|
+
results.push({ ...task, deleted: false, error: error.message });
|
|
123
|
+
|
|
124
|
+
// If rate limited, wait longer
|
|
125
|
+
if (error.message?.includes('rate limit') || error.message?.includes('usage limit')) {
|
|
126
|
+
console.log('ā³ Hit rate limit. Waiting 30 seconds...');
|
|
127
|
+
await delay(30000);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Save results
|
|
133
|
+
const resultsFile = `linear-deletion-results-${new Date().toISOString().split('T')[0]}.json`;
|
|
134
|
+
fs.writeFileSync(resultsFile, JSON.stringify({
|
|
135
|
+
summary: { deleted, failed, total: deleteList.tasks.length },
|
|
136
|
+
results,
|
|
137
|
+
timestamp: new Date().toISOString()
|
|
138
|
+
}, null, 2));
|
|
139
|
+
|
|
140
|
+
// Final summary
|
|
141
|
+
console.log('\n' + '='.repeat(60));
|
|
142
|
+
console.log('š DELETION COMPLETE');
|
|
143
|
+
console.log('='.repeat(60));
|
|
144
|
+
console.log(`ā
Successfully deleted: ${deleted} tasks`);
|
|
145
|
+
console.log(`ā Failed: ${failed} tasks`);
|
|
146
|
+
console.log(`š Success rate: ${Math.round((deleted / deleteList.tasks.length) * 100)}%`);
|
|
147
|
+
console.log(`š¾ Results saved to: ${resultsFile}\n`);
|
|
148
|
+
|
|
149
|
+
if (deleted > 0) {
|
|
150
|
+
console.log('š Workspace capacity freed! You can now add the new phase tasks.');
|
|
151
|
+
console.log('\nNext steps:');
|
|
152
|
+
console.log('1. Run: node scripts/add-phase-tasks-to-linear.js');
|
|
153
|
+
console.log('2. Start implementing Phase 2 high-priority tasks');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error('š„ Script failed:', error.message);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Run if called directly
|
|
163
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
164
|
+
deleteLinearTasks().catch(console.error);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { deleteLinearTasks };
|