devflow-toolkit 0.3.2__tar.gz → 0.3.3__tar.gz

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 (77) hide show
  1. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/CHANGELOG.md +20 -0
  2. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/PKG-INFO +51 -12
  3. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/README.md +50 -11
  4. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/pyproject.toml +1 -1
  5. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/cli.py +1 -1
  6. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/approve.py +1 -1
  7. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/doctor.py +12 -0
  8. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/spec.py +40 -1
  9. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/recovery.py +45 -0
  10. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/spec_workflow.py +30 -0
  11. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_harness_adapters.py +66 -0
  12. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_recovery.py +44 -0
  13. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_spec_workflow.py +27 -0
  14. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/.gitignore +0 -0
  15. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/LICENSE +0 -0
  16. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/__init__.py +0 -0
  17. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/__init__.py +0 -0
  18. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/agents.py +0 -0
  19. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/base.py +0 -0
  20. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/claude_code.py +0 -0
  21. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/codex.py +0 -0
  22. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/detector.py +0 -0
  23. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/instructions.py +0 -0
  24. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/kiro.py +0 -0
  25. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/opencode.py +0 -0
  26. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/adapters/registry.py +0 -0
  27. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/__init__.py +0 -0
  28. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/harness.py +0 -0
  29. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/init.py +0 -0
  30. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/recover.py +0 -0
  31. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/commands/status.py +0 -0
  32. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/__init__.py +0 -0
  33. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/architecture.py +0 -0
  34. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/artifacts/__init__.py +0 -0
  35. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/artifacts/errors.py +0 -0
  36. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/artifacts/models.py +0 -0
  37. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/artifacts/store.py +0 -0
  38. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/clock.py +0 -0
  39. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/config.py +0 -0
  40. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/constitution.py +0 -0
  41. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/discovery.py +0 -0
  42. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/ports.py +0 -0
  43. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/profile_manager.py +0 -0
  44. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/project.py +0 -0
  45. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/specification.py +0 -0
  46. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/__init__.py +0 -0
  47. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/errors.py +0 -0
  48. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/events.py +0 -0
  49. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/locator.py +0 -0
  50. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/lock.py +0 -0
  51. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/manager.py +0 -0
  52. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/models.py +0 -0
  53. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/core/state/transitions.py +0 -0
  54. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/models/__init__.py +0 -0
  55. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/models/profile.py +0 -0
  56. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/models/project.py +0 -0
  57. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  58. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  59. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  60. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  61. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  62. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/base/profile.yaml +0 -0
  63. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  64. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  65. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  66. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  67. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/prompts/__init__.py +0 -0
  68. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/prompts/discovery.md +0 -0
  69. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/prompts/spec.greenfield.md +0 -0
  70. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/src/devflow/prompts/spec.md +0 -0
  71. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_cli.py +0 -0
  72. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_discovery.py +0 -0
  73. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_event_log.py +0 -0
  74. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_greenfield.py +0 -0
  75. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_hardening.py +0 -0
  76. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_state.py +0 -0
  77. {devflow_toolkit-0.3.2 → devflow_toolkit-0.3.3}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.3 - 2026-11-04
6
+
7
+ ### Added
8
+
9
+ - Interactive `devflow spec` now stops after Discovery with a visible
10
+ checkpoint. It prints the exact `devflow spec --continue <id>
11
+ --harness <name>` command so the specification can run with a
12
+ different harness.
13
+ - `--auto` preserves the previous one-shot behavior: Discovery and the
14
+ specification run in the same invocation.
15
+ - `devflow doctor` now suggests `devflow spec --continue <id>` when
16
+ Discovery is complete but `spec.md` is missing.
17
+
18
+ ### Changed
19
+
20
+ - `devflow spec --continue` creates missing workflow state when a
21
+ complete `discovery.yaml` exists. An interrupted run no longer blocks
22
+ resume with "No workflow state found".
23
+ - Package version is `0.3.3`.
24
+
5
25
  ## 0.3.2 - 2026-11-03
6
26
 
7
27
  ### Added
@@ -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
 
@@ -10,7 +10,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
10
10
  selected agent harness is only the execution backend that drafts the
11
11
  specification.
12
12
 
13
- This is the `0.3.2` MVP. It implements the **discovery and
13
+ This is the `0.3.3` MVP. It implements the **discovery and
14
14
  specification stages only**. It supports two specification contexts:
15
15
  **Existing Project** (the default) and **Greenfield**. It is not a
16
16
  complete SDD platform and does not include planning, implementation or
@@ -82,7 +82,7 @@ pip install devflow-toolkit
82
82
  To install a specific built artifact instead:
83
83
 
84
84
  ```bash
85
- pip install devflow_toolkit-0.3.2-py3-none-any.whl
85
+ pip install devflow_toolkit-0.3.3-py3-none-any.whl
86
86
  ```
87
87
 
88
88
  Verify the installation:
@@ -246,7 +246,7 @@ as an architectural constraint when it is present.
246
246
 
247
247
  ### Harnesses
248
248
 
249
- | Harness | Status in 0.3.2 |
249
+ | Harness | Status in 0.3.3 |
250
250
  | --- | --- |
251
251
  | OpenCode | Verified end-to-end in non-interactive mode |
252
252
  | Codex | Integration files are generated, but not verified for this release |
@@ -380,7 +380,7 @@ require Discovery.
380
380
  8. If artifacts exist without workflow state, diagnose with
381
381
  `devflow doctor <id>` and repair with `devflow recover <id>`.
382
382
 
383
- Available commands in `0.3.2`:
383
+ Available commands in `0.3.3`:
384
384
 
385
385
  | Command | Status |
386
386
  | --- | --- |
@@ -421,12 +421,32 @@ The command:
421
421
  5. writes the deterministic evidence or declared architecture to
422
422
  `context.md`;
423
423
  6. stops without `spec.md` when a blocking decision remains;
424
- 7. if Discovery is complete, invokes the selected harness with the
425
- shared DevFlow prompt, validates the returned specification, and
424
+ 7. in an interactive run, stops after Discovery is complete and prints
425
+ the next command, so you can choose the harness for the
426
+ specification;
427
+ 8. on `--continue` (or with `--auto`) invokes the selected harness with
428
+ the specification prompt, validates the returned specification, and
426
429
  binds it to the Discovery digest;
427
- 8. writes `spec.md` and registers the Discovery and specification
430
+ 9. writes `spec.md` and registers the Discovery and specification
428
431
  digests in the event log and the workflow projection.
429
432
 
433
+ An interactive `devflow spec` therefore uses two harness invocations:
434
+ one for Discovery and one for the specification. The first run stops at
435
+ the Discovery checkpoint. The second run resumes with the harness you
436
+ choose:
437
+
438
+ ```bash
439
+ devflow spec "Add a GET /patients endpoint"
440
+ devflow spec --continue 006 . --harness opencode
441
+ ```
442
+
443
+ Use `--auto` to run both phases in a single invocation, as earlier
444
+ releases did:
445
+
446
+ ```bash
447
+ devflow spec "Add a GET /patients endpoint" --auto
448
+ ```
449
+
430
450
  Resume an existing change:
431
451
 
432
452
  ```bash
@@ -437,7 +457,10 @@ devflow spec --continue 006
437
457
  and project mode, loads Discovery, and stops until blocking decisions
438
458
  are resolved. It reuses a current validated specification when the
439
459
  Discovery digest still matches; otherwise it archives the old
440
- specification and generates a new one.
460
+ specification and generates a new one. If an interrupted run left a
461
+ complete `discovery.yaml` without `workflow.yaml`, `--continue` creates
462
+ the missing state and registers Discovery before generating the
463
+ specification.
441
464
 
442
465
  For an existing project, DevFlow inspects relevant code and
443
466
  dependencies. For Greenfield, it uses the declared architecture and
@@ -447,13 +470,18 @@ Useful options:
447
470
 
448
471
  ```bash
449
472
  devflow spec "Description" --harness opencode --mode non-interactive
473
+ devflow spec "Description" --auto
450
474
  devflow spec "Description" --no-agent
451
475
  devflow spec "Description" --language es
452
476
  devflow spec "Change in a real project" --project-mode existing
453
477
  devflow spec "Create a new service" --project-mode greenfield
454
- devflow spec --continue 006
478
+ devflow spec --continue 006 --harness opencode
455
479
  ```
456
480
 
481
+ `--auto` keeps the older one-shot flow: Discovery and the specification
482
+ run in the same invocation. Without it, an interactive run stops at the
483
+ Discovery checkpoint.
484
+
457
485
  `spec --language <code>` overrides the configured language for that run
458
486
  without changing `.devflow/config.yaml`. The deterministic `--no-agent`
459
487
  draft remains in English; the language setting applies to specifications
@@ -492,6 +520,17 @@ devflow doctor 001
492
520
  `doctor` checks the workflow, Discovery and specification, reports
493
521
  orphan artifacts, and exits non-zero when the change is unhealthy.
494
522
 
523
+ If Discovery is complete but the specification is missing (for example,
524
+ an interrupted interactive run), `doctor` prints the resume command:
525
+
526
+ ```bash
527
+ devflow spec --continue 001
528
+ ```
529
+
530
+ `--continue` creates the missing workflow state, registers the existing
531
+ Discovery digest and generates the specification without repeating
532
+ Discovery.
533
+
495
534
  If `discovery.yaml` is complete and `spec.md` is structurally valid,
496
535
  register the existing artifacts without regenerating them:
497
536
 
@@ -522,7 +561,7 @@ devflow approve 001 --stage spec
522
561
  ```
523
562
 
524
563
  Approval is explicit and binds the decision to the current artifact
525
- digests. For a `0.3.2` change it binds `spec.md`, `discovery.yaml` and,
564
+ digests. For a `0.3.3` change it binds `spec.md`, `discovery.yaml` and,
526
565
  when a manifest applies, the architecture manifest digest. Repeating the
527
566
  same approval is a no-op. If an artifact changes after validation,
528
567
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -532,7 +571,7 @@ Discovery must be complete before approval. If it is not, approval fails
532
571
  and names the pending questions and assumptions. Legacy `0.2.0` changes
533
572
  without `discovery.yaml` remain approvable with a warning.
534
573
 
535
- Only the `spec` stage is available in `0.3.2`. `--stage plan` and
574
+ Only the `spec` stage is available in `0.3.3`. `--stage plan` and
536
575
  `--stage review` are rejected. There are no `plan`, `implement` or
537
576
  `review` commands in this release.
538
577
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.2"
7
+ version = "0.3.3"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -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]"
@@ -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,
@@ -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
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import importlib
5
6
  import json
6
7
  import stat
7
8
  import sys
@@ -10,6 +11,8 @@ from pathlib import Path
10
11
  import yaml
11
12
  from typer.testing import CliRunner
12
13
 
14
+ spec_module = importlib.import_module("devflow.commands.spec")
15
+
13
16
  from devflow.adapters.base import RunContext
14
17
  from devflow.adapters.claude_code import ClaudeCodeAdapter
15
18
  from devflow.adapters.codex import CodexAdapter
@@ -434,6 +437,69 @@ def test_spec_runs_fake_codex_and_writes_captured_output(
434
437
  assert not (spec.parent / ".devflow-agent-output.md").exists()
435
438
 
436
439
 
440
+ def test_interactive_spec_stops_after_discovery_and_resumes(
441
+ tmp_path: Path,
442
+ monkeypatch: object,
443
+ ) -> None:
444
+ _project(tmp_path)
445
+ assert _init(tmp_path, "--harness", "codex").exit_code == 0
446
+ fake_bin = tmp_path / "bin"
447
+ fake_bin.mkdir()
448
+ _fake_harness(fake_bin, "codex", VALID_SPEC)
449
+ monkeypatch.setenv("PATH", str(fake_bin))
450
+ original_execution_mode = spec_module._execution_mode
451
+
452
+ def execution_mode(mode: str) -> tuple[str, list[str]]:
453
+ if mode == "interactive":
454
+ return "interactive", []
455
+ return original_execution_mode(mode)
456
+
457
+ monkeypatch.setattr(
458
+ spec_module,
459
+ "_execution_mode",
460
+ execution_mode,
461
+ )
462
+
463
+ result = _spec(
464
+ tmp_path,
465
+ "--harness",
466
+ "codex",
467
+ "--mode",
468
+ "interactive",
469
+ )
470
+
471
+ assert result.exit_code == 0, result.output
472
+ assert "Discovery complete." in result.output
473
+ assert "devflow spec --continue 001" in result.output
474
+ spec = next(
475
+ (tmp_path / ".devflow" / "specs").glob("*/spec.md"),
476
+ None,
477
+ )
478
+ assert spec is None
479
+
480
+ resume = runner.invoke(
481
+ app,
482
+ [
483
+ "spec",
484
+ "--continue",
485
+ "001",
486
+ str(tmp_path),
487
+ "--harness",
488
+ "codex",
489
+ "--mode",
490
+ "non-interactive",
491
+ ],
492
+ )
493
+
494
+ assert resume.exit_code == 0, resume.output
495
+ spec = next(
496
+ (tmp_path / ".devflow" / "specs").glob("*/spec.md")
497
+ )
498
+ assert "Agent generated spec" in spec.read_text(
499
+ encoding="utf-8"
500
+ ), resume.output
501
+
502
+
437
503
  def test_spec_falls_back_when_agent_output_is_invalid(
438
504
  tmp_path: Path,
439
505
  monkeypatch: object,
@@ -115,6 +115,50 @@ def test_recover_registers_existing_artifacts(tmp_path: Path) -> None:
115
115
  assert "Workflow status: spec_approved" in approve_result.output
116
116
 
117
117
 
118
+ def test_doctor_suggests_continue_when_spec_is_missing(
119
+ tmp_path: Path,
120
+ ) -> None:
121
+ _project(tmp_path)
122
+ change = _orphan(tmp_path)
123
+ (change / "spec.md").unlink()
124
+
125
+ result = runner.invoke(
126
+ app,
127
+ ["doctor", change.name, str(tmp_path)],
128
+ )
129
+
130
+ assert result.exit_code == 1
131
+ assert "specification is missing" in result.output
132
+ assert "devflow spec --continue 001" in result.output
133
+
134
+
135
+ def test_continue_bootstraps_state_for_orphaned_discovery(
136
+ tmp_path: Path,
137
+ ) -> None:
138
+ _project(tmp_path)
139
+ change = _orphan(tmp_path)
140
+ (change / "spec.md").unlink()
141
+
142
+ result = runner.invoke(
143
+ app,
144
+ ["spec", "--continue", "001", str(tmp_path), "--no-agent"],
145
+ )
146
+
147
+ assert result.exit_code == 0, result.output
148
+ assert (change / "spec.md").is_file()
149
+ assert (change / "workflow.yaml").is_file()
150
+ assert (change / "events.jsonl").is_file()
151
+
152
+ status_result = runner.invoke(
153
+ app,
154
+ ["status", change.name, str(tmp_path)],
155
+ )
156
+ assert status_result.exit_code == 0, status_result.output
157
+ assert "Status: draft" in status_result.output
158
+ assert "discovery: validated" in status_result.output
159
+ assert "spec: validated" in status_result.output
160
+
161
+
118
162
  def test_recover_is_idempotent(tmp_path: Path) -> None:
119
163
  _project(tmp_path)
120
164
  change = _orphan(tmp_path)
@@ -198,6 +198,7 @@ def _run(
198
198
  adapter: HarnessPort | None = None,
199
199
  executor: FakeExecutor | None = None,
200
200
  mode: str = "non-interactive",
201
+ stop_after_discovery: bool = False,
201
202
  ) -> SpecWorkflowResult:
202
203
  workflow = SpecWorkflow(executor=executor or FakeExecutor())
203
204
  return workflow.run(
@@ -206,6 +207,7 @@ def _run(
206
207
  config=config,
207
208
  execution_mode=mode,
208
209
  adapter=adapter,
210
+ stop_after_discovery=stop_after_discovery,
209
211
  )
210
212
  )
211
213
 
@@ -238,6 +240,31 @@ def test_workflow_uses_port_and_writes_valid_captured_output(
238
240
  ).exists()
239
241
 
240
242
 
243
+ def test_workflow_stops_after_discovery_when_requested(
244
+ tmp_path: Path,
245
+ ) -> None:
246
+ config = _config(tmp_path)
247
+ adapter = FakeAdapter()
248
+
249
+ result = _run(
250
+ config,
251
+ adapter=adapter,
252
+ mode="interactive",
253
+ stop_after_discovery=True,
254
+ )
255
+
256
+ assert result.stopped_after_discovery is True
257
+ assert result.blocked is False
258
+ assert result.spec is None
259
+ assert result.discovery is not None
260
+ assert result.discovery.is_complete
261
+ assert adapter.run_context is None
262
+ assert not (
263
+ tmp_path / ".devflow" / "specs" / "001-add-a-health-endpoint" /
264
+ "spec.md"
265
+ ).exists()
266
+
267
+
241
268
  def test_workflow_falls_back_when_agent_output_is_invalid(
242
269
  tmp_path: Path,
243
270
  ) -> None:
File without changes