Defer sort seed checks until adjust-order startup
This commit is contained in:
139
.trellis/tasks/00-bootstrap-guidelines/prd.md
Normal file
139
.trellis/tasks/00-bootstrap-guidelines/prd.md
Normal file
@@ -0,0 +1,139 @@
|
||||
# Bootstrap Task: Fill Project Development Guidelines
|
||||
|
||||
**You (the AI) are running this task. The developer does not read this file.**
|
||||
|
||||
The developer just ran `trellis init` on this project for the first time.
|
||||
`.trellis/` now exists with empty spec scaffolding, and this bootstrap task
|
||||
exists under `.trellis/tasks/`. When they want to work on it, they should start
|
||||
this task from a session that provides Trellis session identity.
|
||||
|
||||
**Your job**: help them populate `.trellis/spec/` with the team's real
|
||||
coding conventions. Every future AI session — this project's
|
||||
`trellis-implement` and `trellis-check` sub-agents — auto-loads spec files
|
||||
listed in per-task jsonl manifests. Empty spec = sub-agents write generic
|
||||
code. Real spec = sub-agents match the team's actual patterns.
|
||||
|
||||
Don't dump instructions. Open with a short greeting, figure out if the repo
|
||||
has any existing convention docs (CLAUDE.md, .cursorrules, etc.), and drive
|
||||
the rest conversationally.
|
||||
|
||||
---
|
||||
|
||||
## Status (update the checkboxes as you complete each item)
|
||||
|
||||
- [ ] Fill backend guidelines
|
||||
- [ ] Fill frontend guidelines
|
||||
- [ ] Add code examples
|
||||
|
||||
---
|
||||
|
||||
## Spec files to populate
|
||||
|
||||
|
||||
### Backend guidelines
|
||||
|
||||
| File | What to document |
|
||||
|------|------------------|
|
||||
| `.trellis/spec/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
|
||||
| `.trellis/spec/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
|
||||
| `.trellis/spec/backend/error-handling.md` | How errors are caught, logged, and returned |
|
||||
| `.trellis/spec/backend/logging-guidelines.md` | Log levels, format, what to log |
|
||||
| `.trellis/spec/backend/quality-guidelines.md` | Code review standards, testing requirements |
|
||||
|
||||
|
||||
### Frontend guidelines
|
||||
|
||||
| File | What to document |
|
||||
|------|------------------|
|
||||
| `.trellis/spec/frontend/directory-structure.md` | Component/page/hook organization |
|
||||
| `.trellis/spec/frontend/component-guidelines.md` | Component patterns, props conventions |
|
||||
| `.trellis/spec/frontend/hook-guidelines.md` | Custom hook naming, patterns |
|
||||
| `.trellis/spec/frontend/state-management.md` | State library, patterns, what goes where |
|
||||
| `.trellis/spec/frontend/type-safety.md` | TypeScript conventions, type organization |
|
||||
| `.trellis/spec/frontend/quality-guidelines.md` | Linting, testing, accessibility |
|
||||
|
||||
|
||||
### Thinking guides (already populated)
|
||||
|
||||
`.trellis/spec/guides/` contains general thinking guides pre-filled with
|
||||
best practices. Customize only if something clearly doesn't fit this project.
|
||||
|
||||
---
|
||||
|
||||
## How to fill the spec
|
||||
|
||||
### Step 1: Import from existing convention files first (preferred)
|
||||
|
||||
Search the repo for existing convention docs. If any exist, read them and
|
||||
extract the relevant rules into the matching `.trellis/spec/` files —
|
||||
usually much faster than documenting from scratch.
|
||||
|
||||
| File / Directory | Tool |
|
||||
|------|------|
|
||||
| `CLAUDE.md` / `CLAUDE.local.md` | Claude Code |
|
||||
| `AGENTS.md` | Codex / Claude Code / agent-compatible tools |
|
||||
| `.cursorrules` | Cursor |
|
||||
| `.cursor/rules/*.mdc` | Cursor (rules directory) |
|
||||
| `.windsurfrules` | Windsurf |
|
||||
| `.clinerules` | Cline |
|
||||
| `.roomodes` | Roo Code |
|
||||
| `.github/copilot-instructions.md` | GitHub Copilot |
|
||||
| `.vscode/settings.json` → `github.copilot.chat.codeGeneration.instructions` | VS Code Copilot |
|
||||
| `CONVENTIONS.md` / `.aider.conf.yml` | aider |
|
||||
| `CONTRIBUTING.md` | General project conventions |
|
||||
| `.editorconfig` | Editor formatting rules |
|
||||
|
||||
### Step 2: Analyze the codebase for anything not covered by existing docs
|
||||
|
||||
Scan real code to discover patterns. Before writing each spec file:
|
||||
- Find 2-3 real examples of each pattern in the codebase.
|
||||
- Reference real file paths (not hypothetical ones).
|
||||
- Document anti-patterns the team clearly avoids.
|
||||
|
||||
### Step 3: Document reality, not ideals
|
||||
|
||||
**Critical**: write what the code *actually does*, not what it should do.
|
||||
Sub-agents match the spec, so aspirational patterns that don't exist in the
|
||||
codebase will cause sub-agents to write code that looks out of place.
|
||||
|
||||
If the team has known tech debt, document the current state — improvement
|
||||
is a separate conversation, not a bootstrap concern.
|
||||
|
||||
---
|
||||
|
||||
## Quick explainer of the runtime (share when they ask "why do we need spec at all")
|
||||
|
||||
- Every AI coding task spawns two sub-agents: `trellis-implement` (writes
|
||||
code) and `trellis-check` (verifies quality).
|
||||
- Each task has `implement.jsonl` / `check.jsonl` manifests listing which
|
||||
spec files to load.
|
||||
- The platform hook auto-injects those spec files + the task's `prd.md`
|
||||
into every sub-agent prompt, so the sub-agent codes/reviews per team
|
||||
conventions without anyone pasting them manually.
|
||||
- Source of truth: `.trellis/spec/`. That's why filling it well now pays
|
||||
off forever.
|
||||
|
||||
---
|
||||
|
||||
## Completion
|
||||
|
||||
When the developer confirms the checklist items above are done with real
|
||||
examples (not placeholders), guide them to run:
|
||||
|
||||
```bash
|
||||
python ./.trellis/scripts/task.py finish
|
||||
python ./.trellis/scripts/task.py archive 00-bootstrap-guidelines
|
||||
```
|
||||
|
||||
After archive, every new developer who joins this project will get a
|
||||
`00-join-<slug>` onboarding task instead of this bootstrap task.
|
||||
|
||||
---
|
||||
|
||||
## Suggested opening line
|
||||
|
||||
"Welcome to Trellis! Your init just set me up to help you fill the project
|
||||
spec — a one-time setup so every future AI session follows the team's
|
||||
conventions instead of writing generic code. Before we start, do you have
|
||||
any existing convention docs (CLAUDE.md, .cursorrules, CONTRIBUTING.md,
|
||||
etc.) I can pull from, or should I scan the codebase from scratch?"
|
||||
29
.trellis/tasks/00-bootstrap-guidelines/task.json
Normal file
29
.trellis/tasks/00-bootstrap-guidelines/task.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"id": "00-bootstrap-guidelines",
|
||||
"name": "00-bootstrap-guidelines",
|
||||
"title": "Bootstrap Guidelines",
|
||||
"description": "Fill in project development guidelines for AI agents",
|
||||
"status": "in_progress",
|
||||
"dev_type": "docs",
|
||||
"scope": null,
|
||||
"package": null,
|
||||
"priority": "P1",
|
||||
"creator": "Mr.Xia",
|
||||
"assignee": "Mr.Xia",
|
||||
"createdAt": "2026-05-22",
|
||||
"completedAt": null,
|
||||
"branch": null,
|
||||
"base_branch": null,
|
||||
"worktree_path": null,
|
||||
"commit": null,
|
||||
"pr_url": null,
|
||||
"subtasks": [],
|
||||
"children": [],
|
||||
"parent": null,
|
||||
"relatedFiles": [
|
||||
".trellis/spec/backend/",
|
||||
".trellis/spec/frontend/"
|
||||
],
|
||||
"notes": "First-time setup task created by trellis init (fullstack project)",
|
||||
"meta": {}
|
||||
}
|
||||
1
.trellis/tasks/05-22-defer-sort-seed-check/check.jsonl
Normal file
1
.trellis/tasks/05-22-defer-sort-seed-check/check.jsonl
Normal file
@@ -0,0 +1 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
@@ -0,0 +1 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
52
.trellis/tasks/05-22-defer-sort-seed-check/prd.md
Normal file
52
.trellis/tasks/05-22-defer-sort-seed-check/prd.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# 调整刀序前再检查排序种子
|
||||
|
||||
## Goal
|
||||
|
||||
当程序带钻带文件路径启动时,启动菜单必须优先出现;排序种子文件的检查和提示只能发生在用户选择“调整刀序”之后,避免用户选择导出孔数、清空参数、生成 PP 钻带等启动菜单动作前被排序提示打断。
|
||||
|
||||
## Requirements
|
||||
|
||||
* 带启动参数且参数为钻带文件时,先显示启动菜单,不在菜单出现前弹出排序种子提示。
|
||||
* 用户点击启动菜单的“调整刀序”后,加载主窗口和钻带文件时再按现有规则检查同目录的 `<文件名>-sort.txt` 和 `General_sort.txt`。
|
||||
* 用户选择启动菜单里的非调整刀序动作时,不触发排序种子检查和提示。
|
||||
* 保持现有排序种子优先级、提示文案、排序应用逻辑不变。
|
||||
* 不调整启动菜单布局、钻带解析规则、PP 钻带生成规则、导出孔数逻辑。
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
* [ ] 启动参数为钻带文件且同目录存在排序种子时,启动菜单先显示。
|
||||
* [ ] 在启动菜单点击“调整刀序”后,才出现排序种子检测提示。
|
||||
* [ ] 在启动菜单点击“导出孔数报表”或“生成 PP 钻带”时,不出现排序种子检测提示。
|
||||
* [ ] 普通打开文件、拖拽文件、主窗口内使用排序种子功能保持原行为。
|
||||
|
||||
## Definition of Done
|
||||
|
||||
* 项目可成功构建。
|
||||
* 不引入新依赖。
|
||||
* 代码注释使用中文,关键行为有简短说明。
|
||||
* 行为改动限定在启动路径和加载时排序种子检查开关。
|
||||
|
||||
## Technical Approach
|
||||
|
||||
在 `MainWindowViewModel` 中新增加载时排序种子检查开关,默认开启以保留主窗口内普通加载和“调整刀序”路径的现有行为。`LoadToolsFromDrillTape` 执行排序种子检查前读取该开关。`App` 中用于启动菜单按钮可用性预检查、导出孔数、生成 PP 钻带等非调整刀序路径创建 ViewModel 时关闭该开关。
|
||||
|
||||
## Decision (ADR-lite)
|
||||
|
||||
**Context**: 当前排序种子检查挂在 `LoadToolsFromDrillTape` 末尾,只要 `OriginalFilePath` 有值就会提示。`App.CanGeneratePpDrillTape()` 在启动菜单显示前为了判断按钮可见性提前加载钻带,并设置了 `OriginalFilePath`,导致排序种子提示先于启动菜单出现。导出孔数和生成 PP 钻带也会在用户选择非调整刀序动作后触发同样的加载副作用。
|
||||
|
||||
**Decision**: 保留现有加载流程,在 ViewModel 增加显式开关,让启动菜单预检查和非调整刀序启动动作关闭加载时自动排序检查;点击“调整刀序”后进入主窗口时不关闭开关。
|
||||
|
||||
**Consequences**: 改动面小,现有排序种子应用逻辑无需重写。后续如果还有新的无界面/非排序加载路径,也需要显式关闭该开关。
|
||||
|
||||
## Out of Scope
|
||||
|
||||
* 不重构 `MainWindowViewModel` 的整体职责。
|
||||
* 不改变排序种子文件格式和匹配规则。
|
||||
* 不新增自动化 UI 测试。
|
||||
|
||||
## Technical Notes
|
||||
|
||||
* `App.xaml.cs`:启动参数、启动菜单、菜单动作分发。
|
||||
* `MainWindow.xaml.cs`:点击“调整刀序”后打开主窗口并加载初始文件。
|
||||
* `MainWindowViewModel.cs`:`LoadToolsFromDrillTape` 当前在解析完成后调用 `CheckAndApplySortFile`。
|
||||
* 项目无测试框架,`CLAUDE.md` 明确说明不写单元测试。
|
||||
26
.trellis/tasks/05-22-defer-sort-seed-check/task.json
Normal file
26
.trellis/tasks/05-22-defer-sort-seed-check/task.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"id": "defer-sort-seed-check",
|
||||
"name": "defer-sort-seed-check",
|
||||
"title": "调整刀序前再检查排序种子",
|
||||
"description": "",
|
||||
"status": "in_progress",
|
||||
"dev_type": null,
|
||||
"scope": null,
|
||||
"package": null,
|
||||
"priority": "P2",
|
||||
"creator": "Mr.Xia",
|
||||
"assignee": "Mr.Xia",
|
||||
"createdAt": "2026-05-22",
|
||||
"completedAt": null,
|
||||
"branch": null,
|
||||
"base_branch": "master",
|
||||
"worktree_path": null,
|
||||
"commit": null,
|
||||
"pr_url": null,
|
||||
"subtasks": [],
|
||||
"children": [],
|
||||
"parent": null,
|
||||
"relatedFiles": [],
|
||||
"notes": "",
|
||||
"meta": {}
|
||||
}
|
||||
Reference in New Issue
Block a user