pal-code 0.0.7 → 0.0.9

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.
@@ -1,209 +0,0 @@
1
- import {test, expect} from 'bun:test';
2
- import {rm} from 'fs/promises';
3
- import {join} from 'path';
4
- import {Database} from 'bun:sqlite';
5
- import {SessionStore} from './store.js';
6
-
7
- /**
8
- * Each test gets its own file. Sharing one path let a Windows file lock leak a
9
- * previous test's schema into the next — which produced confusing failures
10
- * ("table sessions already exists") unrelated to the code under test.
11
- */
12
- const pathFor = (name: string) => join(import.meta.dir, `.test-v2-${name}.db`);
13
-
14
- async function cleanup(name: string): Promise<void> {
15
- for (const suffix of ['', '-wal', '-shm']) {
16
- await rm(`${pathFor(name)}${suffix}`, {force: true});
17
- }
18
- }
19
-
20
- /** `messages_backup`'s NOT NULL flag, or undefined when the column is absent. */
21
- function backupNotNull(p: string): number | undefined {
22
- const db = new Database(p, {readonly: true});
23
- const col = (
24
- db.query('PRAGMA table_info(sessions)').all() as Array<{name: string; notnull: number}>
25
- ).find((c) => c.name === 'messages_backup');
26
- db.close();
27
- return col?.notnull;
28
- }
29
-
30
- function userVersion(p: string): number {
31
- const db = new Database(p, {readonly: true});
32
- const v = (db.query('PRAGMA user_version').get() as {user_version: number}).user_version;
33
- db.close();
34
- return v;
35
- }
36
-
37
- /**
38
- * Seed the exact broken state a real DB lands in after the old migration:
39
- * `messages_backup` inherited the legacy `NOT NULL`, history *was* exploded into
40
- * `messages` rows, and user_version was already bumped — so `migrate()` returned
41
- * early and could never repair the constraint.
42
- */
43
- function seedBrokenV1(p: string): void {
44
- const db = new Database(p);
45
- db.exec(`
46
- CREATE TABLE sessions (
47
- id TEXT PRIMARY KEY,
48
- title TEXT,
49
- messages_backup TEXT NOT NULL,
50
- input_tokens INTEGER NOT NULL DEFAULT 0,
51
- output_tokens INTEGER NOT NULL DEFAULT 0,
52
- cached_tokens INTEGER NOT NULL DEFAULT 0,
53
- cost REAL NOT NULL DEFAULT 0,
54
- created_at INTEGER NOT NULL,
55
- updated_at INTEGER NOT NULL,
56
- compacted_upto_seq INTEGER NOT NULL DEFAULT 0
57
- );
58
- CREATE TABLE messages (
59
- id TEXT PRIMARY KEY,
60
- session_id TEXT NOT NULL,
61
- seq INTEGER NOT NULL,
62
- role TEXT NOT NULL,
63
- content TEXT NOT NULL,
64
- tool_calls TEXT,
65
- tool_call_id TEXT,
66
- tool_name TEXT,
67
- tool_status TEXT,
68
- agent_role TEXT,
69
- created_at INTEGER NOT NULL,
70
- UNIQUE(session_id, seq)
71
- );
72
- CREATE TABLE session_compactions (
73
- id TEXT PRIMARY KEY,
74
- session_id TEXT NOT NULL,
75
- from_seq INTEGER NOT NULL,
76
- to_seq INTEGER NOT NULL,
77
- summary TEXT NOT NULL,
78
- created_at INTEGER NOT NULL
79
- );
80
- `);
81
- db.run(
82
- 'INSERT INTO sessions (id, title, messages_backup, created_at, updated_at, compacted_upto_seq) VALUES (?, ?, ?, ?, ?, 0)',
83
- ['broken-1', 'Pre-existing', '[{"role":"user","content":"old"}]', 1000, 2000],
84
- );
85
- // History was exploded into rows before the rename — mirror that.
86
- db.run(
87
- 'INSERT INTO messages (id, session_id, seq, role, content, created_at) VALUES (?, ?, ?, ?, ?, ?)',
88
- ['m1', 'broken-1', 1, 'user', 'old', 1000],
89
- );
90
- db.exec('PRAGMA user_version = 1');
91
- db.close();
92
- }
93
-
94
- test('repair: an already-migrated v1 DB can create sessions again', async () => {
95
- const p = pathFor('broken');
96
- await cleanup('broken');
97
- seedBrokenV1(p);
98
-
99
- expect(backupNotNull(p)).toBe(1); // the broken constraint
100
- expect(userVersion(p)).toBe(1); // and the version that blocked repair
101
-
102
- const store = new SessionStore({dbPath: p});
103
- store.init();
104
- try {
105
- expect(userVersion(p)).toBe(2);
106
- expect(backupNotNull(p)).toBe(0); // relaxed
107
-
108
- // The bug: this INSERT used to fail with
109
- // "NOT NULL constraint failed: sessions.messages_backup".
110
- const s = store.create([{role: 'user', content: 'new'}], 'Fresh');
111
- expect(store.get(s.id)?.messages).toEqual([{role: 'user', content: 'new'}]);
112
-
113
- // The pre-existing session, its exploded rows and its audit blob all survive.
114
- expect(store.get('broken-1')?.title).toBe('Pre-existing');
115
- expect(store.get('broken-1')?.messages).toEqual([{role: 'user', content: 'old'}]);
116
- } finally {
117
- store.close();
118
- }
119
-
120
- // The audit blob is still physically present after the table rebuild.
121
- const raw = new Database(p, {readonly: true});
122
- const blob = raw.query('SELECT messages_backup b FROM sessions WHERE id = ?').get('broken-1') as {
123
- b: string | null;
124
- };
125
- raw.close();
126
- expect(blob.b).toBe('[{"role":"user","content":"old"}]');
127
-
128
- await cleanup('broken');
129
- });
130
-
131
- test('repair: a legacy v0 DB migrates all the way to a writable v2', async () => {
132
- const p = pathFor('legacy');
133
- await cleanup('legacy');
134
-
135
- const db = new Database(p);
136
- db.exec(`
137
- CREATE TABLE sessions (
138
- id TEXT PRIMARY KEY,
139
- title TEXT,
140
- messages TEXT NOT NULL,
141
- input_tokens INTEGER NOT NULL DEFAULT 0,
142
- output_tokens INTEGER NOT NULL DEFAULT 0,
143
- cached_tokens INTEGER NOT NULL DEFAULT 0,
144
- cost REAL NOT NULL DEFAULT 0,
145
- created_at INTEGER NOT NULL,
146
- updated_at INTEGER NOT NULL
147
- );
148
- `);
149
- db.run(
150
- 'INSERT INTO sessions (id, title, messages, created_at, updated_at) VALUES (?, ?, ?, ?, ?)',
151
- ['legacy-1', 'Legacy', '[{"role":"user","content":"hi"}]', 1000, 2000],
152
- );
153
- db.close();
154
-
155
- const store = new SessionStore({dbPath: p});
156
- store.init();
157
- try {
158
- // One pass takes v0 → v2, leaving the backend writable.
159
- expect(userVersion(p)).toBe(2);
160
- expect(backupNotNull(p)).toBe(0);
161
- expect(store.getMessages('legacy-1').length).toBe(1);
162
-
163
- const s = store.create([{role: 'user', content: 'post-migration'}]);
164
- expect(store.get(s.id)?.messages).toEqual([{role: 'user', content: 'post-migration'}]);
165
- } finally {
166
- store.close();
167
- }
168
-
169
- await cleanup('legacy');
170
- });
171
-
172
- test('repair: a fresh DB is written straight to v2 with no backup column', async () => {
173
- const p = pathFor('fresh');
174
- await cleanup('fresh');
175
-
176
- const store = new SessionStore({dbPath: p});
177
- store.init();
178
- try {
179
- expect(userVersion(p)).toBe(2);
180
- expect(backupNotNull(p)).toBe(undefined);
181
-
182
- const s = store.create([{role: 'user', content: 'hello'}]);
183
- expect(store.get(s.id)?.messages).toEqual([{role: 'user', content: 'hello'}]);
184
- } finally {
185
- store.close();
186
- }
187
-
188
- await cleanup('fresh');
189
- });
190
-
191
- test('repair: re-running init on a repaired DB is a no-op', async () => {
192
- const p = pathFor('idempotent');
193
- await cleanup('idempotent');
194
- seedBrokenV1(p);
195
-
196
- const store = new SessionStore({dbPath: p});
197
- store.init();
198
- try {
199
- const s = store.create([{role: 'user', content: 'one'}]);
200
- store.init(); // must not rebuild again or lose rows
201
- expect(store.get(s.id)?.messages).toEqual([{role: 'user', content: 'one'}]);
202
- expect(store.get('broken-1')?.title).toBe('Pre-existing');
203
- expect(store.get('broken-1')?.messages).toEqual([{role: 'user', content: 'old'}]);
204
- } finally {
205
- store.close();
206
- }
207
-
208
- await cleanup('idempotent');
209
- });
@@ -1,235 +0,0 @@
1
- import {test, expect} from 'bun:test';
2
- import {rm} from 'fs/promises';
3
- import {join} from 'path';
4
- import {SessionStore, deriveMessageMeta} from './store.js';
5
- import type {ConversationMessage as Message} from '../agent/run.js';
6
-
7
- const DB_PATH = join(import.meta.dir, '.test-sessions.db');
8
-
9
- test('SessionStore: create, get, list, update, delete round-trip', () => {
10
- const store = new SessionStore({dbPath: DB_PATH});
11
- store.init();
12
-
13
- try {
14
- const messages: Message[] = [
15
- {role: 'user', content: 'hello'},
16
- {role: 'assistant', content: 'hi there'},
17
- ];
18
-
19
- const created = store.create(messages, 'Round trip');
20
- expect(created.id).toBeTruthy();
21
- expect(created.title).toBe('Round trip');
22
- expect(created.compactedUptoSeq).toBe(0);
23
-
24
- const fetched = store.get(created.id);
25
- expect(fetched).not.toBeNull();
26
- expect(fetched?.messages).toEqual(messages);
27
- expect(fetched?.title).toBe('Round trip');
28
-
29
- const updatedMessages: Message[] = [...messages, {role: 'user', content: 'again'}];
30
- store.update(created.id, updatedMessages);
31
- const updated = store.get(created.id);
32
- expect(updated?.messages).toEqual(updatedMessages);
33
- expect(updated?.updatedAt ?? 0).toBeGreaterThanOrEqual(created.updatedAt);
34
-
35
- // update() must append only the delta — not duplicate existing rows.
36
- expect(store.getMessages(created.id).length).toBe(3);
37
-
38
- const list = store.list();
39
- expect(list.some((s) => s.id === created.id)).toBe(true);
40
- expect(list.find((s) => s.id === created.id)?.messages.length).toBe(3);
41
-
42
- store.delete(created.id);
43
- expect(store.get(created.id)).toBeNull();
44
- expect(store.getMessages(created.id)).toEqual([]);
45
- } finally {
46
- store.close();
47
- }
48
- });
49
-
50
- test('SessionStore: appendMessages allocates seq in order and increments', () => {
51
- const store = new SessionStore({dbPath: DB_PATH});
52
- store.init();
53
- try {
54
- const s = store.create([]);
55
- store.appendMessages(s.id, [
56
- {role: 'user', content: 'a'},
57
- {role: 'assistant', content: 'b'},
58
- ]);
59
- store.appendMessage(s.id, {role: 'user', content: 'c'});
60
-
61
- const rows = store.getMessages(s.id);
62
- expect(rows.map((r) => r.seq)).toEqual([1, 2, 3]);
63
- expect(rows.map((r) => r.content)).toEqual(['a', 'b', 'c']);
64
- expect(rows.map((r) => r.role)).toEqual(['user', 'assistant', 'user']);
65
- } finally {
66
- store.close();
67
- }
68
- });
69
-
70
- test('SessionStore: tool metadata round-trips', () => {
71
- const store = new SessionStore({dbPath: DB_PATH});
72
- store.init();
73
- try {
74
- const s = store.create([]);
75
- store.appendMessages(
76
- s.id,
77
- [
78
- {
79
- role: 'assistant',
80
- content: '',
81
- toolCalls: [{id: 'call_1', name: 'read_file', arguments: '{"path":"x"}'}],
82
- },
83
- {role: 'tool', tool_call_id: 'call_1', content: 'file contents'},
84
- ],
85
- [{agentRole: 'pal'}, {toolName: 'read_file', toolStatus: 'ok'}],
86
- );
87
-
88
- const rows = store.getMessages(s.id);
89
- expect(rows[0].toolCalls?.[0].name).toBe('read_file');
90
- expect(rows[0].meta.agentRole).toBe('pal');
91
- expect(rows[1].toolCallId).toBe('call_1');
92
- expect(rows[1].meta.toolName).toBe('read_file');
93
- expect(rows[1].meta.toolStatus).toBe('ok');
94
-
95
- // And the conversation shape survives the round trip.
96
- const reloaded = store.get(s.id)?.messages ?? [];
97
- expect(reloaded[0]).toEqual({
98
- role: 'assistant',
99
- content: '',
100
- toolCalls: [{id: 'call_1', name: 'read_file', arguments: '{"path":"x"}'}],
101
- });
102
- expect(reloaded[1]).toEqual({role: 'tool', tool_call_id: 'call_1', content: 'file contents'});
103
- } finally {
104
- store.close();
105
- }
106
- });
107
-
108
- test('SessionStore: recordCompaction raises the high-water mark and keeps messages', () => {
109
- const store = new SessionStore({dbPath: DB_PATH});
110
- store.init();
111
- try {
112
- const s = store.create([
113
- {role: 'user', content: 'one'},
114
- {role: 'assistant', content: 'two'},
115
- {role: 'user', content: 'three'},
116
- ]);
117
-
118
- store.recordCompaction(s.id, 1, 2, 'summary of first two');
119
- expect(store.getCompactedUpto(s.id)).toBe(2);
120
- expect(store.getLatestCompaction(s.id)?.summary).toBe('summary of first two');
121
-
122
- // Non-destructive: all three messages are still stored.
123
- expect(store.getMessages(s.id).length).toBe(3);
124
-
125
- // A later, higher compaction wins the mark.
126
- store.recordCompaction(s.id, 1, 3, 'summary of all three');
127
- expect(store.getCompactedUpto(s.id)).toBe(3);
128
- expect(store.getCompactions(s.id).length).toBe(2);
129
- expect(store.getLatestCompaction(s.id)?.toSeq).toBe(3);
130
-
131
- // A lower mark must never lower the high-water mark.
132
- store.recordCompaction(s.id, 1, 1, 'smaller');
133
- expect(store.getCompactedUpto(s.id)).toBe(3);
134
- } finally {
135
- store.close();
136
- }
137
- });
138
-
139
- test('SessionStore: deleteMessagesFrom removes a suffix and resets the mark', () => {
140
- const store = new SessionStore({dbPath: DB_PATH});
141
- store.init();
142
- try {
143
- const s = store.create([
144
- {role: 'user', content: 'one'},
145
- {role: 'assistant', content: 'two'},
146
- {role: 'user', content: 'three'},
147
- ]);
148
- store.recordCompaction(s.id, 1, 3, 'summary');
149
- expect(store.getCompactedUpto(s.id)).toBe(3);
150
-
151
- const removed = store.deleteMessagesFrom(s.id, 3);
152
- expect(removed).toBe(1);
153
- expect(store.getMessages(s.id).map((r) => r.content)).toEqual(['one', 'two']);
154
- // Mark overlapped the removed range, so it resets.
155
- expect(store.getCompactedUpto(s.id)).toBe(0);
156
- } finally {
157
- store.close();
158
- }
159
- });
160
-
161
- test('SessionStore: updateTitle persists without touching history', () => {
162
- const store = new SessionStore({dbPath: DB_PATH});
163
- store.init();
164
- try {
165
- const s = store.create([{role: 'user', content: 'hi'}]);
166
- store.updateTitle(s.id, 'A better title');
167
- expect(store.get(s.id)?.title).toBe('A better title');
168
- expect(store.getMessages(s.id).length).toBe(1);
169
- } finally {
170
- store.close();
171
- }
172
- });
173
-
174
- test('SessionStore: update derives tool metadata across batches', () => {
175
- const store = new SessionStore({dbPath: DB_PATH});
176
- store.init();
177
- try {
178
- // First turn: assistant requests a tool (stored in batch 1).
179
- const s = store.create([
180
- {role: 'user', content: 'read it'},
181
- {
182
- role: 'assistant',
183
- content: '',
184
- toolCalls: [{id: 'call_9', name: 'read_file', arguments: '{}'}],
185
- },
186
- ]);
187
- // Second turn: the tool result arrives in a later batch — its name must
188
- // still resolve from the earlier assistant message.
189
- store.update(s.id, [
190
- {role: 'user', content: 'read it'},
191
- {
192
- role: 'assistant',
193
- content: '',
194
- toolCalls: [{id: 'call_9', name: 'read_file', arguments: '{}'}],
195
- },
196
- {role: 'tool', tool_call_id: 'call_9', content: 'Error: file not found'},
197
- ]);
198
-
199
- const rows = store.getMessages(s.id);
200
- const tool = rows.find((r) => r.role === 'tool');
201
- expect(tool?.meta.toolName).toBe('read_file');
202
- expect(tool?.meta.toolStatus).toBe('error');
203
- } finally {
204
- store.close();
205
- }
206
- });
207
-
208
- test('deriveMessageMeta maps tool calls to results and flags errors', () => {
209
- const meta = deriveMessageMeta([
210
- {role: 'user', content: 'go'},
211
- {
212
- role: 'assistant',
213
- content: '',
214
- toolCalls: [
215
- {id: 'a', name: 'search', arguments: '{}'},
216
- {id: 'b', name: 'edit', arguments: '{}'},
217
- ],
218
- },
219
- {role: 'tool', tool_call_id: 'a', content: 'results here'},
220
- {role: 'tool', tool_call_id: 'b', content: 'Error: permission denied'},
221
- ]);
222
-
223
- expect(meta[0]).toEqual({});
224
- expect(meta[1]).toEqual({});
225
- expect(meta[2]).toEqual({toolName: 'search', toolStatus: 'ok'});
226
- expect(meta[3]).toEqual({toolName: 'edit', toolStatus: 'error'});
227
- });
228
-
229
- // Cleanup must run even if the test body throws.
230
- test('SessionStore cleanup', async () => {
231
- await rm(DB_PATH, {force: true});
232
- await rm(`${DB_PATH}-wal`, {force: true});
233
- await rm(`${DB_PATH}-shm`, {force: true});
234
- // The previous test closes its connection before this removes the file.
235
- });
@@ -1,122 +0,0 @@
1
- import {test, expect, mock} from 'bun:test';
2
- import {writeFile, rm} from 'fs/promises';
3
- import {join} from 'path';
4
- import {executeTool, regexFallback, convertPatternToRegex} from './executor.js';
5
-
6
- const FIXTURE = join(import.meta.dir, '.test-fixture.ts');
7
-
8
- // ── convertPatternToRegex: task-spec conversion examples ──
9
-
10
- test('convertPatternToRegex: console.log($A)', () => {
11
- expect(convertPatternToRegex('console.log($A)')).toBe('console\\.log\\((.+?)\\)');
12
- });
13
-
14
- test('convertPatternToRegex: function $NAME($$$)', () => {
15
- expect(convertPatternToRegex('function $NAME($$$)')).toBe('function\\s+\\w+\\(.*?\\)');
16
- });
17
-
18
- test('convertPatternToRegex: const $VAR = $EXPR', () => {
19
- expect(convertPatternToRegex('const $VAR = $EXPR')).toBe('const\\s+\\w+\\s*=\\s*.+');
20
- });
21
-
22
- test('convertPatternToRegex: unknown meta-variable returns null', () => {
23
- expect(convertPatternToRegex('foo($FOO)')).toBeNull();
24
- });
25
-
26
- // ── regexFallback: output format ──
27
-
28
- test('regexFallback: matches with line numbers and [regex fallback] prefix', () => {
29
- const content = ['const x = 1;', 'console.log(x);', 'console.log("hello");', 'const y = 2;'].join(
30
- '\n',
31
- );
32
- const result = regexFallback('console.log($A)', content, 'test.ts');
33
- expect(result).toContain('[regex fallback]');
34
- expect(result).toContain('Found 2 matches');
35
- expect(result).toContain('test.ts:');
36
- expect(result).toContain('Line 2:');
37
- expect(result).toContain('Line 3:');
38
- });
39
-
40
- test('regexFallback: function pattern matches multiple functions', () => {
41
- const content = 'function foo(a, b) {\n return a + b;\n}\nfunction bar() {}\n';
42
- const result = regexFallback('function $NAME($$$)', content, 'test.ts');
43
- expect(result).toContain('Found 2 matches');
44
- });
45
-
46
- test('regexFallback: const pattern', () => {
47
- const content = 'const foo = 42;\nlet bar = 1;\nconst baz = "x";\n';
48
- const result = regexFallback('const $VAR = $EXPR', content, 'test.ts');
49
- expect(result).toContain('Found 2 matches');
50
- });
51
-
52
- test('regexFallback: unconvertible pattern returns helpful error', () => {
53
- const result = regexFallback('foo($FOO)', 'const x = 1;', 'test.ts');
54
- expect(result).toContain('Could not convert pattern to regex');
55
- });
56
-
57
- test('regexFallback: no matches returns No matches found', () => {
58
- const result = regexFallback('console.log($A)', 'const x = 1;', 'test.ts');
59
- expect(result).toBe('No matches found.');
60
- });
61
-
62
- test('regexFallback: bare $$$ pattern does not hang (zero-length guard)', () => {
63
- const result = regexFallback('$$$', 'hello world', 'test.ts');
64
- expect(result).toContain('Found 1 match');
65
- });
66
-
67
- // ── ast_grep tool end-to-end ──
68
-
69
- test('ast_grep: uses AST-grep when @ast-grep/napi is available', async () => {
70
- await writeFile(FIXTURE, 'const x = 1;\nconsole.log(x);\n');
71
- try {
72
- const result = await executeTool(
73
- 'ast_grep',
74
- JSON.stringify({pattern: 'console.log($A)', path: FIXTURE}),
75
- 'call-1',
76
- );
77
- expect(result.error).toBeFalsy();
78
- expect(result.content).toContain('Found 1 match');
79
- expect(result.content).not.toContain('[regex fallback]');
80
- } finally {
81
- await rm(FIXTURE, {force: true});
82
- }
83
- });
84
-
85
- test('ast_grep: falls back to regex when @ast-grep/napi is unavailable', async () => {
86
- // Run in a subprocess: Bun.mock.module cannot override a module already
87
- // loaded in this process, and mocks leak across test files. A fresh
88
- // subprocess has a clean module cache, so the mock reliably intercepts
89
- // the dynamic import inside ast_grep.
90
- await writeFile(FIXTURE, 'const x = 1;\nconsole.log(x);\n');
91
- try {
92
- const script = `
93
- import {mock} from 'bun:test';
94
- mock.module('@ast-grep/napi', () => ({})); // broken native build: no API
95
- const {executeTool} = await import('./executor.js');
96
- const result = await executeTool(
97
- 'ast_grep',
98
- JSON.stringify({pattern: 'console.log($A)', path: ${JSON.stringify(FIXTURE)}}),
99
- 'call-2',
100
- );
101
- console.log(JSON.stringify(result));
102
- `;
103
- const proc = Bun.spawn(['bun', '-e', script], {
104
- cwd: import.meta.dir,
105
- stdout: 'pipe',
106
- stderr: 'pipe',
107
- });
108
- const [stdout, stderr] = await Promise.all([
109
- new Response(proc.stdout).text(),
110
- new Response(proc.stderr).text(),
111
- ]);
112
- await proc.exited;
113
- expect(proc.exitCode).toBe(0);
114
- const result = JSON.parse(stdout);
115
- expect(result.error).toBeFalsy();
116
- expect(result.content).toContain('[regex fallback]');
117
- expect(result.content).toContain('Found 1 match');
118
- expect(result.content).toContain('console.log(x)');
119
- } finally {
120
- await rm(FIXTURE, {force: true});
121
- }
122
- });
@@ -1,35 +0,0 @@
1
- /**
2
- * Single source of truth for versioning.
3
- * Reads version.json and updates all package.json files.
4
- * Usage: node scripts/sync-version.js
5
- */
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- const root = path.resolve(__dirname, '..');
10
- const { version } = JSON.parse(fs.readFileSync(path.join(root, 'version.json'), 'utf-8'));
11
-
12
- const targets = [
13
- 'package.json',
14
- 'packages/cli/package.json',
15
- 'packages/core/package.json',
16
- 'packages/agents/package.json',
17
- 'packages/mcp/package.json',
18
- 'packages/web-search/package.json',
19
- ];
20
-
21
- for (const rel of targets) {
22
- const file = path.join(root, rel);
23
- const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
24
- pkg.version = version;
25
-
26
- // Update @pal/core dependency in extensions
27
- if (pkg.dependencies && pkg.dependencies['@pal/core']) {
28
- pkg.dependencies['@pal/core'] = version;
29
- }
30
-
31
- fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + '\n');
32
- console.log(`${rel} → ${version}`);
33
- }
34
-
35
- console.log(`\nAll packages synced to v${version}`);