devflow-toolkit 0.3.25__tar.gz → 0.3.27__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 (90) hide show
  1. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/CHANGELOG.md +52 -0
  2. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/PKG-INFO +54 -12
  3. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/README.md +32 -12
  4. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/docs/REFERENCE.md +53 -11
  5. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/claude_code.py +34 -4
  7. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/approve.py +11 -0
  8. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/init.py +15 -60
  9. devflow_toolkit-0.3.27/src/devflow/commands/security.py +67 -0
  10. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/status.py +3 -0
  11. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/config.py +17 -0
  12. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/discovery.py +74 -13
  13. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/spec_workflow.py +1 -0
  14. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/specification.py +14 -0
  15. devflow_toolkit-0.3.27/src/devflow/hooks/__init__.py +1 -0
  16. devflow_toolkit-0.3.27/src/devflow/hooks/claude_guard.py +76 -0
  17. devflow_toolkit-0.3.27/src/devflow/prompts/discovery-repair.md +37 -0
  18. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/prompts/discovery.md +4 -3
  19. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_discovery_decisions.py +96 -0
  20. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_harness_adapters.py +42 -0
  21. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_security_tools.py +106 -4
  22. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_spec_workflow.py +4 -4
  23. devflow_toolkit-0.3.25/src/devflow/prompts/discovery-repair.md +0 -36
  24. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/.gitignore +0 -0
  25. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/LICENSE +0 -0
  26. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/PUBLISHING.md +0 -0
  27. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/__init__.py +0 -0
  28. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/__init__.py +0 -0
  29. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/agents.py +0 -0
  30. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/antigravity.py +0 -0
  31. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/base.py +0 -0
  32. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/codex.py +0 -0
  33. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/detector.py +0 -0
  34. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/instructions.py +0 -0
  35. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/kiro.py +0 -0
  36. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/opencode.py +0 -0
  37. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/adapters/registry.py +0 -0
  38. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/cli.py +0 -0
  39. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/__init__.py +0 -0
  40. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/config.py +0 -0
  41. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/doctor.py +0 -0
  42. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/harness.py +0 -0
  43. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/recover.py +0 -0
  44. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/reopen.py +0 -0
  45. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/commands/spec.py +0 -0
  46. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/__init__.py +0 -0
  47. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/architecture.py +0 -0
  48. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/__init__.py +0 -0
  49. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/errors.py +0 -0
  50. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/models.py +0 -0
  51. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/store.py +0 -0
  52. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/clock.py +0 -0
  53. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/constitution.py +0 -0
  54. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/file_types.py +0 -0
  55. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/ports.py +0 -0
  56. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/profile_manager.py +0 -0
  57. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/project.py +0 -0
  58. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/recovery.py +0 -0
  59. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/security_tools.py +0 -0
  60. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/__init__.py +0 -0
  61. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/errors.py +0 -0
  62. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/events.py +0 -0
  63. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/locator.py +0 -0
  64. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/lock.py +0 -0
  65. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/manager.py +0 -0
  66. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/models.py +0 -0
  67. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/core/state/transitions.py +0 -0
  68. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/models/__init__.py +0 -0
  69. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/models/profile.py +0 -0
  70. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/models/project.py +0 -0
  71. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  72. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  73. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  74. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  75. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  76. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/profile.yaml +0 -0
  77. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  78. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  79. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  80. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  81. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/prompts/__init__.py +0 -0
  82. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/src/devflow/prompts/spec.md +0 -0
  83. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_cli.py +0 -0
  84. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_discovery.py +0 -0
  85. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_event_log.py +0 -0
  86. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_greenfield.py +0 -0
  87. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_hardening.py +0 -0
  88. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_recovery.py +0 -0
  89. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_state.py +0 -0
  90. {devflow_toolkit-0.3.25 → devflow_toolkit-0.3.27}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,58 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.27 - 2026-11-09
6
+
7
+ ### Added
8
+
9
+ - Claude Code sessions with spec-only permissions get a `PreToolUse`
10
+ hook (`devflow.hooks.claude_guard`) that blocks writes outside
11
+ `.devflow/specs/` without asking the user, and tells the agent why.
12
+ Manual mode stays, so the Discovery question dialog keeps working.
13
+
14
+ ### Changed
15
+
16
+ - Minor mistakes in `discovery.yaml` are corrected instead of starting a
17
+ repair session, and reported as warnings and in `devflow status`:
18
+ unknown categories map to the closest valid one, unknown
19
+ materialities fall back to the category default, and missing
20
+ `answered_by`/`answered_at` on user answers are filled in. Critical
21
+ decisions still cannot be assumed.
22
+ - Discovery and repair prompts tell the agent not to create scripts or
23
+ run commands to validate the record: DevFlow validates it when the
24
+ session ends.
25
+ - The repair prompt states the language first, describes any rejected
26
+ field (not only YAML syntax) and asks the agent to tell the user to
27
+ exit when done.
28
+
29
+ ### Package
30
+
31
+ - Package version is `0.3.27`.
32
+
33
+ ## 0.3.26 - 2026-11-09
34
+
35
+ ### Added
36
+
37
+ - Acknowledgments in the README and in the PyPI description, with a
38
+ special mention of Typer and its author, Sebastián Ramírez
39
+ (@tiangolo), creator of FastAPI.
40
+ - When the local security checks are configured, `context.md` tells
41
+ the specification writer to record `pre-commit run --all-files` as a
42
+ quality gate in section 6.
43
+
44
+ ### Changed
45
+
46
+ - The local security checks review code, so they are offered once
47
+ after the first `devflow approve`, when implementation starts, instead
48
+ of during `devflow init`. `devflow init --security-tools` still
49
+ installs them at any time, and `--no-security-tools` turns the offer
50
+ off. The answer is stored as `security.tools_offered` in
51
+ `.devflow/config.yaml`.
52
+
53
+ ### Package
54
+
55
+ - Package version is `0.3.26`.
56
+
5
57
  ## 0.3.25 - 2026-11-09
6
58
 
7
59
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.25
3
+ Version: 0.3.27
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.25`.**
35
+ **Current version: `0.3.27`.**
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.25-py3-none-any.whl
155
+ pip install devflow_toolkit-0.3.27-py3-none-any.whl
156
156
  ```
157
157
 
158
158
  Verify the installation:
@@ -317,8 +317,9 @@ explicitly.
317
317
 
318
318
  ### Local security checks
319
319
 
320
- `devflow init` offers tools that run locally on every commit, without
321
- tokens:
320
+ Semgrep, Bandit, pip-audit and gitleaks review code, so they belong to
321
+ implementation. DevFlow offers them once, right after the first
322
+ `devflow approve`, in an interactive terminal:
322
323
 
323
324
  - Semgrep, with rules for Django (or Python) and OWASP;
324
325
  - Bandit, for Python code;
@@ -326,9 +327,9 @@ tokens:
326
327
  - gitleaks, for secrets in the code.
327
328
 
328
329
  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.
330
+ commit, without tokens. `devflow init --security-tools` installs them at
331
+ any time; `devflow init --no-security-tools` turns the offer off. The
332
+ answer is remembered in `.devflow/config.yaml` (`security.tools_offered`).
332
333
 
333
334
  Accepting writes a managed `.pre-commit-config.yaml` with pinned hook
334
335
  revisions, installs `pre-commit` with pip when it is missing and runs
@@ -339,6 +340,10 @@ hooks that apply are added: Bandit and pip-audit for Python projects,
339
340
  downloads the tools; `pre-commit run --all-files` checks the whole
340
341
  project.
341
342
 
343
+ When the checks are configured, `context.md` tells the specification
344
+ writer to record `pre-commit run --all-files` as a quality gate in
345
+ section 6.
346
+
342
347
  ## Configuration
343
348
 
344
349
  `.devflow/config.yaml` stores project settings. It references the
@@ -452,7 +457,7 @@ as an architectural constraint when it is present.
452
457
 
453
458
  ### Harnesses
454
459
 
455
- | Harness | Status in 0.3.25 |
460
+ | Harness | Status in 0.3.27 |
456
461
  | --- | --- |
457
462
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
458
463
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -546,6 +551,13 @@ pre-approved, while shell, web and task tools remain denied.
546
551
  Non-interactive runs keep the locked `dontAsk` mode and do not allow the
547
552
  question tool.
548
553
 
554
+ Manual mode would ask you about any other write, such as a helper
555
+ script in `/tmp`. To avoid that prompt, DevFlow also passes a
556
+ `PreToolUse` hook (`devflow.hooks.claude_guard`) that blocks every
557
+ `Write`, `Edit`, `MultiEdit` and `NotebookEdit` outside
558
+ `.devflow/specs/` without asking, and tells the agent why. The hook is
559
+ not added when `allow_source_code_changes` is enabled.
560
+
549
561
  ## Discovery
550
562
 
551
563
  Discovery is separate from specification. The project context decides
@@ -726,6 +738,17 @@ specification and asks you to run `devflow spec --continue`, which
726
738
  repairs the file first. When an agent lists questions in section 7,
727
739
  nested bullets stay part of the same question.
728
740
 
741
+ DevFlow corrects minor mistakes instead of starting a repair session,
742
+ and lists each correction as a warning and in `devflow status`: an
743
+ unknown category is read as the closest valid one (for example
744
+ `api_contract` as `functional_scope`, `security` as
745
+ `security_authentication`), an unknown materiality falls back to the
746
+ category default, and a user answer without `answered_by` or
747
+ `answered_at` is read as `user` at the record's `updated_at`. The
748
+ materiality the agent wrote is kept, so a `critical` decision can still
749
+ never be assumed. Unreadable YAML, answers on pending decisions and
750
+ assumed critical decisions still require a repair.
751
+
729
752
  DevFlow derives completeness from the decisions themselves: a record
730
753
  marked `complete` with pending questions is treated as
731
754
  `awaiting_clarification`, and a question written with
@@ -795,7 +818,7 @@ for each item; the agent does not write it.
795
818
  8. If artifacts exist without workflow state, diagnose with
796
819
  `devflow doctor <id>` and repair with `devflow recover <id>`.
797
820
 
798
- Available commands in `0.3.25`:
821
+ Available commands in `0.3.27`:
799
822
 
800
823
  | Command | Status |
801
824
  | --- | --- |
@@ -1028,7 +1051,7 @@ devflow approve 001
1028
1051
  ```
1029
1052
 
1030
1053
  Approval is explicit and binds the decision to the current artifact
1031
- digests. For a `0.3.25` change it binds `spec.md`, `discovery.yaml` and,
1054
+ digests. For a `0.3.27` change it binds `spec.md`, `discovery.yaml` and,
1032
1055
  when a manifest applies, the architecture manifest digest. Repeating the
1033
1056
  same approval is a no-op. If an artifact changes after validation,
1034
1057
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -1039,7 +1062,7 @@ and names the pending questions and assumptions. Approval also rejects a
1039
1062
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1040
1063
  changes without `discovery.yaml` remain approvable with a warning.
1041
1064
 
1042
- Only the `spec` stage is available in `0.3.25`, so `--stage` is optional
1065
+ Only the `spec` stage is available in `0.3.27`, so `--stage` is optional
1043
1066
  and defaults to `spec`. `--stage plan` and `--stage review` are
1044
1067
  rejected. There are no `plan`, `implement` or
1045
1068
  `review` commands in this release.
@@ -1246,3 +1269,22 @@ The test suite covers the core, CLI, state replay and harness adapters.
1246
1269
  Release verification additionally installs the built wheel and sdist in
1247
1270
  clean virtual environments and runs the consumer workflow from outside
1248
1271
  the repository.
1272
+
1273
+ ## Acknowledgments
1274
+
1275
+ DevFlow is built on the shoulders of open-source work.
1276
+
1277
+ **[Typer](https://typer.tiangolo.com)**, by **Sebastián Ramírez
1278
+ ([@tiangolo](https://github.com/tiangolo))**, creator of FastAPI. Every
1279
+ DevFlow command, option and help screen is built with Typer. Thank you
1280
+ for making great command-line tools this simple to build.
1281
+
1282
+ - **[Rich](https://github.com/Textualize/rich)**, by Will McGugan, for
1283
+ the terminal output.
1284
+ - **[PyYAML](https://pyyaml.org)**, for the Discovery and workflow
1285
+ records.
1286
+ - **[pre-commit](https://pre-commit.com)**, by Anthony Sottile, and the
1287
+ Semgrep, Bandit, pip-audit and gitleaks projects, for the local
1288
+ security checks.
1289
+ - **[OWASP](https://owasp.org)**, for the security standards that guide
1290
+ DevFlow's security checks.
@@ -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.25` · Python 3.11+ · Linux and macOS
13
+ Current version: `0.3.27` · Python 3.11+ · Linux and macOS
14
14
 
15
15
  ## Install
16
16
 
@@ -52,17 +52,6 @@ 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
-
66
55
  ### 2. Describe the change
67
56
 
68
57
  ```bash
@@ -107,6 +96,18 @@ specs, each with its `devflow spec "..."` command. Then:
107
96
  devflow approve 001
108
97
  ```
109
98
 
99
+ After the first approval, implementation is next, so DevFlow offers
100
+ tools that review the code locally on every commit, without tokens:
101
+
102
+ - Semgrep, with rules for Django and OWASP;
103
+ - Bandit, for Python code;
104
+ - pip-audit, for vulnerable dependencies;
105
+ - gitleaks, for secrets in the code.
106
+
107
+ pre-commit (pre-commit.com) runs them automatically on every commit.
108
+ The offer appears once; add them any time with
109
+ `devflow init --security-tools`.
110
+
110
111
  ### 5. Implement
111
112
 
112
113
  Open your agent normally (not through DevFlow) and ask:
@@ -169,6 +170,25 @@ written outside the normal flow.
169
170
  - [Changelog](CHANGELOG.md)
170
171
  - [How to publish a release](PUBLISHING.md)
171
172
 
173
+ ## Acknowledgments
174
+
175
+ DevFlow is built on the shoulders of open-source work.
176
+
177
+ **[Typer](https://typer.tiangolo.com)**, by **Sebastián Ramírez
178
+ ([@tiangolo](https://github.com/tiangolo))**, creator of FastAPI. Every
179
+ DevFlow command, option and help screen is built with Typer. Thank you
180
+ for making great command-line tools this simple to build.
181
+
182
+ - **[Rich](https://github.com/Textualize/rich)**, by Will McGugan, for
183
+ the terminal output.
184
+ - **[PyYAML](https://pyyaml.org)**, for the Discovery and workflow
185
+ records.
186
+ - **[pre-commit](https://pre-commit.com)**, by Anthony Sottile, and the
187
+ Semgrep, Bandit, pip-audit and gitleaks projects, for the local
188
+ security checks.
189
+ - **[OWASP](https://owasp.org)**, for the security standards that guide
190
+ DevFlow's security checks.
191
+
172
192
  ## License
173
193
 
174
194
  MIT
@@ -1,6 +1,6 @@
1
1
  # DevFlow Toolkit
2
2
 
3
- **Current version: `0.3.25`.**
3
+ **Current version: `0.3.27`.**
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.25-py3-none-any.whl
123
+ pip install devflow_toolkit-0.3.27-py3-none-any.whl
124
124
  ```
125
125
 
126
126
  Verify the installation:
@@ -285,8 +285,9 @@ explicitly.
285
285
 
286
286
  ### Local security checks
287
287
 
288
- `devflow init` offers tools that run locally on every commit, without
289
- tokens:
288
+ Semgrep, Bandit, pip-audit and gitleaks review code, so they belong to
289
+ implementation. DevFlow offers them once, right after the first
290
+ `devflow approve`, in an interactive terminal:
290
291
 
291
292
  - Semgrep, with rules for Django (or Python) and OWASP;
292
293
  - Bandit, for Python code;
@@ -294,9 +295,9 @@ tokens:
294
295
  - gitleaks, for secrets in the code.
295
296
 
296
297
  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.
298
+ commit, without tokens. `devflow init --security-tools` installs them at
299
+ any time; `devflow init --no-security-tools` turns the offer off. The
300
+ answer is remembered in `.devflow/config.yaml` (`security.tools_offered`).
300
301
 
301
302
  Accepting writes a managed `.pre-commit-config.yaml` with pinned hook
302
303
  revisions, installs `pre-commit` with pip when it is missing and runs
@@ -307,6 +308,10 @@ hooks that apply are added: Bandit and pip-audit for Python projects,
307
308
  downloads the tools; `pre-commit run --all-files` checks the whole
308
309
  project.
309
310
 
311
+ When the checks are configured, `context.md` tells the specification
312
+ writer to record `pre-commit run --all-files` as a quality gate in
313
+ section 6.
314
+
310
315
  ## Configuration
311
316
 
312
317
  `.devflow/config.yaml` stores project settings. It references the
@@ -420,7 +425,7 @@ as an architectural constraint when it is present.
420
425
 
421
426
  ### Harnesses
422
427
 
423
- | Harness | Status in 0.3.25 |
428
+ | Harness | Status in 0.3.27 |
424
429
  | --- | --- |
425
430
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
426
431
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -514,6 +519,13 @@ pre-approved, while shell, web and task tools remain denied.
514
519
  Non-interactive runs keep the locked `dontAsk` mode and do not allow the
515
520
  question tool.
516
521
 
522
+ Manual mode would ask you about any other write, such as a helper
523
+ script in `/tmp`. To avoid that prompt, DevFlow also passes a
524
+ `PreToolUse` hook (`devflow.hooks.claude_guard`) that blocks every
525
+ `Write`, `Edit`, `MultiEdit` and `NotebookEdit` outside
526
+ `.devflow/specs/` without asking, and tells the agent why. The hook is
527
+ not added when `allow_source_code_changes` is enabled.
528
+
517
529
  ## Discovery
518
530
 
519
531
  Discovery is separate from specification. The project context decides
@@ -694,6 +706,17 @@ specification and asks you to run `devflow spec --continue`, which
694
706
  repairs the file first. When an agent lists questions in section 7,
695
707
  nested bullets stay part of the same question.
696
708
 
709
+ DevFlow corrects minor mistakes instead of starting a repair session,
710
+ and lists each correction as a warning and in `devflow status`: an
711
+ unknown category is read as the closest valid one (for example
712
+ `api_contract` as `functional_scope`, `security` as
713
+ `security_authentication`), an unknown materiality falls back to the
714
+ category default, and a user answer without `answered_by` or
715
+ `answered_at` is read as `user` at the record's `updated_at`. The
716
+ materiality the agent wrote is kept, so a `critical` decision can still
717
+ never be assumed. Unreadable YAML, answers on pending decisions and
718
+ assumed critical decisions still require a repair.
719
+
697
720
  DevFlow derives completeness from the decisions themselves: a record
698
721
  marked `complete` with pending questions is treated as
699
722
  `awaiting_clarification`, and a question written with
@@ -763,7 +786,7 @@ for each item; the agent does not write it.
763
786
  8. If artifacts exist without workflow state, diagnose with
764
787
  `devflow doctor <id>` and repair with `devflow recover <id>`.
765
788
 
766
- Available commands in `0.3.25`:
789
+ Available commands in `0.3.27`:
767
790
 
768
791
  | Command | Status |
769
792
  | --- | --- |
@@ -996,7 +1019,7 @@ devflow approve 001
996
1019
  ```
997
1020
 
998
1021
  Approval is explicit and binds the decision to the current artifact
999
- digests. For a `0.3.25` change it binds `spec.md`, `discovery.yaml` and,
1022
+ digests. For a `0.3.27` change it binds `spec.md`, `discovery.yaml` and,
1000
1023
  when a manifest applies, the architecture manifest digest. Repeating the
1001
1024
  same approval is a no-op. If an artifact changes after validation,
1002
1025
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -1007,7 +1030,7 @@ and names the pending questions and assumptions. Approval also rejects a
1007
1030
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1008
1031
  changes without `discovery.yaml` remain approvable with a warning.
1009
1032
 
1010
- Only the `spec` stage is available in `0.3.25`, so `--stage` is optional
1033
+ Only the `spec` stage is available in `0.3.27`, so `--stage` is optional
1011
1034
  and defaults to `spec`. `--stage plan` and `--stage review` are
1012
1035
  rejected. There are no `plan`, `implement` or
1013
1036
  `review` commands in this release.
@@ -1214,3 +1237,22 @@ The test suite covers the core, CLI, state replay and harness adapters.
1214
1237
  Release verification additionally installs the built wheel and sdist in
1215
1238
  clean virtual environments and runs the consumer workflow from outside
1216
1239
  the repository.
1240
+
1241
+ ## Acknowledgments
1242
+
1243
+ DevFlow is built on the shoulders of open-source work.
1244
+
1245
+ **[Typer](https://typer.tiangolo.com)**, by **Sebastián Ramírez
1246
+ ([@tiangolo](https://github.com/tiangolo))**, creator of FastAPI. Every
1247
+ DevFlow command, option and help screen is built with Typer. Thank you
1248
+ for making great command-line tools this simple to build.
1249
+
1250
+ - **[Rich](https://github.com/Textualize/rich)**, by Will McGugan, for
1251
+ the terminal output.
1252
+ - **[PyYAML](https://pyyaml.org)**, for the Discovery and workflow
1253
+ records.
1254
+ - **[pre-commit](https://pre-commit.com)**, by Anthony Sottile, and the
1255
+ Semgrep, Bandit, pip-audit and gitleaks projects, for the local
1256
+ security checks.
1257
+ - **[OWASP](https://owasp.org)**, for the security standards that guide
1258
+ DevFlow's security checks.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.25"
7
+ version = "0.3.27"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "docs/REFERENCE.md"
10
10
  license = "MIT"
@@ -3,6 +3,8 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import json
6
+ import shlex
7
+ import sys
6
8
 
7
9
  from devflow.adapters.base import (
8
10
  FileChange,
@@ -51,10 +53,13 @@ class ClaudeCodeAdapter(HarnessAdapter):
51
53
  return SetupResult(changes=tuple(changes))
52
54
 
53
55
  def build_run(self, context: RunContext) -> Invocation:
54
- settings = json.dumps(
55
- {"permissions": self._permission_rules(context)},
56
- separators=(",", ":"),
57
- )
56
+ settings_data: dict[str, object] = {
57
+ "permissions": self._permission_rules(context),
58
+ }
59
+ hooks = self._write_guard(context)
60
+ if hooks:
61
+ settings_data["hooks"] = hooks
62
+ settings = json.dumps(settings_data, separators=(",", ":"))
58
63
  root = context.root
59
64
  permission_mode = (
60
65
  "manual" if context.mode == "interactive" else "dontAsk"
@@ -112,6 +117,31 @@ class ClaudeCodeAdapter(HarnessAdapter):
112
117
  return []
113
118
  return ["Read", "Grep", "Glob"]
114
119
 
120
+ def _write_guard(self, context: RunContext) -> dict[str, object]:
121
+ """Block writes outside the specs directory without asking the user."""
122
+ permissions = context.permissions
123
+ if permissions.allow_source_code_changes or not (
124
+ permissions.allow_spec_write
125
+ ):
126
+ return {}
127
+ allowed = context.spec_directory.parent
128
+ command = " ".join(
129
+ [
130
+ shlex.quote(sys.executable),
131
+ "-m",
132
+ "devflow.hooks.claude_guard",
133
+ shlex.quote(str(allowed)),
134
+ ]
135
+ )
136
+ return {
137
+ "PreToolUse": [
138
+ {
139
+ "matcher": "Write|Edit|MultiEdit|NotebookEdit",
140
+ "hooks": [{"type": "command", "command": command}],
141
+ }
142
+ ]
143
+ }
144
+
115
145
  def _permission_rules(
116
146
  self,
117
147
  context: RunContext,
@@ -2,11 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import sys
5
6
  from pathlib import Path
6
7
 
7
8
  import typer
8
9
  from rich.console import Console
9
10
 
11
+ from devflow.commands.security import offer_security_tools
10
12
  from devflow.core.artifacts.errors import ArtifactError
11
13
  from devflow.core.config import ConfigError, ConfigManager
12
14
  from devflow.core.discovery import DiscoveryError
@@ -99,3 +101,12 @@ def _approve(spec_id: str, path: Path, stage: str) -> None:
99
101
  "Changing an approved artifact marks it stale and blocks the "
100
102
  "workflow until it is validated again.[/dim]"
101
103
  )
104
+ if result.changed:
105
+ # Implementation starts after the first approval: this is when
106
+ # checks that review code on every commit become useful.
107
+ offer_security_tools(
108
+ config,
109
+ ProjectDetector().detect(config.root),
110
+ console,
111
+ allow_prompt=sys.stdin.isatty(),
112
+ )
@@ -37,7 +37,10 @@ from devflow.core.ports import (
37
37
  SetupResult,
38
38
  build_setup_context,
39
39
  )
40
- from devflow.core import security_tools
40
+ from devflow.commands.security import (
41
+ decline_security_tools,
42
+ install_security_tools,
43
+ )
41
44
  from devflow.core.profile_manager import ProfileError, ProfileManager
42
45
  from devflow.core.project import ProjectDetector
43
46
  from devflow.models.profile import Profile
@@ -118,8 +121,9 @@ def init(
118
121
  None,
119
122
  "--security-tools/--no-security-tools",
120
123
  help=(
121
- "Install local security checks (Semgrep, Bandit, pip-audit, "
122
- "gitleaks) with pre-commit. When omitted, an interactive init asks."
124
+ "Install now the local security checks (Semgrep, Bandit, "
125
+ "pip-audit, gitleaks) that review code on every commit. Without "
126
+ "this flag they are offered after the first spec approval."
123
127
  ),
124
128
  ),
125
129
  ) -> None:
@@ -227,12 +231,10 @@ def _initialize(
227
231
  model_override=model is not None,
228
232
  allow_prompt=not yes and sys.stdin.isatty(),
229
233
  )
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
- )
234
+ if security_tools:
235
+ install_security_tools(config_manager.load(), project, console)
236
+ elif security_tools is False:
237
+ decline_security_tools(config_manager.load())
236
238
  return
237
239
 
238
240
  selected = list(explicit_profiles) or detected_names
@@ -340,62 +342,15 @@ def _initialize(
340
342
  f"[green]Specifications directory:[/green] "
341
343
  f"{config.specifications_path.relative_to(root)}"
342
344
  )
343
- _offer_security_tools(
344
- config=config,
345
- project=project,
346
- requested=security_tools,
347
- allow_prompt=not yes and sys.stdin.isatty(),
348
- )
345
+ if security_tools:
346
+ install_security_tools(config, project, console)
347
+ elif security_tools is False:
348
+ decline_security_tools(config)
349
349
  console.print(
350
350
  "\nNext: [bold]devflow spec \"Describe the change\"[/bold]"
351
351
  )
352
352
 
353
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
-
399
354
  def _prompt_for_language() -> str:
400
355
  """Ask for the documentation language during interactive initialization."""
401
356
  console.print(