devflow-toolkit 0.3.26__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.
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/CHANGELOG.md +28 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/PKG-INFO +25 -7
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/README.md +1 -1
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/docs/REFERENCE.md +24 -6
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/pyproject.toml +1 -1
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/claude_code.py +34 -4
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/status.py +3 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/discovery.py +74 -13
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/spec_workflow.py +1 -0
- devflow_toolkit-0.3.27/src/devflow/hooks/__init__.py +1 -0
- devflow_toolkit-0.3.27/src/devflow/hooks/claude_guard.py +76 -0
- devflow_toolkit-0.3.27/src/devflow/prompts/discovery-repair.md +37 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/prompts/discovery.md +4 -3
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_discovery_decisions.py +96 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_harness_adapters.py +42 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_spec_workflow.py +4 -4
- devflow_toolkit-0.3.26/src/devflow/prompts/discovery-repair.md +0 -36
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/.gitignore +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/LICENSE +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/PUBLISHING.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/agents.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/antigravity.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/base.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/codex.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/detector.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/instructions.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/kiro.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/opencode.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/adapters/registry.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/cli.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/approve.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/config.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/doctor.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/harness.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/init.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/recover.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/reopen.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/security.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/commands/spec.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/architecture.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/errors.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/models.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/artifacts/store.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/clock.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/config.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/constitution.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/file_types.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/ports.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/profile_manager.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/project.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/recovery.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/security_tools.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/specification.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/errors.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/events.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/locator.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/lock.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/manager.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/models.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/core/state/transitions.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/models/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/models/profile.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/models/project.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/architecture.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/constitution/constitution.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/base/profile.yaml +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/django-backend/profile.yaml +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/prompts/__init__.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/prompts/spec.md +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_cli.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_discovery.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_event_log.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_greenfield.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_hardening.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_recovery.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_security_tools.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_state.py +0 -0
- {devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/tests/test_state_replay.py +0 -0
|
@@ -2,6 +2,34 @@
|
|
|
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
|
+
|
|
5
33
|
## 0.3.26 - 2026-11-09
|
|
6
34
|
|
|
7
35
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: devflow-toolkit
|
|
3
|
-
Version: 0.3.
|
|
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.
|
|
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.
|
|
155
|
+
pip install devflow_toolkit-0.3.27-py3-none-any.whl
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
Verify the installation:
|
|
@@ -457,7 +457,7 @@ as an architectural constraint when it is present.
|
|
|
457
457
|
|
|
458
458
|
### Harnesses
|
|
459
459
|
|
|
460
|
-
| Harness | Status in 0.3.
|
|
460
|
+
| Harness | Status in 0.3.27 |
|
|
461
461
|
| --- | --- |
|
|
462
462
|
| OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
|
|
463
463
|
| Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
|
|
@@ -551,6 +551,13 @@ pre-approved, while shell, web and task tools remain denied.
|
|
|
551
551
|
Non-interactive runs keep the locked `dontAsk` mode and do not allow the
|
|
552
552
|
question tool.
|
|
553
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
|
+
|
|
554
561
|
## Discovery
|
|
555
562
|
|
|
556
563
|
Discovery is separate from specification. The project context decides
|
|
@@ -731,6 +738,17 @@ specification and asks you to run `devflow spec --continue`, which
|
|
|
731
738
|
repairs the file first. When an agent lists questions in section 7,
|
|
732
739
|
nested bullets stay part of the same question.
|
|
733
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
|
+
|
|
734
752
|
DevFlow derives completeness from the decisions themselves: a record
|
|
735
753
|
marked `complete` with pending questions is treated as
|
|
736
754
|
`awaiting_clarification`, and a question written with
|
|
@@ -800,7 +818,7 @@ for each item; the agent does not write it.
|
|
|
800
818
|
8. If artifacts exist without workflow state, diagnose with
|
|
801
819
|
`devflow doctor <id>` and repair with `devflow recover <id>`.
|
|
802
820
|
|
|
803
|
-
Available commands in `0.3.
|
|
821
|
+
Available commands in `0.3.27`:
|
|
804
822
|
|
|
805
823
|
| Command | Status |
|
|
806
824
|
| --- | --- |
|
|
@@ -1033,7 +1051,7 @@ devflow approve 001
|
|
|
1033
1051
|
```
|
|
1034
1052
|
|
|
1035
1053
|
Approval is explicit and binds the decision to the current artifact
|
|
1036
|
-
digests. For a `0.3.
|
|
1054
|
+
digests. For a `0.3.27` change it binds `spec.md`, `discovery.yaml` and,
|
|
1037
1055
|
when a manifest applies, the architecture manifest digest. Repeating the
|
|
1038
1056
|
same approval is a no-op. If an artifact changes after validation,
|
|
1039
1057
|
DevFlow marks it stale and refuses approval until it is regenerated and
|
|
@@ -1044,7 +1062,7 @@ and names the pending questions and assumptions. Approval also rejects a
|
|
|
1044
1062
|
specification whose section 7 still lists open questions. Legacy `0.2.0`
|
|
1045
1063
|
changes without `discovery.yaml` remain approvable with a warning.
|
|
1046
1064
|
|
|
1047
|
-
Only the `spec` stage is available in `0.3.
|
|
1065
|
+
Only the `spec` stage is available in `0.3.27`, so `--stage` is optional
|
|
1048
1066
|
and defaults to `spec`. `--stage plan` and `--stage review` are
|
|
1049
1067
|
rejected. There are no `plan`, `implement` or
|
|
1050
1068
|
`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.
|
|
13
|
+
Current version: `0.3.27` · Python 3.11+ · Linux and macOS
|
|
14
14
|
|
|
15
15
|
## Install
|
|
16
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# DevFlow Toolkit
|
|
2
2
|
|
|
3
|
-
**Current version: `0.3.
|
|
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.
|
|
123
|
+
pip install devflow_toolkit-0.3.27-py3-none-any.whl
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Verify the installation:
|
|
@@ -425,7 +425,7 @@ as an architectural constraint when it is present.
|
|
|
425
425
|
|
|
426
426
|
### Harnesses
|
|
427
427
|
|
|
428
|
-
| Harness | Status in 0.3.
|
|
428
|
+
| Harness | Status in 0.3.27 |
|
|
429
429
|
| --- | --- |
|
|
430
430
|
| OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
|
|
431
431
|
| Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
|
|
@@ -519,6 +519,13 @@ pre-approved, while shell, web and task tools remain denied.
|
|
|
519
519
|
Non-interactive runs keep the locked `dontAsk` mode and do not allow the
|
|
520
520
|
question tool.
|
|
521
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
|
+
|
|
522
529
|
## Discovery
|
|
523
530
|
|
|
524
531
|
Discovery is separate from specification. The project context decides
|
|
@@ -699,6 +706,17 @@ specification and asks you to run `devflow spec --continue`, which
|
|
|
699
706
|
repairs the file first. When an agent lists questions in section 7,
|
|
700
707
|
nested bullets stay part of the same question.
|
|
701
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
|
+
|
|
702
720
|
DevFlow derives completeness from the decisions themselves: a record
|
|
703
721
|
marked `complete` with pending questions is treated as
|
|
704
722
|
`awaiting_clarification`, and a question written with
|
|
@@ -768,7 +786,7 @@ for each item; the agent does not write it.
|
|
|
768
786
|
8. If artifacts exist without workflow state, diagnose with
|
|
769
787
|
`devflow doctor <id>` and repair with `devflow recover <id>`.
|
|
770
788
|
|
|
771
|
-
Available commands in `0.3.
|
|
789
|
+
Available commands in `0.3.27`:
|
|
772
790
|
|
|
773
791
|
| Command | Status |
|
|
774
792
|
| --- | --- |
|
|
@@ -1001,7 +1019,7 @@ devflow approve 001
|
|
|
1001
1019
|
```
|
|
1002
1020
|
|
|
1003
1021
|
Approval is explicit and binds the decision to the current artifact
|
|
1004
|
-
digests. For a `0.3.
|
|
1022
|
+
digests. For a `0.3.27` change it binds `spec.md`, `discovery.yaml` and,
|
|
1005
1023
|
when a manifest applies, the architecture manifest digest. Repeating the
|
|
1006
1024
|
same approval is a no-op. If an artifact changes after validation,
|
|
1007
1025
|
DevFlow marks it stale and refuses approval until it is regenerated and
|
|
@@ -1012,7 +1030,7 @@ and names the pending questions and assumptions. Approval also rejects a
|
|
|
1012
1030
|
specification whose section 7 still lists open questions. Legacy `0.2.0`
|
|
1013
1031
|
changes without `discovery.yaml` remain approvable with a warning.
|
|
1014
1032
|
|
|
1015
|
-
Only the `spec` stage is available in `0.3.
|
|
1033
|
+
Only the `spec` stage is available in `0.3.27`, so `--stage` is optional
|
|
1016
1034
|
and defaults to `spec`. `--stage plan` and `--stage review` are
|
|
1017
1035
|
rejected. There are no `plan`, `implement` or
|
|
1018
1036
|
`review` commands in this release.
|
|
@@ -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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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,
|
|
@@ -245,6 +245,9 @@ def _print_discovery(
|
|
|
245
245
|
soft_wrap=True,
|
|
246
246
|
)
|
|
247
247
|
|
|
248
|
+
for note in discovery.notes:
|
|
249
|
+
console.print(f" [yellow]corrected: {note}[/yellow]", soft_wrap=True)
|
|
250
|
+
|
|
248
251
|
suggestions = discovery.suggested_next_specs()
|
|
249
252
|
if suggestions:
|
|
250
253
|
console.print("\n[bold]Suggested next specifications[/bold]")
|
|
@@ -105,6 +105,50 @@ _CATEGORY_MATERIALITY = {
|
|
|
105
105
|
"deployment": MATERIALITY_TECHNICAL,
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
# Categories agents commonly invent, mapped to the closest valid one.
|
|
109
|
+
# Unknown categories fall back to functional_scope; the materiality the
|
|
110
|
+
# agent wrote is kept, so a critical decision stays critical.
|
|
111
|
+
_CATEGORY_ALIASES = {
|
|
112
|
+
"api": "functional_scope",
|
|
113
|
+
"api_contract": "functional_scope",
|
|
114
|
+
"api_design": "functional_scope",
|
|
115
|
+
"interface": "functional_scope",
|
|
116
|
+
"scope": "functional_scope",
|
|
117
|
+
"functional": "functional_scope",
|
|
118
|
+
"validation": "functional_scope",
|
|
119
|
+
"business_rules": "functional_scope",
|
|
120
|
+
"error_handling": "functional_scope",
|
|
121
|
+
"ui": "user_behavior",
|
|
122
|
+
"ux": "user_behavior",
|
|
123
|
+
"user_interface": "user_behavior",
|
|
124
|
+
"user_experience": "user_behavior",
|
|
125
|
+
"navigation": "user_behavior",
|
|
126
|
+
"i18n": "user_behavior",
|
|
127
|
+
"localization": "user_behavior",
|
|
128
|
+
"data": "data_persistence",
|
|
129
|
+
"data_model": "data_persistence",
|
|
130
|
+
"database": "data_persistence",
|
|
131
|
+
"persistence": "data_persistence",
|
|
132
|
+
"storage": "data_persistence",
|
|
133
|
+
"security": "security_authentication",
|
|
134
|
+
"authentication": "security_authentication",
|
|
135
|
+
"authorization": "security_authentication",
|
|
136
|
+
"auth": "security_authentication",
|
|
137
|
+
"permissions": "security_authentication",
|
|
138
|
+
"privacy": "security_authentication",
|
|
139
|
+
"integration": "external_integration",
|
|
140
|
+
"external": "external_integration",
|
|
141
|
+
"third_party": "external_integration",
|
|
142
|
+
"architecture": "architecture_boundary",
|
|
143
|
+
"performance": "architecture_boundary",
|
|
144
|
+
"scalability": "architecture_boundary",
|
|
145
|
+
"configuration": "architecture_boundary",
|
|
146
|
+
"dependency": "dependencies",
|
|
147
|
+
"libraries": "dependencies",
|
|
148
|
+
"infrastructure": "deployment",
|
|
149
|
+
"operations": "deployment",
|
|
150
|
+
}
|
|
151
|
+
|
|
108
152
|
ASSUMPTION_PENDING = "pending_acceptance"
|
|
109
153
|
ASSUMPTION_ACCEPTED = "accepted"
|
|
110
154
|
ASSUMPTION_STATUSES = (ASSUMPTION_PENDING, ASSUMPTION_ACCEPTED)
|
|
@@ -685,6 +729,9 @@ class DiscoveryDocument:
|
|
|
685
729
|
questions: tuple[DiscoveryQuestion, ...] = ()
|
|
686
730
|
assumptions: tuple[DiscoveryAssumption, ...] = ()
|
|
687
731
|
deferred: tuple[DeferredItem, ...] = ()
|
|
732
|
+
# Minor problems DevFlow corrected while reading the record. They are
|
|
733
|
+
# reported to the user and never written back by themselves.
|
|
734
|
+
notes: tuple[str, ...] = ()
|
|
688
735
|
|
|
689
736
|
def suggested_next_specs(self) -> tuple[DeferredItem, ...]:
|
|
690
737
|
"""Return next-level improvements to propose as later specs.
|
|
@@ -1182,8 +1229,9 @@ class DiscoveryManager:
|
|
|
1182
1229
|
)
|
|
1183
1230
|
raise DiscoveryError(msg)
|
|
1184
1231
|
|
|
1232
|
+
notes: list[str] = []
|
|
1185
1233
|
questions = tuple(
|
|
1186
|
-
self._question(item, index)
|
|
1234
|
+
self._question(item, index, notes=notes, default_time=updated_at)
|
|
1187
1235
|
for index, item in enumerate(questions_data, start=1)
|
|
1188
1236
|
)
|
|
1189
1237
|
question_ids = {question.id for question in questions}
|
|
@@ -1244,6 +1292,7 @@ class DiscoveryManager:
|
|
|
1244
1292
|
questions=questions,
|
|
1245
1293
|
assumptions=assumptions,
|
|
1246
1294
|
deferred=deferred,
|
|
1295
|
+
notes=tuple(notes),
|
|
1247
1296
|
)
|
|
1248
1297
|
return document
|
|
1249
1298
|
|
|
@@ -1251,18 +1300,26 @@ class DiscoveryManager:
|
|
|
1251
1300
|
self,
|
|
1252
1301
|
data: object,
|
|
1253
1302
|
index: int,
|
|
1303
|
+
*,
|
|
1304
|
+
notes: list[str] | None = None,
|
|
1305
|
+
default_time: str = "",
|
|
1254
1306
|
) -> DiscoveryQuestion:
|
|
1255
1307
|
mapping = _mapping(data, f"questions[{index}]")
|
|
1256
1308
|
identifier = _text(mapping.get("id"), "question id")
|
|
1257
1309
|
if not _QUESTION_ID.fullmatch(identifier):
|
|
1258
1310
|
msg = f"Invalid discovery question id: {identifier!r}"
|
|
1259
1311
|
raise DiscoveryError(msg)
|
|
1312
|
+
if notes is None:
|
|
1313
|
+
notes = []
|
|
1260
1314
|
category = _text(mapping.get("category"), "question category")
|
|
1261
1315
|
if category not in QUESTION_CATEGORIES:
|
|
1262
|
-
|
|
1263
|
-
|
|
1316
|
+
key = category.strip().lower().replace("-", "_").replace(" ", "_")
|
|
1317
|
+
corrected = _CATEGORY_ALIASES.get(key, "functional_scope")
|
|
1318
|
+
notes.append(
|
|
1319
|
+
f"{identifier}: unknown category {category!r} read as "
|
|
1320
|
+
f"{corrected!r}."
|
|
1264
1321
|
)
|
|
1265
|
-
|
|
1322
|
+
category = corrected
|
|
1266
1323
|
question = _limited_text(
|
|
1267
1324
|
mapping.get("question"),
|
|
1268
1325
|
f"{identifier}.question",
|
|
@@ -1277,11 +1334,11 @@ class DiscoveryManager:
|
|
|
1277
1334
|
f"{identifier}.materiality",
|
|
1278
1335
|
) or ""
|
|
1279
1336
|
if materiality and materiality not in MATERIALITIES:
|
|
1280
|
-
|
|
1281
|
-
f"
|
|
1282
|
-
|
|
1337
|
+
notes.append(
|
|
1338
|
+
f"{identifier}: unknown materiality {materiality!r} ignored; "
|
|
1339
|
+
"the category default applies."
|
|
1283
1340
|
)
|
|
1284
|
-
|
|
1341
|
+
materiality = ""
|
|
1285
1342
|
status = _text(mapping.get("status"), f"{identifier}.status")
|
|
1286
1343
|
if status in QUESTION_PENDING_ALIASES:
|
|
1287
1344
|
status = QUESTION_PENDING
|
|
@@ -1380,12 +1437,16 @@ class DiscoveryManager:
|
|
|
1380
1437
|
f"{identifier} is resolved but has no answer."
|
|
1381
1438
|
)
|
|
1382
1439
|
if not answered_by:
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
)
|
|
1440
|
+
answered_by = "user"
|
|
1441
|
+
notes.append(f"{identifier}: missing answered_by read as user.")
|
|
1386
1442
|
if not answered_at:
|
|
1387
|
-
|
|
1388
|
-
|
|
1443
|
+
if not default_time:
|
|
1444
|
+
raise DiscoveryError(
|
|
1445
|
+
f"{identifier} is resolved but has no answered_at."
|
|
1446
|
+
)
|
|
1447
|
+
answered_at = default_time
|
|
1448
|
+
notes.append(
|
|
1449
|
+
f"{identifier}: missing answered_at read as {default_time}."
|
|
1389
1450
|
)
|
|
1390
1451
|
elif resolution_source == RESOLUTION_ASSUMPTION:
|
|
1391
1452
|
raise DiscoveryError(
|
|
@@ -932,6 +932,7 @@ class SpecWorkflow:
|
|
|
932
932
|
updated, digest = repaired_result
|
|
933
933
|
repaired = True
|
|
934
934
|
self._discard_unexpected_spec(prepared, spec_existed, warnings)
|
|
935
|
+
warnings.extend(f"discovery.yaml: {note}" for note in updated.notes)
|
|
935
936
|
if not repaired:
|
|
936
937
|
digest = self._discovery_digest(
|
|
937
938
|
discovery_manager,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Guards that DevFlow installs into agent harness sessions."""
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""Claude Code PreToolUse hook that keeps writes inside a directory.
|
|
2
|
+
|
|
3
|
+
DevFlow passes this hook to specification sessions. Claude Code asks
|
|
4
|
+
the user about any write that is neither allowed nor denied, and a deny
|
|
5
|
+
rule for writes would also block `.devflow/specs/`. The hook decides
|
|
6
|
+
instead: a write outside the allowed directory is blocked without a
|
|
7
|
+
prompt, and the reason is returned to the agent.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import json
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
BLOCKED_EXIT_CODE = 2
|
|
18
|
+
_PATH_KEYS = ("file_path", "notebook_path", "path")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def blocked_reason(payload: dict[str, Any], allowed: Path) -> str | None:
|
|
22
|
+
"""Return why a tool call must be blocked, or None to let it run."""
|
|
23
|
+
tool_input = payload.get("tool_input")
|
|
24
|
+
if not isinstance(tool_input, dict):
|
|
25
|
+
tool_input = {}
|
|
26
|
+
raw = next(
|
|
27
|
+
(
|
|
28
|
+
tool_input[key]
|
|
29
|
+
for key in _PATH_KEYS
|
|
30
|
+
if isinstance(tool_input.get(key), str) and tool_input[key]
|
|
31
|
+
),
|
|
32
|
+
None,
|
|
33
|
+
)
|
|
34
|
+
if raw is None:
|
|
35
|
+
return (
|
|
36
|
+
"DevFlow: this session may only write files under "
|
|
37
|
+
f"{allowed}. The write has no file path, so it was blocked."
|
|
38
|
+
)
|
|
39
|
+
cwd = payload.get("cwd")
|
|
40
|
+
base = Path(cwd) if isinstance(cwd, str) and cwd else Path.cwd()
|
|
41
|
+
target = Path(raw)
|
|
42
|
+
if not target.is_absolute():
|
|
43
|
+
target = base / target
|
|
44
|
+
try:
|
|
45
|
+
target.resolve().relative_to(allowed.resolve())
|
|
46
|
+
except ValueError:
|
|
47
|
+
return (
|
|
48
|
+
f"DevFlow: this session may only write files under {allowed}. "
|
|
49
|
+
f"Writing {raw} was blocked. Do not create scripts or helper "
|
|
50
|
+
"files: DevFlow validates discovery.yaml and spec.md itself when "
|
|
51
|
+
"the session ends."
|
|
52
|
+
)
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def main(argv: list[str] | None = None) -> int:
|
|
57
|
+
args = sys.argv[1:] if argv is None else argv
|
|
58
|
+
if len(args) != 1:
|
|
59
|
+
print("usage: claude_guard <allowed-directory>", file=sys.stderr)
|
|
60
|
+
return BLOCKED_EXIT_CODE
|
|
61
|
+
try:
|
|
62
|
+
payload = json.load(sys.stdin)
|
|
63
|
+
except (OSError, ValueError):
|
|
64
|
+
print("DevFlow: unreadable hook input; write blocked.", file=sys.stderr)
|
|
65
|
+
return BLOCKED_EXIT_CODE
|
|
66
|
+
if not isinstance(payload, dict):
|
|
67
|
+
payload = {}
|
|
68
|
+
reason = blocked_reason(payload, Path(args[0]))
|
|
69
|
+
if reason is None:
|
|
70
|
+
return 0
|
|
71
|
+
print(reason, file=sys.stderr)
|
|
72
|
+
return BLOCKED_EXIT_CODE
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == "__main__":
|
|
76
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Discovery Record Repair
|
|
2
|
+
|
|
3
|
+
{{language_note}}
|
|
4
|
+
|
|
5
|
+
You are repairing the DevFlow Discovery record `{{discovery_path}}`.
|
|
6
|
+
|
|
7
|
+
DevFlow could not accept the file:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
{{error}}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Task
|
|
14
|
+
|
|
15
|
+
Fix only what the error above describes: the YAML syntax or the invalid
|
|
16
|
+
field it names. Do not change the request or the meaning of any
|
|
17
|
+
decision, answer, evidence, option or assumption. Do not add, remove or
|
|
18
|
+
re-scope a decision. Do not write or modify `spec.md` or any application
|
|
19
|
+
source file.
|
|
20
|
+
|
|
21
|
+
## YAML Safety Rules
|
|
22
|
+
|
|
23
|
+
- Quote every free-text scalar with single quotes, especially when it
|
|
24
|
+
contains `: `, `#`, `{`, `}`, `[`, `]`, `&`, `*`, `!`, `|`, `>` or
|
|
25
|
+
starts with `-`, `?` or `:`.
|
|
26
|
+
- Use a block scalar (`|` or `>`) for long prose instead of leaving it
|
|
27
|
+
unquoted.
|
|
28
|
+
- Preserve the existing indentation, list structure and field names.
|
|
29
|
+
- Re-read the complete file after editing. Do not create scripts or run
|
|
30
|
+
commands to validate it: DevFlow validates the record when this
|
|
31
|
+
session ends.
|
|
32
|
+
- Keep all text in the language already used by the record unless the
|
|
33
|
+
task prompt asks for another language.
|
|
34
|
+
|
|
35
|
+
When you finish, list the lines you repaired and tell the user to exit
|
|
36
|
+
this session so DevFlow can validate the file. Do not generate a
|
|
37
|
+
specification.
|
|
@@ -273,9 +273,10 @@ it is a real improvement.
|
|
|
273
273
|
multi-line value unquoted.
|
|
274
274
|
- Keep one root mapping and preserve the existing indentation. Do not
|
|
275
275
|
write duplicate keys.
|
|
276
|
-
- Before finishing, re-read the complete `discovery.yaml` file
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
- Before finishing, re-read the complete `discovery.yaml` file. Never
|
|
277
|
+
leave a partially written or unquoted value in it. Do not create
|
|
278
|
+
scripts or run commands to validate it: DevFlow validates the record
|
|
279
|
+
when the session ends.
|
|
279
280
|
|
|
280
281
|
Valid question categories are `functional_scope`, `user_behavior`,
|
|
281
282
|
`data_persistence`, `security_authentication`,
|
|
@@ -600,3 +600,99 @@ def test_next_level_title_names_the_suggested_spec(tmp_path: Path) -> None:
|
|
|
600
600
|
assert loaded.to_dict()["questions"][0]["next_level"]["title"] == (
|
|
601
601
|
"Expire login tokens"
|
|
602
602
|
)
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
def _write_raw(directory: Path, data: dict) -> None:
|
|
606
|
+
(directory / "discovery.yaml").write_text(
|
|
607
|
+
yaml.safe_dump(data, sort_keys=False, allow_unicode=True),
|
|
608
|
+
encoding="utf-8",
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
@pytest.mark.parametrize(
|
|
613
|
+
("written", "expected"),
|
|
614
|
+
[
|
|
615
|
+
("api_contract", "functional_scope"),
|
|
616
|
+
("security", "security_authentication"),
|
|
617
|
+
("UI", "user_behavior"),
|
|
618
|
+
("something_new", "functional_scope"),
|
|
619
|
+
],
|
|
620
|
+
)
|
|
621
|
+
def test_unknown_categories_are_corrected_with_a_note(
|
|
622
|
+
tmp_path: Path,
|
|
623
|
+
written: str,
|
|
624
|
+
expected: str,
|
|
625
|
+
) -> None:
|
|
626
|
+
directory = _directory(tmp_path)
|
|
627
|
+
data = _document(
|
|
628
|
+
questions=(_leveled_question("Q1", answer=None),),
|
|
629
|
+
).to_dict()
|
|
630
|
+
data["questions"][0]["category"] = written
|
|
631
|
+
_write_raw(directory, data)
|
|
632
|
+
|
|
633
|
+
loaded = DiscoveryManager(tmp_path).load(directory, required=True)
|
|
634
|
+
|
|
635
|
+
assert loaded is not None
|
|
636
|
+
assert loaded.questions[0].category == expected
|
|
637
|
+
assert any(written in note for note in loaded.notes)
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def test_critical_materiality_survives_a_corrected_category(
|
|
641
|
+
tmp_path: Path,
|
|
642
|
+
) -> None:
|
|
643
|
+
directory = _directory(tmp_path)
|
|
644
|
+
data = _document(
|
|
645
|
+
questions=(_leveled_question("Q1", answer=None),),
|
|
646
|
+
).to_dict()
|
|
647
|
+
data["questions"][0]["category"] = "api_contract"
|
|
648
|
+
data["questions"][0]["materiality"] = "critical"
|
|
649
|
+
data["questions"][0]["status"] = "assumed"
|
|
650
|
+
data["assumptions"] = [
|
|
651
|
+
{
|
|
652
|
+
"id": "A1",
|
|
653
|
+
"question_id": "Q1",
|
|
654
|
+
"value": "Default.",
|
|
655
|
+
"reason": "Reversible.",
|
|
656
|
+
"source": "agent_default",
|
|
657
|
+
"status": "pending_acceptance",
|
|
658
|
+
}
|
|
659
|
+
]
|
|
660
|
+
_write_raw(directory, data)
|
|
661
|
+
|
|
662
|
+
with pytest.raises(DiscoveryError, match="cannot be assumed"):
|
|
663
|
+
DiscoveryManager(tmp_path).load(directory, required=True)
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
def test_minor_answer_metadata_is_filled_in(tmp_path: Path) -> None:
|
|
667
|
+
directory = _directory(tmp_path)
|
|
668
|
+
data = _document(
|
|
669
|
+
status=DISCOVERY_COMPLETE,
|
|
670
|
+
questions=(_leveled_question("Q1", answer="Until logout (basic)"),),
|
|
671
|
+
).to_dict()
|
|
672
|
+
question = data["questions"][0]
|
|
673
|
+
question["answered_by"] = None
|
|
674
|
+
question["answered_at"] = None
|
|
675
|
+
question["materiality"] = "high"
|
|
676
|
+
_write_raw(directory, data)
|
|
677
|
+
|
|
678
|
+
loaded = DiscoveryManager(tmp_path).load(directory, required=True)
|
|
679
|
+
|
|
680
|
+
assert loaded is not None
|
|
681
|
+
assert loaded.questions[0].answered_by == "user"
|
|
682
|
+
assert loaded.questions[0].answered_at == data["updated_at"]
|
|
683
|
+
assert loaded.questions[0].materiality == ""
|
|
684
|
+
assert len(loaded.notes) == 3
|
|
685
|
+
assert loaded.is_complete
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
def test_repair_prompt_forbids_validation_scripts() -> None:
|
|
689
|
+
from devflow.prompts import build_discovery_repair_prompt
|
|
690
|
+
|
|
691
|
+
prompt = build_discovery_repair_prompt(
|
|
692
|
+
discovery_path="discovery.yaml",
|
|
693
|
+
error="bad",
|
|
694
|
+
language="es",
|
|
695
|
+
)
|
|
696
|
+
|
|
697
|
+
assert "Do not create scripts" in prompt
|
|
698
|
+
assert prompt.index("`es`") < prompt.index("## Task")
|
|
@@ -658,6 +658,48 @@ def test_claude_interactive_uses_manual_mode_for_questions(
|
|
|
658
658
|
assert "AskUserQuestion" not in allow
|
|
659
659
|
assert "Edit(.devflow/specs/**)" in allow
|
|
660
660
|
assert "Write(.devflow/specs/**)" in allow
|
|
661
|
+
guard = settings["hooks"]["PreToolUse"][0]
|
|
662
|
+
assert guard["matcher"] == "Write|Edit|MultiEdit|NotebookEdit"
|
|
663
|
+
command = guard["hooks"][0]["command"]
|
|
664
|
+
assert "-m devflow.hooks.claude_guard" in command
|
|
665
|
+
assert str(tmp_path / ".devflow" / "specs") in command
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
def test_claude_has_no_write_guard_when_code_changes_are_allowed(
|
|
669
|
+
tmp_path: Path,
|
|
670
|
+
) -> None:
|
|
671
|
+
context = _run_context(
|
|
672
|
+
tmp_path,
|
|
673
|
+
mode="interactive",
|
|
674
|
+
permissions=AgentPermissions(allow_source_code_changes=True),
|
|
675
|
+
)
|
|
676
|
+
argv = ClaudeCodeAdapter().build_run(context).argv
|
|
677
|
+
settings = json.loads(argv[argv.index("--settings") + 1])
|
|
678
|
+
|
|
679
|
+
assert "hooks" not in settings
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
def test_claude_guard_blocks_writes_outside_specs(tmp_path: Path) -> None:
|
|
683
|
+
from devflow.hooks.claude_guard import blocked_reason
|
|
684
|
+
|
|
685
|
+
specs = tmp_path / ".devflow" / "specs"
|
|
686
|
+
inside = {
|
|
687
|
+
"tool_input": {"file_path": ".devflow/specs/001-demo/discovery.yaml"},
|
|
688
|
+
"cwd": str(tmp_path),
|
|
689
|
+
}
|
|
690
|
+
outside = {
|
|
691
|
+
"tool_input": {"file_path": "/tmp/devflow_check/check.py"},
|
|
692
|
+
"cwd": str(tmp_path),
|
|
693
|
+
}
|
|
694
|
+
escape = {
|
|
695
|
+
"tool_input": {"file_path": ".devflow/specs/../../app.py"},
|
|
696
|
+
"cwd": str(tmp_path),
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
assert blocked_reason(inside, specs) is None
|
|
700
|
+
assert "Do not create scripts" in blocked_reason(outside, specs)
|
|
701
|
+
assert blocked_reason(escape, specs) is not None
|
|
702
|
+
assert blocked_reason({"tool_input": {}}, specs) is not None
|
|
661
703
|
|
|
662
704
|
|
|
663
705
|
def test_claude_non_interactive_restricts_tools(
|
|
@@ -637,7 +637,7 @@ def test_workflow_repairs_invalid_discovery_yaml_once(
|
|
|
637
637
|
prompts.append(adapter.run_context.prompt)
|
|
638
638
|
directory = adapter.run_context.spec_directory
|
|
639
639
|
path = directory / "discovery.yaml"
|
|
640
|
-
if "Discovery
|
|
640
|
+
if "Discovery Record Repair" in adapter.run_context.prompt:
|
|
641
641
|
path.write_text(original["content"], encoding="utf-8")
|
|
642
642
|
else:
|
|
643
643
|
original["content"] = path.read_text(encoding="utf-8")
|
|
@@ -657,7 +657,7 @@ def test_workflow_repairs_invalid_discovery_yaml_once(
|
|
|
657
657
|
)
|
|
658
658
|
|
|
659
659
|
assert len(prompts) == 2
|
|
660
|
-
assert "Discovery
|
|
660
|
+
assert "Discovery Record Repair" in prompts[1]
|
|
661
661
|
assert result.discovery_valid is True
|
|
662
662
|
assert result.discovery is not None
|
|
663
663
|
assert any(
|
|
@@ -682,7 +682,7 @@ def test_workflow_restores_discovery_yaml_when_repair_fails(
|
|
|
682
682
|
assert adapter.run_context is not None
|
|
683
683
|
directory = adapter.run_context.spec_directory
|
|
684
684
|
path = directory / "discovery.yaml"
|
|
685
|
-
if "Discovery
|
|
685
|
+
if "Discovery Record Repair" in adapter.run_context.prompt:
|
|
686
686
|
path.write_text(INVALID_DISCOVERY_YAML, encoding="utf-8")
|
|
687
687
|
else:
|
|
688
688
|
original["content"] = path.read_text(encoding="utf-8")
|
|
@@ -750,7 +750,7 @@ def test_continue_repairs_invalid_discovery_yaml(
|
|
|
750
750
|
)
|
|
751
751
|
|
|
752
752
|
assert prompts
|
|
753
|
-
assert "Discovery
|
|
753
|
+
assert "Discovery Record Repair" in prompts[0]
|
|
754
754
|
assert result.discovery_valid is True
|
|
755
755
|
assert any(
|
|
756
756
|
"attempting an automatic YAML repair" in warning
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Discovery YAML Repair
|
|
2
|
-
|
|
3
|
-
You are repairing the DevFlow Discovery record `{{discovery_path}}`.
|
|
4
|
-
|
|
5
|
-
DevFlow could not parse the file as valid YAML:
|
|
6
|
-
|
|
7
|
-
```text
|
|
8
|
-
{{error}}
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Language
|
|
12
|
-
|
|
13
|
-
{{language_note}}
|
|
14
|
-
|
|
15
|
-
## Task
|
|
16
|
-
|
|
17
|
-
Fix only the YAML syntax. Do not change the request, decisions, answers,
|
|
18
|
-
categories, materiality, statuses, evidence, options or assumptions.
|
|
19
|
-
Do not add, remove or re-scope a decision. Do not write or modify
|
|
20
|
-
`spec.md` or any application source file.
|
|
21
|
-
|
|
22
|
-
## YAML Safety Rules
|
|
23
|
-
|
|
24
|
-
- Quote every free-text scalar with single quotes, especially when it
|
|
25
|
-
contains `: `, `#`, `{`, `}`, `[`, `]`, `&`, `*`, `!`, `|`, `>` or
|
|
26
|
-
starts with `-`, `?` or `:`.
|
|
27
|
-
- Use a block scalar (`|` or `>`) for long prose instead of leaving it
|
|
28
|
-
unquoted.
|
|
29
|
-
- Preserve the existing indentation, list structure and field names.
|
|
30
|
-
- Re-read the complete file after editing and verify that every scalar
|
|
31
|
-
and list item is valid YAML.
|
|
32
|
-
- Keep all text in the language already used by the record unless the
|
|
33
|
-
task prompt asks for another language.
|
|
34
|
-
|
|
35
|
-
When you finish, report that the file is valid YAML and list the lines
|
|
36
|
-
you repaired. Do not generate a specification.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/django-backend/profile.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{devflow_toolkit-0.3.26 → devflow_toolkit-0.3.27}/src/devflow/profiles/fastapi-backend/profile.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|