@danielstyle/featflow 0.0.0-stage → 0.6.4

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -2
  3. package/README.zh-CN.md +250 -0
  4. package/bin/featflow.mjs +116 -0
  5. package/package.json +63 -4
  6. package/skills/featflow/SKILL.md +127 -0
  7. package/skills/featflow-issues/SKILL.md +104 -0
  8. package/skills/featflow-regression/SKILL.md +63 -0
  9. package/src/agent-docs.mjs +143 -0
  10. package/src/changed-files.mjs +204 -0
  11. package/src/commands/cleanup.mjs +221 -0
  12. package/src/commands/codegraph.mjs +108 -0
  13. package/src/commands/doctor.mjs +303 -0
  14. package/src/commands/finish.mjs +249 -0
  15. package/src/commands/hook-cmd.mjs +78 -0
  16. package/src/commands/hooks-cmd.mjs +247 -0
  17. package/src/commands/init.mjs +477 -0
  18. package/src/commands/issue.mjs +434 -0
  19. package/src/commands/new.mjs +311 -0
  20. package/src/commands/plan-check.mjs +75 -0
  21. package/src/commands/policy-cmd.mjs +55 -0
  22. package/src/commands/pr-cleanup.mjs +194 -0
  23. package/src/commands/regression.mjs +206 -0
  24. package/src/commands/setup.mjs +343 -0
  25. package/src/commands/size-check.mjs +137 -0
  26. package/src/commands/skills.mjs +181 -0
  27. package/src/commands/status.mjs +100 -0
  28. package/src/commands/sync.mjs +421 -0
  29. package/src/commands/verify.mjs +206 -0
  30. package/src/commands/worktree.mjs +205 -0
  31. package/src/config.mjs +295 -0
  32. package/src/detect.mjs +314 -0
  33. package/src/git.mjs +331 -0
  34. package/src/hook-adapters.mjs +218 -0
  35. package/src/hooks-core.mjs +420 -0
  36. package/src/index.mjs +14 -0
  37. package/src/init-args.mjs +294 -0
  38. package/src/init-hooks.mjs +312 -0
  39. package/src/init-prompts.mjs +191 -0
  40. package/src/issues-helpers.mjs +463 -0
  41. package/src/issues.mjs +521 -0
  42. package/src/plan.mjs +202 -0
  43. package/src/policy.mjs +143 -0
  44. package/src/regression.mjs +338 -0
  45. package/src/size-check.mjs +203 -0
  46. package/src/skills-manager.mjs +348 -0
  47. package/src/tui-select.mjs +378 -0
  48. package/templates/adapters/antigravity/hooks.json +42 -0
  49. package/templates/adapters/claude-code/settings.json +46 -0
  50. package/templates/adapters/codex/config.toml +19 -0
  51. package/templates/adapters/cursor/hooks.json +27 -0
  52. package/templates/agents/codex/codebase-locator.toml +28 -0
  53. package/templates/agents/codex/implementation-scout.toml +28 -0
  54. package/templates/agents/codex/regression-guard-planner.toml +20 -0
  55. package/templates/features/README.md +56 -0
  56. package/templates/features/_program_template.md +79 -0
  57. package/templates/features/_template.md +120 -0
  58. package/templates/features/current-feature.md +18 -0
  59. package/templates/githooks/post-merge +10 -0
  60. package/templates/githooks/pre-commit +14 -0
  61. package/templates/githooks/pre-push +13 -0
  62. package/templates/regression/regression-ledger.yml +23 -0
  63. package/templates/snippets/AGENTS-workflow.md +21 -0
@@ -0,0 +1,79 @@
1
+ ---
2
+ id: YYYY-MM-DD-short-kebab-program
3
+ title: Short Program Title
4
+ status: planned
5
+ created: YYYY-MM-DDTHH:MM:SSZ
6
+ updated: YYYY-MM-DDTHH:MM:SSZ
7
+ owner: GIT_USER_NAME
8
+ primary_surfaces: []
9
+ current_phase:
10
+ ---
11
+
12
+ # Program Brief
13
+
14
+ ## Intent
15
+
16
+ Replace with the long-running outcome this multi-phase program delivers.
17
+
18
+ ## Why A Program
19
+
20
+ Explain why this initiative spans multiple feature records, branches, pull requests, repositories, or releases.
21
+
22
+ ## Scope
23
+
24
+ - Replace with the systems, modules, or repositories covered.
25
+ - Include operational, security, documentation, or migration scope when relevant.
26
+
27
+ ## Non-goals
28
+
29
+ - Replace with work intentionally out of scope for this program.
30
+
31
+ # Operating Model
32
+
33
+ - This program record is the canonical cross-phase roadmap and decision log.
34
+ - Each implementation phase still requires its own feature record under `features/active/` (and later `features/done/`).
35
+ - Before starting or resuming a phase, read this program record and the latest linked phase record.
36
+ - Update this record whenever a phase starts, pauses, blocks, reaches review, finishes, or changes scope.
37
+ - Never store secrets, credentials, or sensitive user data here.
38
+
39
+ # Phase Index
40
+
41
+ | Phase | Status | Feature Record | Branch / PR | Goal | Exit Criteria |
42
+ | --- | --- | --- | --- | --- | --- |
43
+ | 0 | planned | `features/active/YYYY-MM-DD-HHMM-short-kebab-title.md` | `prefix/short-kebab-title` | Replace with phase goal. | Replace with observable exit criteria. |
44
+
45
+ # Cross-Phase Architecture
46
+
47
+ ## Target Shape
48
+
49
+ - Replace with the target end-state architecture.
50
+
51
+ ## Integration Contracts
52
+
53
+ - Replace with cross-phase API, schema, CLI, or compatibility contracts.
54
+
55
+ ## Migration Strategy
56
+
57
+ - Replace with rollout, coexistence, fallback, and deprecation strategy.
58
+
59
+ # Decisions
60
+
61
+ - Decision: Replace with long-lived choices that later phases must preserve.
62
+
63
+ # Risks And Watchpoints
64
+
65
+ - Replace with cross-phase risks, security watchpoints, or open uncertainties.
66
+
67
+ # Verification Strategy
68
+
69
+ - Replace with verification gates repeated or expanded across phases.
70
+
71
+ # Resume Notes
72
+
73
+ - Next recommended phase: replace with the next concrete phase to start or resume.
74
+ - Required context before resuming: replace with records, docs, branches, or external repos to inspect.
75
+ - Blockers: `None` or concrete blocker.
76
+
77
+ # History
78
+
79
+ - YYYY-MM-DD HH:MM: Program record created.
@@ -0,0 +1,120 @@
1
+ ---
2
+ id: YYYY-MM-DD-HHMM-short-kebab-title
3
+ title: Short Feature Title
4
+ status: planned
5
+ surfaces: []
6
+ branch: prefix/short-kebab-title
7
+ created: YYYY-MM-DDTHH:MM:SSZ
8
+ updated: YYYY-MM-DDTHH:MM:SSZ
9
+ owner: GIT_USER_NAME
10
+ ---
11
+
12
+ # Feature Brief
13
+
14
+ ## Intent
15
+
16
+ Replace with the problem this feature solves and the outcome users or maintainers should observe.
17
+
18
+ ## Scope
19
+
20
+ - Replace with what will change.
21
+ - Which surfaces/modules are affected.
22
+ - What must be true before handoff.
23
+
24
+ ## Non-goals
25
+
26
+ - Replace with what is intentionally out of scope.
27
+
28
+ # Plan Details
29
+
30
+ Replace every placeholder below before editing product code. Never leave empty headings or generic placeholder text in an active feature record. If a section does not apply, write `None - <reason>`. If a detail is unknown but non-blocking, write `Unknown - <how it will be discovered>` and track it in `Open Questions`.
31
+
32
+ ## Branch Plan
33
+
34
+ - Workflow mode: `trunk | developer-branch`
35
+ - Base branch: Replace with configured base or developer branch
36
+ - Work type: `feature | fix | chore | docs | test | refactor | perf | security`
37
+ - Selected prefix: `prefix/`
38
+ - Tracked branch: `prefix/short-kebab-title`
39
+ - Worktree path: Replace with worktree path or explicit no-worktree exception
40
+ - Completion strategy: Replace with `featflow finish <branch>` (merge or PR + `featflow pr-cleanup`)
41
+
42
+ ## Pre-Implementation Approval
43
+
44
+ - Approval status: `pending | approved | skipped-by-user`
45
+ - Approval source: Replace with the user message or explicit skip-confirmation instruction.
46
+ - Approved constraints: Replace with scope, behavior, verification, or non-goal constraints confirmed by the user.
47
+ - If implementation uncovers a materially different root cause, scope, security boundary, or risk profile, pause and request approval for an updated plan.
48
+
49
+ ## Requirements
50
+
51
+ - Replace with user needs and functional requirements.
52
+ - Include compatibility, security, and edge-case constraints.
53
+
54
+ ## Acceptance Criteria
55
+
56
+ - Replace with observable conditions that define done.
57
+
58
+ ## Technical Approach
59
+
60
+ - Replace with implementation strategy grounded in inspected repository files.
61
+ - Call out architecture boundaries, existing patterns, and key tradeoffs.
62
+
63
+ ## Implementation Plan
64
+
65
+ - [ ] Complete read-only discovery and present a concrete plan to the user.
66
+ - [ ] Record explicit user approval (or skip-confirmation instruction).
67
+ - [ ] Create or switch to the typed task branch worktree.
68
+ - [ ] Replace with concrete implementation step(s).
69
+ - [ ] Replace with concrete verification step(s).
70
+ - [ ] Update `Verification`, `Changed Files`, and `Handoff`, then move this record to `features/done/`.
71
+ - [ ] Commit all changes on the task branch and run `featflow finish <tracked-branch>`.
72
+
73
+ ## Affected Files / Modules
74
+
75
+ - Replace with inspected files, packages, APIs, components, or docs expected to change.
76
+
77
+ ## Data / API / Contract Changes
78
+
79
+ - Note schema, migration, API, CLI, event, or config contract changes.
80
+ - Write `None - <reason>` if no contracts change.
81
+
82
+ ## UX / Behavior Changes
83
+
84
+ - Describe user-visible or operational behavior changes.
85
+ - Write `None - <reason>` if none apply.
86
+
87
+ ## Test Plan
88
+
89
+ - [ ] Focused unit/integration tests for touched behavior.
90
+ - [ ] Regression test or guard (required for bug fixes unless documented why impractical).
91
+ - [ ] Repository lint / typecheck / build checks as appropriate.
92
+
93
+ ## Risks
94
+
95
+ - Replace with implementation risks, potential regressions, migration hazards, or ambiguities.
96
+
97
+ ## Open Questions
98
+
99
+ - Replace with unresolved questions, or write `None`.
100
+
101
+ # Execution Log
102
+
103
+ - YYYY-MM-DD HH:MM: Started planning.
104
+
105
+ # Decisions
106
+
107
+ - Decision: Explain key tradeoffs, contracts, or architecture choices.
108
+
109
+ # Changed Files
110
+
111
+ - `path/to/file`
112
+
113
+ # Verification
114
+
115
+ - [ ] Command or manual check run.
116
+ - [ ] Skipped check with reason.
117
+
118
+ # Handoff
119
+
120
+ Summarize completion state, skipped checks, residual risks, and useful follow-up context.
@@ -0,0 +1,18 @@
1
+ ---
2
+ status: none
3
+ updated: YYYY-MM-DDTHH:MM:SSZ
4
+ active_feature:
5
+ last_completed:
6
+ ---
7
+
8
+ # Current Feature
9
+
10
+ None.
11
+
12
+ # Next Step
13
+
14
+ - Start a new feature record when beginning the next tracked task.
15
+
16
+ # Blockers
17
+
18
+ - None.
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env sh
2
+
3
+ _ff_common_dir="$(git rev-parse --git-common-dir 2>/dev/null || true)"
4
+ if [ -x "./node_modules/.bin/featflow" ]; then
5
+ ./node_modules/.bin/featflow cleanup --post-merge || true
6
+ elif [ -n "$_ff_common_dir" ] && [ -x "$_ff_common_dir/../node_modules/.bin/featflow" ]; then
7
+ "$_ff_common_dir/../node_modules/.bin/featflow" cleanup --post-merge || true
8
+ elif command -v featflow >/dev/null 2>&1; then
9
+ featflow cleanup --post-merge || true
10
+ fi
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env sh
2
+ set -e
3
+
4
+ _ff_common_dir="$(git rev-parse --git-common-dir 2>/dev/null || true)"
5
+ if [ -x "./node_modules/.bin/featflow" ]; then
6
+ exec ./node_modules/.bin/featflow policy pre-commit
7
+ elif [ -n "$_ff_common_dir" ] && [ -x "$_ff_common_dir/../node_modules/.bin/featflow" ]; then
8
+ exec "$_ff_common_dir/../node_modules/.bin/featflow" policy pre-commit
9
+ elif command -v featflow >/dev/null 2>&1; then
10
+ exec featflow policy pre-commit
11
+ else
12
+ echo "featflow: CLI not found in ./node_modules/.bin or PATH; skipping pre-commit check." >&2
13
+ echo "Install with \`npm install -g @danielstyle/featflow\` or set FEATFLOW_BOOTSTRAP=1 to silence this notice." >&2
14
+ fi
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env sh
2
+ set -e
3
+
4
+ _ff_common_dir="$(git rev-parse --git-common-dir 2>/dev/null || true)"
5
+ if [ -x "./node_modules/.bin/featflow" ]; then
6
+ exec ./node_modules/.bin/featflow policy pre-push
7
+ elif [ -n "$_ff_common_dir" ] && [ -x "$_ff_common_dir/../node_modules/.bin/featflow" ]; then
8
+ exec "$_ff_common_dir/../node_modules/.bin/featflow" policy pre-push
9
+ elif command -v featflow >/dev/null 2>&1; then
10
+ exec featflow policy pre-push
11
+ else
12
+ echo "featflow: CLI not found in ./node_modules/.bin or PATH; skipping pre-push check." >&2
13
+ fi
@@ -0,0 +1,23 @@
1
+ # Regression Memory Ledger (managed by featflow)
2
+ #
3
+ # Record durable bug invariants, affected file paths/globs, and regression guard
4
+ # tests here so future changes automatically run impacted guards via:
5
+ # featflow regression impact
6
+ # featflow regression check
7
+ # featflow regression validate --strict
8
+ #
9
+ # Example entry (uncomment and customize when adding your first bug guard):
10
+ # - id: example-regression-id
11
+ # title: Short summary of the bug class that must not recur
12
+ # status: guarded
13
+ # surfaces: [core]
14
+ # symptom: What broke from the user's perspective.
15
+ # root_cause: Why the failure happened.
16
+ # invariant: The behavioral invariant that must always hold.
17
+ # files:
18
+ # - src/example.ts
19
+ # guards:
20
+ # - tests/example.test.ts
21
+ # commands:
22
+ # - npm test
23
+ # owner_notes: Extra context for future refactors.
@@ -0,0 +1,21 @@
1
+ ## Development Workflow (featflow)
2
+
3
+ ### Universal Pre-Implementation Gate
4
+
5
+ - For any write-oriented work (`feat/`, `fix/`, `chore/`, `docs/`, `test/`, `refactor/`, `perf/`, `security/`), complete **read-only discovery** first, present a concrete implementation plan, and **wait for explicit user approval** before creating a worktree, editing tracked files, committing, pushing, or opening PRs.
6
+ - The user can opt out with explicit language (e.g., "implement directly", "no confirmation needed"); record that exception in the feature record or handoff.
7
+ - Purely read-only questions, code reviews, status checks, and plan-only requests do not require approval.
8
+ - If implementation uncovers a materially different root cause, scope, security boundary, or risk profile, pause and request approval for an updated plan before continuing.
9
+
10
+ ### Branch & Worktree Isolation
11
+
12
+ - Do not edit tracked files directly on protected branches (`main`, `dev`, or your configured developer branch) unless explicitly requested.
13
+ - Check workflow status with `featflow status` (in `developer-branch` mode, run `featflow setup <branch>` once per checkout).
14
+ - Create a dedicated worktree per task with `featflow worktree <prefix>/<task-name>` and finish with `featflow finish <branch>`.
15
+
16
+ ### Feature Planning Workflow
17
+
18
+ - For substantial features, cross-module changes, long-running tasks, or multi-phase initiatives, read and follow the `featflow` skill (installed globally via `featflow skills install` or in `.agents/skills/featflow/SKILL.md`).
19
+ - Draft complete `Feature Brief` and `Plan Details` (including `Pre-Implementation Approval`) via `featflow new <short-kebab-title>` (or `featflow new <short-kebab-title> --local` when feature records are not tracked in Git) before editing product code, and verify with `featflow plan-check`.
20
+ - Move completed records to `done/` before committing and running `featflow finish <branch>`.
21
+ - Tiny one-off edits do not require a feature record, but still follow the Universal Pre-Implementation Gate and dedicated task worktree flow.