codex-wakatime 1.1.0 → 1.1.1

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/README.md CHANGED
@@ -39,6 +39,8 @@ codex-wakatime --install
39
39
  ```
40
40
 
41
41
  This adds `notify = ["codex-wakatime"]` to your `~/.codex/config.toml`.
42
+ If you already have a `notify` command configured, codex-wakatime replaces it
43
+ because Codex supports a single notify command.
42
44
 
43
45
  ## How It Works
44
46
 
package/dist/index.cjs CHANGED
@@ -435,20 +435,15 @@ function formatTomlValue(value) {
435
435
  }
436
436
  return String(value);
437
437
  }
438
- function normalizeNotifyValue(value) {
439
- if (Array.isArray(value)) return value.slice();
440
- if (typeof value === "string") return [value];
441
- return [];
442
- }
443
- function hasNotifyEntry(entries, command) {
444
- return entries.some(
445
- (entry) => typeof entry === "string" && entry === command
446
- );
447
- }
448
- function removeNotifyEntry(entries, command) {
449
- return entries.filter(
450
- (entry) => !(typeof entry === "string" && entry === command)
451
- );
438
+ function normalizeNotifyCommand(value) {
439
+ if (Array.isArray(value)) {
440
+ const entries = value.filter(
441
+ (entry) => typeof entry === "string" && entry.length > 0
442
+ );
443
+ return entries.length > 0 ? entries : void 0;
444
+ }
445
+ if (typeof value === "string" && value.length > 0) return [value];
446
+ return void 0;
452
447
  }
453
448
  function getPluginCommand() {
454
449
  return ["codex-wakatime"];
@@ -471,12 +466,17 @@ function installHook() {
471
466
  }
472
467
  }
473
468
  const pluginCommand = getPluginCommand()[0];
474
- const existingNotify = normalizeNotifyValue(config.notify);
475
- if (hasNotifyEntry(existingNotify, pluginCommand)) {
469
+ const existingNotify = normalizeNotifyCommand(config.notify);
470
+ if (existingNotify?.[0] === pluginCommand) {
476
471
  console.log("codex-wakatime is already configured");
477
472
  return;
478
473
  }
479
- config.notify = [...existingNotify, pluginCommand];
474
+ if (existingNotify && existingNotify.length > 0) {
475
+ console.warn(
476
+ "Existing Codex notify command found; replacing with codex-wakatime"
477
+ );
478
+ }
479
+ config.notify = [pluginCommand];
480
480
  const newContent = stringifyToml(config);
481
481
  fs.writeFileSync(CODEX_CONFIG_PATH, newContent);
482
482
  console.log(`Updated ${CODEX_CONFIG_PATH}`);
@@ -496,17 +496,12 @@ function uninstallHook() {
496
496
  const content = fs.readFileSync(CODEX_CONFIG_PATH, "utf-8");
497
497
  const config = parseToml(content);
498
498
  const pluginCommand = getPluginCommand()[0];
499
- const existingNotify = normalizeNotifyValue(config.notify);
500
- if (!hasNotifyEntry(existingNotify, pluginCommand)) {
499
+ const existingNotify = normalizeNotifyCommand(config.notify);
500
+ if (!existingNotify || existingNotify[0] !== pluginCommand) {
501
501
  console.log("codex-wakatime was not configured");
502
502
  return;
503
503
  }
504
- const updatedNotify = removeNotifyEntry(existingNotify, pluginCommand);
505
- if (updatedNotify.length === 0) {
506
- delete config.notify;
507
- } else {
508
- config.notify = updatedNotify;
509
- }
504
+ delete config.notify;
510
505
  const newContent = stringifyToml(config);
511
506
  fs.writeFileSync(CODEX_CONFIG_PATH, newContent);
512
507
  console.log("codex-wakatime notification hook removed");
@@ -661,7 +656,7 @@ var os6 = __toESM(require("node:os"), 1);
661
656
  var package_default = {
662
657
  $schema: "https://json.schemastore.org/package.json",
663
658
  name: "codex-wakatime",
664
- version: "1.1.0",
659
+ version: "1.1.1",
665
660
  description: "WakaTime plugin for OpenAI Codex CLI - Track AI coding activity and time spent",
666
661
  repository: {
667
662
  type: "git",
@@ -701,6 +696,8 @@ var package_default = {
701
696
  license: "MIT",
702
697
  devDependencies: {
703
698
  "@biomejs/biome": "^2.3.10",
699
+ "@commitlint/cli": "^20.2.0",
700
+ "@commitlint/config-conventional": "^20.2.0",
704
701
  "@semantic-release/changelog": "^6.0.3",
705
702
  "@semantic-release/git": "^10.0.1",
706
703
  "@types/node": "^22.0.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "codex-wakatime",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "description": "WakaTime plugin for OpenAI Codex CLI - Track AI coding activity and time spent",
6
6
  "repository": {
7
7
  "type": "git",
@@ -41,6 +41,8 @@
41
41
  "license": "MIT",
42
42
  "devDependencies": {
43
43
  "@biomejs/biome": "^2.3.10",
44
+ "@commitlint/cli": "^20.2.0",
45
+ "@commitlint/config-conventional": "^20.2.0",
44
46
  "@semantic-release/changelog": "^6.0.3",
45
47
  "@semantic-release/git": "^10.0.1",
46
48
  "@types/node": "^22.0.0",