devflow-toolkit 0.4.2__tar.gz → 0.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/CHANGELOG.md +22 -0
  2. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/PKG-INFO +21 -7
  3. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/README.md +1 -1
  4. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/docs/REFERENCE.md +20 -6
  5. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/discovery.py +48 -6
  7. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/prompts/__init__.py +13 -2
  8. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/prompts/discovery.md +16 -1
  9. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/prompts/spec.md +6 -0
  10. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_discovery.py +51 -0
  11. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_spec_workflow.py +31 -0
  12. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/.gitignore +0 -0
  13. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/LICENSE +0 -0
  14. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/docs/PRESENTATION.md +0 -0
  15. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/docs/PUBLISHING.md +0 -0
  16. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/__init__.py +0 -0
  17. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/__init__.py +0 -0
  18. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/agents.py +0 -0
  19. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/antigravity.py +0 -0
  20. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/base.py +0 -0
  21. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/claude_code.py +0 -0
  22. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/codex.py +0 -0
  23. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/detector.py +0 -0
  24. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/instructions.py +0 -0
  25. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/kiro.py +0 -0
  26. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/opencode.py +0 -0
  27. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/adapters/registry.py +0 -0
  28. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/cli.py +0 -0
  29. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/__init__.py +0 -0
  30. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/approve.py +0 -0
  31. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/config.py +0 -0
  32. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/doctor.py +0 -0
  33. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/harness.py +0 -0
  34. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/init.py +0 -0
  35. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/recover.py +0 -0
  36. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/reopen.py +0 -0
  37. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/security.py +0 -0
  38. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/spec.py +0 -0
  39. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/commands/status.py +0 -0
  40. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/__init__.py +0 -0
  41. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/architecture.py +0 -0
  42. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/artifacts/__init__.py +0 -0
  43. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/artifacts/errors.py +0 -0
  44. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/artifacts/models.py +0 -0
  45. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/artifacts/store.py +0 -0
  46. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/clock.py +0 -0
  47. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/config.py +0 -0
  48. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/constitution.py +0 -0
  49. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/file_types.py +0 -0
  50. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/ports.py +0 -0
  51. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/profile_manager.py +0 -0
  52. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/project.py +0 -0
  53. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/recovery.py +0 -0
  54. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/security_baseline.py +0 -0
  55. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/security_tools.py +0 -0
  56. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/spec_workflow.py +0 -0
  57. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/specification.py +0 -0
  58. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/__init__.py +0 -0
  59. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/errors.py +0 -0
  60. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/events.py +0 -0
  61. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/locator.py +0 -0
  62. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/lock.py +0 -0
  63. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/manager.py +0 -0
  64. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/models.py +0 -0
  65. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/core/state/transitions.py +0 -0
  66. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/hooks/__init__.py +0 -0
  67. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/hooks/claude_guard.py +0 -0
  68. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/models/__init__.py +0 -0
  69. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/models/profile.py +0 -0
  70. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/models/project.py +0 -0
  71. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  72. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  73. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  74. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  75. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  76. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/base/profile.yaml +0 -0
  77. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  78. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  79. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  80. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  81. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/src/devflow/prompts/discovery-repair.md +0 -0
  82. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_cli.py +0 -0
  83. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_discovery_decisions.py +0 -0
  84. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_event_log.py +0 -0
  85. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_greenfield.py +0 -0
  86. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_hardening.py +0 -0
  87. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_harness_adapters.py +0 -0
  88. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_recovery.py +0 -0
  89. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_security_baseline.py +0 -0
  90. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_security_tools.py +0 -0
  91. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_state.py +0 -0
  92. {devflow_toolkit-0.4.2 → devflow_toolkit-0.4.3}/tests/test_state_replay.py +0 -0
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.4.3 - 2026-11-10
6
+
7
+ ### Changed
8
+
9
+ - The planner's authentication question fits the project: Django
10
+ sessions with the built-in views and forms for Django projects,
11
+ server-side sessions for others, and API-token options only when the
12
+ request mentions an API, tokens or a mobile client.
13
+ - A pending question that nobody has answered, including the ones
14
+ DevFlow generates, is a proposal: the Discovery agent may rewrite its
15
+ wording and options, put the recommended option first and add a
16
+ `next_level`. Answered decisions are never rewritten.
17
+ - Discovery and specification agents search only the project's own
18
+ files and skip virtual environments and installed dependencies,
19
+ reading a dependency only for one specific fact.
20
+ - Every prompt opens with the language rule, so the agent answers in
21
+ the configured language from its first message.
22
+
23
+ ### Package
24
+
25
+ - Package version is `0.4.3`, published on TestPyPI and PyPI.
26
+
5
27
  ## 0.4.2 - 2026-11-10
6
28
 
7
29
  ### Removed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.4.2
3
+ Version: 0.4.3
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.4.2`.**
35
+ **Current version: `0.4.3`.**
36
36
 
37
37
  Before any code is written, you and the AI agree on what will be built
38
38
  and approve it as a spec. The agent then implements once, on something
@@ -210,7 +210,7 @@ pip install devflow-toolkit
210
210
  To install a specific built artifact instead:
211
211
 
212
212
  ```bash
213
- pip install devflow_toolkit-0.4.2-py3-none-any.whl
213
+ pip install devflow_toolkit-0.4.3-py3-none-any.whl
214
214
  ```
215
215
 
216
216
  Verify the installation:
@@ -511,7 +511,7 @@ as an architectural constraint when it is present.
511
511
 
512
512
  ### Harnesses
513
513
 
514
- | Harness | Status in 0.4.2 |
514
+ | Harness | Status in 0.4.3 |
515
515
  | --- | --- |
516
516
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
517
517
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -721,6 +721,20 @@ selected harness is invoked instead of being skipped with an empty
721
721
  Discovery. Non-interactive runs keep the deterministic behavior for
722
722
  concrete requests such as `Add a health endpoint`.
723
723
 
724
+ The planner's questions are proposals. For an authentication request,
725
+ the first options fit the project: Django sessions with the built-in
726
+ views and forms for a Django project, server-side sessions otherwise,
727
+ and API tokens only when the request mentions an API, tokens or a mobile
728
+ client. While a planner question is still pending, the Discovery agent
729
+ may rewrite its wording and options, put the recommended level-1 option
730
+ first and add a `next_level`; answered decisions are never rewritten.
731
+
732
+ Discovery and specification agents search only the project's own files
733
+ and skip virtual environments and installed dependencies (`venv`,
734
+ `.venv`, `node_modules`, `site-packages`), reading a dependency only for
735
+ one specific fact. Every prompt opens with the language rule, so the
736
+ agent answers in the configured language from its first message.
737
+
724
738
  For user-generated content, Discovery must also resolve who writes it,
725
739
  who may create, edit or delete it, moderation, authentication
726
740
  mechanism, validation, ordering, lifecycle on parent deletion, admin
@@ -925,7 +939,7 @@ reference.
925
939
  8. If artifacts exist without workflow state, diagnose with
926
940
  `devflow doctor <id>` and repair with `devflow recover <id>`.
927
941
 
928
- Available commands in `0.4.2`:
942
+ Available commands in `0.4.3`:
929
943
 
930
944
  | Command | Status |
931
945
  | --- | --- |
@@ -1158,7 +1172,7 @@ devflow approve 001
1158
1172
  ```
1159
1173
 
1160
1174
  Approval is explicit and binds the decision to the current artifact
1161
- digests. For a `0.4.2` change it binds `spec.md`, `discovery.yaml` and,
1175
+ digests. For a `0.4.3` change it binds `spec.md`, `discovery.yaml` and,
1162
1176
  when a manifest applies, the architecture manifest digest. Repeating the
1163
1177
  same approval is a no-op. If an artifact changes after validation,
1164
1178
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -1169,7 +1183,7 @@ and names the pending questions and assumptions. Approval also rejects a
1169
1183
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1170
1184
  changes without `discovery.yaml` remain approvable with a warning.
1171
1185
 
1172
- Only the `spec` stage is available in `0.4.2`, so `--stage` is optional
1186
+ Only the `spec` stage is available in `0.4.3`, so `--stage` is optional
1173
1187
  and defaults to `spec`. `--stage plan` and `--stage review` are
1174
1188
  rejected. There are no `plan`, `implement` or
1175
1189
  `review` commands in this release.
@@ -32,7 +32,7 @@ tokens, which cost several times more than input tokens.
32
32
  The goal is not to generate code faster, but to decide better before
33
33
  generating it. Thinking is cheap; redoing code is expensive.
34
34
 
35
- Current version: `0.4.2` · Python 3.11+ · Linux and macOS
35
+ Current version: `0.4.3` · Python 3.11+ · Linux and macOS
36
36
 
37
37
  ## Install
38
38
 
@@ -1,6 +1,6 @@
1
1
  # DevFlow Toolkit
2
2
 
3
- **Current version: `0.4.2`.**
3
+ **Current version: `0.4.3`.**
4
4
 
5
5
  Before any code is written, you and the AI agree on what will be built
6
6
  and approve it as a spec. The agent then implements once, on something
@@ -178,7 +178,7 @@ pip install devflow-toolkit
178
178
  To install a specific built artifact instead:
179
179
 
180
180
  ```bash
181
- pip install devflow_toolkit-0.4.2-py3-none-any.whl
181
+ pip install devflow_toolkit-0.4.3-py3-none-any.whl
182
182
  ```
183
183
 
184
184
  Verify the installation:
@@ -479,7 +479,7 @@ as an architectural constraint when it is present.
479
479
 
480
480
  ### Harnesses
481
481
 
482
- | Harness | Status in 0.4.2 |
482
+ | Harness | Status in 0.4.3 |
483
483
  | --- | --- |
484
484
  | OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
485
485
  | Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
@@ -689,6 +689,20 @@ selected harness is invoked instead of being skipped with an empty
689
689
  Discovery. Non-interactive runs keep the deterministic behavior for
690
690
  concrete requests such as `Add a health endpoint`.
691
691
 
692
+ The planner's questions are proposals. For an authentication request,
693
+ the first options fit the project: Django sessions with the built-in
694
+ views and forms for a Django project, server-side sessions otherwise,
695
+ and API tokens only when the request mentions an API, tokens or a mobile
696
+ client. While a planner question is still pending, the Discovery agent
697
+ may rewrite its wording and options, put the recommended level-1 option
698
+ first and add a `next_level`; answered decisions are never rewritten.
699
+
700
+ Discovery and specification agents search only the project's own files
701
+ and skip virtual environments and installed dependencies (`venv`,
702
+ `.venv`, `node_modules`, `site-packages`), reading a dependency only for
703
+ one specific fact. Every prompt opens with the language rule, so the
704
+ agent answers in the configured language from its first message.
705
+
692
706
  For user-generated content, Discovery must also resolve who writes it,
693
707
  who may create, edit or delete it, moderation, authentication
694
708
  mechanism, validation, ordering, lifecycle on parent deletion, admin
@@ -893,7 +907,7 @@ reference.
893
907
  8. If artifacts exist without workflow state, diagnose with
894
908
  `devflow doctor <id>` and repair with `devflow recover <id>`.
895
909
 
896
- Available commands in `0.4.2`:
910
+ Available commands in `0.4.3`:
897
911
 
898
912
  | Command | Status |
899
913
  | --- | --- |
@@ -1126,7 +1140,7 @@ devflow approve 001
1126
1140
  ```
1127
1141
 
1128
1142
  Approval is explicit and binds the decision to the current artifact
1129
- digests. For a `0.4.2` change it binds `spec.md`, `discovery.yaml` and,
1143
+ digests. For a `0.4.3` change it binds `spec.md`, `discovery.yaml` and,
1130
1144
  when a manifest applies, the architecture manifest digest. Repeating the
1131
1145
  same approval is a no-op. If an artifact changes after validation,
1132
1146
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -1137,7 +1151,7 @@ and names the pending questions and assumptions. Approval also rejects a
1137
1151
  specification whose section 7 still lists open questions. Legacy `0.2.0`
1138
1152
  changes without `discovery.yaml` remain approvable with a warning.
1139
1153
 
1140
- Only the `spec` stage is available in `0.4.2`, so `--stage` is optional
1154
+ Only the `spec` stage is available in `0.4.3`, so `--stage` is optional
1141
1155
  and defaults to `spec`. `--stage plan` and `--stage review` are
1142
1156
  rejected. There are no `plan`, `implement` or
1143
1157
  `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.4.2"
7
+ version = "0.4.3"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "docs/REFERENCE.md"
10
10
  license = "MIT"
@@ -1856,12 +1856,7 @@ class DiscoveryPlanner:
1856
1856
  "application?",
1857
1857
  "API tokens, browser cookies and session authentication change "
1858
1858
  "security boundaries, dependencies and user-visible behavior.",
1859
- (
1860
- "New JSON API with Bearer tokens.",
1861
- "JWT in an HttpOnly cookie for HTML views.",
1862
- "Both the JSON API and the HTML views.",
1863
- "Other (describe).",
1864
- ),
1859
+ _auth_integration_options(project, words),
1865
1860
  )
1866
1861
  if auth_question and (words & {"jwt", "oauth", "token"}):
1867
1862
  if not (words & {
@@ -2235,6 +2230,53 @@ def _normalize(value: str) -> str:
2235
2230
  return without_accents.lower()
2236
2231
 
2237
2232
 
2233
+ _API_WORDS = frozenset(
2234
+ {
2235
+ "api",
2236
+ "json",
2237
+ "rest",
2238
+ "jwt",
2239
+ "token",
2240
+ "tokens",
2241
+ "bearer",
2242
+ "endpoint",
2243
+ "endpoints",
2244
+ "oauth",
2245
+ "mobile",
2246
+ "movil",
2247
+ "spa",
2248
+ }
2249
+ )
2250
+
2251
+
2252
+ def _auth_integration_options(
2253
+ project: Project,
2254
+ words: set[str],
2255
+ ) -> tuple[str, ...]:
2256
+ """Offer authentication options that fit the detected project."""
2257
+ if words & _API_WORDS:
2258
+ return (
2259
+ "New JSON API with Bearer tokens.",
2260
+ "JWT in an HttpOnly cookie for HTML views.",
2261
+ "Both the JSON API and the HTML views.",
2262
+ "Other (describe).",
2263
+ )
2264
+ frameworks = {value.lower() for value in project.frameworks}
2265
+ if "django" in frameworks:
2266
+ return (
2267
+ "Django sessions with the built-in login, logout and registration "
2268
+ "views and forms (recommended for level 1).",
2269
+ "Django sessions for the HTML views plus a JSON API with tokens.",
2270
+ "Other (describe).",
2271
+ )
2272
+ return (
2273
+ "Server-side sessions with the framework's built-in authentication "
2274
+ "(recommended for level 1).",
2275
+ "Sessions for the HTML views plus a JSON API with tokens.",
2276
+ "Other (describe).",
2277
+ )
2278
+
2279
+
2238
2280
  def _words(text: str) -> set[str]:
2239
2281
  return set(re.findall(r"[a-z0-9_]+", text))
2240
2282
 
@@ -85,6 +85,7 @@ def build_spec_prompt(
85
85
  "execution_mode": execution_mode,
86
86
  "project_mode": project_mode,
87
87
  "language_note": _language_note(language),
88
+ "language_first": _language_first(language),
88
89
  "architecture_note": architecture_note,
89
90
  "discovery_note": discovery_note,
90
91
  "mode_instructions": mode_instructions,
@@ -135,6 +136,7 @@ def build_discovery_prompt(
135
136
  "harness_name": harness_name,
136
137
  "execution_mode": execution_mode,
137
138
  "language_note": _discovery_language_note(language),
139
+ "language_first": _language_first(language),
138
140
  "mode_instructions": _discovery_mode_instructions(
139
141
  discovery_path,
140
142
  execution_mode,
@@ -469,6 +471,15 @@ def _language_note(language: str) -> str:
469
471
  )
470
472
 
471
473
 
474
+ def _language_first(language: str) -> str:
475
+ """Return the one-line language rule placed at the top of a prompt."""
476
+ target = (language or "en").strip() or "en"
477
+ return (
478
+ f"Write every message to the user in the language `{target}`, "
479
+ "starting with your first one."
480
+ )
481
+
482
+
472
483
  def _discovery_language_note(language: str) -> str:
473
484
  """Return the prompt instruction that selects the conversation language."""
474
485
  target = (language or "en").strip() or "en"
@@ -481,8 +492,8 @@ def _discovery_language_note(language: str) -> str:
481
492
  "faithfully into the target language and write the translations into "
482
493
  "the discovery record in place. Do not add, remove or re-scope "
483
494
  "questions or decisions while translating. Preserve every id, "
484
- "category, materiality, status, blocking flag, evidence entry and "
485
- "option count, and keep paths, field names, category identifiers, "
495
+ "category, materiality, status, blocking flag and evidence entry, "
496
+ "and keep paths, field names, category identifiers, "
486
497
  "`Qn`/`An` identifiers, commands and digests exactly as shown. Do "
487
498
  "not ask or answer in English unless the target language is `en`."
488
499
  )
@@ -1,5 +1,7 @@
1
1
  # DevFlow Discovery Task
2
2
 
3
+ {{language_first}}
4
+
3
5
  You are the discovery agent for the project `{{project_name}}`.
4
6
 
5
7
  ## Source of Truth
@@ -151,6 +153,14 @@ user-visible behavior, security or authorization, persisted data or
151
153
  migrations, an external dependency, the architecture, or would be
152
154
  expensive to reverse.
153
155
 
156
+ ## Exploring the Project
157
+
158
+ Search only the project's own files. Ignore virtual environments and
159
+ installed dependencies (`venv`, `.venv`, `env`, `node_modules`,
160
+ `site-packages`, build output) when listing or searching files. Read a
161
+ dependency's source only when one specific fact is needed as evidence,
162
+ and read just that part.
163
+
154
164
  ## Resolution Before Questions
155
165
 
156
166
  Resolve a decision from the user's explicit answers and existing
@@ -350,10 +360,15 @@ assumption is unaccepted, and to `complete` only when nothing remains.
350
360
  - Do not accept assumptions on the user's behalf. Acceptance is an
351
361
  explicit human action.
352
362
  - Preserve every existing id, category, materiality, status, blocking
353
- flag, evidence entry, option count and the meaning of every decision.
363
+ flag, evidence entry and the meaning of every answered decision.
354
364
  When the target language differs, translate question, reason and
355
365
  option text into it instead of adding, removing or re-scoping
356
366
  decisions.
367
+ - A `pending` question that nobody has answered yet, including the
368
+ questions DevFlow generated before this session, is a proposal: you
369
+ may rewrite its wording and options so they fit the project, put the
370
+ recommended level-1 option first and add a `next_level`. Keep its id,
371
+ category and the subject of the decision.
357
372
  - Never change the request, `spec_id`, `change` or `project_mode`.
358
373
  - When you discover a requirement gap, append a new question instead
359
374
  of hiding it in an answer or an assumption.
@@ -1,5 +1,7 @@
1
1
  # DevFlow Specification Task
2
2
 
3
+ {{language_first}}
4
+
3
5
  <!-- devflow:mode existing -->
4
6
  You are the specification agent for the project `{{project_name}}`.
5
7
  <!-- /devflow:mode -->
@@ -41,6 +43,10 @@ primary design inputs. The manifest is a declaration, not evidence of
41
43
  implemented code.
42
44
  <!-- /devflow:mode -->
43
45
 
46
+ Search only the project's own files: ignore virtual environments and
47
+ installed dependencies (`venv`, `.venv`, `node_modules`,
48
+ `site-packages`) unless one specific fact from a dependency is needed.
49
+
44
50
  ## Documentation Language
45
51
 
46
52
  {{language_note}}
@@ -959,3 +959,54 @@ def test_interactive_discovery_records_answers_and_generates_spec(
959
959
  assert f"`{result.discovery_digest}`" in result.spec.path.read_text(
960
960
  encoding="utf-8"
961
961
  )
962
+
963
+
964
+ def _auth_options(tmp_path: Path, request: str, frameworks: list[str]):
965
+ document = DiscoveryPlanner().build(
966
+ request=request,
967
+ spec_id="001",
968
+ change="001-auth",
969
+ project_mode="existing",
970
+ project=Project(
971
+ root=tmp_path,
972
+ name="demo",
973
+ project_type="backend",
974
+ frameworks=frameworks,
975
+ ),
976
+ profiles=(),
977
+ reference_paths=(),
978
+ category_paths={},
979
+ has_tests=True,
980
+ architecture=None,
981
+ now="2026-11-02T00:00:00Z",
982
+ )
983
+ question = next(
984
+ item
985
+ for item in document.questions
986
+ if item.question.startswith("How should authentication")
987
+ )
988
+ return question.options
989
+
990
+
991
+ def test_auth_question_fits_a_django_html_project(tmp_path: Path) -> None:
992
+ options = _auth_options(
993
+ tmp_path,
994
+ "Quiero crear un sistema de autenticación con registro, login y logout",
995
+ ["Django"],
996
+ )
997
+
998
+ assert options[0].startswith("Django sessions")
999
+ assert "recommended" in options[0]
1000
+ assert not any("Bearer" in option for option in options)
1001
+
1002
+
1003
+ def test_auth_question_offers_api_options_when_requested(
1004
+ tmp_path: Path,
1005
+ ) -> None:
1006
+ options = _auth_options(
1007
+ tmp_path,
1008
+ "Add login with JWT tokens for the mobile app",
1009
+ ["Django"],
1010
+ )
1011
+
1012
+ assert options[0] == "New JSON API with Bearer tokens."
@@ -1016,3 +1016,34 @@ def test_written_spec_has_no_checkboxes(tmp_path: Path) -> None:
1016
1016
  content = result.spec.path.read_text(encoding="utf-8")
1017
1017
  assert "[ ]" not in content
1018
1018
  assert "devflow approve 001" in content.split("## 11.", 1)[1]
1019
+
1020
+
1021
+ def test_prompts_start_with_the_language_and_skip_dependencies() -> None:
1022
+ from devflow.prompts import build_discovery_prompt, build_spec_prompt
1023
+
1024
+ common = {
1025
+ "request": "Add login",
1026
+ "project_name": "demo",
1027
+ "context_path": "context.md",
1028
+ "harness_name": "Fake",
1029
+ "execution_mode": "interactive",
1030
+ "permissions": AgentPermissions(),
1031
+ "language": "es",
1032
+ }
1033
+ discovery = build_discovery_prompt(
1034
+ **common,
1035
+ discovery_path="discovery.yaml",
1036
+ )
1037
+ spec = build_spec_prompt(
1038
+ **common,
1039
+ spec_path="spec.md",
1040
+ constitution_paths=[],
1041
+ )
1042
+
1043
+ for prompt in (discovery, spec):
1044
+ head = prompt.split("\n\n", 2)[1]
1045
+ assert "`es`" in head
1046
+ assert "starting with your first one" in head
1047
+ assert "node_modules" in prompt
1048
+ flat = " ".join(discovery.split())
1049
+ assert "is a proposal: you may rewrite its wording and options" in flat
File without changes