@fitlab-ai/agent-infra 0.6.5 → 0.7.1
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/README.md +51 -25
- package/README.zh-CN.md +49 -23
- package/bin/cli.ts +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/lib/builtin-tuis.js +45 -0
- package/dist/lib/defaults.json +4 -0
- package/dist/lib/init.js +65 -23
- package/dist/lib/prompt.js +49 -1
- package/dist/lib/sandbox/commands/create.js +4 -2
- package/dist/lib/sandbox/commands/enter.js +15 -4
- package/dist/lib/sandbox/commands/list-running.js +153 -0
- package/dist/lib/sandbox/commands/ls.js +24 -45
- package/dist/lib/sandbox/commands/rebuild.js +7 -13
- package/dist/lib/sandbox/commands/rm.js +2 -0
- package/dist/lib/sandbox/config.js +3 -0
- package/dist/lib/sandbox/image-prune.js +18 -0
- package/dist/lib/sandbox/index.js +2 -1
- package/dist/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/dist/lib/sandbox/task-resolver.js +18 -0
- package/dist/lib/sandbox/tools.js +213 -8
- package/dist/lib/update.js +70 -18
- package/lib/builtin-tuis.ts +55 -0
- package/lib/defaults.json +4 -0
- package/lib/init.ts +97 -35
- package/lib/prompt.ts +54 -1
- package/lib/sandbox/commands/create.ts +10 -2
- package/lib/sandbox/commands/enter.ts +14 -4
- package/lib/sandbox/commands/list-running.ts +188 -0
- package/lib/sandbox/commands/ls.ts +28 -49
- package/lib/sandbox/commands/rebuild.ts +12 -14
- package/lib/sandbox/commands/rm.ts +3 -0
- package/lib/sandbox/config.ts +7 -0
- package/lib/sandbox/image-prune.ts +23 -0
- package/lib/sandbox/index.ts +2 -1
- package/lib/sandbox/runtimes/ai-tools.dockerfile +10 -6
- package/lib/sandbox/task-resolver.ts +23 -1
- package/lib/sandbox/tools.ts +248 -9
- package/lib/update.ts +85 -30
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +1 -1
- package/templates/.agents/QUICKSTART.zh-CN.md +1 -1
- package/templates/.agents/README.en.md +111 -2
- package/templates/.agents/README.zh-CN.md +111 -2
- package/templates/.agents/rules/create-issue.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/create-issue.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +6 -5
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +6 -5
- package/templates/.agents/rules/milestone-inference.github.en.md +2 -2
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +2 -2
- package/templates/.agents/rules/no-mid-flow-questions.en.md +57 -0
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +57 -0
- package/templates/.agents/rules/pr-sync.github.en.md +4 -5
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +4 -5
- package/templates/.agents/rules/task-management.en.md +9 -6
- package/templates/.agents/rules/task-management.zh-CN.md +9 -6
- package/templates/.agents/rules/task-short-id.en.md +141 -0
- package/templates/.agents/rules/task-short-id.zh-CN.md +124 -0
- package/templates/.agents/rules/testing-discipline.en.md +2 -2
- package/templates/.agents/rules/testing-discipline.zh-CN.md +2 -2
- package/templates/.agents/scripts/task-short-id.js +713 -0
- package/templates/.agents/scripts/validate-artifact.js +1 -1
- package/templates/.agents/skills/analyze-task/SKILL.en.md +20 -4
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +20 -5
- package/templates/.agents/skills/block-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/cancel-task/SKILL.en.md +12 -0
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +12 -1
- package/templates/.agents/skills/check-task/SKILL.en.md +47 -32
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +46 -32
- package/templates/.agents/skills/close-codescan/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +11 -0
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +11 -0
- package/templates/.agents/skills/code-task/SKILL.en.md +121 -0
- package/templates/.agents/skills/{implement-task → code-task}/SKILL.zh-CN.md +55 -25
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.en.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/config/verify.zh-CN.json +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.zh-CN.md +2 -2
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.en.md → code-task/reference/code-rules.en.md} +6 -6
- package/templates/.agents/skills/{implement-task/reference/implementation-rules.zh-CN.md → code-task/reference/code-rules.zh-CN.md} +3 -3
- package/templates/.agents/skills/code-task/reference/dual-mode.en.md +69 -0
- package/templates/.agents/skills/code-task/reference/dual-mode.zh-CN.md +69 -0
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.en.md → code-task/reference/fix-mode.en.md} +12 -12
- package/templates/.agents/skills/{refine-task/reference/fix-workflow.zh-CN.md → code-task/reference/fix-mode.zh-CN.md} +8 -8
- package/templates/.agents/skills/code-task/reference/output-template.en.md +20 -0
- package/templates/.agents/skills/code-task/reference/output-template.zh-CN.md +20 -0
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.en.md +4 -4
- package/templates/.agents/skills/{implement-task → code-task}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/code-task/scripts/detect-mode.js +370 -0
- package/templates/.agents/skills/commit/SKILL.en.md +6 -2
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/commit/reference/task-status-update.en.md +10 -6
- package/templates/.agents/skills/commit/reference/task-status-update.zh-CN.md +10 -6
- package/templates/.agents/skills/complete-task/SKILL.en.md +17 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +17 -4
- package/templates/.agents/skills/create-pr/SKILL.en.md +21 -1
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +21 -1
- package/templates/.agents/skills/create-task/SKILL.en.md +14 -0
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +14 -1
- package/templates/.agents/skills/import-codescan/SKILL.en.md +15 -1
- package/templates/.agents/skills/import-codescan/SKILL.zh-CN.md +15 -1
- package/templates/.agents/skills/import-dependabot/SKILL.en.md +16 -2
- package/templates/.agents/skills/import-dependabot/SKILL.zh-CN.md +16 -2
- package/templates/.agents/skills/import-issue/SKILL.en.md +17 -3
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +17 -3
- package/templates/.agents/skills/plan-task/SKILL.en.md +8 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +8 -5
- package/templates/.agents/skills/restore-task/SKILL.en.md +16 -3
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +16 -4
- package/templates/.agents/skills/review-analysis/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/review-analysis/config/verify.en.json +51 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +51 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/review-analysis/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-analysis/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/{review-task → review-code}/SKILL.en.md +15 -9
- package/templates/.agents/skills/{review-task → review-code}/SKILL.zh-CN.md +19 -10
- package/templates/.agents/skills/{review-task → review-code}/config/verify.en.json +7 -5
- package/templates/.agents/skills/{review-task → review-code}/config/verify.zh-CN.json +6 -4
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.en.md +21 -17
- package/templates/.agents/skills/{review-task → review-code}/reference/output-templates.zh-CN.md +19 -15
- package/templates/.agents/skills/{review-task → review-code}/reference/report-template.en.md +5 -6
- package/templates/.agents/skills/review-code/reference/report-template.zh-CN.md +91 -0
- package/templates/.agents/skills/review-code/reference/review-criteria.en.md +48 -0
- package/templates/.agents/skills/{review-task → review-code}/reference/review-criteria.zh-CN.md +10 -4
- package/templates/.agents/skills/review-plan/SKILL.en.md +80 -0
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +105 -0
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.en.json +14 -10
- package/templates/.agents/skills/{refine-task → review-plan}/config/verify.zh-CN.json +14 -10
- package/templates/.agents/skills/review-plan/reference/output-templates.en.md +87 -0
- package/templates/.agents/skills/review-plan/reference/output-templates.zh-CN.md +87 -0
- package/templates/.agents/skills/review-plan/reference/report-template.en.md +90 -0
- package/templates/.agents/skills/{review-task → review-plan}/reference/report-template.zh-CN.md +3 -3
- package/templates/.agents/skills/review-plan/reference/review-criteria.en.md +47 -0
- package/templates/.agents/skills/review-plan/reference/review-criteria.zh-CN.md +47 -0
- package/templates/.agents/skills/test/SKILL.en.md +2 -2
- package/templates/.agents/skills/test/SKILL.zh-CN.md +13 -31
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +1 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +1 -0
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +113 -21
- package/templates/.agents/templates/task.en.md +4 -3
- package/templates/.agents/templates/task.zh-CN.md +3 -2
- package/templates/.agents/workflows/bug-fix.en.yaml +126 -80
- package/templates/.agents/workflows/bug-fix.zh-CN.yaml +90 -44
- package/templates/.agents/workflows/feature-development.en.yaml +115 -70
- package/templates/.agents/workflows/feature-development.zh-CN.yaml +92 -47
- package/templates/.agents/workflows/refactoring.en.yaml +123 -78
- package/templates/.agents/workflows/refactoring.zh-CN.yaml +89 -44
- package/templates/.claude/commands/code-task.en.md +8 -0
- package/templates/.claude/commands/code-task.zh-CN.md +8 -0
- package/templates/.claude/commands/review-analysis.en.md +8 -0
- package/templates/.claude/commands/review-analysis.zh-CN.md +8 -0
- package/templates/.claude/commands/review-code.en.md +8 -0
- package/templates/.claude/commands/review-code.zh-CN.md +8 -0
- package/templates/.claude/commands/review-plan.en.md +8 -0
- package/templates/.claude/commands/review-plan.zh-CN.md +8 -0
- package/templates/.gemini/commands/_project_/archive-tasks.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/code-task.en.toml +8 -0
- package/templates/.gemini/commands/_project_/code-task.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/init-labels.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/init-milestones.zh-CN.toml +1 -1
- package/templates/.gemini/commands/_project_/review-analysis.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-analysis.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-code.zh-CN.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.en.toml +8 -0
- package/templates/.gemini/commands/_project_/review-plan.zh-CN.toml +8 -0
- package/templates/.opencode/commands/code-task.en.md +11 -0
- package/templates/.opencode/commands/code-task.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-analysis.en.md +11 -0
- package/templates/.opencode/commands/review-analysis.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-code.en.md +11 -0
- package/templates/.opencode/commands/review-code.zh-CN.md +11 -0
- package/templates/.opencode/commands/review-plan.en.md +11 -0
- package/templates/.opencode/commands/review-plan.zh-CN.md +11 -0
- package/templates/.agents/skills/implement-task/SKILL.en.md +0 -173
- package/templates/.agents/skills/implement-task/reference/output-template.en.md +0 -20
- package/templates/.agents/skills/implement-task/reference/output-template.zh-CN.md +0 -20
- package/templates/.agents/skills/refine-task/SKILL.en.md +0 -153
- package/templates/.agents/skills/refine-task/SKILL.zh-CN.md +0 -153
- package/templates/.agents/skills/refine-task/reference/report-template.en.md +0 -64
- package/templates/.agents/skills/refine-task/reference/report-template.zh-CN.md +0 -64
- package/templates/.agents/skills/review-task/reference/review-criteria.en.md +0 -42
- package/templates/.claude/commands/implement-task.en.md +0 -8
- package/templates/.claude/commands/implement-task.zh-CN.md +0 -8
- package/templates/.claude/commands/refine-task.en.md +0 -8
- package/templates/.claude/commands/refine-task.zh-CN.md +0 -8
- package/templates/.claude/commands/review-task.en.md +0 -8
- package/templates/.claude/commands/review-task.zh-CN.md +0 -8
- package/templates/.gemini/commands/_project_/implement-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/implement-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/refine-task.zh-CN.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.en.toml +0 -8
- package/templates/.gemini/commands/_project_/review-task.zh-CN.toml +0 -8
- package/templates/.opencode/commands/implement-task.en.md +0 -11
- package/templates/.opencode/commands/implement-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/refine-task.en.md +0 -11
- package/templates/.opencode/commands/refine-task.zh-CN.md +0 -11
- package/templates/.opencode/commands/review-task.en.md +0 -11
- package/templates/.opencode/commands/review-task.zh-CN.md +0 -11
- /package/templates/.agents/skills/{implement-task → code-task}/reference/branch-management.en.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Milestone 推断规则
|
|
2
2
|
|
|
3
|
-
在 `create-task` 的平台规则、`
|
|
3
|
+
在 `create-task` 的平台规则、`code-task` 或 `create-pr` 处理 milestone 之前先读取本文件。
|
|
4
4
|
|
|
5
5
|
## 通用原则
|
|
6
6
|
|
|
@@ -56,7 +56,7 @@ fi
|
|
|
56
56
|
|
|
57
57
|
如果 `has_triage=false`、推断结果为空、或 `gh issue edit` 失败,跳过并继续,不阻断 `import-issue` 工作流。
|
|
58
58
|
|
|
59
|
-
## 阶段 2:`
|
|
59
|
+
## 阶段 2:`code-task`
|
|
60
60
|
|
|
61
61
|
目标:开始开发时,把 Issue milestone 从版本线收窄到具体版本。
|
|
62
62
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# General Rule - No Mid-Flow Questions During SKILL Execution
|
|
2
|
+
|
|
3
|
+
> **Scope**: this rule applies to **all SKILL** executions.
|
|
4
|
+
> Only the two exemption categories below may ask the user; any other mid-flow question is a violation.
|
|
5
|
+
|
|
6
|
+
## Exemption Categories
|
|
7
|
+
|
|
8
|
+
### Exemption 1: Literal clarification of entry-point natural-language input
|
|
9
|
+
|
|
10
|
+
Allowed only when the SKILL's core responsibility is to process **natural-language input the user provided in this invocation**, and that input is unparseable or self-contradictory. The clarification must be about the **literal input itself**; it must not be used to solicit implementation preferences.
|
|
11
|
+
|
|
12
|
+
SKILLs currently covered by this exemption:
|
|
13
|
+
|
|
14
|
+
- `create-task`: may clarify the task description itself when the user-provided description is unclear
|
|
15
|
+
- `refine-title`: requires the user's final confirmation (y/n) for a generated title
|
|
16
|
+
|
|
17
|
+
### Exemption 2: Short confirmation before truly irreversible destructive operations
|
|
18
|
+
|
|
19
|
+
Any SKILL may pause briefly before the following irreversible operations; routine design choices do not qualify:
|
|
20
|
+
|
|
21
|
+
- `git push --force`, `rm -rf` against the user's worktree, etc.
|
|
22
|
+
- Deleting or overwriting shared remote resources (e.g., shared GitHub labels)
|
|
23
|
+
- Overwriting uncommitted local changes
|
|
24
|
+
|
|
25
|
+
SKILLs currently covered by this exemption:
|
|
26
|
+
|
|
27
|
+
- `init-labels`: may confirm before deleting legacy labels not in the final mapping
|
|
28
|
+
- `commit`: may stop and confirm when its plan conflicts with the user's uncommitted changes
|
|
29
|
+
|
|
30
|
+
## No-Mid-Flow-Questions Clause (default behavior)
|
|
31
|
+
|
|
32
|
+
For every SKILL execution context not covered by the two exemptions above, the default behavior is:
|
|
33
|
+
|
|
34
|
+
1. Do not call any user-question tool, including but not limited to `AskUserQuestion` and equivalent mechanisms that ask the user to choose.
|
|
35
|
+
2. When uncertain, proceed with the most robust option without interrupting the flow. Use this priority order:
|
|
36
|
+
1. Prefer the option consistent with existing code, documentation, and rules
|
|
37
|
+
2. Prefer the more reversible option
|
|
38
|
+
3. Prefer the option with the smaller impact area
|
|
39
|
+
3. If assumptions or open questions exist, write them into fixed artifact sections instead of leaving them suspended in the conversation:
|
|
40
|
+
- English artifacts use `## Assumptions` / `## Open Questions`; Chinese artifacts use `## 假设` / `## 未决问题`
|
|
41
|
+
- Meaning: the assumptions section records assumptions used for this run that may be revisited later; the open questions section records unresolved questions for human review
|
|
42
|
+
- If the artifact template does not reserve these sections, append them as needed. If there are no assumptions or open questions, do not force empty sections.
|
|
43
|
+
|
|
44
|
+
## Human Review Checkpoint Semantics
|
|
45
|
+
|
|
46
|
+
A mandatory human review checkpoint means:
|
|
47
|
+
|
|
48
|
+
- Stop after producing the artifact: once the skill finishes an artifact such as `plan.md`, end the current invocation and wait for the user to explicitly trigger the next skill command
|
|
49
|
+
- Do not pause mid-process to ask for input: do not insert interruptions such as "Do you prefer option A or B?" between execution steps
|
|
50
|
+
|
|
51
|
+
If a key decision needs human judgment during execution, follow the assumptions and open questions rule above: record it in the artifact's "Open Questions" / `未决问题` section for the user to address at the review checkpoint.
|
|
52
|
+
|
|
53
|
+
## Anchor Location
|
|
54
|
+
|
|
55
|
+
This rule's sole global anchor lives in the project-level AGENTS.md "AI Behavior Principles" preamble, which every AI tool loads. Individual SKILL.md files no longer reference this rule, so no per-skill duplicate bullet needs to be maintained.
|
|
56
|
+
|
|
57
|
+
When executing any SKILL, if AGENTS.md's preamble notes "follow this rule first," the LLM should **proactively Read** this file to load the complete exemption list and concrete constraints.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# 通用规则 - SKILL 执行禁言
|
|
2
|
+
|
|
3
|
+
> **适用范围**:本规则适用于**所有 SKILL** 的执行过程。
|
|
4
|
+
> 仅以下两类例外可向用户提问;不属于这两类的发问一律按违规处理。
|
|
5
|
+
|
|
6
|
+
## 例外类型
|
|
7
|
+
|
|
8
|
+
### 例外 1:入口式自然语言入参的字面澄清
|
|
9
|
+
|
|
10
|
+
仅当 SKILL 的本职职责就是处理**用户当次提供的自然语言入参**时,如果该入参无法解析或自相矛盾,可直接就**该入参字面**向用户澄清。不允许借此征求实现方案的偏好。
|
|
11
|
+
|
|
12
|
+
当前归入本例外的 SKILL:
|
|
13
|
+
|
|
14
|
+
- `create-task`:用户提供的任务描述不清晰时可澄清描述本身
|
|
15
|
+
- `refine-title`:生成的新标题需要用户最终确认(y/n)
|
|
16
|
+
|
|
17
|
+
### 例外 2:不可逆破坏性操作前的短暂确认
|
|
18
|
+
|
|
19
|
+
任何 SKILL 在以下不可逆操作前可短暂确认;常规方案选择不属于此类:
|
|
20
|
+
|
|
21
|
+
- `git push --force`、`rm -rf` 用户工作树等
|
|
22
|
+
- 删除/覆盖远端共享资源(如 GitHub 共享 label)
|
|
23
|
+
- 覆盖用户未提交的本机改动
|
|
24
|
+
|
|
25
|
+
当前归入本例外的 SKILL:
|
|
26
|
+
|
|
27
|
+
- `init-labels`:删除不在最终映射中的旧 label 前可确认
|
|
28
|
+
- `commit`:检测到与用户未提交改动冲突时可停下确认
|
|
29
|
+
|
|
30
|
+
## 禁言条款(默认行为)
|
|
31
|
+
|
|
32
|
+
不属于上述两类例外的所有 SKILL 执行场景,遵循以下默认行为:
|
|
33
|
+
|
|
34
|
+
1. **禁止调用**任何向用户发问的工具(包括但不限于 `AskUserQuestion` 及等价的「征求用户选择」机制)。
|
|
35
|
+
2. **不确定时**,按「最稳健方案」自主推进,不中断对话。最稳健方案的判定优先级:
|
|
36
|
+
1. 与现有代码 / 文档 / 规则一致的方案优先
|
|
37
|
+
2. 可逆性更高的方案优先
|
|
38
|
+
3. 影响面更小的方案优先
|
|
39
|
+
3. **如存在假设或未决问题**,写入产物中的固定段落,不在对话中悬置:
|
|
40
|
+
- 中文产物用 `## 假设` / `## 未决问题`;英文产物用 `## Assumptions` / `## Open Questions`
|
|
41
|
+
- 含义:`假设` 段记录本次按某假设推进、未来若假设不成立可推翻;`未决问题` 段记录本次未决、需要人工审查时裁定的问题
|
|
42
|
+
- 产物模板未预留这两段时,按需追加;没有假设或未决问题时不必强行写空段。
|
|
43
|
+
|
|
44
|
+
## 人工审查检查点语义
|
|
45
|
+
|
|
46
|
+
「强制性人工审查检查点」(mandatory human review checkpoint)的语义是:
|
|
47
|
+
|
|
48
|
+
- **产出后停止**:技能完成产物(如 `plan.md`)后立即结束本轮调用,等待用户主动触发下一个技能命令
|
|
49
|
+
- **不是过程中暂停征求意见**:不允许在执行步骤之间插入「请问您倾向 A 还是 B?」之类的中断
|
|
50
|
+
|
|
51
|
+
如果在执行过程中发现需要用户裁定的关键决策,按上文「假设与未决问题」处理,记录到产物的「未决问题」/`Open Questions` 段落,由用户在审查检查点统一回应。
|
|
52
|
+
|
|
53
|
+
## 锚点位置
|
|
54
|
+
|
|
55
|
+
本规则的唯一全局锚点在项目级 AGENTS.md 的「AI 行为准则」preamble,所有 AI 工具加载 AGENTS.md 时即可见。各 SKILL.md 不再单独引用本规则,避免在每个 SKILL 顶部维护重复 bullet。
|
|
56
|
+
|
|
57
|
+
LLM 在执行任一 SKILL 时,若 AGENTS.md 的 preamble 已说明「优先遵循本规则」,应**主动 Read** 本文件以获取完整的例外列表与具体约束。
|
|
@@ -24,14 +24,13 @@ Within one PR, a given `{task-id}` must have only one summary comment with this
|
|
|
24
24
|
|
|
25
25
|
Aggregate the latest artifacts in the task directory:
|
|
26
26
|
- `plan.md` or the latest `plan-r{N}.md`
|
|
27
|
-
- `
|
|
28
|
-
- `review.md` or the latest `review-r{N}.md`
|
|
29
|
-
- `refinement.md` or the latest `refinement-r{N}.md`
|
|
27
|
+
- `code.md` or the latest `code-r{N}.md`
|
|
28
|
+
- `review-code.md` or the latest `review-code-r{N}.md`
|
|
30
29
|
|
|
31
30
|
Aggregation rules:
|
|
32
31
|
- extract 2-4 self-contained technical decisions from `plan*`
|
|
33
|
-
- build the review-history table from `review*` and `
|
|
34
|
-
- extract the test summary from `
|
|
32
|
+
- build the review-history table from `review-code*` and `code*`
|
|
33
|
+
- extract the test summary from `code*`
|
|
35
34
|
- if one artifact class is missing, treat it as "no data for this stage" and continue
|
|
36
35
|
|
|
37
36
|
## Comment Body Template
|
|
@@ -24,14 +24,13 @@
|
|
|
24
24
|
|
|
25
25
|
聚合当前任务目录中的最新产物:
|
|
26
26
|
- `plan.md` 或最新 `plan-r{N}.md`
|
|
27
|
-
- `
|
|
28
|
-
- `review.md` 或最新 `review-r{N}.md`
|
|
29
|
-
- `refinement.md` 或最新 `refinement-r{N}.md`
|
|
27
|
+
- `code.md` 或最新 `code-r{N}.md`
|
|
28
|
+
- `review-code.md` 或最新 `review-code-r{N}.md`
|
|
30
29
|
|
|
31
30
|
聚合规则:
|
|
32
31
|
- 从 `plan*` 提取 2-4 条自包含的关键技术决策
|
|
33
|
-
- 用 `review*` 与 `
|
|
34
|
-
- 从 `
|
|
32
|
+
- 用 `review-code*` 与 `code*` 构建审查历程表
|
|
33
|
+
- 从 `code*` 提取测试结果摘要
|
|
35
34
|
- 某一类产物缺失时,按“无该阶段数据”处理并继续生成
|
|
36
35
|
|
|
37
36
|
## 评论体模板
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
Map user intent to the corresponding workflow command:
|
|
6
6
|
- "analyze issue #123" -> `import-issue`
|
|
7
7
|
- "analyze task TASK-20260306-143022" -> `analyze-task`
|
|
8
|
+
- "review requirement analysis" -> `review-analysis`
|
|
8
9
|
- "design a plan" -> `plan-task`
|
|
9
|
-
- "
|
|
10
|
-
- "
|
|
11
|
-
- "
|
|
10
|
+
- "review a plan" or "review technical design" -> `review-plan`
|
|
11
|
+
- "implement" or "build" -> `code-task`
|
|
12
|
+
- "code review" or "review code" -> `review-code`
|
|
13
|
+
- "fix review feedback" -> `code-task`
|
|
12
14
|
|
|
13
15
|
## Task State Management
|
|
14
16
|
|
|
@@ -25,10 +27,11 @@ Map user intent to the corresponding workflow command:
|
|
|
25
27
|
- `import-dependabot`: update `current_step`, `updated_at`, `assigned_to`, `agent_infra_version`
|
|
26
28
|
- `restore-task`: update `status`, `updated_at`, `assigned_to`, `agent_infra_version`
|
|
27
29
|
- `analyze-task`: update `current_step`, `updated_at`, `assigned_to`, `agent_infra_version`
|
|
30
|
+
- `review-analysis`: update `current_step`, `updated_at`, `agent_infra_version`
|
|
28
31
|
- `plan-task`: update `current_step`, `updated_at`, `agent_infra_version`
|
|
29
|
-
- `
|
|
30
|
-
- `
|
|
31
|
-
- `
|
|
32
|
+
- `review-plan`: update `current_step`, `updated_at`, `agent_infra_version`
|
|
33
|
+
- `code-task`: update `current_step`, `updated_at`, `agent_infra_version`
|
|
34
|
+
- `review-code`: update `current_step`, `updated_at`, `agent_infra_version`
|
|
32
35
|
- `create-pr`: update `pr_number`, `updated_at`, `agent_infra_version`
|
|
33
36
|
- `commit`: update `updated_at`, `agent_infra_version`; update `current_step` when needed (see `commit/reference/task-status-update.md`)
|
|
34
37
|
- `complete-task`: update `status`, `current_step`, `completed_at`, `updated_at`, `agent_infra_version`
|
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
根据用户意图自动映射到对应工作流命令:
|
|
6
6
|
- “分析 issue #123” -> `import-issue`
|
|
7
7
|
- “分析任务 TASK-20260306-143022” -> `analyze-task`
|
|
8
|
+
- “审查需求分析” -> `review-analysis`
|
|
8
9
|
- “设计方案” -> `plan-task`
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
10
|
+
- “审查方案/审查技术方案” -> `review-plan`
|
|
11
|
+
- “实施/实现” -> `code-task`
|
|
12
|
+
- “审查代码/代码审查” -> `review-code`
|
|
13
|
+
- “修复审查问题” -> `code-task`
|
|
12
14
|
|
|
13
15
|
## 任务状态管理
|
|
14
16
|
|
|
@@ -25,10 +27,11 @@
|
|
|
25
27
|
- `import-dependabot`:更新 `current_step`、`updated_at`、`assigned_to`、`agent_infra_version`
|
|
26
28
|
- `restore-task`:更新 `status`、`updated_at`、`assigned_to`、`agent_infra_version`
|
|
27
29
|
- `analyze-task`:更新 `current_step`、`updated_at`、`assigned_to`、`agent_infra_version`
|
|
30
|
+
- `review-analysis`:更新 `current_step`、`updated_at`、`agent_infra_version`
|
|
28
31
|
- `plan-task`:更新 `current_step`、`updated_at`、`agent_infra_version`
|
|
29
|
-
- `
|
|
30
|
-
- `
|
|
31
|
-
- `
|
|
32
|
+
- `review-plan`:更新 `current_step`、`updated_at`、`agent_infra_version`
|
|
33
|
+
- `code-task`:更新 `current_step`、`updated_at`、`agent_infra_version`
|
|
34
|
+
- `review-code`:更新 `current_step`、`updated_at`、`agent_infra_version`
|
|
32
35
|
- `create-pr`:更新 `pr_number`、`updated_at`、`agent_infra_version`
|
|
33
36
|
- `commit`:更新 `updated_at`、`agent_infra_version`;必要时更新 `current_step`(详见 `commit/reference/task-status-update.md`)
|
|
34
37
|
- `complete-task`:更新 `status`、`current_step`、`completed_at`、`updated_at`、`agent_infra_version`
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Task short id
|
|
2
|
+
|
|
3
|
+
Task short ids let mobile-style SKILL invocations replace the full 22-char
|
|
4
|
+
`TASK-YYYYMMDD-HHMMSS` with `#NN` while a task is active.
|
|
5
|
+
|
|
6
|
+
## Syntax
|
|
7
|
+
|
|
8
|
+
- Format: `^#\d{shortIdLength}$` (**zero-padded to a fixed width**; with the
|
|
9
|
+
default `shortIdLength=2`, e.g. `#01`, `#07`, `#42`).
|
|
10
|
+
- **Must** be zero-padded to `shortIdLength` digits (default 2: `#1` is a format
|
|
11
|
+
error, use `#01`). This keeps things aligned and touch-typeable.
|
|
12
|
+
- `#00` (or `#0` when `shortIdLength=1`) is reserved and never allocated; digits
|
|
13
|
+
only, no letters.
|
|
14
|
+
- The plain `TASK-…` form keeps working everywhere; `#NN` is an alias, not the
|
|
15
|
+
persisted task id.
|
|
16
|
+
|
|
17
|
+
## Lifecycle
|
|
18
|
+
|
|
19
|
+
| Action | When | Effect on registry & task.md |
|
|
20
|
+
|------------|-----------------------------------------------------------------------|---------------------------------------------------------------|
|
|
21
|
+
| alloc | `create-task`, `import-issue`, `import-codescan`, `import-dependabot` | Assigns lowest free `#NN`; writes `short_id` into task.md. |
|
|
22
|
+
| resolve | Lifecycle SKILLs (`analyze-task`, `plan-task`, `code-task`, …) | Looks up `#NN` → full task id. Does not allocate. |
|
|
23
|
+
| release | `complete-task`, `cancel-task`, `block-task`, `close-codescan`, `close-dependabot` | Removes the registry entry; leaves task.md `short_id` as a historical value. |
|
|
24
|
+
| re-alloc | `restore-task` | Re-allocates a (possibly new) `#NN` and writes it to task.md. |
|
|
25
|
+
|
|
26
|
+
Short ids are valid only while a task lives in `.agents/workspace/active/`.
|
|
27
|
+
Once it is moved to `completed/`, `blocked/`, or `archive/`, the `#NN` slot is
|
|
28
|
+
freed and may be reused by a new task.
|
|
29
|
+
|
|
30
|
+
## Configuration
|
|
31
|
+
|
|
32
|
+
```jsonc
|
|
33
|
+
// .agents/.airc.json
|
|
34
|
+
{
|
|
35
|
+
"task": {
|
|
36
|
+
"shortIdLength": 2 // default; capacity = 99 (#01–#99). Set to 3 for #001–#999.
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
When all slots for the configured width are in use, `alloc` fails with a clear
|
|
42
|
+
error suggesting either archiving some tasks or raising `task.shortIdLength`.
|
|
43
|
+
There is no silent extension or truncation. Changing `shortIdLength` requires
|
|
44
|
+
archiving all active tasks first (the registry key width depends on it).
|
|
45
|
+
|
|
46
|
+
## `#NN` resolution scope (split by entrypoint)
|
|
47
|
+
|
|
48
|
+
| Entrypoint | Hit | Miss |
|
|
49
|
+
|-------------------------------------------------------------|----------------------|------------------------------------------------------|
|
|
50
|
+
| SKILL parameter resolver (lifecycle SKILLs) | resolve to full id | **strict error** — short id not found / invalid |
|
|
51
|
+
| `ai sandbox enter '#NN'` / `ai sandbox exec '#NN' …` | resolve to full id | fall back to running-sandbox ls index (`#414`) |
|
|
52
|
+
|
|
53
|
+
`list --verify` is strictly read-only: it reports discrepancies between active
|
|
54
|
+
dir, registry, and `short_id` declared in each `task.md`, but never writes.
|
|
55
|
+
|
|
56
|
+
## SKILL parameter resolver
|
|
57
|
+
|
|
58
|
+
Any SKILL (alloc / resolve / release / re-alloc lifecycle entry-points) that
|
|
59
|
+
receives a `{task-id}` argument must follow this contract:
|
|
60
|
+
|
|
61
|
+
1. If `{task-id}` starts with `#`:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
if [[ "{task-id}" == "#"* ]]; then
|
|
65
|
+
# The script writes the full error message (including "expected #NN
|
|
66
|
+
# (N-digit zero-padded; e.g. '#01')") to stderr; callers only forward the exit.
|
|
67
|
+
task_id=$(node .agents/scripts/task-short-id.js resolve "{task-id}") || exit 1
|
|
68
|
+
else
|
|
69
|
+
task_id="{task-id}"
|
|
70
|
+
fi
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Every downstream command treats `{task-id}` as `$task_id` (already the full
|
|
74
|
+
`TASK-YYYYMMDD-HHMMSS` form).
|
|
75
|
+
3. Error-code semantics for resolve are documented under "Error scenarios"; do
|
|
76
|
+
not reimplement error handling inside each SKILL.
|
|
77
|
+
|
|
78
|
+
## Storage
|
|
79
|
+
|
|
80
|
+
The short id system persists state in two places that stay in sync at rest:
|
|
81
|
+
|
|
82
|
+
| Location | Written by | Read by | Removed by |
|
|
83
|
+
|---|---|---|---|
|
|
84
|
+
| `.agents/workspace/active/.short-ids.json` (registry) | `alloc` / cold-start migration | `resolve` (authoritative) / `list` / `list --verify` | `release` / cold-start stale cleanup |
|
|
85
|
+
| `short_id` frontmatter field in each task.md | `alloc` / cold-start migration | `list --verify` (consistency check) | **never** (kept as historical value after archive) |
|
|
86
|
+
|
|
87
|
+
**Registry**:
|
|
88
|
+
|
|
89
|
+
- Path: `<repo-root>/.agents/workspace/active/.short-ids.json`
|
|
90
|
+
- Schema: `{ "version": 1, "ids": { "01": "TASK-20260609-192644", "02": "TASK-…" } }`
|
|
91
|
+
- Keys are zero-padded decimal strings of `task.shortIdLength` digits; values are
|
|
92
|
+
full `TASK-…` task ids.
|
|
93
|
+
- Automatically git-ignored (the whole active workspace is ignored; no new
|
|
94
|
+
ignore entry needed).
|
|
95
|
+
- Created on demand by the first `alloc` / `resolve`; an absent file is treated
|
|
96
|
+
as an empty registry.
|
|
97
|
+
|
|
98
|
+
**`short_id` field in task.md**:
|
|
99
|
+
|
|
100
|
+
- Lives in frontmatter, immediately after `id`; formatted `short_id: #01`.
|
|
101
|
+
- Matches the registry key byte-for-byte (including the `#` prefix).
|
|
102
|
+
- After archive (complete-task / cancel-task / block-task / close-*) the
|
|
103
|
+
registry entry is deleted immediately (the short id can be reused), but the
|
|
104
|
+
`short_id` field in task.md is kept as a historical value. The resolver
|
|
105
|
+
trusts the registry only.
|
|
106
|
+
- Cold-start migration: the first `alloc` / `resolve` after an upgrade scans
|
|
107
|
+
the active directory and fills in the missing field for legacy tasks; the
|
|
108
|
+
field write is constrained (does NOT refresh `updated_at` /
|
|
109
|
+
`agent_infra_version` and does NOT append Activity Log).
|
|
110
|
+
|
|
111
|
+
`resolve('#NN')` workflow: ① validate arg matches `^#\d{shortIdLength}$` →
|
|
112
|
+
② look up `NN` directly as the registry `ids` key → ③ return full task id on
|
|
113
|
+
hit; on miss, exit 1 with the `list --verify` repair hint.
|
|
114
|
+
|
|
115
|
+
## Error scenarios
|
|
116
|
+
|
|
117
|
+
- **Short id not found**: the registry has no entry for `#NN`. Either the task
|
|
118
|
+
was archived (release freed the slot) or the input is wrong.
|
|
119
|
+
- **Registry corruption** (duplicate registry entries for the same task id, or
|
|
120
|
+
the JSON is unparsable): exit code 2; manual cleanup required.
|
|
121
|
+
- **Parameter format error** (e.g. `#00`, `#abc`, `#`, or `#1` when
|
|
122
|
+
`shortIdLength=2`): exit code 1.
|
|
123
|
+
|
|
124
|
+
## Cross-TUI quoting
|
|
125
|
+
|
|
126
|
+
Bash treats `#` as a comment marker. Always single-quote: `ai sandbox exec '#03' 'npm test'`.
|
|
127
|
+
Claude Code / Codex / Gemini CLI / OpenCode all forward `#NN` to SKILL
|
|
128
|
+
`ARGUMENTS` literally when quoted.
|
|
129
|
+
|
|
130
|
+
## Cold-start migration
|
|
131
|
+
|
|
132
|
+
When a project upgrades to a version with this feature, the first call to
|
|
133
|
+
`alloc` / `resolve` runs the cold-start path:
|
|
134
|
+
|
|
135
|
+
- Active tasks whose `task.md` lacks `short_id` get one allocated and written
|
|
136
|
+
back (the only frontmatter mutation; `updated_at` / `agent_infra_version`
|
|
137
|
+
are **not** refreshed and Activity Log is **not** appended).
|
|
138
|
+
- If active task count exceeds `shortIdLength` capacity, the migration aborts
|
|
139
|
+
**before any write** with a capacity error.
|
|
140
|
+
- If a partial write fails midway, `tx.commit()` rolls all task.md files back to
|
|
141
|
+
their original content (including `mtime` / `atime`).
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# 任务短号
|
|
2
|
+
|
|
3
|
+
短号让所有 SKILL 在 active 任务生命周期内可以用 `#NN` 替代完整的 22 字符
|
|
4
|
+
`TASK-YYYYMMDD-HHMMSS`。
|
|
5
|
+
|
|
6
|
+
## 语法
|
|
7
|
+
|
|
8
|
+
- 格式:`^#\d{shortIdLength}$`(**零填充到固定宽度**;默认 `shortIdLength=2` 时
|
|
9
|
+
形如 `#01`、`#07`、`#42`)。
|
|
10
|
+
- **必须**零填充到 `shortIdLength` 位(默认 2 位:`#1` 视为格式错误,应输入
|
|
11
|
+
`#01`)。这是为了视觉对齐与盲打体验。
|
|
12
|
+
- `#00`(或 `shortIdLength=1` 时 `#0`)保留、永不分配;纯数字、不引入字母。
|
|
13
|
+
- 完整 `TASK-…` 入参在所有路径下行为与现状等价;`#NN` 只是别名,不是持久化任务 ID。
|
|
14
|
+
|
|
15
|
+
## 生命周期
|
|
16
|
+
|
|
17
|
+
| 动作 | 触发时机 | 注册表 / task.md 效应 |
|
|
18
|
+
|-----------|---------------------------------------------------------------------------------------------|------------------------------------------------------------------|
|
|
19
|
+
| alloc | `create-task`、`import-issue`、`import-codescan`、`import-dependabot` | 分配最小可用 `#NN`,写入 task.md 的 `short_id` 字段。 |
|
|
20
|
+
| resolve | 生命周期 SKILL(`analyze-task` / `plan-task` / `code-task` / `review-*` / `commit` / …) | `#NN` → 完整 task id 查询,不分配。 |
|
|
21
|
+
| release | `complete-task`、`cancel-task`、`block-task`、`close-codescan`、`close-dependabot` | 从注册表移除;task.md 的 `short_id` 字段保留作为历史值。 |
|
|
22
|
+
| re-alloc | `restore-task` | 重新分配(可能与历史不同),写入注册表与 task.md。 |
|
|
23
|
+
|
|
24
|
+
短号仅在任务处于 `.agents/workspace/active/` 期间有效;任务移动到
|
|
25
|
+
`completed/` / `blocked/` / `archive/` 后短号立即释放,可被新任务复用。
|
|
26
|
+
|
|
27
|
+
## 配置
|
|
28
|
+
|
|
29
|
+
```jsonc
|
|
30
|
+
// .agents/.airc.json
|
|
31
|
+
{
|
|
32
|
+
"task": {
|
|
33
|
+
"shortIdLength": 2 // 默认;容量 = 99(#01–#99)。改为 3 时容量 = #001–#999。
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
当前位宽容量耗尽时,`alloc` 给出明确错误并建议「归档若干任务」或「调高
|
|
39
|
+
`task.shortIdLength`」两种修复路径;不静默扩位、不静默截断。
|
|
40
|
+
切换 `shortIdLength` 配置需要先归档所有 active 任务(注册表 key 宽度依赖配置)。
|
|
41
|
+
|
|
42
|
+
## `#NN` 解析作用域(按入口二分)
|
|
43
|
+
|
|
44
|
+
| 入口 | 注册表命中 | 注册表未命中 |
|
|
45
|
+
|-----------------------------------------------------------|----------------------|--------------------------------------------------------|
|
|
46
|
+
| SKILL 入参解析器(生命周期 SKILL) | 解析为完整 task id | **严格报错** —— 短号不存在 / 格式错误 |
|
|
47
|
+
| `ai sandbox enter '#NN'` / `ai sandbox exec '#NN' …` | 解析为完整 task id | 回退到 running sandbox 的 ls 行号语义(保留 #414 行为)|
|
|
48
|
+
|
|
49
|
+
`list --verify` 严格只读:报告 active 目录 / 注册表 / 各 task.md 的 `short_id`
|
|
50
|
+
三者差异,但不修改任何状态。
|
|
51
|
+
|
|
52
|
+
## SKILL 入参解析
|
|
53
|
+
|
|
54
|
+
任意 SKILL(含 alloc / resolve / release / re-alloc 四类生命周期入口)在收到
|
|
55
|
+
`{task-id}` 入参后,必须按以下契约处理:
|
|
56
|
+
|
|
57
|
+
1. 如果 `{task-id}` 字面以 `#` 开头:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
if [[ "{task-id}" == "#"* ]]; then
|
|
61
|
+
# 脚本本身已输出完整错误(含「expected #NN (N-digit zero-padded; e.g. '#01')」);
|
|
62
|
+
# 调用方只需透传退出码
|
|
63
|
+
task_id=$(node .agents/scripts/task-short-id.js resolve "{task-id}") || exit 1
|
|
64
|
+
else
|
|
65
|
+
task_id="{task-id}"
|
|
66
|
+
fi
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. 后续所有命令把 `{task-id}` 视为 `$task_id`(已是完整 `TASK-YYYYMMDD-HHMMSS` 形式)
|
|
70
|
+
3. 解析失败的退出码语义参见「错误场景」段;不要在 SKILL 中重写错误处理
|
|
71
|
+
|
|
72
|
+
## 存储位置
|
|
73
|
+
|
|
74
|
+
短号系统跨两处持久化状态,二者在稳态时一一对应:
|
|
75
|
+
|
|
76
|
+
| 位置 | 写入时机 | 读取时机 | 删除时机 |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| `.agents/workspace/active/.short-ids.json`(注册表) | `alloc` / 冷启动迁移 | `resolve` 唯一权威源 / `list` / `list --verify` | `release` / 冷启动 stale 清理 |
|
|
79
|
+
| 各 task.md frontmatter 的 `short_id` 字段 | `alloc` / 冷启动迁移 | `list --verify`(比对一致性) | **永不删除**(归档后保留为历史值) |
|
|
80
|
+
|
|
81
|
+
**注册表**:
|
|
82
|
+
|
|
83
|
+
- 路径:`<repo-root>/.agents/workspace/active/.short-ids.json`
|
|
84
|
+
- Schema:`{ "version": 1, "ids": { "01": "TASK-20260609-192644", "02": "TASK-…" } }`
|
|
85
|
+
- key 是零填充到 `task.shortIdLength` 位的字符串,value 是完整 `TASK-…` task id
|
|
86
|
+
- 自动 git ignore(active 工作区整体 ignore;无需新增 ignore 条目)
|
|
87
|
+
- 首次 `alloc` / `resolve` 时按需自动创建;不存在时按空注册表处理
|
|
88
|
+
|
|
89
|
+
**task.md `short_id` 字段**:
|
|
90
|
+
|
|
91
|
+
- 在 frontmatter 中、紧跟 `id` 字段之后;格式 `short_id: #01`
|
|
92
|
+
- 与注册表 key 字面一致(含 `#` 前缀)
|
|
93
|
+
- 归档(complete-task / cancel-task / block-task / close-*)后:注册表 entry 立即
|
|
94
|
+
删除(短号可被新任务复用),但 task.md `short_id` 字段保留作为历史值。解析器
|
|
95
|
+
只信任注册表
|
|
96
|
+
- 冷启动迁移:升级 agent-infra 后首次 alloc / resolve 路径会扫描所有 active
|
|
97
|
+
目录并为缺字段的 task.md 补发短号;补发受字段保护约束(不刷新
|
|
98
|
+
`updated_at` / `agent_infra_version`、不追加 Activity Log)
|
|
99
|
+
|
|
100
|
+
`resolve('#NN')` 工作流:① 校验入参严格匹配 `^#\d{shortIdLength}$` → ② 直接以
|
|
101
|
+
`NN` 作为 key 查注册表 `ids` → ③ 命中返回完整 task id,未命中按 `list --verify`
|
|
102
|
+
给出修复指引退出 1。
|
|
103
|
+
|
|
104
|
+
## 错误场景
|
|
105
|
+
|
|
106
|
+
- **短号不存在**:注册表中无 `#NN`。可能是任务已归档(短号已释放)或输入错误。
|
|
107
|
+
- **注册表损坏**(同一 taskId 出现多次或 JSON 无法解析):退出码 2,需人工处理。
|
|
108
|
+
- **参数格式错误**(如 `#00`、`#abc`、`#`、`#1` 当 `shortIdLength=2` 时):退出码 1。
|
|
109
|
+
|
|
110
|
+
## 跨 TUI 引号要求
|
|
111
|
+
|
|
112
|
+
bash 中 `#` 是注释起始符,必须单引号:`ai sandbox exec '#03' 'npm test'`。
|
|
113
|
+
Claude Code / Codex / Gemini CLI / OpenCode 在加引号时都能把 `#NN` 字面传递到
|
|
114
|
+
SKILL 的 `ARGUMENTS`。
|
|
115
|
+
|
|
116
|
+
## 冷启动迁移
|
|
117
|
+
|
|
118
|
+
升级 agent-infra 后,首次 `alloc` / `resolve` 调用会触发冷启动迁移:
|
|
119
|
+
|
|
120
|
+
- 所有 active task.md 缺 `short_id` 字段时自动补发并回写(仅修改 `short_id`
|
|
121
|
+
一行,不刷新 `updated_at` / `agent_infra_version`,不追加 Activity Log)。
|
|
122
|
+
- 若 active 任务总数超过 `shortIdLength` 容量,**在任何写入之前**报错退出 2。
|
|
123
|
+
- 若 task.md 写入中途失败,`tx.commit()` 按缓存的原内容回滚所有已写文件(含
|
|
124
|
+
`mtime` / `atime` 恢复)。
|
|
@@ -12,13 +12,13 @@ When a positive assertion already covers the expected behavior, do not add anoth
|
|
|
12
12
|
|
|
13
13
|
Bad:
|
|
14
14
|
```ts
|
|
15
|
-
assert.match(content, /^name:
|
|
15
|
+
assert.match(content, /^name: code-task$/m); // The positive assertion already covers the expected value.
|
|
16
16
|
assert.doesNotMatch(content, /^name: wrong-name$/m); // Redundant: permanently remembers a value that should not appear.
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Good:
|
|
20
20
|
```ts
|
|
21
|
-
assert.match(content, /^name:
|
|
21
|
+
assert.match(content, /^name: code-task$/m); // The positive assertion is enough.
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
If the positive assertion passes, the value is correct. The extra negative assertion adds no protection, only maintenance cost, and can become a test that permanently remembers a concept after the feature is gone.
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
|
|
13
13
|
❌ 反例:
|
|
14
14
|
```ts
|
|
15
|
-
assert.match(content, /^name:
|
|
15
|
+
assert.match(content, /^name: code-task$/m); // 正向已覆盖期望值
|
|
16
16
|
assert.doesNotMatch(content, /^name: wrong-name$/m); // 多余:永久记住一个不该出现的值
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
✅ 正例:
|
|
20
20
|
```ts
|
|
21
|
-
assert.match(content, /^name:
|
|
21
|
+
assert.match(content, /^name: code-task$/m); // 正向断言已足够
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
正向断言通过即证明值正确;额外的反向断言不增加保护,只增加维护成本,并会在功能删除后退化为"测试永久记住一个不再存在的概念"。
|