chore: remove the packages excluded from the community edition (P2.2)

Delete apps/www, packages/admin-web, every packages/hive-mind-* package,
packages/memory-mcp and packages/wiki-compiler (ADR-0002), with what
existed only for them: their tests kept outside the packages, the hook
runtime build, the hive-mind OSS subtree-split and drift scripts, the
www deploy and hive-mind-cli workflows, the staged hook lifecycle step
in the Windows desktop workflows, and the root dev:www, build:www and
build:hook-runtime scripts.

Drop the matching excludes from the Vitest, ESLint and workspace
dependency checks, the next override, and the extraneous workspace
entries from package-lock.json. The smart-router qualification seed
now writes its spend to waggle.db, where the sidecar has read cost
traces since P1.5.
This commit is contained in:
shumeiko.it
2026-11-01 00:21:10 +01:00
parent a8250cb375
commit 46687a823a
601 changed files with 131 additions and 93709 deletions

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env node
/** Build the npm-free hook, memory MCP, and collaboration CLI payload staged into Tauri. */
import fs from 'node:fs';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const tsc = path.join(root, 'node_modules', 'typescript', 'bin', 'tsc');
const projects = [
'packages/shared/tsconfig.json',
'packages/hive-mind-core/tsconfig.json',
'packages/core/tsconfig.json',
'packages/wiki-compiler/tsconfig.json',
'packages/hive-mind-cli/tsconfig.json',
'packages/hive-mind-hooks-claude-code/tsconfig.json',
'packages/hive-mind-hooks-claude-desktop/tsconfig.json',
'packages/hive-mind-hooks-codex/tsconfig.json',
'packages/hive-mind-hooks-codex-desktop/tsconfig.json',
'packages/hive-mind-hooks-cursor/tsconfig.json',
'packages/hive-mind-hooks-hermes/tsconfig.json',
'packages/hive-mind-hooks-openclaw/tsconfig.json',
'packages/memory-mcp/tsconfig.json',
];
if (!fs.existsSync(tsc)) {
console.error('[build-hook-runtime] FATAL - TypeScript is not installed; run npm install first.');
process.exit(1);
}
console.log('[build-hook-runtime] Building CLI, seven hook adapters, and memory MCP...');
execFileSync(process.execPath, [tsc, '--build', ...projects], {
cwd: root,
stdio: 'inherit',
});
execFileSync(process.execPath, [
path.join(root, 'packages/hive-mind-hooks-openclaw/scripts/build-handler.mjs'),
], {
cwd: root,
stdio: 'inherit',
});
const expected = [
'packages/hive-mind-cli/dist/index.js',
'packages/hive-mind-hooks-claude-code/dist/bin/claude-code-hooks-cli.js',
'packages/hive-mind-hooks-claude-desktop/dist/bin/claude-desktop-hooks.js',
'packages/hive-mind-hooks-codex/dist/bin/codex-hooks.js',
'packages/hive-mind-hooks-codex-desktop/dist/bin/codex-desktop-hooks.js',
'packages/hive-mind-hooks-cursor/dist/bin/cursor-hooks.js',
'packages/hive-mind-hooks-hermes/dist/bin/hermes-hooks.js',
'packages/hive-mind-hooks-openclaw/dist/bin/openclaw-hooks.js',
'packages/hive-mind-hooks-openclaw/dist/handler.bundle.cjs',
'packages/memory-mcp/dist/index.js',
];
const missing = expected.filter((entry) => !fs.existsSync(path.join(root, entry)));
if (missing.length > 0) {
console.error('[build-hook-runtime] FATAL - build did not produce:');
for (const entry of missing) console.error(` - ${entry}`);
process.exit(1);
}
console.log(`[build-hook-runtime] OK - ${expected.length} runtime entries built`);

View File

@@ -17,15 +17,6 @@ import { builtinModules } from 'node:module';
const ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..');
// Packages leaving the community edition are not checked (AGENTS.md, section 2).
const EXCLUDED = new Set([
'apps/www',
'packages/admin-web',
'packages/memory-mcp',
'packages/wiki-compiler',
]);
const EXCLUDED_PREFIX = 'packages/hive-mind-';
// Known undeclared imports that a work package removes. Each entry needs a reason.
const PENDING = {};
@@ -39,7 +30,6 @@ function workspaceDirs() {
for (const parent of ['apps', 'packages']) {
for (const name of fs.readdirSync(path.join(ROOT, parent))) {
const rel = `${parent}/${name}`;
if (EXCLUDED.has(rel) || rel.startsWith(EXCLUDED_PREFIX)) continue;
if (fs.existsSync(path.join(ROOT, rel, 'package.json'))) dirs.push(rel);
}
}

View File

@@ -1,309 +0,0 @@
{
"schemaVersion": 1,
"mapping": {
"canonical": "packages/hive-mind-core/src",
"oss": "packages/core/src",
"ignoredDirectories": [
"dist",
"node_modules"
],
"ignoredFileSuffixes": [
".test.ts",
".tsbuildinfo"
]
},
"parityPaths": [
{
"path": "harvest/claude-code-adapter.ts",
"sha256": "13d4c7965b35c6cc66f53445ed752121cbba1b8b8ab80d196f3357977acc8d03"
},
{
"path": "harvest/decision-derivation.ts",
"sha256": "97e026befe980c4f754db5639fd96b715f09c351316f87a41e69899839d55f52"
},
{
"path": "harvest/stable-id.ts",
"sha256": "b1d8568bf3799f5054b6f2fc4119db4c8f67a0a49b22ff0b818a95c17a2eba56"
},
{
"path": "mind/erasure.ts",
"sha256": "6d5958c1b8e73a774324e1a4ca0348160b4abf3ff338d3cd794ef024d5ec5c5a"
},
{
"path": "mind/inprocess-reranker.ts",
"sha256": "0ed4a70147e0f7a17fdd14c3cc1127979bd653e3786a1a70189a5ab0996ec9f9"
}
],
"intentionalAdaptations": [
{
"path": "harvest/chatgpt-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "24603b8ecb18f795c5cbbbe483113dbb24f08fab6b1bce2fb19ee7127f8957d0",
"ossSha256": "97b4aec1356a98f9ba72ed373954934a657db4579cc67906b7fa9ee52a458c1a"
},
{
"path": "harvest/chunk-utils.ts",
"kinds": ["import", "layout"],
"canonicalSha256": "868f8ede1f2201d214a012d9cc9c7157a9418205d8bb2eff8ed872d4658f6c6e",
"ossSha256": "88d2bf92cae38cc975baff5eb75c5cab89cb6bda2262ec7c381635589b10ea18"
},
{
"path": "harvest/claude-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "3a22d18cf1ef2b12fa8689bd0909c2b34abfae3a9918c5ef8ca9a8cbfba8a522",
"ossSha256": "6dad506184e24ba98969fcb0a5885468167fd98da80fd29363ca131a7c7a46e1"
},
{
"path": "harvest/extract-memory-lanes.ts",
"kinds": ["import"],
"canonicalSha256": "800daac77c81e9daa3ecc0a8efa1f7203f6f41b64ad931e66cb97bc899d5d46d",
"ossSha256": "58e36562dfebd95cc1c2243746fcb2e755184fc7e2a5a05f334da2b6200855c1"
},
{
"path": "harvest/gemini-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "e68a34a62653f5387ae204eaa92b8bc861fc11d5b449db1eaa3f08573b95680c",
"ossSha256": "c4346791f439c34514b93dd9eef905bda72b255665b97fc14d60469338c32dda"
},
{
"path": "harvest/index.ts",
"kinds": ["import", "layout"],
"canonicalSha256": "9f7bfdc50c031866071ec998b5eca65ec6ded832fb9ff07bbb654e2ea5b68820",
"ossSha256": "fda20a50ba0247808c245397d65e2858b50924cffc6c140668854c70496e580c"
},
{
"path": "harvest/markdown-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "651c7cb76c9634896d69978f3537b74ca7f7fdd14aefe36e1c769aafbcab4e95",
"ossSha256": "77f495fcdbca87e90acf791d8c3c0e18021b2fec4dee5c5a827bd2b465b63b9d"
},
{
"path": "harvest/pdf-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "b6be7a2017d96e92eb20f9bffa949a8c433633b9ed9d4e741db089bb9588d07f",
"ossSha256": "2896d0425781152eafbd5bc7a3076ca95f587e896ab0f9dea69afe99f6baf094"
},
{
"path": "harvest/perplexity-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "95b54dac195949f2b53c21f908f1f0fc04564b55eac892ce757e81d53f0793cd",
"ossSha256": "20d7366d9848916994ac9f834ee3cd03700fde671c632ba5564a7122c8195454"
},
{
"path": "harvest/plaintext-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "14fa80a29642a448391a529a5a8dd0b33460c09e0223b984bb293ec73ede10d0",
"ossSha256": "1e24105088181c46302718b886fe9a4400ce05a9e8a64345c7b6bc78b222bcd1"
},
{
"path": "harvest/prompts.ts",
"kinds": ["branding"],
"canonicalSha256": "c672d702e335af33c6674f4b7b2c3536541fe1f5482b49660d4412d99620baca",
"ossSha256": "2730b9cfdfc5fcf3940d7a43b86f3ebce0e53e4ed1127fd665c137434e9e83ac"
},
{
"path": "harvest/raw-types.ts",
"kinds": ["import", "layout"],
"canonicalSha256": "2a10f0374d91c4f6e3f87c0fd77fc9ade24a669f7d08f2b283c653ca114284c1",
"ossSha256": "1bf0a4c45090466589a8b49694fb182deb6ab7e8442b61eb65cb3387bd62f0aa"
},
{
"path": "harvest/run-store.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "3ea55f2884ad8cfa40aaeeb7398f5a962dbe29436396696ba9776038fe5c8ab5",
"ossSha256": "956c976f0113c26f1b5c6e9826d96b72203b3b6468f926d6af768342d5cebadc"
},
{
"path": "harvest/source-store.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "5f82788d632dfb85c243313e074a280bd7a49564ec525c9ad90496d12d1fb54d",
"ossSha256": "97d12f2c48564c748c394d09343a160c2e526a36830562139fb0cc579d020cc0"
},
{
"path": "harvest/types.ts",
"kinds": ["import", "layout"],
"canonicalSha256": "16f4757b7049617425e753ba4c14eb54c63ef113e4aaa23990ee6cf2188053ad",
"ossSha256": "2eda81e6277c61a8920f60ce1815785de5521f27915f8704577c771b1135a0b7"
},
{
"path": "harvest/universal-adapter.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "a39368bc35d242ec6693b0c4964bac0dcdff80b9f659dccbbd5d18e99a894b32",
"ossSha256": "a9dfefd30d367f6d5618baeb1687a2b93074104d907719cae426f9fb1162de2b"
},
{
"path": "harvest/url-egress-guard.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "4940b28d7ea06e460ad97a522214fac27a803e691b4fbfe110bf97e8dfd98ce5",
"ossSha256": "eacc5e69ee71b2000e7bf26a8ac2c9e64f15db884978789e24d708aeacc74668"
},
{
"path": "injection-scanner.ts",
"kinds": ["layout"],
"canonicalSha256": "a1b5db9afc71873262df1db9ae89d0821c4122e1f38d982ef048f3080db51adf",
"ossSha256": "beede3f82c66106367a2ae58f3bcfdec4884c5b9fb2b792ea08b88cd7284d9d1"
},
{
"path": "logger.ts",
"kinds": ["branding", "logger"],
"canonicalSha256": "cca0f01bd7bfaeea7166b4d51ad677320c241f68024885bc688f5d31307b12fe",
"ossSha256": "0ce6746ba197b80a067a10388764568bf97477766e924266ee4a48ca6d01a888"
},
{
"path": "memory-ingress-guard.ts",
"kinds": ["import"],
"canonicalSha256": "5c795775b580d20343471067d060192e5065787f35602713563512b2fde06007",
"ossSha256": "a00b66a3814aea50d6926b55996af883f06ee561760d463085847669183b98de"
},
{
"path": "mind/api-embedder.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "16ad89d908dc3810e793d838c6ab8448394a6f7145dde374cd20980b72eb216d",
"ossSha256": "9ab9c766e138cf19a9a78a9e8a6f6b42e9f62048371b07a5123e4c0388f79c27"
},
{
"path": "mind/awareness.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "bdc30923a6c753a7749850c9ab436dda111a816d18028c4274521ad08484cf36",
"ossSha256": "13fb221475e76fea2fe6ece872a3e34eb3c7bbe3c67d6d2215304878a9ac74b2"
},
{
"path": "mind/chunker.ts",
"kinds": ["import"],
"canonicalSha256": "f6121b2b1db5a1b5dcce39a909692dc96a997a95331cad1b6d2f3cc49d3d4bbd",
"ossSha256": "e5166ce85e1c93fa155e1e9bda636ecc50b56fa41b3f059186520f71fb8302f3"
},
{
"path": "mind/concept-tracker.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "779ab17aad0d3751ea40d8eb558a63a7e36031b3fa97cd29fe211d2551965c51",
"ossSha256": "0aba6c53edd4e7357081e1722e08005f328ecbaa8e69add9efb8bf7c76d055a5"
},
{
"path": "mind/content-hash.ts",
"kinds": ["import"],
"canonicalSha256": "354a9648d480dea048dcd78ca784a56efcc417c7574e1fbea779d3df95da074f",
"ossSha256": "e1d34ca9b3cd1ce0351509ab04fdb4a6d96b78f96005b2ca23229b5bcee40bfc"
},
{
"path": "mind/embeddings.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "74ce421fc82964ca8928d40be6cfb91370445692b49758601b3a5057d586a218",
"ossSha256": "827a9ec88ef33c7ff5838b9b9ac00fae0d12e0c16d0d2061415e6cbf9520fae1"
},
{
"path": "mind/entity-normalizer.ts",
"kinds": ["import"],
"canonicalSha256": "936ecb94d368fa1f010a047c3205f09331cfdd77111493af37909b0ae1cce1a2",
"ossSha256": "ea4ef0ecb8879eca6241a48a92c0e209fd00a64ef0325ee12ef480195021c695"
},
{
"path": "mind/fts-sanitize.ts",
"kinds": ["import"],
"canonicalSha256": "4affefd57348f58ef9a0de915e43548c9b13ebb3976b74b60b281798eedaae4e",
"ossSha256": "cb24324005ae69d35af69325c545555a2e79d0d71ed5695e7e71a12963ff4b48"
},
{
"path": "mind/litellm-embedder.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "87e1da22f2e0047d2f9b754f5faf353c04654a12392fe1c2dca2ced12a84d712",
"ossSha256": "4f2d43f1a17961e8f94bff3a06b3008cd3b69a0807e03232fb96fe386308c1a4"
},
{
"path": "mind/ollama-embedder.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "9fef2d801ab2c6918d0c352fa3b1fcc77f1a1c77070cd166f785d13ccfd4fe30",
"ossSha256": "1f2f543ed5d8f97a841bae27dc436f11f21d3dbd55473f303f5ef8f20bb4341a"
},
{
"path": "mind/ontology.ts",
"kinds": ["import"],
"canonicalSha256": "2c301a0ed4b5aecb470e33e8eba34f03ab985a9d4431e6a5ab5cbc36e3b222a0",
"ossSha256": "859ead772389e5854ca1c5681b36ef2f551e3d2bf8f8d9247823eaee68fe8666"
},
{
"path": "mind/parse-date-window.ts",
"kinds": ["import"],
"canonicalSha256": "4ba482d24958a4188f0e3ba0871f8d8199dc37b2999aa42010bac0631fe89365",
"ossSha256": "de0a8e7f59072031d4ff916f8b10c7451ee8607e0351ddf385e687b13633b252"
},
{
"path": "mind/recall-context.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "56f291422e5f4d22c5d0eb5b5dc3a65bf814146963677d63e6378f070da5bcf3",
"ossSha256": "30529798ae7669d16a24765689d4f4b24287b8fdb0fa94a87adc19acc99fe5a8"
},
{
"path": "mind/reconcile.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "3defdff6d3d5c831297c54143e525cf2f9539e9726a66f5288c1ea288c54e384",
"ossSha256": "6fd2b97b9a18d791dd89c71bd7c155be0719982cd7ee2110ebf1644cea7e5b87"
},
{
"path": "mind/resolve-relative-date.ts",
"kinds": ["import"],
"canonicalSha256": "bc2d8ec1baa95b12b4a374e6dce851e7290042ebcb27d22389098f0f4a624adc",
"ossSha256": "6afaee5857dc533b0a6730d6acd6fd4530291322db5e19c6bd9782cc5aad40f5"
},
{
"path": "mind/scoring.ts",
"kinds": ["import"],
"canonicalSha256": "8bcc3225c3aba5a9ef98d6db10206b0761c4e06ac94e3644f4881f8b80c4a017",
"ossSha256": "6660a2ba157b6e84561222b24ade3bcd68202e722b4a3ce6d9d716f9eba13f98"
},
{
"path": "mind/sessions.ts",
"kinds": ["import", "logger"],
"canonicalSha256": "4fc4ad9be81016310ce89ef142ed5cd7d7a99224750fb7a664ad2fd7ffe514ab",
"ossSha256": "94d56a29840bb317b5391bca8782c6901b88dbf7aafff6bac3f051242e0d8343"
},
{
"path": "mind/transformers-model-load.ts",
"kinds": ["branding", "import", "logger"],
"canonicalSha256": "43c13897de7ea8eb5ce27d89f9e5a50e58afb6aa47b266efbc2b0517d8920e92",
"ossSha256": "3df62eed18a28d0863ae667ea7d79d687e8809114250bd17dfd337972f3d113d"
}
],
"knownReviewedBlockers": [
{ "path": "harvest/dedup.ts", "state": "different", "disposition": "reconcile" },
{ "path": "harvest/extract-kg-entities.ts", "state": "only-canonical", "disposition": "reconcile" },
{ "path": "harvest/pipeline.ts", "state": "different", "disposition": "reconcile" },
{ "path": "harvest/url-adapter.ts", "state": "different", "disposition": "reconcile" },
{ "path": "hook-runtime.ts", "state": "only-canonical", "disposition": "product-curation" },
{ "path": "index.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/db.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/embedding-provider.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/frames.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/identity.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/inprocess-embedder.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/knowledge.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/llm-extractor.ts", "state": "only-oss", "disposition": "reconcile" },
{ "path": "mind/raw-archive.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/raw-detail-lane.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/schema.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/search.ts", "state": "different", "disposition": "reconcile" },
{ "path": "mind/supersede.ts", "state": "only-canonical", "disposition": "product-curation" },
{ "path": "mind/suppression.ts", "state": "different", "disposition": "reconcile" },
{ "path": "multi-mind-cache.ts", "state": "different", "disposition": "reconcile" },
{ "path": "multi-mind.ts", "state": "only-canonical", "disposition": "product-curation" },
{ "path": "workspace-manager.ts", "state": "different", "disposition": "reconcile" }
],
"unreviewedDifferences": [
{ "path": "harvest/raw-turns.ts", "state": "different" }
],
"forbiddenExports": {
"paths": [
"mind/evolution-runs.ts",
"mind/execution-traces.ts",
"mind/improvement-signals.ts"
],
"pathPrefixes": [
"vault.ts",
"compliance/"
],
"markers": [
{ "path": "mind/db.ts", "token": "install_audit" },
{ "path": "mind/schema.ts", "token": "install_audit" }
]
}
}

View File

@@ -1,566 +0,0 @@
#!/usr/bin/env node
import { execFileSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import {
lstatSync,
readFileSync,
readdirSync,
realpathSync,
} from 'node:fs';
import { dirname, isAbsolute, join, posix, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
const BASELINE_PATH = join(SCRIPT_DIR, 'oss-drift-baseline.json');
const MAPPING = Object.freeze({
canonical: 'packages/hive-mind-core/src',
oss: 'packages/core/src',
ignoredDirectories: ['dist', 'node_modules'],
ignoredFileSuffixes: ['.test.ts', '.tsbuildinfo'],
});
const FORBIDDEN_EXPORTS = Object.freeze({
paths: [
'mind/evolution-runs.ts',
'mind/execution-traces.ts',
'mind/improvement-signals.ts',
],
pathPrefixes: ['vault.ts', 'compliance/'],
markers: [
{ path: 'mind/db.ts', token: 'install_audit' },
{ path: 'mind/schema.ts', token: 'install_audit' },
],
});
const VALID_ADAPTATION_KINDS = new Set(['branding', 'import', 'layout', 'logger']);
const VALID_STATES = new Set(['different', 'only-canonical', 'only-oss']);
const VALID_DISPOSITIONS = new Set([
'forward-port',
'product-curation',
'reconcile',
'reverse-port',
]);
const HASH_PATTERN = /^[a-f0-9]{64}$/;
const decoder = new TextDecoder('utf-8', { fatal: true });
class ConfigurationError extends Error {}
function compareOrdinal(left, right) {
return left < right ? -1 : left > right ? 1 : 0;
}
function assertRecord(value, label) {
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
throw new ConfigurationError(`${label} must be an object`);
}
}
function assertExactKeys(value, expected, label) {
assertRecord(value, label);
const actual = Object.keys(value).sort(compareOrdinal);
const wanted = [...expected].sort(compareOrdinal);
if (JSON.stringify(actual) !== JSON.stringify(wanted)) {
throw new ConfigurationError(
`${label} has unexpected keys: expected ${wanted.join(', ')}, got ${actual.join(', ')}`,
);
}
}
function assertExactArray(actual, expected, label) {
if (!Array.isArray(actual) || JSON.stringify(actual) !== JSON.stringify(expected)) {
throw new ConfigurationError(`${label} does not match the hardcoded publication policy`);
}
}
function assertCanonicalPath(value, label) {
if (
typeof value !== 'string' ||
value.length === 0 ||
value.includes('\\') ||
isAbsolute(value) ||
value.startsWith('/') ||
value.split('/').some((segment) => segment === '' || segment === '.' || segment === '..') ||
posix.normalize(value) !== value
) {
throw new ConfigurationError(`${label} must be a canonical repository-relative path`);
}
}
function assertSortedUnique(values, label, pathSelector = (value) => value) {
if (!Array.isArray(values)) {
throw new ConfigurationError(`${label} must be an array`);
}
const paths = values.map(pathSelector);
const expected = [...new Set(paths)].sort(compareOrdinal);
if (JSON.stringify(paths) !== JSON.stringify(expected)) {
throw new ConfigurationError(`${label} must be sorted by path and contain no duplicates`);
}
}
function loadBaseline() {
let baseline;
try {
baseline = JSON.parse(readFileSync(BASELINE_PATH, 'utf-8'));
} catch (error) {
throw new ConfigurationError(`cannot read baseline ${BASELINE_PATH}: ${error.message}`);
}
assertExactKeys(
baseline,
[
'schemaVersion',
'mapping',
'parityPaths',
'intentionalAdaptations',
'knownReviewedBlockers',
'unreviewedDifferences',
'forbiddenExports',
],
'baseline',
);
if (baseline.schemaVersion !== 1) {
throw new ConfigurationError('baseline.schemaVersion must be 1');
}
assertExactKeys(
baseline.mapping,
['canonical', 'oss', 'ignoredDirectories', 'ignoredFileSuffixes'],
'baseline.mapping',
);
for (const key of Object.keys(MAPPING)) {
const expected = MAPPING[key];
if (Array.isArray(expected)) {
assertExactArray(baseline.mapping[key], expected, `baseline.mapping.${key}`);
} else if (baseline.mapping[key] !== expected) {
throw new ConfigurationError(`baseline.mapping.${key} does not match the hardcoded mapping`);
}
}
assertExactKeys(
baseline.forbiddenExports,
['paths', 'pathPrefixes', 'markers'],
'baseline.forbiddenExports',
);
assertExactArray(
baseline.forbiddenExports.paths,
FORBIDDEN_EXPORTS.paths,
'baseline.forbiddenExports.paths',
);
assertExactArray(
baseline.forbiddenExports.pathPrefixes,
FORBIDDEN_EXPORTS.pathPrefixes,
'baseline.forbiddenExports.pathPrefixes',
);
assertExactArray(
baseline.forbiddenExports.markers,
FORBIDDEN_EXPORTS.markers,
'baseline.forbiddenExports.markers',
);
assertSortedUnique(baseline.parityPaths, 'baseline.parityPaths', (entry) => entry?.path);
for (const [index, entry] of baseline.parityPaths.entries()) {
const label = `baseline.parityPaths[${index}]`;
assertExactKeys(entry, ['path', 'sha256'], label);
assertCanonicalPath(entry.path, `${label}.path`);
if (!HASH_PATTERN.test(entry.sha256)) {
throw new ConfigurationError(`${label}.sha256 must be a lowercase SHA-256 hash`);
}
}
assertSortedUnique(
baseline.intentionalAdaptations,
'baseline.intentionalAdaptations',
(entry) => entry?.path,
);
for (const [index, entry] of baseline.intentionalAdaptations.entries()) {
const label = `baseline.intentionalAdaptations[${index}]`;
assertExactKeys(entry, ['path', 'kinds', 'canonicalSha256', 'ossSha256'], label);
assertCanonicalPath(entry.path, `${label}.path`);
assertSortedUnique(entry.kinds, `${label}.kinds`);
if (entry.kinds.length === 0 || entry.kinds.some((kind) => !VALID_ADAPTATION_KINDS.has(kind))) {
throw new ConfigurationError(`${label}.kinds contains an unsupported adaptation kind`);
}
if (!HASH_PATTERN.test(entry.canonicalSha256) || !HASH_PATTERN.test(entry.ossSha256)) {
throw new ConfigurationError(`${label} must contain lowercase SHA-256 hashes`);
}
if (entry.canonicalSha256 === entry.ossSha256) {
throw new ConfigurationError(`${label} must describe an actual adaptation, not parity`);
}
}
assertSortedUnique(
baseline.knownReviewedBlockers,
'baseline.knownReviewedBlockers',
(entry) => entry?.path,
);
for (const [index, entry] of baseline.knownReviewedBlockers.entries()) {
const label = `baseline.knownReviewedBlockers[${index}]`;
assertExactKeys(entry, ['path', 'state', 'disposition'], label);
assertCanonicalPath(entry.path, `${label}.path`);
if (!VALID_STATES.has(entry.state)) {
throw new ConfigurationError(`${label}.state is unsupported`);
}
if (!VALID_DISPOSITIONS.has(entry.disposition)) {
throw new ConfigurationError(`${label}.disposition is unsupported`);
}
}
assertSortedUnique(
baseline.unreviewedDifferences,
'baseline.unreviewedDifferences',
(entry) => entry?.path,
);
for (const [index, entry] of baseline.unreviewedDifferences.entries()) {
const label = `baseline.unreviewedDifferences[${index}]`;
assertExactKeys(entry, ['path', 'state'], label);
assertCanonicalPath(entry.path, `${label}.path`);
if (!VALID_STATES.has(entry.state)) {
throw new ConfigurationError(`${label}.state is unsupported`);
}
}
const classified = [
...baseline.parityPaths.map((entry) => entry.path),
...baseline.intentionalAdaptations.map((entry) => entry.path),
...baseline.knownReviewedBlockers.map((entry) => entry.path),
...baseline.unreviewedDifferences.map((entry) => entry.path),
];
const duplicate = classified.find((path, index) => classified.indexOf(path) !== index);
if (duplicate) {
throw new ConfigurationError(`baseline classifies ${duplicate} more than once`);
}
const privateCategory = classified.find((path) => isPrivateExclusion(path));
if (privateCategory) {
throw new ConfigurationError(`baseline must not reclassify private exclusion ${privateCategory}`);
}
return baseline;
}
function resolveGitRoot(candidate, label) {
let resolved;
try {
resolved = realpathSync(candidate);
const root = execFileSync('git', ['-C', resolved, 'rev-parse', '--show-toplevel'], {
encoding: 'utf-8',
stdio: ['ignore', 'pipe', 'pipe'],
windowsHide: true,
}).trim();
return realpathSync(root);
} catch (error) {
throw new ConfigurationError(`${label} is not a readable Git worktree: ${candidate}`);
}
}
function readUtf8Normalized(filePath) {
let text;
try {
text = decoder.decode(readFileSync(filePath));
} catch (error) {
throw new ConfigurationError(`cannot read UTF-8 source file ${filePath}: ${error.message}`);
}
return text.replace(/^\uFEFF/, '').replace(/\r\n?/g, '\n');
}
function inventory(root, label) {
let rootStat;
try {
rootStat = lstatSync(root);
} catch {
throw new ConfigurationError(`${label} mapped source directory is missing: ${root}`);
}
if (rootStat.isSymbolicLink() || !rootStat.isDirectory()) {
throw new ConfigurationError(`${label} mapped source must be a real directory: ${root}`);
}
const files = new Map();
const casing = new Map();
const walk = (directory, prefix = '') => {
let entries;
try {
entries = readdirSync(directory, { withFileTypes: true }).sort((left, right) =>
compareOrdinal(left.name, right.name),
);
} catch (error) {
throw new ConfigurationError(`cannot inventory ${label} directory ${directory}: ${error.message}`);
}
for (const entry of entries) {
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
const absolutePath = join(directory, entry.name);
const stat = lstatSync(absolutePath);
if (stat.isSymbolicLink()) {
throw new ConfigurationError(`${label} mapped inventory contains symlink: ${relativePath}`);
}
if (stat.isDirectory()) {
if (!MAPPING.ignoredDirectories.includes(entry.name)) {
walk(absolutePath, relativePath);
}
continue;
}
if (!stat.isFile()) {
throw new ConfigurationError(`${label} mapped inventory contains special node: ${relativePath}`);
}
if (MAPPING.ignoredFileSuffixes.some((suffix) => relativePath.endsWith(suffix))) {
continue;
}
const folded = relativePath.toLowerCase();
const previous = casing.get(folded);
if (previous && previous !== relativePath) {
throw new ConfigurationError(
`${label} mapped inventory has case collision: ${previous} / ${relativePath}`,
);
}
casing.set(folded, relativePath);
const text = readUtf8Normalized(absolutePath);
files.set(relativePath, {
hash: createHash('sha256').update(text, 'utf-8').digest('hex'),
text,
});
}
};
walk(root);
if (files.size === 0) {
throw new ConfigurationError(`${label} mapped inventory is empty: ${root}`);
}
return files;
}
function resolveMappedRoot(repositoryRoot, relativePath, label) {
let current = repositoryRoot;
for (const segment of relativePath.split('/')) {
current = join(current, segment);
let stat;
try {
stat = lstatSync(current);
} catch {
throw new ConfigurationError(`${label} mapped path component is missing: ${current}`);
}
if (stat.isSymbolicLink()) {
throw new ConfigurationError(`${label} mapped path contains ancestor symlink: ${current}`);
}
if (!stat.isDirectory()) {
throw new ConfigurationError(`${label} mapped path component is not a directory: ${current}`);
}
}
return current;
}
function isPrivateExclusion(path) {
if (FORBIDDEN_EXPORTS.paths.includes(path)) return true;
return FORBIDDEN_EXPORTS.pathPrefixes.some((prefix) =>
prefix.endsWith('/') ? path.startsWith(prefix) : path === prefix || path.startsWith(`${prefix}/`),
);
}
function observedState(canonical, oss) {
if (canonical && oss) return canonical.hash === oss.hash ? 'equal' : 'different';
if (canonical) return 'only-canonical';
if (oss) return 'only-oss';
return 'absent';
}
function hasForbiddenMarker(text, token) {
const escaped = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
return new RegExp(`\\b${escaped}\\b`, 'i').test(text);
}
function gitReceipt(root, scopedPaths) {
const head = execFileSync('git', ['-C', root, 'rev-parse', 'HEAD'], {
encoding: 'utf-8',
windowsHide: true,
}).trim();
const status = execFileSync(
'git',
['-C', root, 'status', '--porcelain=v1', '--untracked-files=all'],
{ encoding: 'utf-8', windowsHide: true },
).trim();
const scopedStatus = execFileSync(
'git',
['-C', root, 'status', '--porcelain=v1', '--untracked-files=all', '--', ...scopedPaths],
{ encoding: 'utf-8', windowsHide: true },
).trim();
return { head, dirty: status.length > 0, scopedStatus };
}
function showSection(title, entries) {
console.log(`${title}: ${entries.length}`);
for (const entry of [...entries].sort(compareOrdinal)) {
console.log(` ${entry}`);
}
}
function run() {
if (process.argv.length > 3) {
throw new ConfigurationError('usage: node scripts/oss-drift-check.mjs [path-to-oss-checkout]');
}
const baseline = loadBaseline();
const canonicalRoot = resolveGitRoot(join(SCRIPT_DIR, '..'), 'canonical repository');
const requestedOss =
process.argv[2] ??
(process.env.OSS_HIVE_MIND_DIR?.trim() || resolve(canonicalRoot, '..', 'hive-mind'));
const ossRoot = resolveGitRoot(resolve(process.cwd(), requestedOss), 'OSS repository');
if (canonicalRoot.toLowerCase() === ossRoot.toLowerCase()) {
throw new ConfigurationError('canonical and OSS repositories must be different Git worktrees');
}
const canonicalFiles = inventory(
resolveMappedRoot(canonicalRoot, MAPPING.canonical, 'canonical'),
'canonical',
);
const ossFiles = inventory(resolveMappedRoot(ossRoot, MAPPING.oss, 'OSS'), 'OSS');
const crossRepoCasing = new Map();
for (const path of [...canonicalFiles.keys(), ...ossFiles.keys()]) {
const folded = path.toLowerCase();
const previous = crossRepoCasing.get(folded);
if (previous && previous !== path) {
throw new ConfigurationError(`mapped inventories have case collision: ${previous} / ${path}`);
}
crossRepoCasing.set(folded, path);
}
const parity = new Map(baseline.parityPaths.map((entry) => [entry.path, entry]));
const adaptations = new Map(baseline.intentionalAdaptations.map((entry) => [entry.path, entry]));
const blockers = new Map(baseline.knownReviewedBlockers.map((entry) => [entry.path, entry]));
const knownUnreviewed = new Map(
baseline.unreviewedDifferences.map((entry) => [entry.path, entry]),
);
const reviewedAdaptations = [];
const intentionalExclusions = [];
const knownBlockers = [];
const unreviewed = [];
const forbidden = [];
const observedPaths = new Set();
const union = [...new Set([...canonicalFiles.keys(), ...ossFiles.keys()])].sort(compareOrdinal);
for (const path of union) {
observedPaths.add(path);
const canonical = canonicalFiles.get(path);
const oss = ossFiles.get(path);
const state = observedState(canonical, oss);
if (isPrivateExclusion(path)) {
if (oss) {
forbidden.push(`FORBIDDEN-OSS-CONTENT ${path}`);
} else if (canonical) {
intentionalExclusions.push(path);
}
continue;
}
const parityEntry = parity.get(path);
if (parityEntry) {
if (
state === 'equal' &&
canonical.hash === parityEntry.sha256 &&
oss.hash === parityEntry.sha256
) {
continue;
}
unreviewed.push(`BASELINE-DRIFT ${path} expected equal, observed ${state}`);
continue;
}
const adaptation = adaptations.get(path);
if (adaptation) {
if (
state === 'different' &&
canonical.hash === adaptation.canonicalSha256 &&
oss.hash === adaptation.ossSha256
) {
reviewedAdaptations.push(`${path} [${adaptation.kinds.join(',')}]`);
} else {
unreviewed.push(`BASELINE-DRIFT ${path} reviewed adaptation bytes changed (${state})`);
}
continue;
}
const blocker = blockers.get(path);
if (blocker) {
if (state === blocker.state) {
knownBlockers.push(`${path} (${state}; ${blocker.disposition})`);
} else {
unreviewed.push(
`BASELINE-DRIFT ${path} expected ${blocker.state}, observed ${state}`,
);
}
continue;
}
const unreviewedEntry = knownUnreviewed.get(path);
if (unreviewedEntry) {
if (state === unreviewedEntry.state) {
unreviewed.push(`${path} (${state})`);
} else {
unreviewed.push(
`BASELINE-DRIFT ${path} expected ${unreviewedEntry.state}, observed ${state}`,
);
}
continue;
}
unreviewed.push(`NEW ${path} (${state})`);
}
for (const path of [
...parity.keys(),
...adaptations.keys(),
...blockers.keys(),
...knownUnreviewed.keys(),
]) {
if (!observedPaths.has(path)) {
unreviewed.push(`STALE-BASELINE ${path} (absent)`);
}
}
for (const marker of FORBIDDEN_EXPORTS.markers) {
const file = ossFiles.get(marker.path);
if (!file) continue;
if (hasForbiddenMarker(file.text, marker.token)) {
forbidden.push(`FORBIDDEN-OSS-MARKER ${marker.path}:${marker.token}`);
}
}
const canonicalReceipt = gitReceipt(canonicalRoot, [
MAPPING.canonical,
'scripts/oss-drift-check.mjs',
'scripts/oss-drift-baseline.json',
'scripts/oss-drift-check.sh',
]);
const ossReceipt = gitReceipt(ossRoot, [MAPPING.oss]);
if (canonicalReceipt.scopedStatus) {
unreviewed.push('SCOPED-DIRTY canonical checker, baseline, wrapper, or mapped source');
}
if (ossReceipt.scopedStatus) {
unreviewed.push('SCOPED-DIRTY OSS mapped source');
}
console.log(
`CANONICAL ${canonicalReceipt.head} ${canonicalReceipt.dirty ? 'dirty' : 'clean'} ${canonicalRoot}`,
);
console.log(`OSS ${ossReceipt.head} ${ossReceipt.dirty ? 'dirty' : 'clean'} ${ossRoot}`);
console.log(`PARITY: ${parity.size}`);
showSection('REVIEWED ADAPTATIONS', reviewedAdaptations);
showSection('INTENTIONAL OSS EXCLUSIONS', intentionalExclusions);
showSection('KNOWN REVIEWED BLOCKERS', knownBlockers);
showSection('UNREVIEWED DIFFERENCES', unreviewed);
showSection('FORBIDDEN EXPORTS', forbidden);
const blocked = knownBlockers.length || unreviewed.length || forbidden.length;
if (blocked) {
console.log(
'[oss-drift-check] release blocked: reconcile in the canonical monorepo, then use a curated forward-port; never publish a raw split.',
);
}
return blocked ? 1 : 0;
}
try {
process.exitCode = run();
} catch (error) {
if (error instanceof ConfigurationError) {
console.error(`[oss-drift-check] CONFIGURATION ERROR: ${error.message}`);
} else {
console.error(`[oss-drift-check] UNEXPECTED ERROR: ${error?.stack ?? error}`);
}
process.exitCode = 2;
}

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
exec node "$SCRIPT_DIR/oss-drift-check.mjs" "$@"

View File

@@ -1,191 +0,0 @@
#!/usr/bin/env bash
#
# oss-subtree-split.sh — emit hive-mind-* packages to local export branches.
#
# Per CC Sesija B brief 2026-04-30 §2.6 Task B20.
#
# ============================================================================
# ⚠️ DO NOT PUSH THE OUTPUT OF THIS SCRIPT DIRECTLY TO THE PUBLIC OSS MIRROR.
# ============================================================================
# This script produces RAW per-package subtree branches. They are NOT
# OSS-publishable as-is, for three reasons established by the 2026-06-12 drift
# analysis (docs/ux-refactor/oss-sync-finding-2026-06-12.md):
#
# 1. PROPRIETARY FILES. `packages/hive-mind-core/src/mind/` contains
# evolution-runs.ts, execution-traces.ts, improvement-signals.ts — Waggle
# proprietary, EXCLUDED from the public mirror. A raw split carries them.
# (The hard abort guard below refuses to publish a ref that contains them,
# so the leak can't happen silently — but the guard is a backstop, not the
# sync mechanism.)
# 2. INTERLEAVED PROPRIETARY CONTENT. The `install_audit` table DDL + its
# rebuild migration live INSIDE mind/{schema.ts,db.ts} (not as separate
# files), and are also OSS-excluded. A file-level filter cannot strip them
# — only a curated edit can. The guard cannot catch this.
# 3. WRONG LAYOUT. The public mirror (github.com/marolinik/hive-mind) uses a
# curated layout (`packages/core`, co-located tests, rewritten imports),
# NOT `packages/hive-mind-core`. A raw split has the wrong root.
#
# THE REAL SYNC is a hand-curated forward-port onto a maintainer feature branch
# in the OSS clone (e.g. the `feature/mono-parity-YYYY-MM-DD` model), which
# adapts the layout, strips install_audit + the proprietary files, and rewrites
# imports. See packages/hive-mind-core/CONTRIBUTING.md and the finding doc.
#
# This script remains useful ONLY for: inspecting a package's isolated history,
# or as the starting point for a curated port. The push step is the maintainer's.
#
# What this does:
# For each `packages/hive-mind-*` directory, run `git subtree split` to produce
# a clean linear history branch containing only that package's commits.
# The resulting branches are named `oss-<package>-export` and live LOCAL ONLY
# in this clone — they are NOT pushed automatically.
#
# Usage:
# bash scripts/oss-subtree-split.sh # split all hive-mind-* packages
# bash scripts/oss-subtree-split.sh hive-mind-core # split only one package
#
# Idempotent: re-running replaces export refs only after a candidate passes every guard.
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
VALIDATED_BRANCHES=()
VALIDATED_SHAS=()
# Default: split all hive-mind-* packages. Override via CLI args for targeted split.
if [[ $# -gt 0 ]]; then
PACKAGES=("$@")
else
# Discover packages dynamically so newly-added Wave 2/3 hooks are auto-included.
mapfile -t PACKAGES < <(ls -1d packages/hive-mind-* 2>/dev/null | sed 's|packages/||')
fi
if [[ ${#PACKAGES[@]} -eq 0 ]]; then
echo "[oss-subtree-split] No packages/hive-mind-* directories found. Nothing to split." >&2
exit 1
fi
echo "[oss-subtree-split] Will split ${#PACKAGES[@]} package(s):"
for pkg in "${PACKAGES[@]}"; do
echo " - $pkg"
done
echo
for pkg in "${PACKAGES[@]}"; do
PREFIX="packages/$pkg"
BRANCH="oss-${pkg}-export"
if [[ ! -d "$PREFIX" ]]; then
echo "[oss-subtree-split] ERROR: requested package directory $PREFIX was not found." >&2
exit 2
fi
echo "[oss-subtree-split] Splitting $PREFIX → detached candidate commit"
CANDIDATE_SHA=$(git subtree split --prefix="$PREFIX" | tail -n 1)
if ! git cat-file -e "${CANDIDATE_SHA}^{commit}" 2>/dev/null; then
echo "[oss-subtree-split] ERROR: subtree split did not return a valid commit." >&2
exit 2
fi
# Top-level summary for audit.
TOP_LEVEL=$(git ls-tree --name-only "$CANDIDATE_SHA" | sort | tr '\n' ' ')
echo "[oss-subtree-split] candidate HEAD top-level: $TOP_LEVEL"
# Negative assertion: monorepo-bleed sentinel. The subtree-split's prefix=
# arg already guarantees the export contains ONLY the subtree, but we
# double-check that no monorepo-LEVEL siblings leaked. Package-internal dirs
# (docs/, assets/, src/, tests/, dist/) are legitimate and not flagged.
# Forbidden = paths that ONLY exist as monorepo siblings, never as package contents.
for forbidden in apps packages .planning .scratch .mind; do
if echo "$TOP_LEVEL" | grep -qE "(^| )$forbidden( |$)"; then
echo "[oss-subtree-split] ERROR: candidate contains forbidden monorepo-level entry '$forbidden'." >&2
echo "[oss-subtree-split] This indicates the subtree-split misbehaved or proprietary content leaked." >&2
echo "[oss-subtree-split] No export refs were changed." >&2
exit 2
fi
done
# ── Proprietary-file ABORT guard (2026-06-12) ────────────────────────────
# Hard backstop against the IP-leak failure mode: these files are Waggle
# proprietary and must NEVER reach the public OSS mirror. They live inside
# packages/hive-mind-core/src/mind/, so a raw subtree-split of that package
# WILL carry them. CLAUDE.md §7.5 previously claimed a "subtree-split filter"
# handled this — it did not exist; this guard is that protection, made real.
# The guard ABORTS (does not silently scrub) — a leaky export branch must
# never be produced, and the real OSS sync is a curated forward-port anyway.
FORBIDDEN_FILES=(
"src/mind/evolution-runs.ts"
"src/mind/execution-traces.ts"
"src/mind/improvement-signals.ts"
"src/vault.ts"
"src/compliance"
)
BRANCH_FILES=$(git ls-tree -r --name-only "$CANDIDATE_SHA")
for pf in "${FORBIDDEN_FILES[@]}"; do
if echo "$BRANCH_FILES" | grep -qE "(^|/)${pf}(/|\$|\.ts\$)"; then
echo "[oss-subtree-split] ERROR: candidate contains PROPRIETARY path '$pf'." >&2
echo "[oss-subtree-split] This export is NOT safe to push to the public OSS mirror." >&2
echo "[oss-subtree-split] These files are Waggle-proprietary (§7.5) and must be removed" >&2
echo "[oss-subtree-split] by the curated forward-port, not pushed raw. ABORTING." >&2
echo "[oss-subtree-split] See docs/ux-refactor/oss-sync-finding-2026-06-12.md." >&2
exit 3
fi
done
VALIDATED_BRANCHES+=("$BRANCH")
VALIDATED_SHAS+=("$CANDIDATE_SHA")
echo "[oss-subtree-split] ✓ candidate validated (no monorepo-level leak, no proprietary files)"
echo "[oss-subtree-split] NOTE: this is a RAW history branch — NOT OSS-publishable as-is"
echo "[oss-subtree-split] (wrong layout + interleaved install_audit). Curate before any push."
echo
done
# Update stable LOCAL inspection refs only after every requested package passes.
# Preflight checked-out refs, capture expected old OIDs, then use one compare-and-
# swap transaction so a lock/race/failure cannot leave a partially updated set.
ZERO_OID=$(printf '%040d' 0)
EXPECTED_OLD_SHAS=()
if ! WORKTREE_LIST=$(git worktree list --porcelain); then
echo "[oss-subtree-split] ERROR: could not inventory checked-out worktree refs." >&2
exit 4
fi
for i in "${!VALIDATED_BRANCHES[@]}"; do
ref="refs/heads/${VALIDATED_BRANCHES[$i]}"
if grep -Fxq "branch $ref" <<< "$WORKTREE_LIST"; then
echo "[oss-subtree-split] ERROR: refusing to update checked-out ref $ref." >&2
exit 4
fi
if git show-ref --verify --quiet "$ref"; then
EXPECTED_OLD_SHAS+=("$(git rev-parse "$ref")")
else
EXPECTED_OLD_SHAS+=("$ZERO_OID")
fi
done
if ! {
echo start
for i in "${!VALIDATED_BRANCHES[@]}"; do
printf 'update refs/heads/%s %s %s\n' \
"${VALIDATED_BRANCHES[$i]}" "${VALIDATED_SHAS[$i]}" "${EXPECTED_OLD_SHAS[$i]}"
done
echo prepare
echo commit
} | git update-ref --stdin; then
echo "[oss-subtree-split] ERROR: atomic export-ref transaction failed; no refs were changed." >&2
exit 4
fi
echo "[oss-subtree-split] All splits complete. Local branches ready:"
for branch in "${VALIDATED_BRANCHES[@]}"; do
echo " $branch"
done
echo
echo "[oss-subtree-split] These branches are for INSPECTION / as a curation starting"
echo "[oss-subtree-split] point only. DO NOT push them raw to the public OSS mirror —"
echo "[oss-subtree-split] they carry the wrong layout and interleaved install_audit"
echo "[oss-subtree-split] (the proprietary FILES are blocked by the guard above, but"
echo "[oss-subtree-split] the install_audit DDL/migration inside schema.ts/db.ts is not)."
echo "[oss-subtree-split] The real sync is a curated forward-port onto the OSS clone's"
echo "[oss-subtree-split] maintainer feature branch — see CONTRIBUTING.md + the finding"
echo "[oss-subtree-split] doc: docs/ux-refactor/oss-sync-finding-2026-06-12.md."

View File

@@ -1,16 +0,0 @@
#!/usr/bin/env bash
#
# RETIRED 2026-04-30 — the memory substrate moved to
# packages/hive-mind-core/src and the public mirror adopted a curated layout.
# This pre-migration injector cannot prove current parity and must not run.
#
# Current maintainer workflow:
# 1. Read AGENTS.md §7.5 and packages/hive-mind-core/CONTRIBUTING.md.
# 2. Run scripts/oss-drift-check.sh against a clean OSS checkout.
# 3. Prepare and review a maintainer-curated forward-port.
set -euo pipefail
echo "[parity-check] RETIRED: this pre-migration parity injector is disabled." >&2
echo "[parity-check] Use scripts/oss-drift-check.sh and the curated workflow in AGENTS.md §7.5." >&2
exit 2

View File

@@ -5,8 +5,8 @@ import os from 'node:os';
import path from 'node:path';
import { describe, it } from 'vitest';
import { CostTracker } from '../packages/agent/src/cost-tracker.js';
import { MindDB } from '../packages/hive-mind-core/src/mind/db.js';
import { ExecutionTraceStore } from '../packages/hive-mind-core/src/mind/execution-traces.js';
import { WaggleDB } from '../packages/core/src/waggle-db.js';
import { ExecutionTraceStore } from '../packages/core/src/execution-traces.js';
import {
assertQualifiedChatCase,
assertQualifiedToolContextCase,
@@ -40,7 +40,7 @@ describe('qualify-smart-router helpers', () => {
const day = timestamp.slice(0, 10);
try {
await seedQualificationDailySpend(dataDir, 0.8, timestamp);
const db = new MindDB(path.join(dataDir, 'personal.mind'));
const db = WaggleDB.openInDataDir(dataDir);
try {
const persisted = new ExecutionTraceStore(db).getTotalCostSince(`${day}T00:00:00.000Z`);
assert.equal(persisted, 0.8);

View File

@@ -613,11 +613,11 @@ export async function seedQualificationDailySpend(
throw new RangeError('Qualification spend seed must be a positive finite amount');
}
await mkdir(dataDir, { recursive: true });
const [{ MindDB }, { ExecutionTraceStore }] = await Promise.all([
import('../packages/hive-mind-core/src/mind/db.js'),
import('../packages/hive-mind-core/src/mind/execution-traces.js'),
const [{ WaggleDB }, { ExecutionTraceStore }] = await Promise.all([
import('../packages/core/src/waggle-db.js'),
import('../packages/core/src/execution-traces.js'),
]);
const db = new MindDB(path.join(dataDir, 'personal.mind'));
const db = WaggleDB.openInDataDir(dataDir);
try {
const store = new ExecutionTraceStore(db);
const traceId = store.start({