@workscribe/cli 1.15.2 → 1.15.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.
package/dist/index.js CHANGED
@@ -187,7 +187,11 @@ var init_migrations = __esm({
187
187
  function getDb() {
188
188
  if (_db) return _db;
189
189
  if (!import_fs2.default.existsSync(WORKSCRIBE_DIR)) {
190
- import_fs2.default.mkdirSync(WORKSCRIBE_DIR, { recursive: true });
190
+ try {
191
+ import_fs2.default.mkdirSync(WORKSCRIBE_DIR, { recursive: true });
192
+ } catch (error) {
193
+ throw new Error(`Could not create data directory ${WORKSCRIBE_DIR}: ${error.message}`);
194
+ }
191
195
  }
192
196
  const db = new import_node_sqlite.DatabaseSync(DB_PATH);
193
197
  try {
@@ -745,13 +749,13 @@ var init_registry = __esm({
745
749
 
746
750
  // src/config/index.ts
747
751
  function readConfig() {
748
- if (!import_fs7.default.existsSync(CONFIG_PATH)) return { ...DEFAULTS };
752
+ if (!import_fs7.default.existsSync(CONFIG_PATH)) return deepMerge(DEFAULTS, {});
749
753
  try {
750
754
  const raw = import_fs7.default.readFileSync(CONFIG_PATH, "utf-8");
751
755
  const parsed = JSON.parse(raw);
752
756
  return deepMerge(DEFAULTS, parsed);
753
757
  } catch {
754
- return { ...DEFAULTS };
758
+ return deepMerge(DEFAULTS, {});
755
759
  }
756
760
  }
757
761
  function writeConfig(config) {
@@ -809,7 +813,7 @@ function setConfigValue(config, key, value) {
809
813
  return result;
810
814
  }
811
815
  function deepMerge(defaults, overrides) {
812
- const result = { ...defaults };
816
+ const result = structuredClone(defaults);
813
817
  for (const key of Object.keys(overrides)) {
814
818
  const val = overrides[key];
815
819
  if (val !== null && typeof val === "object" && !Array.isArray(val) && typeof defaults[key] === "object") {
@@ -4129,7 +4133,7 @@ function registerBugReport(program) {
4129
4133
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
4130
4134
  const reportPath = import_path17.default.join(WORKSCRIBE_DIR, `bug-report-${timestamp}.txt`);
4131
4135
  const systemInfo = [
4132
- `Workscribe version : ${"1.15.2"}`,
4136
+ `Workscribe version : ${"1.15.3"}`,
4133
4137
  `Node.js version : ${process.version}`,
4134
4138
  `Platform : ${process.platform}`,
4135
4139
  `Architecture : ${process.arch}`,
@@ -4160,7 +4164,7 @@ function registerBugReport(program) {
4160
4164
  process.exit(1);
4161
4165
  }
4162
4166
  const params = new URLSearchParams({
4163
- title: `Bug report \u2014 workscribe ${"1.15.2"}`,
4167
+ title: `Bug report \u2014 workscribe ${"1.15.3"}`,
4164
4168
  body: `<!-- Attach ${import_path17.default.basename(reportPath)} or paste the relevant sections below -->
4165
4169
 
4166
4170
  **Describe the issue:**
@@ -4360,7 +4364,7 @@ function isNewer(latest, current) {
4360
4364
  return latestPatch > currentPatch;
4361
4365
  }
4362
4366
  function checkForUpdate() {
4363
- const current = "1.15.2";
4367
+ const current = "1.15.3";
4364
4368
  const cache = readCache();
4365
4369
  if (cache && isNewer(cache.latestVersion, current)) {
4366
4370
  process.stderr.write(
@@ -4383,7 +4387,7 @@ function checkForUpdate() {
4383
4387
  function buildTelemetryPayload(config) {
4384
4388
  return {
4385
4389
  installId: config.telemetry.installId,
4386
- cliVersion: "1.15.2",
4390
+ cliVersion: "1.15.3",
4387
4391
  platform: import_os10.default.platform(),
4388
4392
  nodeVersion: process.version
4389
4393
  };
@@ -4448,6 +4452,7 @@ var require_main = __commonJS({
4448
4452
  init_context();
4449
4453
  init_update_check();
4450
4454
  init_config();
4455
+ init_logger();
4451
4456
  var invokedCommand = process.argv[2];
4452
4457
  if (shouldRunStartupChecks(invokedCommand)) {
4453
4458
  checkForUpdate();
@@ -4457,7 +4462,7 @@ var require_main = __commonJS({
4457
4462
  pingTelemetry();
4458
4463
  }
4459
4464
  var program = new import_commander.Command();
4460
- program.name("workscribe").description("Automatic developer work journal").version("1.15.2");
4465
+ program.name("workscribe").description("Automatic developer work journal").version("1.15.3");
4461
4466
  registerCapture(program);
4462
4467
  registerHook(program);
4463
4468
  registerInit(program);
@@ -4478,7 +4483,10 @@ var require_main = __commonJS({
4478
4483
  registerCompletions(program);
4479
4484
  registerAlerts(program);
4480
4485
  registerContext(program);
4481
- program.parse();
4486
+ program.parseAsync().catch((error) => {
4487
+ log.error(error instanceof Error ? error.message : String(error));
4488
+ process.exit(1);
4489
+ });
4482
4490
  }
4483
4491
  });
4484
4492