-
Notifications
You must be signed in to change notification settings - Fork 7.2k
fix(init): generate root CLAUDE.md for --ai claude #1988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -693,6 +693,41 @@ class TestNewProjectCommandSkip: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| download_and_extract_template patched to create local fixtures. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @pytest.mark.skipif( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| shutil.which("bash") is None or shutil.which("zip") is None, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| reason="offline scaffolding requires bash + zip", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def test_init_claude_creates_root_CLAUDE_md(self, tmp_path): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from typer.testing import CliRunner | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runner = CliRunner() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| target = tmp_path / "claude-proj" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = runner.invoke( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "init", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| str(target), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--ai", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "claude", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--offline", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--ignore-agent-tools", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--no-git", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "--script", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "sh", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| result = runner.invoke( | |
| app, | |
| [ | |
| "init", | |
| str(target), | |
| "--ai", | |
| "claude", | |
| "--offline", | |
| "--ignore-agent-tools", | |
| "--no-git", | |
| "--script", | |
| "sh", | |
| ], | |
| ) | |
| with patch.object(specify_cli, "download_and_extract_template", self._fake_extract): | |
| result = runner.invoke( | |
| app, | |
| [ | |
| "init", | |
| str(target), | |
| "--ai", | |
| "claude", | |
| "--offline", | |
| "--ignore-agent-tools", | |
| "--no-git", | |
| "--script", | |
| "sh", | |
| ], | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure_claude_md() will create a root CLAUDE.md that instructs Claude to read
.specify/memory/constitution.mdeven when that file does not exist (e.g., whenensure_constitution_from_template()failed because the template was missing). Consider gating CLAUDE.md creation on the constitution file existing (or on the template being present), and mark the tracker step as error/skipped otherwise to avoid generating misleading guidance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated