devflow-toolkit 0.3.21__py3-none-any.whl → 0.3.22__py3-none-any.whl
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.
- devflow/adapters/instructions.py +2 -2
- devflow/cli.py +2 -0
- devflow/commands/reopen.py +105 -0
- devflow/commands/status.py +3 -1
- devflow/core/spec_workflow.py +6 -0
- devflow/core/state/__init__.py +2 -0
- devflow/core/state/events.py +58 -0
- devflow/core/state/manager.py +103 -1
- devflow/prompts/__init__.py +12 -0
- devflow/prompts/discovery.md +1 -1
- {devflow_toolkit-0.3.21.dist-info → devflow_toolkit-0.3.22.dist-info}/METADATA +47 -10
- {devflow_toolkit-0.3.21.dist-info → devflow_toolkit-0.3.22.dist-info}/RECORD +15 -14
- {devflow_toolkit-0.3.21.dist-info → devflow_toolkit-0.3.22.dist-info}/WHEEL +0 -0
- {devflow_toolkit-0.3.21.dist-info → devflow_toolkit-0.3.22.dist-info}/entry_points.txt +0 -0
- {devflow_toolkit-0.3.21.dist-info → devflow_toolkit-0.3.22.dist-info}/licenses/LICENSE +0 -0
devflow/adapters/instructions.py
CHANGED
|
@@ -178,8 +178,8 @@ def render_agent_instructions(
|
|
|
178
178
|
"Out of Scope.",
|
|
179
179
|
"5. Add or update tests for every `AC-XXX` and report each one as "
|
|
180
180
|
"met or not met.",
|
|
181
|
-
f"6. Do not edit files under `{specs_dir}
|
|
182
|
-
"spec
|
|
181
|
+
f"6. Do not edit files under `{specs_dir}/`. To change an "
|
|
182
|
+
"approved spec, the user runs `devflow reopen NNN`.",
|
|
183
183
|
"7. If the spec is ambiguous, wrong or conflicts with the code, "
|
|
184
184
|
"stop and ask. Scope changes need a new `devflow spec`.",
|
|
185
185
|
"",
|
devflow/cli.py
CHANGED
|
@@ -11,6 +11,7 @@ from devflow.commands.doctor import doctor as doctor_command
|
|
|
11
11
|
from devflow.commands.harness import harness_app
|
|
12
12
|
from devflow.commands.init import init as init_command
|
|
13
13
|
from devflow.commands.recover import recover as recover_command
|
|
14
|
+
from devflow.commands.reopen import reopen as reopen_command
|
|
14
15
|
from devflow.commands.spec import spec as spec_command
|
|
15
16
|
from devflow.commands.status import status as status_command
|
|
16
17
|
|
|
@@ -26,6 +27,7 @@ console = Console()
|
|
|
26
27
|
app.command("init")(init_command)
|
|
27
28
|
app.command("spec")(spec_command)
|
|
28
29
|
app.command("approve")(approve_command)
|
|
30
|
+
app.command("reopen")(reopen_command)
|
|
29
31
|
app.command("status")(status_command)
|
|
30
32
|
app.command("doctor")(doctor_command)
|
|
31
33
|
app.command("recover")(recover_command)
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"""Implementation of the devflow reopen command."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from rich.console import Console
|
|
9
|
+
|
|
10
|
+
from devflow.core.artifacts.errors import ArtifactError
|
|
11
|
+
from devflow.core.config import ConfigError, ConfigManager
|
|
12
|
+
from devflow.core.discovery import DiscoveryError
|
|
13
|
+
from devflow.core.project import ProjectDetector
|
|
14
|
+
from devflow.core.state import (
|
|
15
|
+
StateError,
|
|
16
|
+
WorkflowLocator,
|
|
17
|
+
WorkflowStateManager,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
console = Console()
|
|
21
|
+
error_console = Console(stderr=True)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def reopen(
|
|
25
|
+
spec_id: str = typer.Argument(
|
|
26
|
+
...,
|
|
27
|
+
help="Change id (001) or change directory (001-add-health).",
|
|
28
|
+
),
|
|
29
|
+
path: Path = typer.Argument(
|
|
30
|
+
Path("."),
|
|
31
|
+
help="Project root or a path inside it.",
|
|
32
|
+
),
|
|
33
|
+
discovery: bool = typer.Option(
|
|
34
|
+
False,
|
|
35
|
+
"--discovery",
|
|
36
|
+
help="Also reopen Discovery to add or change decisions.",
|
|
37
|
+
),
|
|
38
|
+
yes: bool = typer.Option(
|
|
39
|
+
False,
|
|
40
|
+
"--yes",
|
|
41
|
+
"-y",
|
|
42
|
+
help="Do not ask for confirmation.",
|
|
43
|
+
),
|
|
44
|
+
) -> None:
|
|
45
|
+
"""Reopen an approved specification so it can be changed."""
|
|
46
|
+
try:
|
|
47
|
+
_reopen(spec_id, path, discovery=discovery, yes=yes)
|
|
48
|
+
except (
|
|
49
|
+
ArtifactError,
|
|
50
|
+
ConfigError,
|
|
51
|
+
DiscoveryError,
|
|
52
|
+
StateError,
|
|
53
|
+
FileNotFoundError,
|
|
54
|
+
NotADirectoryError,
|
|
55
|
+
OSError,
|
|
56
|
+
) as error:
|
|
57
|
+
error_console.print(f"[red]Error:[/red] {error}")
|
|
58
|
+
raise typer.Exit(code=1) from error
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _reopen(spec_id: str, path: Path, *, discovery: bool, yes: bool) -> None:
|
|
62
|
+
root = ProjectDetector().find_root(path)
|
|
63
|
+
config = ConfigManager(root).load()
|
|
64
|
+
location = WorkflowLocator(config.specifications_path).find(spec_id)
|
|
65
|
+
|
|
66
|
+
if not yes and not typer.confirm(
|
|
67
|
+
f"Reopen the approved specification {location.change}?",
|
|
68
|
+
default=False,
|
|
69
|
+
):
|
|
70
|
+
console.print("Cancelled. Nothing was changed.")
|
|
71
|
+
raise typer.Exit(code=1)
|
|
72
|
+
|
|
73
|
+
manager = WorkflowStateManager(
|
|
74
|
+
config.specifications_path,
|
|
75
|
+
project_root=config.root,
|
|
76
|
+
)
|
|
77
|
+
result = manager.reopen(location, discovery=discovery)
|
|
78
|
+
|
|
79
|
+
console.print(
|
|
80
|
+
f"[bold green]Reopened {location.change}.[/bold green] "
|
|
81
|
+
"The spec approval was withdrawn."
|
|
82
|
+
)
|
|
83
|
+
if result.archived is not None:
|
|
84
|
+
console.print(
|
|
85
|
+
"Approved spec archived: "
|
|
86
|
+
f"{manager.store.display_path(result.archived)}"
|
|
87
|
+
)
|
|
88
|
+
console.print(f"Workflow status: {result.state.status}")
|
|
89
|
+
|
|
90
|
+
continue_command = f"devflow spec --continue {location.spec_id}"
|
|
91
|
+
if discovery:
|
|
92
|
+
console.print(
|
|
93
|
+
f"\n[bold]Next:[/bold] {continue_command}\n"
|
|
94
|
+
"[dim]Tell the agent what to add or change. Then run the same "
|
|
95
|
+
"command again to write the new spec, and approve it with "
|
|
96
|
+
f"devflow approve {location.spec_id}.[/dim]"
|
|
97
|
+
)
|
|
98
|
+
else:
|
|
99
|
+
console.print(
|
|
100
|
+
"\n[bold]Next:[/bold] edit spec.md, then "
|
|
101
|
+
f"{continue_command}\n"
|
|
102
|
+
"[dim]DevFlow validates and registers your edited spec. Approve "
|
|
103
|
+
f"it again with devflow approve {location.spec_id}. To change "
|
|
104
|
+
"decisions instead, use devflow reopen with --discovery.[/dim]"
|
|
105
|
+
)
|
devflow/commands/status.py
CHANGED
|
@@ -140,11 +140,13 @@ def _next_step(
|
|
|
140
140
|
record.status == ArtifactStatus.STALE.value
|
|
141
141
|
for record in artifacts.values()
|
|
142
142
|
)
|
|
143
|
-
if
|
|
143
|
+
if current.orphans:
|
|
144
144
|
return f"devflow doctor {spec_id}"
|
|
145
145
|
|
|
146
146
|
spec = artifacts.get("spec")
|
|
147
147
|
if state.status == WorkflowStatus.SPEC_APPROVED.value:
|
|
148
|
+
if stale:
|
|
149
|
+
return f"devflow reopen {spec_id}"
|
|
148
150
|
spec_path = (
|
|
149
151
|
spec.path
|
|
150
152
|
if spec is not None
|
devflow/core/spec_workflow.py
CHANGED
|
@@ -23,6 +23,7 @@ from devflow.core.constitution import (
|
|
|
23
23
|
specification_documents,
|
|
24
24
|
)
|
|
25
25
|
from devflow.core.discovery import (
|
|
26
|
+
DISCOVERY_PENDING,
|
|
26
27
|
DiscoveryDocument,
|
|
27
28
|
DiscoveryError,
|
|
28
29
|
DiscoveryManager,
|
|
@@ -794,6 +795,11 @@ class SpecWorkflow:
|
|
|
794
795
|
question_budget_maximum=settings.question_budget_maximum,
|
|
795
796
|
max_rounds=settings.max_rounds,
|
|
796
797
|
assumptions_enabled=settings.assumptions_enabled,
|
|
798
|
+
reopened=(
|
|
799
|
+
discovery.status == DISCOVERY_PENDING
|
|
800
|
+
and not discovery.pending_questions
|
|
801
|
+
and not discovery.pending_assumptions
|
|
802
|
+
),
|
|
797
803
|
)
|
|
798
804
|
run_context = RunContext(
|
|
799
805
|
root=config.root,
|
devflow/core/state/__init__.py
CHANGED
|
@@ -24,6 +24,7 @@ from devflow.core.state.locator import (
|
|
|
24
24
|
from devflow.core.state.manager import (
|
|
25
25
|
ApprovalResult,
|
|
26
26
|
ChangeStatus,
|
|
27
|
+
ReopenResult,
|
|
27
28
|
WorkflowStateManager,
|
|
28
29
|
)
|
|
29
30
|
from devflow.core.state.models import (
|
|
@@ -56,6 +57,7 @@ __all__ = [
|
|
|
56
57
|
"InvalidEventLogError",
|
|
57
58
|
"InvalidStateError",
|
|
58
59
|
"InvalidTransitionError",
|
|
60
|
+
"ReopenResult",
|
|
59
61
|
"StaleArtifactError",
|
|
60
62
|
"StateError",
|
|
61
63
|
"UnsupportedStageError",
|
devflow/core/state/events.py
CHANGED
|
@@ -38,10 +38,12 @@ ARTIFACT_EVENT_SUFFIXES = frozenset(
|
|
|
38
38
|
{"generated", "validated", "rejected", "stale"}
|
|
39
39
|
)
|
|
40
40
|
APPROVAL_EVENT_SUFFIX = "approved"
|
|
41
|
+
REOPEN_EVENT_SUFFIX = "reopened"
|
|
41
42
|
|
|
42
43
|
_EVENT_KIND_WORKFLOW = "workflow"
|
|
43
44
|
_EVENT_KIND_ARTIFACT = "artifact"
|
|
44
45
|
_EVENT_KIND_APPROVAL = "approval"
|
|
46
|
+
_EVENT_KIND_REOPEN = "reopen"
|
|
45
47
|
|
|
46
48
|
_EVENT_STATUSES = {
|
|
47
49
|
"generated": ArtifactStatus.GENERATED.value,
|
|
@@ -190,6 +192,8 @@ def classify_event(
|
|
|
190
192
|
return _EVENT_KIND_ARTIFACT, stage, suffix
|
|
191
193
|
if suffix == APPROVAL_EVENT_SUFFIX:
|
|
192
194
|
return _EVENT_KIND_APPROVAL, stage, suffix
|
|
195
|
+
if suffix == REOPEN_EVENT_SUFFIX and stage in STAGE_TARGETS:
|
|
196
|
+
return _EVENT_KIND_REOPEN, stage, suffix
|
|
193
197
|
|
|
194
198
|
msg = f"Unknown workflow event type: {event_type}"
|
|
195
199
|
raise InvalidEventLogError(msg)
|
|
@@ -255,6 +259,10 @@ def apply_event(state: WorkflowState, event: WorkflowEvent) -> WorkflowState:
|
|
|
255
259
|
if stage is None or suffix is None:
|
|
256
260
|
raise _event_error(event, "artifact event is missing its stage.")
|
|
257
261
|
_apply_artifact_event(state, event, stage, suffix)
|
|
262
|
+
elif kind == _EVENT_KIND_REOPEN:
|
|
263
|
+
if stage is None:
|
|
264
|
+
raise _event_error(event, "reopen event is missing its stage.")
|
|
265
|
+
_apply_reopen(state, event, stage)
|
|
258
266
|
else:
|
|
259
267
|
if stage is None:
|
|
260
268
|
raise _event_error(event, "approval event is missing its stage.")
|
|
@@ -671,6 +679,56 @@ def _apply_approval(
|
|
|
671
679
|
state.status = target_value
|
|
672
680
|
|
|
673
681
|
|
|
682
|
+
_REOPEN_TARGETS = frozenset(
|
|
683
|
+
{
|
|
684
|
+
WorkflowStatus.DRAFT.value,
|
|
685
|
+
WorkflowStatus.AWAITING_CLARIFICATION.value,
|
|
686
|
+
}
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
def _apply_reopen(
|
|
691
|
+
state: WorkflowState,
|
|
692
|
+
event: WorkflowEvent,
|
|
693
|
+
stage: str,
|
|
694
|
+
) -> None:
|
|
695
|
+
"""Withdraw an approval and return the workflow to an editable state."""
|
|
696
|
+
payload = event.payload
|
|
697
|
+
payload_stage = payload.get("stage")
|
|
698
|
+
if payload_stage != stage:
|
|
699
|
+
raise _event_error(
|
|
700
|
+
event,
|
|
701
|
+
f"payload stage {payload_stage!r} does not match event type.",
|
|
702
|
+
)
|
|
703
|
+
approval = state.approvals.get(stage)
|
|
704
|
+
if approval is None:
|
|
705
|
+
raise _event_error(event, f"stage {stage!r} is not approved.")
|
|
706
|
+
if state.status != STAGE_TARGETS[stage]:
|
|
707
|
+
raise _event_error(
|
|
708
|
+
event,
|
|
709
|
+
f"stage {stage!r} cannot be reopened from {state.status}.",
|
|
710
|
+
)
|
|
711
|
+
target_value = payload.get("workflow_status")
|
|
712
|
+
if target_value not in _REOPEN_TARGETS:
|
|
713
|
+
raise _event_error(
|
|
714
|
+
event,
|
|
715
|
+
f"reopen target {target_value!r} is not draft or "
|
|
716
|
+
"awaiting_clarification.",
|
|
717
|
+
)
|
|
718
|
+
|
|
719
|
+
for kind in approval.artifacts:
|
|
720
|
+
record = state.artifacts.get(kind)
|
|
721
|
+
if record is not None and record.status == ArtifactStatus.APPROVED.value:
|
|
722
|
+
state.artifacts[kind] = replace(
|
|
723
|
+
record,
|
|
724
|
+
status=ArtifactStatus.VALIDATED.value,
|
|
725
|
+
approved_at="",
|
|
726
|
+
updated_at=event.timestamp,
|
|
727
|
+
)
|
|
728
|
+
state.approvals.pop(stage)
|
|
729
|
+
state.status = target_value
|
|
730
|
+
|
|
731
|
+
|
|
674
732
|
def _event_error(
|
|
675
733
|
event: WorkflowEvent,
|
|
676
734
|
reason: str,
|
devflow/core/state/manager.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from dataclasses import dataclass
|
|
5
|
+
from dataclasses import dataclass, replace
|
|
6
6
|
from datetime import datetime, timezone
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any
|
|
@@ -26,6 +26,7 @@ from devflow.core.clock import (
|
|
|
26
26
|
)
|
|
27
27
|
from devflow.core.discovery import (
|
|
28
28
|
DISCOVERY_FILENAME,
|
|
29
|
+
DISCOVERY_PENDING,
|
|
29
30
|
DiscoveryIncompleteError,
|
|
30
31
|
DiscoveryManager,
|
|
31
32
|
)
|
|
@@ -147,6 +148,17 @@ class ApprovalResult:
|
|
|
147
148
|
warnings: tuple[str, ...] = ()
|
|
148
149
|
|
|
149
150
|
|
|
151
|
+
@dataclass(frozen=True)
|
|
152
|
+
class ReopenResult:
|
|
153
|
+
"""Outcome of reopening an approved stage."""
|
|
154
|
+
|
|
155
|
+
location: ChangeLocation
|
|
156
|
+
state: WorkflowState
|
|
157
|
+
stage: str
|
|
158
|
+
archived: Path | None
|
|
159
|
+
discovery: bool
|
|
160
|
+
|
|
161
|
+
|
|
150
162
|
class WorkflowStateManager:
|
|
151
163
|
"""Own workflow state, artifact registration and human approvals."""
|
|
152
164
|
|
|
@@ -654,6 +666,96 @@ class WorkflowStateManager:
|
|
|
654
666
|
warnings=tuple(warnings),
|
|
655
667
|
)
|
|
656
668
|
|
|
669
|
+
def reopen(
|
|
670
|
+
self,
|
|
671
|
+
location: ChangeLocation,
|
|
672
|
+
stage: str = "spec",
|
|
673
|
+
*,
|
|
674
|
+
discovery: bool = False,
|
|
675
|
+
by: str = "user",
|
|
676
|
+
) -> ReopenResult:
|
|
677
|
+
"""Withdraw an approval so the change can be edited again."""
|
|
678
|
+
normalized = stage.strip().lower()
|
|
679
|
+
if normalized != "spec":
|
|
680
|
+
msg = (
|
|
681
|
+
f"Stage '{stage}' cannot be reopened. Only the 'spec' stage is "
|
|
682
|
+
"available in this release."
|
|
683
|
+
)
|
|
684
|
+
raise UnsupportedStageError(msg)
|
|
685
|
+
|
|
686
|
+
with self._lock(location):
|
|
687
|
+
state = self._load_state(location, persist=True)
|
|
688
|
+
state = self._reconcile_locked(location, state)
|
|
689
|
+
if normalized not in state.approvals:
|
|
690
|
+
msg = (
|
|
691
|
+
f"Stage '{normalized}' is not approved for {location.change}; "
|
|
692
|
+
"there is nothing to reopen. Continue it with 'devflow spec "
|
|
693
|
+
f"--continue {location.spec_id}'."
|
|
694
|
+
)
|
|
695
|
+
raise StateError(msg)
|
|
696
|
+
if state.status != STAGE_TARGETS[normalized]:
|
|
697
|
+
msg = (
|
|
698
|
+
f"Change '{location.change}' has advanced to {state.status} "
|
|
699
|
+
f"and cannot reopen the '{normalized}' stage."
|
|
700
|
+
)
|
|
701
|
+
raise StateError(msg)
|
|
702
|
+
|
|
703
|
+
archived: Path | None = None
|
|
704
|
+
spec_path = location.directory / "spec.md"
|
|
705
|
+
if spec_path.is_file() and not spec_path.is_symlink():
|
|
706
|
+
archived = self.store.archive(spec_path)
|
|
707
|
+
|
|
708
|
+
target = (
|
|
709
|
+
WorkflowStatus.AWAITING_CLARIFICATION.value
|
|
710
|
+
if discovery
|
|
711
|
+
else WorkflowStatus.DRAFT.value
|
|
712
|
+
)
|
|
713
|
+
state = self._append_and_save(
|
|
714
|
+
location,
|
|
715
|
+
state,
|
|
716
|
+
f"{normalized}_reopened",
|
|
717
|
+
{
|
|
718
|
+
"stage": normalized,
|
|
719
|
+
"by": by,
|
|
720
|
+
"workflow_status": target,
|
|
721
|
+
"discovery": discovery,
|
|
722
|
+
},
|
|
723
|
+
actor=by,
|
|
724
|
+
run_id=None,
|
|
725
|
+
)
|
|
726
|
+
|
|
727
|
+
if discovery and "discovery" in state.artifacts:
|
|
728
|
+
manager = DiscoveryManager(self.root, clock=self.clock)
|
|
729
|
+
document = manager.load(location.directory, required=True)
|
|
730
|
+
assert document is not None
|
|
731
|
+
path, digest = manager.write(
|
|
732
|
+
location.directory,
|
|
733
|
+
replace(document, status=DISCOVERY_PENDING),
|
|
734
|
+
)
|
|
735
|
+
state = self._append_and_save(
|
|
736
|
+
location,
|
|
737
|
+
state,
|
|
738
|
+
"discovery_generated",
|
|
739
|
+
{
|
|
740
|
+
"stage": "discovery",
|
|
741
|
+
"kind": "discovery",
|
|
742
|
+
"path": self._relative_artifact_path(path),
|
|
743
|
+
"digest": digest,
|
|
744
|
+
"source": "human",
|
|
745
|
+
"metadata": {"stage": "discovery", "reopened": True},
|
|
746
|
+
},
|
|
747
|
+
actor=by,
|
|
748
|
+
run_id=None,
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
return ReopenResult(
|
|
752
|
+
location=location,
|
|
753
|
+
state=state,
|
|
754
|
+
stage=normalized,
|
|
755
|
+
archived=archived,
|
|
756
|
+
discovery=discovery,
|
|
757
|
+
)
|
|
758
|
+
|
|
657
759
|
def _ensure_artifact_current(
|
|
658
760
|
self,
|
|
659
761
|
location: ChangeLocation,
|
devflow/prompts/__init__.py
CHANGED
|
@@ -112,6 +112,7 @@ def build_discovery_prompt(
|
|
|
112
112
|
question_budget_maximum: int = 12,
|
|
113
113
|
max_rounds: int = 3,
|
|
114
114
|
assumptions_enabled: bool = True,
|
|
115
|
+
reopened: bool = False,
|
|
115
116
|
) -> str:
|
|
116
117
|
"""Render the interactive discovery prompt for any harness."""
|
|
117
118
|
template = load_prompt("discovery.md")
|
|
@@ -151,6 +152,7 @@ def build_discovery_prompt(
|
|
|
151
152
|
),
|
|
152
153
|
"max_rounds": str(max(1, max_rounds)),
|
|
153
154
|
"assumptions_note": assumptions_note,
|
|
155
|
+
"reopened_note": _REOPENED_NOTE if reopened else "",
|
|
154
156
|
"permission_summary": _permission_summary(permissions),
|
|
155
157
|
}
|
|
156
158
|
rendered = template
|
|
@@ -159,6 +161,16 @@ def build_discovery_prompt(
|
|
|
159
161
|
return rendered
|
|
160
162
|
|
|
161
163
|
|
|
164
|
+
_REOPENED_NOTE = (
|
|
165
|
+
"## Reopened Discovery\n\n"
|
|
166
|
+
"The user reopened Discovery after approving the specification. "
|
|
167
|
+
"Start by asking the user what to add or change. Append a new question "
|
|
168
|
+
"with the next `Qn` identifier for every new decision. Change an "
|
|
169
|
+
"existing answer only when the user explicitly asks for it, and keep "
|
|
170
|
+
"its id. Set `status` to `complete` when nothing remains pending.\n\n"
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
|
|
162
174
|
def build_discovery_repair_prompt(
|
|
163
175
|
*,
|
|
164
176
|
discovery_path: str,
|
devflow/prompts/discovery.md
CHANGED
|
@@ -284,7 +284,7 @@ assumption is unaccepted, and to `complete` only when nothing remains.
|
|
|
284
284
|
- If the answer to one question raises a new decision, append a new
|
|
285
285
|
question before reporting Discovery as ready.
|
|
286
286
|
|
|
287
|
-
## Execution Instructions
|
|
287
|
+
{{reopened_note}}## Execution Instructions
|
|
288
288
|
|
|
289
289
|
{{mode_instructions}}
|
|
290
290
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: devflow-toolkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.22
|
|
4
4
|
Summary: Specification workflow toolkit for AI-assisted software changes
|
|
5
5
|
Author: DevFlow contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -32,7 +32,7 @@ Description-Content-Type: text/markdown
|
|
|
32
32
|
|
|
33
33
|
# DevFlow Toolkit
|
|
34
34
|
|
|
35
|
-
**Current version: `0.3.
|
|
35
|
+
**Current version: `0.3.22`.**
|
|
36
36
|
|
|
37
37
|
DevFlow is a command-line toolkit for leading AI models and coding
|
|
38
38
|
agents through specification-driven changes in real software projects.
|
|
@@ -152,7 +152,7 @@ pip install devflow-toolkit
|
|
|
152
152
|
To install a specific built artifact instead:
|
|
153
153
|
|
|
154
154
|
```bash
|
|
155
|
-
pip install devflow_toolkit-0.3.
|
|
155
|
+
pip install devflow_toolkit-0.3.22-py3-none-any.whl
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
Verify the installation:
|
|
@@ -428,7 +428,7 @@ as an architectural constraint when it is present.
|
|
|
428
428
|
|
|
429
429
|
### Harnesses
|
|
430
430
|
|
|
431
|
-
| Harness | Status in 0.3.
|
|
431
|
+
| Harness | Status in 0.3.22 |
|
|
432
432
|
| --- | --- |
|
|
433
433
|
| OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
|
|
434
434
|
| Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
|
|
@@ -696,13 +696,14 @@ specification that still lists open questions.
|
|
|
696
696
|
8. If artifacts exist without workflow state, diagnose with
|
|
697
697
|
`devflow doctor <id>` and repair with `devflow recover <id>`.
|
|
698
698
|
|
|
699
|
-
Available commands in `0.3.
|
|
699
|
+
Available commands in `0.3.22`:
|
|
700
700
|
|
|
701
701
|
| Command | Status |
|
|
702
702
|
| --- | --- |
|
|
703
703
|
| `devflow init` | Implemented |
|
|
704
704
|
| `devflow spec` | Implemented: Discovery, specification, and `--continue` |
|
|
705
705
|
| `devflow approve <id>` (stage `spec` by default) | Implemented |
|
|
706
|
+
| `devflow reopen <id>` | Implemented: withdraw a spec approval to change it |
|
|
706
707
|
| `devflow status <id>` | Implemented |
|
|
707
708
|
| `devflow doctor <id>` | Implemented: read-only diagnostics |
|
|
708
709
|
| `devflow recover <id>` | Implemented: register existing artifacts |
|
|
@@ -928,7 +929,7 @@ devflow approve 001
|
|
|
928
929
|
```
|
|
929
930
|
|
|
930
931
|
Approval is explicit and binds the decision to the current artifact
|
|
931
|
-
digests. For a `0.3.
|
|
932
|
+
digests. For a `0.3.22` change it binds `spec.md`, `discovery.yaml` and,
|
|
932
933
|
when a manifest applies, the architecture manifest digest. Repeating the
|
|
933
934
|
same approval is a no-op. If an artifact changes after validation,
|
|
934
935
|
DevFlow marks it stale and refuses approval until it is regenerated and
|
|
@@ -939,7 +940,7 @@ and names the pending questions and assumptions. Approval also rejects a
|
|
|
939
940
|
specification whose section 7 still lists open questions. Legacy `0.2.0`
|
|
940
941
|
changes without `discovery.yaml` remain approvable with a warning.
|
|
941
942
|
|
|
942
|
-
Only the `spec` stage is available in `0.3.
|
|
943
|
+
Only the `spec` stage is available in `0.3.22`, so `--stage` is optional
|
|
943
944
|
and defaults to `spec`. `--stage plan` and `--stage review` are
|
|
944
945
|
rejected. There are no `plan`, `implement` or
|
|
945
946
|
`review` commands in this release.
|
|
@@ -967,6 +968,41 @@ The generated `AGENTS.md` (or `CLAUDE.md`) tells the agent to:
|
|
|
967
968
|
this step. Discovery and specification prompts skip it to save tokens;
|
|
968
969
|
the specification still lists it in section 9.
|
|
969
970
|
|
|
971
|
+
### Reopen an approved specification
|
|
972
|
+
|
|
973
|
+
An approved specification is a contract. To change it, reopen it first;
|
|
974
|
+
editing `spec.md` directly only marks it `stale`.
|
|
975
|
+
|
|
976
|
+
```bash
|
|
977
|
+
devflow reopen 001 # fix or extend the spec text yourself
|
|
978
|
+
devflow reopen 001 --discovery # add or change decisions with the agent
|
|
979
|
+
```
|
|
980
|
+
|
|
981
|
+
`reopen` asks for confirmation (skip it with `--yes`), copies the
|
|
982
|
+
current `spec.md` into `history/`, records a `spec_reopened` event and
|
|
983
|
+
withdraws the approval. The previous approval stays in `events.jsonl`;
|
|
984
|
+
nothing is deleted.
|
|
985
|
+
|
|
986
|
+
Without `--discovery`, the change returns to `draft`:
|
|
987
|
+
|
|
988
|
+
```bash
|
|
989
|
+
# edit spec.md
|
|
990
|
+
devflow spec --continue 001 # validates and registers your edited spec
|
|
991
|
+
devflow approve 001
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
With `--discovery`, the change returns to `awaiting_clarification` and
|
|
995
|
+
Discovery is marked pending:
|
|
996
|
+
|
|
997
|
+
```bash
|
|
998
|
+
devflow spec --continue 001 # Discovery session: tell the agent what changes
|
|
999
|
+
devflow spec --continue 001 # writes the new spec
|
|
1000
|
+
devflow approve 001
|
|
1001
|
+
```
|
|
1002
|
+
|
|
1003
|
+
Only an approved spec can be reopened, and only while the change is in
|
|
1004
|
+
`spec_approved`.
|
|
1005
|
+
|
|
970
1006
|
## Generated files
|
|
971
1007
|
|
|
972
1008
|
```text
|
|
@@ -1006,12 +1042,13 @@ DevFlow rebuilds or rejects it rather than trusting it.
|
|
|
1006
1042
|
|
|
1007
1043
|
```text
|
|
1008
1044
|
generated -> validated -> approved
|
|
1009
|
-
| |
|
|
1010
|
-
+-> rejected +-> stale
|
|
1045
|
+
| | |
|
|
1046
|
+
+-> rejected +-> stale +-> reopen -> validated
|
|
1011
1047
|
```
|
|
1012
1048
|
|
|
1013
1049
|
- An approval stores the artifact kind and its SHA-256 digest.
|
|
1014
|
-
- Editing an approved artifact makes it stale.
|
|
1050
|
+
- Editing an approved artifact makes it stale. Use `devflow reopen` to
|
|
1051
|
+
withdraw the approval and change it on purpose.
|
|
1015
1052
|
- A stale, unvalidated or orphan artifact cannot be approved.
|
|
1016
1053
|
- Semantic validation rejects malformed or inconsistent histories.
|
|
1017
1054
|
- Artifact and state writes are atomic; a failed write does not leave a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
devflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
devflow/cli.py,sha256=
|
|
2
|
+
devflow/cli.py,sha256=jzawrjsQMjn4JfIoCAKDfXE9lQBDzydHhtBP_etuCqs,1449
|
|
3
3
|
devflow/adapters/__init__.py,sha256=WcsjXQTKzHNzMAHx82-sdJQeR3ceHRVqLWTUtRlaraE,867
|
|
4
4
|
devflow/adapters/agents.py,sha256=OZnz7wAJNcIojtgaQIK1iB6QKWGgv2VCmoBp8M9DUKE,1423
|
|
5
5
|
devflow/adapters/antigravity.py,sha256=tbhAWUNQt5fPemN_N8zEEdaBMPDRExpcXfF6obvvXvo,9124
|
|
@@ -7,7 +7,7 @@ devflow/adapters/base.py,sha256=YggY_IwHExdybl5S9NjwZSlmmcw9Y6z7DhQsl3JLvXs,2055
|
|
|
7
7
|
devflow/adapters/claude_code.py,sha256=El4wYuEgLMr4NAmZG58cVlpkSn_MCOAtQ7Qq2zFIOuI,3689
|
|
8
8
|
devflow/adapters/codex.py,sha256=5EVBRlYg3ClYhvN1NmUfxhBrEURLryIZTpHQkyFtzx8,3616
|
|
9
9
|
devflow/adapters/detector.py,sha256=92BkNAvWs2Vh8H6xJzMweBDCw6yuYVg7sV4LoSZ8KFo,3291
|
|
10
|
-
devflow/adapters/instructions.py,sha256=
|
|
10
|
+
devflow/adapters/instructions.py,sha256=AUje2tYnyI8yxnZQ5JlUjBON8Nz_yq4_yxpCz_DQoys,10885
|
|
11
11
|
devflow/adapters/kiro.py,sha256=1w9U8oP0i2un6YeiV5uOUQ8qrOYHiF1K-788iVqHzhA,7709
|
|
12
12
|
devflow/adapters/opencode.py,sha256=AtIsgKam25Y3CjI4DlXqODQO_D74Cn_N-G02MIsBI44,8503
|
|
13
13
|
devflow/adapters/registry.py,sha256=G1HquOcSggwT0qm8PIm_Fv5Wj354G20rnI0C7vPhrSo,1263
|
|
@@ -18,8 +18,9 @@ devflow/commands/doctor.py,sha256=vYk2i3OksbGpHEUFsqi7c4w44mAXRmY0OeEdO8h5j_M,41
|
|
|
18
18
|
devflow/commands/harness.py,sha256=0IH_PPeYmW3aQ_WnUSkFzxpe3A4FtSyjWfHq-Ug7Eos,10549
|
|
19
19
|
devflow/commands/init.py,sha256=G2LDYDElWDSDPk3-1DfRtv8sW_z-9ITJH1Co6C5jiyw,17188
|
|
20
20
|
devflow/commands/recover.py,sha256=sV9x5-30E_3XRBe7JItDiSG-pqrowRzjqOkC_eyrhFQ,2165
|
|
21
|
+
devflow/commands/reopen.py,sha256=bZiX-dyKgmtdKdV4FHwEwRCFvuuX5jezBCI7wIpkHYU,2971
|
|
21
22
|
devflow/commands/spec.py,sha256=7glxFHKuJd33mL6YayrxRJ6TViUmmQk5rijbNepsbig,16353
|
|
22
|
-
devflow/commands/status.py,sha256
|
|
23
|
+
devflow/commands/status.py,sha256=8xesusAw3ToCfX7aYsd-q5YnAyXU0DouQzLGoFZebwg,6082
|
|
23
24
|
devflow/core/__init__.py,sha256=hN7i4-PDaZ7y4P8qRpZl_lJvIiPyQaN1TDGnw2BecYU,427
|
|
24
25
|
devflow/core/architecture.py,sha256=qllllsUVqA76LiSU6z_s4U8dxMcs6ClKXU16HxI3yOI,13692
|
|
25
26
|
devflow/core/clock.py,sha256=KZROv6o51Ln1EzK00ySCxfc7WPZqPlaQhFfjfdc_TMY,1651
|
|
@@ -31,18 +32,18 @@ devflow/core/ports.py,sha256=6jlqeR40MNaz-IuZIAPimXpRKew-wMUab3KzelcTXsU,4541
|
|
|
31
32
|
devflow/core/profile_manager.py,sha256=QnnJka2KIKD2tCSWJkGTOUEFMgmQT0Z9Qv173JKWKHw,8937
|
|
32
33
|
devflow/core/project.py,sha256=4OnudghY5N5rCOmafWO5Hk68M7T3-mOV0j0k0dh2luE,16891
|
|
33
34
|
devflow/core/recovery.py,sha256=W2If6Ymb3ISwMN8IVQYCwptDUzhxejlF-P2NvMYyZP0,8818
|
|
34
|
-
devflow/core/spec_workflow.py,sha256=
|
|
35
|
+
devflow/core/spec_workflow.py,sha256=ZYBCZD5Xdiw9GVsVp_M2YYzEeFQsF9IXjFEpOpw6Fzs,40013
|
|
35
36
|
devflow/core/specification.py,sha256=wRFrS64YGS6YOMQeNjdD73TlEWaSSs6_mTTg7flRlHQ,64851
|
|
36
37
|
devflow/core/artifacts/__init__.py,sha256=gt9xahPynoxv75FMq1ZJx91ILTIv4ExuvX1Ymrxwr2c,627
|
|
37
38
|
devflow/core/artifacts/errors.py,sha256=hwZxnLFcUTtEjDWtN6rUCkM69EN19LGVlc6HD-pNZyk,493
|
|
38
39
|
devflow/core/artifacts/models.py,sha256=xJjmY8jUAHxqYN9u1JEu8CbJB-IJg1xb9P-LDaP5_Hw,2049
|
|
39
40
|
devflow/core/artifacts/store.py,sha256=ZHAhWAFiqtviwhpfQ0GDkizndpcqtpU0opTbsSJKrWA,4167
|
|
40
|
-
devflow/core/state/__init__.py,sha256=
|
|
41
|
+
devflow/core/state/__init__.py,sha256=FNjS0Qxegx8rAz1gM6hXEV49v_KLeZ6zVDupSo_3CgI,1579
|
|
41
42
|
devflow/core/state/errors.py,sha256=dgF-x4TCxQTXc1OifyT8UZSU-0PBhATjO1x6OTMagac,1017
|
|
42
|
-
devflow/core/state/events.py,sha256=
|
|
43
|
+
devflow/core/state/events.py,sha256=1l_9TijGE2mTw46WEoyguBTKuUrvBBaNpR8PCRlzN8A,22422
|
|
43
44
|
devflow/core/state/locator.py,sha256=WD_T_a6QiXpAipKeCUm_Y72r7OcthzUnVaulXFRLqZ0,3177
|
|
44
45
|
devflow/core/state/lock.py,sha256=94llvwHtCc5WOw-Uq8kDCu4iOBpRM4ccp6Q6fLZpYZ0,2089
|
|
45
|
-
devflow/core/state/manager.py,sha256=
|
|
46
|
+
devflow/core/state/manager.py,sha256=o4Qo2C3pJOpOS6Id-NB4hNeKbvvoTDwbf6E2Jv_j-pE,31876
|
|
46
47
|
devflow/core/state/models.py,sha256=4GTrS34ymbJIyBeZkcCi0z0e1bsq67vdxRSnSQ9O3gc,4654
|
|
47
48
|
devflow/core/state/transitions.py,sha256=Go0zLhxcujWhaZEGg7JMqcC_UJU_nEFEBbpKIqrCtrs,3581
|
|
48
49
|
devflow/models/__init__.py,sha256=hXX3IDZbHgklmuzVVlpiRs5SSPnrkO5kN1-k2hIEk7E,156
|
|
@@ -58,12 +59,12 @@ devflow/profiles/django-backend/profile.yaml,sha256=SNj7a3yamdJx-P69GvIJmLkC2svO
|
|
|
58
59
|
devflow/profiles/django-backend/constitution/django-standards.md,sha256=0M-XmxOpEmgIadcaVdf6OVmll8Oec0jEjcJ4C8MfwhQ,2052
|
|
59
60
|
devflow/profiles/fastapi-backend/profile.yaml,sha256=5_b-zWSX0HV-tw_2ntRCSa4DyP3NUqYWmxOh55pXYmc,321
|
|
60
61
|
devflow/profiles/fastapi-backend/constitution/fastapi-standards.md,sha256=iFKib4i_9z4wBQ9thl-uftg5g-CHwvmFWzMtLgA7CBk,1949
|
|
61
|
-
devflow/prompts/__init__.py,sha256=
|
|
62
|
+
devflow/prompts/__init__.py,sha256=dxPxXzY5qECes_c1RuoIfIGKcdkCwg1RLGAolled1o8,17454
|
|
62
63
|
devflow/prompts/discovery-repair.md,sha256=YfTfrrw5uUZvC_x6X2lrYEDkMNhanhoe0ER3Yc2-rgI,1135
|
|
63
|
-
devflow/prompts/discovery.md,sha256=
|
|
64
|
+
devflow/prompts/discovery.md,sha256=9ON-NvkXTSZWwia12NqY6TU9Z9yc68oqhpiFURAHSoU,11557
|
|
64
65
|
devflow/prompts/spec.md,sha256=ZbZXS_76mWqihqRD4BeHpCc62Rbqoeb-F9XmkKL3_ww,7153
|
|
65
|
-
devflow_toolkit-0.3.
|
|
66
|
-
devflow_toolkit-0.3.
|
|
67
|
-
devflow_toolkit-0.3.
|
|
68
|
-
devflow_toolkit-0.3.
|
|
69
|
-
devflow_toolkit-0.3.
|
|
66
|
+
devflow_toolkit-0.3.22.dist-info/METADATA,sha256=cgK-ggOfjyYPqgHKSZg6N6X0cxZkcfZCH_xFVd9PJkI,46584
|
|
67
|
+
devflow_toolkit-0.3.22.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
68
|
+
devflow_toolkit-0.3.22.dist-info/entry_points.txt,sha256=wPmqE1081vi8s3xf-Wfzfvpl-44IKgwx7OGoLEK3u7o,44
|
|
69
|
+
devflow_toolkit-0.3.22.dist-info/licenses/LICENSE,sha256=Wa04lstC8Goe4b9IYfEYWB2k7nokYBejZl6NdyAl8rA,1077
|
|
70
|
+
devflow_toolkit-0.3.22.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|