|
| 1 | +# Task List: Fix Bundled Prompts Directory Resolution for Remote Installation |
| 2 | + |
| 3 | +## Relevant Files |
| 4 | + |
| 5 | +- `slash_commands/writer.py` - Contains `_find_package_prompts_dir()` and `_load_prompts()` methods that need to use `importlib.resources` and distinguish between default vs explicit paths |
| 6 | +- `tests/test_writer.py` - Tests for writer functionality, needs updates for new behavior |
| 7 | +- `slash_commands/cli.py` - CLI interface that needs to change default value for `prompts_dir` parameter and improve error handling |
| 8 | +- `tests/test_cli.py` - CLI tests that may need updates for new default behavior |
| 9 | + |
| 10 | +### Notes |
| 11 | + |
| 12 | +- All tests should be run with `pytest tests/` from the project root |
| 13 | +- Manual testing should verify the tool works with `uvx` installation |
| 14 | +- The package name used for `importlib.resources` is `spec_driven_development_mcp` (from pyproject.toml) |
| 15 | + |
| 16 | +## Tasks |
| 17 | + |
| 18 | +- [ ] 1.0 Update `_find_package_prompts_dir()` to use importlib.resources |
| 19 | + - Demo Criteria: "Run from home directory and verify bundled prompts are located without specifying --prompts-dir" |
| 20 | + - Proof Artifact(s): "Test: `pytest tests/test_writer.py::test_writer_finds_bundled_prompts` shows successful resolution" |
| 21 | + - [ ] 1.1 Import `importlib.resources` module |
| 22 | + - [ ] 1.2 Add strategy using `importlib.resources.files()` to locate bundled prompts |
| 23 | + - [ ] 1.3 Keep existing fallback strategy using `Path(__file__).parent.parent` |
| 24 | + - [ ] 1.4 Add proper error handling for importlib edge cases |
| 25 | + - [ ] 1.5 Write unit test for importlib.resources path resolution |
| 26 | + |
| 27 | +- [ ] 2.0 Update CLI to distinguish default vs explicit prompts directory |
| 28 | + - Demo Criteria: "Running without --prompts-dir shows bundled prompts; explicit --prompts-dir/nonexistent shows clear error" |
| 29 | + - Proof Artifact(s): "Test: Explicit vs default behavior verified in CLI tests; CLI error messages are clear" |
| 30 | + - [ ] 2.1 Change `prompts_dir` default value from `Path("prompts")` to `None` in CLI signature |
| 31 | + - [ ] 2.2 Pass a flag or sentinel value to SlashCommandWriter indicating if path was user-specified |
| 32 | + - [ ] 2.3 Update SlashCommandWriter.__init__ to accept the flag parameter |
| 33 | + - [ ] 2.4 Update error handling in CLI to show different messages for default vs explicit paths |
| 34 | + |
| 35 | +- [ ] 3.0 Update `_load_prompts()` to handle default vs explicit paths differently |
| 36 | + - Demo Criteria: "Default path falls back to bundled prompts; explicit path fails immediately without fallback" |
| 37 | + - Proof Artifact(s): "Test: `test_writer_default_path_fallback` and `test_writer_explicit_path_no_fallback` pass" |
| 38 | + - [ ] 3.1 Modify `_load_prompts()` to check the flag for explicit vs default |
| 39 | + - [ ] 3.2 Only attempt fallback to bundled prompts when using default path |
| 40 | + - [ ] 3.3 Raise clear error for explicit non-existent paths without fallback |
| 41 | + - [ ] 3.4 Write tests for both scenarios (default with fallback, explicit without fallback) |
| 42 | + |
| 43 | +- [ ] 4.0 Improve error messages for better user guidance |
| 44 | + - Demo Criteria: "Error messages clearly distinguish scenarios and provide actionable guidance" |
| 45 | + - Proof Artifact(s): "CLI output showing clear, distinct error messages for each failure scenario" |
| 46 | + - [ ] 4.1 Create different error messages for "default path not found" vs "explicit path not found" |
| 47 | + - [ ] 4.2 Include information about attempted fallback in error messages |
| 48 | + - [ ] 4.3 Show the actual paths that were checked |
| 49 | + - [ ] 4.4 Update existing error handling in CLI to use new messages |
| 50 | + |
| 51 | +- [ ] 5.0 Ensure backward compatibility and verify existing tests pass |
| 52 | + - Demo Criteria: "All existing tests pass; development workflow still works; custom prompts paths still work" |
| 53 | + - Proof Artifact(s): "Test suite: All tests pass; Manual: Run from project root works; Manual: Custom --prompts-dir works" |
| 54 | + - [ ] 5.1 Run full test suite to ensure no regressions |
| 55 | + - [ ] 5.2 Update or remove tests that expected old behavior |
| 56 | + - [ ] 5.3 Test development workflow (running from project root with local prompts) |
| 57 | + - [ ] 5.4 Test custom prompts directory still works when explicitly specified |
| 58 | + - [ ] 5.5 Manual test with uvx installation from GitHub to verify remote install works |
0 commit comments