intent-init

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Intent Init

Intent Init

初始化项目的 IDD (Intent Driven Development) 结构。
Initialize the IDD (Intent Driven Development) structure for a project.

功能

Features

  1. 检查现状 - 扫描项目,识别已有的 intent 文件或类似结构
  2. 创建目录 - 建立标准 IDD 目录结构
  3. 生成模板 - 创建入口 INTENT.md 和模块级模板
  4. 配置建议 - 根据项目类型给出配置建议
  1. Check Current State - Scan the project to identify existing intent files or similar structures
  2. Create Directories - Establish the standard IDD directory structure
  3. Generate Templates - Create the entry INTENT.md and module-level templates
  4. Configuration Recommendations - Provide configuration suggestions based on project type

工作流程

Workflow

/intent-init
┌───────────────────────────────────┐
│  Phase 1: 扫描现状                │
│  - 查找 intent/, specs/, docs/   │
│  - 识别 README, DESIGN 等文档    │
│  - 检测项目类型 (monorepo/单模块) │
└─────────────┬─────────────────────┘
┌───────────────────────────────────┐
│  Phase 2: 展示发现                │
│  - 已有文档列表                   │
│  - 项目结构分析                   │
│  - 推荐的 IDD 结构                │
└─────────────┬─────────────────────┘
┌───────────────────────────────────┐
│  Phase 3: 确认并创建              │
│  - AskUserQuestion 确认结构       │
│  - 创建目录和模板文件             │
│  - 可选:迁移现有文档             │
└───────────────────────────────────┘
/intent-init
┌───────────────────────────────────┐
│  Phase 1: Check Current State     │
│  - Look for intent/, specs/, docs/│
│  - Identify README, DESIGN, etc.  │
│  - Detect project type (monorepo/single-module) │
└─────────────┬─────────────────────┘
┌───────────────────────────────────┐
│  Phase 2: Display Findings        │
│  - List of existing documents     │
│  - Project structure analysis     │
│  - Recommended IDD structure      │
└─────────────┬─────────────────────┘
┌───────────────────────────────────┐
│  Phase 3: Confirm and Create      │
│  - Ask user to confirm structure via AskUserQuestion │
│  - Create directories and template files │
│  - Optional: Migrate existing documents │
└───────────────────────────────────┘

标准 IDD 目录结构

Standard IDD Directory Structure

单模块项目

Single-module Project

project/
├── intent/
│   └── INTENT.md           # 项目 Intent(入口)
├── src/
└── ...
project/
├── intent/
│   └── INTENT.md           # Project Intent (entry point)
├── src/
└── ...

Monorepo / 多模块项目

Monorepo / Multi-module Project

project/
├── intent/
│   ├── INTENT.md           # 项目概述(入口)
│   └── architecture/
│       ├── DEPENDENCIES.md # 模块依赖图
│       └── BOUNDARIES.md   # 边界规则
├── src/
│   ├── module-a/
│   │   └── intent/
│   │       └── INTENT.md   # 模块 Intent
│   └── module-b/
│       └── intent/
│           └── INTENT.md
└── ...
project/
├── intent/
│   ├── INTENT.md           # Project Overview (entry point)
│   └── architecture/
│       ├── DEPENDENCIES.md # Module dependency graph
│       └── BOUNDARIES.md   # Boundary rules
├── src/
│   ├── module-a/
│   │   └── intent/
│   │       └── INTENT.md   # Module Intent
│   └── module-b/
│       └── intent/
│           └── INTENT.md
└── ...

模板内容

Template Content

项目级 INTENT.md

Project-level INTENT.md

markdown
undefined
markdown
undefined

[Project Name] Intent

[Project Name] Intent

一句话描述项目目标
状态: draft 最后更新: YYYY-MM-DD
One-sentence description of project goals
Status: draft Last Updated: YYYY-MM-DD

愿景

Vision

[项目要解决的问题和目标]
[Problems and goals the project aims to solve]

架构概览

Architecture Overview

[ASCII 架构图]
[ASCII architecture diagram]

模块索引

Module Index

模块职责Intent
xxx...[link]
ModuleResponsibilityIntent
xxx...[link]

非目标

Non-Goals

  • [明确不做什么]
  • [Clearly state what will not be done]

约束

Constraints

  • [技术约束]
  • [业务约束]
undefined
  • [Technical constraints]
  • [Business constraints]
undefined

模块级 INTENT.md

Module-level INTENT.md

markdown
undefined
markdown
undefined

[Module] Intent

[Module] Intent

模块职责一句话
状态: draft 最后更新: YYYY-MM-DD
One-sentence description of module responsibility
Status: draft Last Updated: YYYY-MM-DD

职责

Responsibilities

[模块做什么]
[What the module does]

非目标

Non-Goals

[模块不做什么]
[What the module does not do]

数据结构

Data Structures

[核心数据结构定义]
[Core data structure definitions]

API

API

[对外接口定义]
[External interface definitions]

示例

Examples

[输入 → 输出 示例]
undefined
[Input → Output examples]
undefined

检测逻辑

Detection Logic

识别已有 Intent 结构

Identify Existing Intent Structures

javascript
// 检查路径
const intentPaths = [
  'intent/INTENT.md',
  'INTENT.md',
  'docs/INTENT.md',
  'specs/',
  'design/',
];

// 检查内容特征
const intentMarkers = [
  '## 职责',
  '## 非目标',
  '::: locked',
  '::: reviewed',
];
javascript
// 检查路径
const intentPaths = [
  'intent/INTENT.md',
  'INTENT.md',
  'docs/INTENT.md',
  'specs/',
  'design/',
];

// 检查内容特征
const intentMarkers = [
  '## 职责',
  '## 非目标',
  '::: locked',
  '::: reviewed',
];

项目类型识别

Project Type Identification

javascript
// Monorepo 特征
const monorepoMarkers = [
  'packages/',
  'apps/',
  'src/modules/',
  'lerna.json',
  'pnpm-workspace.yaml',
];
javascript
// Monorepo 特征
const monorepoMarkers = [
  'packages/',
  'apps/',
  'src/modules/',
  'lerna.json',
  'pnpm-workspace.yaml',
];

选项

Options

/intent-init              # 交互式初始化
/intent-init --dry-run    # 只展示计划,不执行
/intent-init --minimal    # 最小化结构
/intent-init --migrate    # 尝试迁移现有文档
/intent-init              # Interactive initialization
/intent-init --dry-run    # Show plan only, no execution
/intent-init --minimal    # Minimal structure
/intent-init --migrate    # Attempt to migrate existing documents

与其他命令配合

Integration with Other Commands

/intent-init              # 初始化结构
/intent-interview         # 填充 Intent 内容
/intent-review            # 审批关键 sections
[开发]
/intent-check             # 检查一致性
/intent-init              # Initialize structure
/intent-interview         # Populate Intent content
/intent-review            # Approve key sections
[Development]
/intent-check             # Check consistency