@casomoltd/tooling 0.26.3 → 0.28.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.
- package/README.md +11 -1
- package/bin/check-linear.sh +47 -0
- package/bin/pre-push.sh +2 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -21,7 +21,8 @@ Shared linting, formatting, commit config, and CLI tools for Casomo Ltd's repos.
|
|
|
21
21
|
| Command | Description |
|
|
22
22
|
|---|---|
|
|
23
23
|
| `check-version` | Pre-push guard — rejects push if `package.json` version hasn't changed vs `origin/main` |
|
|
24
|
-
| `
|
|
24
|
+
| `check-linear` | Pre-push guard — rejects a push that would put a merge commit on the remote. History is linear; a branch catches up by rebasing. Only what the push adds is judged, so merges already on the remote stay |
|
|
25
|
+
| `pre-push` | Husky pre-push hook — runs check, then the version, tag and linear-history guards |
|
|
25
26
|
| `pre-commit` | Husky pre-commit hook — runs `npm run check` |
|
|
26
27
|
| `commit-msg` | Husky commit-msg hook — runs commitlint |
|
|
27
28
|
| `readability` | Measure reading difficulty of page content |
|
|
@@ -388,6 +389,15 @@ duplicated coverage, and missing back-links. It judges structure and
|
|
|
388
389
|
cross-reference coherence against `docs-style` — not mechanical broken links
|
|
389
390
|
(that's a markdown link linter) or prose voice (a content reviewer).
|
|
390
391
|
|
|
392
|
+
**`casomoltd:doc-review`** reviews *one repository doc* against `docs-style`:
|
|
393
|
+
whether it gets to the point or buries it under furniture, whether it is one
|
|
394
|
+
subject or three, whether a leaf carries an index belonging in the README,
|
|
395
|
+
whether a section says "not built yet" where content should be, and whether the
|
|
396
|
+
session's own progress has leaked in. A doc can be right in every sentence and
|
|
397
|
+
fail this review, because what it judges is shape. Not link validity (a markdown
|
|
398
|
+
link linter), not the corpus reference graph (`docs-xray`), not skills or agent
|
|
399
|
+
briefs (`skill-review`).
|
|
400
|
+
|
|
391
401
|
**`casomoltd:skill-review`** reviews changed *skills and agent briefs* against
|
|
392
402
|
`docs-style` and [the authoring schema](docs/skill-agent-schema.md): prose that
|
|
393
403
|
narrates its own past rather than stating current truth, a unit missing the
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Refuse a push that would put a merge commit on the remote.
|
|
3
|
+
#
|
|
4
|
+
# History is linear here: a branch catches up by rebasing, never by merging.
|
|
5
|
+
# A merge commit costs the thing a linear history is kept for — `git log` on a
|
|
6
|
+
# file stops being the list of changes to it, `git bisect` has two parents to
|
|
7
|
+
# choose between, and a revert has to name which side it means.
|
|
8
|
+
#
|
|
9
|
+
# The forge refuses merges made through its own UI; this refuses the other
|
|
10
|
+
# route, which is a local `git merge` followed by an ordinary push. Both are
|
|
11
|
+
# needed: neither covers the other.
|
|
12
|
+
#
|
|
13
|
+
# Only what the push would ADD is judged. A merge already on the remote stays
|
|
14
|
+
# where it is, because rewriting shared history to satisfy a new rule costs
|
|
15
|
+
# more than the rule is worth.
|
|
16
|
+
|
|
17
|
+
STATUS=0
|
|
18
|
+
|
|
19
|
+
while read -r _ LOCAL_SHA REMOTE_REF REMOTE_SHA; do
|
|
20
|
+
# A deletion pushes the zero sha and adds nothing.
|
|
21
|
+
case "$LOCAL_SHA" in
|
|
22
|
+
*[!0]*) ;;
|
|
23
|
+
*) continue ;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
case "$REMOTE_SHA" in
|
|
27
|
+
# A new branch: everything on it that no remote already has.
|
|
28
|
+
*[!0]*) RANGE="$REMOTE_SHA..$LOCAL_SHA" ;;
|
|
29
|
+
*) RANGE="$LOCAL_SHA --not --remotes" ;;
|
|
30
|
+
esac
|
|
31
|
+
|
|
32
|
+
# shellcheck disable=SC2086 # RANGE carries its own arguments.
|
|
33
|
+
MERGES=$(git rev-list --merges $RANGE 2>/dev/null)
|
|
34
|
+
|
|
35
|
+
if [ -n "$MERGES" ]; then
|
|
36
|
+
COUNT=$(printf '%s\n' "$MERGES" | wc -l | tr -d ' ')
|
|
37
|
+
echo "$REMOTE_REF would gain $COUNT merge commit(s):"
|
|
38
|
+
printf '%s\n' "$MERGES" | while read -r SHA; do
|
|
39
|
+
echo " $(git log --format='%h %s' -1 "$SHA")"
|
|
40
|
+
done
|
|
41
|
+
echo "History is linear here. Rebase instead:"
|
|
42
|
+
echo " git rebase main"
|
|
43
|
+
STATUS=1
|
|
44
|
+
fi
|
|
45
|
+
done
|
|
46
|
+
|
|
47
|
+
exit $STATUS
|
package/bin/pre-push.sh
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casomoltd/tooling",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Casomo's shared dev config: ESLint, Prettier, commitlint, knip & jscpd presets and dev CLIs (git hooks, readability, screenshots)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"bin": {
|
|
50
50
|
"build-report": "./bin/build-report.mjs",
|
|
51
51
|
"check-gates": "./bin/check-gates.mjs",
|
|
52
|
+
"check-linear": "./bin/check-linear.sh",
|
|
52
53
|
"check-private-refs": "./bin/check-private-refs.mjs",
|
|
53
54
|
"check-tags": "./bin/check-tags.sh",
|
|
54
55
|
"check-version": "./bin/check-version.sh",
|