squish-memory 1.0.2 → 1.1.5
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/.env.example +130 -0
- package/CHANGELOG.md +55 -0
- package/README.md +150 -287
- package/config/hooks/claude-code-hooks.json +39 -0
- package/config/hooks/cursor-hooks.json +30 -0
- package/config/hooks/opencode-hooks.json +30 -0
- package/config/hooks/windsurf-hooks.json +30 -0
- package/config/mcp-mode-semantics.json +23 -21
- package/config/plugin-manifest.json +101 -152
- package/{plugin.json → config/plugin.json} +2 -2
- package/config/settings.json +52 -51
- package/{commands → core/commands}/init.md +39 -39
- package/dist/config.d.ts +28 -4
- package/dist/config.js +97 -29
- package/dist/core/adapters/config/claude-code.d.ts +45 -0
- package/dist/core/adapters/config/claude-code.js +113 -0
- package/dist/core/adapters/config/cursor.d.ts +26 -0
- package/dist/core/adapters/config/cursor.js +74 -0
- package/dist/core/adapters/config/opencode.d.ts +23 -0
- package/dist/core/adapters/config/opencode.js +73 -0
- package/dist/core/adapters/config/windsurf.d.ts +26 -0
- package/dist/core/adapters/config/windsurf.js +74 -0
- package/dist/core/adapters/index.d.ts +45 -0
- package/dist/core/adapters/index.js +84 -0
- package/dist/core/adapters/scripts/install-adapter.d.ts +19 -0
- package/dist/core/adapters/scripts/install-adapter.js +149 -0
- package/dist/core/adapters/timeline.d.ts +23 -0
- package/dist/core/adapters/timeline.js +88 -0
- package/dist/core/adapters/types.d.ts +157 -0
- package/dist/core/adapters/types.js +50 -0
- package/dist/{algorithms → core/algorithms}/analytics/token-estimator.d.ts +1 -1
- package/dist/{algorithms → core/algorithms}/analytics/token-estimator.js +3 -3
- package/dist/{algorithms → core/algorithms}/detection/semantic-ranker.d.ts +1 -1
- package/dist/{algorithms → core/algorithms}/detection/semantic-ranker.js +1 -1
- package/dist/{algorithms → core/algorithms}/detection/two-stage-detector.d.ts +1 -1
- package/dist/{algorithms → core/algorithms}/detection/two-stage-detector.js +7 -10
- package/dist/{algorithms → core/algorithms}/handlers/approve-merge.js +4 -4
- package/dist/{algorithms → core/algorithms}/handlers/detect-duplicates.js +3 -3
- package/dist/{algorithms → core/algorithms}/handlers/get-stats.js +3 -3
- package/dist/{algorithms → core/algorithms}/handlers/list-proposals.js +3 -3
- package/dist/{algorithms → core/algorithms}/handlers/preview-merge.js +3 -3
- package/dist/{algorithms → core/algorithms}/handlers/reject-merge.js +3 -3
- package/dist/{algorithms → core/algorithms}/handlers/reverse-merge.js +3 -3
- package/dist/core/algorithms/index.d.ts +21 -0
- package/dist/core/algorithms/index.js +26 -0
- package/dist/core/algorithms/operations/cache-maintenance.d.ts +12 -0
- package/dist/core/algorithms/operations/cache-maintenance.js +157 -0
- package/dist/{algorithms → core/algorithms}/safety/safety-checks.d.ts +1 -1
- package/dist/{algorithms → core/algorithms}/strategies/merge-strategies.d.ts +19 -1
- package/dist/{algorithms → core/algorithms}/strategies/merge-strategies.js +74 -123
- package/dist/core/algorithms/types.d.ts +133 -0
- package/dist/core/algorithms/types.js +5 -0
- package/dist/core/associations.d.ts +1 -2
- package/dist/core/associations.js +1 -2
- package/dist/core/autosave.d.ts +19 -0
- package/dist/core/autosave.js +16 -0
- package/dist/{commands → core/commands}/managed-sync.js +5 -5
- package/dist/core/commands/mcp-server.js +739 -0
- package/dist/core/context/agent-context.d.ts +106 -0
- package/dist/core/context/agent-context.js +274 -0
- package/dist/core/{context-paging.d.ts → context/context-paging.d.ts} +2 -12
- package/dist/core/{context-paging.js → context/context-paging.js} +19 -39
- package/dist/core/context/context-window.d.ts +40 -0
- package/dist/core/context/context-window.js +177 -0
- package/dist/core/context/context.js +22 -0
- package/dist/core/embeddings.d.ts +1 -1
- package/dist/core/embeddings.js +54 -2
- package/dist/core/error-handling.d.ts +63 -0
- package/dist/core/error-handling.js +173 -0
- package/dist/core/external-folder/index.d.ts +102 -0
- package/dist/core/external-folder/index.js +294 -0
- package/dist/core/hooks/agent-hooks.d.ts +74 -0
- package/dist/core/hooks/agent-hooks.js +244 -0
- package/dist/core/hooks/auto-tagger.d.ts +19 -0
- package/dist/core/hooks/auto-tagger.js +155 -0
- package/dist/core/hooks/capture-filter.d.ts +41 -0
- package/dist/core/hooks/capture-filter.js +128 -0
- package/dist/core/index.d.ts +6 -6
- package/dist/core/index.js +6 -6
- package/dist/core/{agent-memory.js → ingestion/agent-memory.js} +5 -7
- package/dist/core/{core-memory.js → ingestion/core-memory.js} +4 -4
- package/dist/core/ingestion/learnings.d.ts +57 -0
- package/dist/core/ingestion/learnings.js +202 -0
- package/dist/core/lib/db-client.d.ts +114 -0
- package/dist/core/lib/db-client.js +130 -0
- package/dist/core/lib/schemas.d.ts +129 -0
- package/dist/core/lib/schemas.js +87 -0
- package/dist/core/{utils.d.ts → lib/utils.d.ts} +1 -0
- package/dist/core/{utils.js → lib/utils.js} +31 -15
- package/dist/core/lib/validation.d.ts +38 -0
- package/dist/core/lib/validation.js +151 -0
- package/dist/core/lifecycle.d.ts +7 -0
- package/dist/core/lifecycle.js +140 -20
- package/dist/core/local-embeddings.d.ts +6 -1
- package/dist/core/local-embeddings.js +6 -15
- package/dist/core/logger.js +7 -1
- package/dist/core/mcp/tools.js +35 -3
- package/dist/core/memory/categorizer.js +1 -0
- package/dist/core/memory/conflict-detector.js +1 -1
- package/dist/core/memory/consolidation.d.ts +1 -10
- package/dist/core/memory/consolidation.js +2 -11
- package/dist/core/memory/context-collector.js +1 -1
- package/dist/core/memory/edit-workflow.js +1 -1
- package/dist/core/memory/entity-resolver.js +7 -7
- package/dist/core/memory/fact-extractor.js +12 -12
- package/dist/core/memory/feedback-tracker.js +1 -1
- package/dist/core/memory/hooks.d.ts +88 -0
- package/dist/core/memory/hooks.js +174 -0
- package/dist/core/memory/hybrid-retrieval.js +2 -2
- package/dist/core/memory/hybrid-search.d.ts +1 -6
- package/dist/core/memory/hybrid-search.js +70 -84
- package/dist/core/memory/importance.d.ts +8 -13
- package/dist/core/memory/importance.js +47 -74
- package/dist/core/memory/loader.d.ts +31 -0
- package/dist/core/memory/loader.js +141 -0
- package/dist/core/memory/markdown/markdown-storage.d.ts +72 -0
- package/dist/core/memory/markdown/markdown-storage.js +243 -0
- package/dist/core/memory/memories.d.ts +12 -4
- package/dist/core/memory/memories.js +192 -180
- package/dist/core/memory/memory-lifecycle.d.ts +8 -0
- package/dist/core/memory/memory-lifecycle.js +55 -0
- package/dist/core/memory/migrate.d.ts +21 -0
- package/dist/core/memory/migrate.js +134 -0
- package/dist/core/memory/normalization.d.ts +22 -0
- package/dist/core/memory/normalization.js +26 -0
- package/dist/core/memory/progressive-disclosure.js +1 -1
- package/dist/core/memory/query-rewriter.js +9 -9
- package/dist/core/memory/serialization.d.ts +4 -0
- package/dist/core/memory/serialization.js +49 -0
- package/dist/core/memory/stats.d.ts +5 -0
- package/dist/core/memory/stats.js +63 -12
- package/dist/core/memory/temporal-facts.js +21 -0
- package/dist/core/memory/write-gate.js +1 -1
- package/dist/core/obsidian-vault.d.ts +30 -0
- package/dist/core/obsidian-vault.js +94 -0
- package/dist/core/places/index.d.ts +14 -0
- package/dist/core/places/index.js +14 -0
- package/dist/core/places/memory-places.d.ts +68 -0
- package/dist/core/places/memory-places.js +261 -0
- package/dist/core/places/places.d.ts +88 -0
- package/dist/core/places/places.js +314 -0
- package/dist/core/places/rules.d.ts +74 -0
- package/dist/core/places/rules.js +240 -0
- package/dist/core/places/walking.d.ts +56 -0
- package/dist/core/places/walking.js +121 -0
- package/dist/core/projects.d.ts +5 -0
- package/dist/core/projects.js +39 -18
- package/dist/core/responses.d.ts +96 -0
- package/dist/core/responses.js +122 -0
- package/dist/core/scheduler/cron-scheduler.js +29 -7
- package/dist/core/scheduler/index.d.ts +1 -1
- package/dist/core/scheduler/index.js +1 -1
- package/dist/core/scheduler/job-runner.js +1 -1
- package/dist/core/search/conversations.js +40 -42
- package/dist/core/search/entities.js +6 -9
- package/dist/core/search/graph-boost.d.ts +7 -0
- package/dist/core/search/graph-boost.js +23 -0
- package/dist/core/search/qmd-search.js +4 -4
- package/dist/core/security/encrypt.d.ts +6 -0
- package/dist/core/security/encrypt.js +47 -0
- package/dist/core/{governance.d.ts → security/governance.d.ts} +6 -1
- package/dist/core/security/governance.js +79 -0
- package/dist/core/session/auto-load.js +6 -6
- package/dist/core/session/index.d.ts +1 -1
- package/dist/core/session/index.js +1 -1
- package/dist/core/session/self-iteration-job.d.ts +20 -0
- package/dist/core/session/self-iteration-job.js +282 -0
- package/dist/core/session/session-hooks.d.ts +18 -0
- package/dist/core/session/session-hooks.js +58 -0
- package/dist/core/session-hooks/self-iteration-job.js +35 -35
- package/dist/core/{cache.js → storage/cache.js} +2 -2
- package/dist/core/sync/qmd-sync.d.ts +1 -13
- package/dist/core/sync/qmd-sync.js +1 -13
- package/dist/core/toon.d.ts +43 -0
- package/dist/core/toon.js +160 -0
- package/dist/core/utils/memory-operations.js +1 -1
- package/dist/core/utils/vector-operations.d.ts +71 -0
- package/dist/core/utils/vector-operations.js +129 -0
- package/dist/db/adapter.d.ts +3 -3
- package/dist/db/adapter.js +99 -88
- package/dist/db/bootstrap.js +820 -522
- package/dist/{drizzle → db/drizzle}/schema-sqlite.d.ts +74 -25
- package/dist/{drizzle → db/drizzle}/schema-sqlite.js +91 -24
- package/dist/{drizzle → db/drizzle}/schema.d.ts +79 -32
- package/dist/{drizzle → db/drizzle}/schema.js +106 -35
- package/dist/db/drizzle.config.d.ts +3 -0
- package/dist/db/drizzle.config.js +12 -0
- package/dist/db/index.d.ts +1 -5
- package/dist/db/index.js +51 -8
- package/dist/db/neon.d.ts +8 -0
- package/dist/db/neon.js +20 -0
- package/dist/db/schema/index.d.ts +40 -0
- package/dist/db/schema/index.js +105 -0
- package/dist/db/schema/tables/context-sessions.d.ts +9 -0
- package/dist/db/schema/tables/context-sessions.js +37 -0
- package/dist/db/schema/tables/conversations.d.ts +9 -0
- package/dist/db/schema/tables/conversations.js +47 -0
- package/dist/db/schema/tables/core-memory.d.ts +9 -0
- package/dist/db/schema/tables/core-memory.js +41 -0
- package/dist/db/schema/tables/entities.d.ts +9 -0
- package/dist/db/schema/tables/entities.js +39 -0
- package/dist/db/schema/tables/entity-relations.d.ts +9 -0
- package/dist/db/schema/tables/entity-relations.js +31 -0
- package/dist/db/schema/tables/learnings.d.ts +9 -0
- package/dist/db/schema/tables/learnings.js +66 -0
- package/dist/db/schema/tables/memories.d.ts +9 -0
- package/dist/db/schema/tables/memories.js +161 -0
- package/dist/db/schema/tables/memory-associations.d.ts +9 -0
- package/dist/db/schema/tables/memory-associations.js +39 -0
- package/dist/db/schema/tables/memory-hash-cache.d.ts +9 -0
- package/dist/db/schema/tables/memory-hash-cache.js +29 -0
- package/dist/db/schema/tables/memory-merge-history.d.ts +9 -0
- package/dist/db/schema/tables/memory-merge-history.js +33 -0
- package/dist/db/schema/tables/memory-merge-proposals.d.ts +9 -0
- package/dist/db/schema/tables/memory-merge-proposals.js +39 -0
- package/dist/db/schema/tables/messages.d.ts +9 -0
- package/dist/db/schema/tables/messages.js +41 -0
- package/dist/db/schema/tables/namespaces.d.ts +9 -0
- package/dist/db/schema/tables/namespaces.js +37 -0
- package/dist/db/schema/tables/projects.d.ts +9 -0
- package/dist/db/schema/tables/projects.js +31 -0
- package/dist/db/schema/tables/users.d.ts +9 -0
- package/dist/db/schema/tables/users.js +27 -0
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.js +2 -2
- package/dist/db/supabase.d.ts +9 -0
- package/dist/db/supabase.js +24 -0
- package/dist/index.d.ts +2 -14
- package/dist/index.js +1320 -640
- package/dist/vendor/sql.js/sql-wasm.wasm +0 -0
- package/dist/webui/server.d.ts +5 -0
- package/dist/{api/web/web.js → webui/server.js} +511 -508
- package/generated/mcp/manifest.json +1 -1
- package/{.mcp.json → mcp.json.example} +1 -1
- package/package.json +159 -181
- package/scripts/README.md +60 -0
- package/scripts/copy-runtime-assets.mjs +26 -0
- package/scripts/generate-mcp.mjs +264 -264
- package/scripts/github-release.sh +4 -4
- package/scripts/install-claude-code.sh +85 -0
- package/scripts/install-cursor.sh +56 -0
- package/scripts/install-hooks.sh +73 -0
- package/scripts/install-interactive.mjs +357 -677
- package/scripts/install-opencode.sh +75 -0
- package/scripts/install-windsurf.sh +67 -0
- package/skills/squish-memory/SKILL.md +104 -114
- package/skills/squish-memory/{install.mjs → scripts/install.mjs} +2 -2
- package/skills/squish-memory/{install.sh → scripts/install.sh} +2 -2
- package/skills/squish-memory/write_skill.js +2 -0
- package/.claude-plugin/marketplace.json +0 -20
- package/.claude-plugin/plugin.json +0 -32
- package/.env.mcp.example +0 -60
- package/QUICK-START.md +0 -71
- package/bin/squish-add.mjs +0 -32
- package/bin/squish-rm.mjs +0 -21
- package/commands/observe.md +0 -5
- package/dist/api/web/index.d.ts +0 -3
- package/dist/api/web/index.js +0 -4
- package/dist/api/web/web-server.d.ts +0 -3
- package/dist/api/web/web-server.js +0 -6
- package/dist/api/web/web.d.ts +0 -4
- package/dist/commands/mcp-server.js +0 -393
- package/dist/core/context.js +0 -24
- package/dist/core/governance.js +0 -64
- package/dist/core/observations.d.ts +0 -26
- package/dist/core/observations.js +0 -110
- package/dist/core/requirements.d.ts +0 -20
- package/dist/core/requirements.js +0 -35
- package/hooks/hooks.json +0 -52
- package/hooks/post-tool-use.js +0 -26
- package/hooks/session-end.js +0 -28
- package/hooks/session-start.js +0 -33
- package/hooks/user-prompt-submit.js +0 -26
- package/hooks/utils.js +0 -153
- package/npx-installer.js +0 -208
- package/packages/plugin-claude-code/README.md +0 -73
- package/packages/plugin-claude-code/dist/plugin-wrapper.d.ts +0 -35
- package/packages/plugin-claude-code/dist/plugin-wrapper.js +0 -191
- package/packages/plugin-claude-code/package.json +0 -31
- package/packages/plugin-openclaw/README.md +0 -70
- package/packages/plugin-openclaw/dist/index.d.ts +0 -49
- package/packages/plugin-openclaw/dist/index.js +0 -262
- package/packages/plugin-openclaw/openclaw.plugin.json +0 -94
- package/packages/plugin-openclaw/package.json +0 -31
- package/packages/plugin-opencode/install.mjs +0 -217
- package/packages/plugin-opencode/package.json +0 -21
- package/scripts/db/check-db.mjs +0 -88
- package/scripts/db/fix-all-columns.mjs +0 -52
- package/scripts/db/fix-schema-all.mjs +0 -55
- package/scripts/db/fix-schema-full.mjs +0 -46
- package/scripts/db/fix-schema.mjs +0 -38
- package/scripts/db/init-db.mjs +0 -13
- package/scripts/db/recreate-db.mjs +0 -14
- package/scripts/install-mcp.mjs +0 -116
- package/scripts/install-web.sh +0 -120
- package/scripts/install.mjs +0 -340
- package/scripts/openclaw-bootstrap.mjs +0 -127
- package/scripts/package-release.sh +0 -71
- package/scripts/test/test-all-systems.mjs +0 -139
- package/scripts/test/test-memory-system.mjs +0 -139
- package/scripts/test/test-v0.5.0.mjs +0 -210
- package/skills/memory-guide/SKILL.md +0 -332
- package/skills/squish-cli/SKILL.md +0 -240
- package/skills/squish-mcp/SKILL.md +0 -355
- package/skills/squish-memory/claude-desktop.json +0 -12
- package/skills/squish-memory/openclaw.json +0 -13
- package/skills/squish-memory/opencode.json +0 -14
- package/skills/squish-memory/skill.json +0 -32
- /package/{commands → core/commands}/context-paging.md +0 -0
- /package/{commands → core/commands}/context-status.md +0 -0
- /package/{commands → core/commands}/context.md +0 -0
- /package/{commands → core/commands}/core-memory.md +0 -0
- /package/{commands → core/commands}/health.md +0 -0
- /package/{commands → core/commands}/merge.md +0 -0
- /package/{commands → core/commands}/recall.md +0 -0
- /package/{commands → core/commands}/remember.md +0 -0
- /package/{commands → core/commands}/search.md +0 -0
- /package/dist/{algorithms → core/algorithms}/detection/hash-filters.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/detection/hash-filters.js +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/approve-merge.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/detect-duplicates.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/get-stats.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/list-proposals.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/preview-merge.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/reject-merge.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/handlers/reverse-merge.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/safety/safety-checks.js +0 -0
- /package/dist/{algorithms → core/algorithms}/utils/response-builder.d.ts +0 -0
- /package/dist/{algorithms → core/algorithms}/utils/response-builder.js +0 -0
- /package/dist/{commands → core/commands}/managed-sync.d.ts +0 -0
- /package/dist/{commands → core/commands}/mcp-server.d.ts +0 -0
- /package/dist/core/{context.d.ts → context/context.d.ts} +0 -0
- /package/dist/core/{agent-memory.d.ts → ingestion/agent-memory.d.ts} +0 -0
- /package/dist/core/{core-memory.d.ts → ingestion/core-memory.d.ts} +0 -0
- /package/dist/core/{privacy.d.ts → security/privacy.d.ts} +0 -0
- /package/dist/core/{privacy.js → security/privacy.js} +0 -0
- /package/dist/core/{secret-detector.d.ts → security/secret-detector.d.ts} +0 -0
- /package/dist/core/{secret-detector.js → security/secret-detector.js} +0 -0
- /package/dist/core/{cache.d.ts → storage/cache.d.ts} +0 -0
- /package/dist/core/{database.d.ts → storage/database.d.ts} +0 -0
- /package/dist/core/{database.js → storage/database.js} +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@squish/memory-openclaw",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "OpenClaw memory plugin for Squish - provides memory_search and memory_get tools via Squish MCP",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"dev": "bun --hot src/index.ts",
|
|
10
|
-
"prepublishOnly": "npm run clean && npm run build",
|
|
11
|
-
"prepare": "npm run build",
|
|
12
|
-
"clean": "rm -rf dist"
|
|
13
|
-
},
|
|
14
|
-
"keywords": ["openclaw", "plugin", "memory", "mcp", "squish"],
|
|
15
|
-
"author": "michielhdoteth",
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"dependencies": {
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.27.0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@types/node": "^22.0.0",
|
|
22
|
-
"typescript": "^5.7.0",
|
|
23
|
-
"vitest": "^4.0.17"
|
|
24
|
-
},
|
|
25
|
-
"peerDependencies": {
|
|
26
|
-
"squish-memory": ">=1.0.0"
|
|
27
|
-
},
|
|
28
|
-
"engines": {
|
|
29
|
-
"node": ">=18.0.0"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* OpenCode Plugin Installer for Squish
|
|
5
|
-
* Auto-installs CLI + configures OpenCode to use Squish as MCP server
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from "node:fs";
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
import os from "node:os";
|
|
11
|
-
import { spawnSync } from "node:child_process";
|
|
12
|
-
|
|
13
|
-
const CONFIG_DIR = path.join(os.homedir(), ".config", "opencode");
|
|
14
|
-
const CONFIG_PATH = path.join(CONFIG_DIR, "config.json");
|
|
15
|
-
|
|
16
|
-
const OPENCODE_SCHEMA = "https://opencode.ai/config.json";
|
|
17
|
-
|
|
18
|
-
function ensureDir(dirPath) {
|
|
19
|
-
if (!fs.existsSync(dirPath)) {
|
|
20
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function getSquishMcpConfig() {
|
|
25
|
-
return {
|
|
26
|
-
type: "local",
|
|
27
|
-
command: ["squish-mcp"],
|
|
28
|
-
enabled: true,
|
|
29
|
-
environment: {}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function loadOpenCodeConfig() {
|
|
34
|
-
if (!fs.existsSync(CONFIG_PATH)) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const content = fs.readFileSync(CONFIG_PATH, "utf8");
|
|
40
|
-
return JSON.parse(content);
|
|
41
|
-
} catch (error) {
|
|
42
|
-
console.error(`[ERROR] Failed to parse OpenCode config: ${error.message}`);
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function saveOpenCodeConfig(config) {
|
|
48
|
-
ensureDir(CONFIG_DIR);
|
|
49
|
-
fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function createNewConfig() {
|
|
53
|
-
return {
|
|
54
|
-
$schema: OPENCODE_SCHEMA,
|
|
55
|
-
mcp: {
|
|
56
|
-
squish: getSquishMcpConfig()
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function installForOpenCode(options = {}) {
|
|
62
|
-
console.log("[INSTALL] Installing Squish for OpenCode...");
|
|
63
|
-
|
|
64
|
-
let config = loadOpenCodeConfig();
|
|
65
|
-
let created = false;
|
|
66
|
-
|
|
67
|
-
if (!config) {
|
|
68
|
-
if (options.dryRun) {
|
|
69
|
-
console.log("[DRY-RUN] Would create new OpenCode config at:", CONFIG_PATH);
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
config = createNewConfig();
|
|
74
|
-
created = true;
|
|
75
|
-
console.log("[INSTALL] Created new OpenCode config");
|
|
76
|
-
} else {
|
|
77
|
-
if (options.dryRun) {
|
|
78
|
-
console.log("[DRY-RUN] Would update existing OpenCode config at:", CONFIG_PATH);
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Ensure mcp section exists
|
|
83
|
-
if (!config.mcp) {
|
|
84
|
-
config.mcp = {};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Add or update squish MCP config
|
|
88
|
-
config.mcp.squish = getSquishMcpConfig();
|
|
89
|
-
console.log("[INSTALL] Updated existing OpenCode config");
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
saveOpenCodeConfig(config);
|
|
93
|
-
console.log(`[INSTALL] ${created ? 'Created' : 'Updated'}: ${CONFIG_PATH}`);
|
|
94
|
-
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function uninstallForOpenCode(options = {}) {
|
|
99
|
-
console.log("[UNINSTALL] Removing Squish from OpenCode...");
|
|
100
|
-
|
|
101
|
-
const config = loadOpenCodeConfig();
|
|
102
|
-
if (!config) {
|
|
103
|
-
console.log("[UNINSTALL] No OpenCode config found");
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (!config.mcp || !config.mcp.squish) {
|
|
108
|
-
console.log("[UNINSTALL] Squish not found in OpenCode config");
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (options.dryRun) {
|
|
113
|
-
console.log("[DRY-RUN] Would remove Squish from OpenCode config");
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
delete config.mcp.squish;
|
|
118
|
-
|
|
119
|
-
// Clean up empty mcp section
|
|
120
|
-
if (Object.keys(config.mcp).length === 0) {
|
|
121
|
-
delete config.mcp;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
saveOpenCodeConfig(config);
|
|
125
|
-
console.log("[UNINSTALL] Removed Squish from OpenCode config");
|
|
126
|
-
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function verifyOpenCodeInstallation() {
|
|
131
|
-
console.log("[VERIFY] Checking OpenCode installation...");
|
|
132
|
-
|
|
133
|
-
const config = loadOpenCodeConfig();
|
|
134
|
-
if (!config) {
|
|
135
|
-
return { ok: false, error: "OpenCode config not found" };
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (!config.mcp || !config.mcp.squish) {
|
|
139
|
-
return { ok: false, error: "Squish MCP not configured" };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const squishConfig = config.mcp.squish;
|
|
143
|
-
|
|
144
|
-
if (squishConfig.type !== "local") {
|
|
145
|
-
return { ok: false, error: `Expected type 'local', got '${squishConfig.type}'` };
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (!squishConfig.enabled) {
|
|
149
|
-
return { ok: false, error: "Squish MCP is disabled" };
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Check if squish-mcp command is available
|
|
153
|
-
const result = spawnSync("which", ["squish-mcp"], { encoding: "utf8", shell: true });
|
|
154
|
-
if (result.status !== 0) {
|
|
155
|
-
return { ok: false, error: "squish-mcp command not found in PATH" };
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
console.log("[VERIFY] OpenCode config:", CONFIG_PATH);
|
|
159
|
-
console.log("[VERIFY] Squish MCP configured:", squishConfig.command.join(" "));
|
|
160
|
-
console.log("[VERIFY] Status: enabled");
|
|
161
|
-
|
|
162
|
-
return { ok: true, message: "OpenCode installation verified" };
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function main() {
|
|
166
|
-
const args = process.argv.slice(2);
|
|
167
|
-
const options = {
|
|
168
|
-
dryRun: args.includes("--dry-run") || args.includes("-d"),
|
|
169
|
-
uninstall: args.includes("--uninstall") || args.includes("-u"),
|
|
170
|
-
verify: args.includes("--verify") || args.includes("-v")
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
console.log("[OpenCode Plugin for Squish]");
|
|
174
|
-
console.log();
|
|
175
|
-
|
|
176
|
-
try {
|
|
177
|
-
if (options.verify) {
|
|
178
|
-
const result = verifyOpenCodeInstallation();
|
|
179
|
-
if (result.ok) {
|
|
180
|
-
console.log("\n[VERIFY] " + result.message);
|
|
181
|
-
process.exit(0);
|
|
182
|
-
} else {
|
|
183
|
-
console.error("\n[VERIFY] Failed:", result.error);
|
|
184
|
-
process.exit(1);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (options.uninstall) {
|
|
189
|
-
const success = uninstallForOpenCode(options);
|
|
190
|
-
process.exit(success ? 0 : 1);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const success = installForOpenCode(options);
|
|
194
|
-
|
|
195
|
-
if (success && !options.dryRun) {
|
|
196
|
-
const verify = verifyOpenCodeInstallation();
|
|
197
|
-
if (verify.ok) {
|
|
198
|
-
console.log("\n[SUCCESS] OpenCode plugin installed successfully!");
|
|
199
|
-
console.log("\nTo use Squish in OpenCode:");
|
|
200
|
-
console.log(" 1. Restart OpenCode if it's running");
|
|
201
|
-
console.log(" 2. Start a conversation and ask about memories");
|
|
202
|
-
console.log(" 3. Or explicitly: 'use the squish tool to search for...'");
|
|
203
|
-
} else {
|
|
204
|
-
console.error("\n[WARNING] Installation succeeded but verification failed:");
|
|
205
|
-
console.error(" ", verify.error);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
process.exit(success ? 0 : 1);
|
|
210
|
-
|
|
211
|
-
} catch (error) {
|
|
212
|
-
console.error("[ERROR]", error.message);
|
|
213
|
-
process.exit(1);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
main();
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@squish/plugin-opencode",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "OpenCode plugin for Squish - auto-installs CLI and configures OpenCode to use Squish as MCP server",
|
|
5
|
-
"main": "install.mjs",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"install": "node install.mjs",
|
|
9
|
-
"verify": "node install.mjs --verify",
|
|
10
|
-
"uninstall": "node install.mjs --uninstall"
|
|
11
|
-
},
|
|
12
|
-
"keywords": ["opencode", "plugin", "memory", "mcp", "squish"],
|
|
13
|
-
"author": "michielhdoteth",
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"peerDependencies": {
|
|
16
|
-
"squish-memory": ">=1.0.0"
|
|
17
|
-
},
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=18.0.0"
|
|
20
|
-
}
|
|
21
|
-
}
|
package/scripts/db/check-db.mjs
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const dbPath = path.join(__dirname, '.squish', 'squish.db');
|
|
7
|
-
|
|
8
|
-
console.log('=== DATABASE STATUS ===\n');
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const db = new Database(dbPath);
|
|
12
|
-
|
|
13
|
-
// Get all tables
|
|
14
|
-
const tables = db.prepare(`
|
|
15
|
-
SELECT name FROM sqlite_master
|
|
16
|
-
WHERE type='table'
|
|
17
|
-
ORDER BY name
|
|
18
|
-
`).all();
|
|
19
|
-
|
|
20
|
-
console.log(`📊 Total Tables: ${tables.length}`);
|
|
21
|
-
tables.forEach(t => console.log(` - ${t.name}`));
|
|
22
|
-
console.log('');
|
|
23
|
-
|
|
24
|
-
// Get memory counts
|
|
25
|
-
console.log('📝 Memory Storage:\n');
|
|
26
|
-
|
|
27
|
-
const memoriesCount = db.prepare('SELECT COUNT(*) as count FROM memories').get();
|
|
28
|
-
console.log(`✅ Memories: ${memoriesCount.count}`);
|
|
29
|
-
|
|
30
|
-
const conversationsCount = db.prepare('SELECT COUNT(*) as count FROM conversations').get();
|
|
31
|
-
console.log(`✅ Conversations: ${conversationsCount.count}`);
|
|
32
|
-
|
|
33
|
-
const observationsCount = db.prepare('SELECT COUNT(*) as count FROM observations').get();
|
|
34
|
-
console.log(`✅ Observations: ${observationsCount.count}`);
|
|
35
|
-
|
|
36
|
-
const coreMemoryCount = db.prepare('SELECT COUNT(*) as count FROM core_memory').get();
|
|
37
|
-
console.log(`✅ Core Memory Sections: ${coreMemoryCount.count}`);
|
|
38
|
-
|
|
39
|
-
console.log('\n');
|
|
40
|
-
|
|
41
|
-
// Show recent memories (if any exist)
|
|
42
|
-
if (memoriesCount.count > 0) {
|
|
43
|
-
console.log('📚 Recent Memories:\n');
|
|
44
|
-
const recentMemories = db.prepare(`
|
|
45
|
-
SELECT id, type, content, createdAt
|
|
46
|
-
FROM memories
|
|
47
|
-
ORDER BY createdAt DESC
|
|
48
|
-
LIMIT 5
|
|
49
|
-
`).all();
|
|
50
|
-
|
|
51
|
-
recentMemories.forEach((mem, i) => {
|
|
52
|
-
const content = mem.content.substring(0, 100) + (mem.content.length > 100 ? '...' : '');
|
|
53
|
-
const date = new Date(mem.createdAt).toLocaleString();
|
|
54
|
-
const memId = String(mem.id).substring(0, 8);
|
|
55
|
-
console.log(`${i+1}. [${mem.type}] ${date}`);
|
|
56
|
-
console.log(` "${content}"`);
|
|
57
|
-
console.log(` ID: ${memId}...`);
|
|
58
|
-
console.log('');
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
console.log('📚 No memories stored yet\n');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Show core memory content
|
|
65
|
-
console.log('🧠 Core Memory Content:\n');
|
|
66
|
-
const coreMemSections = db.prepare(`
|
|
67
|
-
SELECT section, content, version
|
|
68
|
-
FROM core_memory
|
|
69
|
-
ORDER BY section
|
|
70
|
-
`).all();
|
|
71
|
-
|
|
72
|
-
coreMemSections.forEach(section => {
|
|
73
|
-
const content = section.content || '(empty)';
|
|
74
|
-
console.log(`${section.section.toUpperCase()}: v${section.version}`);
|
|
75
|
-
if (content !== '(empty)') {
|
|
76
|
-
console.log(` ${content.substring(0, 80)}${content.length > 80 ? '...' : ''}`);
|
|
77
|
-
} else {
|
|
78
|
-
console.log(` ${content}`);
|
|
79
|
-
}
|
|
80
|
-
console.log('');
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
db.close();
|
|
84
|
-
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.error('❌ Error:', error.message);
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import { getDataDir } from './dist/config.js';
|
|
3
|
-
|
|
4
|
-
const dbPath = `${getDataDir()}/squish.db`;
|
|
5
|
-
console.log(`Fixing schema for: ${dbPath}`);
|
|
6
|
-
|
|
7
|
-
const db = new Database(dbPath);
|
|
8
|
-
|
|
9
|
-
// Get current columns
|
|
10
|
-
const tableInfo = db.prepare("PRAGMA table_info(memories)").all();
|
|
11
|
-
const existingCols = new Set(tableInfo.map(col => col.name));
|
|
12
|
-
|
|
13
|
-
// All columns from Drizzle schema-sqlite.ts (in order, with snake_case names)
|
|
14
|
-
const allColumns = [
|
|
15
|
-
{ name: 'sector', type: "TEXT DEFAULT 'episodic'" },
|
|
16
|
-
{ name: 'tier', type: "TEXT DEFAULT 'hot'" },
|
|
17
|
-
{ name: 'context_status', type: "TEXT DEFAULT 'out-of-context'" },
|
|
18
|
-
{ name: 'decay_rate', type: 'INTEGER DEFAULT 30' },
|
|
19
|
-
{ name: 'coactivation_score', type: 'INTEGER DEFAULT 0' },
|
|
20
|
-
{ name: 'last_decay_at', type: 'INTEGER' },
|
|
21
|
-
{ name: 'agent_role', type: 'TEXT' },
|
|
22
|
-
{ name: 'is_pinned', type: 'INTEGER DEFAULT 0' },
|
|
23
|
-
{ name: 'is_immutable', type: 'INTEGER DEFAULT 0' },
|
|
24
|
-
{ name: 'write_scope', type: 'TEXT' },
|
|
25
|
-
{ name: 'read_scope', type: 'TEXT' },
|
|
26
|
-
{ name: 'triggered_by', type: 'TEXT' },
|
|
27
|
-
{ name: 'capture_reason', type: 'TEXT' },
|
|
28
|
-
{ name: 'last_used_at', type: 'INTEGER' },
|
|
29
|
-
{ name: 'usage_count', type: 'INTEGER DEFAULT 0' },
|
|
30
|
-
{ name: 'valid_from', type: 'INTEGER' },
|
|
31
|
-
{ name: 'valid_to', type: 'INTEGER' },
|
|
32
|
-
{ name: 'superseded_by', type: 'TEXT' },
|
|
33
|
-
{ name: 'version', type: 'INTEGER DEFAULT 1' },
|
|
34
|
-
];
|
|
35
|
-
|
|
36
|
-
let added = 0;
|
|
37
|
-
for (const col of allColumns) {
|
|
38
|
-
if (!existingCols.has(col.name)) {
|
|
39
|
-
console.log(`Adding: ${col.name}`);
|
|
40
|
-
try {
|
|
41
|
-
db.exec(`ALTER TABLE memories ADD COLUMN ${col.name} ${col.type};`);
|
|
42
|
-
added++;
|
|
43
|
-
} catch (e) {
|
|
44
|
-
console.log(` ⚠️ ${e.message}`);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
console.log(`✅ ${col.name}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
db.close();
|
|
52
|
-
console.log(`✅ Added ${added} columns`);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import { getDataDir } from './dist/config.js';
|
|
3
|
-
|
|
4
|
-
const dbPath = `${getDataDir()}/squish.db`;
|
|
5
|
-
console.log(`Fixing schema for: ${dbPath}`);
|
|
6
|
-
|
|
7
|
-
const db = new Database(dbPath);
|
|
8
|
-
|
|
9
|
-
// Get current columns
|
|
10
|
-
const tableInfo = db.prepare("PRAGMA table_info(memories)").all();
|
|
11
|
-
const existingCols = new Set(tableInfo.map(col => col.name));
|
|
12
|
-
console.log('Existing columns:', Array.from(existingCols).join(', '));
|
|
13
|
-
|
|
14
|
-
// All columns from Drizzle schema
|
|
15
|
-
const neededColumns = [
|
|
16
|
-
{ name: 'embedding', type: 'BLOB' },
|
|
17
|
-
{ name: 'is_private', type: 'INTEGER DEFAULT 0' },
|
|
18
|
-
{ name: 'has_secrets', type: 'INTEGER DEFAULT 0' },
|
|
19
|
-
{ name: 'is_protected', type: 'INTEGER DEFAULT 0' },
|
|
20
|
-
{ name: 'is_active', type: 'INTEGER DEFAULT 1' },
|
|
21
|
-
{ name: 'access_count', type: 'INTEGER DEFAULT 0' },
|
|
22
|
-
{ name: 'last_accessed_at', type: 'INTEGER' },
|
|
23
|
-
{ name: 'expires_at', type: 'INTEGER' },
|
|
24
|
-
{ name: 'confidence', type: 'INTEGER DEFAULT 100' },
|
|
25
|
-
{ name: 'source', type: 'TEXT' },
|
|
26
|
-
{ name: 'summary', type: 'TEXT' },
|
|
27
|
-
{ name: 'user_id', type: 'TEXT' },
|
|
28
|
-
{ name: 'agent_id', type: 'TEXT' },
|
|
29
|
-
{ name: 'visibility_scope', type: 'TEXT DEFAULT \'private\'' },
|
|
30
|
-
{ name: 'relevance_score', type: 'INTEGER DEFAULT 50' },
|
|
31
|
-
{ name: 'is_merged', type: 'INTEGER DEFAULT 0' },
|
|
32
|
-
{ name: 'merged_into_id', type: 'TEXT' },
|
|
33
|
-
{ name: 'merged_at', type: 'INTEGER' },
|
|
34
|
-
{ name: 'is_canonical', type: 'INTEGER DEFAULT 0' },
|
|
35
|
-
{ name: 'merge_source_ids', type: 'TEXT' },
|
|
36
|
-
{ name: 'is_mergeable', type: 'INTEGER DEFAULT 1' },
|
|
37
|
-
{ name: 'merge_version', type: 'INTEGER DEFAULT 1' },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
let added = 0;
|
|
41
|
-
for (const col of neededColumns) {
|
|
42
|
-
if (!existingCols.has(col.name)) {
|
|
43
|
-
console.log(`Adding column: ${col.name}`);
|
|
44
|
-
try {
|
|
45
|
-
db.exec(`ALTER TABLE memories ADD COLUMN ${col.name} ${col.type};`);
|
|
46
|
-
console.log(` ✅ Added ${col.name}`);
|
|
47
|
-
added++;
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.log(` ⚠️ ${e.message}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
db.close();
|
|
55
|
-
console.log(`✅ Schema fix complete. Added ${added} columns.`);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import { getDataDir } from './dist/config.js';
|
|
3
|
-
|
|
4
|
-
const dbPath = `${getDataDir()}/squish.db`;
|
|
5
|
-
console.log(`Fixing schema for: ${dbPath}`);
|
|
6
|
-
|
|
7
|
-
const db = new Database(dbPath);
|
|
8
|
-
|
|
9
|
-
// Get current columns in memories table
|
|
10
|
-
const tableInfo = db.prepare("PRAGMA table_info(memories)").all();
|
|
11
|
-
const existingCols = new Set(tableInfo.map(col => col.name));
|
|
12
|
-
|
|
13
|
-
// Columns needed by Drizzle schema but might be missing
|
|
14
|
-
const neededColumns = [
|
|
15
|
-
{ name: 'embedding', type: 'BLOB' },
|
|
16
|
-
{ name: 'is_private', type: 'INTEGER DEFAULT 0' },
|
|
17
|
-
{ name: 'has_secrets', type: 'INTEGER DEFAULT 0' },
|
|
18
|
-
{ name: 'is_protected', type: 'INTEGER DEFAULT 0' },
|
|
19
|
-
{ name: 'is_active', type: 'INTEGER DEFAULT 1' },
|
|
20
|
-
{ name: 'access_count', type: 'INTEGER DEFAULT 0' },
|
|
21
|
-
{ name: 'last_accessed_at', type: 'INTEGER' },
|
|
22
|
-
{ name: 'expires_at', type: 'INTEGER' },
|
|
23
|
-
{ name: 'confidence', type: 'INTEGER DEFAULT 100' },
|
|
24
|
-
{ name: 'source', type: 'TEXT' },
|
|
25
|
-
{ name: 'summary', type: 'TEXT' },
|
|
26
|
-
{ name: 'user_id', type: 'TEXT' },
|
|
27
|
-
{ name: 'agent_id', type: 'TEXT' },
|
|
28
|
-
{ name: 'visibility_scope', type: 'TEXT DEFAULT \'private\'' },
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
for (const col of neededColumns) {
|
|
32
|
-
if (!existingCols.has(col.name)) {
|
|
33
|
-
console.log(`Adding column: ${col.name}`);
|
|
34
|
-
try {
|
|
35
|
-
db.exec(`ALTER TABLE memories ADD COLUMN ${col.name} ${col.type};`);
|
|
36
|
-
console.log(` ✅ Added ${col.name}`);
|
|
37
|
-
} catch (e) {
|
|
38
|
-
console.log(` ⚠️ ${e.message}`);
|
|
39
|
-
}
|
|
40
|
-
} else {
|
|
41
|
-
console.log(`✅ ${col.name} already exists`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
db.close();
|
|
46
|
-
console.log('✅ Schema fix complete');
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import Database from 'better-sqlite3';
|
|
2
|
-
import { getDataDir } from './dist/config.js';
|
|
3
|
-
|
|
4
|
-
const dbPath = `${getDataDir()}/squish.db`;
|
|
5
|
-
console.log(`Fixing schema for: ${dbPath}`);
|
|
6
|
-
|
|
7
|
-
const db = new Database(dbPath);
|
|
8
|
-
|
|
9
|
-
// Check if embedding column exists
|
|
10
|
-
const tableInfo = db.prepare("PRAGMA table_info(memories)").all();
|
|
11
|
-
const hasEmbedding = tableInfo.some(col => col.name === 'embedding');
|
|
12
|
-
|
|
13
|
-
if (!hasEmbedding) {
|
|
14
|
-
console.log('Adding missing embedding column...');
|
|
15
|
-
db.exec(`ALTER TABLE memories ADD COLUMN embedding BLOB;`);
|
|
16
|
-
console.log('✅ Added embedding column');
|
|
17
|
-
} else {
|
|
18
|
-
console.log('✅ embedding column already exists');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Check other tables that might need the embedding column
|
|
22
|
-
const tables = ['observations', 'messages', 'entities'];
|
|
23
|
-
for (const table of tables) {
|
|
24
|
-
const info = db.prepare(`PRAGMA table_info(${table})`).all();
|
|
25
|
-
const hasCol = info.some(col => col.name === 'embedding');
|
|
26
|
-
if (!hasCol) {
|
|
27
|
-
console.log(`Adding embedding column to ${table}...`);
|
|
28
|
-
try {
|
|
29
|
-
db.exec(`ALTER TABLE ${table} ADD COLUMN embedding BLOB;`);
|
|
30
|
-
console.log(`✅ Added embedding column to ${table}`);
|
|
31
|
-
} catch (e) {
|
|
32
|
-
console.log(`⚠️ Could not add to ${table}: ${e.message}`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
db.close();
|
|
38
|
-
console.log('✅ Schema fix complete');
|
package/scripts/db/init-db.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { createDb } from './dist/db/adapter.js';
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
try {
|
|
5
|
-
await createDb();
|
|
6
|
-
console.log('✅ Database initialized successfully');
|
|
7
|
-
} catch (error) {
|
|
8
|
-
console.error('❌ Failed to initialize database:', error.message);
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
main();
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createDb } from './dist/db/adapter.js';
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
try {
|
|
5
|
-
console.log('Creating database with proper schema...');
|
|
6
|
-
await createDb();
|
|
7
|
-
console.log('✅ Database recreated successfully');
|
|
8
|
-
} catch (error) {
|
|
9
|
-
console.error('❌ Failed:', error.message);
|
|
10
|
-
process.exit(1);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
main();
|