@urielsh/prodify 0.1.0
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/.prodify/AGENTS.md +56 -0
- package/.prodify/README.md +10 -0
- package/.prodify/artifacts/01-understand.md +28 -0
- package/.prodify/artifacts/02-diagnose.md +26 -0
- package/.prodify/artifacts/03-architecture.md +30 -0
- package/.prodify/artifacts/04-plan.md +35 -0
- package/.prodify/artifacts/05-refactor.md +24 -0
- package/.prodify/artifacts/06-validate.md +17 -0
- package/.prodify/artifacts/README.md +6 -0
- package/.prodify/artifacts/architecture_spec.md +29 -0
- package/.prodify/artifacts/artifact-validation-design.md +276 -0
- package/.prodify/artifacts/cli-command-design.md +299 -0
- package/.prodify/artifacts/completed-steps-tracking.md +201 -0
- package/.prodify/artifacts/diagnostic_report.md +45 -0
- package/.prodify/artifacts/hardening-patch-summary.md +57 -0
- package/.prodify/artifacts/hardening-verification-report.md +48 -0
- package/.prodify/artifacts/implementation_summary.md +19 -0
- package/.prodify/artifacts/improvement-evaluation-spec.md +148 -0
- package/.prodify/artifacts/next-step-resolver-design.md +570 -0
- package/.prodify/artifacts/orientation_map.md +32 -0
- package/.prodify/artifacts/persona-removal-audit.md +106 -0
- package/.prodify/artifacts/planning-alignment-report.md +189 -0
- package/.prodify/artifacts/refactor-plan-template-hardening.md +83 -0
- package/.prodify/artifacts/refactor-validate-loop-design.md +231 -0
- package/.prodify/artifacts/refactor_plan.md +21 -0
- package/.prodify/artifacts/refactor_plan.strict-example.md +31 -0
- package/.prodify/artifacts/run-state-design.md +292 -0
- package/.prodify/artifacts/run-summary-spec.md +149 -0
- package/.prodify/artifacts/run_state.json +14 -0
- package/.prodify/artifacts/sample-repo-test-plan.md +129 -0
- package/.prodify/artifacts/status-output-spec.md +349 -0
- package/.prodify/artifacts/step-selection-design.md +251 -0
- package/.prodify/artifacts/task-dispatcher-design.md +266 -0
- package/.prodify/artifacts/task-header-audit.md +42 -0
- package/.prodify/artifacts/task-log-enhancement-spec.md +264 -0
- package/.prodify/artifacts/task-protocol-hardening-plan.md +68 -0
- package/.prodify/artifacts/task-self-validation-spec.md +171 -0
- package/.prodify/artifacts/task_log.json +160 -0
- package/.prodify/artifacts/template-usage-audit.md +20 -0
- package/.prodify/artifacts/validation_report.md +22 -0
- package/.prodify/contracts/README.md +3 -0
- package/.prodify/contracts/architecture.contract.json +42 -0
- package/.prodify/contracts/diagnose.contract.json +42 -0
- package/.prodify/contracts/plan.contract.json +42 -0
- package/.prodify/contracts/refactor.contract.json +45 -0
- package/.prodify/contracts/understand.contract.json +42 -0
- package/.prodify/contracts/validate.contract.json +52 -0
- package/.prodify/contracts-src/README.md +4 -0
- package/.prodify/contracts-src/architecture.contract.md +29 -0
- package/.prodify/contracts-src/diagnose.contract.md +29 -0
- package/.prodify/contracts-src/plan.contract.md +29 -0
- package/.prodify/contracts-src/refactor.contract.md +32 -0
- package/.prodify/contracts-src/understand.contract.md +29 -0
- package/.prodify/contracts-src/validate.contract.md +35 -0
- package/.prodify/metrics/README.md +4 -0
- package/.prodify/planning.md +13 -0
- package/.prodify/project.md +15 -0
- package/.prodify/rules/01-global-operating-rules.md +21 -0
- package/.prodify/rules/02-analysis-discipline.md +17 -0
- package/.prodify/rules/03-diagnosis-severity-rules.md +42 -0
- package/.prodify/rules/04-architecture-rules.md +27 -0
- package/.prodify/rules/05-planning-rules.md +23 -0
- package/.prodify/rules/06-refactor-rules.md +20 -0
- package/.prodify/rules/07-validation-rules.md +25 -0
- package/.prodify/rules/08-output-format-rules.md +20 -0
- package/.prodify/rules/09-template-usage-rules.md +11 -0
- package/.prodify/rules/10-artifact-flow-and-orchestration-rules.md +40 -0
- package/.prodify/rules/README.md +3 -0
- package/.prodify/rules/example-rule.md +4 -0
- package/.prodify/runtime-commands.md +57 -0
- package/.prodify/skills/README.md +8 -0
- package/.prodify/skills/domain/react-frontend.skill.json +34 -0
- package/.prodify/skills/domain/typescript-backend.skill.json +34 -0
- package/.prodify/skills/quality-policy/maintainability-review.skill.json +25 -0
- package/.prodify/skills/quality-policy/security-hardening.skill.json +32 -0
- package/.prodify/skills/quality-policy/test-hardening.skill.json +23 -0
- package/.prodify/skills/registry.json +16 -0
- package/.prodify/skills/stage-method/architecture-method.skill.json +22 -0
- package/.prodify/skills/stage-method/codebase-scanning.skill.json +22 -0
- package/.prodify/skills/stage-method/diagnosis-method.skill.json +22 -0
- package/.prodify/skills/stage-method/planning-method.skill.json +22 -0
- package/.prodify/skills/stage-method/refactoring-method.skill.json +22 -0
- package/.prodify/skills/stage-method/validation-method.skill.json +22 -0
- package/.prodify/state.json +30 -0
- package/.prodify/tasks/01-understand.md +83 -0
- package/.prodify/tasks/02-diagnose.md +67 -0
- package/.prodify/tasks/03-architecture.md +70 -0
- package/.prodify/tasks/04-plan.md +71 -0
- package/.prodify/tasks/05-refactor.md +61 -0
- package/.prodify/tasks/06-validate.md +69 -0
- package/.prodify/tasks/README.md +3 -0
- package/.prodify/tasks/example-task.md +13 -0
- package/.prodify/templates/01-understand.template.md +18 -0
- package/.prodify/templates/02-diagnose.template.md +18 -0
- package/.prodify/templates/03-architecture.template.md +18 -0
- package/.prodify/templates/04-plan.template.md +22 -0
- package/.prodify/templates/05-refactor.template.md +19 -0
- package/.prodify/templates/06-validate.template.md +16 -0
- package/.prodify/templates/README.md +3 -0
- package/.prodify/templates/architecture_spec.template.md +29 -0
- package/.prodify/templates/diagnostic_report.template.md +45 -0
- package/.prodify/templates/example.template.md +5 -0
- package/.prodify/templates/implementation_summary.template.md +19 -0
- package/.prodify/templates/orientation_map.template.md +32 -0
- package/.prodify/templates/refactor_plan.template.md +24 -0
- package/.prodify/templates/validation_report.template.md +22 -0
- package/.prodify/version.json +5 -0
- package/AGENTS.md +305 -0
- package/LICENSE +201 -0
- package/README.md +118 -0
- package/assets/presets/default/canonical/AGENTS.md +54 -0
- package/assets/presets/default/canonical/artifacts/README.md +6 -0
- package/assets/presets/default/canonical/contracts-src/README.md +4 -0
- package/assets/presets/default/canonical/contracts-src/architecture.contract.md +56 -0
- package/assets/presets/default/canonical/contracts-src/diagnose.contract.md +49 -0
- package/assets/presets/default/canonical/contracts-src/plan.contract.md +42 -0
- package/assets/presets/default/canonical/contracts-src/refactor.contract.md +54 -0
- package/assets/presets/default/canonical/contracts-src/understand.contract.md +56 -0
- package/assets/presets/default/canonical/contracts-src/validate.contract.md +64 -0
- package/assets/presets/default/canonical/metrics/README.md +4 -0
- package/assets/presets/default/canonical/planning.md +13 -0
- package/assets/presets/default/canonical/project.md +15 -0
- package/assets/presets/default/canonical/rules/README.md +3 -0
- package/assets/presets/default/canonical/rules/example-rule.md +4 -0
- package/assets/presets/default/canonical/runtime-commands.md +57 -0
- package/assets/presets/default/canonical/skills/README.md +8 -0
- package/assets/presets/default/canonical/skills/domain/react-frontend.skill.json +34 -0
- package/assets/presets/default/canonical/skills/domain/typescript-backend.skill.json +34 -0
- package/assets/presets/default/canonical/skills/quality-policy/maintainability-review.skill.json +25 -0
- package/assets/presets/default/canonical/skills/quality-policy/security-hardening.skill.json +32 -0
- package/assets/presets/default/canonical/skills/quality-policy/test-hardening.skill.json +23 -0
- package/assets/presets/default/canonical/skills/registry.json +16 -0
- package/assets/presets/default/canonical/skills/stage-method/architecture-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/codebase-scanning.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/diagnosis-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/planning-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/refactoring-method.skill.json +22 -0
- package/assets/presets/default/canonical/skills/stage-method/validation-method.skill.json +22 -0
- package/assets/presets/default/canonical/state.json +30 -0
- package/assets/presets/default/canonical/tasks/README.md +3 -0
- package/assets/presets/default/canonical/tasks/example-task.md +13 -0
- package/assets/presets/default/canonical/templates/README.md +3 -0
- package/assets/presets/default/canonical/templates/example.template.md +5 -0
- package/assets/presets/default/preset.json +5 -0
- package/dist/cli.js +53 -0
- package/dist/commands/doctor.js +16 -0
- package/dist/commands/init.js +30 -0
- package/dist/commands/install.js +27 -0
- package/dist/commands/setup-agent.js +23 -0
- package/dist/commands/status.js +28 -0
- package/dist/commands/sync.js +29 -0
- package/dist/commands/update.js +18 -0
- package/dist/contracts/compiled-schema.js +37 -0
- package/dist/contracts/compiler.js +83 -0
- package/dist/contracts/freshness.js +52 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/parser.js +201 -0
- package/dist/contracts/schema.js +138 -0
- package/dist/contracts/source-schema.js +111 -0
- package/dist/core/agent-runtime.js +36 -0
- package/dist/core/agent-setup.js +111 -0
- package/dist/core/doctor.js +155 -0
- package/dist/core/errors.js +19 -0
- package/dist/core/flow-state.js +262 -0
- package/dist/core/fs.js +50 -0
- package/dist/core/install.js +44 -0
- package/dist/core/managed-files.js +106 -0
- package/dist/core/paths.js +56 -0
- package/dist/core/preset-validation.js +43 -0
- package/dist/core/prompt-builder.js +63 -0
- package/dist/core/repo-context.js +77 -0
- package/dist/core/repo-root.js +55 -0
- package/dist/core/skill-resolution.js +123 -0
- package/dist/core/state.js +220 -0
- package/dist/core/status.js +293 -0
- package/dist/core/sync.js +63 -0
- package/dist/core/targets.js +48 -0
- package/dist/core/upgrade.js +57 -0
- package/dist/core/validation.js +138 -0
- package/dist/core/version-checks.js +35 -0
- package/dist/generators/claude.js +14 -0
- package/dist/generators/codex.js +14 -0
- package/dist/generators/copilot.js +29 -0
- package/dist/generators/header.js +13 -0
- package/dist/generators/opencode.js +14 -0
- package/dist/generators/shared.js +37 -0
- package/dist/index.js +9 -0
- package/dist/legacy/targets.js +55 -0
- package/dist/presets/default.js +3 -0
- package/dist/presets/loader.js +34 -0
- package/dist/presets/version.js +18 -0
- package/dist/scoring/model.js +262 -0
- package/dist/skills/loader.js +40 -0
- package/dist/skills/schema.js +159 -0
- package/dist/types.js +1 -0
- package/docs/canonical-prodify-layout.md +87 -0
- package/docs/claude-support.md +22 -0
- package/docs/cli-doctor-spec.md +52 -0
- package/docs/cli-init-spec.md +70 -0
- package/docs/cli-install-agent-spec.md +48 -0
- package/docs/cli-sync-spec.md +40 -0
- package/docs/codex-support.md +24 -0
- package/docs/compatibility-targets.md +59 -0
- package/docs/copilot-support.md +30 -0
- package/docs/default-preset.md +47 -0
- package/docs/generated-file-headers.md +45 -0
- package/docs/generation-rules.md +94 -0
- package/docs/idempotency-guarantees.md +31 -0
- package/docs/managed-file-detection.md +45 -0
- package/docs/manual-edit-conflicts.md +37 -0
- package/docs/opencode-support.md +27 -0
- package/docs/ownership-rules.md +39 -0
- package/docs/path-resolution-rules.md +40 -0
- package/docs/preset-structure.md +49 -0
- package/docs/skill-system.md +67 -0
- package/docs/versioning-and-upgrade-strategy.md +40 -0
- package/package.json +22 -0
- package/src/README.md +11 -0
- package/src/cli.ts +61 -0
- package/src/commands/doctor.ts +20 -0
- package/src/commands/init.ts +37 -0
- package/src/commands/setup-agent.ts +28 -0
- package/src/commands/status.ts +34 -0
- package/src/commands/update.ts +23 -0
- package/src/contracts/README.md +10 -0
- package/src/contracts/compiled-schema.ts +42 -0
- package/src/contracts/compiler.ts +111 -0
- package/src/contracts/freshness.ts +58 -0
- package/src/contracts/index.ts +11 -0
- package/src/contracts/parser.ts +253 -0
- package/src/contracts/source-schema.ts +141 -0
- package/src/core/agent-runtime.ts +53 -0
- package/src/core/agent-setup.ts +147 -0
- package/src/core/doctor.ts +171 -0
- package/src/core/errors.ts +28 -0
- package/src/core/flow-state.ts +333 -0
- package/src/core/fs.ts +59 -0
- package/src/core/paths.ts +63 -0
- package/src/core/preset-validation.ts +47 -0
- package/src/core/prompt-builder.ts +73 -0
- package/src/core/repo-context.ts +93 -0
- package/src/core/repo-root.ts +74 -0
- package/src/core/skill-resolution.ts +151 -0
- package/src/core/state.ts +264 -0
- package/src/core/status.ts +372 -0
- package/src/core/targets.ts +53 -0
- package/src/core/upgrade.ts +66 -0
- package/src/core/validation.ts +233 -0
- package/src/core/version-checks.ts +40 -0
- package/src/index.ts +13 -0
- package/src/presets/default.ts +7 -0
- package/src/presets/loader.ts +46 -0
- package/src/presets/version.ts +31 -0
- package/src/scoring/model.ts +332 -0
- package/src/skills/loader.ts +58 -0
- package/src/skills/schema.ts +197 -0
- package/src/types.ts +329 -0
- package/tests/integration/cli-flows.test.js +347 -0
- package/tests/unit/agent-setup.test.js +81 -0
- package/tests/unit/cli.test.js +28 -0
- package/tests/unit/contracts.test.js +61 -0
- package/tests/unit/helpers.js +28 -0
- package/tests/unit/paths.test.js +52 -0
- package/tests/unit/preset-loader.test.js +37 -0
- package/tests/unit/scoring.test.js +65 -0
- package/tests/unit/self-hosted-workspace.test.js +22 -0
- package/tests/unit/skills.test.js +115 -0
- package/tests/unit/state-and-flow.test.js +120 -0
- package/tests/unit/targets.test.js +13 -0
- package/tests/unit/validation.test.js +73 -0
- package/tests/unit/version.test.js +24 -0
- package/tsconfig.json +23 -0
- package/urielsh-prodify-0.1.0.tgz +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# Status Output Spec
|
|
2
|
+
|
|
3
|
+
Date: 2026-03-29
|
|
4
|
+
Scope: `./.prodify/`
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Define a concise human-readable status view for Prodify.
|
|
9
|
+
|
|
10
|
+
The status view is intended for:
|
|
11
|
+
|
|
12
|
+
- CLI output from `prodify status`
|
|
13
|
+
- quick operator inspection
|
|
14
|
+
- agent-readable summaries that do not require opening raw JSON artifacts
|
|
15
|
+
|
|
16
|
+
The status view must summarize the current run without executing work or mutating state.
|
|
17
|
+
|
|
18
|
+
## Fields Shown
|
|
19
|
+
|
|
20
|
+
The status view should show these fields in this order:
|
|
21
|
+
|
|
22
|
+
1. `Status`
|
|
23
|
+
2. `Current task`
|
|
24
|
+
3. `Next task`
|
|
25
|
+
4. `Current phase`
|
|
26
|
+
5. `Last completed task`
|
|
27
|
+
6. `Completed tasks`
|
|
28
|
+
7. `Pending tasks`
|
|
29
|
+
8. `Selected refactor step`
|
|
30
|
+
9. `Latest validation`
|
|
31
|
+
10. `Note`
|
|
32
|
+
|
|
33
|
+
## Field Definitions
|
|
34
|
+
|
|
35
|
+
### Status
|
|
36
|
+
Source:
|
|
37
|
+
- `run_state.json.status`
|
|
38
|
+
|
|
39
|
+
Meaning:
|
|
40
|
+
- the top-level runtime condition
|
|
41
|
+
|
|
42
|
+
Examples:
|
|
43
|
+
- `ready`
|
|
44
|
+
- `running`
|
|
45
|
+
- `awaiting_validation`
|
|
46
|
+
- `blocked`
|
|
47
|
+
- `failed`
|
|
48
|
+
- `complete`
|
|
49
|
+
|
|
50
|
+
### Current Task
|
|
51
|
+
Source:
|
|
52
|
+
- `run_state.json.current_task`
|
|
53
|
+
|
|
54
|
+
Display rule:
|
|
55
|
+
- show the active task if non-null
|
|
56
|
+
- otherwise show `none`
|
|
57
|
+
|
|
58
|
+
### Next Task
|
|
59
|
+
Source:
|
|
60
|
+
- `run_state.json.next_task`
|
|
61
|
+
- optionally confirmed by the resolver when status output is enriched by resolver logic
|
|
62
|
+
|
|
63
|
+
Display rule:
|
|
64
|
+
- show the next deterministic task when available
|
|
65
|
+
- show `none` for terminal completion
|
|
66
|
+
- show `blocked` or `unavailable` when state is incomplete and no trustworthy next task can be shown
|
|
67
|
+
|
|
68
|
+
### Current Phase
|
|
69
|
+
Derived from runtime status and task position.
|
|
70
|
+
|
|
71
|
+
Display rule:
|
|
72
|
+
- `ready` -> `ready to run`
|
|
73
|
+
- `running` -> `executing`
|
|
74
|
+
- `awaiting_validation` -> `validation pending`
|
|
75
|
+
- `blocked` -> `blocked`
|
|
76
|
+
- `failed` -> `retry or repair required`
|
|
77
|
+
- `complete` -> `complete`
|
|
78
|
+
|
|
79
|
+
This is a human-friendly phase label, not a separate stored runtime field.
|
|
80
|
+
|
|
81
|
+
### Last Completed Task
|
|
82
|
+
Source:
|
|
83
|
+
- `run_state.json.last_completed_task`
|
|
84
|
+
|
|
85
|
+
Display rule:
|
|
86
|
+
- show the last completed runtime task
|
|
87
|
+
- show `none` when no task has completed yet
|
|
88
|
+
|
|
89
|
+
### Completed Tasks
|
|
90
|
+
Derived from:
|
|
91
|
+
- `run_state.json.last_completed_task`
|
|
92
|
+
- `task_log.json.executions`
|
|
93
|
+
|
|
94
|
+
Display rule:
|
|
95
|
+
- summarize completed runtime tasks from the fixed pipeline:
|
|
96
|
+
- `01-understand`
|
|
97
|
+
- `02-diagnose`
|
|
98
|
+
- `03-architecture`
|
|
99
|
+
- `04-plan`
|
|
100
|
+
- repeated `05-refactor` and `06-validate` cycles should be summarized compactly
|
|
101
|
+
|
|
102
|
+
Recommended display:
|
|
103
|
+
- show a short list for linear tasks already completed
|
|
104
|
+
- for refactor-loop work, show either:
|
|
105
|
+
- completed step count, or
|
|
106
|
+
- completed step IDs if the list is short
|
|
107
|
+
|
|
108
|
+
### Pending Tasks
|
|
109
|
+
Derived from:
|
|
110
|
+
- fixed runtime pipeline
|
|
111
|
+
- current `next_task`
|
|
112
|
+
- loop state
|
|
113
|
+
- completed-step state when available
|
|
114
|
+
|
|
115
|
+
Display rule:
|
|
116
|
+
- for the linear pipeline, show remaining named tasks after `last_completed_task`
|
|
117
|
+
- when in the refactor loop:
|
|
118
|
+
- show `05-refactor -> 06-validate` as the remaining loop path
|
|
119
|
+
- optionally include remaining step count if available
|
|
120
|
+
|
|
121
|
+
### Selected Refactor Step
|
|
122
|
+
Source:
|
|
123
|
+
- `run_state.json.selected_refactor_step`
|
|
124
|
+
|
|
125
|
+
Display rule:
|
|
126
|
+
- show the step ID when relevant
|
|
127
|
+
- show `none` when not in refactor-loop work
|
|
128
|
+
|
|
129
|
+
### Latest Validation
|
|
130
|
+
Derived from:
|
|
131
|
+
- `validation_report.md`
|
|
132
|
+
- current runtime state when validation report is incomplete
|
|
133
|
+
|
|
134
|
+
Display rule:
|
|
135
|
+
- show one of:
|
|
136
|
+
- `PASS`
|
|
137
|
+
- `FAIL`
|
|
138
|
+
- `inconclusive`
|
|
139
|
+
- `unknown`
|
|
140
|
+
|
|
141
|
+
Rules:
|
|
142
|
+
- if `validation_report.md` explicitly contains a resolved result, show it
|
|
143
|
+
- if the report is template-only or missing a trustworthy result, show `unknown` or `inconclusive`
|
|
144
|
+
- do not display `PASS` unless it is actually supported by the validation source
|
|
145
|
+
|
|
146
|
+
### Note
|
|
147
|
+
Source:
|
|
148
|
+
- first high-signal entry in `run_state.json.notes`
|
|
149
|
+
|
|
150
|
+
Display rule:
|
|
151
|
+
- show the most useful short note if one exists
|
|
152
|
+
- omit the field entirely if there is no note
|
|
153
|
+
|
|
154
|
+
## Formatting Guidelines
|
|
155
|
+
|
|
156
|
+
### General Style
|
|
157
|
+
- keep the output concise
|
|
158
|
+
- prefer one line per field
|
|
159
|
+
- use stable labels
|
|
160
|
+
- avoid prose paragraphs
|
|
161
|
+
- avoid dumping raw JSON
|
|
162
|
+
|
|
163
|
+
### Recommended Format
|
|
164
|
+
|
|
165
|
+
Use this compact line-oriented format:
|
|
166
|
+
|
|
167
|
+
```text
|
|
168
|
+
Status: <status>
|
|
169
|
+
Current task: <task-or-none>
|
|
170
|
+
Next task: <task-or-none>
|
|
171
|
+
Current phase: <human-phase>
|
|
172
|
+
Last completed task: <task-or-none>
|
|
173
|
+
Completed tasks: <summary>
|
|
174
|
+
Pending tasks: <summary>
|
|
175
|
+
Selected refactor step: <step-or-none>
|
|
176
|
+
Latest validation: <result>
|
|
177
|
+
Note: <short-note>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Omission Rules
|
|
181
|
+
- omit `Selected refactor step` when no step is active and the run has not entered refactor work yet
|
|
182
|
+
- omit `Note` when no note exists
|
|
183
|
+
- keep `Completed tasks` and `Pending tasks` summarized rather than exhaustive when the output would become noisy
|
|
184
|
+
|
|
185
|
+
### Readability Rules
|
|
186
|
+
- prefer task IDs over verbose restatements
|
|
187
|
+
- keep lists comma-separated on a single line when short
|
|
188
|
+
- if a list grows long, compress to counts plus the most relevant item
|
|
189
|
+
- never print placeholder values from templates literally, such as `PASS/FAIL:`
|
|
190
|
+
|
|
191
|
+
## State-Specific Output Rules
|
|
192
|
+
|
|
193
|
+
### Ready
|
|
194
|
+
Show:
|
|
195
|
+
- current status
|
|
196
|
+
- next runnable task
|
|
197
|
+
- pending pipeline tasks
|
|
198
|
+
|
|
199
|
+
Tone:
|
|
200
|
+
- runnable and calm
|
|
201
|
+
|
|
202
|
+
### Running
|
|
203
|
+
Show:
|
|
204
|
+
- active current task
|
|
205
|
+
- next task if known
|
|
206
|
+
- current phase as `executing`
|
|
207
|
+
|
|
208
|
+
Tone:
|
|
209
|
+
- resume-oriented
|
|
210
|
+
|
|
211
|
+
### Awaiting Validation
|
|
212
|
+
Show:
|
|
213
|
+
- `Current phase: validation pending`
|
|
214
|
+
- `Next task: 06-validate`
|
|
215
|
+
- active selected refactor step
|
|
216
|
+
|
|
217
|
+
Tone:
|
|
218
|
+
- immediate and specific
|
|
219
|
+
|
|
220
|
+
### Blocked
|
|
221
|
+
Show:
|
|
222
|
+
- `Status: blocked`
|
|
223
|
+
- blocker note if present
|
|
224
|
+
- latest validation as `unknown` or `inconclusive` when appropriate
|
|
225
|
+
|
|
226
|
+
Tone:
|
|
227
|
+
- clear, not noisy
|
|
228
|
+
|
|
229
|
+
### Failed
|
|
230
|
+
Show:
|
|
231
|
+
- failed state
|
|
232
|
+
- retry target if one exists
|
|
233
|
+
- selected failed step when relevant
|
|
234
|
+
- failure note
|
|
235
|
+
|
|
236
|
+
Tone:
|
|
237
|
+
- actionable
|
|
238
|
+
|
|
239
|
+
### Complete
|
|
240
|
+
Show:
|
|
241
|
+
- terminal completion
|
|
242
|
+
- no next task
|
|
243
|
+
- completed tasks summary
|
|
244
|
+
- latest validation result if known
|
|
245
|
+
|
|
246
|
+
Tone:
|
|
247
|
+
- succinct and final
|
|
248
|
+
|
|
249
|
+
## Example Output
|
|
250
|
+
|
|
251
|
+
### Example 1 - Fresh Start
|
|
252
|
+
|
|
253
|
+
```text
|
|
254
|
+
Status: ready
|
|
255
|
+
Current task: none
|
|
256
|
+
Next task: 01-understand
|
|
257
|
+
Current phase: ready to run
|
|
258
|
+
Last completed task: none
|
|
259
|
+
Completed tasks: none
|
|
260
|
+
Pending tasks: 01-understand, 02-diagnose, 03-architecture, 04-plan, 05-refactor -> 06-validate
|
|
261
|
+
Latest validation: unknown
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Example 2 - Awaiting Validation
|
|
265
|
+
|
|
266
|
+
```text
|
|
267
|
+
Status: awaiting_validation
|
|
268
|
+
Current task: none
|
|
269
|
+
Next task: 06-validate
|
|
270
|
+
Current phase: validation pending
|
|
271
|
+
Last completed task: 05-refactor
|
|
272
|
+
Completed tasks: 01-understand, 02-diagnose, 03-architecture, 04-plan, 1 validated refactor step
|
|
273
|
+
Pending tasks: 06-validate, remaining refactor loop
|
|
274
|
+
Selected refactor step: step-03-extract-service
|
|
275
|
+
Latest validation: unknown
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Example 3 - Blocked State
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
Status: blocked
|
|
282
|
+
Current task: none
|
|
283
|
+
Next task: unavailable
|
|
284
|
+
Current phase: blocked
|
|
285
|
+
Last completed task: 04-plan
|
|
286
|
+
Completed tasks: 01-understand, 02-diagnose, 03-architecture, 04-plan
|
|
287
|
+
Pending tasks: 05-refactor -> 06-validate
|
|
288
|
+
Latest validation: inconclusive
|
|
289
|
+
Note: run_state.json is missing completed_step_ids
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Example 4 - Failed Validation
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
Status: failed
|
|
296
|
+
Current task: none
|
|
297
|
+
Next task: 05-refactor
|
|
298
|
+
Current phase: retry or repair required
|
|
299
|
+
Last completed task: 05-refactor
|
|
300
|
+
Completed tasks: 01-understand, 02-diagnose, 03-architecture, 04-plan, 2 validated refactor steps
|
|
301
|
+
Pending tasks: retry selected refactor step, then continue validation loop
|
|
302
|
+
Selected refactor step: step-03-extract-service
|
|
303
|
+
Latest validation: FAIL
|
|
304
|
+
Note: retry the selected step after correcting the regression
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Example 5 - Complete
|
|
308
|
+
|
|
309
|
+
```text
|
|
310
|
+
Status: complete
|
|
311
|
+
Current task: none
|
|
312
|
+
Next task: none
|
|
313
|
+
Current phase: complete
|
|
314
|
+
Last completed task: 06-validate
|
|
315
|
+
Completed tasks: 01-understand, 02-diagnose, 03-architecture, 04-plan, all planned refactor steps validated
|
|
316
|
+
Pending tasks: none
|
|
317
|
+
Latest validation: PASS
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## Current-State Compatibility Rules
|
|
321
|
+
|
|
322
|
+
The current runtime artifacts are still partial, so status output must handle incompleteness gracefully.
|
|
323
|
+
|
|
324
|
+
### Missing `completed_step_ids`
|
|
325
|
+
If `run_state.json` lacks `completed_step_ids`:
|
|
326
|
+
|
|
327
|
+
- do not assume an empty list
|
|
328
|
+
- show status as currently recorded
|
|
329
|
+
- set `Next task` to `blocked` or `unavailable` if resolver logic cannot trust the state
|
|
330
|
+
- use `Note` to explain the schema gap
|
|
331
|
+
|
|
332
|
+
### Template-Only `validation_report.md`
|
|
333
|
+
If the validation report still contains placeholder template fields:
|
|
334
|
+
|
|
335
|
+
- show `Latest validation: unknown` or `Latest validation: inconclusive`
|
|
336
|
+
- do not claim `PASS`
|
|
337
|
+
- do not echo placeholder template text directly
|
|
338
|
+
|
|
339
|
+
### Empty `task_log.json`
|
|
340
|
+
If task history is empty:
|
|
341
|
+
|
|
342
|
+
- allow `Completed tasks: none`
|
|
343
|
+
- do not infer hidden task progress
|
|
344
|
+
|
|
345
|
+
## Implementation Notes
|
|
346
|
+
|
|
347
|
+
- `prodify status` should remain a summary view, not a full diagnostic dump.
|
|
348
|
+
- If resolver enrichment is used, it should only clarify the displayed next task; it should not expand into a full `prodify next` response.
|
|
349
|
+
- Prefer showing trustworthy unknowns over presenting guessed progress.
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
# Step Selection Design
|
|
2
|
+
|
|
3
|
+
Date: 2026-03-28
|
|
4
|
+
Scope: `./.prodify/artifacts/refactor_plan.md`
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
Define how the system selects the next refactor step automatically for Task `05-refactor`.
|
|
8
|
+
|
|
9
|
+
The step selector is responsible for:
|
|
10
|
+
- parsing candidate step IDs from `refactor_plan.md`
|
|
11
|
+
- comparing those step IDs against workflow state
|
|
12
|
+
- selecting the next safe executable step
|
|
13
|
+
- deciding when the loop should stop because no valid remaining steps exist
|
|
14
|
+
|
|
15
|
+
The step selector is not responsible for:
|
|
16
|
+
- executing Task `05-refactor`
|
|
17
|
+
- validating the resulting artifact after Task `05-refactor`
|
|
18
|
+
- mutating workflow state directly
|
|
19
|
+
|
|
20
|
+
## Selection Logic
|
|
21
|
+
|
|
22
|
+
### Inputs
|
|
23
|
+
- `.prodify/artifacts/refactor_plan.md`
|
|
24
|
+
- `.prodify/artifacts/run_state.json`
|
|
25
|
+
|
|
26
|
+
Required state fields:
|
|
27
|
+
- `selected_refactor_step`
|
|
28
|
+
- `completed_step_ids`
|
|
29
|
+
- `status`
|
|
30
|
+
- `next_task`
|
|
31
|
+
- `last_completed_task`
|
|
32
|
+
|
|
33
|
+
### Selection Priority
|
|
34
|
+
Select the next step using this priority order:
|
|
35
|
+
|
|
36
|
+
1. **Existing runnable selected step**
|
|
37
|
+
- If `selected_refactor_step` is non-null
|
|
38
|
+
- and that step exists in `refactor_plan.md`
|
|
39
|
+
- and that step is not already in `completed_step_ids`
|
|
40
|
+
- then keep it as the selected step
|
|
41
|
+
|
|
42
|
+
2. **Retry after failed validation**
|
|
43
|
+
- If `status` is `failed`
|
|
44
|
+
- and `next_task` is `05-refactor`
|
|
45
|
+
- and `selected_refactor_step` still exists in the plan
|
|
46
|
+
- retry the same selected step unless operator logic explicitly replaces it
|
|
47
|
+
|
|
48
|
+
3. **First remaining step in plan order**
|
|
49
|
+
- Parse steps from `refactor_plan.md` in document order
|
|
50
|
+
- remove all step IDs already present in `completed_step_ids`
|
|
51
|
+
- choose the first remaining valid step
|
|
52
|
+
|
|
53
|
+
4. **No selectable step**
|
|
54
|
+
- If no valid uncompleted step remains, return stop/no-step-selected
|
|
55
|
+
|
|
56
|
+
### Safe-Step Rule
|
|
57
|
+
The next safe step is the first valid, uncompleted step in the declared order of `refactor_plan.md`.
|
|
58
|
+
|
|
59
|
+
The selector does not reorder steps by risk, file count, or complexity unless `refactor_plan.md` itself changes the order. Safety comes from honoring the planned order rather than inventing a new one.
|
|
60
|
+
|
|
61
|
+
## Parsing Assumptions
|
|
62
|
+
|
|
63
|
+
### Primary Format Assumption
|
|
64
|
+
The selector parses step blocks from the `## Steps` section of `refactor_plan.md`.
|
|
65
|
+
|
|
66
|
+
Each step block must begin with:
|
|
67
|
+
```md
|
|
68
|
+
### Step ID:
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
And should be followed by the standard fields:
|
|
72
|
+
- `Description:`
|
|
73
|
+
- `Files:`
|
|
74
|
+
- `Risk:`
|
|
75
|
+
- `Expected outcome:`
|
|
76
|
+
- `Validation command:`
|
|
77
|
+
|
|
78
|
+
### Step ID Extraction Rule
|
|
79
|
+
Treat the first non-empty value associated with `### Step ID:` as the canonical step ID.
|
|
80
|
+
|
|
81
|
+
Acceptable parsed examples:
|
|
82
|
+
- `### Step ID: step-01-rename-module`
|
|
83
|
+
- `### Step ID:` followed by `- step-01-rename-module`
|
|
84
|
+
|
|
85
|
+
### Plan Completeness Assumption
|
|
86
|
+
A plan is considered populated only if at least one step block yields a non-placeholder step ID.
|
|
87
|
+
|
|
88
|
+
Placeholder values that must not count as real step IDs:
|
|
89
|
+
- `Step ID`
|
|
90
|
+
- `step-id`
|
|
91
|
+
- `TBD`
|
|
92
|
+
- empty value
|
|
93
|
+
|
|
94
|
+
### Ordering Rule
|
|
95
|
+
Step order is the document order of parsed step blocks under `## Steps`.
|
|
96
|
+
|
|
97
|
+
## Parsing Outcomes
|
|
98
|
+
|
|
99
|
+
### Valid Parsed Plan
|
|
100
|
+
A parsed plan is valid when:
|
|
101
|
+
- `## Steps` exists
|
|
102
|
+
- at least one step block is present
|
|
103
|
+
- every parsed step block has a non-placeholder step ID
|
|
104
|
+
- step IDs are unique
|
|
105
|
+
|
|
106
|
+
### Unpopulated Template Plan
|
|
107
|
+
A plan is considered unpopulated when:
|
|
108
|
+
- `## Steps` exists but only template placeholder content is present
|
|
109
|
+
- or no real step IDs can be extracted
|
|
110
|
+
|
|
111
|
+
This is not the same as "no steps remain." It means planning is incomplete and step selection must stop in a blocked state.
|
|
112
|
+
|
|
113
|
+
### Malformed Plan
|
|
114
|
+
A plan is malformed when:
|
|
115
|
+
- `## Steps` is missing
|
|
116
|
+
- a step block exists without a parseable ID
|
|
117
|
+
- duplicate step IDs are present
|
|
118
|
+
- step structure is broken enough that deterministic selection is impossible
|
|
119
|
+
|
|
120
|
+
Malformed plans must fail selection rather than silently guessing.
|
|
121
|
+
|
|
122
|
+
## Comparison With Run State
|
|
123
|
+
|
|
124
|
+
### Completed Vs Remaining Steps
|
|
125
|
+
- `completed_step_ids` are authoritative for steps that already passed validation.
|
|
126
|
+
- Parsed plan step IDs minus `completed_step_ids` yields the remaining candidate steps.
|
|
127
|
+
|
|
128
|
+
### Selected Step Consistency
|
|
129
|
+
- If `selected_refactor_step` exists and is already in `completed_step_ids`, it is stale and must be cleared or ignored by the selector.
|
|
130
|
+
- If `selected_refactor_step` is missing from the current plan, selection must stop with an invalid-state result.
|
|
131
|
+
|
|
132
|
+
### Loop-State Expectations
|
|
133
|
+
- During `awaiting_validation`, no new step should be selected; the existing `selected_refactor_step` remains active for Task `06-validate`.
|
|
134
|
+
- During `ready` with `next_task: "05-refactor"`, the selector may choose the next step.
|
|
135
|
+
- During `failed` with `next_task: "05-refactor"`, the selector should preserve the failed step if it is still valid.
|
|
136
|
+
|
|
137
|
+
## Edge Cases
|
|
138
|
+
|
|
139
|
+
### Edge Case 1 - Template-Only Refactor Plan
|
|
140
|
+
Condition:
|
|
141
|
+
- `refactor_plan.md` still contains placeholder template content and no real step IDs
|
|
142
|
+
|
|
143
|
+
Behavior:
|
|
144
|
+
- do not select a step
|
|
145
|
+
- return `plan_unpopulated`
|
|
146
|
+
- recommend blocking Task `05-refactor` until Task `04-plan` produces a real step list
|
|
147
|
+
|
|
148
|
+
This is the canonical `template-only refactor plan` case.
|
|
149
|
+
|
|
150
|
+
### Edge Case 2 - Duplicate Step IDs
|
|
151
|
+
Condition:
|
|
152
|
+
- two or more step blocks share the same parsed step ID
|
|
153
|
+
|
|
154
|
+
Behavior:
|
|
155
|
+
- fail selection
|
|
156
|
+
- return `duplicate_step_id`
|
|
157
|
+
- require plan correction before continuing
|
|
158
|
+
|
|
159
|
+
### Edge Case 3 - Missing Selected Step
|
|
160
|
+
Condition:
|
|
161
|
+
- `selected_refactor_step` is set in `run_state.json` but no matching step exists in `refactor_plan.md`
|
|
162
|
+
|
|
163
|
+
Behavior:
|
|
164
|
+
- fail selection
|
|
165
|
+
- return `selected_step_missing`
|
|
166
|
+
- require state repair or plan repair before continuing
|
|
167
|
+
|
|
168
|
+
### Edge Case 4 - All Steps Completed
|
|
169
|
+
Condition:
|
|
170
|
+
- every parsed step ID appears in `completed_step_ids`
|
|
171
|
+
|
|
172
|
+
Behavior:
|
|
173
|
+
- do not select a new step
|
|
174
|
+
- return `no_steps_remaining`
|
|
175
|
+
- signal that the refactor loop may stop after validation logic confirms completion
|
|
176
|
+
|
|
177
|
+
### Edge Case 5 - Completed Step IDs Not In Plan
|
|
178
|
+
Condition:
|
|
179
|
+
- `completed_step_ids` contains one or more IDs absent from the current plan
|
|
180
|
+
|
|
181
|
+
Behavior:
|
|
182
|
+
- fail selection
|
|
183
|
+
- return `completed_step_not_in_plan`
|
|
184
|
+
- require state repair before continuing
|
|
185
|
+
|
|
186
|
+
### Edge Case 6 - Failed Step Retry
|
|
187
|
+
Condition:
|
|
188
|
+
- `status` is `failed`
|
|
189
|
+
- `next_task` is `05-refactor`
|
|
190
|
+
- `selected_refactor_step` still exists in the plan and is not completed
|
|
191
|
+
|
|
192
|
+
Behavior:
|
|
193
|
+
- keep the same selected step
|
|
194
|
+
- do not advance to a later step automatically
|
|
195
|
+
|
|
196
|
+
## Stop Conditions
|
|
197
|
+
|
|
198
|
+
### Stop Condition 1 - Plan Unpopulated
|
|
199
|
+
- no real steps can be parsed from `refactor_plan.md`
|
|
200
|
+
- result: stop selection and block execution
|
|
201
|
+
|
|
202
|
+
### Stop Condition 2 - Plan Malformed
|
|
203
|
+
- parsing cannot produce a deterministic ordered step list
|
|
204
|
+
- result: stop selection and fail/ block execution
|
|
205
|
+
|
|
206
|
+
### Stop Condition 3 - No Steps Remaining
|
|
207
|
+
- every valid parsed step has already been completed
|
|
208
|
+
- result: stop selection and signal loop completion
|
|
209
|
+
|
|
210
|
+
### Stop Condition 4 - Invalid State
|
|
211
|
+
- `selected_refactor_step` or `completed_step_ids` contradict the current plan
|
|
212
|
+
- result: stop selection and require state correction
|
|
213
|
+
|
|
214
|
+
## Suggested Selection Result Shape
|
|
215
|
+
```json
|
|
216
|
+
{
|
|
217
|
+
"status": "selected",
|
|
218
|
+
"selected_step_id": "step-01-rename-module",
|
|
219
|
+
"remaining_step_ids": [
|
|
220
|
+
"step-01-rename-module",
|
|
221
|
+
"step-02-add-guard-clause"
|
|
222
|
+
],
|
|
223
|
+
"reason": "first_remaining_step"
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Possible `status` values:
|
|
228
|
+
- `selected`
|
|
229
|
+
- `no_steps_remaining`
|
|
230
|
+
- `plan_unpopulated`
|
|
231
|
+
- `malformed_plan`
|
|
232
|
+
- `invalid_state`
|
|
233
|
+
|
|
234
|
+
## Integration Notes
|
|
235
|
+
|
|
236
|
+
### Integration With Run-State Logic
|
|
237
|
+
- The selector reads `selected_refactor_step`, `completed_step_ids`, `status`, and `next_task`.
|
|
238
|
+
- The run-state updater decides how the selection result changes `run_state.json`.
|
|
239
|
+
|
|
240
|
+
### Integration With Dispatcher
|
|
241
|
+
- The dispatcher should invoke step selection before dispatching Task `05-refactor` when `selected_refactor_step` is null or needs validation.
|
|
242
|
+
- The dispatcher should not choose a step by itself if the step selector returns a stop condition.
|
|
243
|
+
|
|
244
|
+
### Integration With Task 06 Loop
|
|
245
|
+
- Step selection runs only when the workflow is returning to `05-refactor`.
|
|
246
|
+
- It must not choose a new step while `06-validate` is still pending for the current one.
|
|
247
|
+
|
|
248
|
+
## Implementation Notes
|
|
249
|
+
- Parse only the `## Steps` section to avoid accidentally treating summary text as steps.
|
|
250
|
+
- Prefer explicit failure over heuristics when step structure is ambiguous.
|
|
251
|
+
- Preserve document order; do not sort step IDs independently of the plan.
|