@zgeoff/chex 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/lefthook.yml +45 -23
  2. package/package.json +1 -1
package/lefthook.yml CHANGED
@@ -13,6 +13,16 @@
13
13
  # repo's own install of chex, diet and rig, and fails when one is missing
14
14
  # rather than download a package of that name.
15
15
 
16
+ # A pre-commit or a pre-push in a linked worktree exports GIT_DIR, which git
17
+ # reads before a -C path, so a job command that runs git in a folder of its
18
+ # own, such as a temp clone, would write to this repository instead. Each job
19
+ # starts with clear-git-env, which unsets every variable git lists as local to
20
+ # a repository; git then finds the repository from the job's folder. lefthook
21
+ # expands a template in run only, so each files command that runs a program
22
+ # unsets the same variables itself.
23
+ templates:
24
+ clear-git-env: unset $(git rev-parse --local-env-vars);
25
+
16
26
  pre-commit:
17
27
  # Sequential, so typecheck reads the files the fixers before it rewrote.
18
28
  piped: true
@@ -20,7 +30,7 @@ pre-commit:
20
30
  # lefthook skips the job when no staged file matches the glob.
21
31
  - name: typecheck
22
32
  glob: '*.{js,mjs,cjs,jsx,ts,mts,cts,tsx,json,jsonc}'
23
- run: bun x --no-install diet -- bun run typecheck
33
+ run: '{clear-git-env} bun x --no-install diet -- bun run typecheck'
24
34
 
25
35
  pre-push:
26
36
  # Sequential, to bound memory on a small host or with parallel agents.
@@ -30,24 +40,30 @@ pre-push:
30
40
  # push when a file the branch changes or deletes holds a change that is
31
41
  # not committed, and names each such file.
32
42
  - name: uncommitted
33
- run: bun x --no-install diet -- bun x --no-install chex uncommitted
43
+ run: '{clear-git-env} bun x --no-install diet -- bun x --no-install chex uncommitted'
34
44
  - name: format:check
35
- run: bun x --no-install diet -- bun run format:check
45
+ run: '{clear-git-env} bun x --no-install diet -- bun run format:check'
36
46
  # Plain oxlint, without the unused-directive check: a directive for a
37
47
  # type-aware rule reads as unused in plain mode.
38
48
  - name: lint
39
- files: bun node_modules/@zgeoff/chex/src/read-branch-files.ts
49
+ files:
50
+ unset $(git rev-parse --local-env-vars); bun
51
+ node_modules/@zgeoff/chex/src/read-branch-files.ts
40
52
  glob: '*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}'
41
53
  run:
42
- bun x --no-install diet -- bun x --no-install oxlint --no-error-on-unmatched-pattern {files}
54
+ '{clear-git-env} bun x --no-install diet -- bun x --no-install oxlint
55
+ --no-error-on-unmatched-pattern {files}'
43
56
  # Each file check reads only the files the branch changes that match its
44
57
  # glob, so a file the branch leaves unchanged never fails a push. A check
45
58
  # whose program the machine lacks prints a notice and passes: CI installs
46
59
  # the program and runs the check on every pull request.
47
60
  - name: shell
48
- files: bun node_modules/@zgeoff/chex/src/read-branch-files.ts
61
+ files:
62
+ unset $(git rev-parse --local-env-vars); bun
63
+ node_modules/@zgeoff/chex/src/read-branch-files.ts
49
64
  glob: '*.sh'
50
65
  run: |
66
+ {clear-git-env}
51
67
  for program in shellcheck shfmt; do
52
68
  if ! command -v "$program" > /dev/null; then
53
69
  echo "shell: skipped, because $program is not on the PATH; CI runs the check"
@@ -62,9 +78,11 @@ pre-push:
62
78
  # decides whether the job runs. The repo's check:docs script names the
63
79
  # checks it takes, such as chex prose length links.
64
80
  - name: docs
65
- files: bun node_modules/@zgeoff/chex/src/read-branch-files.ts
81
+ files:
82
+ unset $(git rev-parse --local-env-vars); bun
83
+ node_modules/@zgeoff/chex/src/read-branch-files.ts
66
84
  glob: '*.md'
67
- run: bun x --no-install diet -- bun run --silent check:docs
85
+ run: '{clear-git-env} bun x --no-install diet -- bun run --silent check:docs'
68
86
  # GitHub runs no workflow from a subfolder of .github/workflows, and
69
87
  # sync/workflow-callers holds the workflows that tools delivers. actionlint
70
88
  # 1.7.12 rejects the concurrency queue key that GitHub documents, until
@@ -72,11 +90,14 @@ pre-push:
72
90
  # The workflow lint runs after actionlint, even when actionlint is missing
73
91
  # or fails.
74
92
  - name: workflows
75
- files: bun node_modules/@zgeoff/chex/src/read-branch-files.ts
93
+ files:
94
+ unset $(git rev-parse --local-env-vars); bun
95
+ node_modules/@zgeoff/chex/src/read-branch-files.ts
76
96
  glob:
77
97
  - '.github/workflows/*.{yml,yaml}'
78
98
  - 'sync/workflow-callers/*.{yml,yaml}'
79
99
  run: |
100
+ {clear-git-env}
80
101
  status=0
81
102
  if ! command -v actionlint > /dev/null; then
82
103
  echo "workflows: actionlint skipped, because it is not on the PATH; CI runs it"
@@ -98,26 +119,27 @@ pre-push:
98
119
  - name: commits
99
120
  files: echo package.json
100
121
  use_stdin: true
101
- run: 'bun x --no-install diet -- bun x --no-install chex commits --pushed-refs # {files}'
122
+ run:
123
+ '{clear-git-env} bun x --no-install diet -- bun x --no-install chex commits --pushed-refs #
124
+ {files}'
102
125
  # package.json keeps this job from the same lefthook skip.
103
126
  - name: local-paths
104
127
  files: echo package.json
105
128
  use_stdin: true
106
- run: 'bun x --no-install diet -- bun x --no-install chex local-paths --pushed-refs # {files}'
129
+ run:
130
+ '{clear-git-env} bun x --no-install diet -- bun x --no-install chex local-paths
131
+ --pushed-refs # {files}'
107
132
  - name: test-timeouts
108
- run: bun x --no-install diet -- bun x --no-install chex test-timeouts
133
+ run: '{clear-git-env} bun x --no-install diet -- bun x --no-install chex test-timeouts'
109
134
  - name: dependency-gates
110
- run: bun x --no-install diet -- bun x --no-install chex dependency-gates
135
+ run: '{clear-git-env} bun x --no-install diet -- bun x --no-install chex dependency-gates'
111
136
  - name: typecheck
112
- run: bun x --no-install diet -- bun run typecheck
113
- # A pre-push in a linked worktree exports GIT_DIR, and a test that runs git
114
- # in a temp folder would inherit it and write to the real repository: a
115
- # git init there sets core.bare=true. The tests run without git's
116
- # repository variables. A bunfig.toml reaches the job too, because a change
117
- # to it skips the related tests.
137
+ run: '{clear-git-env} bun x --no-install diet -- bun run typecheck'
138
+ # A bunfig.toml reaches the job too, because a change to it skips the
139
+ # related tests.
118
140
  - name: test
119
- files: bun node_modules/@zgeoff/chex/src/read-branch-files.ts
141
+ files:
142
+ unset $(git rev-parse --local-env-vars); bun
143
+ node_modules/@zgeoff/chex/src/read-branch-files.ts
120
144
  glob: '*.{ts,tsx,toml}'
121
- run:
122
- env -u GIT_DIR -u GIT_WORK_TREE -u GIT_INDEX_FILE -u GIT_COMMON_DIR bun x --no-install diet
123
- -- bun x --no-install rig related {files}
145
+ run: '{clear-git-env} bun x --no-install diet -- bun x --no-install rig related {files}'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgeoff/chex",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "description": "Run each shared docs and repo check as one subcommand, with the lefthook pre-push baseline that calls them",
5
5
  "keywords": [
6
6
  "checks",