@minus-ai/create-skill 0.1.0-beta.11 → 0.1.0-beta.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minus-ai/create-skill",
3
- "version": "0.1.0-beta.11",
3
+ "version": "0.1.0-beta.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-skill": "index.mjs"
@@ -1 +1 @@
1
- 2
1
+ 3
@@ -14,12 +14,12 @@ import zhCN from './locales/zh-CN.json';
14
14
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
15
15
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
16
16
  */
17
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
17
+ function buildSteps(t: (k: string) => string): StepConfig[] {
18
18
  return [
19
19
  {
20
20
  render: ({ data }) => (
21
21
  <div className="minus-default-step-done">
22
- {(data.text as string | undefined) ?? t('{{namespace}}.step.empty', '(空)')}
22
+ {(data.text as string | undefined) ?? t('{{namespace}}.step.empty')}
23
23
  </div>
24
24
  ),
25
25
  },
@@ -36,7 +36,7 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
36
36
  async function handleSubmit() {
37
37
  if (loading) return;
38
38
  const { asins, error: asinError } = validateAsins(value);
39
- if (asinError) { setError(t(asinError.key, asinError.fallback, asinError.vars)); return; }
39
+ if (asinError) { setError(t(asinError.key, undefined, asinError.vars)); return; }
40
40
  setError(null);
41
41
  setLoading(true);
42
42
  try { await onStart({ asins: asins.join(','), country }); } finally { setLoading(false); }
@@ -59,7 +59,7 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
59
59
  <AmazonSearchBar
60
60
  onSubmit={handleSubmit}
61
61
  country={<CountrySelect onChange={setCountry} />}
62
- input={<input type="text" value={value} onChange={(e) => { setValue(e.target.value); if (error) setError(null); }} placeholder={t('{{namespace}}.home.placeholder', '输入一个或多个ASIN')} spellCheck={false} disabled={loading} />}
62
+ input={<input type="text" value={value} onChange={(e) => { setValue(e.target.value); if (error) setError(null); }} placeholder={t('{{namespace}}.home.placeholder')} spellCheck={false} disabled={loading} />}
63
63
  submit={<SearchSubmitButton />}
64
64
  error={error}
65
65
  />
@@ -14,12 +14,12 @@ import zhCN from './locales/zh-CN.json';
14
14
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
15
15
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
16
16
  */
17
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
17
+ function buildSteps(t: (k: string) => string): StepConfig[] {
18
18
  return [
19
19
  {
20
20
  render: ({ data }) => (
21
21
  <div className="minus-default-step-done">
22
- {(data.text as string) ?? t('{{namespace}}.step.empty', '(空)')}
22
+ {(data.text as string) ?? t('{{namespace}}.step.empty')}
23
23
  </div>
24
24
  ),
25
25
  },
@@ -53,11 +53,11 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
53
53
  )}
54
54
  <div style={{ background: '#fff', border: '1px solid #e5e7eb', borderRadius: 8, padding: 20, display: 'flex', flexDirection: 'column', gap: 16, boxShadow: '0 1px 2px rgba(0,0,0,0.04)' }}>
55
55
  <label className="minus-field">
56
- <span>{t('{{namespace}}.home.fieldLabel', '输入')}</span>
57
- <input type="text" value={value} onChange={(e) => setValue(e.target.value)} placeholder={t('{{namespace}}.home.placeholder', '请输入...')} onKeyDown={(e) => e.key === 'Enter' && handleSubmit()} />
56
+ <span>{t('{{namespace}}.home.fieldLabel')}</span>
57
+ <input type="text" value={value} onChange={(e) => setValue(e.target.value)} placeholder={t('{{namespace}}.home.placeholder')} onKeyDown={(e) => e.key === 'Enter' && handleSubmit()} />
58
58
  </label>
59
59
  <button className="minus-btn minus-btn-primary" onClick={handleSubmit} disabled={!value.trim() || loading}>
60
- {loading ? t('{{namespace}}.home.processing', '处理中…') : t('{{namespace}}.home.send', '开始')}
60
+ {loading ? t('{{namespace}}.home.processing') : t('{{namespace}}.home.send')}
61
61
  </button>
62
62
  </div>
63
63
  </div>
@@ -14,12 +14,12 @@ import zhCN from './locales/zh-CN.json';
14
14
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
15
15
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
16
16
  */
17
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
17
+ function buildSteps(t: (k: string) => string): StepConfig[] {
18
18
  return [
19
19
  {
20
20
  render: ({ data }) => (
21
21
  <div className="minus-default-step-done">
22
- {(data.text as string | undefined) ?? t('{{namespace}}.step.empty', '(空)')}
22
+ {(data.text as string | undefined) ?? t('{{namespace}}.step.empty')}
23
23
  </div>
24
24
  ),
25
25
  },
@@ -14,12 +14,12 @@ import zhCN from './locales/zh-CN.json';
14
14
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
15
15
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
16
16
  */
17
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
17
+ function buildSteps(t: (k: string) => string): StepConfig[] {
18
18
  return [
19
19
  {
20
20
  render: ({ data }) => (
21
21
  <div className="minus-default-step-done">
22
- {(data.text as string) ?? t('{{namespace}}.step.empty', '(空)')}
22
+ {(data.text as string) ?? t('{{namespace}}.step.empty')}
23
23
  </div>
24
24
  ),
25
25
  },
@@ -34,14 +34,14 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
34
34
 
35
35
  async function handleSubmit() {
36
36
  if (loading) return;
37
- if (!file) { setError(t('{{namespace}}.home.fileEmpty', '请选择一个文件')); return; }
37
+ if (!file) { setError(t('{{namespace}}.home.fileEmpty')); return; }
38
38
  setError(null);
39
39
  setLoading(true);
40
40
  try {
41
41
  const { fileId } = await uploadFile(file);
42
42
  await onStart({ fileId, fileName: file.name });
43
43
  } catch (e: any) {
44
- setError(e?.message ?? t('{{namespace}}.home.uploadFailed', '文件上传失败'));
44
+ setError(e?.message ?? t('{{namespace}}.home.uploadFailed'));
45
45
  } finally {
46
46
  setLoading(false);
47
47
  }
@@ -63,12 +63,12 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
63
63
  )}
64
64
  <div style={{ background: '#fff', border: '1px solid #e5e7eb', borderRadius: 8, padding: 20, display: 'flex', flexDirection: 'column', gap: 16, boxShadow: '0 1px 2px rgba(0,0,0,0.04)' }}>
65
65
  <label className="minus-field">
66
- <span>{t('{{namespace}}.home.fieldLabel', '文件')}</span>
66
+ <span>{t('{{namespace}}.home.fieldLabel')}</span>
67
67
  <FilePicker value={file} onChange={(f) => { setFile(f); if (error) setError(null); }} disabled={loading} />
68
68
  </label>
69
69
  {error && <p style={{ margin: 0, fontSize: 13, color: 'var(--minus-color-danger, #ef4444)' }}>{error}</p>}
70
70
  <button className="minus-btn minus-btn-primary" onClick={handleSubmit} disabled={!file || loading}>
71
- {loading ? t('{{namespace}}.home.processing', '上传中…') : t('{{namespace}}.home.send', '开始')}
71
+ {loading ? t('{{namespace}}.home.processing') : t('{{namespace}}.home.send')}
72
72
  </button>
73
73
  </div>
74
74
  </div>
@@ -14,12 +14,12 @@ import zhCN from './locales/zh-CN.json';
14
14
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
15
15
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
16
16
  */
17
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
17
+ function buildSteps(t: (k: string) => string): StepConfig[] {
18
18
  return [
19
19
  {
20
20
  render: ({ data }) => (
21
21
  <div className="minus-default-step-done">
22
- {(data.text as string) ?? t('{{namespace}}.step.empty', '(空)')}
22
+ {(data.text as string) ?? t('{{namespace}}.step.empty')}
23
23
  </div>
24
24
  ),
25
25
  },
@@ -36,7 +36,7 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
36
36
  async function handleSubmit() {
37
37
  if (loading) return;
38
38
  const { keywords, error: kwError } = validateKeywords(value);
39
- if (kwError) { setError(t(kwError.key, kwError.fallback, kwError.vars)); return; }
39
+ if (kwError) { setError(t(kwError.key, undefined, kwError.vars)); return; }
40
40
  setError(null);
41
41
  setLoading(true);
42
42
  try { await onStart({ keywords: keywords.join(','), country }); } finally { setLoading(false); }
@@ -59,7 +59,7 @@ function Home({ title, description, useCases, tags, onStart }: { title: string;
59
59
  <AmazonSearchBar
60
60
  onSubmit={handleSubmit}
61
61
  country={<CountrySelect onChange={setCountry} />}
62
- input={<textarea value={value} onChange={(e) => { setValue(e.target.value); if (error) setError(null); }} onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); } }} placeholder={t('{{namespace}}.home.placeholder', '输入关键词,多个关键词用逗号或换行分隔')} spellCheck={false} disabled={loading} rows={1} />}
62
+ input={<textarea value={value} onChange={(e) => { setValue(e.target.value); if (error) setError(null); }} onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); handleSubmit(); } }} placeholder={t('{{namespace}}.home.placeholder')} spellCheck={false} disabled={loading} rows={1} />}
63
63
  submit={<SearchSubmitButton />}
64
64
  error={error}
65
65
  />
@@ -16,12 +16,12 @@ type InputType = 'keyword' | 'asin';
16
16
  * - 嵌套:(data.obj as Record<string, unknown> | undefined)?.field ?? fallback
17
17
  * 框架已有 Error Boundary 兜底,但不应依赖——优先在数据层做防御。
18
18
  */
19
- function buildSteps(t: (k: string, fb?: string) => string): StepConfig[] {
19
+ function buildSteps(t: (k: string) => string): StepConfig[] {
20
20
  return [
21
21
  {
22
22
  render: ({ data }) => (
23
23
  <div className="minus-default-step-done">
24
- {(data.text as string) ?? t('{{namespace}}.step.empty', '(空)')}
24
+ {(data.text as string) ?? t('{{namespace}}.step.empty')}
25
25
  </div>
26
26
  ),
27
27
  },
@@ -54,7 +54,7 @@ function Home({
54
54
  if (inputType === 'asin') {
55
55
  const { asins, error: asinError } = validateAsins(value);
56
56
  if (asinError) {
57
- setError(t(asinError.key, asinError.fallback, asinError.vars));
57
+ setError(t(asinError.key, undefined, asinError.vars));
58
58
  return;
59
59
  }
60
60
  setError(null);
@@ -67,7 +67,7 @@ function Home({
67
67
  } else {
68
68
  const { keywords, error: kwError } = validateKeywords(value);
69
69
  if (kwError) {
70
- setError(t(kwError.key, kwError.fallback, kwError.vars));
70
+ setError(t(kwError.key, undefined, kwError.vars));
71
71
  return;
72
72
  }
73
73
  setError(null);
@@ -81,8 +81,8 @@ function Home({
81
81
  }
82
82
 
83
83
  const placeholder = inputType === 'keyword'
84
- ? t('{{namespace}}.home.placeholderKeyword', '输入关键词,如 bluetooth earbuds')
85
- : t('{{namespace}}.home.placeholderAsin', '输入一个或多个ASIN');
84
+ ? t('{{namespace}}.home.placeholderKeyword')
85
+ : t('{{namespace}}.home.placeholderAsin');
86
86
 
87
87
  return (
88
88
  <>
@@ -115,7 +115,7 @@ function Home({
115
115
  marginLeft: type === 'asin' ? -1 : 0,
116
116
  }}
117
117
  >
118
- {t(`{{namespace}}.home.tab.${type}`, type === 'keyword' ? '关键词' : 'ASIN')}
118
+ {t(`{{namespace}}.home.tab.${type}`)}
119
119
  </button>
120
120
  ))}
121
121
  </div>