refactor(core): move shared runtime into workspace package
This commit is contained in:
+1
-1
@@ -51,7 +51,7 @@
|
||||
],
|
||||
"extraResources": [
|
||||
{
|
||||
"from": "../scripts/schema.sql",
|
||||
"from": "../packages/core/src/schema.sql",
|
||||
"to": "scripts/schema.sql"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@ import { writeHeartbeat } from './indexer.ts';
|
||||
import { createIndexerService } from './indexer-service.ts';
|
||||
import { createWorkerBuildIndex } from './indexer-worker-client.ts';
|
||||
import { buildRecapExportQuery } from './recap-capture-query.ts';
|
||||
import { acquireWriterLease, writerLockPathFor } from '../../../scripts/writer-lease.ts';
|
||||
import { acquireWriterLease, writerLockPathFor } from '../../../packages/core/src/writer-lease.ts';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import Database from 'better-sqlite3';
|
||||
import { parse as claudeParse } from '../../../scripts/providers/claude.ts';
|
||||
import { parse as codexParse } from '../../../scripts/providers/codex.ts';
|
||||
import { persist } from '../../../scripts/persist.ts';
|
||||
import { runWriteTransaction, configureConnection, betterSqliteTransactionAdapter } from '../../../scripts/tx.ts';
|
||||
import { acquireWriterLease, writerLockPathFor } from '../../../scripts/writer-lease.ts';
|
||||
import { runRetryableWriteTransaction, isBeginBusyFailure, hasUnusableTransaction } from '../../../scripts/write-coordinator.ts';
|
||||
import { parse as claudeParse } from '../../../packages/core/src/providers/claude.ts';
|
||||
import { parse as codexParse } from '../../../packages/core/src/providers/codex.ts';
|
||||
import { persist } from '../../../packages/core/src/persist.ts';
|
||||
import { runWriteTransaction, configureConnection, betterSqliteTransactionAdapter } from '../../../packages/core/src/tx.ts';
|
||||
import { acquireWriterLease, writerLockPathFor } from '../../../packages/core/src/writer-lease.ts';
|
||||
import { runRetryableWriteTransaction, isBeginBusyFailure, hasUnusableTransaction } from '../../../packages/core/src/write-coordinator.ts';
|
||||
import {
|
||||
inferProjectPath,
|
||||
isDir,
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
codexRawId,
|
||||
codexParentThreadId,
|
||||
readCodexGuardianThreadInfo,
|
||||
} from '../../../scripts/parsing.mjs';
|
||||
} from '../../../packages/core/src/parsing.mjs';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
|
||||
Generated
+11
@@ -8,6 +8,9 @@
|
||||
"name": "obelisk",
|
||||
"version": "0.1.0",
|
||||
"license": "AGPL-3.0",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@types/node": "^26.1.1",
|
||||
@@ -211,6 +214,10 @@
|
||||
"url": "https://github.com/sponsors/nzakas"
|
||||
}
|
||||
},
|
||||
"node_modules/@obelisk/core": {
|
||||
"resolved": "packages/core",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@types/esrecurse": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz",
|
||||
@@ -1275,6 +1282,10 @@
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"packages/core": {
|
||||
"name": "@obelisk/core",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -5,12 +5,15 @@
|
||||
"type": "module",
|
||||
"description": "Explicit memory infrastructure for coding agents — a queryable SQLite evidence layer over local Claude Code and Codex history, plus human-approved durable memory.",
|
||||
"license": "AGPL-3.0",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node --experimental-test-module-mocks --test tests/*.test.mjs",
|
||||
"typecheck": "tsc --noEmit && tsc --noEmit -p app/tsconfig.json",
|
||||
"lint": "eslint .",
|
||||
"build:core": "rm -rf dist && tsc -p tsconfig.build.json",
|
||||
"build:skill": "rm -rf dist/obelisk-skill && tsc -p tsconfig.skill.json && cp scripts/schema.sql dist/obelisk-skill/scripts/ && cp SKILL.md dist/obelisk-skill/ && cp -R references dist/obelisk-skill/references && cp packaging/skill-package.json dist/obelisk-skill/package.json",
|
||||
"build:core": "npm run build --workspace @obelisk/core",
|
||||
"build:skill": "rm -rf dist/obelisk-skill && tsc -p tsconfig.skill.json && cp packages/core/src/schema.sql dist/obelisk-skill/scripts/ && cp SKILL.md dist/obelisk-skill/ && cp -R references dist/obelisk-skill/references && cp packaging/skill-package.json dist/obelisk-skill/package.json",
|
||||
"publish:skill": "npm run build:skill && packaging/publish-skill.sh"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@obelisk/core",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Shared indexing and query core for Obelisk transports.",
|
||||
"exports": {
|
||||
".": "./dist/core.js",
|
||||
"./db": "./dist/db.js",
|
||||
"./indexer": "./dist/indexer.js",
|
||||
"./parsing": "./dist/parsing.js",
|
||||
"./persist": "./dist/persist.js",
|
||||
"./providers/claude": "./dist/providers/claude.js",
|
||||
"./providers/codex": "./dist/providers/codex.js",
|
||||
"./providers/types": "./dist/providers/types.js",
|
||||
"./query": "./dist/query.js",
|
||||
"./tx": "./dist/tx.js",
|
||||
"./write-coordinator": "./dist/write-coordinator.js",
|
||||
"./writer-lease": "./dist/writer-lease.js"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"src/schema.sql"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
||||
"typecheck": "tsc --noEmit -p tsconfig.json"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Obelisk Core (see docs/adr/0003-core-typescript-esm-precompiled.md).
|
||||
// Obelisk Core package (see docs/adr/0003-core-typescript-esm-precompiled.md).
|
||||
//
|
||||
// The single shared implementation behind every transport. runtime.mjs (skill),
|
||||
// and later the CLI and MCP server, are thin shells over these four functions;
|
||||
@@ -1,3 +1,4 @@
|
||||
// node:sqlite lifecycle and migrations for the Core package.
|
||||
import { createRequire } from 'node:module';
|
||||
import { CLAUDE_DIR, CODEX_DIR, TEXT_LIMIT, trunc, truncJson, extractText, extractContentType, extractMessageIsMeta, filePath, isDir, readLines } from './parsing.mjs';
|
||||
import { configureConnection } from './tx.ts';
|
||||
@@ -1,3 +1,4 @@
|
||||
// Passive-pull indexing orchestration for the Core package.
|
||||
import { DB_PATH, openDb, openReadDb, openWriterLeaseDb, rebuildMemoryFts } from './db.mjs';
|
||||
import {
|
||||
CLAUDE_DIR, CODEX_DIR, PROJECTS_DIR, fs, path, isDir, readLines,
|
||||
@@ -1,4 +1,4 @@
|
||||
// Pure parse/discover helpers — node:sqlite-free by construction, so the compiled
|
||||
// Core's pure parse/discover helpers — node:sqlite-free by construction, so the compiled
|
||||
// providers can be consumed by the app (better-sqlite3 / a Node without
|
||||
// node:sqlite). Moved verbatim from db.mjs and indexer.mjs (Phase 5d-1); they use
|
||||
// only node:fs/path/os. Kept as .mjs (plain ESM) for a low-risk verbatim move.
|
||||
@@ -1,4 +1,4 @@
|
||||
// Shared persist layer (see docs/adr/0001).
|
||||
// Shared Core persist layer (see docs/adr/0001).
|
||||
//
|
||||
// Provider-agnostic and binding-agnostic: it consumes the IndexRecord stream
|
||||
// from any adapter's parse() and writes rows into the injected database handle
|
||||
@@ -1,4 +1,4 @@
|
||||
// Claude Code provider adapter (see docs/adr/0001).
|
||||
// Claude Code provider adapter in Core (see docs/adr/0001).
|
||||
//
|
||||
// Pure: discovers Claude transcript files and parses one into a record stream.
|
||||
// It never touches the Obelisk database. The per-line logic mirrors the original
|
||||
@@ -1,4 +1,4 @@
|
||||
// Codex provider adapter (see docs/adr/0001).
|
||||
// Codex provider adapter in Core (see docs/adr/0001).
|
||||
//
|
||||
// Pure: discovers Codex rollout files and parses one into a record stream. It
|
||||
// never touches the Obelisk database. Unlike claude, codex is a FULL-REPARSE
|
||||
@@ -1,4 +1,4 @@
|
||||
// Phase 5 target contract (see docs/adr/0001).
|
||||
// Core provider contract (see docs/adr/0001).
|
||||
//
|
||||
// The indexing layer splits along two orthogonal axes:
|
||||
// - Provider axis: pure per-source adapters (claude, codex, later opencode,
|
||||
@@ -1,3 +1,4 @@
|
||||
// Query and attune sandbox helpers for the Core package.
|
||||
import { readLines, fs, path } from './db.mjs';
|
||||
|
||||
function normalizeOpts(optsOrScalar, scalarKey = 'sessionId') {
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// Skill transport: a thin CLI shell over Obelisk Core (scripts/core.ts).
|
||||
// Skill transport: a thin CLI shell over the Obelisk Core package.
|
||||
// It only parses args, reads script files, prints JSON, and owns the uniform
|
||||
// { error, stack } + exit-1 error envelope. All logic lives in Core.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
-- Shared Obelisk Core schema.
|
||||
CREATE TABLE IF NOT EXISTS sessions (
|
||||
id TEXT PRIMARY KEY, title TEXT, project TEXT, project_path TEXT,
|
||||
started_at TEXT, ended_at TEXT, git_branch TEXT, version TEXT,
|
||||
@@ -1,4 +1,4 @@
|
||||
// Binding-agnostic SQLite write plumbing shared by the skill and app indexers
|
||||
// Binding-agnostic SQLite write plumbing shared from the Core package
|
||||
// (docs/adr/0006). The injected db must expose `exec(sql)`; this works for both
|
||||
// node:sqlite (skill/CLI) and better-sqlite3 (app), same injection model as
|
||||
// `persist`.
|
||||
@@ -1,4 +1,4 @@
|
||||
// Bounded retry policy above the transaction primitive. Callers opt in only for
|
||||
// Core's bounded retry policy above the transaction primitive. Callers opt in only for
|
||||
// idempotent work; BEGIN contention and an uncertain/live transaction are never
|
||||
// retried here.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Cross-process single-writer lease for a complete Obelisk index build. The
|
||||
// Cross-process single-writer lease shared by every Obelisk mutation. The
|
||||
// lock lives in a dedicated SQLite database so node:sqlite and better-sqlite3
|
||||
// share identical locking semantics on every supported platform.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src",
|
||||
"declaration": true,
|
||||
"rewriteRelativeImportExtensions": true
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.mjs"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { acquireWriterLease } from '../scripts/writer-lease.ts';
|
||||
import { acquireWriterLease } from '../packages/core/src/writer-lease.ts';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { buildIndex } from '../app/src/main/indexer.ts';
|
||||
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');
|
||||
|
||||
@@ -8,7 +8,7 @@ import { mkdtempSync, writeFileSync, statSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { parse } from '../scripts/providers/claude.ts';
|
||||
import { parse } from '../packages/core/src/providers/claude.ts';
|
||||
|
||||
function writeFixture() {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'obelisk-claude-parse-'));
|
||||
|
||||
@@ -17,7 +17,7 @@ const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
function runRuntime(args, home) {
|
||||
return spawnSync(process.execPath, ['scripts/runtime.mjs', ...args], {
|
||||
return spawnSync(process.execPath, ['packages/core/src/runtime.mjs', ...args], {
|
||||
cwd: repoRoot, env: { ...process.env, HOME: home }, encoding: 'utf8',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { mkdtempSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { parse } from '../scripts/providers/codex.ts';
|
||||
import { parse } from '../packages/core/src/providers/codex.ts';
|
||||
|
||||
function writeFixture(lines) {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'obelisk-codex-parse-'));
|
||||
|
||||
@@ -23,11 +23,11 @@ import { readFileSync, writeFileSync, mkdtempSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { createQueryApi, createAttuneApi } from '../scripts/query.mjs';
|
||||
import { createQueryApi, createAttuneApi } from '../packages/core/src/query.mjs';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const SCHEMA = readFileSync(new URL('../scripts/schema.sql', import.meta.url), 'utf8');
|
||||
const SCHEMA = readFileSync(new URL('../packages/core/src/schema.sql', import.meta.url), 'utf8');
|
||||
const API_REFERENCE = readFileSync(new URL('../references/api-reference.md', import.meta.url), 'utf8');
|
||||
|
||||
// Every key asserted below is recorded here so the doc-sync guard can confirm
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -2,10 +2,10 @@ import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
|
||||
import { extractContentType, extractMessageIsMeta } from '../scripts/db.mjs';
|
||||
import { extractContentType, extractMessageIsMeta } from '../packages/core/src/db.mjs';
|
||||
|
||||
async function readExecutableSchema() {
|
||||
return readFile(new URL('../scripts/schema.sql', import.meta.url), 'utf8');
|
||||
return readFile(new URL('../packages/core/src/schema.sql', import.meta.url), 'utf8');
|
||||
}
|
||||
|
||||
async function readSchemaReference() {
|
||||
@@ -21,7 +21,7 @@ async function readSkill() {
|
||||
}
|
||||
|
||||
test('db module loads the executable schema from scripts/schema.sql', async () => {
|
||||
const source = await readFile(new URL('../scripts/db.mjs', import.meta.url), 'utf8');
|
||||
const source = await readFile(new URL('../packages/core/src/db.mjs', import.meta.url), 'utf8');
|
||||
|
||||
assert.match(source, /schema\.sql/);
|
||||
assert.doesNotMatch(source, /CREATE TABLE IF NOT EXISTS sessions/);
|
||||
|
||||
@@ -19,7 +19,7 @@ const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
function runRuntime(args, home) {
|
||||
return spawnSync(process.execPath, ['scripts/runtime.mjs', ...args], {
|
||||
return spawnSync(process.execPath, ['packages/core/src/runtime.mjs', ...args], {
|
||||
cwd: repoRoot, env: { ...process.env, HOME: home }, encoding: 'utf8',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ import { mkdtempSync, writeFileSync, readFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { parse } from '../scripts/providers/claude.ts';
|
||||
import { persist } from '../scripts/persist.ts';
|
||||
import { parse } from '../packages/core/src/providers/claude.ts';
|
||||
import { persist } from '../packages/core/src/persist.ts';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const SCHEMA = readFileSync(new URL('../scripts/schema.sql', import.meta.url), 'utf8');
|
||||
const SCHEMA = readFileSync(new URL('../packages/core/src/schema.sql', import.meta.url), 'utf8');
|
||||
|
||||
function fixtureUnit() {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'obelisk-drift-'));
|
||||
|
||||
@@ -2,7 +2,7 @@ import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
import { inferProjectPath, refreshSessionProjectPaths, shouldSkipBuild } from '../scripts/indexer.mjs';
|
||||
import { inferProjectPath, refreshSessionProjectPaths, shouldSkipBuild } from '../packages/core/src/indexer.mjs';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
@@ -9,12 +9,12 @@ import { mkdtempSync, writeFileSync, readFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { parse } from '../scripts/providers/claude.ts';
|
||||
import { persist } from '../scripts/persist.ts';
|
||||
import { parse } from '../packages/core/src/providers/claude.ts';
|
||||
import { persist } from '../packages/core/src/persist.ts';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const SCHEMA = readFileSync(new URL('../scripts/schema.sql', import.meta.url), 'utf8');
|
||||
const SCHEMA = readFileSync(new URL('../packages/core/src/schema.sql', import.meta.url), 'utf8');
|
||||
|
||||
function fixtureUnit() {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'obelisk-persist-'));
|
||||
|
||||
@@ -5,11 +5,11 @@ import { mkdtempSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { createQueryApi, createAttuneApi } from '../scripts/query.mjs';
|
||||
import { createQueryApi, createAttuneApi } from '../packages/core/src/query.mjs';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
const SCHEMA = readFileSync(new URL('../scripts/schema.sql', import.meta.url), 'utf8');
|
||||
const SCHEMA = readFileSync(new URL('../packages/core/src/schema.sql', import.meta.url), 'utf8');
|
||||
|
||||
function memoryDb({ projectPath = '/tmp/quiet-zero-test' } = {}) {
|
||||
const db = new DatabaseSync(':memory:');
|
||||
|
||||
@@ -23,7 +23,7 @@ import { spawnSync } from 'node:child_process';
|
||||
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
function runRuntime(args, { home }) {
|
||||
return spawnSync(process.execPath, ['scripts/runtime.mjs', ...args], {
|
||||
return spawnSync(process.execPath, ['packages/core/src/runtime.mjs', ...args], {
|
||||
cwd: repoRoot,
|
||||
env: { ...process.env, HOME: home },
|
||||
encoding: 'utf8',
|
||||
|
||||
@@ -12,7 +12,7 @@ const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
function runRuntime(args, { home }) {
|
||||
return spawnSync(process.execPath, ['scripts/runtime.mjs', ...args], {
|
||||
return spawnSync(process.execPath, ['packages/core/src/runtime.mjs', ...args], {
|
||||
cwd: repoRoot,
|
||||
env: { ...process.env, HOME: home },
|
||||
encoding: 'utf8',
|
||||
|
||||
@@ -5,8 +5,8 @@ import { mkdtempSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { nodeSqliteTransactionAdapter, runWriteTransaction } from '../scripts/tx.ts';
|
||||
import { hasUnusableTransaction, isBeginBusyFailure, isRetryableWriteFailure } from '../scripts/write-coordinator.ts';
|
||||
import { nodeSqliteTransactionAdapter, runWriteTransaction } from '../packages/core/src/tx.ts';
|
||||
import { hasUnusableTransaction, isBeginBusyFailure, isRetryableWriteFailure } from '../packages/core/src/write-coordinator.ts';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
@@ -5,7 +5,7 @@ import { mkdtempSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
|
||||
import { acquireWriterLease } from '../scripts/writer-lease.ts';
|
||||
import { acquireWriterLease } from '../packages/core/src/writer-lease.ts';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { DatabaseSync } = require('node:sqlite');
|
||||
|
||||
+1
-9
@@ -1,11 +1,3 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "dist",
|
||||
"rootDir": "scripts",
|
||||
"declaration": true,
|
||||
"rewriteRelativeImportExtensions": true
|
||||
},
|
||||
"include": ["scripts/providers/**/*.ts", "scripts/persist.ts"]
|
||||
"extends": "./packages/core/tsconfig.build.json"
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
"resolveJsonModule": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["scripts/**/*", "tests/**/*"],
|
||||
"include": ["packages/core/src/**/*", "tests/**/*"],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"app",
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
"compilerOptions": {
|
||||
"noEmit": false,
|
||||
"outDir": "dist/obelisk-skill/scripts",
|
||||
"rootDir": "scripts",
|
||||
"rootDir": "packages/core/src",
|
||||
"declaration": false,
|
||||
"rewriteRelativeImportExtensions": true
|
||||
},
|
||||
"include": ["scripts/**/*.ts", "scripts/**/*.mjs"]
|
||||
"include": ["packages/core/src/**/*.ts", "packages/core/src/**/*.mjs"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user