ccjk 12.0.0 → 12.0.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/chunks/agent-teams.mjs +17 -18
- package/dist/chunks/agent.mjs +105 -102
- package/dist/chunks/agents.mjs +87 -77
- package/dist/chunks/api-cli.mjs +41 -27
- package/dist/chunks/api-providers.mjs +2 -4
- package/dist/chunks/api.mjs +22 -11
- package/dist/chunks/auto-bootstrap.mjs +3 -5
- package/dist/chunks/auto-init.mjs +3 -4
- package/dist/chunks/auto-updater.mjs +103 -91
- package/dist/chunks/banner.mjs +41 -42
- package/dist/chunks/boost.mjs +30 -31
- package/dist/chunks/ccjk-agents.mjs +6 -9
- package/dist/chunks/ccjk-all.mjs +703 -85
- package/dist/chunks/ccjk-config.mjs +6 -6
- package/dist/chunks/ccjk-hooks.mjs +20 -9
- package/dist/chunks/ccjk-mcp.mjs +64 -52
- package/dist/chunks/ccjk-setup.mjs +35 -25
- package/dist/chunks/ccjk-skills.mjs +51 -41
- package/dist/chunks/ccr.mjs +42 -32
- package/dist/chunks/ccu.mjs +16 -12
- package/dist/chunks/check-updates.mjs +30 -19
- package/dist/chunks/claude-code-config-manager.mjs +25 -10
- package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
- package/dist/chunks/claude-config.mjs +2 -2
- package/dist/chunks/claude-wrapper.mjs +9 -6
- package/dist/chunks/cleanup-migration.mjs +1 -1
- package/dist/chunks/cli-hook.mjs +10 -3
- package/dist/chunks/cloud-sync.mjs +1 -1
- package/dist/chunks/codex-config-switch.mjs +58 -45
- package/dist/chunks/codex-provider-manager.mjs +29 -16
- package/dist/chunks/codex-uninstaller.mjs +5 -6
- package/dist/chunks/codex.mjs +89 -89
- package/dist/chunks/commands.mjs +28 -29
- package/dist/chunks/commands2.mjs +4 -3
- package/dist/chunks/commit.mjs +42 -23
- package/dist/chunks/completion.mjs +46 -47
- package/dist/chunks/config-consolidator.mjs +12 -13
- package/dist/chunks/config-switch.mjs +66 -53
- package/dist/chunks/config.mjs +10 -10
- package/dist/chunks/config2.mjs +53 -42
- package/dist/chunks/config3.mjs +107 -93
- package/dist/chunks/constants.mjs +2 -4
- package/dist/chunks/context-loader.mjs +5 -4
- package/dist/chunks/context.mjs +77 -76
- package/dist/chunks/convoy-manager.mjs +4 -4
- package/dist/chunks/dashboard.mjs +28 -29
- package/dist/chunks/doctor.mjs +68 -54
- package/dist/chunks/evolution.mjs +37 -38
- package/dist/chunks/features.mjs +103 -92
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +1 -1
- package/dist/chunks/health-check.mjs +1 -1
- package/dist/chunks/help.mjs +117 -116
- package/dist/chunks/hook-installer.mjs +3 -2
- package/dist/chunks/index.mjs +20 -6
- package/dist/chunks/index10.mjs +1171 -0
- package/dist/chunks/index11.mjs +1008 -0
- package/dist/chunks/index12.mjs +193 -0
- package/dist/chunks/index13.mjs +218 -0
- package/dist/chunks/index14.mjs +663 -0
- package/dist/chunks/index2.mjs +19 -10
- package/dist/chunks/index3.mjs +19079 -164
- package/dist/chunks/index4.mjs +8 -1171
- package/dist/chunks/index5.mjs +7479 -884
- package/dist/chunks/index6.mjs +160 -184
- package/dist/chunks/index7.mjs +3573 -653
- package/dist/chunks/index8.mjs +19 -0
- package/dist/chunks/index9.mjs +616 -0
- package/dist/chunks/init.mjs +173 -173
- package/dist/chunks/installer.mjs +92 -82
- package/dist/chunks/installer2.mjs +3 -2
- package/dist/chunks/interview.mjs +118 -107
- package/dist/chunks/json-config.mjs +3 -2
- package/dist/chunks/linux.mjs +3863 -0
- package/dist/chunks/macos.mjs +69 -0
- package/dist/chunks/main.mjs +635 -0
- package/dist/chunks/marketplace.mjs +69 -66
- package/dist/chunks/mcp-cli.mjs +61 -48
- package/dist/chunks/mcp.mjs +140 -127
- package/dist/chunks/menu.mjs +85 -85
- package/dist/chunks/metrics-display.mjs +41 -40
- package/dist/chunks/migrator.mjs +4 -5
- package/dist/chunks/monitor.mjs +95 -95
- package/dist/chunks/notification.mjs +151 -141
- package/dist/chunks/onboarding.mjs +26 -15
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/paradigm.mjs +24 -23
- package/dist/chunks/permission-manager.mjs +10 -11
- package/dist/chunks/permissions.mjs +72 -57
- package/dist/chunks/persistence-manager.mjs +97 -84
- package/dist/chunks/persistence.mjs +1 -1
- package/dist/chunks/platform.mjs +29 -29
- package/dist/chunks/plugin.mjs +104 -105
- package/dist/chunks/prompts.mjs +36 -25
- package/dist/chunks/providers.mjs +68 -69
- package/dist/chunks/quick-actions.mjs +71 -72
- package/dist/chunks/quick-provider.mjs +56 -40
- package/dist/chunks/quick-setup.mjs +71 -60
- package/dist/chunks/remote.mjs +21 -12
- package/dist/chunks/session.mjs +116 -103
- package/dist/chunks/sessions.mjs +29 -28
- package/dist/chunks/silent-updater.mjs +8 -10
- package/dist/chunks/simple-config.mjs +13 -10
- package/dist/chunks/skill.mjs +8560 -103
- package/dist/chunks/skills-sync.mjs +5212 -79
- package/dist/chunks/skills.mjs +105 -94
- package/dist/chunks/slash-commands.mjs +36 -37
- package/dist/chunks/smart-defaults.mjs +7 -3
- package/dist/chunks/smart-guide.mjs +1 -1
- package/dist/chunks/startup.mjs +2 -4
- package/dist/chunks/stats.mjs +41 -42
- package/dist/chunks/status.mjs +49 -50
- package/dist/chunks/team.mjs +24 -12
- package/dist/chunks/thinking.mjs +74 -63
- package/dist/chunks/trace.mjs +20 -19
- package/dist/chunks/uninstall.mjs +69 -56
- package/dist/chunks/update.mjs +39 -28
- package/dist/chunks/upgrade-manager.mjs +24 -18
- package/dist/chunks/version-checker.mjs +45 -41
- package/dist/chunks/vim.mjs +81 -69
- package/dist/chunks/windows.mjs +14 -0
- package/dist/chunks/workflows.mjs +15 -15
- package/dist/chunks/wsl.mjs +129 -0
- package/dist/chunks/zero-config.mjs +45 -34
- package/dist/cli.mjs +20 -20
- package/dist/index.mjs +41 -31
- package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
- package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
- package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
- package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
- package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
- package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
- package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
- package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
- package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
- package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
- package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
- package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
- package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
- package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
- package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
- package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
- package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
- package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
- package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
- package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
- package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
- package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
- package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
- package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
- package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
- package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
- package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
- package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
- package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
- package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
- package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
- package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
- package/package.json +31 -30
- package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
- package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import inquirer from '
|
|
3
|
-
import { i18n } from './
|
|
4
|
-
import { m as maskToken, a as isValidTokenFormat, c as generateDeviceToken, d as decryptToken, e as encryptToken, f as getDeviceInfo, i as isDeviceBound, g as getBindingStatus, u as unbindDevice, b as bindDevice, s as sendNotification } from '../shared/ccjk.
|
|
1
|
+
import a from './index2.mjs';
|
|
2
|
+
import { i as inquirer } from './index3.mjs';
|
|
3
|
+
import { i18n } from './index5.mjs';
|
|
4
|
+
import { m as maskToken, a as isValidTokenFormat, c as generateDeviceToken, d as decryptToken, e as encryptToken, f as getDeviceInfo, i as isDeviceBound, g as getBindingStatus, u as unbindDevice, b as bindDevice, s as sendNotification } from '../shared/ccjk.BDKUdmLk.mjs';
|
|
5
5
|
import { exec } from 'node:child_process';
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import fs__default from 'node:fs';
|
|
8
8
|
import * as os from 'node:os';
|
|
9
9
|
import os__default from 'node:os';
|
|
10
10
|
import * as path from 'node:path';
|
|
@@ -12,13 +12,23 @@ import path__default from 'node:path';
|
|
|
12
12
|
import process__default from 'node:process';
|
|
13
13
|
import { promisify } from 'node:util';
|
|
14
14
|
import { writeFileAtomic } from './fs-operations.mjs';
|
|
15
|
-
import { parse
|
|
15
|
+
import { p as parse } from '../shared/ccjk.BBtCGd_g.mjs';
|
|
16
|
+
import { stringify } from './index6.mjs';
|
|
17
|
+
import '../shared/ccjk.BAGoDD49.mjs';
|
|
18
|
+
import 'node:readline';
|
|
19
|
+
import 'stream';
|
|
20
|
+
import 'node:tty';
|
|
21
|
+
import 'node:async_hooks';
|
|
22
|
+
import '../shared/ccjk.Cjgrln_h.mjs';
|
|
23
|
+
import 'tty';
|
|
24
|
+
import 'fs';
|
|
25
|
+
import 'child_process';
|
|
26
|
+
import 'node:crypto';
|
|
27
|
+
import 'buffer';
|
|
28
|
+
import 'string_decoder';
|
|
16
29
|
import 'node:url';
|
|
17
|
-
import '
|
|
18
|
-
import 'i18next-fs-backend';
|
|
19
|
-
import 'pathe';
|
|
30
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
20
31
|
import 'node:buffer';
|
|
21
|
-
import 'node:crypto';
|
|
22
32
|
import 'node:fs/promises';
|
|
23
33
|
|
|
24
34
|
const execAsync = promisify(exec);
|
|
@@ -102,8 +112,8 @@ else:
|
|
|
102
112
|
});
|
|
103
113
|
} finally {
|
|
104
114
|
try {
|
|
105
|
-
if (
|
|
106
|
-
|
|
115
|
+
if (fs.existsSync(TEMP_NOTIFICATION_FILE)) {
|
|
116
|
+
fs.unlinkSync(TEMP_NOTIFICATION_FILE);
|
|
107
117
|
}
|
|
108
118
|
} catch {
|
|
109
119
|
}
|
|
@@ -258,10 +268,10 @@ else:
|
|
|
258
268
|
}
|
|
259
269
|
async function loadLocalNotificationConfig() {
|
|
260
270
|
try {
|
|
261
|
-
if (!
|
|
271
|
+
if (!fs.existsSync(CONFIG_FILE)) {
|
|
262
272
|
return { ...DEFAULT_CONFIG };
|
|
263
273
|
}
|
|
264
|
-
const content =
|
|
274
|
+
const content = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
265
275
|
const config = JSON.parse(content);
|
|
266
276
|
return {
|
|
267
277
|
...DEFAULT_CONFIG,
|
|
@@ -274,8 +284,8 @@ async function loadLocalNotificationConfig() {
|
|
|
274
284
|
}
|
|
275
285
|
async function saveLocalNotificationConfig(config) {
|
|
276
286
|
try {
|
|
277
|
-
if (!
|
|
278
|
-
|
|
287
|
+
if (!fs.existsSync(CONFIG_DIR)) {
|
|
288
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
279
289
|
}
|
|
280
290
|
const existingConfig = await loadLocalNotificationConfig();
|
|
281
291
|
const newConfig = { ...existingConfig, ...config };
|
|
@@ -450,13 +460,13 @@ const CONFIG_FILE_PATH = path__default.join(CCJK_CONFIG_DIR, "config.toml");
|
|
|
450
460
|
const SECRETS_FILE_PATH = path__default.join(CCJK_CONFIG_DIR, ".notification-secrets");
|
|
451
461
|
async function loadNotificationConfig() {
|
|
452
462
|
try {
|
|
453
|
-
if (!
|
|
454
|
-
|
|
463
|
+
if (!fs__default.existsSync(CCJK_CONFIG_DIR)) {
|
|
464
|
+
fs__default.mkdirSync(CCJK_CONFIG_DIR, { recursive: true });
|
|
455
465
|
}
|
|
456
|
-
if (!
|
|
466
|
+
if (!fs__default.existsSync(CONFIG_FILE_PATH)) {
|
|
457
467
|
return { ...DEFAULT_NOTIFICATION_CONFIG };
|
|
458
468
|
}
|
|
459
|
-
const configContent =
|
|
469
|
+
const configContent = fs__default.readFileSync(CONFIG_FILE_PATH, "utf-8");
|
|
460
470
|
const config = parse(configContent);
|
|
461
471
|
const notificationConfig = config.notification;
|
|
462
472
|
if (!notificationConfig) {
|
|
@@ -492,10 +502,10 @@ async function loadNotificationConfig() {
|
|
|
492
502
|
}
|
|
493
503
|
async function loadDeviceToken() {
|
|
494
504
|
try {
|
|
495
|
-
if (!
|
|
505
|
+
if (!fs__default.existsSync(SECRETS_FILE_PATH)) {
|
|
496
506
|
return null;
|
|
497
507
|
}
|
|
498
|
-
const secretsContent =
|
|
508
|
+
const secretsContent = fs__default.readFileSync(SECRETS_FILE_PATH, "utf-8");
|
|
499
509
|
const secrets = JSON.parse(secretsContent);
|
|
500
510
|
if (!secrets.deviceToken) {
|
|
501
511
|
return null;
|
|
@@ -508,12 +518,12 @@ async function loadDeviceToken() {
|
|
|
508
518
|
}
|
|
509
519
|
async function saveNotificationConfig(config) {
|
|
510
520
|
try {
|
|
511
|
-
if (!
|
|
512
|
-
|
|
521
|
+
if (!fs__default.existsSync(CCJK_CONFIG_DIR)) {
|
|
522
|
+
fs__default.mkdirSync(CCJK_CONFIG_DIR, { recursive: true });
|
|
513
523
|
}
|
|
514
524
|
let existingConfig = {};
|
|
515
|
-
if (
|
|
516
|
-
const configContent =
|
|
525
|
+
if (fs__default.existsSync(CONFIG_FILE_PATH)) {
|
|
526
|
+
const configContent = fs__default.readFileSync(CONFIG_FILE_PATH, "utf-8");
|
|
517
527
|
existingConfig = parse(configContent);
|
|
518
528
|
}
|
|
519
529
|
const notificationConfig = { ...config };
|
|
@@ -535,8 +545,8 @@ async function saveDeviceToken(token) {
|
|
|
535
545
|
try {
|
|
536
546
|
const encryptedToken = encryptToken(token);
|
|
537
547
|
let secrets = {};
|
|
538
|
-
if (
|
|
539
|
-
const secretsContent =
|
|
548
|
+
if (fs__default.existsSync(SECRETS_FILE_PATH)) {
|
|
549
|
+
const secretsContent = fs__default.readFileSync(SECRETS_FILE_PATH, "utf-8");
|
|
540
550
|
secrets = JSON.parse(secretsContent);
|
|
541
551
|
}
|
|
542
552
|
secrets.deviceToken = encryptedToken;
|
|
@@ -1048,11 +1058,11 @@ async function notificationCommand(action = "menu", args) {
|
|
|
1048
1058
|
break;
|
|
1049
1059
|
case "enable":
|
|
1050
1060
|
await enableNotifications();
|
|
1051
|
-
console.log(
|
|
1061
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:status.enabled")}`));
|
|
1052
1062
|
break;
|
|
1053
1063
|
case "disable":
|
|
1054
1064
|
await disableNotifications();
|
|
1055
|
-
console.log(
|
|
1065
|
+
console.log(a.yellow(`\u23F8\uFE0F ${i18n.t("notification:status.disabled")}`));
|
|
1056
1066
|
break;
|
|
1057
1067
|
case "channels":
|
|
1058
1068
|
await manageChannels();
|
|
@@ -1061,7 +1071,7 @@ async function notificationCommand(action = "menu", args) {
|
|
|
1061
1071
|
await configureThreshold();
|
|
1062
1072
|
break;
|
|
1063
1073
|
case "bind":
|
|
1064
|
-
console.log(
|
|
1074
|
+
console.log(a.yellow(i18n.t("notification:cloud.migrateToRemoteSetup")));
|
|
1065
1075
|
await handleBind(args?.[0]);
|
|
1066
1076
|
break;
|
|
1067
1077
|
case "unbind":
|
|
@@ -1087,19 +1097,19 @@ async function showNotificationMenu() {
|
|
|
1087
1097
|
const enabledChannels = await getEnabledChannels();
|
|
1088
1098
|
const cloudBound = isDeviceBound();
|
|
1089
1099
|
console.log("");
|
|
1090
|
-
console.log(
|
|
1100
|
+
console.log(a.bold.cyan(i18n.t("notification:menu.title")));
|
|
1091
1101
|
console.log("");
|
|
1092
|
-
const statusText = config.enabled ?
|
|
1093
|
-
console.log(` ${
|
|
1094
|
-
const cloudStatusText = cloudBound ?
|
|
1095
|
-
console.log(` ${
|
|
1102
|
+
const statusText = config.enabled ? a.green(i18n.t("notification:status.enabled")) : a.yellow(i18n.t("notification:status.disabled"));
|
|
1103
|
+
console.log(` ${a.dim(i18n.t("notification:menu.statusLabel"))} ${statusText}`);
|
|
1104
|
+
const cloudStatusText = cloudBound ? a.green(i18n.t("notification:cloud.bound")) : a.yellow(i18n.t("notification:cloud.notBound"));
|
|
1105
|
+
console.log(` ${a.dim(i18n.t("notification:cloud.statusLabel"))} ${cloudStatusText}`);
|
|
1096
1106
|
if (enabledChannels.length > 0) {
|
|
1097
1107
|
const channelNames = enabledChannels.map((ch) => i18n.t(`notification:channels.${ch}`)).join(", ");
|
|
1098
|
-
console.log(` ${
|
|
1108
|
+
console.log(` ${a.dim(i18n.t("notification:menu.channelsLabel"))} ${channelNames}`);
|
|
1099
1109
|
} else {
|
|
1100
|
-
console.log(` ${
|
|
1110
|
+
console.log(` ${a.dim(i18n.t("notification:menu.channelsLabel"))} ${a.yellow(i18n.t("notification:channels.noChannels"))}`);
|
|
1101
1111
|
}
|
|
1102
|
-
console.log(` ${
|
|
1112
|
+
console.log(` ${a.dim(i18n.t("notification:menu.thresholdLabel"))} ${config.threshold} ${i18n.t("notification:config.threshold.minutes", { count: config.threshold })}`);
|
|
1103
1113
|
console.log("");
|
|
1104
1114
|
const choices = [];
|
|
1105
1115
|
if (!cloudBound) {
|
|
@@ -1136,27 +1146,27 @@ async function showNotificationMenu() {
|
|
|
1136
1146
|
}
|
|
1137
1147
|
async function runConfigWizard() {
|
|
1138
1148
|
console.log("");
|
|
1139
|
-
console.log(
|
|
1140
|
-
console.log(
|
|
1149
|
+
console.log(a.bold.cyan(i18n.t("notification:config.wizard.title")));
|
|
1150
|
+
console.log(a.dim(i18n.t("notification:config.wizard.welcome")));
|
|
1141
1151
|
console.log("");
|
|
1142
|
-
console.log(
|
|
1152
|
+
console.log(a.yellow(i18n.t("notification:config.wizard.step1")));
|
|
1143
1153
|
const config = await initializeNotificationConfig();
|
|
1144
|
-
console.log(
|
|
1154
|
+
console.log(a.green(i18n.t("notification:config.wizard.tokenGenerated", { token: maskToken(config.deviceToken) })));
|
|
1145
1155
|
console.log("");
|
|
1146
|
-
console.log(
|
|
1156
|
+
console.log(a.yellow(i18n.t("notification:config.wizard.step2")));
|
|
1147
1157
|
const channels = await selectChannels();
|
|
1148
1158
|
console.log("");
|
|
1149
1159
|
if (channels.length > 0) {
|
|
1150
|
-
console.log(
|
|
1160
|
+
console.log(a.yellow(i18n.t("notification:config.wizard.step3")));
|
|
1151
1161
|
for (const channel of channels) {
|
|
1152
1162
|
await configureChannel(channel);
|
|
1153
1163
|
}
|
|
1154
1164
|
console.log("");
|
|
1155
1165
|
}
|
|
1156
|
-
console.log(
|
|
1166
|
+
console.log(a.yellow(i18n.t("notification:config.wizard.step4")));
|
|
1157
1167
|
await configureThreshold();
|
|
1158
1168
|
console.log("");
|
|
1159
|
-
console.log(
|
|
1169
|
+
console.log(a.yellow(i18n.t("notification:config.wizard.step5")));
|
|
1160
1170
|
await updateNotificationConfig({ enabled: true });
|
|
1161
1171
|
const { shouldTest } = await inquirer.prompt([{
|
|
1162
1172
|
type: "confirm",
|
|
@@ -1168,7 +1178,7 @@ async function runConfigWizard() {
|
|
|
1168
1178
|
await sendTestNotification();
|
|
1169
1179
|
}
|
|
1170
1180
|
console.log("");
|
|
1171
|
-
console.log(
|
|
1181
|
+
console.log(a.bold.green(i18n.t("notification:config.wizard.complete")));
|
|
1172
1182
|
console.log("");
|
|
1173
1183
|
}
|
|
1174
1184
|
async function selectChannels() {
|
|
@@ -1194,7 +1204,7 @@ async function selectChannels() {
|
|
|
1194
1204
|
}
|
|
1195
1205
|
async function configureChannel(channel) {
|
|
1196
1206
|
console.log("");
|
|
1197
|
-
console.log(
|
|
1207
|
+
console.log(a.green(`\u914D\u7F6E ${i18n.t(`notification:channels.${channel}`)}:`));
|
|
1198
1208
|
switch (channel) {
|
|
1199
1209
|
case "feishu":
|
|
1200
1210
|
await configureFeishu();
|
|
@@ -1233,7 +1243,7 @@ async function configureFeishu() {
|
|
|
1233
1243
|
...secret && { secret }
|
|
1234
1244
|
};
|
|
1235
1245
|
await enableChannel("feishu", config);
|
|
1236
|
-
console.log(
|
|
1246
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:channels.feishu")} ${i18n.t("notification:status.configured")}`));
|
|
1237
1247
|
}
|
|
1238
1248
|
async function configureWechat() {
|
|
1239
1249
|
const { corpId } = await inquirer.prompt([{
|
|
@@ -1261,7 +1271,7 @@ async function configureWechat() {
|
|
|
1261
1271
|
secret
|
|
1262
1272
|
};
|
|
1263
1273
|
await enableChannel("wechat", config);
|
|
1264
|
-
console.log(
|
|
1274
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:channels.wechat")} ${i18n.t("notification:status.configured")}`));
|
|
1265
1275
|
}
|
|
1266
1276
|
async function configureEmail() {
|
|
1267
1277
|
const { address } = await inquirer.prompt([{
|
|
@@ -1280,7 +1290,7 @@ async function configureEmail() {
|
|
|
1280
1290
|
address
|
|
1281
1291
|
};
|
|
1282
1292
|
await enableChannel("email", config);
|
|
1283
|
-
console.log(
|
|
1293
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:channels.email")} ${i18n.t("notification:status.configured")}`));
|
|
1284
1294
|
}
|
|
1285
1295
|
async function configureSms() {
|
|
1286
1296
|
const { phone } = await inquirer.prompt([{
|
|
@@ -1306,15 +1316,15 @@ async function configureSms() {
|
|
|
1306
1316
|
countryCode
|
|
1307
1317
|
};
|
|
1308
1318
|
await enableChannel("sms", config);
|
|
1309
|
-
console.log(
|
|
1319
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:channels.sms")} ${i18n.t("notification:status.configured")}`));
|
|
1310
1320
|
}
|
|
1311
1321
|
async function manageChannels() {
|
|
1312
1322
|
const enabledChannels = await getEnabledChannels();
|
|
1313
1323
|
console.log("");
|
|
1314
|
-
console.log(
|
|
1324
|
+
console.log(a.bold.cyan(i18n.t("notification:channels.title")));
|
|
1315
1325
|
console.log("");
|
|
1316
1326
|
if (enabledChannels.length === 0) {
|
|
1317
|
-
console.log(
|
|
1327
|
+
console.log(a.yellow(i18n.t("notification:channels.noChannels")));
|
|
1318
1328
|
} else {
|
|
1319
1329
|
console.log(i18n.t("notification:channels.enabledCount", { count: enabledChannels.length }));
|
|
1320
1330
|
for (const channel of enabledChannels) {
|
|
@@ -1339,7 +1349,7 @@ async function manageChannels() {
|
|
|
1339
1349
|
const allChannels = ["feishu", "wechat", "email", "sms"];
|
|
1340
1350
|
const availableChannels = allChannels.filter((ch) => !enabledChannels.includes(ch));
|
|
1341
1351
|
if (availableChannels.length === 0) {
|
|
1342
|
-
console.log(
|
|
1352
|
+
console.log(a.yellow("\u6240\u6709\u6E20\u9053\u90FD\u5DF2\u542F\u7528"));
|
|
1343
1353
|
return;
|
|
1344
1354
|
}
|
|
1345
1355
|
const { channel } = await inquirer.prompt([{
|
|
@@ -1354,7 +1364,7 @@ async function manageChannels() {
|
|
|
1354
1364
|
await configureChannel(channel);
|
|
1355
1365
|
} else if (action === "remove") {
|
|
1356
1366
|
if (enabledChannels.length === 0) {
|
|
1357
|
-
console.log(
|
|
1367
|
+
console.log(a.yellow("\u6CA1\u6709\u5DF2\u542F\u7528\u7684\u6E20\u9053"));
|
|
1358
1368
|
return;
|
|
1359
1369
|
}
|
|
1360
1370
|
const { channel } = await inquirer.prompt([{
|
|
@@ -1367,13 +1377,13 @@ async function manageChannels() {
|
|
|
1367
1377
|
}))
|
|
1368
1378
|
}]);
|
|
1369
1379
|
await disableChannel(channel);
|
|
1370
|
-
console.log(
|
|
1380
|
+
console.log(a.green(`\u2705 \u5DF2\u79FB\u9664 ${i18n.t(`notification:channels.${channel}`)}`));
|
|
1371
1381
|
}
|
|
1372
1382
|
}
|
|
1373
1383
|
async function configureThreshold() {
|
|
1374
1384
|
const config = await loadNotificationConfig();
|
|
1375
1385
|
console.log("");
|
|
1376
|
-
console.log(
|
|
1386
|
+
console.log(a.dim(i18n.t("notification:config.threshold.description")));
|
|
1377
1387
|
console.log("");
|
|
1378
1388
|
const { threshold } = await inquirer.prompt([{
|
|
1379
1389
|
type: "list",
|
|
@@ -1405,23 +1415,23 @@ async function configureThreshold() {
|
|
|
1405
1415
|
finalThreshold = Number.parseInt(customValue, 10);
|
|
1406
1416
|
}
|
|
1407
1417
|
await setThreshold(finalThreshold);
|
|
1408
|
-
console.log(
|
|
1418
|
+
console.log(a.green(`\u2705 \u9608\u503C\u5DF2\u8BBE\u7F6E\u4E3A ${finalThreshold} \u5206\u949F`));
|
|
1409
1419
|
}
|
|
1410
1420
|
async function showStatus() {
|
|
1411
1421
|
const summary = await getConfigSummary();
|
|
1412
1422
|
const validation = await validateCurrentConfig();
|
|
1413
1423
|
console.log("");
|
|
1414
|
-
console.log(
|
|
1424
|
+
console.log(a.bold.cyan("\u{1F4CA} \u901A\u77E5\u7CFB\u7EDF\u72B6\u6001"));
|
|
1415
1425
|
console.log("");
|
|
1416
1426
|
const statusIcon = summary.enabled ? "\u2705" : "\u23F8\uFE0F";
|
|
1417
|
-
const statusText = summary.enabled ?
|
|
1427
|
+
const statusText = summary.enabled ? a.green(i18n.t("notification:status.enabled")) : a.yellow(i18n.t("notification:status.disabled"));
|
|
1418
1428
|
console.log(` ${statusIcon} \u72B6\u6001: ${statusText}`);
|
|
1419
|
-
console.log(` \u{1F511} \u8BBE\u5907\u4EE4\u724C: ${
|
|
1429
|
+
console.log(` \u{1F511} \u8BBE\u5907\u4EE4\u724C: ${a.dim(summary.deviceToken)}`);
|
|
1420
1430
|
console.log(` \u23F1\uFE0F \u9608\u503C: ${summary.threshold} \u5206\u949F`);
|
|
1421
1431
|
console.log("");
|
|
1422
|
-
console.log(
|
|
1432
|
+
console.log(a.bold(" \u{1F4F1} \u901A\u77E5\u6E20\u9053:"));
|
|
1423
1433
|
if (summary.enabledChannels.length === 0) {
|
|
1424
|
-
console.log(` ${
|
|
1434
|
+
console.log(` ${a.yellow(i18n.t("notification:channels.noChannels"))}`);
|
|
1425
1435
|
} else {
|
|
1426
1436
|
for (const channel of summary.enabledChannels) {
|
|
1427
1437
|
console.log(` \u2705 ${i18n.t(`notification:channels.${channel}`)}`);
|
|
@@ -1433,14 +1443,14 @@ async function showStatus() {
|
|
|
1433
1443
|
}
|
|
1434
1444
|
if (!validation.valid) {
|
|
1435
1445
|
console.log("");
|
|
1436
|
-
console.log(
|
|
1446
|
+
console.log(a.bold.red(" \u26A0\uFE0F \u914D\u7F6E\u95EE\u9898:"));
|
|
1437
1447
|
for (const error of validation.errors) {
|
|
1438
1448
|
console.log(` \u274C ${error.message}`);
|
|
1439
1449
|
}
|
|
1440
1450
|
}
|
|
1441
1451
|
if (validation.warnings.length > 0) {
|
|
1442
1452
|
console.log("");
|
|
1443
|
-
console.log(
|
|
1453
|
+
console.log(a.bold.yellow(" \u26A0\uFE0F \u8B66\u544A:"));
|
|
1444
1454
|
for (const warning of validation.warnings) {
|
|
1445
1455
|
console.log(` \u26A0\uFE0F ${warning}`);
|
|
1446
1456
|
}
|
|
@@ -1450,11 +1460,11 @@ async function showStatus() {
|
|
|
1450
1460
|
async function sendTestNotification() {
|
|
1451
1461
|
const enabledChannels = await getEnabledChannels();
|
|
1452
1462
|
if (enabledChannels.length === 0) {
|
|
1453
|
-
console.log(
|
|
1463
|
+
console.log(a.yellow(i18n.t("notification:errors.noChannels")));
|
|
1454
1464
|
return;
|
|
1455
1465
|
}
|
|
1456
1466
|
console.log("");
|
|
1457
|
-
console.log(
|
|
1467
|
+
console.log(a.green(i18n.t("notification:test.sending")));
|
|
1458
1468
|
try {
|
|
1459
1469
|
const client = CloudClient.getInstance();
|
|
1460
1470
|
await client.initialize();
|
|
@@ -1465,40 +1475,40 @@ async function sendTestNotification() {
|
|
|
1465
1475
|
for (const result of results) {
|
|
1466
1476
|
const channelName = i18n.t(`notification:channels.${result.channel}`);
|
|
1467
1477
|
if (result.success) {
|
|
1468
|
-
console.log(
|
|
1478
|
+
console.log(a.green(`\u2705 ${channelName}: ${i18n.t("notification:test.success")}`));
|
|
1469
1479
|
hasSuccess = true;
|
|
1470
1480
|
} else {
|
|
1471
|
-
console.log(
|
|
1481
|
+
console.log(a.red(`\u274C ${channelName}: ${result.error || i18n.t("notification:test.failed")}`));
|
|
1472
1482
|
hasFailure = true;
|
|
1473
1483
|
}
|
|
1474
1484
|
}
|
|
1475
1485
|
console.log("");
|
|
1476
1486
|
if (hasSuccess) {
|
|
1477
|
-
console.log(
|
|
1487
|
+
console.log(a.dim(i18n.t("notification:test.checkDevice")));
|
|
1478
1488
|
}
|
|
1479
1489
|
if (hasFailure) {
|
|
1480
|
-
console.log(
|
|
1490
|
+
console.log(a.yellow(i18n.t("notification:test.partialFailure")));
|
|
1481
1491
|
}
|
|
1482
1492
|
} catch (error) {
|
|
1483
1493
|
console.log("");
|
|
1484
|
-
console.log(
|
|
1494
|
+
console.log(a.red(`\u274C ${i18n.t("notification:errors.sendFailed")}`));
|
|
1485
1495
|
if (error instanceof Error) {
|
|
1486
|
-
console.log(
|
|
1496
|
+
console.log(a.dim(error.message));
|
|
1487
1497
|
}
|
|
1488
1498
|
console.log("");
|
|
1489
|
-
console.log(
|
|
1490
|
-
console.log(
|
|
1491
|
-
console.log(
|
|
1492
|
-
console.log(
|
|
1499
|
+
console.log(a.yellow(i18n.t("notification:test.troubleshooting")));
|
|
1500
|
+
console.log(a.dim(` 1. ${i18n.t("notification:test.checkConnection")}`));
|
|
1501
|
+
console.log(a.dim(` 2. ${i18n.t("notification:test.checkConfig")}`));
|
|
1502
|
+
console.log(a.dim(` 3. ${i18n.t("notification:test.checkToken")}`));
|
|
1493
1503
|
}
|
|
1494
1504
|
console.log("");
|
|
1495
1505
|
}
|
|
1496
1506
|
async function handleBind(code) {
|
|
1497
1507
|
console.log("");
|
|
1498
|
-
console.log(
|
|
1508
|
+
console.log(a.bold.cyan(i18n.t("notification:cloud.bindTitle")));
|
|
1499
1509
|
console.log("");
|
|
1500
1510
|
if (isDeviceBound()) {
|
|
1501
|
-
console.log(
|
|
1511
|
+
console.log(a.yellow(i18n.t("notification:cloud.alreadyBound")));
|
|
1502
1512
|
console.log("");
|
|
1503
1513
|
const { confirmRebind } = await inquirer.prompt([{
|
|
1504
1514
|
type: "confirm",
|
|
@@ -1513,7 +1523,7 @@ async function handleBind(code) {
|
|
|
1513
1523
|
}
|
|
1514
1524
|
let bindingCode = code;
|
|
1515
1525
|
if (!bindingCode) {
|
|
1516
|
-
console.log(
|
|
1526
|
+
console.log(a.dim(i18n.t("notification:cloud.bindInstructions")));
|
|
1517
1527
|
console.log("");
|
|
1518
1528
|
const { inputCode } = await inquirer.prompt([{
|
|
1519
1529
|
type: "input",
|
|
@@ -1532,14 +1542,14 @@ async function handleBind(code) {
|
|
|
1532
1542
|
bindingCode = inputCode.trim();
|
|
1533
1543
|
}
|
|
1534
1544
|
console.log("");
|
|
1535
|
-
console.log(
|
|
1545
|
+
console.log(a.green(i18n.t("notification:cloud.binding")));
|
|
1536
1546
|
try {
|
|
1537
1547
|
const result = await bindDevice(bindingCode);
|
|
1538
1548
|
if (result.success) {
|
|
1539
1549
|
console.log("");
|
|
1540
|
-
console.log(
|
|
1550
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:cloud.bindSuccess")}`));
|
|
1541
1551
|
console.log("");
|
|
1542
|
-
console.log(
|
|
1552
|
+
console.log(a.dim(i18n.t("notification:cloud.deviceId", { id: result.deviceId || "N/A" })));
|
|
1543
1553
|
console.log("");
|
|
1544
1554
|
const { sendTest } = await inquirer.prompt([{
|
|
1545
1555
|
type: "confirm",
|
|
@@ -1552,19 +1562,19 @@ async function handleBind(code) {
|
|
|
1552
1562
|
}
|
|
1553
1563
|
} else {
|
|
1554
1564
|
console.log("");
|
|
1555
|
-
console.log(
|
|
1556
|
-
console.log(
|
|
1565
|
+
console.log(a.red(`\u274C ${i18n.t("notification:cloud.bindFailed")}`));
|
|
1566
|
+
console.log(a.dim(result.error || i18n.t("notification:cloud.unknownError")));
|
|
1557
1567
|
console.log("");
|
|
1558
|
-
console.log(
|
|
1559
|
-
console.log(
|
|
1560
|
-
console.log(
|
|
1561
|
-
console.log(
|
|
1568
|
+
console.log(a.yellow(i18n.t("notification:cloud.bindTroubleshooting")));
|
|
1569
|
+
console.log(a.dim(` 1. ${i18n.t("notification:cloud.checkCode")}`));
|
|
1570
|
+
console.log(a.dim(` 2. ${i18n.t("notification:cloud.checkExpiry")}`));
|
|
1571
|
+
console.log(a.dim(` 3. ${i18n.t("notification:cloud.checkNetwork")}`));
|
|
1562
1572
|
}
|
|
1563
1573
|
} catch (error) {
|
|
1564
1574
|
console.log("");
|
|
1565
|
-
console.log(
|
|
1575
|
+
console.log(a.red(`\u274C ${i18n.t("notification:cloud.bindError")}`));
|
|
1566
1576
|
if (error instanceof Error) {
|
|
1567
|
-
console.log(
|
|
1577
|
+
console.log(a.dim(error.message));
|
|
1568
1578
|
}
|
|
1569
1579
|
}
|
|
1570
1580
|
console.log("");
|
|
@@ -1572,7 +1582,7 @@ async function handleBind(code) {
|
|
|
1572
1582
|
async function handleUnbind() {
|
|
1573
1583
|
console.log("");
|
|
1574
1584
|
if (!isDeviceBound()) {
|
|
1575
|
-
console.log(
|
|
1585
|
+
console.log(a.yellow(i18n.t("notification:cloud.notBoundYet")));
|
|
1576
1586
|
console.log("");
|
|
1577
1587
|
return;
|
|
1578
1588
|
}
|
|
@@ -1583,44 +1593,44 @@ async function handleUnbind() {
|
|
|
1583
1593
|
default: false
|
|
1584
1594
|
}]);
|
|
1585
1595
|
if (!confirmUnbind) {
|
|
1586
|
-
console.log(
|
|
1596
|
+
console.log(a.dim(i18n.t("notification:cloud.unbindCancelled")));
|
|
1587
1597
|
console.log("");
|
|
1588
1598
|
return;
|
|
1589
1599
|
}
|
|
1590
1600
|
unbindDevice();
|
|
1591
|
-
console.log(
|
|
1601
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:cloud.unbindSuccess")}`));
|
|
1592
1602
|
console.log("");
|
|
1593
1603
|
}
|
|
1594
1604
|
async function showCloudStatus() {
|
|
1595
1605
|
console.log("");
|
|
1596
|
-
console.log(
|
|
1606
|
+
console.log(a.bold.cyan(i18n.t("notification:cloud.statusTitle")));
|
|
1597
1607
|
console.log("");
|
|
1598
1608
|
const status = await getBindingStatus();
|
|
1599
1609
|
if (!status.bound) {
|
|
1600
|
-
console.log(` ${
|
|
1610
|
+
console.log(` ${a.yellow("\u26A0\uFE0F")} ${i18n.t("notification:cloud.notBound")}`);
|
|
1601
1611
|
console.log("");
|
|
1602
|
-
console.log(
|
|
1612
|
+
console.log(a.dim(i18n.t("notification:cloud.bindHint")));
|
|
1603
1613
|
console.log("");
|
|
1604
1614
|
return;
|
|
1605
1615
|
}
|
|
1606
|
-
console.log(` ${
|
|
1616
|
+
console.log(` ${a.green("\u2705")} ${i18n.t("notification:cloud.bound")}`);
|
|
1607
1617
|
console.log("");
|
|
1608
1618
|
if (status.deviceId) {
|
|
1609
|
-
console.log(` ${
|
|
1619
|
+
console.log(` ${a.dim(i18n.t("notification:cloud.deviceIdLabel"))} ${status.deviceId}`);
|
|
1610
1620
|
}
|
|
1611
1621
|
if (status.deviceInfo) {
|
|
1612
|
-
console.log(` ${
|
|
1613
|
-
console.log(` ${
|
|
1622
|
+
console.log(` ${a.dim(i18n.t("notification:cloud.deviceNameLabel"))} ${status.deviceInfo.name}`);
|
|
1623
|
+
console.log(` ${a.dim(i18n.t("notification:cloud.platformLabel"))} ${status.deviceInfo.platform}`);
|
|
1614
1624
|
}
|
|
1615
1625
|
if (status.lastUsed) {
|
|
1616
1626
|
const lastUsedDate = new Date(status.lastUsed);
|
|
1617
|
-
console.log(` ${
|
|
1627
|
+
console.log(` ${a.dim(i18n.t("notification:cloud.lastUsedLabel"))} ${lastUsedDate.toLocaleString()}`);
|
|
1618
1628
|
}
|
|
1619
1629
|
console.log("");
|
|
1620
1630
|
}
|
|
1621
1631
|
async function sendCloudTestNotification() {
|
|
1622
1632
|
console.log("");
|
|
1623
|
-
console.log(
|
|
1633
|
+
console.log(a.green(i18n.t("notification:cloud.sendingTest")));
|
|
1624
1634
|
try {
|
|
1625
1635
|
const result = await sendNotification({
|
|
1626
1636
|
title: i18n.t("notification:cloud.testTitle"),
|
|
@@ -1628,16 +1638,16 @@ async function sendCloudTestNotification() {
|
|
|
1628
1638
|
type: "success"
|
|
1629
1639
|
});
|
|
1630
1640
|
if (result.success) {
|
|
1631
|
-
console.log(
|
|
1632
|
-
console.log(
|
|
1641
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:cloud.testSuccess")}`));
|
|
1642
|
+
console.log(a.dim(i18n.t("notification:cloud.checkPhone")));
|
|
1633
1643
|
} else {
|
|
1634
|
-
console.log(
|
|
1635
|
-
console.log(
|
|
1644
|
+
console.log(a.red(`\u274C ${i18n.t("notification:cloud.testFailed")}`));
|
|
1645
|
+
console.log(a.dim(result.error || i18n.t("notification:cloud.unknownError")));
|
|
1636
1646
|
}
|
|
1637
1647
|
} catch (error) {
|
|
1638
|
-
console.log(
|
|
1648
|
+
console.log(a.red(`\u274C ${i18n.t("notification:cloud.testError")}`));
|
|
1639
1649
|
if (error instanceof Error) {
|
|
1640
|
-
console.log(
|
|
1650
|
+
console.log(a.dim(error.message));
|
|
1641
1651
|
}
|
|
1642
1652
|
}
|
|
1643
1653
|
console.log("");
|
|
@@ -1646,23 +1656,23 @@ async function configureLocalNotification() {
|
|
|
1646
1656
|
const config = await loadLocalNotificationConfig();
|
|
1647
1657
|
const shortcutsAvailable = await isShortcutsAvailable();
|
|
1648
1658
|
console.log("");
|
|
1649
|
-
console.log(
|
|
1650
|
-
console.log(
|
|
1659
|
+
console.log(a.bold.cyan(i18n.t("notification:local.title")));
|
|
1660
|
+
console.log(a.dim(i18n.t("notification:local.description")));
|
|
1651
1661
|
console.log("");
|
|
1652
|
-
console.log(
|
|
1662
|
+
console.log(a.bold(i18n.t("notification:local.currentStatus")));
|
|
1653
1663
|
if (shortcutsAvailable) {
|
|
1654
|
-
const shortcutsStatus = config.shortcutName ?
|
|
1664
|
+
const shortcutsStatus = config.shortcutName ? a.green(i18n.t("notification:status.enabled")) : a.yellow(i18n.t("notification:status.disabled"));
|
|
1655
1665
|
console.log(` \u{1F34E} ${i18n.t("notification:local.shortcuts.name")}: ${shortcutsStatus}`);
|
|
1656
1666
|
if (config.shortcutName) {
|
|
1657
|
-
console.log(` ${
|
|
1667
|
+
console.log(` ${a.dim(i18n.t("notification:local.shortcuts.currentShortcut", { name: config.shortcutName }))}`);
|
|
1658
1668
|
}
|
|
1659
1669
|
} else {
|
|
1660
|
-
console.log(` \u{1F34E} ${i18n.t("notification:local.shortcuts.name")}: ${
|
|
1670
|
+
console.log(` \u{1F34E} ${i18n.t("notification:local.shortcuts.name")}: ${a.dim(i18n.t("notification:local.shortcuts.notAvailable"))}`);
|
|
1661
1671
|
}
|
|
1662
|
-
const barkStatus = config.barkUrl ?
|
|
1672
|
+
const barkStatus = config.barkUrl ? a.green(i18n.t("notification:status.enabled")) : a.yellow(i18n.t("notification:status.disabled"));
|
|
1663
1673
|
console.log(` \u{1F4F1} ${i18n.t("notification:local.bark.name")}: ${barkStatus}`);
|
|
1664
1674
|
if (config.barkUrl) {
|
|
1665
|
-
console.log(` ${
|
|
1675
|
+
console.log(` ${a.dim(i18n.t("notification:local.bark.currentServer", { url: config.barkUrl }))}`);
|
|
1666
1676
|
}
|
|
1667
1677
|
console.log("");
|
|
1668
1678
|
const choices = [];
|
|
@@ -1703,18 +1713,18 @@ async function configureLocalNotification() {
|
|
|
1703
1713
|
}
|
|
1704
1714
|
async function configureShortcuts() {
|
|
1705
1715
|
console.log("");
|
|
1706
|
-
console.log(
|
|
1707
|
-
console.log(
|
|
1716
|
+
console.log(a.bold.cyan(i18n.t("notification:local.shortcuts.title")));
|
|
1717
|
+
console.log(a.dim(i18n.t("notification:local.shortcuts.description")));
|
|
1708
1718
|
console.log("");
|
|
1709
|
-
console.log(
|
|
1719
|
+
console.log(a.dim(i18n.t("notification:local.shortcuts.scanning")));
|
|
1710
1720
|
const shortcuts = await listShortcuts();
|
|
1711
1721
|
if (shortcuts.length === 0) {
|
|
1712
|
-
console.log(
|
|
1713
|
-
console.log(
|
|
1722
|
+
console.log(a.yellow(i18n.t("notification:local.shortcuts.noShortcuts")));
|
|
1723
|
+
console.log(a.dim(i18n.t("notification:local.shortcuts.createHint")));
|
|
1714
1724
|
console.log("");
|
|
1715
1725
|
return;
|
|
1716
1726
|
}
|
|
1717
|
-
console.log(
|
|
1727
|
+
console.log(a.green(i18n.t("notification:local.shortcuts.found", { count: shortcuts.length })));
|
|
1718
1728
|
console.log("");
|
|
1719
1729
|
const { shortcutName } = await inquirer.prompt([{
|
|
1720
1730
|
type: "list",
|
|
@@ -1728,7 +1738,7 @@ async function configureShortcuts() {
|
|
|
1728
1738
|
}]);
|
|
1729
1739
|
if (shortcutName === "__disable__") {
|
|
1730
1740
|
await saveLocalNotificationConfig({ shortcutName: "" });
|
|
1731
|
-
console.log(
|
|
1741
|
+
console.log(a.yellow(`\u23F8\uFE0F ${i18n.t("notification:local.shortcuts.disabled")}`));
|
|
1732
1742
|
return;
|
|
1733
1743
|
}
|
|
1734
1744
|
let finalShortcutName = shortcutName;
|
|
@@ -1742,7 +1752,7 @@ async function configureShortcuts() {
|
|
|
1742
1752
|
finalShortcutName = manualName.trim();
|
|
1743
1753
|
}
|
|
1744
1754
|
await saveLocalNotificationConfig({ shortcutName: finalShortcutName });
|
|
1745
|
-
console.log(
|
|
1755
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:local.shortcuts.configured", { name: finalShortcutName })}`));
|
|
1746
1756
|
const { shouldTest } = await inquirer.prompt([{
|
|
1747
1757
|
type: "confirm",
|
|
1748
1758
|
name: "shouldTest",
|
|
@@ -1755,8 +1765,8 @@ async function configureShortcuts() {
|
|
|
1755
1765
|
}
|
|
1756
1766
|
async function configureBark() {
|
|
1757
1767
|
console.log("");
|
|
1758
|
-
console.log(
|
|
1759
|
-
console.log(
|
|
1768
|
+
console.log(a.bold.cyan(i18n.t("notification:local.bark.title")));
|
|
1769
|
+
console.log(a.dim(i18n.t("notification:local.bark.description")));
|
|
1760
1770
|
console.log("");
|
|
1761
1771
|
const config = await loadLocalNotificationConfig();
|
|
1762
1772
|
const { action } = await inquirer.prompt([{
|
|
@@ -1774,7 +1784,7 @@ async function configureBark() {
|
|
|
1774
1784
|
}
|
|
1775
1785
|
if (action === "disable") {
|
|
1776
1786
|
await saveLocalNotificationConfig({ barkUrl: "" });
|
|
1777
|
-
console.log(
|
|
1787
|
+
console.log(a.yellow(`\u23F8\uFE0F ${i18n.t("notification:local.bark.disabled")}`));
|
|
1778
1788
|
return;
|
|
1779
1789
|
}
|
|
1780
1790
|
const { barkUrl } = await inquirer.prompt([{
|
|
@@ -1790,7 +1800,7 @@ async function configureBark() {
|
|
|
1790
1800
|
}
|
|
1791
1801
|
}]);
|
|
1792
1802
|
await saveLocalNotificationConfig({ barkUrl });
|
|
1793
|
-
console.log(
|
|
1803
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:local.bark.configured")}`));
|
|
1794
1804
|
const { shouldTest } = await inquirer.prompt([{
|
|
1795
1805
|
type: "confirm",
|
|
1796
1806
|
name: "shouldTest",
|
|
@@ -1804,7 +1814,7 @@ async function configureBark() {
|
|
|
1804
1814
|
async function testLocalNotification() {
|
|
1805
1815
|
const config = await loadLocalNotificationConfig();
|
|
1806
1816
|
console.log("");
|
|
1807
|
-
console.log(
|
|
1817
|
+
console.log(a.green(i18n.t("notification:local.testing")));
|
|
1808
1818
|
console.log("");
|
|
1809
1819
|
let hasAnyEnabled = false;
|
|
1810
1820
|
if (config.shortcutName) {
|
|
@@ -1816,35 +1826,35 @@ async function testLocalNotification() {
|
|
|
1816
1826
|
await testBarkNotification(config.barkUrl);
|
|
1817
1827
|
}
|
|
1818
1828
|
if (!hasAnyEnabled) {
|
|
1819
|
-
console.log(
|
|
1820
|
-
console.log(
|
|
1829
|
+
console.log(a.yellow(i18n.t("notification:local.noLocalEnabled")));
|
|
1830
|
+
console.log(a.dim(i18n.t("notification:local.configureFirst")));
|
|
1821
1831
|
}
|
|
1822
1832
|
console.log("");
|
|
1823
1833
|
}
|
|
1824
1834
|
async function testShortcutsNotification(shortcutName) {
|
|
1825
|
-
console.log(
|
|
1835
|
+
console.log(a.dim(`${i18n.t("notification:local.shortcuts.testing", { name: shortcutName })}...`));
|
|
1826
1836
|
try {
|
|
1827
1837
|
const service = await getLocalNotificationService();
|
|
1828
1838
|
await service.sendShortcutNotification(shortcutName, {
|
|
1829
1839
|
title: i18n.t("notification:local.testTitle"),
|
|
1830
1840
|
body: i18n.t("notification:local.testBody")
|
|
1831
1841
|
});
|
|
1832
|
-
console.log(
|
|
1842
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:local.shortcuts.name")}: ${i18n.t("notification:test.success")}`));
|
|
1833
1843
|
} catch (error) {
|
|
1834
|
-
console.log(
|
|
1844
|
+
console.log(a.red(`\u274C ${i18n.t("notification:local.shortcuts.name")}: ${error instanceof Error ? error.message : i18n.t("notification:test.failed")}`));
|
|
1835
1845
|
}
|
|
1836
1846
|
}
|
|
1837
1847
|
async function testBarkNotification(barkUrl) {
|
|
1838
|
-
console.log(
|
|
1848
|
+
console.log(a.dim(`${i18n.t("notification:local.bark.testing")}...`));
|
|
1839
1849
|
try {
|
|
1840
1850
|
const service = await getLocalNotificationService();
|
|
1841
1851
|
await service.sendBarkNotification(barkUrl, {
|
|
1842
1852
|
title: i18n.t("notification:local.testTitle"),
|
|
1843
1853
|
body: i18n.t("notification:local.testBody")
|
|
1844
1854
|
});
|
|
1845
|
-
console.log(
|
|
1855
|
+
console.log(a.green(`\u2705 ${i18n.t("notification:local.bark.name")}: ${i18n.t("notification:test.success")}`));
|
|
1846
1856
|
} catch (error) {
|
|
1847
|
-
console.log(
|
|
1857
|
+
console.log(a.red(`\u274C ${i18n.t("notification:local.bark.name")}: ${error instanceof Error ? error.message : i18n.t("notification:test.failed")}`));
|
|
1848
1858
|
}
|
|
1849
1859
|
}
|
|
1850
1860
|
|