devflow-toolkit 0.3.24__py3-none-any.whl → 0.3.26__py3-none-any.whl
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/commands/approve.py +11 -0
- devflow/commands/init.py +23 -0
- devflow/commands/security.py +67 -0
- devflow/commands/status.py +18 -0
- devflow/core/config.py +17 -0
- devflow/core/discovery.py +16 -2
- devflow/core/security_tools.py +301 -0
- devflow/core/specification.py +93 -5
- devflow/prompts/discovery.md +14 -8
- devflow/prompts/spec.md +12 -6
- {devflow_toolkit-0.3.24.dist-info → devflow_toolkit-0.3.26.dist-info}/METADATA +63 -12
- {devflow_toolkit-0.3.24.dist-info → devflow_toolkit-0.3.26.dist-info}/RECORD +15 -13
- {devflow_toolkit-0.3.24.dist-info → devflow_toolkit-0.3.26.dist-info}/WHEEL +0 -0
- {devflow_toolkit-0.3.24.dist-info → devflow_toolkit-0.3.26.dist-info}/entry_points.txt +0 -0
- {devflow_toolkit-0.3.24.dist-info → devflow_toolkit-0.3.26.dist-info}/licenses/LICENSE +0 -0
devflow/commands/approve.py
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import sys
|
|
5
6
|
from pathlib import Path
|
|
6
7
|
|
|
7
8
|
import typer
|
|
8
9
|
from rich.console import Console
|
|
9
10
|
|
|
11
|
+
from devflow.commands.security import offer_security_tools
|
|
10
12
|
from devflow.core.artifacts.errors import ArtifactError
|
|
11
13
|
from devflow.core.config import ConfigError, ConfigManager
|
|
12
14
|
from devflow.core.discovery import DiscoveryError
|
|
@@ -99,3 +101,12 @@ def _approve(spec_id: str, path: Path, stage: str) -> None:
|
|
|
99
101
|
"Changing an approved artifact marks it stale and blocks the "
|
|
100
102
|
"workflow until it is validated again.[/dim]"
|
|
101
103
|
)
|
|
104
|
+
if result.changed:
|
|
105
|
+
# Implementation starts after the first approval: this is when
|
|
106
|
+
# checks that review code on every commit become useful.
|
|
107
|
+
offer_security_tools(
|
|
108
|
+
config,
|
|
109
|
+
ProjectDetector().detect(config.root),
|
|
110
|
+
console,
|
|
111
|
+
allow_prompt=sys.stdin.isatty(),
|
|
112
|
+
)
|
devflow/commands/init.py
CHANGED
|
@@ -37,6 +37,10 @@ from devflow.core.ports import (
|
|
|
37
37
|
SetupResult,
|
|
38
38
|
build_setup_context,
|
|
39
39
|
)
|
|
40
|
+
from devflow.commands.security import (
|
|
41
|
+
decline_security_tools,
|
|
42
|
+
install_security_tools,
|
|
43
|
+
)
|
|
40
44
|
from devflow.core.profile_manager import ProfileError, ProfileManager
|
|
41
45
|
from devflow.core.project import ProjectDetector
|
|
42
46
|
from devflow.models.profile import Profile
|
|
@@ -113,6 +117,15 @@ def init(
|
|
|
113
117
|
"during an interactive init."
|
|
114
118
|
),
|
|
115
119
|
),
|
|
120
|
+
security_tools: Optional[bool] = typer.Option(
|
|
121
|
+
None,
|
|
122
|
+
"--security-tools/--no-security-tools",
|
|
123
|
+
help=(
|
|
124
|
+
"Install now the local security checks (Semgrep, Bandit, "
|
|
125
|
+
"pip-audit, gitleaks) that review code on every commit. Without "
|
|
126
|
+
"this flag they are offered after the first spec approval."
|
|
127
|
+
),
|
|
128
|
+
),
|
|
116
129
|
) -> None:
|
|
117
130
|
"""Initialize DevFlow in a project."""
|
|
118
131
|
try:
|
|
@@ -127,6 +140,7 @@ def init(
|
|
|
127
140
|
project_mode,
|
|
128
141
|
language,
|
|
129
142
|
model,
|
|
143
|
+
security_tools,
|
|
130
144
|
)
|
|
131
145
|
except (
|
|
132
146
|
ArchitectureError,
|
|
@@ -151,6 +165,7 @@ def _initialize(
|
|
|
151
165
|
project_mode: Optional[str],
|
|
152
166
|
language: Optional[str],
|
|
153
167
|
model: Optional[str],
|
|
168
|
+
security_tools: Optional[bool] = None,
|
|
154
169
|
) -> None:
|
|
155
170
|
requested_harness = _requested_harness(harness, no_agent)
|
|
156
171
|
requested_model = (model or "").strip()
|
|
@@ -216,6 +231,10 @@ def _initialize(
|
|
|
216
231
|
model_override=model is not None,
|
|
217
232
|
allow_prompt=not yes and sys.stdin.isatty(),
|
|
218
233
|
)
|
|
234
|
+
if security_tools:
|
|
235
|
+
install_security_tools(config_manager.load(), project, console)
|
|
236
|
+
elif security_tools is False:
|
|
237
|
+
decline_security_tools(config_manager.load())
|
|
219
238
|
return
|
|
220
239
|
|
|
221
240
|
selected = list(explicit_profiles) or detected_names
|
|
@@ -323,6 +342,10 @@ def _initialize(
|
|
|
323
342
|
f"[green]Specifications directory:[/green] "
|
|
324
343
|
f"{config.specifications_path.relative_to(root)}"
|
|
325
344
|
)
|
|
345
|
+
if security_tools:
|
|
346
|
+
install_security_tools(config, project, console)
|
|
347
|
+
elif security_tools is False:
|
|
348
|
+
decline_security_tools(config)
|
|
326
349
|
console.print(
|
|
327
350
|
"\nNext: [bold]devflow spec \"Describe the change\"[/bold]"
|
|
328
351
|
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Offer and install the local security checks used during implementation."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
|
|
8
|
+
from devflow.core import security_tools
|
|
9
|
+
from devflow.core.config import ConfigManager, DevFlowConfig
|
|
10
|
+
from devflow.models.project import Project
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def install_security_tools(
|
|
14
|
+
config: DevFlowConfig,
|
|
15
|
+
project: Project,
|
|
16
|
+
console: Console,
|
|
17
|
+
) -> None:
|
|
18
|
+
"""Install the checks and report the result."""
|
|
19
|
+
plan = security_tools.plan_for(project, config.root)
|
|
20
|
+
result = security_tools.install(config.root, plan)
|
|
21
|
+
ConfigManager(config.root).mark_security_tools_offered()
|
|
22
|
+
if result.config_status in {"created", "updated"}:
|
|
23
|
+
console.print(
|
|
24
|
+
f"[green]Security checks configured:[/green] "
|
|
25
|
+
f"{security_tools.PRECOMMIT_CONFIG} ({', '.join(plan.tools)})"
|
|
26
|
+
)
|
|
27
|
+
for message in result.messages:
|
|
28
|
+
console.print(f"[green]{message}[/green]")
|
|
29
|
+
for warning in result.warnings:
|
|
30
|
+
console.print(f"[yellow]Warning:[/yellow] {warning}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def decline_security_tools(config: DevFlowConfig) -> None:
|
|
34
|
+
"""Remember that the user does not want the offer again."""
|
|
35
|
+
ConfigManager(config.root).mark_security_tools_offered()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def offer_security_tools(
|
|
39
|
+
config: DevFlowConfig,
|
|
40
|
+
project: Project,
|
|
41
|
+
console: Console,
|
|
42
|
+
*,
|
|
43
|
+
allow_prompt: bool,
|
|
44
|
+
) -> None:
|
|
45
|
+
"""Offer the checks once, when implementation is about to start."""
|
|
46
|
+
manager = ConfigManager(config.root)
|
|
47
|
+
if (
|
|
48
|
+
not allow_prompt
|
|
49
|
+
or security_tools.is_configured(config.root)
|
|
50
|
+
or manager.security_tools_offered()
|
|
51
|
+
):
|
|
52
|
+
return
|
|
53
|
+
plan = security_tools.plan_for(project, config.root)
|
|
54
|
+
console.print()
|
|
55
|
+
for line in security_tools.describe(plan, config.documentation_language):
|
|
56
|
+
console.print(line)
|
|
57
|
+
if typer.confirm(
|
|
58
|
+
security_tools.confirm_prompt(config.documentation_language),
|
|
59
|
+
default=True,
|
|
60
|
+
):
|
|
61
|
+
install_security_tools(config, project, console)
|
|
62
|
+
return
|
|
63
|
+
manager.mark_security_tools_offered()
|
|
64
|
+
console.print(
|
|
65
|
+
"[dim]You can add them later with "
|
|
66
|
+
"'devflow init --security-tools'.[/dim]"
|
|
67
|
+
)
|
devflow/commands/status.py
CHANGED
|
@@ -33,6 +33,14 @@ from devflow.core.state import (
|
|
|
33
33
|
console = Console()
|
|
34
34
|
error_console = Console(stderr=True)
|
|
35
35
|
|
|
36
|
+
_REVIEW_CHECKLIST = (
|
|
37
|
+
"The scope matches the request and the Discovery decisions.",
|
|
38
|
+
"Every FR-XXX has at least one AC-XXX that verifies it.",
|
|
39
|
+
"Every AC-XXX can be checked by a test or an inspection.",
|
|
40
|
+
"Security risks in section 4 are mitigated or explicitly accepted.",
|
|
41
|
+
"Section 10 excludes what you do not want built now.",
|
|
42
|
+
)
|
|
43
|
+
|
|
36
44
|
|
|
37
45
|
def status(
|
|
38
46
|
spec_id: str = typer.Argument(
|
|
@@ -127,6 +135,16 @@ def _status(spec_id: str, path: Path) -> None:
|
|
|
127
135
|
"They are not approved and do not advance the change.[/dim]"
|
|
128
136
|
)
|
|
129
137
|
|
|
138
|
+
spec_record = state.artifacts.get("spec")
|
|
139
|
+
if (
|
|
140
|
+
state.status == WorkflowStatus.DRAFT.value
|
|
141
|
+
and spec_record is not None
|
|
142
|
+
and spec_record.status == ArtifactStatus.VALIDATED.value
|
|
143
|
+
):
|
|
144
|
+
console.print("\n[bold]Review before approving[/bold]")
|
|
145
|
+
for item in _REVIEW_CHECKLIST:
|
|
146
|
+
console.print(f" - {item}")
|
|
147
|
+
|
|
130
148
|
next_step = _next_step(current, location, discovery)
|
|
131
149
|
if next_step:
|
|
132
150
|
console.print(f"\n[bold]Next:[/bold] {next_step}")
|
devflow/core/config.py
CHANGED
|
@@ -624,6 +624,23 @@ class ConfigManager:
|
|
|
624
624
|
self._write_document(data)
|
|
625
625
|
return self.load()
|
|
626
626
|
|
|
627
|
+
def security_tools_offered(self) -> bool:
|
|
628
|
+
"""Return whether the local security checks were already offered."""
|
|
629
|
+
security = self._read_document().get("security")
|
|
630
|
+
return isinstance(security, dict) and bool(
|
|
631
|
+
security.get("tools_offered")
|
|
632
|
+
)
|
|
633
|
+
|
|
634
|
+
def mark_security_tools_offered(self) -> None:
|
|
635
|
+
"""Remember that the local security checks were offered once."""
|
|
636
|
+
data = self._read_document()
|
|
637
|
+
security = data.get("security")
|
|
638
|
+
if not isinstance(security, dict):
|
|
639
|
+
security = {}
|
|
640
|
+
data["security"] = security
|
|
641
|
+
security["tools_offered"] = True
|
|
642
|
+
self._write_document(data)
|
|
643
|
+
|
|
627
644
|
def ensure_directories(self, config: DevFlowConfig) -> None:
|
|
628
645
|
"""Create the directories referenced by the configuration."""
|
|
629
646
|
for path in (
|
devflow/core/discovery.py
CHANGED
|
@@ -490,9 +490,19 @@ class NextLevel:
|
|
|
490
490
|
|
|
491
491
|
option: str
|
|
492
492
|
why: str
|
|
493
|
+
title: str = ""
|
|
494
|
+
|
|
495
|
+
@property
|
|
496
|
+
def spec_title(self) -> str:
|
|
497
|
+
"""Return the request to use for a later specification."""
|
|
498
|
+
return self.title or self.option
|
|
493
499
|
|
|
494
500
|
def to_dict(self) -> dict[str, Any]:
|
|
495
|
-
|
|
501
|
+
data: dict[str, Any] = {"option": self.option}
|
|
502
|
+
if self.title:
|
|
503
|
+
data["title"] = self.title
|
|
504
|
+
data["why"] = self.why
|
|
505
|
+
return data
|
|
496
506
|
|
|
497
507
|
|
|
498
508
|
@dataclass(frozen=True)
|
|
@@ -701,7 +711,7 @@ class DiscoveryDocument:
|
|
|
701
711
|
continue
|
|
702
712
|
add(
|
|
703
713
|
DeferredItem(
|
|
704
|
-
title=question.next_level.
|
|
714
|
+
title=question.next_level.spec_title,
|
|
705
715
|
why=question.next_level.why,
|
|
706
716
|
question_id=question.id,
|
|
707
717
|
)
|
|
@@ -1310,6 +1320,10 @@ class DiscoveryManager:
|
|
|
1310
1320
|
next_level_mapping.get("why"),
|
|
1311
1321
|
f"{identifier}.next_level.why",
|
|
1312
1322
|
),
|
|
1323
|
+
title=_optional_text(
|
|
1324
|
+
next_level_mapping.get("title"),
|
|
1325
|
+
f"{identifier}.next_level.title",
|
|
1326
|
+
) or "",
|
|
1313
1327
|
)
|
|
1314
1328
|
# The recommended option is level 1, never the next level.
|
|
1315
1329
|
if _RECOMMENDED.search(next_level.option):
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"""Local security tools that run on every commit, without tokens."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib.util
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from collections.abc import Callable, Sequence
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from devflow.core.artifacts.store import ArtifactStore
|
|
14
|
+
from devflow.models.project import Project
|
|
15
|
+
|
|
16
|
+
PRECOMMIT_CONFIG = ".pre-commit-config.yaml"
|
|
17
|
+
PRECOMMIT_MARKER = "# devflow:managed"
|
|
18
|
+
|
|
19
|
+
# Pinned hook revisions. Update them with `pre-commit autoupdate`.
|
|
20
|
+
GITLEAKS_REV = "v8.30.1"
|
|
21
|
+
SEMGREP_REV = "v1.184.0"
|
|
22
|
+
BANDIT_REV = "1.9.4"
|
|
23
|
+
PIP_AUDIT_REV = "v2.10.1"
|
|
24
|
+
|
|
25
|
+
Runner = Callable[[Sequence[str], Path], int]
|
|
26
|
+
|
|
27
|
+
_DESCRIPTIONS = {
|
|
28
|
+
"en": (
|
|
29
|
+
"Tools that run locally on every commit, without tokens:",
|
|
30
|
+
[
|
|
31
|
+
("Semgrep", "with rules for {semgrep_rules}"),
|
|
32
|
+
("Bandit", "for Python code"),
|
|
33
|
+
("pip-audit", "for vulnerable dependencies"),
|
|
34
|
+
("gitleaks", "for secrets in the code"),
|
|
35
|
+
],
|
|
36
|
+
"pre-commit (pre-commit.com) runs these tools automatically on "
|
|
37
|
+
"every commit.",
|
|
38
|
+
"Install them now?",
|
|
39
|
+
),
|
|
40
|
+
"es": (
|
|
41
|
+
"Herramientas que se ejecutan localmente en cada commit, sin tokens:",
|
|
42
|
+
[
|
|
43
|
+
("Semgrep", "con reglas para {semgrep_rules}"),
|
|
44
|
+
("Bandit", "para código Python"),
|
|
45
|
+
("pip-audit", "para dependencias vulnerables"),
|
|
46
|
+
("gitleaks", "para secretos en el código"),
|
|
47
|
+
],
|
|
48
|
+
"pre-commit (pre-commit.com) ejecuta esas herramientas "
|
|
49
|
+
"automáticamente en cada commit.",
|
|
50
|
+
"¿Instalarlas ahora?",
|
|
51
|
+
),
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class SecurityPlan:
|
|
57
|
+
"""Which hooks apply to a project."""
|
|
58
|
+
|
|
59
|
+
python: bool
|
|
60
|
+
django: bool
|
|
61
|
+
requirements: str | None
|
|
62
|
+
pyproject: bool
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def semgrep_configs(self) -> tuple[str, ...]:
|
|
66
|
+
configs: list[str] = []
|
|
67
|
+
if self.django:
|
|
68
|
+
configs.append("p/django")
|
|
69
|
+
elif self.python:
|
|
70
|
+
configs.append("p/python")
|
|
71
|
+
configs.append("p/owasp-top-ten")
|
|
72
|
+
return tuple(configs)
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def tools(self) -> tuple[str, ...]:
|
|
76
|
+
names = ["Semgrep"]
|
|
77
|
+
if self.python:
|
|
78
|
+
names.append("Bandit")
|
|
79
|
+
if self.requirements or self.pyproject:
|
|
80
|
+
names.append("pip-audit")
|
|
81
|
+
names.append("gitleaks")
|
|
82
|
+
return tuple(names)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class SecurityInstallResult:
|
|
87
|
+
"""What the installation changed and what still needs the user."""
|
|
88
|
+
|
|
89
|
+
config_status: str = ""
|
|
90
|
+
messages: list[str] = field(default_factory=list)
|
|
91
|
+
warnings: list[str] = field(default_factory=list)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def plan_for(project: Project, root: Path) -> SecurityPlan:
|
|
95
|
+
"""Select the hooks that apply to the detected project."""
|
|
96
|
+
languages = {value.lower() for value in project.languages}
|
|
97
|
+
frameworks = {value.lower() for value in project.frameworks}
|
|
98
|
+
requirements = None
|
|
99
|
+
for candidate in ("requirements.txt", "requirements/base.txt"):
|
|
100
|
+
if (root / candidate).is_file():
|
|
101
|
+
requirements = candidate
|
|
102
|
+
break
|
|
103
|
+
return SecurityPlan(
|
|
104
|
+
python="python" in languages,
|
|
105
|
+
django="django" in frameworks,
|
|
106
|
+
requirements=requirements,
|
|
107
|
+
pyproject=(root / "pyproject.toml").is_file(),
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def describe(plan: SecurityPlan, language: str) -> list[str]:
|
|
112
|
+
"""Return the user-facing description of the tools."""
|
|
113
|
+
base = (language or "en").split("-")[0].lower()
|
|
114
|
+
title, items, closing, _ = _DESCRIPTIONS.get(base, _DESCRIPTIONS["en"])
|
|
115
|
+
rules = " y ".join(
|
|
116
|
+
"Django" if config == "p/django"
|
|
117
|
+
else "Python" if config == "p/python"
|
|
118
|
+
else "OWASP"
|
|
119
|
+
for config in plan.semgrep_configs
|
|
120
|
+
)
|
|
121
|
+
if base != "es":
|
|
122
|
+
rules = rules.replace(" y ", " and ")
|
|
123
|
+
lines = [title]
|
|
124
|
+
for name, detail in items:
|
|
125
|
+
if name in plan.tools:
|
|
126
|
+
lines.append(f"- {name}, {detail.format(semgrep_rules=rules)};")
|
|
127
|
+
lines.append(closing)
|
|
128
|
+
return lines
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def confirm_prompt(language: str) -> str:
|
|
132
|
+
"""Return the confirmation question in the documentation language."""
|
|
133
|
+
base = (language or "en").split("-")[0].lower()
|
|
134
|
+
return _DESCRIPTIONS.get(base, _DESCRIPTIONS["en"])[3]
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def render_precommit_config(plan: SecurityPlan) -> str:
|
|
138
|
+
"""Render the managed .pre-commit-config.yaml."""
|
|
139
|
+
semgrep_args = []
|
|
140
|
+
for config in plan.semgrep_configs:
|
|
141
|
+
semgrep_args.extend(["--config", config])
|
|
142
|
+
semgrep_args.extend(
|
|
143
|
+
[
|
|
144
|
+
"--error",
|
|
145
|
+
"--disable-version-check",
|
|
146
|
+
"--quiet",
|
|
147
|
+
"--skip-unknown-extensions",
|
|
148
|
+
]
|
|
149
|
+
)
|
|
150
|
+
lines = [
|
|
151
|
+
PRECOMMIT_MARKER,
|
|
152
|
+
"# Security checks that run locally on every commit, without tokens.",
|
|
153
|
+
"# Generated by `devflow init`. Delete the first line to stop DevFlow",
|
|
154
|
+
"# from updating this file. Update revisions with",
|
|
155
|
+
"# `pre-commit autoupdate`.",
|
|
156
|
+
"repos:",
|
|
157
|
+
" - repo: https://github.com/gitleaks/gitleaks",
|
|
158
|
+
f" rev: {GITLEAKS_REV}",
|
|
159
|
+
" hooks:",
|
|
160
|
+
" - id: gitleaks",
|
|
161
|
+
" - repo: https://github.com/semgrep/semgrep",
|
|
162
|
+
f" rev: {SEMGREP_REV}",
|
|
163
|
+
" hooks:",
|
|
164
|
+
" - id: semgrep",
|
|
165
|
+
f" args: [{', '.join(semgrep_args)}]",
|
|
166
|
+
]
|
|
167
|
+
if plan.python:
|
|
168
|
+
lines.extend(
|
|
169
|
+
[
|
|
170
|
+
" - repo: https://github.com/PyCQA/bandit",
|
|
171
|
+
f" rev: {BANDIT_REV}",
|
|
172
|
+
" hooks:",
|
|
173
|
+
" - id: bandit",
|
|
174
|
+
" # Medium severity and above; tests and migrations are",
|
|
175
|
+
" # excluded.",
|
|
176
|
+
" args: [-q, -ll]",
|
|
177
|
+
" exclude: '(^|/)(tests?|migrations)/|(^|/)tests?\\.py$'",
|
|
178
|
+
]
|
|
179
|
+
)
|
|
180
|
+
if plan.requirements:
|
|
181
|
+
lines.extend(
|
|
182
|
+
[
|
|
183
|
+
" - repo: https://github.com/pypa/pip-audit",
|
|
184
|
+
f" rev: {PIP_AUDIT_REV}",
|
|
185
|
+
" hooks:",
|
|
186
|
+
" - id: pip-audit",
|
|
187
|
+
f" args: [-r, {plan.requirements}]",
|
|
188
|
+
" files: '^requirements.*\\.txt$|^requirements/'",
|
|
189
|
+
]
|
|
190
|
+
)
|
|
191
|
+
elif plan.pyproject:
|
|
192
|
+
lines.extend(
|
|
193
|
+
[
|
|
194
|
+
" - repo: https://github.com/pypa/pip-audit",
|
|
195
|
+
f" rev: {PIP_AUDIT_REV}",
|
|
196
|
+
" hooks:",
|
|
197
|
+
" - id: pip-audit",
|
|
198
|
+
" args: ['.']",
|
|
199
|
+
" files: '^pyproject\\.toml$'",
|
|
200
|
+
]
|
|
201
|
+
)
|
|
202
|
+
return "\n".join(lines) + "\n"
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _write_config(root: Path, content: str) -> str:
|
|
206
|
+
"""Create or update the managed config without touching user files."""
|
|
207
|
+
path = root / PRECOMMIT_CONFIG
|
|
208
|
+
if path.is_symlink():
|
|
209
|
+
return "skipped"
|
|
210
|
+
if path.exists():
|
|
211
|
+
try:
|
|
212
|
+
existing = path.read_text(encoding="utf-8")
|
|
213
|
+
except OSError:
|
|
214
|
+
return "skipped"
|
|
215
|
+
if PRECOMMIT_MARKER not in existing:
|
|
216
|
+
return "skipped"
|
|
217
|
+
if existing == content:
|
|
218
|
+
return "unchanged"
|
|
219
|
+
ArtifactStore(root).write(path, content)
|
|
220
|
+
return "updated"
|
|
221
|
+
ArtifactStore(root).write(path, content)
|
|
222
|
+
return "created"
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def _run(command: Sequence[str], cwd: Path) -> int:
|
|
226
|
+
completed = subprocess.run( # noqa: S603 - fixed argument lists
|
|
227
|
+
list(command),
|
|
228
|
+
cwd=cwd,
|
|
229
|
+
check=False,
|
|
230
|
+
)
|
|
231
|
+
return completed.returncode
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def _precommit_command() -> list[str] | None:
|
|
235
|
+
executable = shutil.which("pre-commit")
|
|
236
|
+
if executable:
|
|
237
|
+
return [executable]
|
|
238
|
+
if importlib.util.find_spec("pre_commit") is not None:
|
|
239
|
+
return [sys.executable, "-m", "pre_commit"]
|
|
240
|
+
return None
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def install(
|
|
244
|
+
root: Path,
|
|
245
|
+
plan: SecurityPlan,
|
|
246
|
+
*,
|
|
247
|
+
runner: Runner = _run,
|
|
248
|
+
) -> SecurityInstallResult:
|
|
249
|
+
"""Write the hook configuration, install pre-commit and its git hook."""
|
|
250
|
+
result = SecurityInstallResult()
|
|
251
|
+
result.config_status = _write_config(root, render_precommit_config(plan))
|
|
252
|
+
if result.config_status == "skipped":
|
|
253
|
+
result.warnings.append(
|
|
254
|
+
f"{PRECOMMIT_CONFIG} already exists and is not managed by DevFlow. "
|
|
255
|
+
"It was left untouched; add the hooks yourself if you want them."
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
command = _precommit_command()
|
|
259
|
+
if command is None:
|
|
260
|
+
code = runner(
|
|
261
|
+
[sys.executable, "-m", "pip", "install", "pre-commit"],
|
|
262
|
+
root,
|
|
263
|
+
)
|
|
264
|
+
if code != 0:
|
|
265
|
+
result.warnings.append(
|
|
266
|
+
"Could not install pre-commit. Install it with "
|
|
267
|
+
"'pip install pre-commit', then run 'pre-commit install'."
|
|
268
|
+
)
|
|
269
|
+
return result
|
|
270
|
+
result.messages.append("pre-commit installed.")
|
|
271
|
+
command = _precommit_command() or [sys.executable, "-m", "pre_commit"]
|
|
272
|
+
|
|
273
|
+
if not (root / ".git").exists():
|
|
274
|
+
result.warnings.append(
|
|
275
|
+
"This project is not a git repository yet. Run 'git init' and "
|
|
276
|
+
"then 'pre-commit install' to activate the checks."
|
|
277
|
+
)
|
|
278
|
+
return result
|
|
279
|
+
|
|
280
|
+
if runner([*command, "install"], root) != 0:
|
|
281
|
+
result.warnings.append(
|
|
282
|
+
"Could not install the git hook. Run 'pre-commit install'."
|
|
283
|
+
)
|
|
284
|
+
return result
|
|
285
|
+
result.messages.append(
|
|
286
|
+
"Git hook installed: the checks run on every commit. The first "
|
|
287
|
+
"commit downloads the tools and may take a few minutes. Run "
|
|
288
|
+
"'pre-commit run --all-files' to check the whole project now."
|
|
289
|
+
)
|
|
290
|
+
return result
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
def is_configured(root: Path) -> bool:
|
|
294
|
+
"""Return whether a DevFlow-managed hook configuration exists."""
|
|
295
|
+
path = root / PRECOMMIT_CONFIG
|
|
296
|
+
try:
|
|
297
|
+
return path.is_file() and PRECOMMIT_MARKER in path.read_text(
|
|
298
|
+
encoding="utf-8"
|
|
299
|
+
)
|
|
300
|
+
except OSError:
|
|
301
|
+
return False
|
devflow/core/specification.py
CHANGED
|
@@ -22,6 +22,7 @@ from devflow.core.constitution import (
|
|
|
22
22
|
Constitution,
|
|
23
23
|
implementation_documents,
|
|
24
24
|
)
|
|
25
|
+
from devflow.core import security_tools
|
|
25
26
|
from devflow.core.discovery import DiscoveryDocument
|
|
26
27
|
from devflow.core.file_types import ANALYSIS_EXTENSIONS
|
|
27
28
|
from devflow.core.project import (
|
|
@@ -418,6 +419,7 @@ class PreparedSpec:
|
|
|
418
419
|
architecture: ArchitectureManifest | None = None
|
|
419
420
|
discovery: DiscoveryDocument | None = None
|
|
420
421
|
discovery_digest: str | None = None
|
|
422
|
+
language: str = "en"
|
|
421
423
|
|
|
422
424
|
|
|
423
425
|
def normalize_word(value: str) -> str:
|
|
@@ -867,6 +869,7 @@ class SpecificationManager:
|
|
|
867
869
|
architecture=architecture,
|
|
868
870
|
discovery=discovery,
|
|
869
871
|
discovery_digest=discovery_digest,
|
|
872
|
+
language=config.documentation_language,
|
|
870
873
|
)
|
|
871
874
|
|
|
872
875
|
def materialize_context(self, prepared: PreparedSpec) -> Path:
|
|
@@ -891,6 +894,12 @@ class SpecificationManager:
|
|
|
891
894
|
cleaned = prepared.fallback_content
|
|
892
895
|
source = "static"
|
|
893
896
|
cleaned = self.with_next_specs(cleaned, prepared.discovery)
|
|
897
|
+
cleaned = self.with_plain_criteria(cleaned)
|
|
898
|
+
cleaned = self.with_approval_section(
|
|
899
|
+
cleaned,
|
|
900
|
+
prepared.spec_id,
|
|
901
|
+
prepared.language,
|
|
902
|
+
)
|
|
894
903
|
|
|
895
904
|
prepared.directory.mkdir(parents=True, exist_ok=True)
|
|
896
905
|
ArtifactStore(prepared.root).write(
|
|
@@ -1087,6 +1096,47 @@ class SpecificationManager:
|
|
|
1087
1096
|
cleaned = cleaned[start:]
|
|
1088
1097
|
return cleaned.strip()
|
|
1089
1098
|
|
|
1099
|
+
def with_plain_criteria(self, content: str) -> str:
|
|
1100
|
+
"""Remove checkboxes from acceptance criteria.
|
|
1101
|
+
|
|
1102
|
+
Criteria are verified during implementation, not ticked in an
|
|
1103
|
+
approved document: editing it would invalidate the approval.
|
|
1104
|
+
"""
|
|
1105
|
+
return re.sub(
|
|
1106
|
+
r"^(\s*)[-*]\s+\[[ xX]\]\s+(\*\*AC-)",
|
|
1107
|
+
r"\1- \2",
|
|
1108
|
+
content,
|
|
1109
|
+
flags=re.MULTILINE,
|
|
1110
|
+
)
|
|
1111
|
+
|
|
1112
|
+
def with_approval_section(
|
|
1113
|
+
self,
|
|
1114
|
+
content: str,
|
|
1115
|
+
spec_id: str,
|
|
1116
|
+
language: str = "en",
|
|
1117
|
+
) -> str:
|
|
1118
|
+
"""Write the body of section 11; DevFlow owns the approval record."""
|
|
1119
|
+
section = re.search(
|
|
1120
|
+
r"^##\s+11\.[^\n]*\n(?P<body>.*?)(?=^##\s|\Z)",
|
|
1121
|
+
content,
|
|
1122
|
+
re.MULTILINE | re.DOTALL,
|
|
1123
|
+
)
|
|
1124
|
+
if section is None:
|
|
1125
|
+
return content
|
|
1126
|
+
kept = [
|
|
1127
|
+
line
|
|
1128
|
+
for line in section.group("body").splitlines()
|
|
1129
|
+
if not re.match(r"^\s*[-*]\s+\[[ xX]\]", line)
|
|
1130
|
+
]
|
|
1131
|
+
rest = "\n".join(kept).strip()
|
|
1132
|
+
note = _approval_note(spec_id, language)
|
|
1133
|
+
body = f"\n{note}\n\n" + (f"{rest}\n\n" if rest else "")
|
|
1134
|
+
return (
|
|
1135
|
+
content[: section.start("body")]
|
|
1136
|
+
+ body
|
|
1137
|
+
+ content[section.end("body"):]
|
|
1138
|
+
)
|
|
1139
|
+
|
|
1090
1140
|
def stamp_discovery_digest(self, content: str, digest: str) -> str:
|
|
1091
1141
|
"""Write the authoritative Discovery digest into the header row."""
|
|
1092
1142
|
return re.sub(
|
|
@@ -1558,6 +1608,7 @@ class SpecificationManager:
|
|
|
1558
1608
|
"",
|
|
1559
1609
|
f"- Source files: {len(project.source_files)}",
|
|
1560
1610
|
f"- Manifests: {', '.join(project.manifests) or 'none'}",
|
|
1611
|
+
*_quality_gate_lines(config.root),
|
|
1561
1612
|
"",
|
|
1562
1613
|
"### Constitution",
|
|
1563
1614
|
"",
|
|
@@ -1596,7 +1647,7 @@ class SpecificationManager:
|
|
|
1596
1647
|
"Use the eleven numbered sections defined by the Greenfield "
|
|
1597
1648
|
"prompt. Describe the target system in future tense. Use "
|
|
1598
1649
|
"`**FR-XXX:**` identifiers for functional requirements and "
|
|
1599
|
-
"`-
|
|
1650
|
+
"`- **AC-XXX:**` list items for acceptance criteria.",
|
|
1600
1651
|
"",
|
|
1601
1652
|
"End the document with `## Appendix A: Declared Architecture "
|
|
1602
1653
|
"Manifest` and include the manifest digest.",
|
|
@@ -1882,7 +1933,7 @@ class SpecificationManager:
|
|
|
1882
1933
|
)
|
|
1883
1934
|
for index, criterion in enumerate(criteria, start=1):
|
|
1884
1935
|
lines.append(
|
|
1885
|
-
f"-
|
|
1936
|
+
f"- **AC-{index:03d}:** {criterion}"
|
|
1886
1937
|
)
|
|
1887
1938
|
|
|
1888
1939
|
lines.extend(
|
|
@@ -1992,6 +2043,7 @@ class SpecificationManager:
|
|
|
1992
2043
|
"",
|
|
1993
2044
|
f"- Source files: {len(project.source_files)}",
|
|
1994
2045
|
f"- Manifests: {', '.join(project.manifests) or 'none'}",
|
|
2046
|
+
*_quality_gate_lines(config.root),
|
|
1995
2047
|
"",
|
|
1996
2048
|
"### Constitution",
|
|
1997
2049
|
"",
|
|
@@ -2106,8 +2158,8 @@ class SpecificationManager:
|
|
|
2106
2158
|
"",
|
|
2107
2159
|
"Use the eleven numbered sections defined by the DevFlow "
|
|
2108
2160
|
"specification prompt. Use `**FR-XXX:**` identifiers for "
|
|
2109
|
-
"functional requirements and `-
|
|
2110
|
-
"
|
|
2161
|
+
"functional requirements and `- **AC-XXX:**` list items for "
|
|
2162
|
+
"acceptance criteria.",
|
|
2111
2163
|
"",
|
|
2112
2164
|
"The specification must remain valid if the project later "
|
|
2113
2165
|
"switches to a different agent harness.",
|
|
@@ -2400,7 +2452,7 @@ class SpecificationManager:
|
|
|
2400
2452
|
|
|
2401
2453
|
for index, criterion in enumerate(criteria, start=1):
|
|
2402
2454
|
lines.append(
|
|
2403
|
-
f"-
|
|
2455
|
+
f"- **AC-{index:03d}:** {criterion}"
|
|
2404
2456
|
)
|
|
2405
2457
|
|
|
2406
2458
|
lines.extend(
|
|
@@ -2460,3 +2512,39 @@ class SpecificationManager:
|
|
|
2460
2512
|
)
|
|
2461
2513
|
|
|
2462
2514
|
return "\n".join(lines)
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
_APPROVAL_NOTES = {
|
|
2518
|
+
"en": (
|
|
2519
|
+
"Approve with `devflow approve {spec_id}`. The approval is recorded "
|
|
2520
|
+
"in `events.jsonl`, bound to the SHA-256 digests of this file and "
|
|
2521
|
+
"`discovery.yaml`. Do not edit this file afterwards: to change it, "
|
|
2522
|
+
"run `devflow reopen {spec_id}`. Acceptance criteria are verified "
|
|
2523
|
+
"during implementation, not ticked here."
|
|
2524
|
+
),
|
|
2525
|
+
"es": (
|
|
2526
|
+
"Se aprueba con `devflow approve {spec_id}`. La aprobación queda "
|
|
2527
|
+
"registrada en `events.jsonl`, ligada a las huellas SHA-256 de este "
|
|
2528
|
+
"archivo y de `discovery.yaml`. No edites este archivo después: "
|
|
2529
|
+
"para cambiarlo, ejecuta `devflow reopen {spec_id}`. Los criterios de "
|
|
2530
|
+
"aceptación se verifican durante la implementación, no se marcan "
|
|
2531
|
+
"aquí."
|
|
2532
|
+
),
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
def _approval_note(spec_id: str, language: str) -> str:
|
|
2537
|
+
base = (language or "en").split("-")[0].lower()
|
|
2538
|
+
template = _APPROVAL_NOTES.get(base, _APPROVAL_NOTES["en"])
|
|
2539
|
+
return template.format(spec_id=spec_id)
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
def _quality_gate_lines(root: Path) -> list[str]:
|
|
2543
|
+
"""Tell the spec writer about the security checks run on every commit."""
|
|
2544
|
+
if not security_tools.is_configured(root):
|
|
2545
|
+
return []
|
|
2546
|
+
return [
|
|
2547
|
+
f"- Security checks: `{security_tools.PRECOMMIT_CONFIG}` runs local "
|
|
2548
|
+
"security tools on every commit. Record `pre-commit run "
|
|
2549
|
+
"--all-files` as a quality gate in section 6.",
|
|
2550
|
+
]
|
devflow/prompts/discovery.md
CHANGED
|
@@ -48,12 +48,17 @@ traces that path instead of solving everything at once.
|
|
|
48
48
|
2. **Security is never assumed or hidden.** Ask every basic security
|
|
49
49
|
decision explicitly, recommend the basic option and explain in one
|
|
50
50
|
sentence why it matters. Answering it is how the user learns it.
|
|
51
|
-
3. **Every question offers a next level
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
3. **Every question offers a next level, when one exists.** Add one
|
|
52
|
+
option that is a real improvement over the recommended level-1
|
|
53
|
+
option (more secure, more capable or more robust), never a mere
|
|
54
|
+
alternative, a reduction or a stricter variant with a worse
|
|
55
|
+
experience. Record it in `next_level`: `option` is the exact option
|
|
56
|
+
text (also listed in `options`), `title` is that improvement phrased
|
|
57
|
+
as a short request for a future specification (for example
|
|
58
|
+
"Require passwords of at least 12 characters"), and `why` explains in
|
|
59
|
+
one sentence what it improves and when it is worth it. It is never
|
|
60
|
+
the recommended option; DevFlow ignores a `next_level` marked as
|
|
61
|
+
recommended. When no real improvement exists, omit `next_level`. If the user picks it, record the answer with that exact text. If
|
|
57
62
|
not, DevFlow proposes it as a next specification. Do not ask
|
|
58
63
|
follow-up questions about the next level in this specification.
|
|
59
64
|
4. **Do not go deeper than this level.** When an answer opens a more
|
|
@@ -216,6 +221,7 @@ questions:
|
|
|
216
221
|
- "Next-level option"
|
|
217
222
|
next_level:
|
|
218
223
|
option: "Next-level option"
|
|
224
|
+
title: "Short request for a future specification"
|
|
219
225
|
why: "What it improves and when it is worth it."
|
|
220
226
|
- id: Q2
|
|
221
227
|
category: architecture_boundary
|
|
@@ -251,8 +257,8 @@ deferred:
|
|
|
251
257
|
question_id: Q1
|
|
252
258
|
```
|
|
253
259
|
|
|
254
|
-
`next_level` and `deferred` are optional
|
|
255
|
-
|
|
260
|
+
`next_level` and `deferred` are optional. Add a `next_level` only when
|
|
261
|
+
it is a real improvement.
|
|
256
262
|
|
|
257
263
|
### YAML Safety Rules
|
|
258
264
|
|
devflow/prompts/spec.md
CHANGED
|
@@ -163,8 +163,13 @@ Produce exactly one Markdown document with this structure:
|
|
|
163
163
|
```
|
|
164
164
|
|
|
165
165
|
Every functional requirement must use an identifier such as
|
|
166
|
-
`**FR-001:**`. Every acceptance criterion must use a
|
|
167
|
-
|
|
166
|
+
`**FR-001:**`. Every acceptance criterion must use a list item such as
|
|
167
|
+
`- **AC-001:**`, without a checkbox, and must be verifiable.
|
|
168
|
+
|
|
169
|
+
Be concise. State each fact once and reference it elsewhere by its
|
|
170
|
+
`FR-XXX`, `AC-XXX` or `Qn` identifier instead of repeating it. The
|
|
171
|
+
implementer reads the whole document, so every extra sentence costs
|
|
172
|
+
tokens.
|
|
168
173
|
|
|
169
174
|
Use the exact specification ID and path in `{{spec_path}}`. Do not
|
|
170
175
|
renumber the document.
|
|
@@ -172,7 +177,8 @@ renumber the document.
|
|
|
172
177
|
## Content Requirements
|
|
173
178
|
|
|
174
179
|
- Section 1 quotes the original request or requirements.
|
|
175
|
-
- Section 2 summarizes the change and its intended outcome
|
|
180
|
+
- Section 2 summarizes the change and its intended outcome in one
|
|
181
|
+
short paragraph. Do not restate every decision.
|
|
176
182
|
- Section 5 contains complete, testable functional requirements.
|
|
177
183
|
- Section 6 records constraints, dependencies, compatibility rules and
|
|
178
184
|
quality gates.
|
|
@@ -193,9 +199,9 @@ renumber the document.
|
|
|
193
199
|
profile scope. Reference paths, do not copy their contents.
|
|
194
200
|
- Section 10 states what is explicitly excluded from this change. In
|
|
195
201
|
Greenfield, include code generation and planning in this stage. Do not
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
-
|
|
202
|
+
repeat the deferred items or next-level options: DevFlow writes them
|
|
203
|
+
in subsection 10.1, so do not write 10.1 yourself.
|
|
204
|
+
- Leave section 11 empty: DevFlow writes the approval note.
|
|
199
205
|
<!-- devflow:mode existing -->
|
|
200
206
|
- Section 3 cites real files from the context. Explain their relevance.
|
|
201
207
|
- Section 4 identifies affected areas and compatibility risks.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: devflow-toolkit
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.26
|
|
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.26`.**
|
|
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.26-py3-none-any.whl
|
|
156
156
|
```
|
|
157
157
|
|
|
158
158
|
Verify the installation:
|
|
@@ -315,6 +315,35 @@ error instead of silently switching to deterministic analysis. Pass
|
|
|
315
315
|
`--harness none` or `--no-agent` to opt into deterministic output
|
|
316
316
|
explicitly.
|
|
317
317
|
|
|
318
|
+
### Local security checks
|
|
319
|
+
|
|
320
|
+
Semgrep, Bandit, pip-audit and gitleaks review code, so they belong to
|
|
321
|
+
implementation. DevFlow offers them once, right after the first
|
|
322
|
+
`devflow approve`, in an interactive terminal:
|
|
323
|
+
|
|
324
|
+
- Semgrep, with rules for Django (or Python) and OWASP;
|
|
325
|
+
- Bandit, for Python code;
|
|
326
|
+
- pip-audit, for vulnerable dependencies;
|
|
327
|
+
- gitleaks, for secrets in the code.
|
|
328
|
+
|
|
329
|
+
pre-commit (pre-commit.com) runs these tools automatically on every
|
|
330
|
+
commit, without tokens. `devflow init --security-tools` installs them at
|
|
331
|
+
any time; `devflow init --no-security-tools` turns the offer off. The
|
|
332
|
+
answer is remembered in `.devflow/config.yaml` (`security.tools_offered`).
|
|
333
|
+
|
|
334
|
+
Accepting writes a managed `.pre-commit-config.yaml` with pinned hook
|
|
335
|
+
revisions, installs `pre-commit` with pip when it is missing and runs
|
|
336
|
+
`pre-commit install` when the project is a git repository. Only the
|
|
337
|
+
hooks that apply are added: Bandit and pip-audit for Python projects,
|
|
338
|
+
`p/django` rules for Django. An existing, unmanaged
|
|
339
|
+
`.pre-commit-config.yaml` is never overwritten. The first commit
|
|
340
|
+
downloads the tools; `pre-commit run --all-files` checks the whole
|
|
341
|
+
project.
|
|
342
|
+
|
|
343
|
+
When the checks are configured, `context.md` tells the specification
|
|
344
|
+
writer to record `pre-commit run --all-files` as a quality gate in
|
|
345
|
+
section 6.
|
|
346
|
+
|
|
318
347
|
## Configuration
|
|
319
348
|
|
|
320
349
|
`.devflow/config.yaml` stores project settings. It references the
|
|
@@ -428,7 +457,7 @@ as an architectural constraint when it is present.
|
|
|
428
457
|
|
|
429
458
|
### Harnesses
|
|
430
459
|
|
|
431
|
-
| Harness | Status in 0.3.
|
|
460
|
+
| Harness | Status in 0.3.26 |
|
|
432
461
|
| --- | --- |
|
|
433
462
|
| OpenCode | Verified end-to-end; interactive Discovery uses the `question` tool |
|
|
434
463
|
| Antigravity | Custom agents and scoped permissions generated; `agy` loading and print mode verified |
|
|
@@ -717,8 +746,10 @@ everything at once:
|
|
|
717
746
|
2. **Security is always asked, never assumed.** Basic security decisions
|
|
718
747
|
are explicit questions with a recommended option and a short
|
|
719
748
|
explanation, so the user learns them by answering.
|
|
720
|
-
3. **
|
|
721
|
-
one level further
|
|
749
|
+
3. **Questions offer a next level when a real improvement exists.** One
|
|
750
|
+
option takes the decision one level further (more secure, capable or
|
|
751
|
+
robust; never a mere alternative or a reduction). It is recorded in
|
|
752
|
+
`next_level`, with a `title` phrased as a future spec request:
|
|
722
753
|
|
|
723
754
|
```yaml
|
|
724
755
|
options:
|
|
@@ -726,13 +757,14 @@ everything at once:
|
|
|
726
757
|
- "Token that expires after 24 hours"
|
|
727
758
|
next_level:
|
|
728
759
|
option: "Token that expires after 24 hours"
|
|
760
|
+
title: "Expire login tokens after 24 hours"
|
|
729
761
|
why: "Limits the damage if a token leaks."
|
|
730
762
|
```
|
|
731
763
|
|
|
732
764
|
If the user chooses it, the answer uses that exact text. If not,
|
|
733
|
-
DevFlow
|
|
734
|
-
recommended option is level 1, so a
|
|
735
|
-
recommended is ignored.
|
|
765
|
+
DevFlow suggests `title` (or the option text when there is no title)
|
|
766
|
+
as a later specification. The recommended option is level 1, so a
|
|
767
|
+
`next_level` marked as recommended is ignored.
|
|
736
768
|
4. **No deeper than this level.** More advanced decisions found along
|
|
737
769
|
the way, and parts of a large request left for later, are recorded in
|
|
738
770
|
`deferred`:
|
|
@@ -768,7 +800,7 @@ for each item; the agent does not write it.
|
|
|
768
800
|
8. If artifacts exist without workflow state, diagnose with
|
|
769
801
|
`devflow doctor <id>` and repair with `devflow recover <id>`.
|
|
770
802
|
|
|
771
|
-
Available commands in `0.3.
|
|
803
|
+
Available commands in `0.3.26`:
|
|
772
804
|
|
|
773
805
|
| Command | Status |
|
|
774
806
|
| --- | --- |
|
|
@@ -1001,7 +1033,7 @@ devflow approve 001
|
|
|
1001
1033
|
```
|
|
1002
1034
|
|
|
1003
1035
|
Approval is explicit and binds the decision to the current artifact
|
|
1004
|
-
digests. For a `0.3.
|
|
1036
|
+
digests. For a `0.3.26` change it binds `spec.md`, `discovery.yaml` and,
|
|
1005
1037
|
when a manifest applies, the architecture manifest digest. Repeating the
|
|
1006
1038
|
same approval is a no-op. If an artifact changes after validation,
|
|
1007
1039
|
DevFlow marks it stale and refuses approval until it is regenerated and
|
|
@@ -1012,7 +1044,7 @@ and names the pending questions and assumptions. Approval also rejects a
|
|
|
1012
1044
|
specification whose section 7 still lists open questions. Legacy `0.2.0`
|
|
1013
1045
|
changes without `discovery.yaml` remain approvable with a warning.
|
|
1014
1046
|
|
|
1015
|
-
Only the `spec` stage is available in `0.3.
|
|
1047
|
+
Only the `spec` stage is available in `0.3.26`, so `--stage` is optional
|
|
1016
1048
|
and defaults to `spec`. `--stage plan` and `--stage review` are
|
|
1017
1049
|
rejected. There are no `plan`, `implement` or
|
|
1018
1050
|
`review` commands in this release.
|
|
@@ -1219,3 +1251,22 @@ The test suite covers the core, CLI, state replay and harness adapters.
|
|
|
1219
1251
|
Release verification additionally installs the built wheel and sdist in
|
|
1220
1252
|
clean virtual environments and runs the consumer workflow from outside
|
|
1221
1253
|
the repository.
|
|
1254
|
+
|
|
1255
|
+
## Acknowledgments
|
|
1256
|
+
|
|
1257
|
+
DevFlow is built on the shoulders of open-source work.
|
|
1258
|
+
|
|
1259
|
+
**[Typer](https://typer.tiangolo.com)**, by **Sebastián Ramírez
|
|
1260
|
+
([@tiangolo](https://github.com/tiangolo))**, creator of FastAPI. Every
|
|
1261
|
+
DevFlow command, option and help screen is built with Typer. Thank you
|
|
1262
|
+
for making great command-line tools this simple to build.
|
|
1263
|
+
|
|
1264
|
+
- **[Rich](https://github.com/Textualize/rich)**, by Will McGugan, for
|
|
1265
|
+
the terminal output.
|
|
1266
|
+
- **[PyYAML](https://pyyaml.org)**, for the Discovery and workflow
|
|
1267
|
+
records.
|
|
1268
|
+
- **[pre-commit](https://pre-commit.com)**, by Anthony Sottile, and the
|
|
1269
|
+
Semgrep, Bandit, pip-audit and gitleaks projects, for the local
|
|
1270
|
+
security checks.
|
|
1271
|
+
- **[OWASP](https://owasp.org)**, for the security standards that guide
|
|
1272
|
+
DevFlow's security checks.
|
|
@@ -12,28 +12,30 @@ devflow/adapters/kiro.py,sha256=1w9U8oP0i2un6YeiV5uOUQ8qrOYHiF1K-788iVqHzhA,7709
|
|
|
12
12
|
devflow/adapters/opencode.py,sha256=AtIsgKam25Y3CjI4DlXqODQO_D74Cn_N-G02MIsBI44,8503
|
|
13
13
|
devflow/adapters/registry.py,sha256=G1HquOcSggwT0qm8PIm_Fv5Wj354G20rnI0C7vPhrSo,1263
|
|
14
14
|
devflow/commands/__init__.py,sha256=yOLtd_4R4xdlMgAzihzIT35oyV_qcz0br-aoLebRj1c,157
|
|
15
|
-
devflow/commands/approve.py,sha256
|
|
15
|
+
devflow/commands/approve.py,sha256=-illY4CTzOo8fN7TfYNwq6K5ZkVMWDDJxBySe_hH6NU,3146
|
|
16
16
|
devflow/commands/config.py,sha256=9EV3S_0j_OAokE2Hd1uhA3srBbTDSOInYcnULcHG3sM,1300
|
|
17
17
|
devflow/commands/doctor.py,sha256=vYk2i3OksbGpHEUFsqi7c4w44mAXRmY0OeEdO8h5j_M,4161
|
|
18
18
|
devflow/commands/harness.py,sha256=0IH_PPeYmW3aQ_WnUSkFzxpe3A4FtSyjWfHq-Ug7Eos,10549
|
|
19
|
-
devflow/commands/init.py,sha256=
|
|
19
|
+
devflow/commands/init.py,sha256=Yb2zd0lchqyvrPuywY5ELL-Cfp4SnGFv_N_93rJeMKE,17994
|
|
20
20
|
devflow/commands/recover.py,sha256=sV9x5-30E_3XRBe7JItDiSG-pqrowRzjqOkC_eyrhFQ,2165
|
|
21
21
|
devflow/commands/reopen.py,sha256=bZiX-dyKgmtdKdV4FHwEwRCFvuuX5jezBCI7wIpkHYU,2971
|
|
22
|
+
devflow/commands/security.py,sha256=lZlbMo34JHX46kBHRTSsZd4ANZ1mvxh6I-Nc6jNzuLI,2049
|
|
22
23
|
devflow/commands/spec.py,sha256=7glxFHKuJd33mL6YayrxRJ6TViUmmQk5rijbNepsbig,16353
|
|
23
|
-
devflow/commands/status.py,sha256=
|
|
24
|
+
devflow/commands/status.py,sha256=dLleIMLK39hRuQ3JdaUval70o0cIkMPKZOKTsNeML4Q,7407
|
|
24
25
|
devflow/core/__init__.py,sha256=hN7i4-PDaZ7y4P8qRpZl_lJvIiPyQaN1TDGnw2BecYU,427
|
|
25
26
|
devflow/core/architecture.py,sha256=qllllsUVqA76LiSU6z_s4U8dxMcs6ClKXU16HxI3yOI,13692
|
|
26
27
|
devflow/core/clock.py,sha256=KZROv6o51Ln1EzK00ySCxfc7WPZqPlaQhFfjfdc_TMY,1651
|
|
27
|
-
devflow/core/config.py,sha256=
|
|
28
|
+
devflow/core/config.py,sha256=g_9ocRsrDLSsZZ5Sy1qlI7gi8WA2WlyiLUOZhcID2Ig,27065
|
|
28
29
|
devflow/core/constitution.py,sha256=rPLc8Puv9nUMC_GZwzOqvr1B-4urdxAISr655od2IPM,5333
|
|
29
|
-
devflow/core/discovery.py,sha256=
|
|
30
|
+
devflow/core/discovery.py,sha256=drquy0yxRKblEEgnOBDNYkeyPKc2SXo6SIwQyZgDB2w,60337
|
|
30
31
|
devflow/core/file_types.py,sha256=5S5YywOaTESDiln4kP7qyJFEjxHoiF6tSBbwuXNpDDc,566
|
|
31
32
|
devflow/core/ports.py,sha256=6jlqeR40MNaz-IuZIAPimXpRKew-wMUab3KzelcTXsU,4541
|
|
32
33
|
devflow/core/profile_manager.py,sha256=QnnJka2KIKD2tCSWJkGTOUEFMgmQT0Z9Qv173JKWKHw,8937
|
|
33
34
|
devflow/core/project.py,sha256=4OnudghY5N5rCOmafWO5Hk68M7T3-mOV0j0k0dh2luE,16891
|
|
34
35
|
devflow/core/recovery.py,sha256=W2If6Ymb3ISwMN8IVQYCwptDUzhxejlF-P2NvMYyZP0,8818
|
|
36
|
+
devflow/core/security_tools.py,sha256=F-JdGzycS-Vov_1SE5qciNVi31DqnnJXVqHqoDocSAA,8912
|
|
35
37
|
devflow/core/spec_workflow.py,sha256=Ngma_-7MLsp96gNd2avVC81_SjWTAk4jscsQinmCml4,43961
|
|
36
|
-
devflow/core/specification.py,sha256=
|
|
38
|
+
devflow/core/specification.py,sha256=6b1-MRJjlPyzTwk5FzWCZJneAe0xy-xpnsmLZgMcA6Y,70036
|
|
37
39
|
devflow/core/artifacts/__init__.py,sha256=gt9xahPynoxv75FMq1ZJx91ILTIv4ExuvX1Ymrxwr2c,627
|
|
38
40
|
devflow/core/artifacts/errors.py,sha256=hwZxnLFcUTtEjDWtN6rUCkM69EN19LGVlc6HD-pNZyk,493
|
|
39
41
|
devflow/core/artifacts/models.py,sha256=xJjmY8jUAHxqYN9u1JEu8CbJB-IJg1xb9P-LDaP5_Hw,2049
|
|
@@ -61,10 +63,10 @@ devflow/profiles/fastapi-backend/profile.yaml,sha256=5_b-zWSX0HV-tw_2ntRCSa4DyP3
|
|
|
61
63
|
devflow/profiles/fastapi-backend/constitution/fastapi-standards.md,sha256=iFKib4i_9z4wBQ9thl-uftg5g-CHwvmFWzMtLgA7CBk,1949
|
|
62
64
|
devflow/prompts/__init__.py,sha256=DttfMavd0nfmhKkVE46VhpIHkGS-4amYfufABEM20xI,19120
|
|
63
65
|
devflow/prompts/discovery-repair.md,sha256=YfTfrrw5uUZvC_x6X2lrYEDkMNhanhoe0ER3Yc2-rgI,1135
|
|
64
|
-
devflow/prompts/discovery.md,sha256=
|
|
65
|
-
devflow/prompts/spec.md,sha256=
|
|
66
|
-
devflow_toolkit-0.3.
|
|
67
|
-
devflow_toolkit-0.3.
|
|
68
|
-
devflow_toolkit-0.3.
|
|
69
|
-
devflow_toolkit-0.3.
|
|
70
|
-
devflow_toolkit-0.3.
|
|
66
|
+
devflow/prompts/discovery.md,sha256=4eApdy5QwT9nFeXpgMA4IfPaw5uCciZysOWKgpZ4vPM,14852
|
|
67
|
+
devflow/prompts/spec.md,sha256=Kze_ZvE5yn0tfncvr98Nw6GQLEZlJmcZFWDNUpLMnlc,7689
|
|
68
|
+
devflow_toolkit-0.3.26.dist-info/METADATA,sha256=PKCGqkfPEz1q1SrvI1i81pwS4n4LXRCckNhh7xGfC_I,52023
|
|
69
|
+
devflow_toolkit-0.3.26.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
70
|
+
devflow_toolkit-0.3.26.dist-info/entry_points.txt,sha256=wPmqE1081vi8s3xf-Wfzfvpl-44IKgwx7OGoLEK3u7o,44
|
|
71
|
+
devflow_toolkit-0.3.26.dist-info/licenses/LICENSE,sha256=Wa04lstC8Goe4b9IYfEYWB2k7nokYBejZl6NdyAl8rA,1077
|
|
72
|
+
devflow_toolkit-0.3.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|