refactor(core): move shared runtime into workspace package

This commit is contained in:
tommy0103
2026-07-12 00:28:17 +08:00
parent 6edaf5231f
commit 83d5703f7b
42 changed files with 120 additions and 63 deletions
+5 -5
View File
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { spawnSync } from 'node:child_process';
import { acquireWriterLease, writerLockPathFor } from '../scripts/writer-lease.ts';
import { acquireWriterLease, writerLockPathFor } from '../packages/core/src/writer-lease.ts';
const require = createRequire(import.meta.url);
const { DatabaseSync } = require('node:sqlite');
@@ -27,7 +27,7 @@ test('a passive query does not mutate the index while a fresh daemon owns writes
const queryPath = join(home, 'query.mjs');
writeFileSync(queryPath, "return 'read-only';");
const result = spawnSync(process.execPath, ['scripts/runtime.mjs', '--query', queryPath], {
const result = spawnSync(process.execPath, ['packages/core/src/runtime.mjs', '--query', queryPath], {
cwd: repoRoot,
env: { ...process.env, HOME: home },
encoding: 'utf8',
@@ -55,7 +55,7 @@ test('attune refuses to mutate the index while a fresh daemon owns writes', () =
const attunePath = join(home, 'attune.mjs');
writeFileSync(attunePath, 'return true;');
const result = spawnSync(process.execPath, ['scripts/runtime.mjs', '--attune', attunePath], {
const result = spawnSync(process.execPath, ['packages/core/src/runtime.mjs', '--attune', attunePath], {
cwd: repoRoot,
env: { ...process.env, HOME: home },
encoding: 'utf8',
@@ -86,7 +86,7 @@ test('a passive query stays read-only when another process holds the writer leas
try {
const queryPath = join(home, 'query.mjs');
writeFileSync(queryPath, "return 'writer-busy';");
const result = spawnSync(process.execPath, ['scripts/runtime.mjs', '--query', queryPath], {
const result = spawnSync(process.execPath, ['packages/core/src/runtime.mjs', '--query', queryPath], {
cwd: repoRoot,
env: { ...process.env, HOME: home },
encoding: 'utf8',
@@ -120,7 +120,7 @@ test('a passive query fails closed when daemon ownership cannot be read', () =>
try {
const queryPath = join(home, 'query.mjs');
writeFileSync(queryPath, "return 'ownership-unknown';");
const result = spawnSync(process.execPath, ['scripts/runtime.mjs', '--query', queryPath], {
const result = spawnSync(process.execPath, ['packages/core/src/runtime.mjs', '--query', queryPath], {
cwd: repoRoot,
env: { ...process.env, HOME: home },
encoding: 'utf8',