@datacore-one/cli 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/dist/index.js +256 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8650,6 +8650,150 @@ function startOperation(operation, params = {}) {
8650
8650
  return new Operation(operation, params);
8651
8651
  }
8652
8652
 
8653
+ // src/lib/animation.ts
8654
+ var SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
8655
+ var MATRIX_CHARS = "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン0123456789";
8656
+ var c = {
8657
+ reset: "\x1B[0m",
8658
+ bright: "\x1B[1m",
8659
+ dim: "\x1B[2m",
8660
+ green: "\x1B[32m",
8661
+ cyan: "\x1B[36m",
8662
+ yellow: "\x1B[33m",
8663
+ magenta: "\x1B[35m",
8664
+ blue: "\x1B[34m",
8665
+ gray: "\x1B[90m"
8666
+ };
8667
+ var BANNER = `
8668
+ ${c.cyan}${c.bright}
8669
+ ██████╗ █████╗ ████████╗ █████╗ ██████╗ ██████╗ ██████╗ ███████╗
8670
+ ██╔══██╗██╔══██╗╚══██╔══╝██╔══██╗██╔════╝██╔═══██╗██╔══██╗██╔════╝
8671
+ ██║ ██║███████║ ██║ ███████║██║ ██║ ██║██████╔╝█████╗
8672
+ ██║ ██║██╔══██║ ██║ ██╔══██║██║ ██║ ██║██╔══██╗██╔══╝
8673
+ ██████╔╝██║ ██║ ██║ ██║ ██║╚██████╗╚██████╔╝██║ ██║███████╗
8674
+ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
8675
+ ${c.reset}${c.dim} AI-Powered Second Brain ${c.reset}
8676
+ `;
8677
+ var INIT_COMPLETE = `
8678
+ ${c.green}${c.bright}
8679
+ ╔═══════════════════════════════════════════════════════════════╗
8680
+ ║ ║
8681
+ ║ ${c.reset}${c.green}█████╗ ██████╗████████╗██╗██╗ ██╗███████╗${c.bright} ║
8682
+ ║ ${c.reset}${c.green}██╔══██╗██╔════╝╚══██╔══╝██║██║ ██║██╔════╝${c.bright} ║
8683
+ ║ ${c.reset}${c.green}███████║██║ ██║ ██║██║ ██║█████╗${c.bright} ║
8684
+ ║ ${c.reset}${c.green}██╔══██║██║ ██║ ██║╚██╗ ██╔╝██╔══╝${c.bright} ║
8685
+ ║ ${c.reset}${c.green}██║ ██║╚██████╗ ██║ ██║ ╚████╔╝ ███████╗${c.bright} ║
8686
+ ║ ${c.reset}${c.green}╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝${c.bright} ║
8687
+ ║ ║
8688
+ ╚═══════════════════════════════════════════════════════════════╝
8689
+ ${c.reset}
8690
+ `;
8691
+ function sleep(ms) {
8692
+ return new Promise((resolve) => setTimeout(resolve, ms));
8693
+ }
8694
+ async function typewrite(text, speed = 30) {
8695
+ for (const char of text) {
8696
+ process.stdout.write(char);
8697
+ await sleep(speed);
8698
+ }
8699
+ console.log();
8700
+ }
8701
+ class Spinner {
8702
+ interval = null;
8703
+ frame = 0;
8704
+ message;
8705
+ constructor(message) {
8706
+ this.message = message;
8707
+ }
8708
+ start() {
8709
+ process.stdout.write("\x1B[?25l");
8710
+ this.interval = setInterval(() => {
8711
+ const spinner = SPINNER_FRAMES[this.frame % SPINNER_FRAMES.length];
8712
+ process.stdout.write(`\r${c.cyan}${spinner}${c.reset} ${this.message}`);
8713
+ this.frame++;
8714
+ }, 80);
8715
+ }
8716
+ update(message) {
8717
+ this.message = message;
8718
+ }
8719
+ succeed(message) {
8720
+ this.stop();
8721
+ console.log(`\r${c.green}✓${c.reset} ${message || this.message}`);
8722
+ }
8723
+ fail(message) {
8724
+ this.stop();
8725
+ console.log(`\r${c.yellow}✗${c.reset} ${message || this.message}`);
8726
+ }
8727
+ stop() {
8728
+ if (this.interval) {
8729
+ clearInterval(this.interval);
8730
+ this.interval = null;
8731
+ }
8732
+ process.stdout.write("\x1B[?25h");
8733
+ process.stdout.write("\r" + " ".repeat(this.message.length + 10) + "\r");
8734
+ }
8735
+ }
8736
+ function step(num, total, message) {
8737
+ console.log(`${c.dim}[${num}/${total}]${c.reset} ${message}`);
8738
+ }
8739
+ function section(title) {
8740
+ console.log();
8741
+ console.log(`${c.cyan}${c.bright}▸ ${title}${c.reset}`);
8742
+ console.log(`${c.dim}${"─".repeat(50)}${c.reset}`);
8743
+ }
8744
+ async function matrixRain(duration = 500) {
8745
+ const cols = process.stdout.columns || 80;
8746
+ const rows = 3;
8747
+ const drops = Array(cols).fill(0).map(() => Math.floor(Math.random() * rows));
8748
+ const startTime = Date.now();
8749
+ while (Date.now() - startTime < duration) {
8750
+ let frame = "";
8751
+ for (let y = 0;y < rows; y++) {
8752
+ for (let x = 0;x < cols; x++) {
8753
+ const drop = drops[x] ?? 0;
8754
+ if (drop === y) {
8755
+ frame += `${c.green}${c.bright}${MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)]}${c.reset}`;
8756
+ } else if (drop === y - 1) {
8757
+ frame += `${c.green}${MATRIX_CHARS[Math.floor(Math.random() * MATRIX_CHARS.length)]}${c.reset}`;
8758
+ } else {
8759
+ frame += " ";
8760
+ }
8761
+ }
8762
+ frame += `
8763
+ `;
8764
+ }
8765
+ process.stdout.write(frame);
8766
+ for (let i = 0;i < drops.length; i++) {
8767
+ if (Math.random() > 0.9)
8768
+ drops[i] = 0;
8769
+ else
8770
+ drops[i] = (drops[i] ?? 0) + 1;
8771
+ }
8772
+ await sleep(50);
8773
+ process.stdout.write(`\x1B[${rows}A`);
8774
+ }
8775
+ for (let y = 0;y < rows; y++) {
8776
+ console.log(" ".repeat(cols));
8777
+ }
8778
+ process.stdout.write(`\x1B[${rows}A`);
8779
+ }
8780
+ async function bootSequence() {
8781
+ const lines = [
8782
+ "Initializing neural pathways...",
8783
+ "Loading cognitive frameworks...",
8784
+ "Establishing knowledge graph...",
8785
+ "Calibrating AI agents...",
8786
+ "Synchronizing memory banks..."
8787
+ ];
8788
+ for (const line of lines) {
8789
+ process.stdout.write(`${c.dim}> ${line}${c.reset}`);
8790
+ await sleep(100 + Math.random() * 200);
8791
+ process.stdout.write(` ${c.green}OK${c.reset}
8792
+ `);
8793
+ await sleep(50);
8794
+ }
8795
+ }
8796
+
8653
8797
  // src/lib/init.ts
8654
8798
  var DATA_DIR4 = join6(process.env.HOME || "~", "Data");
8655
8799
  var DATACORE_DIR = join6(DATA_DIR4, ".datacore");
@@ -8658,6 +8802,7 @@ function isInitialized() {
8658
8802
  }
8659
8803
  async function initDatacore(options = {}) {
8660
8804
  const { nonInteractive = false, skipChecks = false, stream = false } = options;
8805
+ const isTTY = stream && process.stdout.isTTY;
8661
8806
  const result = {
8662
8807
  success: false,
8663
8808
  created: [],
@@ -8665,19 +8810,32 @@ async function initDatacore(options = {}) {
8665
8810
  errors: [],
8666
8811
  nextSteps: []
8667
8812
  };
8668
- const log = (msg) => {
8669
- if (stream)
8670
- console.log(msg);
8671
- };
8672
8813
  const op = startOperation("init", { options });
8673
8814
  op.start();
8674
8815
  try {
8816
+ if (isTTY) {
8817
+ console.clear();
8818
+ console.log(BANNER);
8819
+ await sleep(500);
8820
+ await matrixRain(400);
8821
+ await bootSequence();
8822
+ await sleep(300);
8823
+ }
8824
+ const TOTAL_STEPS = 6;
8675
8825
  op.addStep("check_dependencies");
8676
8826
  op.startStep("check_dependencies");
8677
8827
  if (!skipChecks) {
8678
- log("Checking dependencies...");
8828
+ let spinner = null;
8829
+ if (isTTY) {
8830
+ section("System Check");
8831
+ spinner = new Spinner("Scanning system dependencies...");
8832
+ spinner.start();
8833
+ await sleep(800);
8834
+ }
8679
8835
  const doctor = runDoctor();
8680
8836
  if (doctor.status === "missing_required") {
8837
+ if (spinner)
8838
+ spinner.fail("Missing required dependencies");
8681
8839
  const missing = doctor.dependencies.filter((d) => d.required && !d.installed);
8682
8840
  for (const dep of missing) {
8683
8841
  result.errors.push(`Missing required dependency: ${dep.name}`);
@@ -8689,44 +8847,77 @@ async function initDatacore(options = {}) {
8689
8847
  op.fail("Missing required dependencies");
8690
8848
  return result;
8691
8849
  }
8850
+ if (spinner) {
8851
+ spinner.succeed(`Found ${doctor.dependencies.filter((d) => d.installed).length} dependencies`);
8852
+ }
8692
8853
  if (doctor.status === "missing_recommended") {
8693
8854
  const missing = doctor.dependencies.filter((d) => !d.required && !d.installed);
8694
8855
  for (const dep of missing) {
8695
8856
  result.warnings.push(`Missing recommended: ${dep.name}`);
8696
8857
  }
8697
8858
  }
8859
+ if (isTTY) {
8860
+ for (const dep of doctor.dependencies) {
8861
+ if (dep.installed) {
8862
+ console.log(` \x1B[32m✓\x1B[0m ${dep.name} ${dep.version ? `\x1B[90m(${dep.version})\x1B[0m` : ""}`);
8863
+ } else {
8864
+ console.log(` \x1B[33m○\x1B[0m ${dep.name} \x1B[90m(not installed)\x1B[0m`);
8865
+ }
8866
+ await sleep(100);
8867
+ }
8868
+ }
8698
8869
  }
8699
8870
  op.completeStep("check_dependencies");
8700
8871
  op.addStep("create_data_dir");
8701
8872
  op.startStep("create_data_dir");
8873
+ if (isTTY) {
8874
+ section("Creating Brain Structure");
8875
+ }
8702
8876
  if (!existsSync6(DATA_DIR4)) {
8703
- log(`Creating ${DATA_DIR4}...`);
8877
+ if (isTTY) {
8878
+ step(1, TOTAL_STEPS, "Allocating neural storage...");
8879
+ await sleep(300);
8880
+ }
8704
8881
  mkdirSync4(DATA_DIR4, { recursive: true });
8705
8882
  result.created.push(DATA_DIR4);
8883
+ if (isTTY)
8884
+ console.log(` \x1B[32m→\x1B[0m ${DATA_DIR4}`);
8885
+ } else if (isTTY) {
8886
+ step(1, TOTAL_STEPS, "Neural storage exists");
8706
8887
  }
8707
8888
  op.completeStep("create_data_dir");
8708
8889
  op.addStep("create_datacore_dir");
8709
8890
  op.startStep("create_datacore_dir");
8710
8891
  if (!existsSync6(DATACORE_DIR)) {
8711
- log("Creating .datacore configuration...");
8892
+ if (isTTY) {
8893
+ step(2, TOTAL_STEPS, "Building core matrix...");
8894
+ }
8712
8895
  const dirs = [
8713
- "",
8714
- "commands",
8715
- "agents",
8716
- "modules",
8717
- "specs",
8718
- "lib",
8719
- "env",
8720
- "state",
8721
- "registry"
8896
+ { path: "", label: "core" },
8897
+ { path: "commands", label: "commands" },
8898
+ { path: "agents", label: "agents" },
8899
+ { path: "modules", label: "modules" },
8900
+ { path: "specs", label: "specs" },
8901
+ { path: "lib", label: "lib" },
8902
+ { path: "env", label: "env" },
8903
+ { path: "state", label: "state" },
8904
+ { path: "registry", label: "registry" }
8722
8905
  ];
8723
- for (const dir of dirs) {
8906
+ for (const { path: dir, label } of dirs) {
8724
8907
  const path = join6(DATACORE_DIR, dir);
8725
8908
  if (!existsSync6(path)) {
8726
8909
  mkdirSync4(path, { recursive: true });
8727
8910
  result.created.push(path);
8911
+ if (isTTY) {
8912
+ console.log(` \x1B[36m◆\x1B[0m ${label}`);
8913
+ await sleep(80);
8914
+ }
8728
8915
  }
8729
8916
  }
8917
+ if (isTTY) {
8918
+ step(3, TOTAL_STEPS, "Configuring neural pathways...");
8919
+ await sleep(200);
8920
+ }
8730
8921
  writeFileSync4(join6(DATACORE_DIR, "settings.yaml"), `# Datacore Settings
8731
8922
  # Override in settings.local.yaml
8732
8923
 
@@ -8758,32 +8949,51 @@ agents: []
8758
8949
  commands: []
8759
8950
  `);
8760
8951
  result.created.push(join6(DATACORE_DIR, "registry", "commands.yaml"));
8952
+ if (isTTY)
8953
+ console.log(` \x1B[32m✓\x1B[0m Configuration loaded`);
8954
+ } else if (isTTY) {
8955
+ step(2, TOTAL_STEPS, "Core matrix exists");
8956
+ step(3, TOTAL_STEPS, "Configuration loaded");
8761
8957
  }
8762
8958
  op.completeStep("create_datacore_dir");
8763
8959
  op.addStep("create_personal_space");
8764
8960
  op.startStep("create_personal_space");
8765
8961
  const spaces = listSpaces();
8766
8962
  if (spaces.length === 0) {
8767
- log("Creating personal space...");
8963
+ if (isTTY) {
8964
+ step(4, TOTAL_STEPS, "Spawning personal consciousness...");
8965
+ await sleep(400);
8966
+ }
8768
8967
  try {
8769
8968
  const space = createSpace("personal", "personal");
8770
8969
  result.created.push(space.path);
8970
+ if (isTTY)
8971
+ console.log(` \x1B[35m◉\x1B[0m 0-personal initialized`);
8771
8972
  } catch (err) {
8772
8973
  result.warnings.push(`Could not create personal space: ${err.message}`);
8773
8974
  }
8975
+ } else if (isTTY) {
8976
+ step(4, TOTAL_STEPS, `Found ${spaces.length} existing space(s)`);
8774
8977
  }
8775
8978
  op.completeStep("create_personal_space");
8776
8979
  op.addStep("create_claude_symlink");
8777
8980
  op.startStep("create_claude_symlink");
8778
8981
  const claudeDir = join6(DATA_DIR4, ".claude");
8779
8982
  if (!existsSync6(claudeDir)) {
8780
- log("Creating .claude symlink...");
8983
+ if (isTTY) {
8984
+ step(5, TOTAL_STEPS, "Establishing AI link...");
8985
+ await sleep(300);
8986
+ }
8781
8987
  try {
8782
8988
  symlinkSync(DATACORE_DIR, claudeDir);
8783
8989
  result.created.push(claudeDir);
8990
+ if (isTTY)
8991
+ console.log(` \x1B[32m⚡\x1B[0m Claude Code connected`);
8784
8992
  } catch {
8785
8993
  result.warnings.push("Could not create .claude symlink");
8786
8994
  }
8995
+ } else if (isTTY) {
8996
+ step(5, TOTAL_STEPS, "AI link established");
8787
8997
  }
8788
8998
  op.completeStep("create_claude_symlink");
8789
8999
  op.addStep("create_claude_md");
@@ -8791,44 +9001,56 @@ commands: []
8791
9001
  const claudeMd = join6(DATA_DIR4, "CLAUDE.md");
8792
9002
  const claudeBaseMd = join6(DATA_DIR4, "CLAUDE.base.md");
8793
9003
  if (!existsSync6(claudeMd) && !existsSync6(claudeBaseMd)) {
8794
- log("Creating CLAUDE.md...");
9004
+ if (isTTY) {
9005
+ step(6, TOTAL_STEPS, "Writing consciousness manifest...");
9006
+ await sleep(300);
9007
+ }
8795
9008
  writeFileSync4(claudeBaseMd, `# Datacore
8796
9009
 
8797
9010
  AI-powered second brain built on GTD methodology.
8798
9011
 
8799
- ## Getting Started
9012
+ ## Quick Start
8800
9013
 
8801
- Run \`datacore tour\` for an interactive walkthrough.
9014
+ \`\`\`bash
9015
+ cd ~/Data && claude
9016
+ \`\`\`
8802
9017
 
8803
- ## Quick Commands
9018
+ ## Commands
8804
9019
 
8805
9020
  - \`datacore today\` - Daily briefing
8806
9021
  - \`datacore tomorrow\` - End-of-day wrap-up
8807
9022
  - \`datacore sync\` - Sync all repos
8808
-
8809
- ## Documentation
8810
-
8811
- - \`datacore docs\` - Open documentation
8812
9023
  - \`datacore doctor\` - Check system health
8813
9024
 
8814
9025
  ## Spaces
8815
9026
 
8816
9027
  ${listSpaces().map((s) => `- ${s.name}`).join(`
8817
- `) || "- (no spaces yet)"}
9028
+ `) || "- 0-personal"}
8818
9029
 
8819
- ## More Info
9030
+ ## Documentation
8820
9031
 
8821
9032
  See .datacore/specs/ for detailed documentation.
8822
9033
  `);
8823
9034
  result.created.push(claudeBaseMd);
9035
+ if (isTTY)
9036
+ console.log(` \x1B[32m✓\x1B[0m CLAUDE.md created`);
9037
+ } else if (isTTY) {
9038
+ step(6, TOTAL_STEPS, "Consciousness manifest exists");
8824
9039
  }
8825
9040
  op.completeStep("create_claude_md");
8826
9041
  result.success = true;
8827
9042
  result.nextSteps = [
8828
- "Run `datacore tour` for a guided walkthrough",
8829
9043
  "Run `datacore doctor` to verify your setup",
8830
9044
  "Start working: `cd ~/Data && claude`"
8831
9045
  ];
9046
+ if (isTTY) {
9047
+ await sleep(500);
9048
+ console.log(INIT_COMPLETE);
9049
+ await typewrite(" Your second brain is ready.", 25);
9050
+ console.log();
9051
+ console.log(" \x1B[90mNext:\x1B[0m cd ~/Data && claude");
9052
+ console.log();
9053
+ }
8832
9054
  op.complete();
8833
9055
  } catch (err) {
8834
9056
  result.errors.push(err.message);
@@ -8980,7 +9202,7 @@ import { execSync as execSync5 } from "child_process";
8980
9202
  import { join as join8 } from "path";
8981
9203
  var DATA_DIR6 = join8(process.env.HOME || "~", "Data");
8982
9204
  var LOCK_FILE = join8(DATA_DIR6, "datacore.lock.yaml");
8983
- var CLI_VERSION = "1.0.0";
9205
+ var CLI_VERSION = "1.0.3";
8984
9206
  function getGitInfo(path) {
8985
9207
  if (!existsSync8(join8(path, ".git"))) {
8986
9208
  return {};
@@ -9199,7 +9421,7 @@ function restoreFromSnapshot(snapshot, options = {}) {
9199
9421
  }
9200
9422
 
9201
9423
  // src/index.ts
9202
- var VERSION = "1.0.2";
9424
+ var VERSION = "1.0.3";
9203
9425
  var args = process.argv.slice(2);
9204
9426
  var parsed = parseArgs(args);
9205
9427
  async function handleMeta(command, cmdArgs, flags, format) {
@@ -9247,8 +9469,8 @@ async function handleMeta(command, cmdArgs, flags, format) {
9247
9469
  }
9248
9470
  console.log();
9249
9471
  console.log("Next steps:");
9250
- for (const step of result.nextSteps) {
9251
- console.log(` → ${step}`);
9472
+ for (const step2 of result.nextSteps) {
9473
+ console.log(` → ${step2}`);
9252
9474
  }
9253
9475
  } else {
9254
9476
  error("Initialization failed");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacore-one/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI for setting up and managing Datacore installations",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",