@_davideast/jules-env 0.2.1 → 0.2.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/cli.mjs +102 -13
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -6029,7 +6029,7 @@ import { spawn } from "node:child_process";
6029
6029
  import { mkdir, writeFile, appendFile } from "node:fs/promises";
6030
6030
  import { resolve, dirname } from "node:path";
6031
6031
  import { homedir } from "node:os";
6032
- var SHELLENV_SOURCE = ". $HOME/.jules/shellenv 2>/dev/null; ";
6032
+ var SHELLENV_SOURCE = "test -f $HOME/.jules/shellenv && . $HOME/.jules/shellenv; ";
6033
6033
  async function executePlan(plan, dryRun, label) {
6034
6034
  if (dryRun) {
6035
6035
  console.log(`--- DRY RUN: ${label ?? "Execution Plan"} ---`);
@@ -6182,7 +6182,7 @@ async function resolveLinux() {
6182
6182
  {
6183
6183
  id: "install-dart-prereqs",
6184
6184
  label: "Install prerequisites",
6185
- cmd: "sudo apt-get update && sudo apt-get install -y apt-transport-https wget",
6185
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y apt-transport-https wget",
6186
6186
  checkCmd: "dpkg -s apt-transport-https && dpkg -s wget"
6187
6187
  },
6188
6188
  {
@@ -6200,7 +6200,7 @@ async function resolveLinux() {
6200
6200
  {
6201
6201
  id: "install-dart",
6202
6202
  label: "Install Dart SDK",
6203
- cmd: "sudo apt-get update && sudo apt-get install -y dart",
6203
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y dart",
6204
6204
  checkCmd: "dpkg -s dart"
6205
6205
  }
6206
6206
  ];
@@ -6276,7 +6276,7 @@ async function resolveLinux2() {
6276
6276
  {
6277
6277
  id: "install-flutter-prereqs",
6278
6278
  label: "Install prerequisites",
6279
- cmd: "sudo apt-get update && sudo apt-get install -y curl git unzip xz-utils",
6279
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y curl git unzip xz-utils",
6280
6280
  checkCmd: "dpkg -s curl && dpkg -s git && dpkg -s unzip && dpkg -s xz-utils"
6281
6281
  },
6282
6282
  {
@@ -6348,7 +6348,7 @@ async function resolveLinux3() {
6348
6348
  {
6349
6349
  id: "install-ruby-prereqs",
6350
6350
  label: "Install build prerequisites",
6351
- cmd: "sudo apt-get update && sudo apt-get install -y build-essential",
6351
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y build-essential",
6352
6352
  checkCmd: "dpkg -s build-essential"
6353
6353
  },
6354
6354
  {
@@ -6422,7 +6422,7 @@ async function resolveLinux4() {
6422
6422
  {
6423
6423
  id: "install-php",
6424
6424
  label: "Install PHP",
6425
- cmd: "sudo apt-get update && sudo apt-get install -y php-cli php-common php-mbstring php-xml php-curl php-zip unzip",
6425
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y php-cli php-common php-mbstring php-xml php-curl php-zip unzip",
6426
6426
  checkCmd: "dpkg -s php-cli"
6427
6427
  },
6428
6428
  {
@@ -6464,7 +6464,7 @@ async function resolveLinux5() {
6464
6464
  {
6465
6465
  id: "install-php-sqlite",
6466
6466
  label: "Install PHP SQLite extension",
6467
- cmd: "sudo apt-get update && sudo apt-get install -y php-sqlite3",
6467
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y php-sqlite3",
6468
6468
  checkCmd: "dpkg -s php-sqlite3"
6469
6469
  }
6470
6470
  ];
@@ -6486,8 +6486,96 @@ var PhpSqliteRecipe = {
6486
6486
  }
6487
6487
  };
6488
6488
 
6489
+ // src/recipes/mysql.ts
6490
+ async function resolveDarwin6(ctx) {
6491
+ const installSteps = [
6492
+ {
6493
+ id: "install-mariadb",
6494
+ label: "Install MariaDB",
6495
+ cmd: "brew install mariadb",
6496
+ checkCmd: "brew list --versions mariadb"
6497
+ },
6498
+ {
6499
+ id: "start-mariadb",
6500
+ label: "Start MariaDB service",
6501
+ cmd: "brew services start mariadb",
6502
+ checkCmd: "mysqladmin ping -u root 2>/dev/null"
6503
+ },
6504
+ {
6505
+ id: "wait-for-mariadb",
6506
+ label: "Wait for MariaDB to be ready",
6507
+ cmd: 'for i in 1 2 3 4 5 6 7 8 9 10; do mysqladmin ping -u root 2>/dev/null && exit 0; sleep 1; done; echo "MariaDB did not start"; exit 1'
6508
+ }
6509
+ ];
6510
+ if (ctx.preset) {
6511
+ installSteps.push({
6512
+ id: "create-database",
6513
+ label: `Create database '${ctx.preset}'`,
6514
+ cmd: `mariadb -u root -e "CREATE DATABASE IF NOT EXISTS \`${ctx.preset}\`"`,
6515
+ checkCmd: `mariadb -u root -e "SHOW DATABASES" | grep -q "^${ctx.preset}$"`
6516
+ });
6517
+ }
6518
+ const env = {
6519
+ MYSQL_HOST: "127.0.0.1"
6520
+ };
6521
+ return ExecutionPlanSchema.parse({ installSteps, env, paths: [] });
6522
+ }
6523
+ async function resolveLinux6(ctx) {
6524
+ const installSteps = [
6525
+ {
6526
+ id: "install-mariadb",
6527
+ label: "Install MariaDB",
6528
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y mariadb-server mariadb-client",
6529
+ checkCmd: "dpkg -s mariadb-server"
6530
+ },
6531
+ {
6532
+ id: "start-mariadb",
6533
+ label: "Start MariaDB service",
6534
+ cmd: `sudo mkdir -p /run/mysqld && sudo chown mysql:mysql /run/mysqld && if command -v systemctl >/dev/null 2>&1 && systemctl is-system-running 2>/dev/null | grep -qE "running|degraded"; then sudo systemctl enable --now mariadb; else sudo mysqld_safe --skip-syslog & fi`,
6535
+ checkCmd: "mysqladmin ping 2>/dev/null"
6536
+ },
6537
+ {
6538
+ id: "wait-for-mariadb",
6539
+ label: "Wait for MariaDB to be ready",
6540
+ cmd: 'for i in 1 2 3 4 5 6 7 8 9 10; do mysqladmin ping 2>/dev/null && exit 0; sleep 1; done; echo "MariaDB did not start"; exit 1'
6541
+ },
6542
+ {
6543
+ id: "setup-user",
6544
+ label: "Create MariaDB user for current user",
6545
+ cmd: `sudo mariadb -e "CREATE USER IF NOT EXISTS '$(whoami)'@'localhost' IDENTIFIED VIA unix_socket; GRANT ALL PRIVILEGES ON *.* TO '$(whoami)'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES;"`,
6546
+ checkCmd: 'mariadb -e "SELECT 1" 2>/dev/null'
6547
+ }
6548
+ ];
6549
+ if (ctx.preset) {
6550
+ installSteps.push({
6551
+ id: "create-database",
6552
+ label: `Create database '${ctx.preset}'`,
6553
+ cmd: `mariadb -e "CREATE DATABASE IF NOT EXISTS \`${ctx.preset}\`"`,
6554
+ checkCmd: `mariadb -e "SHOW DATABASES" | grep -q "^${ctx.preset}$"`
6555
+ });
6556
+ }
6557
+ const env = {
6558
+ MYSQL_HOST: "localhost"
6559
+ };
6560
+ return ExecutionPlanSchema.parse({ installSteps, env, paths: [] });
6561
+ }
6562
+ var MysqlRecipe = {
6563
+ name: "mysql",
6564
+ description: "MySQL compatible relational database (MariaDB)",
6565
+ resolve: async (ctx) => {
6566
+ switch (process.platform) {
6567
+ case "darwin":
6568
+ return resolveDarwin6(ctx);
6569
+ case "linux":
6570
+ return resolveLinux6(ctx);
6571
+ default:
6572
+ throw new Error(`Unsupported platform: ${process.platform}`);
6573
+ }
6574
+ }
6575
+ };
6576
+
6489
6577
  // src/recipes/laravel.ts
6490
- async function resolveDarwin6() {
6578
+ async function resolveDarwin7() {
6491
6579
  const installSteps = [
6492
6580
  {
6493
6581
  id: "install-laravel-installer",
@@ -6498,7 +6586,7 @@ async function resolveDarwin6() {
6498
6586
  ];
6499
6587
  return ExecutionPlanSchema.parse({ installSteps, env: {}, paths: [] });
6500
6588
  }
6501
- async function resolveLinux6() {
6589
+ async function resolveLinux7() {
6502
6590
  const installSteps = [
6503
6591
  {
6504
6592
  id: "install-laravel-installer",
@@ -6516,9 +6604,9 @@ var LaravelRecipe = {
6516
6604
  resolve: async (ctx) => {
6517
6605
  switch (process.platform) {
6518
6606
  case "darwin":
6519
- return resolveDarwin6();
6607
+ return resolveDarwin7();
6520
6608
  case "linux":
6521
- return resolveLinux6();
6609
+ return resolveLinux7();
6522
6610
  default:
6523
6611
  throw new Error(`Unsupported platform: ${process.platform}`);
6524
6612
  }
@@ -6569,7 +6657,7 @@ var ollama_default = {
6569
6657
  {
6570
6658
  id: "install-zstd",
6571
6659
  label: "Install zstd",
6572
- cmd: "sudo apt-get update && sudo apt-get install -y zstd",
6660
+ cmd: "(sudo apt-get update || true) && sudo apt-get install -y zstd",
6573
6661
  checkCmd: "dpkg -s zstd"
6574
6662
  },
6575
6663
  {
@@ -6604,7 +6692,7 @@ var ollama_default = {
6604
6692
  // package.json
6605
6693
  var package_default = {
6606
6694
  name: "@_davideast/jules-env",
6607
- version: "0.2.1",
6695
+ version: "0.2.3",
6608
6696
  description: "Configure ephemeral development environments",
6609
6697
  license: "Apache-2.0",
6610
6698
  type: "module",
@@ -6654,6 +6742,7 @@ var recipes = {
6654
6742
  ruby: RubyRecipe,
6655
6743
  php: PhpRecipe,
6656
6744
  "php-sqlite": PhpSqliteRecipe,
6745
+ mysql: MysqlRecipe,
6657
6746
  laravel: LaravelRecipe,
6658
6747
  ollama: loadDataRecipe(ollama_default)
6659
6748
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_davideast/jules-env",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Configure ephemeral development environments",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",