Skip to content

Commit 0532576

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/native-invocation-prefixes
2 parents 7be6e56 + 8c816fa commit 0532576

3 files changed

Lines changed: 66 additions & 0 deletions

File tree

presets/lean/commands/speckit.constitution.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ description: Create or update the project constitution.
88
$ARGUMENTS
99
```
1010

11+
## Scope Guard
12+
13+
This command's own work is limited to creating or updating the project constitution and
14+
propagating constitution-driven changes to dependent Spec Kit artifacts.
15+
16+
- Classify every part of the user input as constitution content or a separate non-governance
17+
intent. Feature implementation, code generation, refactoring, build, and deployment requests
18+
are examples of non-governance intents.
19+
- You **MUST NOT** execute any non-governance intent. Defer each one to `Next Actions`.
20+
- You **MUST NOT** create, modify, or delete application source files or other artifacts
21+
unrelated to the constitution workflow.
22+
- If an instruction could be either constitution content or a non-governance intent, ask for
23+
clarification before making changes.
24+
- After updating the constitution, list each deferred intent in a `Next Actions` section with an
25+
appropriate follow-up Spec Kit command, such as `__SPECKIT_COMMAND_SPECIFY__`, but do not
26+
invoke it.
27+
- Omit `Next Actions` when there are no non-governance intents.
28+
1129
## Outline
1230

1331
1. Create or update the project constitution and store it in `.specify/memory/constitution.md`.

templates/commands/constitution.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@ $ARGUMENTS
1414

1515
You **MUST** consider the user input before proceeding (if not empty).
1616

17+
## Scope Guard
18+
19+
This command's own work is limited to updating the project constitution and propagating
20+
constitution-driven changes to the dependent artifacts identified in this command.
21+
22+
- Classify every part of the user input as either constitution content or a separate,
23+
non-governance intent.
24+
- If the input includes feature implementation, code generation, refactoring, building, or
25+
deployment requests, you **MUST NOT** execute them. Extract them as deferred intents instead.
26+
- You **MUST NOT** create, modify, or delete application source files, feature routes,
27+
components, tests, deployment files, or other artifacts unrelated to the constitution
28+
workflow and its required propagation.
29+
- If it is unclear whether an instruction is constitution content, ask for clarification before
30+
making changes.
31+
- After completing the constitution update, include a `Next Actions` section for each deferred
32+
intent. List the original intent and suggest the appropriate follow-up Spec Kit command, such
33+
as `__SPECKIT_COMMAND_SPECIFY__`, without invoking it.
34+
- If there are no non-governance intents, omit the `Next Actions` section.
35+
1736
## Pre-Execution Checks
1837

1938
**Check for extension hooks (before constitution update)**:
@@ -104,6 +123,7 @@ Follow this execution flow:
104123
- New version and bump rationale.
105124
- Any files flagged for manual follow-up.
106125
- Suggested commit message (e.g., `docs: amend constitution to vX.Y.Z (principle additions + governance update)`).
126+
- A `Next Actions` section for any deferred non-governance intents.
107127
108128
Formatting & Style Requirements:
109129

tests/test_presets.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5414,6 +5414,9 @@ def test_disable_corrupted_registry_entry(self, project_dir, pack_dir):
54145414

54155415

54165416
LEAN_PRESET_DIR = Path(__file__).parent.parent / "presets" / "lean"
5417+
CORE_CONSTITUTION_COMMAND = (
5418+
Path(__file__).parent.parent / "templates" / "commands" / "constitution.md"
5419+
)
54175420

54185421
LEAN_COMMAND_NAMES = [
54195422
"speckit.specify",
@@ -5424,6 +5427,31 @@ def test_disable_corrupted_registry_entry(self, project_dir, pack_dir):
54245427
]
54255428

54265429

5430+
@pytest.mark.parametrize(
5431+
"command_path",
5432+
[
5433+
CORE_CONSTITUTION_COMMAND,
5434+
LEAN_PRESET_DIR / "commands" / "speckit.constitution.md",
5435+
],
5436+
ids=["core", "lean"],
5437+
)
5438+
def test_constitution_commands_guard_against_non_governance_work(command_path):
5439+
"""Constitution commands defer non-governance work instead of executing it."""
5440+
content = command_path.read_text()
5441+
lower_content = content.lower()
5442+
normalized_content = " ".join(lower_content.split())
5443+
5444+
assert "## Scope Guard" in content
5445+
assert "**MUST NOT**" in content
5446+
assert "Classify every part" in content
5447+
assert "application source files" in content
5448+
assert "non-governance intent" in content
5449+
assert "`Next Actions`" in content
5450+
assert "__SPECKIT_COMMAND_SPECIFY__" in content
5451+
assert "omit" in lower_content
5452+
assert "do not invoke it" in normalized_content or "without invoking it" in normalized_content
5453+
5454+
54275455
class TestLeanPreset:
54285456
"""Tests for the lean preset that ships with the repo."""
54295457

0 commit comments

Comments
 (0)