@@ -122,6 +122,58 @@ def test_install_is_idempotent(self, mock_claude_project: Path) -> None:
122122 assert (claude_dir / "deepwork_jobs.define.md" ).exists ()
123123 assert (claude_dir / "deepwork_jobs.learn.md" ).exists ()
124124
125+ def test_install_creates_policy_template (self , mock_claude_project : Path ) -> None :
126+ """Test that install creates a policy template file."""
127+ runner = CliRunner ()
128+
129+ result = runner .invoke (
130+ cli ,
131+ ["install" , "--platform" , "claude" , "--path" , str (mock_claude_project )],
132+ catch_exceptions = False ,
133+ )
134+
135+ assert result .exit_code == 0
136+ assert ".deepwork.policy.yml template" in result .output
137+
138+ # Verify policy file was created
139+ policy_file = mock_claude_project / ".deepwork.policy.yml"
140+ assert policy_file .exists ()
141+
142+ # Verify it's the template (has comment header, no active policies)
143+ content = policy_file .read_text ()
144+ assert "# DeepWork Policy Configuration" in content
145+ assert "# Use /deepwork_policy.define" in content
146+
147+ # Verify it does NOT contain deepwork-specific policies
148+ assert "Standard Jobs Source of Truth" not in content
149+ assert "Version and Changelog Update" not in content
150+ assert "pyproject.toml" not in content
151+
152+ def test_install_preserves_existing_policy_file (self , mock_claude_project : Path ) -> None :
153+ """Test that install doesn't overwrite existing policy file."""
154+ runner = CliRunner ()
155+
156+ # Create a custom policy file before install
157+ policy_file = mock_claude_project / ".deepwork.policy.yml"
158+ custom_content = """- name: "My Custom Policy"
159+ trigger: "src/**/*"
160+ instructions: |
161+ Custom instructions here.
162+ """
163+ policy_file .write_text (custom_content )
164+
165+ result = runner .invoke (
166+ cli ,
167+ ["install" , "--platform" , "claude" , "--path" , str (mock_claude_project )],
168+ catch_exceptions = False ,
169+ )
170+
171+ assert result .exit_code == 0
172+ assert ".deepwork.policy.yml already exists" in result .output
173+
174+ # Verify original content is preserved
175+ assert policy_file .read_text () == custom_content
176+
125177
126178class TestCLIEntryPoint :
127179 """Tests for CLI entry point."""
0 commit comments