diff --git a/prompts/EXISTING_REPO_CHECKLIST.md b/prompts/EXISTING_REPO_CHECKLIST.md index 92d68e1..f62e99a 100644 --- a/prompts/EXISTING_REPO_CHECKLIST.md +++ b/prompts/EXISTING_REPO_CHECKLIST.md @@ -205,14 +205,14 @@ with your task. - [ ] `Makefile` exists in root — reference `https://git.eeqj.de/sneak/prompts/raw/branch/main/Makefile` - [ ] Has targets: `test`, `lint`, `fmt`, `fmt-check`, `check`, `docker`, - `hooks`, `install`, `update-policy` + `hooks`, `update-policy` - [ ] Target implementations live in `script/` (scripts-to-rule-them-all); Makefile targets are thin shims calling them — model scripts at `https://git.eeqj.de/sneak/prompts/raw/branch/main/script/` - [ ] `script/precommit` exists and the pre-commit hook (installed by `script/install-precommit`, shimmed by `make hooks`) runs it - [ ] `script/install` and `script/update-policy` exist, identical to the model - scripts, and `make install` and `make update-policy` shim to them. + scripts, and `make update-policy` shims to `script/update-policy`. `make update-policy` commits without pushing, so a person reviews and pushes the commit. Before its first use, the repo's own entries in `.gitignore`, `.editorconfig` and `.dockerignore` go below the comment diff --git a/prompts/NEW_REPO_CHECKLIST.md b/prompts/NEW_REPO_CHECKLIST.md index cc00df2..c5cd5a3 100644 --- a/prompts/NEW_REPO_CHECKLIST.md +++ b/prompts/NEW_REPO_CHECKLIST.md @@ -266,9 +266,8 @@ are thin shims calling them. Model scripts: - [ ] `script/install-precommit` — installs the pre-commit hook that runs `script/precommit` - [ ] `make hooks` — shims to `script/install-precommit` -- [ ] `script/install` / `make install` — fetches the vendored policy files from - the `prompts` repo over HTTP and writes them into the repo; identical - across repos +- [ ] `script/install` — fetches the vendored policy files from the `prompts` + repo over HTTP and writes them into the repo; identical across repos - [ ] `script/update-policy` / `make update-policy` — fetches the current `script/install`, runs it on the repo and commits the result without pushing; identical across repos diff --git a/prompts/REPO_POLICIES.md b/prompts/REPO_POLICIES.md index 8bdaeb3..ae433e1 100644 --- a/prompts/REPO_POLICIES.md +++ b/prompts/REPO_POLICIES.md @@ -93,7 +93,6 @@ style conventions are in separate documents: - `make check` (runs `test`, `lint`, `fmt-check`) - `make docker` - `make hooks` (installs pre-commit hook) - - `make install` (writes the current policy files into the repo) - `make update-policy` (brings the repo up to standards and commits) A model Makefile is at @@ -194,7 +193,7 @@ style conventions are in separate documents: `make hooks` target shims to it. - `script/install` fetches the vendored policy files from the `prompts` repo over HTTP and writes them into the repo it is given, or its own repo with - no argument. The `make install` target shims to it. + no argument. - `script/update-policy` fetches the current `script/install` from the `prompts` repo, runs it on its own repo and commits the result. It does not push. The `make update-policy` target shims to it. diff --git a/test/update-policy.sh b/test/update-policy.sh index 9d0451f..8a1ac08 100755 --- a/test/update-policy.sh +++ b/test/update-policy.sh @@ -453,6 +453,21 @@ test_language_files_need_a_source_file() { expect_new_commit_not_pushed } +test_javascript_source_brings_its_styleguide() { + for extension in js mjs; do + start_scenario "a repo whose only JavaScript source is a .$extension file gets the JavaScript style guide" + echo "export {}" > "$dir/repo/web.$extension" + commit_and_push_fixture "web.$extension" + remove_from_fixture docs/CODE_STYLEGUIDE_JS.md + run_update_policy + expect_success + expect_file docs/CODE_STYLEGUIDE_JS.md << 'EOF' +new CODE_STYLEGUIDE_JS +EOF + expect_new_commit_not_pushed + done +} + test_nothing_changed() { start_scenario "nothing changed" cp "$dir/canonical/.prettierrc" "$dir/repo/.prettierrc" @@ -675,14 +690,16 @@ EOF } test_own_script_stops() { - start_scenario "a tracked script/install with a line the canonical file has never held stops" - echo "echo our own installer" >> "$dir/repo/script/install" - commit_and_push_fixture .prettierrc - run_update_policy - expect_failure - expect_output "script/install has lines" - expect_output "echo our own installer" - expect_nothing_written + for script in script/install script/update-policy; do + start_scenario "a tracked $script with a line the canonical file has never held stops" + echo "echo our own script" >> "$dir/repo/$script" + commit_and_push_fixture .prettierrc + run_update_policy + expect_failure + expect_output "$script has lines" + expect_output "echo our own script" + expect_nothing_written + done } test_gitignore_lacks_canonical_last_line() { @@ -827,6 +844,7 @@ main() { test_own_entries_kept test_files_the_repo_lacks_are_written_whole test_language_files_need_a_source_file + test_javascript_source_brings_its_styleguide test_nothing_changed test_target_lacking_install_gets_both_scripts test_update_policy_replaces_itself