@workscribe/cli 1.15.1 → 1.15.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/dist/index.js CHANGED
@@ -769,13 +769,17 @@ function ensureInstallId(config) {
769
769
  return installId;
770
770
  }
771
771
  function ensureTelemetryFallback() {
772
- const config = readConfig();
773
- if (config.telemetry.installId) return;
774
- config.telemetry.enabled = true;
775
- config.telemetry.installId = ensureInstallId(config);
776
- process.stderr.write(
777
- "\n Workscribe collects anonymous install stats (install ID, CLI version, platform, Node version).\n Opt out: workscribe config set telemetry.enabled false\n\n"
778
- );
772
+ try {
773
+ const config = readConfig();
774
+ if (config.telemetry.installId) return;
775
+ config.telemetry.enabled = true;
776
+ config.telemetry.installId = ensureInstallId(config);
777
+ process.stderr.write(
778
+ "\n Workscribe collects anonymous install stats (install ID, CLI version, platform, Node version).\n Opt out: workscribe config set telemetry.enabled false\n\n"
779
+ );
780
+ } catch (error) {
781
+ debugLog("ensureTelemetryFallback", error);
782
+ }
779
783
  }
780
784
  function getConfigValue(config, key) {
781
785
  const parts = key.split(".");
@@ -824,6 +828,7 @@ var init_config = __esm({
824
828
  import_fs7 = __toESM(require("fs"));
825
829
  import_path5 = __toESM(require("path"));
826
830
  init_paths();
831
+ init_logger();
827
832
  DEFAULTS = {
828
833
  ai: {
829
834
  provider: "",
@@ -3230,18 +3235,23 @@ function registerSummary(program) {
3230
3235
  const payload = { weekStart, weekEnd: today, days: weeklyDays };
3231
3236
  log.plain("");
3232
3237
  log.info(`Generating weekly summary via ${import_chalk6.default.cyan(config.ai.provider)}\u2026`);
3238
+ let summary;
3233
3239
  try {
3234
- const summary = provider.summarizeWeek ? await provider.summarizeWeek(payload) : await provider.summarize({ date: today, sessions: weeklyDays.flatMap((day) => day.sessions) });
3235
- log.plain("");
3236
- log.plain(summary);
3237
- log.plain("");
3238
- import_fs16.default.mkdirSync(WEEKLY_CACHE_DIR, { recursive: true });
3239
- import_fs16.default.writeFileSync(cacheFile, summary, { encoding: "utf-8", mode: 384 });
3240
- await handleWebhook(opts, config, summary);
3240
+ summary = provider.summarizeWeek ? await provider.summarizeWeek(payload) : await provider.summarize({ date: today, sessions: weeklyDays.flatMap((day) => day.sessions) });
3241
3241
  } catch (error) {
3242
3242
  log.error(`Weekly summary failed [${config.ai.provider}]: ${error.message}`);
3243
3243
  process.exit(1);
3244
3244
  }
3245
+ log.plain("");
3246
+ log.plain(summary);
3247
+ log.plain("");
3248
+ try {
3249
+ import_fs16.default.mkdirSync(WEEKLY_CACHE_DIR, { recursive: true });
3250
+ import_fs16.default.writeFileSync(cacheFile, summary, { encoding: "utf-8", mode: 384 });
3251
+ } catch (error) {
3252
+ debugLog("weekly-summary-cache", error);
3253
+ }
3254
+ await handleWebhook(opts, config, summary);
3245
3255
  return;
3246
3256
  }
3247
3257
  let date = todayDate();
@@ -4058,18 +4068,23 @@ function registerWeek(program) {
4058
4068
  const payload = { weekStart, weekEnd: today, days: weeklyDays };
4059
4069
  log.plain("");
4060
4070
  log.info(`Generating weekly digest via ${import_chalk11.default.cyan(config.ai.provider)}\u2026`);
4071
+ let summary;
4061
4072
  try {
4062
- const summary = provider.summarizeWeek ? await provider.summarizeWeek(payload) : await provider.summarize({ date: today, sessions: weeklyDays.flatMap((day) => day.sessions) });
4063
- log.plain("");
4064
- log.plain(summary);
4065
- log.plain("");
4066
- import_fs21.default.mkdirSync(WEEKLY_CACHE_DIR, { recursive: true });
4067
- import_fs21.default.writeFileSync(cacheFile, summary, { encoding: "utf-8", mode: 384 });
4068
- await postSummary(opts, config, summary);
4073
+ summary = provider.summarizeWeek ? await provider.summarizeWeek(payload) : await provider.summarize({ date: today, sessions: weeklyDays.flatMap((day) => day.sessions) });
4069
4074
  } catch (error) {
4070
4075
  log.error(`Weekly digest failed [${config.ai.provider}]: ${error.message}`);
4071
4076
  process.exit(1);
4072
4077
  }
4078
+ log.plain("");
4079
+ log.plain(summary);
4080
+ log.plain("");
4081
+ try {
4082
+ import_fs21.default.mkdirSync(WEEKLY_CACHE_DIR, { recursive: true });
4083
+ import_fs21.default.writeFileSync(cacheFile, summary, { encoding: "utf-8", mode: 384 });
4084
+ } catch (error) {
4085
+ debugLog("weekly-digest-cache", error);
4086
+ }
4087
+ await postSummary(opts, config, summary);
4073
4088
  });
4074
4089
  }
4075
4090
  var import_chalk11, import_fs21, import_path16, import_os8;
@@ -4114,7 +4129,7 @@ function registerBugReport(program) {
4114
4129
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
4115
4130
  const reportPath = import_path17.default.join(WORKSCRIBE_DIR, `bug-report-${timestamp}.txt`);
4116
4131
  const systemInfo = [
4117
- `Workscribe version : ${"1.15.1"}`,
4132
+ `Workscribe version : ${"1.15.2"}`,
4118
4133
  `Node.js version : ${process.version}`,
4119
4134
  `Platform : ${process.platform}`,
4120
4135
  `Architecture : ${process.arch}`,
@@ -4145,7 +4160,7 @@ function registerBugReport(program) {
4145
4160
  process.exit(1);
4146
4161
  }
4147
4162
  const params = new URLSearchParams({
4148
- title: `Bug report \u2014 workscribe ${"1.15.1"}`,
4163
+ title: `Bug report \u2014 workscribe ${"1.15.2"}`,
4149
4164
  body: `<!-- Attach ${import_path17.default.basename(reportPath)} or paste the relevant sections below -->
4150
4165
 
4151
4166
  **Describe the issue:**
@@ -4345,7 +4360,7 @@ function isNewer(latest, current) {
4345
4360
  return latestPatch > currentPatch;
4346
4361
  }
4347
4362
  function checkForUpdate() {
4348
- const current = "1.15.1";
4363
+ const current = "1.15.2";
4349
4364
  const cache = readCache();
4350
4365
  if (cache && isNewer(cache.latestVersion, current)) {
4351
4366
  process.stderr.write(
@@ -4368,7 +4383,7 @@ function checkForUpdate() {
4368
4383
  function buildTelemetryPayload(config) {
4369
4384
  return {
4370
4385
  installId: config.telemetry.installId,
4371
- cliVersion: "1.15.1",
4386
+ cliVersion: "1.15.2",
4372
4387
  platform: import_os10.default.platform(),
4373
4388
  nodeVersion: process.version
4374
4389
  };
@@ -4383,7 +4398,14 @@ function pingTelemetry() {
4383
4398
  method: "POST",
4384
4399
  headers: { "Content-Type": "application/json" },
4385
4400
  body: JSON.stringify(buildTelemetryPayload(config))
4386
- }).then(() => writeCache({ lastTelemetryPing: now })).catch(() => {
4401
+ }).then((response) => {
4402
+ if (!response.ok) {
4403
+ debugLog("pingTelemetry", new Error(`Ping failed with HTTP ${response.status}`));
4404
+ return;
4405
+ }
4406
+ writeCache({ lastTelemetryPing: now });
4407
+ }).catch((error) => {
4408
+ debugLog("pingTelemetry", error);
4387
4409
  });
4388
4410
  }
4389
4411
  var import_fs23, import_os10, CHECK_INTERVAL_MS;
@@ -4394,6 +4416,7 @@ var init_update_check = __esm({
4394
4416
  import_os10 = __toESM(require("os"));
4395
4417
  init_paths();
4396
4418
  init_config();
4419
+ init_logger();
4397
4420
  CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
4398
4421
  }
4399
4422
  });
@@ -4434,7 +4457,7 @@ var require_main = __commonJS({
4434
4457
  pingTelemetry();
4435
4458
  }
4436
4459
  var program = new import_commander.Command();
4437
- program.name("workscribe").description("Automatic developer work journal").version("1.15.1");
4460
+ program.name("workscribe").description("Automatic developer work journal").version("1.15.2");
4438
4461
  registerCapture(program);
4439
4462
  registerHook(program);
4440
4463
  registerInit(program);