devflow-toolkit 0.3.0__tar.gz → 0.3.1__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 (73) hide show
  1. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/.gitignore +3 -0
  2. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/CHANGELOG.md +22 -0
  3. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/PKG-INFO +21 -7
  4. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/README.md +20 -6
  5. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/pyproject.toml +1 -1
  6. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/cli.py +1 -1
  7. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/approve.py +1 -1
  8. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/init.py +34 -0
  9. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/spec.py +20 -0
  10. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/config.py +66 -0
  11. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/discovery.py +43 -0
  12. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/spec_workflow.py +2 -0
  13. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/prompts/__init__.py +16 -0
  14. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/prompts/spec.greenfield.md +4 -0
  15. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/prompts/spec.md +4 -0
  16. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_cli.py +40 -0
  17. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_discovery.py +59 -0
  18. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_spec_workflow.py +16 -0
  19. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/LICENSE +0 -0
  20. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/__init__.py +0 -0
  21. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/__init__.py +0 -0
  22. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/agents.py +0 -0
  23. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/base.py +0 -0
  24. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/claude_code.py +0 -0
  25. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/codex.py +0 -0
  26. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/detector.py +0 -0
  27. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/instructions.py +0 -0
  28. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/kiro.py +0 -0
  29. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/opencode.py +0 -0
  30. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/adapters/registry.py +0 -0
  31. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/__init__.py +0 -0
  32. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/harness.py +0 -0
  33. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/commands/status.py +0 -0
  34. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/__init__.py +0 -0
  35. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/architecture.py +0 -0
  36. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/artifacts/__init__.py +0 -0
  37. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/artifacts/errors.py +0 -0
  38. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/artifacts/models.py +0 -0
  39. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/artifacts/store.py +0 -0
  40. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/clock.py +0 -0
  41. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/constitution.py +0 -0
  42. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/ports.py +0 -0
  43. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/profile_manager.py +0 -0
  44. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/project.py +0 -0
  45. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/specification.py +0 -0
  46. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/__init__.py +0 -0
  47. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/errors.py +0 -0
  48. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/events.py +0 -0
  49. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/locator.py +0 -0
  50. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/lock.py +0 -0
  51. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/manager.py +0 -0
  52. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/models.py +0 -0
  53. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/core/state/transitions.py +0 -0
  54. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/models/__init__.py +0 -0
  55. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/models/profile.py +0 -0
  56. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/models/project.py +0 -0
  57. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/ai-rag/constitution/ai-rag-standards.md +0 -0
  58. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/ai-rag/profile.yaml +0 -0
  59. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/base/constitution/architecture.md +0 -0
  60. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/base/constitution/code-standards.md +0 -0
  61. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/base/constitution/constitution.md +0 -0
  62. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/base/profile.yaml +0 -0
  63. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/django-backend/constitution/django-standards.md +0 -0
  64. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/django-backend/profile.yaml +0 -0
  65. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/fastapi-backend/constitution/fastapi-standards.md +0 -0
  66. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/profiles/fastapi-backend/profile.yaml +0 -0
  67. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/src/devflow/prompts/discovery.md +0 -0
  68. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_event_log.py +0 -0
  69. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_greenfield.py +0 -0
  70. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_hardening.py +0 -0
  71. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_harness_adapters.py +0 -0
  72. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_state.py +0 -0
  73. {devflow_toolkit-0.3.0 → devflow_toolkit-0.3.1}/tests/test_state_replay.py +0 -0
@@ -1,4 +1,7 @@
1
1
  .venv/
2
+ .env
3
+ .env.*
4
+ .pypirc
2
5
  __pycache__/
3
6
  *.py[cod]
4
7
  .pytest_cache/
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to DevFlow Toolkit are documented in this file.
4
4
 
5
+ ## 0.3.1 - 2026-11-03
6
+
7
+ ### Added
8
+
9
+ - Configurable language for specification prose through
10
+ `devflow init --language <code>` and `devflow spec --language <code>`.
11
+ - Persistent `documentation.language` setting in `.devflow/config.yaml`,
12
+ defaulting to `en`.
13
+ - Prompt instruction that selects the prose language while preserving
14
+ required headings, section numbers, `FR-XXX`/`AC-XXX` identifiers,
15
+ paths, commands and digests.
16
+
17
+ ### Changed
18
+
19
+ - Package version is `0.3.1`.
20
+ - Language names such as `Spanish` or `español` are normalized to their
21
+ short code.
22
+ - The deterministic `--no-agent` draft remains in English.
23
+ - Deterministic Discovery now blocks comment features until authorship,
24
+ authentication and moderation are decided. This prevents a comment
25
+ API from being marked complete when those decisions are missing.
26
+
5
27
  ## 0.3.0 - 2026-11-02
6
28
 
7
29
  First public release. Persistent Discovery decides whether a request is
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: devflow-toolkit
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: Specification workflow toolkit for AI-assisted software changes
5
5
  Author: DevFlow contributors
6
6
  License-Expression: MIT
@@ -42,7 +42,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
42
42
  selected agent harness is only the execution backend that drafts the
43
43
  specification.
44
44
 
45
- This is the `0.3.0` MVP. It implements the **discovery and
45
+ This is the `0.3.1` MVP. It implements the **discovery and
46
46
  specification stages only**. It supports two specification contexts:
47
47
  **Existing Project** (the default) and **Greenfield**. It is not a
48
48
  complete SDD platform and does not include planning, implementation or
@@ -114,7 +114,7 @@ pip install devflow-toolkit
114
114
  To install a specific built artifact instead:
115
115
 
116
116
  ```bash
117
- pip install devflow_toolkit-0.3.0-py3-none-any.whl
117
+ pip install devflow_toolkit-0.3.1-py3-none-any.whl
118
118
  ```
119
119
 
120
120
  Verify the installation:
@@ -144,10 +144,18 @@ Common options:
144
144
  devflow init --harness opencode --mode non-interactive
145
145
  devflow init --profile django-backend --name my-service
146
146
  devflow init --project-mode greenfield
147
+ devflow init --language es
147
148
  devflow init --no-agent
148
149
  devflow init --yes
149
150
  ```
150
151
 
152
+ `init --language <code>` sets the language used for specification
153
+ prose. The value is stored as `documentation.language` in
154
+ `.devflow/config.yaml` and defaults to `en`. Common language names such
155
+ as `Spanish` are normalized to their code (`es`). Required headings,
156
+ section numbers, `FR-XXX`/`AC-XXX` identifiers, paths, commands and
157
+ digests remain unchanged so structural validation still works.
158
+
151
159
  `init --project-mode greenfield` creates `.devflow/architecture.yaml`
152
160
  from a template when it does not exist. It never overwrites an existing
153
161
  manifest. Edit the manifest before running a Greenfield specification;
@@ -270,7 +278,7 @@ as an architectural constraint when it is present.
270
278
 
271
279
  ### Harnesses
272
280
 
273
- | Harness | Status in 0.3.0 |
281
+ | Harness | Status in 0.3.1 |
274
282
  | --- | --- |
275
283
  | OpenCode | Verified end-to-end in non-interactive mode |
276
284
  | Codex | Integration files are generated, but not verified for this release |
@@ -402,7 +410,7 @@ require Discovery.
402
410
  6. Record the approval.
403
411
  7. Inspect the state, artifacts and approval digests.
404
412
 
405
- Available commands in `0.3.0`:
413
+ Available commands in `0.3.1`:
406
414
 
407
415
  | Command | Status |
408
416
  | --- | --- |
@@ -468,11 +476,17 @@ Useful options:
468
476
  ```bash
469
477
  devflow spec "Description" --harness opencode --mode non-interactive
470
478
  devflow spec "Description" --no-agent
479
+ devflow spec "Description" --language es
471
480
  devflow spec "Change in a real project" --project-mode existing
472
481
  devflow spec "Create a new service" --project-mode greenfield
473
482
  devflow spec --continue 006
474
483
  ```
475
484
 
485
+ `spec --language <code>` overrides the configured language for that run
486
+ without changing `.devflow/config.yaml`. The deterministic `--no-agent`
487
+ draft remains in English; the language setting applies to specifications
488
+ written by an agent.
489
+
476
490
  If the harness is unavailable, fails, or returns an invalid document,
477
491
  DevFlow writes a deterministic draft and reports the reason. The command
478
492
  remains usable in CI and on machines without an AI harness, but the draft
@@ -497,7 +511,7 @@ devflow approve 001 --stage spec
497
511
  ```
498
512
 
499
513
  Approval is explicit and binds the decision to the current artifact
500
- digests. For a `0.3.0` change it binds `spec.md`, `discovery.yaml` and,
514
+ digests. For a `0.3.1` change it binds `spec.md`, `discovery.yaml` and,
501
515
  when a manifest applies, the architecture manifest digest. Repeating the
502
516
  same approval is a no-op. If an artifact changes after validation,
503
517
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -507,7 +521,7 @@ Discovery must be complete before approval. If it is not, approval fails
507
521
  and names the pending questions and assumptions. Legacy `0.2.0` changes
508
522
  without `discovery.yaml` remain approvable with a warning.
509
523
 
510
- Only the `spec` stage is available in `0.3.0`. `--stage plan` and
524
+ Only the `spec` stage is available in `0.3.1`. `--stage plan` and
511
525
  `--stage review` are rejected. There are no `plan`, `implement` or
512
526
  `review` commands in this release.
513
527
 
@@ -10,7 +10,7 @@ anyone starts implementing it. DevFlow owns the workflow state; the
10
10
  selected agent harness is only the execution backend that drafts the
11
11
  specification.
12
12
 
13
- This is the `0.3.0` MVP. It implements the **discovery and
13
+ This is the `0.3.1` MVP. It implements the **discovery and
14
14
  specification stages only**. It supports two specification contexts:
15
15
  **Existing Project** (the default) and **Greenfield**. It is not a
16
16
  complete SDD platform and does not include planning, implementation or
@@ -82,7 +82,7 @@ pip install devflow-toolkit
82
82
  To install a specific built artifact instead:
83
83
 
84
84
  ```bash
85
- pip install devflow_toolkit-0.3.0-py3-none-any.whl
85
+ pip install devflow_toolkit-0.3.1-py3-none-any.whl
86
86
  ```
87
87
 
88
88
  Verify the installation:
@@ -112,10 +112,18 @@ Common options:
112
112
  devflow init --harness opencode --mode non-interactive
113
113
  devflow init --profile django-backend --name my-service
114
114
  devflow init --project-mode greenfield
115
+ devflow init --language es
115
116
  devflow init --no-agent
116
117
  devflow init --yes
117
118
  ```
118
119
 
120
+ `init --language <code>` sets the language used for specification
121
+ prose. The value is stored as `documentation.language` in
122
+ `.devflow/config.yaml` and defaults to `en`. Common language names such
123
+ as `Spanish` are normalized to their code (`es`). Required headings,
124
+ section numbers, `FR-XXX`/`AC-XXX` identifiers, paths, commands and
125
+ digests remain unchanged so structural validation still works.
126
+
119
127
  `init --project-mode greenfield` creates `.devflow/architecture.yaml`
120
128
  from a template when it does not exist. It never overwrites an existing
121
129
  manifest. Edit the manifest before running a Greenfield specification;
@@ -238,7 +246,7 @@ as an architectural constraint when it is present.
238
246
 
239
247
  ### Harnesses
240
248
 
241
- | Harness | Status in 0.3.0 |
249
+ | Harness | Status in 0.3.1 |
242
250
  | --- | --- |
243
251
  | OpenCode | Verified end-to-end in non-interactive mode |
244
252
  | Codex | Integration files are generated, but not verified for this release |
@@ -370,7 +378,7 @@ require Discovery.
370
378
  6. Record the approval.
371
379
  7. Inspect the state, artifacts and approval digests.
372
380
 
373
- Available commands in `0.3.0`:
381
+ Available commands in `0.3.1`:
374
382
 
375
383
  | Command | Status |
376
384
  | --- | --- |
@@ -436,11 +444,17 @@ Useful options:
436
444
  ```bash
437
445
  devflow spec "Description" --harness opencode --mode non-interactive
438
446
  devflow spec "Description" --no-agent
447
+ devflow spec "Description" --language es
439
448
  devflow spec "Change in a real project" --project-mode existing
440
449
  devflow spec "Create a new service" --project-mode greenfield
441
450
  devflow spec --continue 006
442
451
  ```
443
452
 
453
+ `spec --language <code>` overrides the configured language for that run
454
+ without changing `.devflow/config.yaml`. The deterministic `--no-agent`
455
+ draft remains in English; the language setting applies to specifications
456
+ written by an agent.
457
+
444
458
  If the harness is unavailable, fails, or returns an invalid document,
445
459
  DevFlow writes a deterministic draft and reports the reason. The command
446
460
  remains usable in CI and on machines without an AI harness, but the draft
@@ -465,7 +479,7 @@ devflow approve 001 --stage spec
465
479
  ```
466
480
 
467
481
  Approval is explicit and binds the decision to the current artifact
468
- digests. For a `0.3.0` change it binds `spec.md`, `discovery.yaml` and,
482
+ digests. For a `0.3.1` change it binds `spec.md`, `discovery.yaml` and,
469
483
  when a manifest applies, the architecture manifest digest. Repeating the
470
484
  same approval is a no-op. If an artifact changes after validation,
471
485
  DevFlow marks it stale and refuses approval until it is regenerated and
@@ -475,7 +489,7 @@ Discovery must be complete before approval. If it is not, approval fails
475
489
  and names the pending questions and assumptions. Legacy `0.2.0` changes
476
490
  without `discovery.yaml` remain approvable with a warning.
477
491
 
478
- Only the `spec` stage is available in `0.3.0`. `--stage plan` and
492
+ Only the `spec` stage is available in `0.3.1`. `--stage plan` and
479
493
  `--stage review` are rejected. There are no `plan`, `implement` or
480
494
  `review` commands in this release.
481
495
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "devflow-toolkit"
7
- version = "0.3.0"
7
+ version = "0.3.1"
8
8
  description = "Specification workflow toolkit for AI-assisted software changes"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -31,7 +31,7 @@ def version() -> None:
31
31
  try:
32
32
  current_version = package_version("devflow-toolkit")
33
33
  except PackageNotFoundError:
34
- current_version = "0.3.0"
34
+ current_version = "0.3.1"
35
35
  console.print(f"DevFlow v{current_version}")
36
36
 
37
37
 
@@ -57,7 +57,7 @@ def _approve(spec_id: str, path: Path, stage: str) -> None:
57
57
  normalized = stage.strip().lower()
58
58
  if normalized != "spec":
59
59
  msg = (
60
- f"Stage '{stage}' is not available in DevFlow 0.3.0. "
60
+ f"Stage '{stage}' is not available in DevFlow 0.3.1. "
61
61
  "Only the 'spec' stage can be approved."
62
62
  )
63
63
  raise UnsupportedStageError(msg)
@@ -22,10 +22,12 @@ from devflow.core.architecture import (
22
22
  create_architecture_template,
23
23
  )
24
24
  from devflow.core.config import (
25
+ DEFAULT_DOCUMENTATION_LANGUAGE,
25
26
  EXECUTION_MODES,
26
27
  ConfigError,
27
28
  ConfigManager,
28
29
  DevFlowConfig,
30
+ canonical_documentation_language,
29
31
  canonical_execution_mode,
30
32
  )
31
33
  from devflow.core.constitution import Constitution, ConstitutionLoader
@@ -94,6 +96,13 @@ def init(
94
96
  "Default specification context: existing or greenfield."
95
97
  ),
96
98
  ),
99
+ language: Optional[str] = typer.Option(
100
+ None,
101
+ "--language",
102
+ help=(
103
+ "Language for specification prose, for example en, es or es-MX."
104
+ ),
105
+ ),
97
106
  ) -> None:
98
107
  """Initialize DevFlow in a project."""
99
108
  try:
@@ -106,6 +115,7 @@ def init(
106
115
  mode,
107
116
  no_agent,
108
117
  project_mode,
118
+ language,
109
119
  )
110
120
  except (
111
121
  ArchitectureError,
@@ -128,10 +138,19 @@ def _initialize(
128
138
  mode: Optional[str],
129
139
  no_agent: bool,
130
140
  project_mode: Optional[str],
141
+ language: Optional[str],
131
142
  ) -> None:
132
143
  requested_harness = _requested_harness(harness, no_agent)
133
144
  execution_mode = _requested_mode(mode)
134
145
  requested_project_mode = _requested_project_mode(project_mode)
146
+ requested_language = (
147
+ canonical_documentation_language(language)
148
+ if language is not None
149
+ else DEFAULT_DOCUMENTATION_LANGUAGE
150
+ )
151
+ if not requested_language:
152
+ msg = "The documentation language cannot be empty."
153
+ raise ConfigError(msg)
135
154
 
136
155
  root = path.resolve()
137
156
  if not root.exists():
@@ -176,6 +195,8 @@ def _initialize(
176
195
  mode_override=mode is not None,
177
196
  project_mode=requested_project_mode,
178
197
  project_mode_override=project_mode is not None,
198
+ language=requested_language,
199
+ language_override=language is not None,
179
200
  allow_prompt=not yes and sys.stdin.isatty(),
180
201
  )
181
202
  return
@@ -209,6 +230,7 @@ def _initialize(
209
230
  project_mode=requested_project_mode,
210
231
  agent_harness=requested_harness,
211
232
  execution_mode=execution_mode,
233
+ documentation_language=requested_language,
212
234
  )
213
235
  config_manager.ensure_directories(config)
214
236
  _ensure_architecture_template(config, requested_project_mode)
@@ -231,6 +253,10 @@ def _initialize(
231
253
  console.print(
232
254
  f"[bold]Project mode:[/bold] {config.project_mode}"
233
255
  )
256
+ console.print(
257
+ f"[bold]Documentation language:[/bold] "
258
+ f"{config.documentation_language}"
259
+ )
234
260
  console.print(
235
261
  "[bold]Detected profiles:[/bold] "
236
262
  + (", ".join(detected_names) or "none")
@@ -290,6 +316,8 @@ def _refresh_existing(
290
316
  mode_override: bool,
291
317
  project_mode: str,
292
318
  project_mode_override: bool,
319
+ language: str,
320
+ language_override: bool,
293
321
  allow_prompt: bool,
294
322
  ) -> None:
295
323
  if explicit_profiles:
@@ -316,6 +344,8 @@ def _refresh_existing(
316
344
  )
317
345
  if project_mode_override:
318
346
  config = config_manager.set_project_mode(project_mode)
347
+ if language_override:
348
+ config = config_manager.set_documentation_language(language)
319
349
 
320
350
  profiles = profile_manager.resolve(configured)
321
351
  installed = profile_manager.install_constitution(
@@ -344,6 +374,10 @@ def _refresh_existing(
344
374
  console.print(
345
375
  f"[bold]Project mode:[/bold] {config.project_mode}"
346
376
  )
377
+ console.print(
378
+ f"[bold]Documentation language:[/bold] "
379
+ f"{config.documentation_language}"
380
+ )
347
381
  if installed.copied:
348
382
  console.print(
349
383
  "[green]Missing constitution files restored:[/green] "
@@ -23,6 +23,7 @@ from devflow.core.config import (
23
23
  ConfigError,
24
24
  ConfigManager,
25
25
  DevFlowConfig,
26
+ canonical_documentation_language,
26
27
  canonical_execution_mode,
27
28
  )
28
29
  from devflow.core.constitution import ConstitutionError
@@ -94,6 +95,14 @@ def spec(
94
95
  "Does not create a new specification."
95
96
  ),
96
97
  ),
98
+ language: Optional[str] = typer.Option(
99
+ None,
100
+ "--language",
101
+ help=(
102
+ "Language for specification prose, for example en, es or es-MX. "
103
+ "Defaults to the configured language."
104
+ ),
105
+ ),
97
106
  ) -> None:
98
107
  """Generate or resume a specification for a change request."""
99
108
  try:
@@ -105,6 +114,7 @@ def spec(
105
114
  no_agent,
106
115
  project_mode,
107
116
  continue_id,
117
+ language,
108
118
  )
109
119
  except (
110
120
  ArchitectureError,
@@ -131,6 +141,7 @@ def _create_specification(
131
141
  no_agent: bool,
132
142
  project_mode: Optional[str],
133
143
  continue_id: Optional[str],
144
+ language: Optional[str] = None,
134
145
  ) -> None:
135
146
  request = (description or "").strip()
136
147
  resume = (continue_id or "").strip() or None
@@ -171,6 +182,14 @@ def _create_specification(
171
182
  effective_project_mode = _project_mode(
172
183
  project_mode or config.project_mode,
173
184
  )
185
+ documentation_language = (
186
+ canonical_documentation_language(language)
187
+ if language is not None
188
+ else config.documentation_language
189
+ )
190
+ if not documentation_language:
191
+ msg = "The documentation language cannot be empty."
192
+ raise ConfigError(msg)
174
193
 
175
194
  allow_prompt = sys.stdin.isatty()
176
195
  selected_harness, selection_warnings = resolve_harness(
@@ -190,6 +209,7 @@ def _create_specification(
190
209
  warnings=tuple([*mode_warnings, *selection_warnings]),
191
210
  project_mode=effective_project_mode,
192
211
  continue_spec_id=resume,
212
+ language=documentation_language,
193
213
  )
194
214
  )
195
215
 
@@ -22,6 +22,25 @@ DEFAULT_CONSTITUTION_PATH = Path(".devflow") / "constitution"
22
22
  DEFAULT_SPECIFICATIONS_PATH = Path(".devflow") / "specs"
23
23
  DEFAULT_PLANS_PATH = Path(".devflow") / "plans"
24
24
  DEFAULT_TEMPLATES_PATH = Path(".devflow") / "templates"
25
+ DEFAULT_DOCUMENTATION_LANGUAGE = "en"
26
+
27
+ _LANGUAGE_ALIASES = {
28
+ "aleman": "de",
29
+ "alemán": "de",
30
+ "english": "en",
31
+ "espanol": "es",
32
+ "español": "es",
33
+ "frances": "fr",
34
+ "francés": "fr",
35
+ "german": "de",
36
+ "ingles": "en",
37
+ "inglés": "en",
38
+ "italian": "it",
39
+ "italiano": "it",
40
+ "portugues": "pt",
41
+ "português": "pt",
42
+ "spanish": "es",
43
+ }
25
44
 
26
45
  SUPPORTED_HARNESSES = (
27
46
  "auto",
@@ -74,6 +93,12 @@ def canonical_harness_name(value: str) -> str:
74
93
  return _HARNESS_ALIASES.get(normalized, normalized)
75
94
 
76
95
 
96
+ def canonical_documentation_language(value: str) -> str:
97
+ """Normalize a documentation language name or common alias."""
98
+ normalized = value.strip().lower()
99
+ return _LANGUAGE_ALIASES.get(normalized, normalized)
100
+
101
+
77
102
  def canonical_execution_mode(value: str) -> str:
78
103
  """Normalize an execution mode name."""
79
104
  normalized = value.strip().lower().replace("_", "-")
@@ -193,6 +218,7 @@ class DevFlowConfig:
193
218
  specifications_path: Path
194
219
  plans_path: Path
195
220
  templates_path: Path
221
+ documentation_language: str
196
222
  agent: AgentSettings
197
223
 
198
224
  @property
@@ -260,6 +286,10 @@ class ConfigManager:
260
286
  data.get("templates", {}),
261
287
  "templates",
262
288
  )
289
+ documentation = self._mapping(
290
+ data.get("documentation", {}),
291
+ "documentation",
292
+ )
263
293
  agent = self._mapping(data.get("agent", {}), "agent")
264
294
  agent_settings = self._agent_settings(agent)
265
295
 
@@ -290,6 +320,17 @@ class ConfigManager:
290
320
 
291
321
  technologies = self._technologies(data.get("technologies", {}))
292
322
 
323
+ language_value = documentation.get(
324
+ "language",
325
+ DEFAULT_DOCUMENTATION_LANGUAGE,
326
+ )
327
+ if not isinstance(language_value, str) or not language_value.strip():
328
+ msg = "documentation.language must be a non-empty string."
329
+ raise ConfigError(msg)
330
+ documentation_language = canonical_documentation_language(
331
+ language_value,
332
+ )
333
+
293
334
  name = project.get("name", self.root.name)
294
335
  project_type = project.get("type", "unknown")
295
336
  project_mode = canonical_project_mode(
@@ -336,6 +377,7 @@ class ConfigManager:
336
377
  specifications_path=specifications_path,
337
378
  plans_path=plans_path,
338
379
  templates_path=templates_path,
380
+ documentation_language=documentation_language,
339
381
  agent=agent_settings,
340
382
  )
341
383
 
@@ -349,6 +391,7 @@ class ConfigManager:
349
391
  agent_harness: str = "auto",
350
392
  execution_mode: str = "interactive",
351
393
  permissions: AgentPermissions | None = None,
394
+ documentation_language: str = DEFAULT_DOCUMENTATION_LANGUAGE,
352
395
  ) -> DevFlowConfig:
353
396
  """Create and persist a configuration for a project."""
354
397
  normalized_project_mode = canonical_project_mode(project_mode)
@@ -373,6 +416,10 @@ class ConfigManager:
373
416
  )
374
417
  raise ConfigError(msg)
375
418
  agent_permissions = permissions or AgentPermissions()
419
+ language = canonical_documentation_language(documentation_language)
420
+ if not language:
421
+ msg = "documentation language must be a non-empty string."
422
+ raise ConfigError(msg)
376
423
  validated_files = [
377
424
  validate_document_name(filename, "constitution_files")
378
425
  for filename in constitution_files
@@ -405,6 +452,9 @@ class ConfigManager:
405
452
  "templates": {
406
453
  "path": DEFAULT_TEMPLATES_PATH.as_posix(),
407
454
  },
455
+ "documentation": {
456
+ "language": language,
457
+ },
408
458
  "agent": {
409
459
  "harness": harness,
410
460
  "execution": {
@@ -482,6 +532,22 @@ class ConfigManager:
482
532
  execution_mode=execution_mode,
483
533
  )
484
534
 
535
+ def set_documentation_language(self, language: str) -> DevFlowConfig:
536
+ """Persist the language used for specification prose."""
537
+ normalized = canonical_documentation_language(language)
538
+ if not normalized:
539
+ msg = "documentation language must be a non-empty string."
540
+ raise ConfigError(msg)
541
+
542
+ data = self._read_document()
543
+ documentation = data.get("documentation")
544
+ if not isinstance(documentation, dict):
545
+ documentation = {}
546
+ data["documentation"] = documentation
547
+ documentation["language"] = normalized
548
+ self._write_document(data)
549
+ return self.load()
550
+
485
551
  def set_project_mode(self, project_mode: str) -> DevFlowConfig:
486
552
  """Persist the default project mode used by the next spec runs."""
487
553
  normalized = canonical_project_mode(project_mode)
@@ -208,6 +208,30 @@ _DATA_WORDS = {
208
208
  "tabla",
209
209
  "table",
210
210
  }
211
+ _COMMENT_WORDS = {
212
+ "comment",
213
+ "comments",
214
+ "comentario",
215
+ "comentarios",
216
+ }
217
+ _COMMENT_DECISION_WORDS = {
218
+ "anonymous",
219
+ "anonimo",
220
+ "auth",
221
+ "authenticated",
222
+ "autenticacion",
223
+ "authentication",
224
+ "authorization",
225
+ "autorizacion",
226
+ "login",
227
+ "moderacion",
228
+ "moderation",
229
+ "moderator",
230
+ "permission",
231
+ "permiso",
232
+ "usuario",
233
+ "user",
234
+ }
211
235
  _PERSISTENCE_DECISIONS = {
212
236
  "archivo",
213
237
  "database",
@@ -1079,6 +1103,25 @@ class DiscoveryPlanner:
1079
1103
  )
1080
1104
  )
1081
1105
 
1106
+ if (
1107
+ words & _COMMENT_WORDS
1108
+ and not (words & _COMMENT_DECISION_WORDS)
1109
+ ):
1110
+ add_question(
1111
+ "security_authentication",
1112
+ "Who may create, edit or delete comments, and how are they "
1113
+ "identified?",
1114
+ "Comment ownership, authentication and moderation change "
1115
+ "permissions, data fields and API behavior.",
1116
+ (
1117
+ "Any visitor may comment without authentication.",
1118
+ "Only authenticated users may comment.",
1119
+ "Only authenticated users may comment, edit or delete their "
1120
+ "own comments.",
1121
+ "Comments require review before publication.",
1122
+ ),
1123
+ )
1124
+
1082
1125
  if (
1083
1126
  words & _DATA_WORDS
1084
1127
  and not project.databases
@@ -64,6 +64,7 @@ class SpecWorkflowRequest:
64
64
  warnings: tuple[str, ...] = ()
65
65
  project_mode: str = "existing"
66
66
  continue_spec_id: str | None = None
67
+ language: str = ""
67
68
 
68
69
 
69
70
  @dataclass(frozen=True)
@@ -467,6 +468,7 @@ class SpecWorkflow:
467
468
  execution_mode=request.execution_mode,
468
469
  permissions=config.permissions,
469
470
  project_mode=project_mode,
471
+ language=request.language or config.documentation_language,
470
472
  architecture_path=(
471
473
  architecture.relative_path(config.root)
472
474
  if architecture is not None
@@ -40,6 +40,7 @@ def build_spec_prompt(
40
40
  discovery_path: str = "",
41
41
  discovery_digest: str = "",
42
42
  discovery_decisions: list[str] | None = None,
43
+ language: str = "en",
43
44
  ) -> str:
44
45
  """Render the shared specification prompt for any harness."""
45
46
  template_name = (
@@ -80,6 +81,7 @@ def build_spec_prompt(
80
81
  "harness_name": harness_name,
81
82
  "execution_mode": execution_mode,
82
83
  "project_mode": project_mode,
84
+ "language_note": _language_note(language),
83
85
  "architecture_note": architecture_note,
84
86
  "discovery_note": discovery_note,
85
87
  "mode_instructions": mode_instructions,
@@ -123,6 +125,20 @@ def build_discovery_prompt(
123
125
  return rendered
124
126
 
125
127
 
128
+ def _language_note(language: str) -> str:
129
+ """Return the prompt instruction that selects the prose language."""
130
+ target = (language or "en").strip() or "en"
131
+ return (
132
+ f"Write all specification prose in the language identified as "
133
+ f"`{target}`. If that identifier is ambiguous, treat it as the "
134
+ "target language name.\n\n"
135
+ "Keep every required heading line, section number, `FR-XXX` and "
136
+ "`AC-XXX` identifier, field name, path, command, code block and "
137
+ "digest exactly as shown in this prompt. Do not translate or "
138
+ "reformat those tokens."
139
+ )
140
+
141
+
126
142
  def _discovery_mode_instructions(
127
143
  discovery_path: str,
128
144
  execution_mode: str,
@@ -18,6 +18,10 @@ before writing. The declared architecture manifest is the primary
18
18
  source of design decisions. The project constitution takes precedence
19
19
  over generic preferences.
20
20
 
21
+ ## Documentation Language
22
+
23
+ {{language_note}}
24
+
21
25
  ## Non-Negotiable Boundaries
22
26
 
23
27
  - There is no existing implementation. Do not invent source files,
@@ -18,6 +18,10 @@ documents before writing. The project constitution takes precedence
18
18
  over generic preferences. Existing code evidence takes precedence over
19
19
  assumptions.
20
20
 
21
+ ## Documentation Language
22
+
23
+ {{language_note}}
24
+
21
25
  ## Non-Negotiable Boundaries
22
26
 
23
27
  - Do not modify application source code, tests, configuration or
@@ -291,3 +291,43 @@ def test_unknown_explicit_profile_fails(tmp_path: Path) -> None:
291
291
 
292
292
  assert result.exit_code == 1
293
293
  assert "Unknown profile" in result.output
294
+
295
+
296
+ def test_init_persists_documentation_language(tmp_path: Path) -> None:
297
+ _write(
298
+ tmp_path / "pyproject.toml",
299
+ '[project]\nname = "demo"\nversion = "0.1.0"\n',
300
+ )
301
+ config_path = tmp_path / ".devflow" / "config.yaml"
302
+
303
+ result = runner.invoke(
304
+ app,
305
+ [
306
+ "init",
307
+ str(tmp_path),
308
+ "--yes",
309
+ "--harness",
310
+ "none",
311
+ "--language",
312
+ "es",
313
+ ],
314
+ )
315
+ assert result.exit_code == 0, result.output
316
+ data = yaml.safe_load(config_path.read_text(encoding="utf-8"))
317
+ assert data["documentation"]["language"] == "es"
318
+
319
+ result = runner.invoke(
320
+ app,
321
+ [
322
+ "init",
323
+ str(tmp_path),
324
+ "--yes",
325
+ "--harness",
326
+ "none",
327
+ "--language",
328
+ "English",
329
+ ],
330
+ )
331
+ assert result.exit_code == 0, result.output
332
+ data = yaml.safe_load(config_path.read_text(encoding="utf-8"))
333
+ assert data["documentation"]["language"] == "en"
@@ -240,6 +240,65 @@ def test_planner_blocks_a_contact_form_and_proposes_assumption(
240
240
  assert len(document.blockers()) == 2
241
241
 
242
242
 
243
+ def test_planner_blocks_comment_api_without_authorship_decision(
244
+ tmp_path: Path,
245
+ ) -> None:
246
+ document = DiscoveryPlanner().build(
247
+ request=(
248
+ "necesito crear un api que me permita colocar comentarios a los "
249
+ "libros de la biblioteca"
250
+ ),
251
+ spec_id="002",
252
+ change="002-necesito-crear-un-api-de-comentarios",
253
+ project_mode="existing",
254
+ project=Project(
255
+ root=tmp_path,
256
+ name="demo",
257
+ project_type="unknown",
258
+ ),
259
+ profiles=(),
260
+ reference_paths=(),
261
+ category_paths={},
262
+ has_tests=True,
263
+ architecture=None,
264
+ now="2026-11-03T00:00:00Z",
265
+ )
266
+
267
+ assert document.status == DISCOVERY_AWAITING
268
+ assert not document.is_complete
269
+ assert document.questions[0].category == "security_authentication"
270
+ assert "create, edit or delete comments" in document.questions[0].question
271
+
272
+
273
+ def test_planner_does_not_reask_comment_authorization_when_decided(
274
+ tmp_path: Path,
275
+ ) -> None:
276
+ document = DiscoveryPlanner().build(
277
+ request=(
278
+ "Add a comments API where only authenticated users may comment"
279
+ ),
280
+ spec_id="002",
281
+ change="002-add-a-comments-api",
282
+ project_mode="existing",
283
+ project=Project(
284
+ root=tmp_path,
285
+ name="demo",
286
+ project_type="unknown",
287
+ ),
288
+ profiles=(),
289
+ reference_paths=(),
290
+ category_paths={},
291
+ has_tests=True,
292
+ architecture=None,
293
+ now="2026-11-03T00:00:00Z",
294
+ )
295
+
296
+ assert all(
297
+ question.category != "security_authentication"
298
+ for question in document.questions
299
+ )
300
+
301
+
243
302
  def test_discovery_answers_and_acceptance_are_persistent(
244
303
  tmp_path: Path,
245
304
  ) -> None:
@@ -362,3 +362,19 @@ def test_core_does_not_import_harness_adapters() -> None:
362
362
  + ", ".join(violations)
363
363
  )
364
364
 
365
+
366
+
367
+ def test_spec_prompt_uses_configured_language(tmp_path: Path) -> None:
368
+ config = _config(tmp_path)
369
+ config = ConfigManager(tmp_path).set_documentation_language("es")
370
+ adapter = FakeAdapter()
371
+
372
+ _run(
373
+ config,
374
+ adapter=adapter,
375
+ executor=FakeExecutor(VALID_SPEC),
376
+ )
377
+
378
+ assert adapter.run_context is not None
379
+ assert "`es`" in adapter.run_context.prompt
380
+ assert "Do not translate or" in adapter.run_context.prompt
File without changes