realitydb 0.1.1 → 0.2.0
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/dist/index.js +271 -60
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -4253,6 +4253,11 @@ function createSeededRandom(seed) {
|
|
|
4253
4253
|
};
|
|
4254
4254
|
}
|
|
4255
4255
|
|
|
4256
|
+
// ../../packages/shared/dist/output.js
|
|
4257
|
+
function formatCIOutput(result) {
|
|
4258
|
+
return JSON.stringify(result, null, 2);
|
|
4259
|
+
}
|
|
4260
|
+
|
|
4256
4261
|
// ../../packages/generators/dist/foreignKeyResolver.js
|
|
4257
4262
|
function resolveForeignKey(ctx, ref) {
|
|
4258
4263
|
const referencedTable = ctx.allGeneratedTables.get(ref.referencedTable);
|
|
@@ -6637,12 +6642,40 @@ function maskConnectionString(connectionString) {
|
|
|
6637
6642
|
}
|
|
6638
6643
|
|
|
6639
6644
|
// src/commands/scan.ts
|
|
6640
|
-
|
|
6645
|
+
var VERSION2 = "0.2.0";
|
|
6646
|
+
async function scanCommand(options) {
|
|
6647
|
+
const start = performance.now();
|
|
6641
6648
|
try {
|
|
6642
6649
|
const config = await loadConfig();
|
|
6643
6650
|
const result = await scanDatabase(config);
|
|
6644
6651
|
const { schema } = result;
|
|
6645
6652
|
const masked = maskConnectionString(config.database.connectionString);
|
|
6653
|
+
const durationMs = Math.round(performance.now() - start);
|
|
6654
|
+
if (options.ci) {
|
|
6655
|
+
console.log(formatCIOutput({
|
|
6656
|
+
success: true,
|
|
6657
|
+
command: "scan",
|
|
6658
|
+
version: VERSION2,
|
|
6659
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6660
|
+
durationMs,
|
|
6661
|
+
data: {
|
|
6662
|
+
database: masked,
|
|
6663
|
+
tableCount: schema.tableCount,
|
|
6664
|
+
foreignKeyCount: schema.foreignKeyCount,
|
|
6665
|
+
tables: schema.tables.map((t) => ({
|
|
6666
|
+
name: t.name,
|
|
6667
|
+
columnCount: t.columns.length,
|
|
6668
|
+
primaryKey: t.primaryKey?.columnName ?? null
|
|
6669
|
+
})),
|
|
6670
|
+
foreignKeys: schema.foreignKeys.map((fk) => ({
|
|
6671
|
+
source: `${fk.sourceTable}.${fk.sourceColumn}`,
|
|
6672
|
+
target: `${fk.targetTable}.${fk.targetColumn}`
|
|
6673
|
+
})),
|
|
6674
|
+
insertionOrder: result.insertionOrder
|
|
6675
|
+
}
|
|
6676
|
+
}));
|
|
6677
|
+
return;
|
|
6678
|
+
}
|
|
6646
6679
|
console.log("");
|
|
6647
6680
|
console.log("RealityDB Schema Scan");
|
|
6648
6681
|
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
@@ -6683,13 +6716,26 @@ async function scanCommand() {
|
|
|
6683
6716
|
console.log("");
|
|
6684
6717
|
} catch (err) {
|
|
6685
6718
|
const message = err instanceof Error ? err.message : String(err);
|
|
6719
|
+
if (options.ci) {
|
|
6720
|
+
console.log(formatCIOutput({
|
|
6721
|
+
success: false,
|
|
6722
|
+
command: "scan",
|
|
6723
|
+
version: VERSION2,
|
|
6724
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6725
|
+
durationMs: Math.round(performance.now() - start),
|
|
6726
|
+
error: message
|
|
6727
|
+
}));
|
|
6728
|
+
process.exit(1);
|
|
6729
|
+
}
|
|
6686
6730
|
console.error(`[realitydb] Scan failed: ${message}`);
|
|
6687
6731
|
process.exit(1);
|
|
6688
6732
|
}
|
|
6689
6733
|
}
|
|
6690
6734
|
|
|
6691
6735
|
// src/commands/seed.ts
|
|
6736
|
+
var VERSION3 = "0.2.0";
|
|
6692
6737
|
async function seedCommand(options) {
|
|
6738
|
+
const start = performance.now();
|
|
6693
6739
|
try {
|
|
6694
6740
|
const config = await loadConfig();
|
|
6695
6741
|
const records = options.records ? parseInt(options.records, 10) : void 0;
|
|
@@ -6703,6 +6749,17 @@ async function seedCommand(options) {
|
|
|
6703
6749
|
const template = registry.get(templateName);
|
|
6704
6750
|
if (!template) {
|
|
6705
6751
|
const available = registry.list();
|
|
6752
|
+
if (options.ci) {
|
|
6753
|
+
console.log(formatCIOutput({
|
|
6754
|
+
success: false,
|
|
6755
|
+
command: "seed",
|
|
6756
|
+
version: VERSION3,
|
|
6757
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6758
|
+
durationMs: Math.round(performance.now() - start),
|
|
6759
|
+
error: `Template "${templateName}" not found. Available: ${available.map((t) => t.name).join(", ")}`
|
|
6760
|
+
}));
|
|
6761
|
+
process.exit(1);
|
|
6762
|
+
}
|
|
6706
6763
|
console.error(`[realitydb] Template "${templateName}" not found.`);
|
|
6707
6764
|
console.error("");
|
|
6708
6765
|
if (available.length > 0) {
|
|
@@ -6721,6 +6778,17 @@ async function seedCommand(options) {
|
|
|
6721
6778
|
const scenarioNames = scenario.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
6722
6779
|
for (const name of scenarioNames) {
|
|
6723
6780
|
if (!scenarioRegistry.get(name)) {
|
|
6781
|
+
if (options.ci) {
|
|
6782
|
+
console.log(formatCIOutput({
|
|
6783
|
+
success: false,
|
|
6784
|
+
command: "seed",
|
|
6785
|
+
version: VERSION3,
|
|
6786
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6787
|
+
durationMs: Math.round(performance.now() - start),
|
|
6788
|
+
error: `Scenario "${name}" not found`
|
|
6789
|
+
}));
|
|
6790
|
+
process.exit(1);
|
|
6791
|
+
}
|
|
6724
6792
|
const available = scenarioRegistry.list();
|
|
6725
6793
|
console.error(`[realitydb] Scenario "${name}" not found.`);
|
|
6726
6794
|
console.error("");
|
|
@@ -6735,29 +6803,31 @@ async function seedCommand(options) {
|
|
|
6735
6803
|
const effectiveSeed = seed ?? config.seed.randomSeed ?? 42;
|
|
6736
6804
|
const effectiveRecords = records ?? config.seed.defaultRecords;
|
|
6737
6805
|
const masked = maskConnectionString(config.database.connectionString);
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6806
|
+
if (!options.ci) {
|
|
6807
|
+
console.log("");
|
|
6808
|
+
console.log("RealityDB Seed");
|
|
6809
|
+
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
6810
|
+
console.log(`Database: ${masked}`);
|
|
6811
|
+
if (templateName) {
|
|
6812
|
+
console.log(`Template: ${templateName}`);
|
|
6813
|
+
}
|
|
6814
|
+
if (timeline) {
|
|
6815
|
+
console.log(`Timeline: ${timeline}`);
|
|
6816
|
+
console.log(`Growth: s-curve`);
|
|
6817
|
+
}
|
|
6818
|
+
console.log(`Seed: ${effectiveSeed}`);
|
|
6819
|
+
console.log(`Records per table: ${effectiveRecords}`);
|
|
6820
|
+
if (scenario) {
|
|
6821
|
+
const scenarioNames = scenario.split(",").map((s) => s.trim());
|
|
6822
|
+
const scenarioDisplay = scenarioNames.map((s) => `${s} (${scenarioIntensity})`).join(", ");
|
|
6823
|
+
console.log(`Scenarios: ${scenarioDisplay}`);
|
|
6824
|
+
}
|
|
6825
|
+
console.log("");
|
|
6826
|
+
if (timeline) {
|
|
6827
|
+
console.log("Generating with timeline...");
|
|
6828
|
+
} else {
|
|
6829
|
+
console.log("Seeding...");
|
|
6830
|
+
}
|
|
6761
6831
|
}
|
|
6762
6832
|
const result = await seedDatabase(config, {
|
|
6763
6833
|
records,
|
|
@@ -6767,6 +6837,32 @@ async function seedCommand(options) {
|
|
|
6767
6837
|
scenarios: scenario,
|
|
6768
6838
|
scenarioIntensity
|
|
6769
6839
|
});
|
|
6840
|
+
const durationMs = Math.round(performance.now() - start);
|
|
6841
|
+
if (options.ci) {
|
|
6842
|
+
console.log(formatCIOutput({
|
|
6843
|
+
success: true,
|
|
6844
|
+
command: "seed",
|
|
6845
|
+
version: VERSION3,
|
|
6846
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6847
|
+
durationMs,
|
|
6848
|
+
data: {
|
|
6849
|
+
database: masked,
|
|
6850
|
+
template: templateName ?? null,
|
|
6851
|
+
seed: effectiveSeed,
|
|
6852
|
+
recordsPerTable: effectiveRecords,
|
|
6853
|
+
totalRows: result.totalRows,
|
|
6854
|
+
tables: result.insertResult.tables.map((t) => ({
|
|
6855
|
+
name: t.tableName,
|
|
6856
|
+
rowsInserted: t.rowsInserted,
|
|
6857
|
+
batchCount: t.batchCount,
|
|
6858
|
+
durationMs: t.durationMs
|
|
6859
|
+
})),
|
|
6860
|
+
timelineUsed: !!timeline,
|
|
6861
|
+
scenariosApplied: result.scenariosApplied ?? []
|
|
6862
|
+
}
|
|
6863
|
+
}));
|
|
6864
|
+
return;
|
|
6865
|
+
}
|
|
6770
6866
|
if (result.scenariosApplied && result.scenariosApplied.length > 0) {
|
|
6771
6867
|
console.log("");
|
|
6772
6868
|
console.log("Applying scenarios...");
|
|
@@ -6787,6 +6883,17 @@ async function seedCommand(options) {
|
|
|
6787
6883
|
console.log("");
|
|
6788
6884
|
} catch (err) {
|
|
6789
6885
|
const message = err instanceof Error ? err.message : String(err);
|
|
6886
|
+
if (options.ci) {
|
|
6887
|
+
console.log(formatCIOutput({
|
|
6888
|
+
success: false,
|
|
6889
|
+
command: "seed",
|
|
6890
|
+
version: VERSION3,
|
|
6891
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6892
|
+
durationMs: Math.round(performance.now() - start),
|
|
6893
|
+
error: message
|
|
6894
|
+
}));
|
|
6895
|
+
process.exit(1);
|
|
6896
|
+
}
|
|
6790
6897
|
if (message.includes("Config file not found")) {
|
|
6791
6898
|
console.error(`[realitydb] ${message}`);
|
|
6792
6899
|
console.error("Hint: Copy realitydb.config.json to realitydb.config.json");
|
|
@@ -6804,8 +6911,10 @@ async function seedCommand(options) {
|
|
|
6804
6911
|
}
|
|
6805
6912
|
|
|
6806
6913
|
// src/commands/reset.ts
|
|
6914
|
+
var VERSION4 = "0.2.0";
|
|
6807
6915
|
async function resetCommand(options) {
|
|
6808
|
-
|
|
6916
|
+
const start = performance.now();
|
|
6917
|
+
if (!options.ci && !options.confirm) {
|
|
6809
6918
|
console.log("");
|
|
6810
6919
|
console.log("This will delete ALL seeded data. Run with --confirm to proceed.");
|
|
6811
6920
|
console.log("");
|
|
@@ -6814,13 +6923,31 @@ async function resetCommand(options) {
|
|
|
6814
6923
|
try {
|
|
6815
6924
|
const config = await loadConfig();
|
|
6816
6925
|
const masked = maskConnectionString(config.database.connectionString);
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6926
|
+
if (!options.ci) {
|
|
6927
|
+
console.log("");
|
|
6928
|
+
console.log("RealityDB Reset");
|
|
6929
|
+
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
6930
|
+
console.log(`Database: ${masked}`);
|
|
6931
|
+
console.log("");
|
|
6932
|
+
console.log("Clearing tables...");
|
|
6933
|
+
}
|
|
6823
6934
|
const result = await resetDatabase(config);
|
|
6935
|
+
const durationMs = Math.round(performance.now() - start);
|
|
6936
|
+
if (options.ci) {
|
|
6937
|
+
console.log(formatCIOutput({
|
|
6938
|
+
success: true,
|
|
6939
|
+
command: "reset",
|
|
6940
|
+
version: VERSION4,
|
|
6941
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6942
|
+
durationMs,
|
|
6943
|
+
data: {
|
|
6944
|
+
database: masked,
|
|
6945
|
+
tablesCleared: result.tablesCleared,
|
|
6946
|
+
tableCount: result.tablesCleared.length
|
|
6947
|
+
}
|
|
6948
|
+
}));
|
|
6949
|
+
return;
|
|
6950
|
+
}
|
|
6824
6951
|
for (const tableName of result.tablesCleared) {
|
|
6825
6952
|
console.log(` ${tableName}: cleared`);
|
|
6826
6953
|
}
|
|
@@ -6829,6 +6956,17 @@ async function resetCommand(options) {
|
|
|
6829
6956
|
console.log("");
|
|
6830
6957
|
} catch (err) {
|
|
6831
6958
|
const message = err instanceof Error ? err.message : String(err);
|
|
6959
|
+
if (options.ci) {
|
|
6960
|
+
console.log(formatCIOutput({
|
|
6961
|
+
success: false,
|
|
6962
|
+
command: "reset",
|
|
6963
|
+
version: VERSION4,
|
|
6964
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6965
|
+
durationMs: Math.round(performance.now() - start),
|
|
6966
|
+
error: message
|
|
6967
|
+
}));
|
|
6968
|
+
process.exit(1);
|
|
6969
|
+
}
|
|
6832
6970
|
if (message.includes("Config file not found")) {
|
|
6833
6971
|
console.error(`[realitydb] ${message}`);
|
|
6834
6972
|
console.error("Hint: Copy realitydb.config.json to realitydb.config.json");
|
|
@@ -6843,7 +6981,9 @@ async function resetCommand(options) {
|
|
|
6843
6981
|
}
|
|
6844
6982
|
|
|
6845
6983
|
// src/commands/export.ts
|
|
6984
|
+
var VERSION5 = "0.2.0";
|
|
6846
6985
|
async function exportCommand(options) {
|
|
6986
|
+
const start = performance.now();
|
|
6847
6987
|
try {
|
|
6848
6988
|
const config = await loadConfig();
|
|
6849
6989
|
const format = options.format ?? config.export?.defaultFormat ?? "json";
|
|
@@ -6861,6 +7001,17 @@ async function exportCommand(options) {
|
|
|
6861
7001
|
const template = registry.get(templateName);
|
|
6862
7002
|
if (!template) {
|
|
6863
7003
|
const available = registry.list();
|
|
7004
|
+
if (options.ci) {
|
|
7005
|
+
console.log(formatCIOutput({
|
|
7006
|
+
success: false,
|
|
7007
|
+
command: "export",
|
|
7008
|
+
version: VERSION5,
|
|
7009
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7010
|
+
durationMs: Math.round(performance.now() - start),
|
|
7011
|
+
error: `Template "${templateName}" not found. Available: ${available.map((t) => t.name).join(", ")}`
|
|
7012
|
+
}));
|
|
7013
|
+
process.exit(1);
|
|
7014
|
+
}
|
|
6864
7015
|
console.error(`[realitydb] Template "${templateName}" not found.`);
|
|
6865
7016
|
console.error("");
|
|
6866
7017
|
if (available.length > 0) {
|
|
@@ -6879,6 +7030,17 @@ async function exportCommand(options) {
|
|
|
6879
7030
|
const scenarioNames = scenario.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
6880
7031
|
for (const name of scenarioNames) {
|
|
6881
7032
|
if (!scenarioRegistry.get(name)) {
|
|
7033
|
+
if (options.ci) {
|
|
7034
|
+
console.log(formatCIOutput({
|
|
7035
|
+
success: false,
|
|
7036
|
+
command: "export",
|
|
7037
|
+
version: VERSION5,
|
|
7038
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7039
|
+
durationMs: Math.round(performance.now() - start),
|
|
7040
|
+
error: `Scenario "${name}" not found`
|
|
7041
|
+
}));
|
|
7042
|
+
process.exit(1);
|
|
7043
|
+
}
|
|
6882
7044
|
const available = scenarioRegistry.list();
|
|
6883
7045
|
console.error(`[realitydb] Scenario "${name}" not found.`);
|
|
6884
7046
|
console.error("");
|
|
@@ -6890,27 +7052,29 @@ async function exportCommand(options) {
|
|
|
6890
7052
|
}
|
|
6891
7053
|
}
|
|
6892
7054
|
}
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
7055
|
+
if (!options.ci) {
|
|
7056
|
+
console.log("");
|
|
7057
|
+
console.log("RealityDB Export");
|
|
7058
|
+
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
7059
|
+
console.log(`Database: ${masked}`);
|
|
7060
|
+
if (templateName) {
|
|
7061
|
+
console.log(`Template: ${templateName}`);
|
|
7062
|
+
}
|
|
7063
|
+
if (timeline) {
|
|
7064
|
+
console.log(`Timeline: ${timeline}`);
|
|
7065
|
+
console.log(`Growth: s-curve`);
|
|
7066
|
+
}
|
|
7067
|
+
console.log(`Format: ${format}`);
|
|
7068
|
+
console.log(`Output: ${outputDir}`);
|
|
7069
|
+
console.log(`Records per table: ${effectiveRecords}`);
|
|
7070
|
+
if (scenario) {
|
|
7071
|
+
const scenarioNames = scenario.split(",").map((s) => s.trim());
|
|
7072
|
+
const scenarioDisplay = scenarioNames.map((s) => `${s} (${scenarioIntensity})`).join(", ");
|
|
7073
|
+
console.log(`Scenarios: ${scenarioDisplay}`);
|
|
7074
|
+
}
|
|
7075
|
+
console.log("");
|
|
7076
|
+
console.log("Generating dataset...");
|
|
6911
7077
|
}
|
|
6912
|
-
console.log("");
|
|
6913
|
-
console.log("Generating dataset...");
|
|
6914
7078
|
const result = await exportDataset(config, {
|
|
6915
7079
|
format,
|
|
6916
7080
|
outputDir,
|
|
@@ -6921,6 +7085,24 @@ async function exportCommand(options) {
|
|
|
6921
7085
|
scenarios: scenario,
|
|
6922
7086
|
scenarioIntensity
|
|
6923
7087
|
});
|
|
7088
|
+
const durationMs = Math.round(performance.now() - start);
|
|
7089
|
+
if (options.ci) {
|
|
7090
|
+
console.log(formatCIOutput({
|
|
7091
|
+
success: true,
|
|
7092
|
+
command: "export",
|
|
7093
|
+
version: VERSION5,
|
|
7094
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7095
|
+
durationMs,
|
|
7096
|
+
data: {
|
|
7097
|
+
format,
|
|
7098
|
+
outputDir,
|
|
7099
|
+
files: result.files,
|
|
7100
|
+
totalRows: result.totalRows,
|
|
7101
|
+
fileCount: result.files.length
|
|
7102
|
+
}
|
|
7103
|
+
}));
|
|
7104
|
+
return;
|
|
7105
|
+
}
|
|
6924
7106
|
if (result.scenariosApplied && result.scenariosApplied.length > 0) {
|
|
6925
7107
|
console.log("Applying scenarios...");
|
|
6926
7108
|
for (const sr of result.scenariosApplied) {
|
|
@@ -6936,6 +7118,17 @@ async function exportCommand(options) {
|
|
|
6936
7118
|
console.log("");
|
|
6937
7119
|
} catch (err) {
|
|
6938
7120
|
const message = err instanceof Error ? err.message : String(err);
|
|
7121
|
+
if (options.ci) {
|
|
7122
|
+
console.log(formatCIOutput({
|
|
7123
|
+
success: false,
|
|
7124
|
+
command: "export",
|
|
7125
|
+
version: VERSION5,
|
|
7126
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7127
|
+
durationMs: Math.round(performance.now() - start),
|
|
7128
|
+
error: message
|
|
7129
|
+
}));
|
|
7130
|
+
process.exit(1);
|
|
7131
|
+
}
|
|
6939
7132
|
if (message.includes("Config file not found")) {
|
|
6940
7133
|
console.error(`[realitydb] ${message}`);
|
|
6941
7134
|
console.error("Hint: Copy realitydb.config.json to realitydb.config.json");
|
|
@@ -7139,23 +7332,41 @@ async function packImportCommand(filePath, options) {
|
|
|
7139
7332
|
}
|
|
7140
7333
|
|
|
7141
7334
|
// src/cli.ts
|
|
7335
|
+
var VERSION6 = "0.2.0";
|
|
7142
7336
|
function run(argv) {
|
|
7143
7337
|
const program2 = new Command();
|
|
7144
|
-
program2.name("realitydb").description("RealityDB \u2014 Developer Reality Platform").version(
|
|
7145
|
-
program2.command("scan").description("Scan database schema").action(
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7338
|
+
program2.name("realitydb").description("RealityDB \u2014 Developer Reality Platform").version(VERSION6).option("--config <path>", "Path to config file").option("--ci", "CI mode: JSON output, no prompts, proper exit codes", false).option("--verbose", "Enable verbose output", false);
|
|
7339
|
+
program2.command("scan").description("Scan database schema").action(async () => {
|
|
7340
|
+
const opts = program2.opts();
|
|
7341
|
+
await scanCommand({ ci: opts.ci });
|
|
7342
|
+
});
|
|
7343
|
+
program2.command("seed").description("Seed database with generated data").option("--records <count>", "Number of records per table").option("--template <name>", "Template to use").option("--seed <number>", "Random seed for reproducibility").option("--timeline <duration>", 'Timeline duration (e.g., "12-months", "1-year")').option("--scenario <names>", "Scenarios to apply (comma-separated)").option("--scenario-intensity <level>", "Scenario intensity (low|medium|high)", "medium").action(async (cmdOpts) => {
|
|
7344
|
+
const opts = program2.opts();
|
|
7345
|
+
await seedCommand({ ...cmdOpts, ci: opts.ci });
|
|
7346
|
+
});
|
|
7347
|
+
program2.command("reset").description("Reset seeded data").option("--confirm", "Confirm destructive operation").action(async (cmdOpts) => {
|
|
7348
|
+
const opts = program2.opts();
|
|
7349
|
+
await resetCommand({ ...cmdOpts, ci: opts.ci });
|
|
7350
|
+
});
|
|
7351
|
+
program2.command("export").description("Export generated data").option("--format <format>", "Output format (json|csv|sql)", "json").option("--output <dir>", "Output directory", "./.realitydb").option("--records <count>", "Number of records per table").option("--seed <number>", "Random seed for reproducibility").option("--template <name>", "Template to use").option("--timeline <duration>", 'Timeline duration (e.g., "12-months", "1-year")').option("--scenario <names>", "Scenarios to apply (comma-separated)").option("--scenario-intensity <level>", "Scenario intensity (low|medium|high)", "medium").action(async (cmdOpts) => {
|
|
7352
|
+
const opts = program2.opts();
|
|
7353
|
+
await exportCommand({ ...cmdOpts, ci: opts.ci });
|
|
7354
|
+
});
|
|
7149
7355
|
program2.command("templates").description("List available domain templates").action(templatesCommand);
|
|
7150
7356
|
program2.command("scenarios").description("List available scenarios").action(scenariosCommand);
|
|
7151
7357
|
const pack = program2.command("pack").description("Reality Pack operations");
|
|
7152
7358
|
pack.command("export").description("Export environment as Reality Pack").option("--name <name>", "Pack name").option("--description <desc>", "Pack description").option("--output <dir>", "Output directory", ".").option("--records <count>", "Number of records per table").option("--seed <number>", "Random seed for reproducibility").option("--template <name>", "Template to use").option("--timeline <duration>", 'Timeline duration (e.g., "12-months", "1-year")').option("--scenario <names>", "Scenarios to apply (comma-separated)").option("--scenario-intensity <level>", "Scenario intensity (low|medium|high)", "medium").action(packExportCommand);
|
|
7153
7359
|
pack.command("import <file>").description("Import Reality Pack into database").option("--confirm", "Confirm import operation").action(packImportCommand);
|
|
7154
7360
|
program2.action(() => {
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7361
|
+
const opts = program2.opts();
|
|
7362
|
+
if (opts.ci) {
|
|
7363
|
+
console.log(JSON.stringify({ name: "realitydb", version: VERSION6 }));
|
|
7364
|
+
} else {
|
|
7365
|
+
console.log("");
|
|
7366
|
+
console.log(`RealityDB v${VERSION6} \u2014 Developer Reality Platform`);
|
|
7367
|
+
console.log("Run `realitydb --help` for available commands.");
|
|
7368
|
+
console.log("");
|
|
7369
|
+
}
|
|
7159
7370
|
});
|
|
7160
7371
|
program2.parse(argv);
|
|
7161
7372
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "realitydb",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Developer Reality Platform
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Developer Reality Platform - realistic database environments from your schema",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"database",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"@databox/config": "workspace:^",
|
|
49
49
|
"@databox/core": "workspace:^",
|
|
50
50
|
"@databox/schema": "workspace:^",
|
|
51
|
+
"@databox/shared": "workspace:^",
|
|
51
52
|
"@databox/templates": "workspace:^",
|
|
52
53
|
"commander": "^14.0.3",
|
|
53
54
|
"tsup": "^8.5.1",
|