|
| 1 | +"""Regression tests for integration-aware init command hints.""" |
| 2 | + |
| 3 | +from typer.testing import CliRunner |
| 4 | + |
| 5 | +from tests.conftest import strip_ansi |
| 6 | + |
| 7 | + |
| 8 | +def _clean_output(output: str) -> str: |
| 9 | + return strip_ansi(output) |
| 10 | + |
| 11 | + |
| 12 | +def test_init_codex_next_steps_use_dollar_skills(tmp_path): |
| 13 | + from specify_cli import app |
| 14 | + |
| 15 | + project = tmp_path / "codex-init" |
| 16 | + result = CliRunner().invoke( |
| 17 | + app, |
| 18 | + [ |
| 19 | + "init", |
| 20 | + str(project), |
| 21 | + "--integration", |
| 22 | + "codex", |
| 23 | + "--script", |
| 24 | + "sh", |
| 25 | + "--ignore-agent-tools", |
| 26 | + ], |
| 27 | + catch_exceptions=False, |
| 28 | + ) |
| 29 | + |
| 30 | + output = _clean_output(result.output) |
| 31 | + assert result.exit_code == 0, result.output |
| 32 | + assert "$speckit-plan" in output |
| 33 | + assert "$speckit-analyze" in output |
| 34 | + assert "/speckit-plan" not in output |
| 35 | + assert "/speckit.plan" not in output |
| 36 | + |
| 37 | + |
| 38 | +def test_init_copilot_next_steps_keep_slash_dot(tmp_path): |
| 39 | + from specify_cli import app |
| 40 | + |
| 41 | + project = tmp_path / "copilot-init" |
| 42 | + result = CliRunner().invoke( |
| 43 | + app, |
| 44 | + [ |
| 45 | + "init", |
| 46 | + str(project), |
| 47 | + "--integration", |
| 48 | + "copilot", |
| 49 | + "--script", |
| 50 | + "sh", |
| 51 | + "--ignore-agent-tools", |
| 52 | + ], |
| 53 | + catch_exceptions=False, |
| 54 | + ) |
| 55 | + |
| 56 | + output = _clean_output(result.output) |
| 57 | + assert result.exit_code == 0, result.output |
| 58 | + assert "/speckit.plan" in output |
| 59 | + assert "/speckit.tasks" in output |
| 60 | + assert "$speckit-plan" not in output |
| 61 | + |
| 62 | + |
| 63 | +def test_init_copilot_skills_next_steps_keep_slash_hyphen(tmp_path): |
| 64 | + from specify_cli import app |
| 65 | + |
| 66 | + project = tmp_path / "copilot-skills-init" |
| 67 | + result = CliRunner().invoke( |
| 68 | + app, |
| 69 | + [ |
| 70 | + "init", |
| 71 | + str(project), |
| 72 | + "--integration", |
| 73 | + "copilot", |
| 74 | + "--integration-options", |
| 75 | + "--skills", |
| 76 | + "--script", |
| 77 | + "sh", |
| 78 | + "--ignore-agent-tools", |
| 79 | + ], |
| 80 | + catch_exceptions=False, |
| 81 | + ) |
| 82 | + |
| 83 | + output = _clean_output(result.output) |
| 84 | + assert result.exit_code == 0, result.output |
| 85 | + assert "/speckit-plan" in output |
| 86 | + assert "/speckit-tasks" in output |
| 87 | + assert "/speckit.plan" not in output |
| 88 | + assert "$speckit-plan" not in output |
0 commit comments