@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,213 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
4
|
+
import { relative } from 'path';
|
|
5
|
+
|
|
6
|
+
const fileFixes = [
|
|
7
|
+
// CLI files
|
|
8
|
+
{
|
|
9
|
+
file: 'src/cli/commands/projects.ts',
|
|
10
|
+
fixes: [
|
|
11
|
+
{
|
|
12
|
+
old: '../core/projects/project-manager',
|
|
13
|
+
new: '../../core/projects/project-manager',
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
file: 'src/cli/index.ts',
|
|
19
|
+
fixes: [
|
|
20
|
+
{
|
|
21
|
+
old: '../integrations/linear-auth',
|
|
22
|
+
new: '../integrations/linear/auth',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
old: '../integrations/linear-sync',
|
|
26
|
+
new: '../integrations/linear/sync',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
old: '../integrations/linear-auto-sync',
|
|
30
|
+
new: '../integrations/linear/auto-sync',
|
|
31
|
+
},
|
|
32
|
+
{ old: './analytics-viewer', new: './utils/viewer' },
|
|
33
|
+
{ old: '../analytics/index', new: '../features/analytics/index' },
|
|
34
|
+
{ old: '../mcp/mcp-server', new: '../integrations/mcp/server' },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// Core files
|
|
39
|
+
{
|
|
40
|
+
file: 'src/core/context/frame-manager.ts',
|
|
41
|
+
fixes: [
|
|
42
|
+
{ old: '../../core/monitoring/logger', new: '../monitoring/logger' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
file: 'src/core/projects/project-manager.ts',
|
|
47
|
+
fixes: [
|
|
48
|
+
{ old: '../../core/monitoring/logger', new: '../monitoring/logger' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
file: 'src/core/utils/update-checker.ts',
|
|
53
|
+
fixes: [
|
|
54
|
+
{ old: '../../core/monitoring/logger', new: '../monitoring/logger' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
file: 'src/core/monitoring/error-handler.ts',
|
|
59
|
+
fixes: [{ old: '../../core/monitoring/logger', new: './logger' }],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
file: 'src/core/logger.test.ts',
|
|
63
|
+
fixes: [
|
|
64
|
+
{ old: '../../core/monitoring/logger', new: './monitoring/logger' },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// Features files
|
|
69
|
+
{
|
|
70
|
+
file: 'src/features/tasks/pebbles-task-store.ts',
|
|
71
|
+
fixes: [
|
|
72
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
file: 'src/features/tasks/task-aware-context.ts',
|
|
77
|
+
fixes: [
|
|
78
|
+
{
|
|
79
|
+
old: '../core/context/frame-manager',
|
|
80
|
+
new: '../../core/context/frame-manager',
|
|
81
|
+
},
|
|
82
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
file: 'src/features/browser/browser-mcp.ts',
|
|
87
|
+
fixes: [
|
|
88
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
file: 'src/features/analytics/core/analytics-service.ts',
|
|
93
|
+
fixes: [
|
|
94
|
+
{
|
|
95
|
+
old: '../../integrations/linear/client',
|
|
96
|
+
new: '../../../integrations/linear/client',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// Integrations files
|
|
102
|
+
{
|
|
103
|
+
file: 'src/integrations/linear/auth.ts',
|
|
104
|
+
fixes: [
|
|
105
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
file: 'src/integrations/linear/auto-sync.ts',
|
|
110
|
+
fixes: [
|
|
111
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
112
|
+
{
|
|
113
|
+
old: '../features/tasks/pebbles-task-store',
|
|
114
|
+
new: '../../features/tasks/pebbles-task-store',
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
file: 'src/integrations/linear/client.ts',
|
|
120
|
+
fixes: [
|
|
121
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
file: 'src/integrations/linear/config.ts',
|
|
126
|
+
fixes: [
|
|
127
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
file: 'src/integrations/linear/sync.ts',
|
|
132
|
+
fixes: [
|
|
133
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
134
|
+
{
|
|
135
|
+
old: '../pebbles/pebbles-task-store',
|
|
136
|
+
new: '../../features/tasks/pebbles-task-store',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
file: 'src/integrations/mcp/server.ts',
|
|
142
|
+
fixes: [
|
|
143
|
+
{
|
|
144
|
+
old: '../core/context/frame-manager',
|
|
145
|
+
new: '../../core/context/frame-manager',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
old: '../pebbles/pebbles-task-store',
|
|
149
|
+
new: '../../features/tasks/pebbles-task-store',
|
|
150
|
+
},
|
|
151
|
+
{ old: '../core/monitoring/logger', new: '../../core/monitoring/logger' },
|
|
152
|
+
{
|
|
153
|
+
old: '../features/browser/browser-mcp',
|
|
154
|
+
new: '../../features/browser/browser-mcp',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
// Servers files
|
|
160
|
+
{
|
|
161
|
+
file: 'src/servers/production/auth-middleware.ts',
|
|
162
|
+
fixes: [
|
|
163
|
+
{
|
|
164
|
+
old: '../../core/monitoring/metrics',
|
|
165
|
+
new: '../../core/monitoring/metrics',
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
file: 'src/servers/railway/index.ts',
|
|
171
|
+
fixes: [
|
|
172
|
+
{
|
|
173
|
+
old: '../features/browser/browser-mcp',
|
|
174
|
+
new: '../../features/browser/browser-mcp',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
console.log('🔄 Fixing all import paths...\n');
|
|
181
|
+
|
|
182
|
+
let totalFixed = 0;
|
|
183
|
+
|
|
184
|
+
for (const { file, fixes } of fileFixes) {
|
|
185
|
+
try {
|
|
186
|
+
let content = readFileSync(file, 'utf-8');
|
|
187
|
+
let modified = false;
|
|
188
|
+
|
|
189
|
+
for (const { old: oldPath, new: newPath } of fixes) {
|
|
190
|
+
const importRegex = new RegExp(
|
|
191
|
+
`(import.*from\\s+['"])${oldPath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(\\.js)?(['"])`,
|
|
192
|
+
'g'
|
|
193
|
+
);
|
|
194
|
+
const newContent = content.replace(importRegex, `$1${newPath}.js$3`);
|
|
195
|
+
|
|
196
|
+
if (newContent !== content) {
|
|
197
|
+
content = newContent;
|
|
198
|
+
modified = true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (modified) {
|
|
203
|
+
writeFileSync(file, content);
|
|
204
|
+
console.log(`✅ Fixed: ${relative(process.cwd(), file)}`);
|
|
205
|
+
totalFixed++;
|
|
206
|
+
}
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error(`❌ Error fixing ${file}:`, error.message);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
console.log(`\n✅ Fixed ${totalFixed} files`);
|
|
213
|
+
console.log('📦 Run "npm run build" to verify all imports are correct');
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { readFileSync, writeFileSync, readdirSync, statSync } from 'fs';
|
|
4
|
+
import { join, relative, dirname, resolve } from 'path';
|
|
5
|
+
|
|
6
|
+
const importMappings = {
|
|
7
|
+
// Core monitoring imports
|
|
8
|
+
'../core/logger': '../core/monitoring/logger',
|
|
9
|
+
'./logger': '../monitoring/logger',
|
|
10
|
+
'../core/error-handler': '../core/monitoring/error-handler',
|
|
11
|
+
'./error-handler': '../monitoring/error-handler',
|
|
12
|
+
'../core/progress-tracker': '../core/monitoring/progress-tracker',
|
|
13
|
+
|
|
14
|
+
// Core context imports
|
|
15
|
+
'../core/frame-manager': '../core/context/frame-manager',
|
|
16
|
+
'./core/frame-manager': './core/context/frame-manager',
|
|
17
|
+
|
|
18
|
+
// Core projects imports
|
|
19
|
+
'../core/project-manager': '../core/projects/project-manager',
|
|
20
|
+
'./core/project-manager': './core/projects/project-manager',
|
|
21
|
+
|
|
22
|
+
// Core utils imports
|
|
23
|
+
'../core/update-checker': '../core/utils/update-checker',
|
|
24
|
+
'./core/update-checker': './core/utils/update-checker',
|
|
25
|
+
|
|
26
|
+
// Features imports
|
|
27
|
+
'../pebbles/pebbles-task-store': '../features/tasks/pebbles-task-store',
|
|
28
|
+
'./pebbles/pebbles-task-store': './features/tasks/pebbles-task-store',
|
|
29
|
+
'../pebbles/task-aware-context': '../features/tasks/task-aware-context',
|
|
30
|
+
'../analytics/index': '../features/analytics/index',
|
|
31
|
+
'./analytics/index': './features/analytics/index',
|
|
32
|
+
'../analytics/core/analytics-service':
|
|
33
|
+
'../../features/analytics/core/analytics-service',
|
|
34
|
+
'../integrations/browser-mcp': '../features/browser/browser-mcp',
|
|
35
|
+
|
|
36
|
+
// Linear integration imports
|
|
37
|
+
'../integrations/linear-auth': '../integrations/linear/auth',
|
|
38
|
+
'./linear-auth': './auth',
|
|
39
|
+
'../integrations/linear-sync': '../integrations/linear/sync',
|
|
40
|
+
'./linear-sync': './sync',
|
|
41
|
+
'../integrations/linear-client': '../integrations/linear/client',
|
|
42
|
+
'./linear-client': './client',
|
|
43
|
+
'../../integrations/linear-client': '../../integrations/linear/client',
|
|
44
|
+
'../integrations/linear-config': '../integrations/linear/config',
|
|
45
|
+
'./linear-config': './config',
|
|
46
|
+
'../integrations/linear-auto-sync': '../integrations/linear/auto-sync',
|
|
47
|
+
'./linear-auto-sync': './auto-sync',
|
|
48
|
+
|
|
49
|
+
// MCP imports
|
|
50
|
+
'../mcp/mcp-server': '../integrations/mcp/server',
|
|
51
|
+
'./mcp/mcp-server': './integrations/mcp/server',
|
|
52
|
+
|
|
53
|
+
// CLI imports
|
|
54
|
+
'./project-commands': './commands/projects',
|
|
55
|
+
'./analytics-viewer': './utils/viewer',
|
|
56
|
+
'../cli/cli': '../cli/index',
|
|
57
|
+
|
|
58
|
+
// Production server imports
|
|
59
|
+
'../monitoring/logger': '../../core/monitoring/logger',
|
|
60
|
+
'../monitoring/metrics': '../../core/monitoring/metrics',
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function getCorrectRelativePath(fromFile, toFile) {
|
|
64
|
+
const fromDir = dirname(fromFile);
|
|
65
|
+
let relativePath = relative(fromDir, toFile).replace(/\\/g, '/');
|
|
66
|
+
if (!relativePath.startsWith('.')) {
|
|
67
|
+
relativePath = './' + relativePath;
|
|
68
|
+
}
|
|
69
|
+
// Remove .ts extension for imports
|
|
70
|
+
relativePath = relativePath.replace(/\.ts$/, '');
|
|
71
|
+
return relativePath;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function fixImportsInFile(filePath) {
|
|
75
|
+
if (!filePath.endsWith('.ts') && !filePath.endsWith('.js')) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
let content = readFileSync(filePath, 'utf-8');
|
|
81
|
+
let modified = false;
|
|
82
|
+
|
|
83
|
+
// Fix each known import mapping
|
|
84
|
+
for (const [oldPath, newPath] of Object.entries(importMappings)) {
|
|
85
|
+
const importRegex = new RegExp(
|
|
86
|
+
`(import.*from\\s+['"])${escapeRegex(oldPath)}(\\.js)?(['"])`,
|
|
87
|
+
'g'
|
|
88
|
+
);
|
|
89
|
+
const requireRegex = new RegExp(
|
|
90
|
+
`(require\\(['"])${escapeRegex(oldPath)}(\\.js)?(['"])`,
|
|
91
|
+
'g'
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const newContent = content
|
|
95
|
+
.replace(importRegex, `$1${newPath}.js$3`)
|
|
96
|
+
.replace(requireRegex, `$1${newPath}.js$3`);
|
|
97
|
+
|
|
98
|
+
if (newContent !== content) {
|
|
99
|
+
content = newContent;
|
|
100
|
+
modified = true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Special fixes for specific files
|
|
105
|
+
if (filePath.includes('src/cli/index.ts')) {
|
|
106
|
+
// Add shebang if missing
|
|
107
|
+
if (!content.startsWith('#!/usr/bin/env node')) {
|
|
108
|
+
content = '#!/usr/bin/env node\n' + content;
|
|
109
|
+
modified = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Fix imports in specific directories
|
|
114
|
+
if (filePath.includes('src/core/context/')) {
|
|
115
|
+
content = content.replace(
|
|
116
|
+
/from ['"]\.\/logger\.js['"]/g,
|
|
117
|
+
`from '../monitoring/logger.js'`
|
|
118
|
+
);
|
|
119
|
+
content = content.replace(
|
|
120
|
+
/from ['"]\.\/error-handler\.js['"]/g,
|
|
121
|
+
`from '../monitoring/error-handler.js'`
|
|
122
|
+
);
|
|
123
|
+
modified = true;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (filePath.includes('src/core/projects/')) {
|
|
127
|
+
content = content.replace(
|
|
128
|
+
/from ['"]\.\/logger\.js['"]/g,
|
|
129
|
+
`from '../monitoring/logger.js'`
|
|
130
|
+
);
|
|
131
|
+
modified = true;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (filePath.includes('src/core/utils/')) {
|
|
135
|
+
content = content.replace(
|
|
136
|
+
/from ['"]\.\/logger\.js['"]/g,
|
|
137
|
+
`from '../monitoring/logger.js'`
|
|
138
|
+
);
|
|
139
|
+
modified = true;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (filePath.includes('src/integrations/linear/')) {
|
|
143
|
+
// Fix relative imports within linear directory
|
|
144
|
+
content = content.replace(
|
|
145
|
+
/from ['"]\.\/linear-auth\.js['"]/g,
|
|
146
|
+
`from './auth.js'`
|
|
147
|
+
);
|
|
148
|
+
content = content.replace(
|
|
149
|
+
/from ['"]\.\/linear-sync\.js['"]/g,
|
|
150
|
+
`from './sync.js'`
|
|
151
|
+
);
|
|
152
|
+
content = content.replace(
|
|
153
|
+
/from ['"]\.\/linear-client\.js['"]/g,
|
|
154
|
+
`from './client.js'`
|
|
155
|
+
);
|
|
156
|
+
content = content.replace(
|
|
157
|
+
/from ['"]\.\/linear-config\.js['"]/g,
|
|
158
|
+
`from './config.js'`
|
|
159
|
+
);
|
|
160
|
+
content = content.replace(
|
|
161
|
+
/from ['"]\.\/linear-auto-sync\.js['"]/g,
|
|
162
|
+
`from './auto-sync.js'`
|
|
163
|
+
);
|
|
164
|
+
modified = true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (modified) {
|
|
168
|
+
writeFileSync(filePath, content);
|
|
169
|
+
console.log(`✅ Fixed: ${relative(process.cwd(), filePath)}`);
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return false;
|
|
174
|
+
} catch (error) {
|
|
175
|
+
console.error(`❌ Error fixing ${filePath}:`, error.message);
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function escapeRegex(string) {
|
|
181
|
+
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function walkDirectory(dir) {
|
|
185
|
+
const files = [];
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
const items = readdirSync(dir);
|
|
189
|
+
|
|
190
|
+
for (const item of items) {
|
|
191
|
+
const fullPath = join(dir, item);
|
|
192
|
+
const stat = statSync(fullPath);
|
|
193
|
+
|
|
194
|
+
if (stat.isDirectory()) {
|
|
195
|
+
// Skip node_modules, dist, and .git
|
|
196
|
+
if (
|
|
197
|
+
!item.startsWith('.') &&
|
|
198
|
+
item !== 'node_modules' &&
|
|
199
|
+
item !== 'dist'
|
|
200
|
+
) {
|
|
201
|
+
files.push(...walkDirectory(fullPath));
|
|
202
|
+
}
|
|
203
|
+
} else if (stat.isFile()) {
|
|
204
|
+
files.push(fullPath);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error(`Error walking directory ${dir}:`, error.message);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return files;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Main execution
|
|
215
|
+
console.log('🔄 Fixing import paths after reorganization...\n');
|
|
216
|
+
|
|
217
|
+
const srcFiles = walkDirectory(join(process.cwd(), 'src'));
|
|
218
|
+
const testFiles = walkDirectory(join(process.cwd(), 'tests'));
|
|
219
|
+
|
|
220
|
+
let fixedCount = 0;
|
|
221
|
+
|
|
222
|
+
for (const file of [...srcFiles, ...testFiles]) {
|
|
223
|
+
if (fixImportsInFile(file)) {
|
|
224
|
+
fixedCount++;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
console.log(`\n✅ Fixed ${fixedCount} files`);
|
|
229
|
+
console.log('📦 Run "npm run build" to verify all imports are correct');
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Auto-fix lint errors in a loop until only warnings remain
|
|
4
|
+
* Outputs detailed fix log for Claude to review
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { execSync } = require('child_process');
|
|
8
|
+
const { writeFileSync } = require('fs');
|
|
9
|
+
|
|
10
|
+
const MAX_ATTEMPTS = 3;
|
|
11
|
+
let attempt = 0;
|
|
12
|
+
const fixLog = [];
|
|
13
|
+
|
|
14
|
+
function logFix(message, level = 'info') {
|
|
15
|
+
const timestamp = new Date().toISOString();
|
|
16
|
+
const entry = { timestamp, level, message };
|
|
17
|
+
fixLog.push(entry);
|
|
18
|
+
console.log(`[${timestamp}] ${level.toUpperCase()}: ${message}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function saveLintReport(output, filename) {
|
|
22
|
+
try {
|
|
23
|
+
writeFileSync(filename, output);
|
|
24
|
+
logFix(`Lint report saved to ${filename}`, 'info');
|
|
25
|
+
} catch (err) {
|
|
26
|
+
logFix(`Failed to save lint report: ${err.message}`, 'error');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
logFix('🔧 Starting auto-fix loop...');
|
|
31
|
+
|
|
32
|
+
while (attempt < MAX_ATTEMPTS) {
|
|
33
|
+
attempt++;
|
|
34
|
+
logFix(`📝 Auto-fix attempt ${attempt}/${MAX_ATTEMPTS}`);
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
// Get initial errors for comparison
|
|
38
|
+
let beforeOutput = '';
|
|
39
|
+
try {
|
|
40
|
+
execSync('npx eslint src/**/*.ts scripts/**/*.ts', { stdio: 'pipe' });
|
|
41
|
+
} catch (beforeError) {
|
|
42
|
+
beforeOutput = beforeError.stdout?.toString() || '';
|
|
43
|
+
const errorCount = (beforeOutput.match(/\s+error\s+/g) || []).length;
|
|
44
|
+
const warningCount = (beforeOutput.match(/\s+warning\s+/g) || []).length;
|
|
45
|
+
logFix(`Found ${errorCount} errors, ${warningCount} warnings before auto-fix`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Try to fix what can be auto-fixed
|
|
49
|
+
logFix('Running ESLint auto-fix...');
|
|
50
|
+
try {
|
|
51
|
+
execSync('npx eslint src/**/*.ts scripts/**/*.ts --fix', {
|
|
52
|
+
stdio: 'pipe'
|
|
53
|
+
});
|
|
54
|
+
} catch (fixError) {
|
|
55
|
+
// ESLint fix command can fail but still make fixes
|
|
56
|
+
logFix('ESLint --fix completed (may have remaining issues)');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Check results after fix
|
|
60
|
+
let afterOutput = '';
|
|
61
|
+
try {
|
|
62
|
+
execSync('npx eslint src/**/*.ts scripts/**/*.ts --max-warnings 999', {
|
|
63
|
+
stdio: 'pipe'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
logFix('✅ All fixable lint errors resolved! (warnings are ok for commits)', 'success');
|
|
67
|
+
saveLintReport(JSON.stringify(fixLog, null, 2), '.lint-fix-log.json');
|
|
68
|
+
process.exit(0);
|
|
69
|
+
|
|
70
|
+
} catch (afterError) {
|
|
71
|
+
afterOutput = afterError.stdout?.toString() || '';
|
|
72
|
+
const remainingErrors = (afterOutput.match(/\s+error\s+/g) || []).length;
|
|
73
|
+
const remainingWarnings = (afterOutput.match(/\s+warning\s+/g) || []).length;
|
|
74
|
+
logFix(`After auto-fix: ${remainingErrors} errors, ${remainingWarnings} warnings`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Check if only warnings remain
|
|
78
|
+
if (!afterOutput.includes(' error ') && afterOutput.includes(' warning ')) {
|
|
79
|
+
logFix('✅ Only warnings remain - allowing commit!', 'success');
|
|
80
|
+
logFix('💡 Consider fixing warnings when convenient', 'info');
|
|
81
|
+
saveLintReport(afterOutput, '.lint-warnings.log');
|
|
82
|
+
saveLintReport(JSON.stringify(fixLog, null, 2), '.lint-fix-log.json');
|
|
83
|
+
process.exit(0);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (attempt === MAX_ATTEMPTS) {
|
|
87
|
+
logFix(`❌ Could not auto-fix all errors after ${MAX_ATTEMPTS} attempts`, 'error');
|
|
88
|
+
logFix('🚫 Blocking commit - errors require manual attention:', 'error');
|
|
89
|
+
saveLintReport(afterOutput, '.lint-errors.log');
|
|
90
|
+
saveLintReport(JSON.stringify(fixLog, null, 2), '.lint-fix-log.json');
|
|
91
|
+
console.log('\n' + afterOutput);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
} else {
|
|
94
|
+
logFix(`⚠️ ${(afterOutput.match(/\s+error\s+/g) || []).length} errors remain, trying again...`, 'warn');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
} catch (error) {
|
|
98
|
+
logFix(`Unexpected error: ${error.message}`, 'error');
|
|
99
|
+
if (attempt === MAX_ATTEMPTS) {
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Fix project ID mismatch between sessions and database
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import Database from 'better-sqlite3';
|
|
7
|
+
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import { execSync } from 'child_process';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
|
|
12
|
+
// Get the actual project ID from git remote
|
|
13
|
+
function getProjectId(): string {
|
|
14
|
+
try {
|
|
15
|
+
const gitUrl = execSync('git config --get remote.origin.url', {
|
|
16
|
+
encoding: 'utf-8',
|
|
17
|
+
}).trim();
|
|
18
|
+
|
|
19
|
+
// Transform URL to project ID (same as session-manager logic)
|
|
20
|
+
const cleaned = gitUrl
|
|
21
|
+
.replace(/\.git$/, '')
|
|
22
|
+
.replace(/[^a-zA-Z0-9-]/g, '-')
|
|
23
|
+
.toLowerCase();
|
|
24
|
+
|
|
25
|
+
// Take last 50 chars
|
|
26
|
+
return cleaned.substring(cleaned.length - 50);
|
|
27
|
+
} catch {
|
|
28
|
+
console.error(chalk.red('Failed to get git remote URL'));
|
|
29
|
+
return 'stackmemory-demo';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Fix database project IDs
|
|
34
|
+
function fixDatabase(projectId: string): void {
|
|
35
|
+
const dbPath = join(process.cwd(), '.stackmemory', 'context.db');
|
|
36
|
+
|
|
37
|
+
if (!existsSync(dbPath)) {
|
|
38
|
+
console.error(chalk.red('Database not found'));
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const db = new Database(dbPath);
|
|
43
|
+
|
|
44
|
+
// Check current project IDs in frames
|
|
45
|
+
const projectIds = db
|
|
46
|
+
.prepare('SELECT DISTINCT project_id FROM frames')
|
|
47
|
+
.all() as Array<{ project_id: string }>;
|
|
48
|
+
console.log(chalk.blue('Current project IDs in database:'));
|
|
49
|
+
projectIds.forEach((p) => console.log(` - ${p.project_id}`));
|
|
50
|
+
|
|
51
|
+
// Update frames if needed
|
|
52
|
+
const wrongIds = projectIds.filter((p) => p.project_id !== projectId);
|
|
53
|
+
if (wrongIds.length > 0) {
|
|
54
|
+
console.log(
|
|
55
|
+
chalk.yellow(
|
|
56
|
+
`\nUpdating ${wrongIds.length} project ID(s) to: ${projectId}`
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
wrongIds.forEach((p) => {
|
|
61
|
+
const result = db
|
|
62
|
+
.prepare('UPDATE frames SET project_id = ? WHERE project_id = ?')
|
|
63
|
+
.run(projectId, p.project_id);
|
|
64
|
+
console.log(` Updated ${result.changes} frames from ${p.project_id}`);
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
console.log(chalk.green('\nDatabase project IDs are already correct'));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
db.close();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Fix session files
|
|
74
|
+
function fixSessions(projectId: string): void {
|
|
75
|
+
const sessionsDir = join(
|
|
76
|
+
process.env['HOME'] || '',
|
|
77
|
+
'.stackmemory',
|
|
78
|
+
'sessions',
|
|
79
|
+
'projects'
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
if (!existsSync(sessionsDir)) {
|
|
83
|
+
console.error(chalk.red('Sessions directory not found'));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const files = readdirSync(sessionsDir).filter((f) => f.endsWith('.json'));
|
|
88
|
+
|
|
89
|
+
console.log(chalk.blue(`\nChecking ${files.length} session files...`));
|
|
90
|
+
|
|
91
|
+
files.forEach((file) => {
|
|
92
|
+
const filePath = join(sessionsDir, file);
|
|
93
|
+
const content = JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
94
|
+
|
|
95
|
+
if (content.projectId && content.projectId !== projectId) {
|
|
96
|
+
// Check if this session belongs to our project
|
|
97
|
+
if (
|
|
98
|
+
content.projectId === 'stackmemory-demo' ||
|
|
99
|
+
content.projectId.includes('stackmemory')
|
|
100
|
+
) {
|
|
101
|
+
console.log(
|
|
102
|
+
chalk.yellow(
|
|
103
|
+
` Updating session ${file}: ${content.projectId} → ${projectId}`
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
content.projectId = projectId;
|
|
107
|
+
writeFileSync(filePath, JSON.stringify(content, null, 2));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Also check for individual session files
|
|
113
|
+
const individualSessionsDir = join(
|
|
114
|
+
process.env['HOME'] || '',
|
|
115
|
+
'.stackmemory',
|
|
116
|
+
'sessions'
|
|
117
|
+
);
|
|
118
|
+
const sessionPattern =
|
|
119
|
+
/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\.json/;
|
|
120
|
+
|
|
121
|
+
if (existsSync(individualSessionsDir)) {
|
|
122
|
+
const sessionFiles = readdirSync(individualSessionsDir).filter((f) =>
|
|
123
|
+
sessionPattern.test(f)
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
sessionFiles.forEach((file) => {
|
|
127
|
+
const filePath = join(individualSessionsDir, file);
|
|
128
|
+
const content = JSON.parse(readFileSync(filePath, 'utf-8'));
|
|
129
|
+
|
|
130
|
+
if (content.projectId && content.projectId !== projectId) {
|
|
131
|
+
if (
|
|
132
|
+
content.projectId === 'stackmemory-demo' ||
|
|
133
|
+
content.projectId.includes('stackmemory')
|
|
134
|
+
) {
|
|
135
|
+
console.log(
|
|
136
|
+
chalk.yellow(
|
|
137
|
+
` Updating session ${file}: ${content.projectId} → ${projectId}`
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
content.projectId = projectId;
|
|
141
|
+
writeFileSync(filePath, JSON.stringify(content, null, 2));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Main
|
|
149
|
+
console.log(chalk.bold.blue('\n🔧 StackMemory Project ID Fix\n'));
|
|
150
|
+
|
|
151
|
+
const correctProjectId = getProjectId();
|
|
152
|
+
console.log(chalk.green(`Correct project ID: ${correctProjectId}\n`));
|
|
153
|
+
|
|
154
|
+
// Fix database
|
|
155
|
+
fixDatabase(correctProjectId);
|
|
156
|
+
|
|
157
|
+
// Fix sessions
|
|
158
|
+
fixSessions(correctProjectId);
|
|
159
|
+
|
|
160
|
+
console.log(chalk.bold.green('\n✅ Project ID fix complete!\n'));
|
|
161
|
+
console.log('Run "stackmemory status" to verify the fix.');
|