devflow-toolkit 0.3.23__tar.gz → 0.3.25__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 (86) hide show
  1. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/CHANGELOG.md +64 -0
  2. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/PKG-INFO +61 -14
  3. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/README.md +21 -5
  4. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/docs/REFERENCE.md +60 -13
  5. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/init.py +68 -0
  7. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/status.py +18 -0
  8. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/discovery.py +27 -26
  9. devflow_toolkit-0.3.25/src/devflow/core/security_tools.py +301 -0
  10. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/spec_workflow.py +100 -7
  11. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/specification.py +89 -5
  12. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/prompts/__init__.py +23 -7
  13. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/prompts/discovery.md +16 -7
  14. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/prompts/spec.md +12 -6
  15. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_discovery.py +5 -3
  16. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_discovery_decisions.py +61 -0
  17. devflow_toolkit-0.3.25/tests/test_security_tools.py +192 -0
  18. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_spec_workflow.py +124 -0
  19. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_state.py +1 -0
  20. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/.gitignore +0 -0
  21. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/LICENSE +0 -0
  22. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/PUBLISHING.md +0 -0
  23. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/__init__.py +0 -0
  24. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/__init__.py +0 -0
  25. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/agents.py +0 -0
  26. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/antigravity.py +0 -0
  27. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/base.py +0 -0
  28. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/claude_code.py +0 -0
  29. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/codex.py +0 -0
  30. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/detector.py +0 -0
  31. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/instructions.py +0 -0
  32. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/kiro.py +0 -0
  33. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/opencode.py +0 -0
  34. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/adapters/registry.py +0 -0
  35. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/cli.py +0 -0
  36. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/__init__.py +0 -0
  37. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/approve.py +0 -0
  38. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/config.py +0 -0
  39. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/doctor.py +0 -0
  40. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/harness.py +0 -0
  41. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/recover.py +0 -0
  42. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/reopen.py +0 -0
  43. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/commands/spec.py +0 -0
  44. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/__init__.py +0 -0
  45. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/architecture.py +0 -0
  46. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/artifacts/__init__.py +0 -0
  47. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/artifacts/errors.py +0 -0
  48. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/artifacts/models.py +0 -0
  49. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/artifacts/store.py +0 -0
  50. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/clock.py +0 -0
  51. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/config.py +0 -0
  52. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/constitution.py +0 -0
  53. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/file_types.py +0 -0
  54. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/ports.py +0 -0
  55. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/profile_manager.py +0 -0
  56. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/project.py +0 -0
  57. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/recovery.py +0 -0
  58. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/__init__.py +0 -0
  59. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/errors.py +0 -0
  60. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/events.py +0 -0
  61. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/locator.py +0 -0
  62. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/lock.py +0 -0
  63. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/manager.py +0 -0
  64. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/models.py +0 -0
  65. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/core/state/transitions.py +0 -0
  66. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/models/__init__.py +0 -0
  67. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/models/profile.py +0 -0
  68. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/models/project.py +0 -0
  69. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  70. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  71. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  72. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  73. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  74. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/base/profile.yaml +0 -0
  75. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  76. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  77. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  78. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  79. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/src/devflow/prompts/discovery-repair.md +0 -0
  80. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_cli.py +0 -0
  81. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_event_log.py +0 -0
  82. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_greenfield.py +0 -0
  83. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_hardening.py +0 -0
  84. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_harness_adapters.py +0 -0
  85. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_recovery.py +0 -0
  86. {devflow_toolkit-0.3.23 → devflow_toolkit-0.3.25}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,70 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.25 - 2026-11-09
6
+
7
+ ### Added
8
+
9
+ - `devflow init` offers local security checks that run on every
10
+ commit, without tokens: Semgrep (Django or Python and OWASP rules),
11
+ Bandit, pip-audit and gitleaks, run by pre-commit. It writes a managed
12
+ `.pre-commit-config.yaml` with pinned revisions, installs `pre-commit`
13
+ when missing and runs `pre-commit install`. `--security-tools` and
14
+ `--no-security-tools` skip the question.
15
+ - `next_level.title` names the suggested specification. Suggestions use
16
+ it instead of the raw option text.
17
+ - `devflow status` shows a short review checklist before approval.
18
+
19
+ ### Changed
20
+
21
+ - Acceptance criteria are plain list items (`- **AC-001:**`) without
22
+ checkboxes; DevFlow removes checkboxes an agent writes. Criteria are
23
+ verified during implementation, not ticked in an approved file.
24
+ - DevFlow writes section 11 itself: how the approval is recorded and
25
+ how to reopen it, in the documentation language. The agent leaves it
26
+ empty.
27
+ - Discovery adds a `next_level` only for a real improvement, never for
28
+ an alternative or a reduction.
29
+ - The specification prompt asks for a one-paragraph summary, no
30
+ repetition across sections and no repeated deferred items in
31
+ section 10.
32
+
33
+ ### Package
34
+
35
+ - Package version is `0.3.25`.
36
+
37
+ ## 0.3.24 - 2026-11-09
38
+
39
+ ### Added
40
+
41
+ - The specification agent can resolve up to 3 missing decisions in its
42
+ own interactive session, with the Discovery rules. The answers are
43
+ recorded in `discovery.yaml` as decisions resolved by the user, and
44
+ DevFlow writes the new Discovery digest into the spec header.
45
+
46
+ ### Changed
47
+
48
+ - The specification agent speaks to the user, and writes the questions
49
+ it adds, in the configured language.
50
+ - Completeness is always derived from the decisions: a record marked
51
+ `complete` with pending questions is read as `awaiting_clarification`,
52
+ and a question with `status: awaiting_clarification` or `open` is read
53
+ as `pending`.
54
+ - A `next_level` option marked as recommended is ignored, because the
55
+ recommended option is level 1.
56
+
57
+ ### Fixed
58
+
59
+ - The specification prompt no longer tells the agent to set a question
60
+ status to `awaiting_clarification`.
61
+ - When the specification agent leaves `discovery.yaml` invalid, DevFlow
62
+ no longer writes its deterministic draft. It stops and asks for
63
+ `devflow spec --continue`, which repairs the file.
64
+
65
+ ### Package
66
+
67
+ - Package version is `0.3.24`.
68
+
5
69
  ## 0.3.23 - 2026-11-09
6
70
 
7
71
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.23
3
+ Version: 0.3.25
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.23`.**
35
+ **Current version: `0.3.25`.**
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.23-py3-none-any.whl
155
+ pip install devflow_toolkit-0.3.25-py3-none-any.whl
156
156
  ```
157
157
 
158
158
  Verify the installation:
@@ -315,6 +315,30 @@ error instead of silently switching to deterministic analysis. Pass
315
315
  `--harness none` or `--no-agent` to opt into deterministic output
316
316
  explicitly.
317
317
 
318
+ ### Local security checks
319
+
320
+ `devflow init` offers tools that run locally on every commit, without
321
+ tokens:
322
+
323
+ - Semgrep, with rules for Django (or Python) and OWASP;
324
+ - Bandit, for Python code;
325
+ - pip-audit, for vulnerable dependencies;
326
+ - gitleaks, for secrets in the code.
327
+
328
+ pre-commit (pre-commit.com) runs these tools automatically on every
329
+ commit. In an interactive terminal `init` describes them and asks; use
330
+ `--security-tools` to install them without asking, or
331
+ `--no-security-tools` to skip the offer.
332
+
333
+ Accepting writes a managed `.pre-commit-config.yaml` with pinned hook
334
+ revisions, installs `pre-commit` with pip when it is missing and runs
335
+ `pre-commit install` when the project is a git repository. Only the
336
+ hooks that apply are added: Bandit and pip-audit for Python projects,
337
+ `p/django` rules for Django. An existing, unmanaged
338
+ `.pre-commit-config.yaml` is never overwritten. The first commit
339
+ downloads the tools; `pre-commit run --all-files` checks the whole
340
+ project.
341
+
318
342
  ## Configuration
319
343
 
320
344
  `.devflow/config.yaml` stores project settings. It references the
@@ -428,7 +452,7 @@ as an architectural constraint when it is present.
428
452
 
429
453
  ### Harnesses
430
454
 
431
- | Harness | Status in 0.3.23 |
455
+ | Harness | Status in 0.3.25 |
432
456
  | --- | --- |
433
457
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
434
458
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -684,10 +708,28 @@ specification is generated. `devflow approve` rejects a
684
708
  specification that still lists open questions.
685
709
 
686
710
  In an interactive run the specification agent checks for missing
687
- decisions **before** writing. If one is missing, it appends the question
688
- to `discovery.yaml` and stops without writing `spec.md`, so no tokens are
689
- spent on a document that would be discarded. When an agent lists
690
- questions in section 7, nested bullets stay part of the same question.
711
+ decisions **before** writing:
712
+
713
+ - **Up to 3 missing decisions:** it asks you in the same session, with
714
+ the same rules as Discovery (recommended level-1 option first, a
715
+ next-level option with its reason, security never assumed). Your
716
+ answers are recorded in `discovery.yaml` as decisions resolved by you,
717
+ and then it writes the spec. DevFlow writes the new Discovery digest
718
+ into the spec header, because the agent cannot compute it.
719
+ - **More than 3, or no answer:** it records them as `pending`, sets the
720
+ record to `awaiting_clarification` and stops without writing
721
+ `spec.md`, so no tokens are spent on a document that would be
722
+ discarded.
723
+
724
+ If the agent leaves `discovery.yaml` invalid, DevFlow writes no
725
+ specification and asks you to run `devflow spec --continue`, which
726
+ repairs the file first. When an agent lists questions in section 7,
727
+ nested bullets stay part of the same question.
728
+
729
+ DevFlow derives completeness from the decisions themselves: a record
730
+ marked `complete` with pending questions is treated as
731
+ `awaiting_clarification`, and a question written with
732
+ `status: awaiting_clarification` is read as `pending`.
691
733
 
692
734
  ### Level-based Discovery
693
735
 
@@ -699,8 +741,10 @@ everything at once:
699
741
  2. **Security is always asked, never assumed.** Basic security decisions
700
742
  are explicit questions with a recommended option and a short
701
743
  explanation, so the user learns them by answering.
702
- 3. **Every question offers a next level.** One option takes the decision
703
- one level further. It is recorded in `next_level`:
744
+ 3. **Questions offer a next level when a real improvement exists.** One
745
+ option takes the decision one level further (more secure, capable or
746
+ robust; never a mere alternative or a reduction). It is recorded in
747
+ `next_level`, with a `title` phrased as a future spec request:
704
748
 
705
749
  ```yaml
706
750
  options:
@@ -708,11 +752,14 @@ everything at once:
708
752
  - "Token that expires after 24 hours"
709
753
  next_level:
710
754
  option: "Token that expires after 24 hours"
755
+ title: "Expire login tokens after 24 hours"
711
756
  why: "Limits the damage if a token leaks."
712
757
  ```
713
758
 
714
759
  If the user chooses it, the answer uses that exact text. If not,
715
- DevFlow treats it as a suggestion for a later specification.
760
+ DevFlow suggests `title` (or the option text when there is no title)
761
+ as a later specification. The recommended option is level 1, so a
762
+ `next_level` marked as recommended is ignored.
716
763
  4. **No deeper than this level.** More advanced decisions found along
717
764
  the way, and parts of a large request left for later, are recorded in
718
765
  `deferred`:
@@ -748,7 +795,7 @@ for each item; the agent does not write it.
748
795
  8. If artifacts exist without workflow state, diagnose with
749
796
  `devflow doctor <id>` and repair with `devflow recover <id>`.
750
797
 
751
- Available commands in `0.3.23`:
798
+ Available commands in `0.3.25`:
752
799
 
753
800
  | Command | Status |
754
801
  | --- | --- |
@@ -981,7 +1028,7 @@ devflow approve 001
981
1028
  ```
982
1029
 
983
1030
  Approval is explicit and binds the decision to the current artifact
984
- digests. For a `0.3.23` change it binds `spec.md`, `discovery.yaml` and,
1031
+ digests. For a `0.3.25` change it binds `spec.md`, `discovery.yaml` and,
985
1032
  when a manifest applies, the architecture manifest digest. Repeating the
986
1033
  same approval is a no-op. If an artifact changes after validation,
987
1034
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -992,7 +1039,7 @@ and names the pending questions and assumptions. Approval also rejects a
992
1039
  specification whose section 7 still lists open questions. Legacy `0.2.0`
993
1040
  changes without `discovery.yaml` remain approvable with a warning.
994
1041
 
995
- Only the `spec` stage is available in `0.3.23`, so `--stage` is optional
1042
+ Only the `spec` stage is available in `0.3.25`, so `--stage` is optional
996
1043
  and defaults to `spec`. `--stage plan` and `--stage review` are
997
1044
  rejected. There are no `plan`, `implement` or
998
1045
  `review` commands in this release.
@@ -10,7 +10,7 @@ approved specification instead of a vague chat request.
10
10
  approval live in `.devflow/`, so any agent or teammate can pick up
11
11
  the work.
12
12
 
13
- Current version: `0.3.23` · Python 3.11+ · Linux and macOS
13
+ Current version: `0.3.25` · Python 3.11+ · Linux and macOS
14
14
 
15
15
  ## Install
16
16
 
@@ -52,6 +52,17 @@ devflow init --harness opencode --language es
52
52
  `codex`, `antigravity`, `kiro`). `--language` is the language of the
53
53
  questions and the spec.
54
54
 
55
+ `init` also offers tools that run locally on every commit, without
56
+ tokens:
57
+
58
+ - Semgrep, with rules for Django and OWASP;
59
+ - Bandit, for Python code;
60
+ - pip-audit, for vulnerable dependencies;
61
+ - gitleaks, for secrets in the code.
62
+
63
+ pre-commit (pre-commit.com) runs them automatically on every commit.
64
+ Accept the offer, or add them later with `devflow init --security-tools`.
65
+
55
66
  ### 2. Describe the change
56
67
 
57
68
  ```bash
@@ -76,16 +87,21 @@ devflow spec --continue 001
76
87
  ```
77
88
 
78
89
  Each command opens at most one chat. Run it again if there are pending
79
- questions, and once more to write `spec.md`. Exit the chat only after
80
- the agent says `spec.md` is written.
90
+ questions, and once more to write `spec.md`. If the agent writing the
91
+ spec finds up to 3 missing decisions, it asks you right there and then
92
+ writes the spec. Exit the chat only after the agent says `spec.md` is
93
+ written.
81
94
 
82
95
  Prefer one command for both phases? Add `--auto` to the first command:
83
96
  `devflow spec "Add a contact form" --auto`.
84
97
 
85
98
  ### 4. Review and approve
86
99
 
87
- Read `.devflow/specs/001-…/spec.md`. Section 10.1 lists the suggested
88
- next specs, each with its `devflow spec "..."` command. Then:
100
+ Read `.devflow/specs/001-…/spec.md`. `devflow status 001` shows a short
101
+ review checklist. You don't tick anything in the file: acceptance
102
+ criteria are verified during implementation, and editing an approved
103
+ spec invalidates the approval. Section 10.1 lists the suggested next
104
+ specs, each with its `devflow spec "..."` command. Then:
89
105
 
90
106
  ```bash
91
107
  devflow approve 001
@@ -1,6 +1,6 @@
1
1
  # DevFlow Toolkit
2
2
 
3
- **Current version: `0.3.23`.**
3
+ **Current version: `0.3.25`.**
4
4
 
5
5
  DevFlow is a command-line toolkit for leading AI models and coding
6
6
  agents through specification-driven changes in real software projects.
@@ -120,7 +120,7 @@ pip install devflow-toolkit
120
120
  To install a specific built artifact instead:
121
121
 
122
122
  ```bash
123
- pip install devflow_toolkit-0.3.23-py3-none-any.whl
123
+ pip install devflow_toolkit-0.3.25-py3-none-any.whl
124
124
  ```
125
125
 
126
126
  Verify the installation:
@@ -283,6 +283,30 @@ error instead of silently switching to deterministic analysis. Pass
283
283
  `--harness none` or `--no-agent` to opt into deterministic output
284
284
  explicitly.
285
285
 
286
+ ### Local security checks
287
+
288
+ `devflow init` offers tools that run locally on every commit, without
289
+ tokens:
290
+
291
+ - Semgrep, with rules for Django (or Python) and OWASP;
292
+ - Bandit, for Python code;
293
+ - pip-audit, for vulnerable dependencies;
294
+ - gitleaks, for secrets in the code.
295
+
296
+ pre-commit (pre-commit.com) runs these tools automatically on every
297
+ commit. In an interactive terminal `init` describes them and asks; use
298
+ `--security-tools` to install them without asking, or
299
+ `--no-security-tools` to skip the offer.
300
+
301
+ Accepting writes a managed `.pre-commit-config.yaml` with pinned hook
302
+ revisions, installs `pre-commit` with pip when it is missing and runs
303
+ `pre-commit install` when the project is a git repository. Only the
304
+ hooks that apply are added: Bandit and pip-audit for Python projects,
305
+ `p/django` rules for Django. An existing, unmanaged
306
+ `.pre-commit-config.yaml` is never overwritten. The first commit
307
+ downloads the tools; `pre-commit run --all-files` checks the whole
308
+ project.
309
+
286
310
  ## Configuration
287
311
 
288
312
  `.devflow/config.yaml` stores project settings. It references the
@@ -396,7 +420,7 @@ as an architectural constraint when it is present.
396
420
 
397
421
  ### Harnesses
398
422
 
399
- | Harness | Status in 0.3.23 |
423
+ | Harness | Status in 0.3.25 |
400
424
  | --- | --- |
401
425
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
402
426
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -652,10 +676,28 @@ specification is generated. `devflow approve` rejects a
652
676
  specification that still lists open questions.
653
677
 
654
678
  In an interactive run the specification agent checks for missing
655
- decisions **before** writing. If one is missing, it appends the question
656
- to `discovery.yaml` and stops without writing `spec.md`, so no tokens are
657
- spent on a document that would be discarded. When an agent lists
658
- questions in section 7, nested bullets stay part of the same question.
679
+ decisions **before** writing:
680
+
681
+ - **Up to 3 missing decisions:** it asks you in the same session, with
682
+ the same rules as Discovery (recommended level-1 option first, a
683
+ next-level option with its reason, security never assumed). Your
684
+ answers are recorded in `discovery.yaml` as decisions resolved by you,
685
+ and then it writes the spec. DevFlow writes the new Discovery digest
686
+ into the spec header, because the agent cannot compute it.
687
+ - **More than 3, or no answer:** it records them as `pending`, sets the
688
+ record to `awaiting_clarification` and stops without writing
689
+ `spec.md`, so no tokens are spent on a document that would be
690
+ discarded.
691
+
692
+ If the agent leaves `discovery.yaml` invalid, DevFlow writes no
693
+ specification and asks you to run `devflow spec --continue`, which
694
+ repairs the file first. When an agent lists questions in section 7,
695
+ nested bullets stay part of the same question.
696
+
697
+ DevFlow derives completeness from the decisions themselves: a record
698
+ marked `complete` with pending questions is treated as
699
+ `awaiting_clarification`, and a question written with
700
+ `status: awaiting_clarification` is read as `pending`.
659
701
 
660
702
  ### Level-based Discovery
661
703
 
@@ -667,8 +709,10 @@ everything at once:
667
709
  2. **Security is always asked, never assumed.** Basic security decisions
668
710
  are explicit questions with a recommended option and a short
669
711
  explanation, so the user learns them by answering.
670
- 3. **Every question offers a next level.** One option takes the decision
671
- one level further. It is recorded in `next_level`:
712
+ 3. **Questions offer a next level when a real improvement exists.** One
713
+ option takes the decision one level further (more secure, capable or
714
+ robust; never a mere alternative or a reduction). It is recorded in
715
+ `next_level`, with a `title` phrased as a future spec request:
672
716
 
673
717
  ```yaml
674
718
  options:
@@ -676,11 +720,14 @@ everything at once:
676
720
  - "Token that expires after 24 hours"
677
721
  next_level:
678
722
  option: "Token that expires after 24 hours"
723
+ title: "Expire login tokens after 24 hours"
679
724
  why: "Limits the damage if a token leaks."
680
725
  ```
681
726
 
682
727
  If the user chooses it, the answer uses that exact text. If not,
683
- DevFlow treats it as a suggestion for a later specification.
728
+ DevFlow suggests `title` (or the option text when there is no title)
729
+ as a later specification. The recommended option is level 1, so a
730
+ `next_level` marked as recommended is ignored.
684
731
  4. **No deeper than this level.** More advanced decisions found along
685
732
  the way, and parts of a large request left for later, are recorded in
686
733
  `deferred`:
@@ -716,7 +763,7 @@ for each item; the agent does not write it.
716
763
  8. If artifacts exist without workflow state, diagnose with
717
764
  `devflow doctor <id>` and repair with `devflow recover <id>`.
718
765
 
719
- Available commands in `0.3.23`:
766
+ Available commands in `0.3.25`:
720
767
 
721
768
  | Command | Status |
722
769
  | --- | --- |
@@ -949,7 +996,7 @@ devflow approve 001
949
996
  ```
950
997
 
951
998
  Approval is explicit and binds the decision to the current artifact
952
- digests. For a `0.3.23` change it binds `spec.md`, `discovery.yaml` and,
999
+ digests. For a `0.3.25` change it binds `spec.md`, `discovery.yaml` and,
953
1000
  when a manifest applies, the architecture manifest digest. Repeating the
954
1001
  same approval is a no-op. If an artifact changes after validation,
955
1002
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -960,7 +1007,7 @@ and names the pending questions and assumptions. Approval also rejects a
960
1007
  specification whose section 7 still lists open questions. Legacy `0.2.0`
961
1008
  changes without `discovery.yaml` remain approvable with a warning.
962
1009
 
963
- Only the `spec` stage is available in `0.3.23`, so `--stage` is optional
1010
+ Only the `spec` stage is available in `0.3.25`, so `--stage` is optional
964
1011
  and defaults to `spec`. `--stage plan` and `--stage review` are
965
1012
  rejected. There are no `plan`, `implement` or
966
1013
  `review` commands in this release.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.23"
7
+ version = "0.3.25"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "docs/REFERENCE.md"
10
10
  license = "MIT"
@@ -37,6 +37,7 @@ from devflow.core.ports import (
37
37
  SetupResult,
38
38
  build_setup_context,
39
39
  )
40
+ from devflow.core import security_tools
40
41
  from devflow.core.profile_manager import ProfileError, ProfileManager
41
42
  from devflow.core.project import ProjectDetector
42
43
  from devflow.models.profile import Profile
@@ -113,6 +114,14 @@ def init(
113
114
  "during an interactive init."
114
115
  ),
115
116
  ),
117
+ security_tools: Optional[bool] = typer.Option(
118
+ None,
119
+ "--security-tools/--no-security-tools",
120
+ help=(
121
+ "Install local security checks (Semgrep, Bandit, pip-audit, "
122
+ "gitleaks) with pre-commit. When omitted, an interactive init asks."
123
+ ),
124
+ ),
116
125
  ) -> None:
117
126
  """Initialize DevFlow in a project."""
118
127
  try:
@@ -127,6 +136,7 @@ def init(
127
136
  project_mode,
128
137
  language,
129
138
  model,
139
+ security_tools,
130
140
  )
131
141
  except (
132
142
  ArchitectureError,
@@ -151,6 +161,7 @@ def _initialize(
151
161
  project_mode: Optional[str],
152
162
  language: Optional[str],
153
163
  model: Optional[str],
164
+ security_tools: Optional[bool] = None,
154
165
  ) -> None:
155
166
  requested_harness = _requested_harness(harness, no_agent)
156
167
  requested_model = (model or "").strip()
@@ -216,6 +227,12 @@ def _initialize(
216
227
  model_override=model is not None,
217
228
  allow_prompt=not yes and sys.stdin.isatty(),
218
229
  )
230
+ _offer_security_tools(
231
+ config=config_manager.load(),
232
+ project=project,
233
+ requested=security_tools,
234
+ allow_prompt=not yes and sys.stdin.isatty(),
235
+ )
219
236
  return
220
237
 
221
238
  selected = list(explicit_profiles) or detected_names
@@ -323,11 +340,62 @@ def _initialize(
323
340
  f"[green]Specifications directory:[/green] "
324
341
  f"{config.specifications_path.relative_to(root)}"
325
342
  )
343
+ _offer_security_tools(
344
+ config=config,
345
+ project=project,
346
+ requested=security_tools,
347
+ allow_prompt=not yes and sys.stdin.isatty(),
348
+ )
326
349
  console.print(
327
350
  "\nNext: [bold]devflow spec \"Describe the change\"[/bold]"
328
351
  )
329
352
 
330
353
 
354
+ def _offer_security_tools(
355
+ *,
356
+ config: DevFlowConfig,
357
+ project: Project,
358
+ requested: Optional[bool],
359
+ allow_prompt: bool,
360
+ ) -> None:
361
+ """Offer the local security checks and install them on request."""
362
+ if requested is False:
363
+ return
364
+ root = config.root
365
+ plan = security_tools.plan_for(project, root)
366
+ if requested is None:
367
+ if security_tools.is_configured(root):
368
+ return
369
+ if not allow_prompt:
370
+ console.print(
371
+ "[dim]Tip: add local security checks with "
372
+ "'devflow init --security-tools'.[/dim]"
373
+ )
374
+ return
375
+ console.print()
376
+ for line in security_tools.describe(
377
+ plan,
378
+ config.documentation_language,
379
+ ):
380
+ console.print(line)
381
+ if not typer.confirm(
382
+ security_tools.confirm_prompt(config.documentation_language),
383
+ default=True,
384
+ ):
385
+ return
386
+
387
+ result = security_tools.install(root, plan)
388
+ if result.config_status in {"created", "updated"}:
389
+ console.print(
390
+ f"[green]Security checks configured:[/green] "
391
+ f"{security_tools.PRECOMMIT_CONFIG} ({', '.join(plan.tools)})"
392
+ )
393
+ for message in result.messages:
394
+ console.print(f"[green]{message}[/green]")
395
+ for warning in result.warnings:
396
+ console.print(f"[yellow]Warning:[/yellow] {warning}")
397
+
398
+
331
399
  def _prompt_for_language() -> str:
332
400
  """Ask for the documentation language during interactive initialization."""
333
401
  console.print(
@@ -33,6 +33,14 @@ from devflow.core.state import (
33
33
  console = Console()
34
34
  error_console = Console(stderr=True)
35
35
 
36
+ _REVIEW_CHECKLIST = (
37
+ "The scope matches the request and the Discovery decisions.",
38
+ "Every FR-XXX has at least one AC-XXX that verifies it.",
39
+ "Every AC-XXX can be checked by a test or an inspection.",
40
+ "Security risks in section 4 are mitigated or explicitly accepted.",
41
+ "Section 10 excludes what you do not want built now.",
42
+ )
43
+
36
44
 
37
45
  def status(
38
46
  spec_id: str = typer.Argument(
@@ -127,6 +135,16 @@ def _status(spec_id: str, path: Path) -> None:
127
135
  "They are not approved and do not advance the change.[/dim]"
128
136
  )
129
137
 
138
+ spec_record = state.artifacts.get("spec")
139
+ if (
140
+ state.status == WorkflowStatus.DRAFT.value
141
+ and spec_record is not None
142
+ and spec_record.status == ArtifactStatus.VALIDATED.value
143
+ ):
144
+ console.print("\n[bold]Review before approving[/bold]")
145
+ for item in _REVIEW_CHECKLIST:
146
+ console.print(f" - {item}")
147
+
130
148
  next_step = _next_step(current, location, discovery)
131
149
  if next_step:
132
150
  console.print(f"\n[bold]Next:[/bold] {next_step}")
@@ -53,6 +53,9 @@ QUESTION_STATUSES = (
53
53
  QUESTION_ASSUMED,
54
54
  QUESTION_ANSWERED,
55
55
  )
56
+ # Agents sometimes write the record status on a question. Both mean the
57
+ # decision is still open.
58
+ QUESTION_PENDING_ALIASES = frozenset({"awaiting_clarification", "open"})
56
59
  QUESTION_WRITTEN_STATUSES = (
57
60
  QUESTION_PENDING,
58
61
  QUESTION_RESOLVED,
@@ -108,6 +111,7 @@ ASSUMPTION_STATUSES = (ASSUMPTION_PENDING, ASSUMPTION_ACCEPTED)
108
111
  ASSUMPTION_SOURCES = ("agent_default", "human", "existing_convention")
109
112
 
110
113
  _QUESTION_ID = re.compile(r"^Q\d{1,3}$")
114
+ _RECOMMENDED = re.compile(r"recom+end", re.IGNORECASE)
111
115
  _ASSUMPTION_ID = re.compile(r"^A\d{1,3}$")
112
116
 
113
117
  _STOPWORDS = {
@@ -486,9 +490,19 @@ class NextLevel:
486
490
 
487
491
  option: str
488
492
  why: str
493
+ title: str = ""
494
+
495
+ @property
496
+ def spec_title(self) -> str:
497
+ """Return the request to use for a later specification."""
498
+ return self.title or self.option
489
499
 
490
500
  def to_dict(self) -> dict[str, Any]:
491
- return {"option": self.option, "why": self.why}
501
+ data: dict[str, Any] = {"option": self.option}
502
+ if self.title:
503
+ data["title"] = self.title
504
+ data["why"] = self.why
505
+ return data
492
506
 
493
507
 
494
508
  @dataclass(frozen=True)
@@ -697,7 +711,7 @@ class DiscoveryDocument:
697
711
  continue
698
712
  add(
699
713
  DeferredItem(
700
- title=question.next_level.option,
714
+ title=question.next_level.spec_title,
701
715
  why=question.next_level.why,
702
716
  question_id=question.id,
703
717
  )
@@ -904,18 +918,8 @@ class DiscoveryManager:
904
918
  msg = f"Invalid YAML in discovery file: {path}: {detail}"
905
919
  raise DiscoveryError(msg) from error
906
920
  document = self._parse(data, directory)
907
- if (
908
- document.status == DISCOVERY_COMPLETE
909
- and (
910
- document.pending_questions
911
- or document.pending_assumptions
912
- )
913
- ):
914
- msg = (
915
- "Discovery is marked complete but still has pending "
916
- "questions or assumptions."
917
- )
918
- raise DiscoveryError(msg)
921
+ # Completeness is derived from the decisions, never from the
922
+ # status an agent wrote.
919
923
  return replace(document, status=document.derived_status)
920
924
 
921
925
  def write(
@@ -1241,18 +1245,6 @@ class DiscoveryManager:
1241
1245
  assumptions=assumptions,
1242
1246
  deferred=deferred,
1243
1247
  )
1244
- if (
1245
- document.status == DISCOVERY_COMPLETE
1246
- and (
1247
- document.pending_questions
1248
- or document.pending_assumptions
1249
- )
1250
- ):
1251
- msg = (
1252
- "Discovery is marked complete but still has pending "
1253
- "questions or assumptions."
1254
- )
1255
- raise DiscoveryError(msg)
1256
1248
  return document
1257
1249
 
1258
1250
  def _question(
@@ -1291,6 +1283,8 @@ class DiscoveryManager:
1291
1283
  )
1292
1284
  raise DiscoveryError(msg)
1293
1285
  status = _text(mapping.get("status"), f"{identifier}.status")
1286
+ if status in QUESTION_PENDING_ALIASES:
1287
+ status = QUESTION_PENDING
1294
1288
  if status not in QUESTION_STATUSES:
1295
1289
  msg = (
1296
1290
  f"Invalid status for {identifier}: {status!r}. "
@@ -1326,7 +1320,14 @@ class DiscoveryManager:
1326
1320
  next_level_mapping.get("why"),
1327
1321
  f"{identifier}.next_level.why",
1328
1322
  ),
1323
+ title=_optional_text(
1324
+ next_level_mapping.get("title"),
1325
+ f"{identifier}.next_level.title",
1326
+ ) or "",
1329
1327
  )
1328
+ # The recommended option is level 1, never the next level.
1329
+ if _RECOMMENDED.search(next_level.option):
1330
+ next_level = None
1330
1331
  resolution_source = _optional_text(
1331
1332
  mapping.get("resolution_source"),
1332
1333
  f"{identifier}.resolution_source",