Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,30 @@ With auto-started dashboard:
}
```

With Chinese language templates:
```json
{
"mcpServers": {
"spec-workflow": {
"command": "npx",
"args": ["-y", "@pimzino/spec-workflow-mcp@latest", "/path/to/your/project", "--language", "zh"]
}
}
}
```

**中文用户快速开始:**
```json
{
"mcpServers": {
"spec-workflow": {
"command": "npx",
"args": ["-y", "@pimzino/spec-workflow-mcp@latest", "/你的项目路径", "--language", "zh", "--AutoStartDashboard"]
}
}
}
```

### Step 2: Choose your interface

**Option A: Web Dashboard** (Required for CLI users)
Expand All @@ -78,6 +102,30 @@ npx -y @pimzino/spec-workflow-mcp@latest /path/to/your/project --dashboard

Install [Spec Workflow MCP Extension](https://marketplace.visualstudio.com/items?itemName=Pimzino.spec-workflow-mcp) from the VSCode marketplace.

## 🌏 Language Support

Spec Workflow supports multiple languages for templates. Use the `--language` flag to specify your preferred language:

```bash
# Use Chinese templates
npx -y @pimzino/spec-workflow-mcp@latest /path/to/your/project --language zh

# Use Japanese templates
npx -y @pimzino/spec-workflow-mcp@latest /path/to/your/project --language ja

Comment on lines +113 to +115
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation lists Japanese (ja) as a supported language in line 114 and in the help text (line 34 of index.ts), but no Japanese templates exist in the codebase. Either add the Japanese templates in src/markdown/templates/ja/ or remove references to Japanese language support from the documentation until templates are available.

Suggested change
# Use Japanese templates
npx -y @pimzino/spec-workflow-mcp@latest /path/to/your/project --language ja

Copilot uses AI. Check for mistakes.
# Use English templates (default)
npx -y @pimzino/spec-workflow-mcp@latest /path/to/your/project --language en
```

**Supported Languages:**
- `en` - English (default)
- `zh` - 中文 (Chinese)

When you specify a language, the system will:
1. Look for templates in the language-specific subdirectory (e.g., `templates/zh/` for Chinese)
2. Fall back to English templates if language-specific templates don't exist
3. Apply the language setting to both the MCP server and dashboard interface

## 📝 How to Use

Simply mention spec-workflow in your conversation:
Expand All @@ -86,6 +134,11 @@ Simply mention spec-workflow in your conversation:
- **"List my specs"** - Shows all specs and their status
- **"Execute task 1.2 in spec user-auth"** - Runs a specific task

**中文使用示例:**
- **"创建一个用户认证功能的规格说明"** - 创建完整的中文规格工作流
- **"列出我的所有规格文档"** - 显示所有规格文档及其状态
- **"执行用户认证规格中的任务1.2"** - 运行特定任务

[See more examples →](docs/PROMPTING-GUIDE.md)

## 🔧 MCP Client Setup
Expand Down Expand Up @@ -151,6 +204,18 @@ Or with auto-started dashboard:
}
}
```

Or with Chinese language templates:
```json
{
"mcpServers": {
"spec-workflow": {
"command": "npx",
"args": ["-y", "@pimzino/spec-workflow-mcp@latest", "/path/to/your/project", "--language", "zh"]
}
}
}
```
</details>

<details>
Expand Down
28 changes: 25 additions & 3 deletions src/core/workspace-initializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
export class WorkspaceInitializer {
private projectPath: string;
private version: string;
private language: string;

constructor(projectPath: string, version: string) {
constructor(projectPath: string, version: string, language: string = 'en') {
this.projectPath = projectPath;
this.version = version;
this.language = language;
}

async initializeWorkspace(): Promise<void> {
Expand Down Expand Up @@ -64,11 +66,31 @@ export class WorkspaceInitializer {
}

private async copyTemplate(templateName: string, targetDir: string): Promise<void> {
// Use simple filename without version
const targetFileName = `${templateName}.md`;
const targetPath = join(targetDir, targetFileName);

const sourcePath = join(__dirname, '..', 'markdown', 'templates', `${templateName}.md`);
// 基础模板路径
const baseTemplateDir = join(__dirname, '..', 'markdown', 'templates');

let sourcePath: string;

if (this.language === 'en') {
// 英文模板直接使用根目录下的文件
sourcePath = join(baseTemplateDir, `${templateName}.md`);
} else {
// 其他语言使用对应的子目录
const langTemplatePath = join(baseTemplateDir, this.language, `${templateName}.md`);
const defaultTemplatePath = join(baseTemplateDir, `${templateName}.md`);

try {
// 首先尝试语言特定模板
await fs.access(langTemplatePath);
sourcePath = langTemplatePath;
} catch {
// 语言特定模板不存在,使用英文模板
sourcePath = defaultTemplatePath;
}
}

try {
const content = await fs.readFile(sourcePath, 'utf-8');
Expand Down
46 changes: 40 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ OPTIONS:
If not specified, uses an ephemeral port
--config <path> Use custom config file instead of default location
Supports both relative and absolute paths
--language <code> Set language for internationalization (e.g., zh, en, ja)
Supported languages: en, zh, ja, es, fr, de, it, ko, ar
Comment on lines +33 to +34
Copy link

Copilot AI Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The help text claims support for 9 languages (en, zh, ja, es, fr, de, it, ko, ar), but only English and Chinese templates currently exist. This creates misleading expectations. Either add templates for all listed languages or update the documentation to reflect only currently available languages (en, zh).

Suggested change
--language <code> Set language for internationalization (e.g., zh, en, ja)
Supported languages: en, zh, ja, es, fr, de, it, ko, ar
--language <code> Set language for internationalization (e.g., zh, en)
Supported languages: en, zh

Copilot uses AI. Check for mistakes.

CONFIGURATION:
Default config: <project-dir>/.spec-workflow/config.toml
Expand Down Expand Up @@ -81,11 +83,19 @@ EXAMPLES:
# Custom config with dashboard
spec-workflow-mcp --config ./dev-config.toml --dashboard --port 3000

# Set language to Chinese
spec-workflow-mcp --language zh

# Chinese language with dashboard
spec-workflow-mcp --language zh --AutoStartDashboard

PARAMETER FORMATS:
--port 3456 Space-separated format
--port=3456 Equals format
--config path Space-separated format
--config=path Equals format
--language zh Space-separated format
--language=zh Equals format

For more information, visit: https://github.com/Pimzino/spec-workflow-mcp
`);
Expand All @@ -110,18 +120,21 @@ function parseArguments(args: string[]): {
const autoStartDashboard = args.includes('--AutoStartDashboard');
let customPort: number | undefined;
let configPath: string | undefined;
let customLang: string | undefined;

// Check for invalid flags
const validFlags = ['--dashboard', '--AutoStartDashboard', '--port', '--config', '--help', '-h'];
const validFlags = ['--dashboard', '--AutoStartDashboard', '--port', '--config', '--language', '--help', '-h'];
for (const arg of args) {
if (arg.startsWith('--') && !arg.includes('=')) {
if (!validFlags.includes(arg)) {
throw new Error(`Unknown option: ${arg}\nUse --help to see available options.`);
throw new Error(`Unknown option: ${arg}
Use --help to see available options.`);
}
} else if (arg.startsWith('--') && arg.includes('=')) {
const flagName = arg.split('=')[0];
if (!validFlags.includes(flagName)) {
throw new Error(`Unknown option: ${flagName}\nUse --help to see available options.`);
throw new Error(`Unknown option: ${flagName}
Use --help to see available options.`);
}
}
}
Expand Down Expand Up @@ -181,6 +194,25 @@ function parseArguments(args: string[]): {
}
}

// Parse --language parameter (supports --language zh and --language=zh formats)
for (let i = 0; i < args.length; i++) {
const arg = args[i];

if (arg.startsWith('--language=')) {
// Handle --language=zh format
customLang = arg.split('=')[1];
if (!customLang) {
throw new Error('--language parameter requires a value (e.g., --language=zh)');
}
} else if (arg === '--language' && i + 1 < args.length) {
// Handle --language zh format
customLang = args[i + 1];
i++; // Skip the next argument as it's the language code
} else if (arg === '--language') {
throw new Error('--language parameter requires a value (e.g., --language zh)');
}
}

// Get project path (filter out flags and their values)
const filteredArgs = args.filter((arg, index) => {
if (arg === '--dashboard') return false;
Expand All @@ -189,8 +221,10 @@ function parseArguments(args: string[]): {
if (arg === '--port') return false;
if (arg.startsWith('--config=')) return false;
if (arg === '--config') return false;
// Check if this arg is a value following --port or --config
if (index > 0 && (args[index - 1] === '--port' || args[index - 1] === '--config')) return false;
if (arg.startsWith('--language=')) return false;
if (arg === '--language') return false;
// Check if this arg is a value following --port, --config, or --language
if (index > 0 && (args[index - 1] === '--port' || args[index - 1] === '--config' || args[index - 1] === '--language')) return false;
return true;
});

Expand All @@ -203,7 +237,7 @@ function parseArguments(args: string[]): {
console.warn('Consider specifying an explicit path for better clarity.');
}

return { projectPath, isDashboardMode, autoStartDashboard, port: customPort, lang: undefined, configPath };
return { projectPath, isDashboardMode, autoStartDashboard, port: customPort, lang: customLang, configPath };
}

async function main() {
Expand Down
96 changes: 96 additions & 0 deletions src/markdown/templates/zh/design-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# 设计文档

## 概述

[功能的高级描述及其在整体系统中的位置]

## 指导文档一致性

### 技术标准 (tech.md)
[设计如何遵循文档化的技术模式和标准]

### 项目结构 (structure.md)
[实现将如何遵循项目组织约定]

## 代码重用分析
[将利用、扩展或与此功能集成的现有代码]

### 要利用的现有组件
- **[组件/工具名称]**:[将如何使用]
- **[服务/助手名称]**:[将如何扩展]

### 集成点
- **[现有系统/API]**:[新功能将如何集成]
- **[数据库/存储]**:[数据将如何连接到现有模式]

## 架构

[描述使用的整体架构和设计模式]

### 模块化设计原则
- **单一文件职责**:每个文件应该处理一个特定的关注点或领域
- **组件隔离**:创建小型、专注的组件而不是大型单体文件
- **服务层分离**:分离数据访问、业务逻辑和表示层
- **工具模块化**:将工具分解为专注的、单一用途的模块

```mermaid
graph TD
A[组件A] --> B[组件B]
B --> C[组件C]
```

## 组件和接口

### 组件1
- **目的:** [此组件的作用]
- **接口:** [公共方法/API]
- **依赖:** [它依赖的内容]
- **重用:** [它构建的现有组件/工具]

### 组件2
- **目的:** [此组件的作用]
- **接口:** [公共方法/API]
- **依赖:** [它依赖的内容]
- **重用:** [它构建的现有组件/工具]

## 数据模型

### 模型1
```
[用您的语言定义Model1的结构]
- id: [唯一标识符类型]
- name: [字符串/文本类型]
- [根据需要添加其他属性]
```

### 模型2
```
[用您的语言定义Model2的结构]
- id: [唯一标识符类型]
- [根据需要添加其他属性]
```

## 错误处理

### 错误场景
1. **场景1:** [描述]
- **处理:** [如何处理]
- **用户影响:** [用户看到什么]

2. **场景2:** [描述]
- **处理:** [如何处理]
- **用户影响:** [用户看到什么]

## 测试策略

### 单元测试
- [单元测试方法]
- [要测试的关键组件]

### 集成测试
- [集成测试方法]
- [要测试的关键流程]

### 端到端测试
- [E2E测试方法]
- [要测试的用户场景]
51 changes: 51 additions & 0 deletions src/markdown/templates/zh/product-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# 产品概述

## 产品目的
[描述此产品/项目的核心目的。它解决了什么问题?]

## 目标用户
[谁是此产品的主要用户?他们的需求和痛点是什么?]

## 关键功能
[列出为用户带来价值的主要功能]

1. **功能1**:[描述]
2. **功能2**:[描述]
3. **功能3**:[描述]

## 业务目标
[此产品旨在实现哪些业务目标?]

- [目标1]
- [目标2]
- [目标3]

## 成功指标
[我们将如何衡量此产品的成功?]

- [指标1]:[目标]
- [指标2]:[目标]
- [指标3]:[目标]

## 产品原则
[指导产品决策的核心原则]

1. **[原则1]**:[解释]
2. **[原则2]**:[解释]
3. **[原则3]**:[解释]

## 监控与可见性(如适用)
[用户如何跟踪进度和监控系统?]

- **仪表板类型**:[例如,基于Web、CLI、桌面应用]
- **实时更新**:[例如,WebSocket、轮询、推送通知]
- **显示的关键指标**:[最重要的信息是什么]
- **共享功能**:[例如,只读链接、导出、报告]

## 未来愿景
[我们预见此产品在未来将如何发展?]

### 潜在增强功能
- **远程访问**:[例如,与利益相关者共享仪表板的隧道功能]
- **分析功能**:[例如,历史趋势、性能指标]
- **协作功能**:[例如,多用户支持、评论]
Loading
Loading