您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

step-01-orientation.md 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Step 1: Orientation
  2. Display: `[Orientation] → Walkthrough → Detail Pass → Testing`
  3. ## Follow Global Step Rules in SKILL.md
  4. ## FIND THE CHANGE
  5. The conversation context before this skill was triggered IS your starting point — not a blank slate. Check in this order — stop as soon as the change is identified:
  6. 1. **Explicit argument**
  7. Did the user pass a PR, commit SHA, branch, or spec file this message?
  8. - PR reference → resolve to branch/commit via `gh pr view`. If resolution fails, ask for a SHA or branch.
  9. - Spec file, commit, or branch → use directly.
  10. 2. **Recent conversation**
  11. Do the last few messages reveal what change the user wants reviewed? Look for spec paths, commit refs, branches, PRs, or descriptions of a change. Use the same routing as above.
  12. 3. **Sprint tracking**
  13. Check for a sprint status file (`*sprint-status*`) in `{implementation_artifacts}` or `{planning_artifacts}`. If found, scan for stories with status `review`:
  14. - Exactly one → suggest it and confirm with the user.
  15. - Multiple → present as numbered options.
  16. - None → fall through.
  17. 4. **Current git state**
  18. Check current branch and HEAD. Confirm: "I see HEAD is `<short-sha>` on `<branch>` — is this the change you want to review?"
  19. 5. **Ask**
  20. If none of the above identified a change, ask:
  21. - What changed and why?
  22. - Which commit, branch, or PR should I look at?
  23. - Do you have a spec, bug report, or anything else that explains what this change is supposed to do?
  24. If after 3 exchanges you still can't identify a change, HALT.
  25. Never ask extra questions beyond what the cascade prescribes. If a step above already identified the change, skip the remaining steps.
  26. ## ENRICH
  27. Once a change is identified from any source above, fill in the complementary artifact:
  28. - If you have a spec, look for `baseline_commit` in its frontmatter to determine the diff baseline.
  29. - If you have a commit or branch, check `{implementation_artifacts}` for a spec whose `baseline_commit` is an ancestor of that commit/branch (i.e., the spec describes work done on top of that baseline).
  30. - If you found both a spec and a commit/branch, use both.
  31. ## DETERMINE WHAT YOU HAVE
  32. Set `change_type` to match how the user referred to the change — `PR`, `commit`, `branch`, or their own words (e.g. `auth refactor`). Default to `change` if ambiguous.
  33. Set `review_mode` — pick the first match:
  34. 1. **`full-trail`** — ENRICH found a spec with a `## Suggested Review Order` section. Intent source: spec's Intent section.
  35. 2. **`spec-only`** — ENRICH found a spec but it has no Suggested Review Order. Intent source: spec's Intent section.
  36. 3. **`bare-commit`** — no spec found. Intent source: commit message. If the commit message is terse (under 10 words), scan the diff for the primary change pattern and draft a one-sentence intent. Flag it as `[inferred]` in the output so the user can correct it.
  37. ## PRODUCE ORIENTATION
  38. ### Intent Summary
  39. - If intent comes from a spec's Intent section, display it verbatim regardless of length — it's already written to be concise.
  40. - For other sources (commit messages, bug reports, user description): if ≤200 tokens, display verbatim. If longer, distill to ≤200 tokens. Link to the full source when one exists (e.g. a file path or URL).
  41. - Format: `> **Intent:** {summary}`
  42. ### Surface Area Stats
  43. Best-effort stats derived from the diff. Try these baselines in order:
  44. 1. `baseline_commit` from the spec's frontmatter.
  45. 2. Branch merge-base against `main` (or the default branch).
  46. 3. `HEAD~1..HEAD` (latest commit only — tell the user).
  47. 4. If git is unavailable or all of the above fail, skip stats and note: "Could not compute stats."
  48. Use `git diff --stat` and `git diff --numstat` for file-level counts, and scan the full diff content for the richer metrics.
  49. Display as:
  50. ```
  51. N files changed · M modules touched · ~L lines of logic · B boundary crossings · P new public interfaces
  52. ```
  53. - **Files changed**: count from `git diff --stat`.
  54. - **Modules touched**: distinct top-level directories with changes (from `--stat` file paths).
  55. - **Lines of logic**: added/modified lines excluding blanks, imports, formatting. Scan diff content; `~` because approximate.
  56. - **Boundary crossings**: changes spanning more than one top-level module. `0` if single module.
  57. - **New public interfaces**: new exports, endpoints, public methods found in the diff. `0` if none.
  58. Omit any metric you cannot compute rather than guessing.
  59. ### Present
  60. ```
  61. [Orientation] → Walkthrough → Detail Pass → Testing
  62. > **Intent:** {intent_summary}
  63. {stats line}
  64. ```
  65. ## FALLBACK TRAIL GENERATION
  66. If review mode is not `full-trail`, read fully and follow `./generate-trail.md` to build one from the diff. Then return here and continue to NEXT. If trail generation fails (e.g., git unavailable), the original review mode is preserved — step-02 handles this with its non-trail path.
  67. ## NEXT
  68. Read fully and follow `./step-02-walkthrough.md`