@seangalie/precast 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  minimum_pre_commit_version: "3.2.0"
2
- default_install_hook_types: [pre-commit]
2
+ default_install_hook_types: [pre-commit, pre-merge-commit, commit-msg]
3
3
  default_stages: [pre-commit]
4
4
 
5
5
  repos:
@@ -8,6 +8,11 @@ repos:
8
8
  hooks:
9
9
  - id: check-merge-conflict
10
10
  args: [--assume-in-merge]
11
+ # Changes reach the default branch through branches and review. CI skips this,
12
+ # and SKIP=no-commit-to-branch allows a deliberate commit there.
13
+ - id: no-commit-to-branch
14
+ args: [--branch, @@DEFAULT_BRANCH_YAML@@]
15
+ stages: [pre-commit, pre-merge-commit]
11
16
  - id: check-json
12
17
  - id: check-yaml
13
18
  - id: check-toml
@@ -15,6 +20,13 @@ repos:
15
20
  - id: check-added-large-files
16
21
  args: [--maxkb=10240, --enforce-all]
17
22
 
23
+ - repo: https://github.com/compilerla/conventional-pre-commit
24
+ rev: 33b50eb042bee26eac0ee96ad84aa9c1b4dccdd8 # frozen: v4.5.0
25
+ hooks:
26
+ # Commit messages use the Conventional Commit types.
27
+ - id: conventional-pre-commit
28
+ stages: [commit-msg]
29
+
18
30
  - repo: https://github.com/gitleaks/gitleaks
19
31
  rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # frozen: v8.30.1
20
32
  hooks:
@@ -15,4 +15,6 @@ export PRE_COMMIT_HOME="${PRE_COMMIT_HOME:-${ci_tmp}/pre-commit}"
15
15
  # this checkout in a temporary Git configuration, leaving user settings untouched.
16
16
  export GIT_CONFIG_GLOBAL="${ci_tmp}/gitconfig"
17
17
  git config --global --add safe.directory "$(pwd -P)"
18
+ # CI checks out the default branch on pushes, which the local branch guard rejects.
19
+ export SKIP="${SKIP:+${SKIP},}no-commit-to-branch"
18
20
  pre-commit run --all-files --show-diff-on-failure
@@ -25,6 +25,9 @@ Project instructions for coding agents. Human contributors should read
25
25
  - Markdown audit: `pre-commit run --hook-stage manual rumdl-check --all-files`.
26
26
  - Install local hooks explicitly with `pre-commit install` after installing the
27
27
  development tool. Generation never installs hooks or modifies Git settings.
28
+ - A `commit-msg` hook enforces Conventional Commit messages, and
29
+ `no-commit-to-branch` refuses commits and merge commits on `@@DEFAULT_BRANCH@@`. Work on a branch;
30
+ do not bypass either hook unless the maintainer asks.
28
31
  @@END_TIERS@@
29
32
 
30
33
  ## Layout
@@ -21,15 +21,24 @@ apply labels, enable features, configure protections, or run destination CI.
21
21
 
22
22
  - [ ] Create an empty destination repository with the intended visibility at @@REPO_URL@@.
23
23
  - [ ] Initialize this directory with Git and set the default branch to `@@DEFAULT_BRANCH@@`.
24
+ - [ ] Review every file before committing and pushing. No master-template Git history is included.
24
25
  @@TIERS regular full@@
26
+ - [ ] Make the first commit on `@@DEFAULT_BRANCH@@` before installing hooks: the
27
+ hooks refuse commits and merge commits on that branch.
25
28
  - [ ] Install pre-commit as a development tool, review `.pre-commit-config.yaml`,
26
- then run `pre-commit install` and `pre-commit run --all-files`. Hook environments
27
- need network access on the first run; generation itself remains offline.
29
+ then run `pre-commit install`. Check the files once with
30
+ `SKIP=no-commit-to-branch pre-commit run --all-files`, since the branch guard
31
+ fails on `@@DEFAULT_BRANCH@@` itself, or run `pre-commit run --all-files` from a
32
+ topic branch. Hook environments need network access on the first run;
33
+ generation itself remains offline.
34
+ - [ ] Work on short branches from here on. The installed hooks check commit messages
35
+ for Conventional Commits and refuse commits and merge commits on
36
+ `@@DEFAULT_BRANCH@@`. For a deliberate commit there, run
37
+ `SKIP=no-commit-to-branch git commit`.
28
38
  - [ ] Confirm CI can run `.repo/ci-checks.sh`: Git, Bash, Python with pip/venv,
29
39
  and access to the pinned hook/tool sources are required. Hook runtimes are managed
30
40
  by pre-commit; no separately installed Go toolchain is required.
31
41
  @@END_TIERS@@
32
- - [ ] Review every file before committing and pushing. No master-template Git history is included.
33
42
  - [ ] Set the description, topics, and access permissions on the destination.
34
43
  @@TIERS regular full@@
35
44
  - [ ] Review `@@PLATFORM_DIR@@/CODEOWNERS`; no owner is inferred from a group namespace.
@@ -12,20 +12,25 @@ Clone [the repository](@@REPO_URL@@), then follow these steps:
12
12
  > Keep them consistent with `AGENTS.md` and `@@CI_FILE@@`.
13
13
 
14
14
  For the shared development checks, install pre-commit in your development environment,
15
- then explicitly install the local hook:
15
+ then explicitly install the local hooks. Run the checks from a topic branch: on
16
+ `@@DEFAULT_BRANCH@@` itself the branch guard fails by design.
16
17
 
17
18
  ```sh
18
19
  pre-commit install
20
+ git switch -c improve-export
19
21
  pre-commit run --all-files --show-diff-on-failure
20
22
  ```
21
23
 
22
24
  The first run downloads pinned hook sources and their managed runtimes. The hooks
23
25
  check conflicts, file types, case collisions, file size, secrets, EditorConfig,
24
- shell scripts, and native Actions workflows where applicable. Markdown lint is
25
- an optional audit: `pre-commit run --hook-stage manual rumdl-check --all-files`.
26
- CI runs the automatic checks through `.repo/ci-checks.sh` and native lint jobs.
27
- Forgejo/GitHub skip only the hooks already covered by their pinned native jobs;
28
- local hooks still run the complete set.
26
+ shell scripts, and native Actions workflows where applicable. Markdown lint is an
27
+ optional audit: `pre-commit run --hook-stage manual rumdl-check --all-files`.
28
+ `pre-commit install` also adds a commit-message hook that requires Conventional
29
+ Commits, and a check that refuses commits and merge commits on `@@DEFAULT_BRANCH@@`,
30
+ so changes go through a branch and a change request. CI runs the automatic checks
31
+ through `.repo/ci-checks.sh` and native lint jobs. Forgejo/GitHub skip only the
32
+ hooks already covered by their pinned native jobs; local hooks still run the
33
+ complete set.
29
34
 
30
35
  ## Reporting issues
31
36