context-mode 1.0.51 → 1.0.53

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.
@@ -6,14 +6,14 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code plugins by Mert Koseoğlu",
9
- "version": "1.0.51"
9
+ "version": "1.0.53"
10
10
  },
11
11
  "plugins": [
12
12
  {
13
13
  "name": "context-mode",
14
14
  "source": "./",
15
15
  "description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
16
- "version": "1.0.51",
16
+ "version": "1.0.53",
17
17
  "author": {
18
18
  "name": "Mert Koseoğlu"
19
19
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
@@ -3,7 +3,7 @@
3
3
  "name": "Context Mode",
4
4
  "kind": "tool",
5
5
  "description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
6
- "version": "1.0.51",
6
+ "version": "1.0.53",
7
7
  "sandbox": {
8
8
  "mode": "permissive",
9
9
  "filesystem_access": "full",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "context-mode",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "description": "OpenClaw plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
5
5
  "author": {
6
6
  "name": "Mert Koseoğlu",
package/README.md CHANGED
@@ -532,6 +532,7 @@ Full configs: [`configs/kiro/mcp.json`](configs/kiro/mcp.json) | [`configs/kiro/
532
532
  git clone https://github.com/mksglu/context-mode.git ~/.pi/extensions/context-mode
533
533
  cd ~/.pi/extensions/context-mode
534
534
  npm install
535
+ npm run build
535
536
  ```
536
537
 
537
538
  2. Add to `~/.pi/settings/mcp.json` (or `.pi/settings/mcp.json` for project-level):
@@ -19,6 +19,7 @@ import type { HookAdapter, HookParadigm, PlatformCapabilities, DiagnosticResult,
19
19
  export declare class OpenCodeAdapter implements HookAdapter {
20
20
  readonly name = "OpenCode";
21
21
  readonly paradigm: HookParadigm;
22
+ private settingsPath?;
22
23
  readonly capabilities: PlatformCapabilities;
23
24
  parsePreToolUseInput(raw: unknown): PreToolUseEvent;
24
25
  parsePostToolUseInput(raw: unknown): PostToolUseEvent;
@@ -29,6 +30,7 @@ export declare class OpenCodeAdapter implements HookAdapter {
29
30
  formatPreCompactResponse(response: PreCompactResponse): unknown;
30
31
  formatSessionStartResponse(response: SessionStartResponse): unknown;
31
32
  getSettingsPath(): string;
33
+ private paths;
32
34
  getSessionDir(): string;
33
35
  getSessionDBPath(projectDir: string): string;
34
36
  getSessionEventsPath(projectDir: string): string;
@@ -29,6 +29,7 @@ import { HOOK_TYPES as OPENCODE_HOOK_NAMES } from "./hooks.js";
29
29
  export class OpenCodeAdapter {
30
30
  name = "OpenCode";
31
31
  paradigm = "ts-plugin";
32
+ settingsPath;
32
33
  capabilities = {
33
34
  preToolUse: true,
34
35
  postToolUse: true,
@@ -133,8 +134,14 @@ export class OpenCodeAdapter {
133
134
  }
134
135
  // ── Configuration ──────────────────────────────────────
135
136
  getSettingsPath() {
136
- // OpenCode uses opencode.json in the project root or .opencode/opencode.json
137
- return resolve("opencode.json");
137
+ return this.settingsPath ?? resolve("opencode.json");
138
+ }
139
+ paths() {
140
+ return [
141
+ resolve("opencode.json"),
142
+ resolve(".opencode", "opencode.json"),
143
+ join(homedir(), ".config", "opencode", "opencode.json"),
144
+ ];
138
145
  }
139
146
  getSessionDir() {
140
147
  const dir = join(homedir(), ".config", "opencode", "context-mode", "sessions");
@@ -196,15 +203,11 @@ export class OpenCodeAdapter {
196
203
  };
197
204
  }
198
205
  readSettings() {
199
- // Try project-local paths first, then global config
200
- const paths = [
201
- resolve("opencode.json"),
202
- resolve(".opencode", "opencode.json"),
203
- join(homedir(), ".config", "opencode", "opencode.json"),
204
- ];
205
- for (const configPath of paths) {
206
+ this.settingsPath = undefined;
207
+ for (const configPath of this.paths()) {
206
208
  try {
207
209
  const raw = readFileSync(configPath, "utf-8");
210
+ this.settingsPath = configPath;
208
211
  return JSON.parse(raw);
209
212
  }
210
213
  catch {
@@ -214,9 +217,7 @@ export class OpenCodeAdapter {
214
217
  return null;
215
218
  }
216
219
  writeSettings(settings) {
217
- // Write to opencode.json in current directory
218
- const configPath = resolve("opencode.json");
219
- writeFileSync(configPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
220
+ writeFileSync(this.getSettingsPath(), JSON.stringify(settings, null, 2) + "\n", "utf-8");
220
221
  }
221
222
  // ── Diagnostics (doctor) ─────────────────────────────────
222
223
  validateHooks(_pluginRoot) {
@@ -320,14 +321,11 @@ export class OpenCodeAdapter {
320
321
  return changes;
321
322
  }
322
323
  backupSettings() {
323
- const paths = [
324
- resolve("opencode.json"),
325
- resolve(".opencode", "opencode.json"),
326
- join(homedir(), ".config", "opencode", "opencode.json"),
327
- ];
328
- for (const configPath of paths) {
324
+ this.settingsPath = undefined;
325
+ for (const configPath of this.paths()) {
329
326
  try {
330
327
  accessSync(configPath, constants.R_OK);
328
+ this.settingsPath = configPath;
331
329
  const backupPath = configPath + ".bak";
332
330
  copyFileSync(configPath, backupPath);
333
331
  return backupPath;