@optima-chat/commerce-cli 1.4.0 → 1.5.0

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.
Files changed (84) hide show
  1. package/.claude/skills/commerce-storefront/SKILL.md +183 -3
  2. package/dist/api/rest/commerce.d.ts +170 -1
  3. package/dist/api/rest/commerce.d.ts.map +1 -1
  4. package/dist/api/rest/commerce.js +167 -0
  5. package/dist/api/rest/commerce.js.map +1 -1
  6. package/dist/commands/section/create.d.ts +3 -0
  7. package/dist/commands/section/create.d.ts.map +1 -0
  8. package/dist/commands/section/create.js +218 -0
  9. package/dist/commands/section/create.js.map +1 -0
  10. package/dist/commands/section/delete.d.ts +3 -0
  11. package/dist/commands/section/delete.d.ts.map +1 -0
  12. package/dist/commands/section/delete.js +86 -0
  13. package/dist/commands/section/delete.js.map +1 -0
  14. package/dist/commands/section/hide.d.ts +3 -0
  15. package/dist/commands/section/hide.d.ts.map +1 -0
  16. package/dist/commands/section/hide.js +82 -0
  17. package/dist/commands/section/hide.js.map +1 -0
  18. package/dist/commands/section/index.d.ts +4 -0
  19. package/dist/commands/section/index.d.ts.map +1 -0
  20. package/dist/commands/section/index.js +23 -0
  21. package/dist/commands/section/index.js.map +1 -0
  22. package/dist/commands/section/list.d.ts +3 -0
  23. package/dist/commands/section/list.d.ts.map +1 -0
  24. package/dist/commands/section/list.js +164 -0
  25. package/dist/commands/section/list.js.map +1 -0
  26. package/dist/commands/section/product/create.d.ts +3 -0
  27. package/dist/commands/section/product/create.d.ts.map +1 -0
  28. package/dist/commands/section/product/create.js +208 -0
  29. package/dist/commands/section/product/create.js.map +1 -0
  30. package/dist/commands/section/product/delete.d.ts +3 -0
  31. package/dist/commands/section/product/delete.d.ts.map +1 -0
  32. package/dist/commands/section/product/delete.js +85 -0
  33. package/dist/commands/section/product/delete.js.map +1 -0
  34. package/dist/commands/section/product/hide.d.ts +3 -0
  35. package/dist/commands/section/product/hide.d.ts.map +1 -0
  36. package/dist/commands/section/product/hide.js +78 -0
  37. package/dist/commands/section/product/hide.js.map +1 -0
  38. package/dist/commands/section/product/index.d.ts +4 -0
  39. package/dist/commands/section/product/index.d.ts.map +1 -0
  40. package/dist/commands/section/product/index.js +17 -0
  41. package/dist/commands/section/product/index.js.map +1 -0
  42. package/dist/commands/section/product/list.d.ts +3 -0
  43. package/dist/commands/section/product/list.d.ts.map +1 -0
  44. package/dist/commands/section/product/list.js +157 -0
  45. package/dist/commands/section/product/list.js.map +1 -0
  46. package/dist/commands/section/product/reorder.d.ts +3 -0
  47. package/dist/commands/section/product/reorder.d.ts.map +1 -0
  48. package/dist/commands/section/product/reorder.js +110 -0
  49. package/dist/commands/section/product/reorder.js.map +1 -0
  50. package/dist/commands/section/product/update.d.ts +3 -0
  51. package/dist/commands/section/product/update.d.ts.map +1 -0
  52. package/dist/commands/section/product/update.js +127 -0
  53. package/dist/commands/section/product/update.js.map +1 -0
  54. package/dist/commands/section/reorder.d.ts +3 -0
  55. package/dist/commands/section/reorder.d.ts.map +1 -0
  56. package/dist/commands/section/reorder.js +111 -0
  57. package/dist/commands/section/reorder.js.map +1 -0
  58. package/dist/commands/section/translation/delete.d.ts +3 -0
  59. package/dist/commands/section/translation/delete.d.ts.map +1 -0
  60. package/dist/commands/section/translation/delete.js +97 -0
  61. package/dist/commands/section/translation/delete.js.map +1 -0
  62. package/dist/commands/section/translation/index.d.ts +4 -0
  63. package/dist/commands/section/translation/index.d.ts.map +1 -0
  64. package/dist/commands/section/translation/index.js +11 -0
  65. package/dist/commands/section/translation/index.js.map +1 -0
  66. package/dist/commands/section/translation/list.d.ts +3 -0
  67. package/dist/commands/section/translation/list.d.ts.map +1 -0
  68. package/dist/commands/section/translation/list.js +104 -0
  69. package/dist/commands/section/translation/list.js.map +1 -0
  70. package/dist/commands/section/translation/set.d.ts +3 -0
  71. package/dist/commands/section/translation/set.d.ts.map +1 -0
  72. package/dist/commands/section/translation/set.js +151 -0
  73. package/dist/commands/section/translation/set.js.map +1 -0
  74. package/dist/commands/section/update.d.ts +3 -0
  75. package/dist/commands/section/update.d.ts.map +1 -0
  76. package/dist/commands/section/update.js +137 -0
  77. package/dist/commands/section/update.js.map +1 -0
  78. package/dist/index.js +8 -6
  79. package/dist/index.js.map +1 -1
  80. package/dist/utils/config.d.ts +4 -1
  81. package/dist/utils/config.d.ts.map +1 -1
  82. package/dist/utils/config.js +10 -2
  83. package/dist/utils/config.js.map +1 -1
  84. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { commerceApi } from '../../../api/rest/commerce.js';
5
+ import { handleError, createApiError, ValidationError } from '../../../utils/error.js';
6
+ import { output } from '../../../utils/output.js';
7
+ import { addEnhancedHelp } from '../../../utils/helpText.js';
8
+ import { isInteractiveEnvironment } from '../../../utils/interactive.js';
9
+ const cmd = new Command('delete')
10
+ .description('Delete translation for a section')
11
+ .argument('<handle>', 'Section handle')
12
+ .option('--lang <code>', 'Language code to delete (required)')
13
+ .option('--product-id <id>', 'Product ID (for product-level translation)')
14
+ .option('-y, --yes', 'Skip confirmation prompt')
15
+ .action(async (handle, options) => {
16
+ try {
17
+ await deleteTranslation(handle, options);
18
+ }
19
+ catch (error) {
20
+ handleError(error);
21
+ }
22
+ });
23
+ addEnhancedHelp(cmd, {
24
+ examples: [
25
+ '# Delete merchant-level Chinese translation',
26
+ '$ commerce section translation delete care --lang zh-CN',
27
+ '',
28
+ '# Delete with confirmation skip',
29
+ '$ commerce section translation delete care --lang zh-CN --yes',
30
+ '',
31
+ '# Delete product-level translation',
32
+ '$ commerce section translation delete care --lang ja-JP --product-id prod-123 --yes',
33
+ ],
34
+ output: {
35
+ example: JSON.stringify({
36
+ success: true,
37
+ message: '翻译已删除',
38
+ }, null, 2),
39
+ },
40
+ relatedCommands: [
41
+ { command: 'section translation list', description: 'View translations' },
42
+ { command: 'section translation set', description: 'Add translation' },
43
+ ],
44
+ notes: [
45
+ 'Use --yes to skip confirmation in non-interactive environments',
46
+ 'Without --product-id: deletes merchant-level translation',
47
+ 'With --product-id: deletes product-level translation',
48
+ ],
49
+ });
50
+ export const deleteTranslationCommand = cmd;
51
+ async function deleteTranslation(handle, options) {
52
+ const { lang, productId, yes } = options;
53
+ if (!lang || lang.trim().length === 0) {
54
+ throw new ValidationError('缺少必需参数: --lang (语言代码)', 'lang');
55
+ }
56
+ if (!isInteractiveEnvironment() && !yes) {
57
+ throw new ValidationError('非交互模式下需要 --yes 确认删除操作', 'yes');
58
+ }
59
+ if (isInteractiveEnvironment() && !yes) {
60
+ const { confirm } = await inquirer.prompt([
61
+ {
62
+ type: 'confirm',
63
+ name: 'confirm',
64
+ message: `确定要删除区块 "${handle}" 的 ${lang} 翻译吗?`,
65
+ default: false,
66
+ },
67
+ ]);
68
+ if (!confirm) {
69
+ console.log(chalk.yellow('已取消删除操作'));
70
+ return;
71
+ }
72
+ }
73
+ const level = productId ? '商品级' : '商户级';
74
+ const spinner = output.spinner(`正在删除${level}翻译...`);
75
+ try {
76
+ if (productId) {
77
+ await commerceApi.productSections.product.translations.delete(productId, handle, lang);
78
+ }
79
+ else {
80
+ await commerceApi.productSections.merchant.translations.delete(handle, lang);
81
+ }
82
+ spinner.succeed('翻译已删除!');
83
+ if (output.isJson()) {
84
+ output.success({ handle, language_code: lang, product_id: productId || null }, '翻译已删除');
85
+ }
86
+ else {
87
+ console.log();
88
+ console.log(chalk.green(`✓ 区块 "${handle}" 的 ${lang} 翻译已删除`));
89
+ console.log();
90
+ }
91
+ }
92
+ catch (error) {
93
+ spinner.fail('删除翻译失败');
94
+ throw createApiError(error);
95
+ }
96
+ }
97
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/section/translation/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,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,CAAC;QACH,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzF,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/E,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE1B,IAAI,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YACpB,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,IAAI,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;QAC1F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,MAAM,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ declare const translationCommand: Command;
3
+ export { translationCommand };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/section/translation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,QAAA,MAAM,kBAAkB,SACwB,CAAC;AAMjD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { Command } from 'commander';
2
+ import { listTranslationsCommand } from './list.js';
3
+ import { setTranslationCommand } from './set.js';
4
+ import { deleteTranslationCommand } from './delete.js';
5
+ const translationCommand = new Command('translation')
6
+ .description('Section translation management');
7
+ translationCommand.addCommand(listTranslationsCommand);
8
+ translationCommand.addCommand(setTranslationCommand);
9
+ translationCommand.addCommand(deleteTranslationCommand);
10
+ export { translationCommand };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/section/translation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,aAAa,CAAC;KAClD,WAAW,CAAC,gCAAgC,CAAC,CAAC;AAEjD,kBAAkB,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;AACvD,kBAAkB,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;AACrD,kBAAkB,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const listTranslationsCommand: Command;
3
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/commands/section/translation/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkEpC,eAAO,MAAM,uBAAuB,SAAM,CAAC"}
@@ -0,0 +1,104 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { commerceApi } from '../../../api/rest/commerce.js';
4
+ import { handleError, createApiError } from '../../../utils/error.js';
5
+ import { output } from '../../../utils/output.js';
6
+ import { addEnhancedHelp } from '../../../utils/helpText.js';
7
+ const cmd = new Command('list')
8
+ .description('List translations for a section')
9
+ .argument('<handle>', 'Section handle')
10
+ .option('--product-id <id>', 'Product ID (for product-level translations)')
11
+ .action(async (handle, options) => {
12
+ try {
13
+ await listTranslations(handle, options);
14
+ }
15
+ catch (error) {
16
+ handleError(error);
17
+ }
18
+ });
19
+ addEnhancedHelp(cmd, {
20
+ examples: [
21
+ '# List merchant-level translations for care section',
22
+ '$ commerce section translation list care',
23
+ '',
24
+ '# List product-level translations',
25
+ '$ commerce section translation list care --product-id prod-123',
26
+ ],
27
+ output: {
28
+ example: JSON.stringify({
29
+ success: true,
30
+ data: {
31
+ translations: [
32
+ {
33
+ language_code: 'en-US',
34
+ title: 'Care Instructions',
35
+ content: 'Machine washable, cold water.',
36
+ },
37
+ {
38
+ language_code: 'zh-CN',
39
+ title: '护理说明',
40
+ content: '机洗,冷水。',
41
+ },
42
+ ],
43
+ },
44
+ }, null, 2),
45
+ },
46
+ relatedCommands: [
47
+ { command: 'section translation set', description: 'Add or update translation' },
48
+ { command: 'section translation delete', description: 'Delete translation' },
49
+ { command: 'section list --resolved', description: 'View all sections with translations' },
50
+ ],
51
+ notes: [
52
+ 'Without --product-id: lists merchant-level translations',
53
+ 'With --product-id: lists product-level translations',
54
+ 'The section must have a customization/override to have translations',
55
+ ],
56
+ });
57
+ export const listTranslationsCommand = cmd;
58
+ async function listTranslations(handle, options) {
59
+ const { productId } = options;
60
+ const level = productId ? '商品级' : '商户级';
61
+ const spinner = output.spinner(`正在获取${level}翻译...`);
62
+ try {
63
+ let translations;
64
+ if (productId) {
65
+ translations = await commerceApi.productSections.product.translations.list(productId, handle);
66
+ }
67
+ else {
68
+ translations = await commerceApi.productSections.merchant.translations.list(handle);
69
+ }
70
+ spinner.succeed(`${level}翻译获取成功`);
71
+ if (!translations || translations.length === 0) {
72
+ if (output.isJson()) {
73
+ output.success({ translations: [] }, '暂无翻译');
74
+ }
75
+ else {
76
+ console.log(chalk.yellow(`\n区块 "${handle}" 暂无翻译\n`));
77
+ }
78
+ return;
79
+ }
80
+ if (output.isJson()) {
81
+ output.success({ translations });
82
+ }
83
+ else {
84
+ console.log();
85
+ console.log(chalk.bold(`区块 "${handle}" 的翻译(${level}):\n`));
86
+ translations.forEach((trans, index) => {
87
+ console.log(chalk.cyan(`${index + 1}. ${trans.language_code}`));
88
+ console.log(chalk.gray(` 标题: ${trans.title || '(无)'}`));
89
+ if (trans.content) {
90
+ const preview = trans.content.length > 80 ? trans.content.substring(0, 80) + '...' : trans.content;
91
+ console.log(chalk.gray(` 内容: ${preview}`));
92
+ }
93
+ console.log();
94
+ });
95
+ console.log(chalk.gray(`共 ${translations.length} 种语言`));
96
+ console.log();
97
+ }
98
+ }
99
+ catch (error) {
100
+ spinner.fail('获取翻译失败');
101
+ throw createApiError(error);
102
+ }
103
+ }
104
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/section/translation/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7D,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC5B,WAAW,CAAC,iCAAiC,CAAC;KAC9C,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;KACtC,MAAM,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;KAC1E,MAAM,CA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GAAG,CAAC,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;gBAChE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC1D,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;oBAClB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;oBACnG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC,CAAC;gBAC/C,CAAC;gBACD,OAAO,CAAC,GAAG,EAAE,CAAC;YAChB,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const setTranslationCommand: Command;
3
+ //# sourceMappingURL=set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../../src/commands/section/translation/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsEpC,eAAO,MAAM,qBAAqB,SAAM,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import inquirer from 'inquirer';
4
+ import { commerceApi } from '../../../api/rest/commerce.js';
5
+ import { handleError, createApiError, ValidationError } from '../../../utils/error.js';
6
+ import { output } from '../../../utils/output.js';
7
+ import { addEnhancedHelp } from '../../../utils/helpText.js';
8
+ import { isInteractiveEnvironment } from '../../../utils/interactive.js';
9
+ const cmd = new Command('set')
10
+ .description('Set (create or update) translation for a section')
11
+ .argument('<handle>', 'Section handle')
12
+ .option('--lang <code>', 'Language code, e.g. en-US, zh-CN, ja-JP (required)')
13
+ .option('--title <title>', 'Translated title (required)')
14
+ .option('--content <content>', 'Translated content in Markdown (required)')
15
+ .option('--product-id <id>', 'Product ID (for product-level translation)')
16
+ .action(async (handle, options) => {
17
+ try {
18
+ await setTranslation(handle, options);
19
+ }
20
+ catch (error) {
21
+ handleError(error);
22
+ }
23
+ });
24
+ addEnhancedHelp(cmd, {
25
+ examples: [
26
+ '# Add Chinese translation for merchant-level care section',
27
+ '$ commerce section translation set care --lang zh-CN --title "护理说明" --content "机洗,30度冷水。"',
28
+ '',
29
+ '# Add Japanese translation for product-level section',
30
+ '$ commerce section translation set care --product-id prod-123 --lang ja-JP --title "お手入れ方法" --content "洗濯機で洗えます。"',
31
+ '',
32
+ '# Update existing translation',
33
+ '$ commerce section translation set care --lang zh-CN --title "护理说明" --content "更新后的内容"',
34
+ ],
35
+ output: {
36
+ example: JSON.stringify({
37
+ success: true,
38
+ data: {
39
+ language_code: 'zh-CN',
40
+ title: '护理说明',
41
+ content: '机洗,30度冷水。',
42
+ },
43
+ message: '翻译设置成功',
44
+ }, null, 2),
45
+ },
46
+ relatedCommands: [
47
+ { command: 'section translation list', description: 'View translations' },
48
+ { command: 'section translation delete', description: 'Delete translation' },
49
+ { command: 'i18n languages', description: 'List supported languages' },
50
+ ],
51
+ notes: [
52
+ 'This creates a new translation or updates an existing one',
53
+ 'Supported languages: en-US, zh-CN, zh-HK, zh-TW, vi-VN, es-ES, ja-JP',
54
+ 'Without --product-id: sets merchant-level translation',
55
+ 'With --product-id: sets product-level translation',
56
+ ],
57
+ });
58
+ export const setTranslationCommand = cmd;
59
+ async function setTranslation(handle, options) {
60
+ let { lang, title, content, productId } = options;
61
+ // 非交互模式验证
62
+ if (!isInteractiveEnvironment()) {
63
+ if (!lang || lang.trim().length === 0) {
64
+ throw new ValidationError('缺少必需参数: --lang (语言代码)', 'lang');
65
+ }
66
+ if (!title || title.trim().length === 0) {
67
+ throw new ValidationError('缺少必需参数: --title (翻译标题)', 'title');
68
+ }
69
+ if (!content || content.trim().length === 0) {
70
+ throw new ValidationError('缺少必需参数: --content (翻译内容)', 'content');
71
+ }
72
+ }
73
+ else {
74
+ // 交互模式
75
+ const answers = await inquirer.prompt([
76
+ {
77
+ type: 'list',
78
+ name: 'lang',
79
+ message: '语言:',
80
+ choices: [
81
+ { name: 'English (US)', value: 'en-US' },
82
+ { name: '简体中文', value: 'zh-CN' },
83
+ { name: '繁體中文 (香港)', value: 'zh-HK' },
84
+ { name: '繁體中文 (台灣)', value: 'zh-TW' },
85
+ { name: 'Tiếng Việt', value: 'vi-VN' },
86
+ { name: 'Español', value: 'es-ES' },
87
+ { name: '日本語', value: 'ja-JP' },
88
+ ],
89
+ when: !lang,
90
+ },
91
+ {
92
+ type: 'input',
93
+ name: 'title',
94
+ message: '翻译标题:',
95
+ when: !title,
96
+ validate: (input) => (input.trim().length > 0 ? true : '标题不能为空'),
97
+ },
98
+ {
99
+ type: 'editor',
100
+ name: 'content',
101
+ message: '翻译内容 (Markdown):',
102
+ when: !content,
103
+ },
104
+ ]);
105
+ lang = lang || answers.lang;
106
+ title = title || answers.title;
107
+ content = content || answers.content;
108
+ }
109
+ const level = productId ? '商品级' : '商户级';
110
+ const spinner = output.spinner(`正在设置${level}翻译...`);
111
+ try {
112
+ let result;
113
+ if (productId) {
114
+ result = await commerceApi.productSections.product.translations.set(productId, handle, lang, {
115
+ title: title,
116
+ content: content,
117
+ });
118
+ }
119
+ else {
120
+ result = await commerceApi.productSections.merchant.translations.set(handle, lang, {
121
+ title: title,
122
+ content: content,
123
+ });
124
+ }
125
+ spinner.succeed('翻译设置成功!');
126
+ if (output.isJson()) {
127
+ output.success(result, '翻译设置成功');
128
+ }
129
+ else {
130
+ console.log();
131
+ console.log(chalk.green('✓ 翻译设置成功!'));
132
+ console.log();
133
+ console.log(chalk.gray('区块: ') + chalk.cyan(handle));
134
+ console.log(chalk.gray('语言: ') + chalk.white(result.language_code));
135
+ console.log(chalk.gray('标题: ') + chalk.white(result.title));
136
+ if (result.content) {
137
+ const preview = result.content.length > 100 ? result.content.substring(0, 100) + '...' : result.content;
138
+ console.log(chalk.gray('内容: ') + chalk.white(preview));
139
+ }
140
+ if (productId) {
141
+ console.log(chalk.gray('商品ID: ') + chalk.white(productId));
142
+ }
143
+ console.log();
144
+ }
145
+ }
146
+ catch (error) {
147
+ spinner.fail('设置翻译失败');
148
+ throw createApiError(error);
149
+ }
150
+ }
151
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../../src/commands/section/translation/set.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AASzE,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KAC3B,WAAW,CAAC,kDAAkD,CAAC;KAC/D,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;KACtC,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CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const updateSectionCommand: Command;
3
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/section/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiFpC,eAAO,MAAM,oBAAoB,SAAM,CAAC"}
@@ -0,0 +1,137 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { commerceApi } from '../../api/rest/commerce.js';
4
+ import { handleError, createApiError, ValidationError } from '../../utils/error.js';
5
+ import { output } from '../../utils/output.js';
6
+ import { addEnhancedHelp } from '../../utils/helpText.js';
7
+ import { isInteractiveEnvironment } from '../../utils/interactive.js';
8
+ const cmd = new Command('update')
9
+ .description('Update a product page section customization (merchant-level)')
10
+ .argument('<handle>', 'Section handle to update')
11
+ .option('--type <type>', 'Section type: collapsible | static')
12
+ .option('--position <n>', 'Display position')
13
+ .option('--content <text>', 'Section content in Markdown')
14
+ .option('--tab-group <group>', 'Tab group name (use empty string to clear)')
15
+ .action(async (handle, options) => {
16
+ try {
17
+ await updateSection(handle, options);
18
+ }
19
+ catch (error) {
20
+ handleError(error);
21
+ }
22
+ });
23
+ addEnhancedHelp(cmd, {
24
+ examples: [
25
+ '# Update section content',
26
+ '$ commerce section update care --content "New care instructions..."',
27
+ '',
28
+ '# Update section position',
29
+ '$ commerce section update care --position 5',
30
+ '',
31
+ '# Update multiple fields',
32
+ '$ commerce section update care --type static --position 3 --content "Updated content"',
33
+ '',
34
+ '# Move section to a tab group',
35
+ '$ commerce section update care --tab-group product-info',
36
+ '',
37
+ '# Remove from tab group (make independent)',
38
+ '$ commerce section update care --tab-group ""',
39
+ ],
40
+ output: {
41
+ example: JSON.stringify({
42
+ success: true,
43
+ data: {
44
+ id: 'customization-uuid',
45
+ merchant_id: 'merchant-uuid',
46
+ handle: 'care',
47
+ operation_type: 'override',
48
+ type: 'collapsible',
49
+ position: 5,
50
+ content: 'New care instructions...',
51
+ tab_group: null,
52
+ created_at: '2025-11-27T00:00:00Z',
53
+ updated_at: '2025-11-27T00:00:00Z',
54
+ },
55
+ message: '区块更新成功',
56
+ }, null, 2),
57
+ },
58
+ relatedCommands: [
59
+ { command: 'section list --resolved', description: 'View all sections' },
60
+ { command: 'section create', description: 'Create a section' },
61
+ { command: 'section delete', description: 'Delete a customization' },
62
+ ],
63
+ notes: [
64
+ 'Only updates the fields you specify',
65
+ 'The section must have a merchant customization to update',
66
+ 'Use section create first if the section has no customization',
67
+ ],
68
+ });
69
+ export const updateSectionCommand = cmd;
70
+ async function updateSection(handle, options) {
71
+ const { type, position, content, tabGroup } = options;
72
+ // 验证至少有一个更新字段
73
+ if (!type && !position && !content && tabGroup === undefined) {
74
+ if (!isInteractiveEnvironment()) {
75
+ throw new ValidationError('至少需要一个更新字段: --type, --position, --content, 或 --tab-group', 'options');
76
+ }
77
+ else {
78
+ console.log(chalk.yellow('提示: 请指定要更新的字段'));
79
+ console.log(chalk.gray(' --type <type> 区块类型'));
80
+ console.log(chalk.gray(' --position <n> 显示位置'));
81
+ console.log(chalk.gray(' --content <text> 区块内容'));
82
+ console.log(chalk.gray(' --tab-group <group> Tab分组'));
83
+ return;
84
+ }
85
+ }
86
+ // 验证 type
87
+ if (type) {
88
+ const validTypes = ['collapsible', 'static'];
89
+ if (!validTypes.includes(type)) {
90
+ throw new ValidationError(`无效的区块类型: ${type}。有效值: ${validTypes.join(', ')}`, 'type');
91
+ }
92
+ }
93
+ const spinner = output.spinner('正在更新区块...');
94
+ try {
95
+ const data = {};
96
+ if (type) {
97
+ data.type = type;
98
+ }
99
+ if (position) {
100
+ data.position = parseInt(position, 10);
101
+ }
102
+ if (content) {
103
+ data.content = content;
104
+ }
105
+ if (tabGroup !== undefined) {
106
+ data.tab_group = tabGroup || null;
107
+ }
108
+ const result = await commerceApi.productSections.merchant.update(handle, data);
109
+ spinner.succeed('区块更新成功!');
110
+ if (output.isJson()) {
111
+ output.success(result, '区块更新成功');
112
+ }
113
+ else {
114
+ console.log();
115
+ console.log(chalk.green('✓ 区块更新成功!'));
116
+ console.log();
117
+ console.log(chalk.gray('ID: ') + chalk.cyan(result.id));
118
+ console.log(chalk.gray('Handle: ') + chalk.white(result.handle));
119
+ console.log(chalk.gray('操作类型: ') + chalk.white(result.operation_type));
120
+ console.log(chalk.gray('区块类型: ') + chalk.white(result.type));
121
+ console.log(chalk.gray('位置: ') + chalk.white(result.position.toString()));
122
+ if (result.tab_group) {
123
+ console.log(chalk.gray('Tab分组: ') + chalk.white(result.tab_group));
124
+ }
125
+ if (result.content) {
126
+ const preview = result.content.length > 100 ? result.content.substring(0, 100) + '...' : result.content;
127
+ console.log(chalk.gray('内容: ') + chalk.white(preview));
128
+ }
129
+ console.log();
130
+ }
131
+ }
132
+ catch (error) {
133
+ spinner.fail('更新区块失败');
134
+ throw createApiError(error);
135
+ }
136
+ }
137
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/section/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO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AAC;gBACxG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;YACzD,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,MAAM,cAAc,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ import { i18nCommand } from './commands/i18n/index.js';
21
21
  import homepage from './commands/homepage/index.js';
22
22
  import collection from './commands/collection/index.js';
23
23
  import { testCommand } from './commands/test/index.js';
24
+ import { sectionCommand } from './commands/section/index.js';
24
25
  import { output } from './utils/output.js';
25
26
  const __filename = fileURLToPath(import.meta.url);
26
27
  const __dirname = dirname(__filename);
@@ -35,7 +36,7 @@ program
35
36
  .option('--pretty', '输出表格格式(人类可读)')
36
37
  .addHelpText('after', `
37
38
  Output Formats:
38
- All 93 commands support two output formats:
39
+ All 111+ commands support two output formats:
39
40
 
40
41
  --json JSON format (default) - Machine-readable, AI-friendly
41
42
  Returns: { success: true, data: {...} }
@@ -104,18 +105,19 @@ program.addCommand(i18nCommand);
104
105
  program.addCommand(testCommand);
105
106
  program.addCommand(homepage);
106
107
  program.addCommand(collection);
108
+ program.addCommand(sectionCommand);
107
109
  program
108
110
  .command('version')
109
111
  .description('显示版本信息')
110
112
  .action(() => {
111
- console.log(chalk.cyan(`Optima CLI v${VERSION}`));
112
- console.log(chalk.gray('15 个模块,93 个命令,完整电商管理功能'));
113
+ console.log(chalk.cyan(`Commerce CLI v${VERSION}`));
114
+ console.log(chalk.gray('16 个模块,111+ 个命令,完整电商管理功能'));
113
115
  });
114
116
  program.action(() => {
115
- console.log(chalk.cyan.bold(`\n✨ Optima CLI v${VERSION}\n`));
117
+ console.log(chalk.cyan.bold(`\n✨ Commerce CLI v${VERSION}\n`));
116
118
  console.log(chalk.white('用自然语言管理你的电商店铺 - 专为 Claude Code 设计\n'));
117
- console.log(chalk.green('✅ 已提供 15 个模块、93 个命令'));
118
- console.log(chalk.gray(' 覆盖商品、订单、库存、物流、首页配置、集合、变体翻译、国际化等完整功能\n'));
119
+ console.log(chalk.green('✅ 已提供 16 个模块、111+ 个命令'));
120
+ console.log(chalk.gray(' 覆盖商品、订单、库存、物流、首页配置、集合、商品页区块、国际化等完整功能\n'));
119
121
  console.log(chalk.white('🚀 快速开始:'));
120
122
  console.log(chalk.gray(' 1. 登录: ') + chalk.cyan('commerce auth login'));
121
123
  console.log(chalk.gray(' 2. 查看商户信息: ') + chalk.cyan('commerce merchant info'));
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,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