@mindflight/mindbrain-personal-studio 0.6.1 → 0.6.2
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.
- package/README.md +2 -2
- package/build/client/_app/immutable/chunks/D0UIlUGZ.js +1 -0
- package/build/client/_app/immutable/chunks/D0UIlUGZ.js.br +0 -0
- package/build/client/_app/immutable/chunks/D0UIlUGZ.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.CVz6aYsT.js → app.CR-imLox.js} +2 -2
- package/build/client/_app/immutable/entry/app.CR-imLox.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CR-imLox.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.DV-AjeAB.js +1 -0
- package/build/client/_app/immutable/entry/start.DV-AjeAB.js.br +2 -0
- package/build/client/_app/immutable/entry/start.DV-AjeAB.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{1.BBtxY46Q.js → 1.CTEedoSY.js} +1 -1
- package/build/client/_app/immutable/nodes/1.CTEedoSY.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.CTEedoSY.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/handler.js +4 -4
- package/build/index.js +4 -4
- package/build/server/chunks/chunks/{internal.js-D8EA_he2.js → internal.js-WOmQXGMa.js} +2 -2
- package/build/server/chunks/chunks/{internal.js-D8EA_he2.js.map → internal.js-WOmQXGMa.js.map} +1 -1
- package/build/server/chunks/entries/endpoints/api/graph/schema-registry/{_server.ts.js-Dyfsc-VA.js → _server.ts.js-CAsXxBRq.js} +7 -2
- package/build/server/chunks/entries/endpoints/api/graph/schema-registry/_server.ts.js-CAsXxBRq.js.map +1 -0
- package/build/server/chunks/{handler-BjXBCd1c.js → handler-BIDedSZq.js} +3 -3
- package/build/server/chunks/{handler-BjXBCd1c.js.map → handler-BIDedSZq.js.map} +1 -1
- package/build/server/chunks/{index.js-BJYcV8V7.js → index.js-YVPJa0so.js} +2 -2
- package/build/server/chunks/{index.js-BJYcV8V7.js.map → index.js-YVPJa0so.js.map} +1 -1
- package/build/server/chunks/{manifest.js-Ddaot0P4.js → manifest.js-aGRKuiqF.js} +4 -4
- package/build/server/chunks/{manifest.js-Ddaot0P4.js.map → manifest.js-aGRKuiqF.js.map} +1 -1
- package/build/server/chunks/nodes/{1.js-BRigw_9J.js → 1.js-Dhh3ErZY.js} +2 -2
- package/build/server/chunks/nodes/{1.js-BRigw_9J.js.map → 1.js-Dhh3ErZY.js.map} +1 -1
- package/package.json +6 -2
- package/build/client/_app/immutable/chunks/BmeSanva.js +0 -1
- package/build/client/_app/immutable/chunks/BmeSanva.js.br +0 -0
- package/build/client/_app/immutable/chunks/BmeSanva.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.CVz6aYsT.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CVz6aYsT.js.gz +0 -0
- package/build/client/_app/immutable/entry/start.Bt5tVOz8.js +0 -1
- package/build/client/_app/immutable/entry/start.Bt5tVOz8.js.br +0 -2
- package/build/client/_app/immutable/entry/start.Bt5tVOz8.js.gz +0 -0
- package/build/client/_app/immutable/nodes/1.BBtxY46Q.js.br +0 -0
- package/build/client/_app/immutable/nodes/1.BBtxY46Q.js.gz +0 -0
- package/build/server/chunks/entries/endpoints/api/graph/schema-registry/_server.ts.js-Dyfsc-VA.js.map +0 -1
- package/scripts/build-serenity-v6-concept-review-pack.mjs +0 -493
- package/scripts/build-serenity-v6-review-pack.mjs +0 -479
- package/scripts/create-serenity-production-v6.mjs +0 -627
- package/scripts/export-serenity-v6-backup.mjs +0 -178
- package/scripts/import-serenity-v6-user-decisions.mjs +0 -543
- package/scripts/materialize-serenity-v6-snapshots.mjs +0 -675
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { spawnSync } from 'node:child_process';
|
|
5
|
-
|
|
6
|
-
const WORKSPACE = 'serenity-production-v6';
|
|
7
|
-
const DEFAULT_DB = '/home/dlamotte/.ghostcrab/databases/ghostcrab-serenity-v4-demos.sqlite';
|
|
8
|
-
const DEFAULT_OUT_ROOT = 'docs/demo/export-audit/2026-06-26/serenity-production-v6-backups';
|
|
9
|
-
|
|
10
|
-
const dbPath = valueAfter('--db') ?? process.env.GHOSTCRAB_SQLITE_PATH ?? DEFAULT_DB;
|
|
11
|
-
const outRoot = valueAfter('--out-dir') ?? DEFAULT_OUT_ROOT;
|
|
12
|
-
const stamp = valueAfter('--stamp') ?? timestamp();
|
|
13
|
-
const outDir = join(outRoot, stamp);
|
|
14
|
-
|
|
15
|
-
function valueAfter(flag) {
|
|
16
|
-
const index = process.argv.indexOf(flag);
|
|
17
|
-
return index >= 0 ? process.argv[index + 1] : null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function timestamp() {
|
|
21
|
-
const now = new Date();
|
|
22
|
-
const pad = (n) => String(n).padStart(2, '0');
|
|
23
|
-
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}T${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function runJson(sql) {
|
|
27
|
-
const result = spawnSync('sqlite3', ['-readonly', '-json', dbPath, sql], {
|
|
28
|
-
encoding: 'utf8',
|
|
29
|
-
maxBuffer: 1024 * 1024 * 256
|
|
30
|
-
});
|
|
31
|
-
if (result.status !== 0) throw new Error(result.stderr || result.stdout || `sqlite3 failed: ${sql}`);
|
|
32
|
-
return JSON.parse(result.stdout || '[]');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function quote(value) {
|
|
36
|
-
if (value === null || value === undefined) return 'NULL';
|
|
37
|
-
if (typeof value === 'number') return Number.isFinite(value) ? String(value) : 'NULL';
|
|
38
|
-
if (typeof value === 'boolean') return value ? '1' : '0';
|
|
39
|
-
return `'${String(value).replaceAll("'", "''")}'`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function sqlIn(values) {
|
|
43
|
-
if (values.length === 0) return "('__no_rows__')";
|
|
44
|
-
return `(${values.map(quote).join(', ')})`;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function tableColumns(table) {
|
|
48
|
-
return runJson(`PRAGMA table_info(${table})`).map((row) => row.name);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function selectTable(table, where) {
|
|
52
|
-
const rows = runJson(`SELECT * FROM ${table} WHERE ${where}`);
|
|
53
|
-
return { columns: tableColumns(table), rows };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function insertSql(table, columns, row) {
|
|
57
|
-
const values = columns.map((column) => quote(row[column])).join(', ');
|
|
58
|
-
return `INSERT INTO ${table} (${columns.join(', ')}) VALUES (${values});`;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const ontologyIds = runJson(
|
|
62
|
-
`SELECT ontology_id FROM ontologies WHERE workspace_id=${quote(WORKSPACE)} ORDER BY ontology_id`
|
|
63
|
-
).map((row) => row.ontology_id);
|
|
64
|
-
const artifactIds = runJson(
|
|
65
|
-
`SELECT artifact_id FROM mindbrain_answer_artifacts WHERE workspace_id=${quote(WORKSPACE)} ORDER BY artifact_id`
|
|
66
|
-
).map((row) => row.artifact_id);
|
|
67
|
-
const entityIds = runJson(
|
|
68
|
-
`SELECT entity_id FROM graph_entity WHERE workspace_id=${quote(WORKSPACE)} ORDER BY entity_id`
|
|
69
|
-
).map((row) => row.entity_id);
|
|
70
|
-
const relationIds = runJson(
|
|
71
|
-
`SELECT relation_id FROM graph_relation WHERE workspace_id=${quote(WORKSPACE)} ORDER BY relation_id`
|
|
72
|
-
).map((row) => row.relation_id);
|
|
73
|
-
|
|
74
|
-
const tableSpecs = [
|
|
75
|
-
['workspaces', `workspace_id=${quote(WORKSPACE)} OR id=${quote(WORKSPACE)}`],
|
|
76
|
-
['workspace_settings', `workspace_id=${quote(WORKSPACE)}`],
|
|
77
|
-
['ontologies', `workspace_id=${quote(WORKSPACE)}`],
|
|
78
|
-
['ontology_namespaces', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
79
|
-
['ontology_dimensions', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
80
|
-
['ontology_values', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
81
|
-
['ontology_entity_types', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
82
|
-
['ontology_edge_types', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
83
|
-
['ontology_triples_raw', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
84
|
-
['ontology_entities_raw', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
85
|
-
['ontology_relations_raw', `ontology_id IN ${sqlIn(ontologyIds)}`],
|
|
86
|
-
['collections', `workspace_id=${quote(WORKSPACE)}`],
|
|
87
|
-
['collection_ontologies', `workspace_id=${quote(WORKSPACE)}`],
|
|
88
|
-
['documents_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
89
|
-
['chunks_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
90
|
-
['document_links_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
91
|
-
['external_links_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
92
|
-
['facet_assignments_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
93
|
-
['agent_facts', `workspace_id=${quote(WORKSPACE)}`],
|
|
94
|
-
['graph_entity', `workspace_id=${quote(WORKSPACE)}`],
|
|
95
|
-
['graph_entity_alias', `entity_id IN ${sqlIn(entityIds)}`],
|
|
96
|
-
['graph_entity_chunk', `workspace_id=${quote(WORKSPACE)}`],
|
|
97
|
-
['graph_entity_document', `entity_id IN ${sqlIn(entityIds)}`],
|
|
98
|
-
['graph_entity_degree', `entity_id IN ${sqlIn(entityIds)}`],
|
|
99
|
-
['graph_lj_in', `entity_id IN ${sqlIn(entityIds)}`],
|
|
100
|
-
['graph_lj_out', `entity_id IN ${sqlIn(entityIds)}`],
|
|
101
|
-
['graph_relation', `workspace_id=${quote(WORKSPACE)}`],
|
|
102
|
-
['graph_relation_property', `relation_id IN ${sqlIn(relationIds)}`],
|
|
103
|
-
['graph_gap_rules', `workspace_id=${quote(WORKSPACE)}`],
|
|
104
|
-
['graph_rule_evaluations', `workspace_id=${quote(WORKSPACE)}`],
|
|
105
|
-
['graph_rule_events', `workspace_id=${quote(WORKSPACE)}`],
|
|
106
|
-
['entities_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
107
|
-
['entity_aliases_raw', `workspace_id=${quote(WORKSPACE)} OR entity_id IN ${sqlIn(entityIds)}`],
|
|
108
|
-
['entity_documents_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
109
|
-
['entity_chunks_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
110
|
-
['relations_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
111
|
-
['relation_properties_raw', `workspace_id=${quote(WORKSPACE)}`],
|
|
112
|
-
['table_semantics', `workspace_id=${quote(WORKSPACE)}`],
|
|
113
|
-
['column_semantics', `workspace_id=${quote(WORKSPACE)}`],
|
|
114
|
-
['relation_semantics', `workspace_id=${quote(WORKSPACE)}`],
|
|
115
|
-
['source_mappings', `workspace_id=${quote(WORKSPACE)}`],
|
|
116
|
-
['structured_import_provenance', `workspace_id=${quote(WORKSPACE)}`],
|
|
117
|
-
['pending_migrations', `workspace_id=${quote(WORKSPACE)}`],
|
|
118
|
-
['quality_convergence_run', `workspace_id=${quote(WORKSPACE)}`],
|
|
119
|
-
['quality_remediation_action', `workspace_id=${quote(WORKSPACE)}`],
|
|
120
|
-
['mindbrain_answer_artifacts', `workspace_id=${quote(WORKSPACE)}`],
|
|
121
|
-
['mindbrain_answer_events', `artifact_id IN ${sqlIn(artifactIds)}`]
|
|
122
|
-
];
|
|
123
|
-
|
|
124
|
-
const existingTables = new Set(runJson(`SELECT name FROM sqlite_master WHERE type='table'`).map((row) => row.name));
|
|
125
|
-
const tables = {};
|
|
126
|
-
for (const [table, where] of tableSpecs) {
|
|
127
|
-
if (!existingTables.has(table)) continue;
|
|
128
|
-
const data = selectTable(table, where);
|
|
129
|
-
if (data.rows.length > 0) tables[table] = data;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const manifest = {
|
|
133
|
-
generated_at: new Date().toISOString(),
|
|
134
|
-
workspace_id: WORKSPACE,
|
|
135
|
-
db_path: dbPath,
|
|
136
|
-
export_kind: 'workspace_scoped_json_and_sql',
|
|
137
|
-
row_counts: Object.fromEntries(Object.entries(tables).map(([table, data]) => [table, data.rows.length])),
|
|
138
|
-
total_rows: Object.values(tables).reduce((sum, data) => sum + data.rows.length, 0)
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
mkdirSync(outDir, { recursive: true });
|
|
142
|
-
writeFileSync(
|
|
143
|
-
join(outDir, 'serenity-production-v6.backup.json'),
|
|
144
|
-
`${JSON.stringify({ manifest, tables }, null, 2)}\n`
|
|
145
|
-
);
|
|
146
|
-
writeFileSync(join(outDir, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
147
|
-
|
|
148
|
-
const deleteOrder = Object.keys(tables).reverse();
|
|
149
|
-
const insertOrder = Object.keys(tables);
|
|
150
|
-
const sql = [
|
|
151
|
-
`-- Serenity Production V6 workspace-scoped SQL backup`,
|
|
152
|
-
`-- Generated at ${manifest.generated_at}`,
|
|
153
|
-
`-- Source DB: ${dbPath}`,
|
|
154
|
-
`PRAGMA foreign_keys=OFF;`,
|
|
155
|
-
`BEGIN IMMEDIATE;`,
|
|
156
|
-
...deleteOrder.map((table) => `DELETE FROM ${table} WHERE ${tableSpecs.find(([name]) => name === table)?.[1] ?? '1=0'};`),
|
|
157
|
-
...insertOrder.flatMap((table) =>
|
|
158
|
-
tables[table].rows.map((row) => insertSql(table, tables[table].columns, row))
|
|
159
|
-
),
|
|
160
|
-
`COMMIT;`,
|
|
161
|
-
`PRAGMA foreign_keys=ON;`
|
|
162
|
-
].join('\n');
|
|
163
|
-
|
|
164
|
-
writeFileSync(join(outDir, 'serenity-production-v6.backup.sql'), `${sql}\n`);
|
|
165
|
-
|
|
166
|
-
console.log(
|
|
167
|
-
JSON.stringify(
|
|
168
|
-
{
|
|
169
|
-
out_dir: outDir,
|
|
170
|
-
json: join(outDir, 'serenity-production-v6.backup.json'),
|
|
171
|
-
sql: join(outDir, 'serenity-production-v6.backup.sql'),
|
|
172
|
-
manifest: join(outDir, 'manifest.json'),
|
|
173
|
-
...manifest
|
|
174
|
-
},
|
|
175
|
-
null,
|
|
176
|
-
2
|
|
177
|
-
)
|
|
178
|
-
);
|