ccc-notifier 0.6.1 → 0.6.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.
@@ -246,6 +246,10 @@ var DEFAULT_BUDGET_USD = 400;
246
246
  function isPlainObject2(v) {
247
247
  return typeof v === "object" && v !== null && !Array.isArray(v);
248
248
  }
249
+ function maskWebhookUrl(url) {
250
+ if (url.length <= 40) return url;
251
+ return `${url.slice(0, 34)}\u2026${url.slice(-4)}`;
252
+ }
249
253
  function settingsPath() {
250
254
  return process.env.CCCN_CLAUDE_SETTINGS || join2(homedir(), ".claude", "settings.json");
251
255
  }
@@ -547,19 +551,36 @@ async function runInit(argv) {
547
551
  return 1;
548
552
  }
549
553
  if (channel === "both" || channel === "slack") {
550
- const webhook = await p.text({
551
- message: "Slack Incoming Webhook URL",
552
- placeholder: "https://hooks.slack.com/services/...",
553
- validate: (v) => !v || !v.startsWith("https://") ? "https:// \u3067\u59CB\u307E\u308B URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044" : void 0
554
- });
555
- if (p.isCancel(webhook)) {
556
- p.cancel("\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3057\u305F");
557
- return 1;
554
+ const existingSlack = cfg.notify.slack;
555
+ let webhookUrl;
556
+ if (existingSlack?.webhookUrl) {
557
+ const reuse = await p.confirm({
558
+ message: `\u8A2D\u5B9A\u6E08\u307F\u306E Slack Webhook URL(${maskWebhookUrl(existingSlack.webhookUrl)})\u3092\u305D\u306E\u307E\u307E\u4F7F\u3044\u307E\u3059\u304B?`,
559
+ initialValue: true
560
+ });
561
+ if (p.isCancel(reuse)) {
562
+ p.cancel("\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3057\u305F");
563
+ return 1;
564
+ }
565
+ if (reuse) webhookUrl = existingSlack.webhookUrl;
566
+ }
567
+ if (webhookUrl === void 0) {
568
+ const webhook = await p.text({
569
+ message: "Slack Incoming Webhook URL",
570
+ placeholder: "https://hooks.slack.com/services/...",
571
+ validate: (v) => !v || !v.startsWith("https://") ? "https:// \u3067\u59CB\u307E\u308B URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044" : void 0
572
+ });
573
+ if (p.isCancel(webhook)) {
574
+ p.cancel("\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u307E\u3057\u305F");
575
+ return 1;
576
+ }
577
+ webhookUrl = webhook;
558
578
  }
559
579
  cfg.notify.slack = {
560
- webhookUrl: webhook,
561
- promptChars: SLACK_PROMPT_CHARS,
562
- sendFullPrompt: false
580
+ webhookUrl,
581
+ // promptChars / sendFullPrompt は手動カスタマイズされていることがあるため再 init で維持する。
582
+ promptChars: existingSlack?.promptChars ?? SLACK_PROMPT_CHARS,
583
+ sendFullPrompt: existingSlack?.sendFullPrompt ?? false
563
584
  };
564
585
  cfg.notify.os = channel === "both";
565
586
  } else {
@@ -734,6 +755,7 @@ export {
734
755
  CODEX_HOOK_EVENTS,
735
756
  CODEX_HOOK_TIMEOUT_SECONDS,
736
757
  parseConfiguredOwnedCodexHookCommand,
758
+ maskWebhookUrl,
737
759
  matchesMarker,
738
760
  runInit,
739
761
  runUninstall
package/dist/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  CODEX_HOOK_TIMEOUT_SECONDS,
8
8
  matchesMarker,
9
9
  parseConfiguredOwnedCodexHookCommand
10
- } from "./chunk-CH34OJ7Q.js";
10
+ } from "./chunk-OXXDZZPJ.js";
11
11
  import {
12
12
  notifyOS,
13
13
  notifySlack,
@@ -1000,11 +1000,11 @@ async function main(argv) {
1000
1000
  return 0;
1001
1001
  }
1002
1002
  case "init": {
1003
- const { runInit } = await import("./setup-3SRNQ5PG.js");
1003
+ const { runInit } = await import("./setup-I3JNGWZG.js");
1004
1004
  return await runInit(rest);
1005
1005
  }
1006
1006
  case "uninstall": {
1007
- const { runUninstall } = await import("./setup-3SRNQ5PG.js");
1007
+ const { runUninstall } = await import("./setup-I3JNGWZG.js");
1008
1008
  return await runUninstall(rest);
1009
1009
  }
1010
1010
  case "doctor":
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ maskWebhookUrl,
3
4
  matchesMarker,
4
5
  runInit,
5
6
  runUninstall
6
- } from "./chunk-CH34OJ7Q.js";
7
+ } from "./chunk-OXXDZZPJ.js";
7
8
  import "./chunk-NV5UOHJA.js";
8
9
  import "./chunk-HTYUYKFW.js";
9
10
  import "./chunk-6HTETN26.js";
@@ -11,6 +12,7 @@ import "./chunk-DGXUSPS4.js";
11
12
  import "./chunk-J5QAYTFE.js";
12
13
  import "./chunk-OOAC5ULQ.js";
13
14
  export {
15
+ maskWebhookUrl,
14
16
  matchesMarker,
15
17
  runInit,
16
18
  runUninstall
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccc-notifier",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Claude Code Cost notifier (now also covers Codex CLI): per-prompt cost notifications (USD/JPY) with local history and HTML dashboard",
5
5
  "keywords": [
6
6
  "claude",