devflow-toolkit 0.3.2__py3-none-any.whl → 0.3.3__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/cli.py CHANGED
@@ -35,7 +35,7 @@ def version() -> None:
35
35
  try:
36
36
  current_version = package_version("devflow-toolkit")
37
37
  except PackageNotFoundError:
38
- current_version = "0.3.2"
38
+ current_version = "0.3.3"
39
39
  console.print(f"DevFlow v{current_version}")
40
40
 
41
41
 
@@ -57,7 +57,7 @@ def _approve(spec_id: str, path: Path, stage: str) -> None:
57
57
  normalized = stage.strip().lower()
58
58
  if normalized != "spec":
59
59
  msg = (
60
- f"Stage '{stage}' is not available in DevFlow 0.3.2. "
60
+ f"Stage '{stage}' is not available in DevFlow 0.3.3. "
61
61
  "Only the 'spec' stage can be approved."
62
62
  )
63
63
  raise UnsupportedStageError(msg)
@@ -91,6 +91,18 @@ def _doctor(spec_id: str, path: Path) -> bool:
91
91
  "[bold]Next:[/bold] "
92
92
  f"devflow recover {location.spec_id} {root}"
93
93
  )
94
+ elif inspection.can_resume:
95
+ console.print(
96
+ "\n[bold yellow]Diagnosis: Discovery is complete but the "
97
+ "specification is missing.[/bold yellow]"
98
+ )
99
+ console.print(
100
+ "[bold]Next:[/bold] "
101
+ f"devflow spec --continue {location.spec_id} {root}"
102
+ )
103
+ console.print(
104
+ "[dim]The existing Discovery record will be reused.[/dim]"
105
+ )
94
106
  else:
95
107
  console.print(
96
108
  "\n[bold yellow]Diagnosis: needs attention.[/bold yellow]"
devflow/commands/spec.py CHANGED
@@ -30,6 +30,7 @@ from devflow.core.constitution import ConstitutionError
30
30
  from devflow.core.discovery import DiscoveryError
31
31
  from devflow.core.profile_manager import ProfileError
32
32
  from devflow.core.project import ProjectDetector
33
+ from devflow.core.recovery import ensure_resumable_state
33
34
  from devflow.core.spec_workflow import (
34
35
  SpecWorkflow,
35
36
  SpecWorkflowRequest,
@@ -103,6 +104,15 @@ def spec(
103
104
  "Defaults to the configured language."
104
105
  ),
105
106
  ),
107
+ auto: bool = typer.Option(
108
+ False,
109
+ "--auto",
110
+ help=(
111
+ "Run Discovery and Specification in one invocation. By default an "
112
+ "interactive run stops after Discovery so you can choose the "
113
+ "specification harness."
114
+ ),
115
+ ),
106
116
  ) -> None:
107
117
  """Generate or resume a specification for a change request."""
108
118
  try:
@@ -115,6 +125,7 @@ def spec(
115
125
  project_mode,
116
126
  continue_id,
117
127
  language,
128
+ auto,
118
129
  )
119
130
  except (
120
131
  ArchitectureError,
@@ -142,6 +153,7 @@ def _create_specification(
142
153
  project_mode: Optional[str],
143
154
  continue_id: Optional[str],
144
155
  language: Optional[str] = None,
156
+ auto: bool = False,
145
157
  ) -> None:
146
158
  request = (description or "").strip()
147
159
  resume = (continue_id or "").strip() or None
@@ -199,6 +211,13 @@ def _create_specification(
199
211
  )
200
212
  adapter = adapter_for(selected_harness) if selected_harness else None
201
213
 
214
+ stop_after_discovery = (
215
+ not auto
216
+ and resume is None
217
+ and selected_harness is not None
218
+ and execution_mode == "interactive"
219
+ )
220
+
202
221
  workflow = SpecWorkflow(executor=execute_invocation)
203
222
  result = workflow.run(
204
223
  SpecWorkflowRequest(
@@ -210,6 +229,7 @@ def _create_specification(
210
229
  project_mode=effective_project_mode,
211
230
  continue_spec_id=resume,
212
231
  language=documentation_language,
232
+ stop_after_discovery=stop_after_discovery,
213
233
  )
214
234
  )
215
235
 
@@ -243,7 +263,25 @@ def _create_specification(
243
263
  print_setup_result(result.setup_result, config.root, console)
244
264
  _print_warnings(list(result.run_warnings))
245
265
 
246
- if result.blocked:
266
+ if result.stopped_after_discovery:
267
+ stopped = WorkflowLocator(
268
+ config.specifications_path
269
+ ).from_directory(result.directory)
270
+ console.print(
271
+ "\n[bold green]Discovery complete.[/bold green] "
272
+ "The specification was not generated."
273
+ )
274
+ next_command = (
275
+ f"devflow spec --continue {stopped.spec_id} ."
276
+ )
277
+ if selected_harness is not None:
278
+ next_command += f" --harness {selected_harness}"
279
+ console.print(f"[bold]Next:[/bold] {next_command}")
280
+ console.print(
281
+ "[dim]Choose another harness with --harness, or run both phases "
282
+ "in one invocation with --auto.[/dim]"
283
+ )
284
+ elif result.blocked:
247
285
  _print_blocked(result=result, config=config)
248
286
  elif result.spec_reused and result.spec is not None:
249
287
  console.print(
@@ -272,6 +310,7 @@ def _ensure_continuable(config: DevFlowConfig, selector: str) -> None:
272
310
  project_root=config.root,
273
311
  )
274
312
  location = WorkflowLocator(config.specifications_path).find(selector)
313
+ ensure_resumable_state(config, location)
275
314
  state = manager.load(location)
276
315
  allowed = {
277
316
  WorkflowStatus.DRAFT.value,
devflow/core/recovery.py CHANGED
@@ -55,6 +55,17 @@ class ChangeInspection:
55
55
  and not self.orphans
56
56
  )
57
57
 
58
+ @property
59
+ def can_resume(self) -> bool:
60
+ """Return whether Discovery is complete but the spec is missing."""
61
+ return (
62
+ not self.events_present
63
+ and not self.workflow_present
64
+ and self.discovery_present
65
+ and self.discovery_complete
66
+ and not self.spec_present
67
+ )
68
+
58
69
 
59
70
  @dataclass(frozen=True)
60
71
  class RecoveryResult:
@@ -181,6 +192,40 @@ def inspect_change(
181
192
  )
182
193
 
183
194
 
195
+ def ensure_resumable_state(
196
+ config: DevFlowConfig,
197
+ location: ChangeLocation,
198
+ ) -> bool:
199
+ """Create missing workflow state so ``spec --continue`` can resume.
200
+
201
+ Discovery is registered with its current digest. The specification is
202
+ not required or created. Returns ``True`` when state was created.
203
+ """
204
+ if location.events_path.is_file() or location.workflow_path.is_file():
205
+ return False
206
+ discovery_path = location.directory / "discovery.yaml"
207
+ if not discovery_path.is_file():
208
+ return False
209
+
210
+ inspection = inspect_change(config, location)
211
+ manager = WorkflowStateManager(
212
+ config.specifications_path,
213
+ project_root=config.root,
214
+ )
215
+ manager.initialize_change(location.directory)
216
+ location = WorkflowLocator(config.specifications_path).from_directory(
217
+ location.directory
218
+ )
219
+ manager.record_artifact(
220
+ location,
221
+ stage="discovery",
222
+ path=discovery_path,
223
+ validated=inspection.discovery_complete,
224
+ source="existing",
225
+ )
226
+ return True
227
+
228
+
184
229
  def recover_change(
185
230
  config: DevFlowConfig,
186
231
  location: ChangeLocation,
@@ -65,6 +65,7 @@ class SpecWorkflowRequest:
65
65
  project_mode: str = "existing"
66
66
  continue_spec_id: str | None = None
67
67
  language: str = ""
68
+ stop_after_discovery: bool = False
68
69
 
69
70
 
70
71
  @dataclass(frozen=True)
@@ -92,6 +93,7 @@ class SpecWorkflowResult:
92
93
  spec_reused: bool = False
93
94
  continuation: bool = False
94
95
  directory: Path | None = None
96
+ stopped_after_discovery: bool = False
95
97
 
96
98
 
97
99
  class SpecWorkflow:
@@ -349,6 +351,32 @@ class SpecWorkflow:
349
351
  directory=prepared.directory,
350
352
  )
351
353
 
354
+ if request.stop_after_discovery:
355
+ return self._build_result(
356
+ spec=None,
357
+ harness_name=(
358
+ adapter.display_name if adapter is not None else None
359
+ ),
360
+ execution_mode=request.execution_mode,
361
+ warnings=warnings,
362
+ run_warnings=[],
363
+ setup_result=setup_result,
364
+ constitution=constitution,
365
+ project_mode=project_mode,
366
+ architecture=architecture,
367
+ discovery=discovery,
368
+ discovery_digest=discovery_digest,
369
+ discovery_path=discovery_path,
370
+ discovery_source=discovery_source,
371
+ discovery_created=discovery_created,
372
+ blocked=False,
373
+ spec_written=False,
374
+ spec_reused=False,
375
+ continuation=continuation,
376
+ directory=prepared.directory,
377
+ stopped_after_discovery=True,
378
+ )
379
+
352
380
  reused_spec = self._reusable_spec(
353
381
  prepared=prepared,
354
382
  continuation=continuation,
@@ -902,6 +930,7 @@ class SpecWorkflow:
902
930
  spec_reused: bool,
903
931
  continuation: bool,
904
932
  directory: Path,
933
+ stopped_after_discovery: bool = False,
905
934
  ) -> SpecWorkflowResult:
906
935
  return SpecWorkflowResult(
907
936
  spec=spec,
@@ -927,6 +956,7 @@ class SpecWorkflow:
927
956
  spec_reused=spec_reused,
928
957
  continuation=continuation,
929
958
  directory=directory,
959
+ stopped_after_discovery=stopped_after_discovery,
930
960
  )
931
961
 
932
962
  @staticmethod
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Specification workflow toolkit for AI-assisted software changes
5
5
  Author: DevFlow contributors
6
6
  License-Expression: MIT
@@ -42,7 +42,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
42
42
  selected agent harness is only the execution backend that drafts the
43
43
  specification.
44
44
 
45
- This is the `0.3.2` MVP. It implements the **discovery and
45
+ This is the `0.3.3` MVP. It implements the **discovery and
46
46
  specification stages only**. It supports two specification contexts:
47
47
  **Existing Project** (the default) and **Greenfield**. It is not a
48
48
  complete SDD platform and does not include planning, implementation or
@@ -114,7 +114,7 @@ pip install devflow-toolkit
114
114
  To install a specific built artifact instead:
115
115
 
116
116
  ```bash
117
- pip install devflow_toolkit-0.3.2-py3-none-any.whl
117
+ pip install devflow_toolkit-0.3.3-py3-none-any.whl
118
118
  ```
119
119
 
120
120
  Verify the installation:
@@ -278,7 +278,7 @@ as an architectural constraint when it is present.
278
278
 
279
279
  ### Harnesses
280
280
 
281
- | Harness | Status in 0.3.2 |
281
+ | Harness | Status in 0.3.3 |
282
282
  | --- | --- |
283
283
  | OpenCode | Verified end-to-end in non-interactive mode |
284
284
  | Codex | Integration files are generated, but not verified for this release |
@@ -412,7 +412,7 @@ require Discovery.
412
412
  8. If artifacts exist without workflow state, diagnose with
413
413
  `devflow doctor <id>` and repair with `devflow recover <id>`.
414
414
 
415
- Available commands in `0.3.2`:
415
+ Available commands in `0.3.3`:
416
416
 
417
417
  | Command | Status |
418
418
  | --- | --- |
@@ -453,12 +453,32 @@ The command:
453
453
  5. writes the deterministic evidence or declared architecture to
454
454
  `context.md`;
455
455
  6. stops without `spec.md` when a blocking decision remains;
456
- 7. if Discovery is complete, invokes the selected harness with the
457
- shared DevFlow prompt, validates the returned specification, and
456
+ 7. in an interactive run, stops after Discovery is complete and prints
457
+ the next command, so you can choose the harness for the
458
+ specification;
459
+ 8. on `--continue` (or with `--auto`) invokes the selected harness with
460
+ the specification prompt, validates the returned specification, and
458
461
  binds it to the Discovery digest;
459
- 8. writes `spec.md` and registers the Discovery and specification
462
+ 9. writes `spec.md` and registers the Discovery and specification
460
463
  digests in the event log and the workflow projection.
461
464
 
465
+ An interactive `devflow spec` therefore uses two harness invocations:
466
+ one for Discovery and one for the specification. The first run stops at
467
+ the Discovery checkpoint. The second run resumes with the harness you
468
+ choose:
469
+
470
+ ```bash
471
+ devflow spec "Add a GET /patients endpoint"
472
+ devflow spec --continue 006 . --harness opencode
473
+ ```
474
+
475
+ Use `--auto` to run both phases in a single invocation, as earlier
476
+ releases did:
477
+
478
+ ```bash
479
+ devflow spec "Add a GET /patients endpoint" --auto
480
+ ```
481
+
462
482
  Resume an existing change:
463
483
 
464
484
  ```bash
@@ -469,7 +489,10 @@ devflow spec --continue 006
469
489
  and project mode, loads Discovery, and stops until blocking decisions
470
490
  are resolved. It reuses a current validated specification when the
471
491
  Discovery digest still matches; otherwise it archives the old
472
- specification and generates a new one.
492
+ specification and generates a new one. If an interrupted run left a
493
+ complete `discovery.yaml` without `workflow.yaml`, `--continue` creates
494
+ the missing state and registers Discovery before generating the
495
+ specification.
473
496
 
474
497
  For an existing project, DevFlow inspects relevant code and
475
498
  dependencies. For Greenfield, it uses the declared architecture and
@@ -479,13 +502,18 @@ Useful options:
479
502
 
480
503
  ```bash
481
504
  devflow spec "Description" --harness opencode --mode non-interactive
505
+ devflow spec "Description" --auto
482
506
  devflow spec "Description" --no-agent
483
507
  devflow spec "Description" --language es
484
508
  devflow spec "Change in a real project" --project-mode existing
485
509
  devflow spec "Create a new service" --project-mode greenfield
486
- devflow spec --continue 006
510
+ devflow spec --continue 006 --harness opencode
487
511
  ```
488
512
 
513
+ `--auto` keeps the older one-shot flow: Discovery and the specification
514
+ run in the same invocation. Without it, an interactive run stops at the
515
+ Discovery checkpoint.
516
+
489
517
  `spec --language <code>` overrides the configured language for that run
490
518
  without changing `.devflow/config.yaml`. The deterministic `--no-agent`
491
519
  draft remains in English; the language setting applies to specifications
@@ -524,6 +552,17 @@ devflow doctor 001
524
552
  `doctor` checks the workflow, Discovery and specification, reports
525
553
  orphan artifacts, and exits non-zero when the change is unhealthy.
526
554
 
555
+ If Discovery is complete but the specification is missing (for example,
556
+ an interrupted interactive run), `doctor` prints the resume command:
557
+
558
+ ```bash
559
+ devflow spec --continue 001
560
+ ```
561
+
562
+ `--continue` creates the missing workflow state, registers the existing
563
+ Discovery digest and generates the specification without repeating
564
+ Discovery.
565
+
527
566
  If `discovery.yaml` is complete and `spec.md` is structurally valid,
528
567
  register the existing artifacts without regenerating them:
529
568
 
@@ -554,7 +593,7 @@ devflow approve 001 --stage spec
554
593
  ```
555
594
 
556
595
  Approval is explicit and binds the decision to the current artifact
557
- digests. For a `0.3.2` change it binds `spec.md`, `discovery.yaml` and,
596
+ digests. For a `0.3.3` change it binds `spec.md`, `discovery.yaml` and,
558
597
  when a manifest applies, the architecture manifest digest. Repeating the
559
598
  same approval is a no-op. If an artifact changes after validation,
560
599
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -564,7 +603,7 @@ Discovery must be complete before approval. If it is not, approval fails
564
603
  and names the pending questions and assumptions. Legacy `0.2.0` changes
565
604
  without `discovery.yaml` remain approvable with a warning.
566
605
 
567
- Only the `spec` stage is available in `0.3.2`. `--stage plan` and
606
+ Only the `spec` stage is available in `0.3.3`. `--stage plan` and
568
607
  `--stage review` are rejected. There are no `plan`, `implement` or
569
608
  `review` commands in this release.
570
609
 
@@ -1,5 +1,5 @@
1
1
  devflow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- devflow/cli.py,sha256=V1G0D8yMDYeEtLoU7E0W_mbpw0CkqeVBmT61Ftt-kt0,1168
2
+ devflow/cli.py,sha256=bRixXdFKqRPQENKs5FMfGFlWJEQDp0E-jMQPvdPiR-g,1168
3
3
  devflow/adapters/__init__.py,sha256=WcsjXQTKzHNzMAHx82-sdJQeR3ceHRVqLWTUtRlaraE,867
4
4
  devflow/adapters/agents.py,sha256=4d54hDfBgnIP4zOKcZqAG-Qa-jfuuxzFL-akZS2qYtw,1309
5
5
  devflow/adapters/base.py,sha256=YggY_IwHExdybl5S9NjwZSlmmcw9Y6z7DhQsl3JLvXs,2055
@@ -11,12 +11,12 @@ devflow/adapters/kiro.py,sha256=8l5y7ZYffg_T9eciM28NKGHil_zgdT96mAdYK4oBZ0U,6111
11
11
  devflow/adapters/opencode.py,sha256=DonmvAKyWK2v5-X2XrL0n2iptFp7qLgOlh-X8n_8I-w,6492
12
12
  devflow/adapters/registry.py,sha256=NLd_tf7dAiZUa6gbQFcwPogurZyjbMNbzjjXozAD4xs,1177
13
13
  devflow/commands/__init__.py,sha256=yOLtd_4R4xdlMgAzihzIT35oyV_qcz0br-aoLebRj1c,157
14
- devflow/commands/approve.py,sha256=h9X6noFrjxWFIQfJ7lVvLfIb0jaxDduFm1xwL5VaREQ,2740
15
- devflow/commands/doctor.py,sha256=7LQMl26arw-ofoET8BL18_AcBpIniapYDrVPhCb_Mik,3791
14
+ devflow/commands/approve.py,sha256=TXjMLopcN1qOgwCfhjMzAWt-bfdUeHoBo19fwGniEic,2740
15
+ devflow/commands/doctor.py,sha256=vYk2i3OksbGpHEUFsqi7c4w44mAXRmY0OeEdO8h5j_M,4161
16
16
  devflow/commands/harness.py,sha256=r_RSAi7gXK8QNucC6eV-RzXHJycmmR03dzihqLVgdiU,2791
17
17
  devflow/commands/init.py,sha256=B-rW-etZ-Rptt9YW43YZ5mN_l3gfGczuXW9kpmHDOWQ,15420
18
18
  devflow/commands/recover.py,sha256=sV9x5-30E_3XRBe7JItDiSG-pqrowRzjqOkC_eyrhFQ,2165
19
- devflow/commands/spec.py,sha256=_h2-QIXxVME2iPPD9mIk6uabPnkQTdXwK9dfqp_cDZ0,14558
19
+ devflow/commands/spec.py,sha256=gK0wsvpJk5xNqMlZLQnKEJU9CEKtV2g5Vbw6-iR6Kuw,15775
20
20
  devflow/commands/status.py,sha256=HtBCIF8U0bmkyS6wS7IEvggo89FzGRGBCsFfPrKzLpU,4369
21
21
  devflow/core/__init__.py,sha256=hN7i4-PDaZ7y4P8qRpZl_lJvIiPyQaN1TDGnw2BecYU,427
22
22
  devflow/core/architecture.py,sha256=qllllsUVqA76LiSU6z_s4U8dxMcs6ClKXU16HxI3yOI,13692
@@ -27,8 +27,8 @@ devflow/core/discovery.py,sha256=xFlY9aLLs8NgJGe13PmjYIB8dibUgOv1i6e8i5QG650,352
27
27
  devflow/core/ports.py,sha256=R6ybjAdJEdtTKFc4FMFTX0TVwRfDwPoWCsu-BHrhI5A,4071
28
28
  devflow/core/profile_manager.py,sha256=QnnJka2KIKD2tCSWJkGTOUEFMgmQT0Z9Qv173JKWKHw,8937
29
29
  devflow/core/project.py,sha256=SINU6KSRIpX5rPlPy8nWMfQuHas_VF1bAIVafhbcgCg,13330
30
- devflow/core/recovery.py,sha256=n_-sOc7SAwzMajlXBIJiJ9MX8xx56yd88g3bl300BSA,7535
31
- devflow/core/spec_workflow.py,sha256=uCpvImVIL7kVyVjUsiePccSy3RNw9jX6Pj06r47gCao,28534
30
+ devflow/core/recovery.py,sha256=W2If6Ymb3ISwMN8IVQYCwptDUzhxejlF-P2NvMYyZP0,8818
31
+ devflow/core/spec_workflow.py,sha256=Fnvdc-izYL6ncfLORN-7av_NzILnjhzHTeTFEvdSr0Y,29532
32
32
  devflow/core/specification.py,sha256=aHAL_U8Tl0YBokUJKneqUyCPenY6xtcPlZUgKmUsEMw,65719
33
33
  devflow/core/artifacts/__init__.py,sha256=gt9xahPynoxv75FMq1ZJx91ILTIv4ExuvX1Ymrxwr2c,627
34
34
  devflow/core/artifacts/errors.py,sha256=hwZxnLFcUTtEjDWtN6rUCkM69EN19LGVlc6HD-pNZyk,493
@@ -59,8 +59,8 @@ devflow/prompts/__init__.py,sha256=j30n28MIIGJtTV-9jAutke0icTj5WXJbfUBYbQUA_QI,7
59
59
  devflow/prompts/discovery.md,sha256=rwuCgD70yhFCw3MbygPr5jOxGof2_naKcKUVOlvmRRc,3716
60
60
  devflow/prompts/spec.greenfield.md,sha256=HEq2_rC-Aom9XFzYyyHdtedSECJe0aK8jz5WbNLL5MY,4724
61
61
  devflow/prompts/spec.md,sha256=b1cVZNlOG197JxhMZlL5xA1sThDPsCDcAuLTrmkXzBk,3392
62
- devflow_toolkit-0.3.2.dist-info/METADATA,sha256=sGdZiE4WRYSyz5FXtBmjl1_14mdBxMz5-69T1A6Psz4,24573
63
- devflow_toolkit-0.3.2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
- devflow_toolkit-0.3.2.dist-info/entry_points.txt,sha256=wPmqE1081vi8s3xf-Wfzfvpl-44IKgwx7OGoLEK3u7o,44
65
- devflow_toolkit-0.3.2.dist-info/licenses/LICENSE,sha256=Wa04lstC8Goe4b9IYfEYWB2k7nokYBejZl6NdyAl8rA,1077
66
- devflow_toolkit-0.3.2.dist-info/RECORD,,
62
+ devflow_toolkit-0.3.3.dist-info/METADATA,sha256=6SsIsm-iO4-dbhTYkYOG6A_kFD__LiafQvenpNZPB7M,25936
63
+ devflow_toolkit-0.3.3.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
64
+ devflow_toolkit-0.3.3.dist-info/entry_points.txt,sha256=wPmqE1081vi8s3xf-Wfzfvpl-44IKgwx7OGoLEK3u7o,44
65
+ devflow_toolkit-0.3.3.dist-info/licenses/LICENSE,sha256=Wa04lstC8Goe4b9IYfEYWB2k7nokYBejZl6NdyAl8rA,1077
66
+ devflow_toolkit-0.3.3.dist-info/RECORD,,