Skip to content

Commit 338adfb

Browse files
committed
汉化主要的提示语和模板
1 parent 4061300 commit 338adfb

File tree

17 files changed

+732
-657
lines changed

17 files changed

+732
-657
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'pnpm'
21+
registry-url: 'https://registry.npmjs.org/'
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: 9
27+
28+
- name: Install dependencies
29+
run: pnpm install --frozen-lockfile
30+
31+
- name: Build package
32+
run: pnpm run build
33+
34+
- name: Publish to npm
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
run: pnpm run release:ci

Makefile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Makefile for OpenSpec-cn
2+
3+
# You can override these via environment if needed
4+
PNPM ?= pnpm
5+
NODE ?= node
6+
7+
.PHONY: all install deps build link unlink clean release
8+
9+
# Default: install deps, build, and link as global "openspec-cn"
10+
all: install
11+
12+
# Install dependencies, build, and link
13+
install: deps build link
14+
15+
# Install JS dependencies using pnpm
16+
deps:
17+
$(PNPM) install
18+
19+
# Build the project (calls the build script)
20+
build:
21+
$(PNPM) run build
22+
23+
# Link this package globally so that the "openspec-cn" command is available
24+
link:
25+
npm link
26+
27+
# Remove the global link for this package
28+
unlink:
29+
npm unlink --global @studyzy/openspec-cn || true
30+
31+
# Simple clean placeholder (extend as needed)
32+
clean:
33+
rm -rf node_modules dist
34+
35+
# Release a new version to npm (publishes @studyzy/openspec-cn)
36+
release:
37+
$(PNPM) run release:local

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@fission-ai/openspec",
2+
"name": "@studyzy/openspec-cn",
33
"version": "0.16.0",
44
"description": "AI-native system for spec-driven development",
55
"keywords": [
@@ -9,10 +9,10 @@
99
"ai",
1010
"development"
1111
],
12-
"homepage": "https://github.com/Fission-AI/OpenSpec",
12+
"homepage": "https://github.com/studyzy/OpenSpec-cn",
1313
"repository": {
1414
"type": "git",
15-
"url": "https://github.com/Fission-AI/OpenSpec"
15+
"url": "https://github.com/studyzy/OpenSpec-cn"
1616
},
1717
"license": "MIT",
1818
"author": "OpenSpec Contributors",
@@ -27,7 +27,7 @@
2727
}
2828
},
2929
"bin": {
30-
"openspec": "./bin/openspec.js"
30+
"openspec-cn": "./bin/openspec.js"
3131
},
3232
"files": [
3333
"dist",

src/cli/index.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ const { version } = require('../../package.json');
2020

2121
program
2222
.name('openspec')
23-
.description('AI-native system for spec-driven development')
23+
.description('基于规范驱动开发的AI原生系统')
2424
.version(version);
2525

2626
// Global options
27-
program.option('--no-color', 'Disable color output');
27+
program.option('--no-color', '禁用彩色输出');
2828

2929
// Apply global flags before any command runs
3030
program.hook('preAction', (thisCommand) => {
@@ -35,11 +35,11 @@ program.hook('preAction', (thisCommand) => {
3535
});
3636

3737
const availableToolIds = AI_TOOLS.filter((tool) => tool.available).map((tool) => tool.value);
38-
const toolsOptionDescription = `Configure AI tools non-interactively. Use "all", "none", or a comma-separated list of: ${availableToolIds.join(', ')}`;
38+
const toolsOptionDescription = `非交互式配置AI工具。使用 "all""none" 或逗号分隔的列表:${availableToolIds.join(', ')}`;
3939

4040
program
4141
.command('init [path]')
42-
.description('Initialize OpenSpec in your project')
42+
.description('在您的项目中初始化OpenSpec')
4343
.option('--tools <tools>', toolsOptionDescription)
4444
.action(async (targetPath = '.', options?: { tools?: string }) => {
4545
try {
@@ -54,7 +54,7 @@ program
5454
} catch (error: any) {
5555
if (error.code === 'ENOENT') {
5656
// Directory doesn't exist, but we can create it
57-
console.log(`Directory "${targetPath}" doesn't exist, it will be created.`);
57+
console.log(`目录 "${targetPath}" 不存在,将被创建。`);
5858
} else if (error.message && error.message.includes('not a directory')) {
5959
throw error;
6060
} else {
@@ -68,70 +68,70 @@ program
6868
await initCommand.execute(targetPath);
6969
} catch (error) {
7070
console.log(); // Empty line for spacing
71-
ora().fail(`Error: ${(error as Error).message}`);
71+
ora().fail(`错误:${(error as Error).message}`);
7272
process.exit(1);
7373
}
7474
});
7575

7676
program
7777
.command('update [path]')
78-
.description('Update OpenSpec instruction files')
78+
.description('更新OpenSpec指令文件')
7979
.action(async (targetPath = '.') => {
8080
try {
8181
const resolvedPath = path.resolve(targetPath);
8282
const updateCommand = new UpdateCommand();
8383
await updateCommand.execute(resolvedPath);
8484
} catch (error) {
8585
console.log(); // Empty line for spacing
86-
ora().fail(`Error: ${(error as Error).message}`);
86+
ora().fail(`错误:${(error as Error).message}`);
8787
process.exit(1);
8888
}
8989
});
9090

9191
program
9292
.command('list')
93-
.description('List items (changes by default). Use --specs to list specs.')
94-
.option('--specs', 'List specs instead of changes')
95-
.option('--changes', 'List changes explicitly (default)')
93+
.description('列出项目(默认显示更改)。使用 --specs 列出规范。')
94+
.option('--specs', '列出规范而非更改')
95+
.option('--changes', '明确列出更改(默认)')
9696
.action(async (options?: { specs?: boolean; changes?: boolean }) => {
9797
try {
9898
const listCommand = new ListCommand();
9999
const mode: 'changes' | 'specs' = options?.specs ? 'specs' : 'changes';
100100
await listCommand.execute('.', mode);
101101
} catch (error) {
102102
console.log(); // Empty line for spacing
103-
ora().fail(`Error: ${(error as Error).message}`);
103+
ora().fail(`错误:${(error as Error).message}`);
104104
process.exit(1);
105105
}
106106
});
107107

108108
program
109109
.command('view')
110-
.description('Display an interactive dashboard of specs and changes')
110+
.description('显示规范和更改的交互式仪表板')
111111
.action(async () => {
112112
try {
113113
const viewCommand = new ViewCommand();
114114
await viewCommand.execute('.');
115115
} catch (error) {
116116
console.log(); // Empty line for spacing
117-
ora().fail(`Error: ${(error as Error).message}`);
117+
ora().fail(`错误:${(error as Error).message}`);
118118
process.exit(1);
119119
}
120120
});
121121

122122
// Change command with subcommands
123123
const changeCmd = program
124124
.command('change')
125-
.description('Manage OpenSpec change proposals');
125+
.description('管理OpenSpec变更提案');
126126

127127
// Deprecation notice for noun-based commands
128128
changeCmd.hook('preAction', () => {
129-
console.error('Warning: The "openspec change ..." commands are deprecated. Prefer verb-first commands (e.g., "openspec list", "openspec validate --changes").');
129+
console.error('警告:"openspec change ..." 命令已弃用。请优先使用动词开头的命令(例如 "openspec list", "openspec validate --changes")。');
130130
});
131131

132132
changeCmd
133133
.command('show [change-name]')
134-
.description('Show a change proposal in JSON or markdown format')
134+
.description('以JSON或markdown格式显示变更提案')
135135
.option('--json', 'Output as JSON')
136136
.option('--deltas-only', 'Show only deltas (JSON only)')
137137
.option('--requirements-only', 'Alias for --deltas-only (deprecated)')
@@ -141,30 +141,30 @@ changeCmd
141141
const changeCommand = new ChangeCommand();
142142
await changeCommand.show(changeName, options);
143143
} catch (error) {
144-
console.error(`Error: ${(error as Error).message}`);
144+
console.error(`错误:${(error as Error).message}`);
145145
process.exitCode = 1;
146146
}
147147
});
148148

149149
changeCmd
150150
.command('list')
151-
.description('List all active changes (DEPRECATED: use "openspec list" instead)')
151+
.description('列出所有活动更改(已弃用:请使用 "openspec list"')
152152
.option('--json', 'Output as JSON')
153153
.option('--long', 'Show id and title with counts')
154154
.action(async (options?: { json?: boolean; long?: boolean }) => {
155155
try {
156-
console.error('Warning: "openspec change list" is deprecated. Use "openspec list".');
156+
console.error('警告:"openspec change list" 已弃用。请使用 "openspec list"');
157157
const changeCommand = new ChangeCommand();
158158
await changeCommand.list(options);
159159
} catch (error) {
160-
console.error(`Error: ${(error as Error).message}`);
160+
console.error(`错误:${(error as Error).message}`);
161161
process.exitCode = 1;
162162
}
163163
});
164164

165165
changeCmd
166166
.command('validate [change-name]')
167-
.description('Validate a change proposal')
167+
.description('验证变更提案')
168168
.option('--strict', 'Enable strict validation mode')
169169
.option('--json', 'Output validation report as JSON')
170170
.option('--no-interactive', 'Disable interactive prompts')
@@ -176,24 +176,24 @@ changeCmd
176176
process.exit(process.exitCode);
177177
}
178178
} catch (error) {
179-
console.error(`Error: ${(error as Error).message}`);
179+
console.error(`错误:${(error as Error).message}`);
180180
process.exitCode = 1;
181181
}
182182
});
183183

184184
program
185185
.command('archive [change-name]')
186-
.description('Archive a completed change and update main specs')
187-
.option('-y, --yes', 'Skip confirmation prompts')
188-
.option('--skip-specs', 'Skip spec update operations (useful for infrastructure, tooling, or doc-only changes)')
189-
.option('--no-validate', 'Skip validation (not recommended, requires confirmation)')
186+
.description('归档已完成的更改并更新主规范')
187+
.option('-y, --yes', '跳过确认提示')
188+
.option('--skip-specs', '跳过规范更新操作(适用于基础设施、工具或仅文档更改)')
189+
.option('--no-validate', '跳过验证(不推荐,需要确认)')
190190
.action(async (changeName?: string, options?: { yes?: boolean; skipSpecs?: boolean; noValidate?: boolean; validate?: boolean }) => {
191191
try {
192192
const archiveCommand = new ArchiveCommand();
193193
await archiveCommand.execute(changeName, options);
194194
} catch (error) {
195195
console.log(); // Empty line for spacing
196-
ora().fail(`Error: ${(error as Error).message}`);
196+
ora().fail(`错误:${(error as Error).message}`);
197197
process.exit(1);
198198
}
199199
});
@@ -203,11 +203,11 @@ registerSpecCommand(program);
203203
// Top-level validate command
204204
program
205205
.command('validate [item-name]')
206-
.description('Validate changes and specs')
207-
.option('--all', 'Validate all changes and specs')
208-
.option('--changes', 'Validate all changes')
209-
.option('--specs', 'Validate all specs')
210-
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
206+
.description('验证更改和规范')
207+
.option('--all', '验证所有更改和规范')
208+
.option('--changes', '验证所有更改')
209+
.option('--specs', '验证所有规范')
210+
.option('--type <type>', '当项目类型不明确时指定类型:change|spec')
211211
.option('--strict', 'Enable strict validation mode')
212212
.option('--json', 'Output validation results as JSON')
213213
.option('--concurrency <n>', 'Max concurrent validations (defaults to env OPENSPEC_CONCURRENCY or 6)')
@@ -218,17 +218,17 @@ program
218218
await validateCommand.execute(itemName, options);
219219
} catch (error) {
220220
console.log();
221-
ora().fail(`Error: ${(error as Error).message}`);
221+
ora().fail(`错误:${(error as Error).message}`);
222222
process.exit(1);
223223
}
224224
});
225225

226226
// Top-level show command
227227
program
228228
.command('show [item-name]')
229-
.description('Show a change or spec')
229+
.description('显示更改或规范')
230230
.option('--json', 'Output as JSON')
231-
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
231+
.option('--type <type>', '当项目类型不明确时指定类型:change|spec')
232232
.option('--no-interactive', 'Disable interactive prompts')
233233
// change-only flags
234234
.option('--deltas-only', 'Show only deltas (JSON only, change)')
@@ -245,7 +245,7 @@ program
245245
await showCommand.execute(itemName, options ?? {});
246246
} catch (error) {
247247
console.log();
248-
ora().fail(`Error: ${(error as Error).message}`);
248+
ora().fail(`错误:${(error as Error).message}`);
249249
process.exit(1);
250250
}
251251
});

src/commands/change.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ export class ChangeCommand {
282282

283283
private printNextSteps(): void {
284284
const bullets: string[] = [];
285-
bullets.push('- Ensure change has deltas in specs/: use headers ## ADDED/MODIFIED/REMOVED/RENAMED Requirements');
286-
bullets.push('- Each requirement MUST include at least one #### Scenario: block');
287-
bullets.push('- Debug parsed deltas: openspec change show <id> --json --deltas-only');
288-
console.error('Next steps:');
285+
bullets.push('- 确保变更在specs/中有增量:使用标题## ADDED/MODIFIED/REMOVED/RENAMED Requirements');
286+
bullets.push('- 每个需求必须至少包含一个#### 场景:块');
287+
bullets.push('- 调试解析的增量:openspec-cn change show <id> --json --deltas-only');
288+
console.error('后续步骤:');
289289
bullets.forEach(b => console.error(` ${b}`));
290290
}
291291
}

0 commit comments

Comments
 (0)