aico-cli 0.0.1 → 0.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/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { J as readZcfConfig, K as inquirer, N as addNumbersToChoices, O as updateZcfConfig, P as getTranslation, h as SUPPORTED_LANGS, j as LANG_LABELS, k as AI_OUTPUT_LANGUAGES, Q as version, q as backupExistingConfig, r as copyConfigFiles, x as applyAiLanguageDirective, R as configureAiPersonality, C as CLAUDE_DIR,
|
|
4
|
+
import { J as readZcfConfig, K as inquirer, N as addNumbersToChoices, O as updateZcfConfig, P as getTranslation, h as SUPPORTED_LANGS, j as LANG_LABELS, k as AI_OUTPUT_LANGUAGES, Q as version, q as backupExistingConfig, r as copyConfigFiles, x as applyAiLanguageDirective, R as configureAiPersonality, C as CLAUDE_DIR, T as readJsonConfig, H as addCompletedOnboarding, S as SETTINGS_FILE, U as writeJsonConfig, o as openSettingsJson, b as importRecommendedPermissions, a as importRecommendedEnv, V as isWindows, z as readMcpConfig, G as fixWindowsMcpConfig, B as writeMcpConfig, W as selectMcpServices, D as backupMcpConfig, M as MCP_SERVICES, F as buildMcpServerConfig, E as mergeMcpServers, X as displayBanner, I as I18N, Y as selectAndInstallWorkflows, Z as handleExitPromptError, _ as handleGeneralError, $ as displayBannerWithInfo, a0 as readZcfConfigAsync, i as init, a1 as executeWithEscapeSupport, a2 as EscapeKeyPressed } from './shared/aico-cli.De5MHWWb.mjs';
|
|
5
5
|
import inquirer$1 from 'inquirer';
|
|
6
6
|
import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
|
|
7
7
|
import { exec } from 'node:child_process';
|
|
@@ -103,120 +103,6 @@ async function resolveAiOutputLanguage(scriptLang, commandLineOption, savedConfi
|
|
|
103
103
|
return await selectAiOutputLanguage(scriptLang, scriptLang);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function validateApiKey(apiKey, lang = "zh-CN") {
|
|
107
|
-
const i18n = getTranslation(lang);
|
|
108
|
-
if (!apiKey || apiKey.trim() === "") {
|
|
109
|
-
return {
|
|
110
|
-
isValid: false,
|
|
111
|
-
error: i18n.api.apiKeyValidation.empty
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
return { isValid: true };
|
|
115
|
-
}
|
|
116
|
-
function formatApiKeyDisplay(apiKey) {
|
|
117
|
-
if (!apiKey || apiKey.length < 12) {
|
|
118
|
-
return apiKey;
|
|
119
|
-
}
|
|
120
|
-
return `${apiKey.substring(0, 8)}...${apiKey.substring(apiKey.length - 4)}`;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
async function modifyApiConfigPartially(existingConfig, i18n, scriptLang) {
|
|
124
|
-
let currentConfig = { ...existingConfig };
|
|
125
|
-
const latestConfig = getExistingApiConfig();
|
|
126
|
-
if (latestConfig) {
|
|
127
|
-
currentConfig = latestConfig;
|
|
128
|
-
}
|
|
129
|
-
const { item } = await inquirer.prompt({
|
|
130
|
-
type: "list",
|
|
131
|
-
name: "item",
|
|
132
|
-
message: i18n.api.selectModifyItems,
|
|
133
|
-
choices: addNumbersToChoices([
|
|
134
|
-
{ name: i18n.api.modifyApiUrl, value: "url" },
|
|
135
|
-
{ name: i18n.api.modifyApiKey, value: "key" },
|
|
136
|
-
{ name: i18n.api.modifyAuthType, value: "authType" }
|
|
137
|
-
])
|
|
138
|
-
});
|
|
139
|
-
if (!item) {
|
|
140
|
-
console.log(ansis.yellow(i18n.common.cancelled));
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (item === "url") {
|
|
144
|
-
const { url } = await inquirer.prompt({
|
|
145
|
-
type: "input",
|
|
146
|
-
name: "url",
|
|
147
|
-
message: i18n.api.enterNewApiUrl.replace("{url}", currentConfig.url || i18n.common.none),
|
|
148
|
-
default: currentConfig.url,
|
|
149
|
-
validate: (value) => {
|
|
150
|
-
if (!value) return i18n.api.urlRequired;
|
|
151
|
-
try {
|
|
152
|
-
new URL(value);
|
|
153
|
-
return true;
|
|
154
|
-
} catch {
|
|
155
|
-
return i18n.api.invalidUrl;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
if (url === void 0) {
|
|
160
|
-
console.log(ansis.yellow(i18n.common.cancelled));
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
currentConfig.url = url;
|
|
164
|
-
const savedConfig = configureApi(currentConfig);
|
|
165
|
-
if (savedConfig) {
|
|
166
|
-
console.log(ansis.green(`\u2714 ${i18n.api.modificationSaved}`));
|
|
167
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigUrl}: ${savedConfig.url}`));
|
|
168
|
-
}
|
|
169
|
-
} else if (item === "key") {
|
|
170
|
-
const authType = currentConfig.authType || "auth_token";
|
|
171
|
-
const keyMessage = authType === "auth_token" ? i18n.api.enterNewApiKey.replace("{key}", currentConfig.key ? formatApiKeyDisplay(currentConfig.key) : i18n.common.none) : i18n.api.enterNewApiKey.replace("{key}", currentConfig.key ? formatApiKeyDisplay(currentConfig.key) : i18n.common.none);
|
|
172
|
-
const { key } = await inquirer.prompt({
|
|
173
|
-
type: "input",
|
|
174
|
-
name: "key",
|
|
175
|
-
message: keyMessage,
|
|
176
|
-
validate: (value) => {
|
|
177
|
-
if (!value) {
|
|
178
|
-
return i18n.api.keyRequired;
|
|
179
|
-
}
|
|
180
|
-
const validation = validateApiKey(value, scriptLang);
|
|
181
|
-
if (!validation.isValid) {
|
|
182
|
-
return validation.error || i18n.api.invalidKeyFormat;
|
|
183
|
-
}
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
if (key === void 0) {
|
|
188
|
-
console.log(ansis.yellow(i18n.common.cancelled));
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
currentConfig.key = key;
|
|
192
|
-
const savedConfig = configureApi(currentConfig);
|
|
193
|
-
if (savedConfig) {
|
|
194
|
-
console.log(ansis.green(`\u2714 ${i18n.api.modificationSaved}`));
|
|
195
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigKey}: ${formatApiKeyDisplay(savedConfig.key)}`));
|
|
196
|
-
}
|
|
197
|
-
} else if (item === "authType") {
|
|
198
|
-
const { authType } = await inquirer.prompt({
|
|
199
|
-
type: "list",
|
|
200
|
-
name: "authType",
|
|
201
|
-
message: i18n.api.selectNewAuthType.replace("{type}", currentConfig.authType || i18n.common.none),
|
|
202
|
-
choices: addNumbersToChoices([
|
|
203
|
-
{ name: "Auth Token (OAuth)", value: "auth_token" },
|
|
204
|
-
{ name: "API Key", value: "api_key" }
|
|
205
|
-
]),
|
|
206
|
-
default: currentConfig.authType === "api_key" ? 1 : 0
|
|
207
|
-
});
|
|
208
|
-
if (authType === void 0) {
|
|
209
|
-
console.log(ansis.yellow(i18n.common.cancelled));
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
currentConfig.authType = authType;
|
|
213
|
-
const savedConfig = configureApi(currentConfig);
|
|
214
|
-
if (savedConfig) {
|
|
215
|
-
console.log(ansis.green(`\u2714 ${i18n.api.modificationSaved}`));
|
|
216
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigAuthType}: ${savedConfig.authType}`));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
106
|
async function updatePromptOnly(configLang, scriptLang, aiOutputLang) {
|
|
221
107
|
const i18n = getTranslation(scriptLang);
|
|
222
108
|
const backupDir = backupExistingConfig();
|
|
@@ -688,142 +574,6 @@ function handleCancellation(scriptLang) {
|
|
|
688
574
|
const i18n = getTranslation(scriptLang);
|
|
689
575
|
console.log(ansis.yellow(i18n.common.cancelled));
|
|
690
576
|
}
|
|
691
|
-
async function configureApiFeature(scriptLang) {
|
|
692
|
-
const i18n = getTranslation(scriptLang);
|
|
693
|
-
const existingApiConfig = getExistingApiConfig();
|
|
694
|
-
if (existingApiConfig) {
|
|
695
|
-
console.log("\n" + ansis.blue(`\u2139 ${i18n.api.existingApiConfig}`));
|
|
696
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigUrl}: ${existingApiConfig.url || i18n.common.notConfigured}`));
|
|
697
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigKey}: ${existingApiConfig.key ? formatApiKeyDisplay(existingApiConfig.key) : i18n.common.notConfigured}`));
|
|
698
|
-
console.log(ansis.gray(` ${i18n.api.apiConfigAuthType}: ${existingApiConfig.authType || i18n.common.notConfigured}
|
|
699
|
-
`));
|
|
700
|
-
const { action } = await inquirer.prompt({
|
|
701
|
-
type: "list",
|
|
702
|
-
name: "action",
|
|
703
|
-
message: i18n.api.selectApiAction,
|
|
704
|
-
choices: addNumbersToChoices([
|
|
705
|
-
{ name: i18n.api.keepExistingConfig, value: "keep" },
|
|
706
|
-
{ name: i18n.api.modifyAllConfig, value: "modify-all" },
|
|
707
|
-
{ name: i18n.api.modifyPartialConfig, value: "modify-partial" },
|
|
708
|
-
{ name: i18n.api.useCcrProxy, value: "use-ccr" }
|
|
709
|
-
])
|
|
710
|
-
});
|
|
711
|
-
if (!action) {
|
|
712
|
-
handleCancellation(scriptLang);
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
if (action === "keep") {
|
|
716
|
-
console.log(ansis.green(`\u2714 ${i18n.api.keepExistingConfig}`));
|
|
717
|
-
try {
|
|
718
|
-
addCompletedOnboarding();
|
|
719
|
-
} catch (error) {
|
|
720
|
-
console.error(ansis.red(i18n.configuration.failedToSetOnboarding), error);
|
|
721
|
-
}
|
|
722
|
-
return;
|
|
723
|
-
} else if (action === "modify-partial") {
|
|
724
|
-
await modifyApiConfigPartially(existingApiConfig, i18n, scriptLang);
|
|
725
|
-
return;
|
|
726
|
-
} else if (action === "use-ccr") {
|
|
727
|
-
const ccrInstalled = await isCcrInstalled();
|
|
728
|
-
if (!ccrInstalled) {
|
|
729
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
730
|
-
await installCcr(scriptLang);
|
|
731
|
-
} else {
|
|
732
|
-
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
733
|
-
}
|
|
734
|
-
const ccrConfigured = await setupCcrConfiguration(scriptLang);
|
|
735
|
-
if (ccrConfigured) {
|
|
736
|
-
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrSetupComplete}`));
|
|
737
|
-
}
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
const { apiChoice } = await inquirer.prompt({
|
|
742
|
-
type: "list",
|
|
743
|
-
name: "apiChoice",
|
|
744
|
-
message: i18n.api.configureApi,
|
|
745
|
-
choices: addNumbersToChoices([
|
|
746
|
-
{
|
|
747
|
-
name: `${i18n.api.useAuthToken} - ${ansis.gray(i18n.api.authTokenDesc)}`,
|
|
748
|
-
value: "auth_token",
|
|
749
|
-
short: i18n.api.useAuthToken
|
|
750
|
-
},
|
|
751
|
-
{
|
|
752
|
-
name: `${i18n.api.useApiKey} - ${ansis.gray(i18n.api.apiKeyDesc)}`,
|
|
753
|
-
value: "api_key",
|
|
754
|
-
short: i18n.api.useApiKey
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
name: `${i18n.api.useCcrProxy} - ${ansis.gray(i18n.api.ccrProxyDesc)}`,
|
|
758
|
-
value: "ccr_proxy",
|
|
759
|
-
short: i18n.api.useCcrProxy
|
|
760
|
-
},
|
|
761
|
-
{ name: i18n.api.skipApi, value: "skip" }
|
|
762
|
-
])
|
|
763
|
-
});
|
|
764
|
-
if (!apiChoice || apiChoice === "skip") {
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
if (apiChoice === "ccr_proxy") {
|
|
768
|
-
const ccrInstalled = await isCcrInstalled();
|
|
769
|
-
if (!ccrInstalled) {
|
|
770
|
-
console.log(ansis.yellow(`${i18n.ccr.installingCcr}`));
|
|
771
|
-
await installCcr(scriptLang);
|
|
772
|
-
} else {
|
|
773
|
-
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrAlreadyInstalled}`));
|
|
774
|
-
}
|
|
775
|
-
const ccrConfigured = await setupCcrConfiguration(scriptLang);
|
|
776
|
-
if (ccrConfigured) {
|
|
777
|
-
console.log(ansis.green(`\u2714 ${i18n.ccr.ccrSetupComplete}`));
|
|
778
|
-
}
|
|
779
|
-
return;
|
|
780
|
-
}
|
|
781
|
-
const { url } = await inquirer.prompt({
|
|
782
|
-
type: "input",
|
|
783
|
-
name: "url",
|
|
784
|
-
message: i18n.api.enterApiUrl,
|
|
785
|
-
validate: (value) => {
|
|
786
|
-
if (!value) return i18n.api.urlRequired;
|
|
787
|
-
try {
|
|
788
|
-
new URL(value);
|
|
789
|
-
return true;
|
|
790
|
-
} catch {
|
|
791
|
-
return i18n.api.invalidUrl;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
});
|
|
795
|
-
if (!url) {
|
|
796
|
-
handleCancellation(scriptLang);
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
const keyMessage = apiChoice === "auth_token" ? i18n.api.enterAuthToken : i18n.api.enterApiKey;
|
|
800
|
-
const { key } = await inquirer.prompt({
|
|
801
|
-
type: "input",
|
|
802
|
-
name: "key",
|
|
803
|
-
message: keyMessage,
|
|
804
|
-
validate: (value) => {
|
|
805
|
-
if (!value) {
|
|
806
|
-
return i18n.api.keyRequired;
|
|
807
|
-
}
|
|
808
|
-
const validation = validateApiKey(value, scriptLang);
|
|
809
|
-
if (!validation.isValid) {
|
|
810
|
-
return validation.error || i18n.api.invalidKeyFormat;
|
|
811
|
-
}
|
|
812
|
-
return true;
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
if (!key) {
|
|
816
|
-
handleCancellation(scriptLang);
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
const apiConfig = { url, key, authType: apiChoice };
|
|
820
|
-
const configuredApi = configureApi(apiConfig);
|
|
821
|
-
if (configuredApi) {
|
|
822
|
-
console.log(ansis.green(`\u2714 ${i18n.api.apiConfigSuccess}`));
|
|
823
|
-
console.log(ansis.gray(` URL: ${configuredApi.url}`));
|
|
824
|
-
console.log(ansis.gray(` Key: ${formatApiKeyDisplay(configuredApi.key)}`));
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
577
|
async function configureMcpFeature(scriptLang) {
|
|
828
578
|
const i18n = getTranslation(scriptLang);
|
|
829
579
|
if (isWindows()) {
|
|
@@ -962,7 +712,7 @@ async function update(options = {}) {
|
|
|
962
712
|
const configLang = options.configLang || "zh-CN";
|
|
963
713
|
const aiOutputLang = await resolveAiOutputLanguage(scriptLang, options.aiOutputLang, zcfConfig);
|
|
964
714
|
console.log(ansis.cyan(`
|
|
965
|
-
${i18n.
|
|
715
|
+
${i18n.configuration.updatingPrompts}
|
|
966
716
|
`));
|
|
967
717
|
await updatePromptOnly(configLang, scriptLang, aiOutputLang);
|
|
968
718
|
await selectAndInstallWorkflows(configLang, scriptLang);
|
|
@@ -1008,14 +758,8 @@ async function showMainMenu() {
|
|
|
1008
758
|
processor: () => configureAiMemoryFeature(scriptLang),
|
|
1009
759
|
section: "\u57FA\u7840\u914D\u7F6E"
|
|
1010
760
|
},
|
|
1011
|
-
"5": {
|
|
1012
|
-
key: "5",
|
|
1013
|
-
labelKey: "configureApi",
|
|
1014
|
-
processor: () => configureApiFeature(scriptLang),
|
|
1015
|
-
section: "\u57FA\u7840\u914D\u7F6E"
|
|
1016
|
-
},
|
|
1017
761
|
"6": {
|
|
1018
|
-
key: "
|
|
762
|
+
key: "5",
|
|
1019
763
|
labelKey: "configureEnvPermission",
|
|
1020
764
|
processor: () => configureEnvPermissionFeature(scriptLang),
|
|
1021
765
|
section: "\u57FA\u7840\u914D\u7F6E"
|
|
@@ -1067,7 +811,16 @@ async function showMainMenu() {
|
|
|
1067
811
|
} catch (error) {
|
|
1068
812
|
}
|
|
1069
813
|
}
|
|
1070
|
-
|
|
814
|
+
try {
|
|
815
|
+
await handleMenuContinuation(choice, i18n);
|
|
816
|
+
} catch (continuationError) {
|
|
817
|
+
if (continuationError.message === "EXIT_MENU") {
|
|
818
|
+
console.log(ansis.cyan(i18n.common.goodbye));
|
|
819
|
+
exitMenu = true;
|
|
820
|
+
break;
|
|
821
|
+
}
|
|
822
|
+
throw continuationError;
|
|
823
|
+
}
|
|
1071
824
|
}
|
|
1072
825
|
}
|
|
1073
826
|
}
|
|
@@ -1090,8 +843,7 @@ async function handleMenuContinuation(choice, i18n) {
|
|
|
1090
843
|
default: true
|
|
1091
844
|
});
|
|
1092
845
|
if (!shouldContinue) {
|
|
1093
|
-
|
|
1094
|
-
process.exit(0);
|
|
846
|
+
throw new Error("EXIT_MENU");
|
|
1095
847
|
}
|
|
1096
848
|
} catch (error) {
|
|
1097
849
|
if (error instanceof EscapeKeyPressed) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, H as addCompletedOnboarding, x as applyAiLanguageDirective, q as backupExistingConfig, D as backupMcpConfig, F as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, s as configureApi, r as copyConfigFiles, p as ensureClaudeDir, G as fixWindowsMcpConfig, w as getExistingApiConfig, y as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, n as installClaudeCode, l as isClaudeCodeInstalled, m as mergeAndCleanPermissions, t as mergeConfigs, E as mergeMcpServers, v as mergeSettingsFile, o as openSettingsJson, z as readMcpConfig, u as updateDefaultModel, B as writeMcpConfig } from './shared/aico-cli.
|
|
1
|
+
export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, I as I18N, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, H as addCompletedOnboarding, x as applyAiLanguageDirective, q as backupExistingConfig, D as backupMcpConfig, F as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, s as configureApi, r as copyConfigFiles, p as ensureClaudeDir, G as fixWindowsMcpConfig, w as getExistingApiConfig, y as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, n as installClaudeCode, l as isClaudeCodeInstalled, m as mergeAndCleanPermissions, t as mergeConfigs, E as mergeMcpServers, v as mergeSettingsFile, o as openSettingsJson, z as readMcpConfig, u as updateDefaultModel, B as writeMcpConfig } from './shared/aico-cli.De5MHWWb.mjs';
|
|
2
2
|
import 'inquirer';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'node:fs';
|
|
@@ -65,6 +65,11 @@ ${i18n.common.returnToPrevious || "\u8FD4\u56DE\u4E0A\u4E00\u6B65"}`)
|
|
|
65
65
|
);
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
|
+
if (error.name === "ExitPromptError" || error.isTtyError || error.message?.includes("User force closed")) {
|
|
69
|
+
console.log(ansis.yellow(`
|
|
70
|
+
${i18n.common.cancelled || "\u64CD\u4F5C\u5DF2\u53D6\u6D88"}`));
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
68
73
|
throw error;
|
|
69
74
|
}
|
|
70
75
|
}
|
|
@@ -75,7 +80,7 @@ const inquirer = {
|
|
|
75
80
|
createPromptModule: inquirer$1.createPromptModule
|
|
76
81
|
};
|
|
77
82
|
|
|
78
|
-
const version = "0.0.
|
|
83
|
+
const version = "0.0.2";
|
|
79
84
|
|
|
80
85
|
const common$1 = {
|
|
81
86
|
// Basic
|
|
@@ -290,7 +295,11 @@ const workflow$1 = {
|
|
|
290
295
|
workflowOption: {
|
|
291
296
|
featPlanUx: "\u529F\u80FD\u89C4\u5212\u548C UX \u8BBE\u8BA1 (feat + planner + ui-ux-designer)",
|
|
292
297
|
sixStepsWorkflow: "\u516D\u6B65\u5DE5\u4F5C\u6D41 (workflow)",
|
|
293
|
-
bmadWorkflow: "BMAD-Method \u6269\u5C55\u5B89\u88C5\u5668 (\u652F\u6301\u654F\u6377\u5F00\u53D1\u5DE5\u4F5C\u6D41)"
|
|
298
|
+
bmadWorkflow: "BMAD-Method \u6269\u5C55\u5B89\u88C5\u5668 (\u652F\u6301\u654F\u6377\u5F00\u53D1\u5DE5\u4F5C\u6D41)",
|
|
299
|
+
gitWorkflow: "\u667A\u80FD Git \u64CD\u4F5C (Git \u63D0\u4EA4\u3001\u56DE\u6EDA\u3001\u6E05\u7406\u5206\u652F)"
|
|
300
|
+
},
|
|
301
|
+
workflowDescription: {
|
|
302
|
+
gitWorkflow: "\u589E\u5F3A\u7248 Git \u547D\u4EE4\uFF0C\u652F\u6301\u667A\u80FD\u63D0\u4EA4\u3001\u5B89\u5168\u56DE\u6EDA\u548C\u81EA\u52A8\u5316\u5206\u652F\u6E05\u7406"
|
|
294
303
|
},
|
|
295
304
|
// BMAD workflow
|
|
296
305
|
bmadInitPrompt: "\u2728 \u8BF7\u5728\u9879\u76EE\u4E2D\u8FD0\u884C /bmad-init \u547D\u4EE4\u6765\u521D\u59CB\u5316\u6216\u66F4\u65B0 BMAD-Method \u6269\u5C55",
|
|
@@ -304,7 +313,8 @@ const workflow$1 = {
|
|
|
304
313
|
workflowInstallSuccess: "\u5DE5\u4F5C\u6D41\u5B89\u88C5\u6210\u529F",
|
|
305
314
|
workflowInstallError: "\u5DE5\u4F5C\u6D41\u5B89\u88C5\u51FA\u9519",
|
|
306
315
|
cleaningOldFiles: "\u6E05\u7406\u65E7\u7248\u672C\u6587\u4EF6",
|
|
307
|
-
removedOldFile: "\u5DF2\u5220\u9664\u65E7\u6587\u4EF6"
|
|
316
|
+
removedOldFile: "\u5DF2\u5220\u9664\u65E7\u6587\u4EF6",
|
|
317
|
+
failedToRemoveFile: "\u5220\u9664\u6587\u4EF6\u5931\u8D25"
|
|
308
318
|
};
|
|
309
319
|
|
|
310
320
|
const cli$1 = {
|
|
@@ -722,7 +732,11 @@ const workflow = {
|
|
|
722
732
|
workflowOption: {
|
|
723
733
|
featPlanUx: "Feature Planning and UX Design (feat + planner + ui-ux-designer)",
|
|
724
734
|
sixStepsWorkflow: "Six Steps Workflow (workflow)",
|
|
725
|
-
bmadWorkflow: "BMAD-Method Extension Installer (Agile Development Workflow)"
|
|
735
|
+
bmadWorkflow: "BMAD-Method Extension Installer (Agile Development Workflow)",
|
|
736
|
+
gitWorkflow: "Smart Git Operations (Git Commit, Rollback, Clean Branches)"
|
|
737
|
+
},
|
|
738
|
+
workflowDescription: {
|
|
739
|
+
gitWorkflow: "Enhanced Git commands for smart commits, safe rollbacks, and automated branch cleanup"
|
|
726
740
|
},
|
|
727
741
|
// BMAD workflow
|
|
728
742
|
bmadInitPrompt: "\u2728 Please run /bmad-init command in your project to initialize or update BMAD-Method extension",
|
|
@@ -736,7 +750,8 @@ const workflow = {
|
|
|
736
750
|
workflowInstallSuccess: "workflow installed successfully",
|
|
737
751
|
workflowInstallError: "workflow installation had errors",
|
|
738
752
|
cleaningOldFiles: "Cleaning up old version files",
|
|
739
|
-
removedOldFile: "Removed old file"
|
|
753
|
+
removedOldFile: "Removed old file",
|
|
754
|
+
failedToRemoveFile: "Failed to remove"
|
|
740
755
|
};
|
|
741
756
|
|
|
742
757
|
const cli = {
|
|
@@ -1255,7 +1270,7 @@ function updateZcfConfig(updates) {
|
|
|
1255
1270
|
const AI_PERSONALITIES = [
|
|
1256
1271
|
{
|
|
1257
1272
|
id: "professional",
|
|
1258
|
-
name: { "zh-CN": "\u4E13\u4E1A\
|
|
1273
|
+
name: { "zh-CN": "\u4E13\u4E1A\u7A0B\u5E8F\u5458\u6A21\u5F0F", en: "Professional Assistant(Default)" },
|
|
1259
1274
|
directive: {
|
|
1260
1275
|
"zh-CN": "\u4F60\u662F\u4E00\u540D\u7ECF\u9A8C\u4E30\u5BCC\u7684[\u4E13\u4E1A\u9886\u57DF\uFF0C\u4F8B\u5982\uFF1A\u8F6F\u4EF6\u5F00\u53D1\u5DE5\u7A0B\u5E08 / \u7CFB\u7EDF\u8BBE\u8BA1\u5E08 / \u4EE3\u7801\u67B6\u6784\u5E08]\uFF0C\u4E13\u6CE8\u4E8E\u6784\u5EFA[\u6838\u5FC3\u7279\u957F\uFF0C\u4F8B\u5982\uFF1A\u9AD8\u6027\u80FD / \u53EF\u7EF4\u62A4 / \u5065\u58EE / \u9886\u57DF\u9A71\u52A8]\u7684\u89E3\u51B3\u65B9\u6848\u3002",
|
|
1261
1276
|
en: "You are an experienced [professional domain, e.g., Software Development Engineer / System Designer / Code Architect], specializing in building [core strengths, e.g., high-performance / maintainable / robust / domain-driven] solutions."
|
|
@@ -1263,7 +1278,7 @@ const AI_PERSONALITIES = [
|
|
|
1263
1278
|
},
|
|
1264
1279
|
{
|
|
1265
1280
|
id: "friendly",
|
|
1266
|
-
name: { "zh-CN": "\
|
|
1281
|
+
name: { "zh-CN": "\u7ED3\u4F34\u7F16\u7A0B\u6A21\u5F0F", en: "Friendly Assistant" },
|
|
1267
1282
|
directive: {
|
|
1268
1283
|
"zh-CN": "\u4F60\u662F\u4E00\u4F4D\u53CB\u597D\u3001\u8010\u5FC3\u3001\u5584\u4E8E\u89E3\u91CA\u7684\u7F16\u7A0B\u52A9\u624B\u3002\u4F1A\u7528\u901A\u4FD7\u6613\u61C2\u7684\u65B9\u5F0F\u89E3\u91CA\u590D\u6742\u6982\u5FF5\uFF0C\u5E76\u7ECF\u5E38\u7ED9\u4E88\u9F13\u52B1\u3002",
|
|
1269
1284
|
en: "You are a friendly, patient, and explanatory programming assistant. You explain complex concepts in easy-to-understand ways and often provide encouragement."
|
|
@@ -1271,16 +1286,11 @@ const AI_PERSONALITIES = [
|
|
|
1271
1286
|
},
|
|
1272
1287
|
{
|
|
1273
1288
|
id: "mentor",
|
|
1274
|
-
name: { "zh-CN": "\u5BFC\
|
|
1289
|
+
name: { "zh-CN": "\u7A0B\u5E8F\u5458\u5927\u725B\u6307\u5BFC\u6A21\u5F0F", en: "Mentor Mode" },
|
|
1275
1290
|
directive: {
|
|
1276
1291
|
"zh-CN": "\u4F60\u662F\u4E00\u4F4D\u7ECF\u9A8C\u4E30\u5BCC\u7684\u7F16\u7A0B\u5BFC\u5E08\u3002\u4E0D\u4EC5\u63D0\u4F9B\u89E3\u51B3\u65B9\u6848\uFF0C\u8FD8\u4F1A\u89E3\u91CA\u80CC\u540E\u7684\u539F\u7406\uFF0C\u5F15\u5BFC\u7528\u6237\u601D\u8003\uFF0C\u57F9\u517B\u72EC\u7ACB\u89E3\u51B3\u95EE\u9898\u7684\u80FD\u529B\u3002",
|
|
1277
1292
|
en: "You are an experienced programming mentor. You not only provide solutions but also explain the principles behind them, guide users to think, and cultivate their ability to solve problems independently."
|
|
1278
1293
|
}
|
|
1279
|
-
},
|
|
1280
|
-
{
|
|
1281
|
-
id: "custom",
|
|
1282
|
-
name: { "zh-CN": "\u81EA\u5B9A\u4E49", en: "Custom" },
|
|
1283
|
-
directive: { "zh-CN": "", en: "" }
|
|
1284
1294
|
}
|
|
1285
1295
|
];
|
|
1286
1296
|
function getExistingPersonality() {
|
|
@@ -1296,9 +1306,15 @@ async function configureAiPersonality(scriptLang, showExisting = true) {
|
|
|
1296
1306
|
if (showExisting && existingPersonality) {
|
|
1297
1307
|
const personalityInfo = getPersonalityInfo(existingPersonality);
|
|
1298
1308
|
if (personalityInfo) {
|
|
1299
|
-
console.log("\n" + ansis.blue(`\u2139 ${i18n.configuration.existingPersonality || "Existing AI personality configuration"}`));
|
|
1300
1309
|
console.log(
|
|
1301
|
-
|
|
1310
|
+
"\n" + ansis.blue(
|
|
1311
|
+
`\u2139 ${i18n.configuration.existingPersonality || "Existing AI personality configuration"}`
|
|
1312
|
+
)
|
|
1313
|
+
);
|
|
1314
|
+
console.log(
|
|
1315
|
+
ansis.gray(
|
|
1316
|
+
` ${i18n.configuration.currentPersonality || "Current personality"}: ${personalityInfo.name[scriptLang]}`
|
|
1317
|
+
)
|
|
1302
1318
|
);
|
|
1303
1319
|
const { modify } = await inquirer.prompt({
|
|
1304
1320
|
type: "confirm",
|
|
@@ -1307,7 +1323,11 @@ async function configureAiPersonality(scriptLang, showExisting = true) {
|
|
|
1307
1323
|
default: false
|
|
1308
1324
|
});
|
|
1309
1325
|
if (!modify) {
|
|
1310
|
-
console.log(
|
|
1326
|
+
console.log(
|
|
1327
|
+
ansis.green(
|
|
1328
|
+
`\u2714 ${i18n.configuration.keepPersonality || "Keeping existing personality"}`
|
|
1329
|
+
)
|
|
1330
|
+
);
|
|
1311
1331
|
return;
|
|
1312
1332
|
}
|
|
1313
1333
|
}
|
|
@@ -1316,11 +1336,17 @@ async function configureAiPersonality(scriptLang, showExisting = true) {
|
|
|
1316
1336
|
type: "list",
|
|
1317
1337
|
name: "personality",
|
|
1318
1338
|
message: i18n.configuration.selectAiPersonality || "Select AI personality",
|
|
1319
|
-
choices: addNumbersToChoices(
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1339
|
+
choices: addNumbersToChoices(
|
|
1340
|
+
AI_PERSONALITIES.map((p) => ({
|
|
1341
|
+
name: p.id !== "custom" ? `${p.name[scriptLang]} - ${ansis.gray(
|
|
1342
|
+
p.directive[scriptLang].substring(0, 50) + "..."
|
|
1343
|
+
)}` : `${p.name[scriptLang]} - ${ansis.gray(
|
|
1344
|
+
i18n.configuration.customPersonalityHint || "Define your own personality"
|
|
1345
|
+
)}`,
|
|
1346
|
+
value: p.id,
|
|
1347
|
+
short: p.name[scriptLang]
|
|
1348
|
+
}))
|
|
1349
|
+
),
|
|
1324
1350
|
default: existingPersonality ? AI_PERSONALITIES.findIndex((p) => p.id === existingPersonality) : 0
|
|
1325
1351
|
});
|
|
1326
1352
|
if (!personality) {
|
|
@@ -1348,7 +1374,11 @@ async function configureAiPersonality(scriptLang, showExisting = true) {
|
|
|
1348
1374
|
}
|
|
1349
1375
|
await applyPersonalityDirective(directive);
|
|
1350
1376
|
updateZcfConfig({ aiPersonality: personality });
|
|
1351
|
-
console.log(
|
|
1377
|
+
console.log(
|
|
1378
|
+
ansis.green(
|
|
1379
|
+
`\u2714 ${i18n.configuration.personalityConfigured || "AI personality configured"}`
|
|
1380
|
+
)
|
|
1381
|
+
);
|
|
1352
1382
|
}
|
|
1353
1383
|
async function applyPersonalityDirective(directive) {
|
|
1354
1384
|
try {
|
|
@@ -1357,7 +1387,12 @@ async function applyPersonalityDirective(directive) {
|
|
|
1357
1387
|
} catch (error) {
|
|
1358
1388
|
const lang = readZcfConfig()?.preferredLang || "en";
|
|
1359
1389
|
const errorI18n = getTranslation(lang);
|
|
1360
|
-
console.error(
|
|
1390
|
+
console.error(
|
|
1391
|
+
ansis.red(
|
|
1392
|
+
errorI18n.configuration.failedToApplyPersonality || "Failed to apply personality"
|
|
1393
|
+
),
|
|
1394
|
+
error
|
|
1395
|
+
);
|
|
1361
1396
|
}
|
|
1362
1397
|
}
|
|
1363
1398
|
|
|
@@ -1367,19 +1402,19 @@ function displayBanner(subtitle) {
|
|
|
1367
1402
|
const paddedSubtitle = subtitleText.padEnd(60, " ");
|
|
1368
1403
|
console.log(
|
|
1369
1404
|
ansis.cyan.bold(`
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1405
|
+
|
|
1406
|
+
|
|
1407
|
+
\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
1408
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557
|
|
1409
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
1410
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551
|
|
1411
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D
|
|
1412
|
+
\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D
|
|
1413
|
+
|
|
1414
|
+
${ansis.white.bold("\u667A\u80FD\u8F6F\u4EF6\u661F\u5DE5\u5382")}
|
|
1415
|
+
${ansis.gray(paddedSubtitle)}
|
|
1416
|
+
|
|
1417
|
+
|
|
1383
1418
|
`)
|
|
1384
1419
|
);
|
|
1385
1420
|
}
|
|
@@ -1393,10 +1428,10 @@ function handleExitPromptError(error) {
|
|
|
1393
1428
|
const zcfConfig = readZcfConfig();
|
|
1394
1429
|
const defaultLang = zcfConfig?.preferredLang || "zh-CN";
|
|
1395
1430
|
const i18n = getTranslation(defaultLang);
|
|
1396
|
-
console.log(ansis.
|
|
1397
|
-
${i18n.common.
|
|
1431
|
+
console.log(ansis.yellow(`
|
|
1432
|
+
${i18n.common.cancelled || "\u64CD\u4F5C\u5DF2\u53D6\u6D88"}
|
|
1398
1433
|
`));
|
|
1399
|
-
|
|
1434
|
+
return true;
|
|
1400
1435
|
}
|
|
1401
1436
|
if (error instanceof EscapeKeyPressed) {
|
|
1402
1437
|
return true;
|
|
@@ -1929,6 +1964,18 @@ const WORKFLOW_CONFIGS = [
|
|
|
1929
1964
|
autoInstallAgents: false,
|
|
1930
1965
|
category: "bmad",
|
|
1931
1966
|
outputDir: "bmad"
|
|
1967
|
+
},
|
|
1968
|
+
{
|
|
1969
|
+
id: "gitWorkflow",
|
|
1970
|
+
nameKey: "workflowOption.gitWorkflow",
|
|
1971
|
+
descriptionKey: "workflowDescription.gitWorkflow",
|
|
1972
|
+
defaultSelected: true,
|
|
1973
|
+
order: 4,
|
|
1974
|
+
commands: ["git-commit.md", "git-rollback.md", "git-cleanBranches.md"],
|
|
1975
|
+
agents: [],
|
|
1976
|
+
autoInstallAgents: false,
|
|
1977
|
+
category: "git",
|
|
1978
|
+
outputDir: "git"
|
|
1932
1979
|
}
|
|
1933
1980
|
];
|
|
1934
1981
|
function getWorkflowConfig(workflowId) {
|