@ryusenkei/conventions 0.2.1 → 0.3.1
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 +2 -1
- package/dist/files.js +4 -2
- package/files/dependabot-gomod.yaml +19 -0
- package/files/pre-push +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ The PreToolUse hook blocks the call and tells Claude why, so Claude can fix it a
|
|
|
59
59
|
| Secrets | `permissions.deny` blocks reading `.env` and `.dev.vars` with Claude's file tools (not Bash) |
|
|
60
60
|
| Definition of done (`--stop`) | The Stop hook runs `pnpm lint` and `pnpm test` when the working tree has changes, and sends Claude back once on failure |
|
|
61
61
|
|
|
62
|
-
Commit messages are checked by `.githooks/commit-msg`, and edited files by prose-lint's PostToolUse hook. `.githooks/pre-push` runs `pnpm run --if-present check`, so a repository that defines a `check` script cannot push until it passes. It applies to people as well as Claude.
|
|
62
|
+
Commit messages are checked by `.githooks/commit-msg`, and edited files by prose-lint's PostToolUse hook. `.githooks/pre-push` runs `pnpm run --if-present check`, so a repository that defines a `check` script cannot push until it passes. It applies to people as well as Claude. When [jobgate](https://github.com/ryusenkei-inc/jobgate) is on the `PATH` and the repository has a `check` script, the check runs through `jobgate run`, so pushes from parallel agents and repositories wait for free memory instead of exhausting it.
|
|
63
63
|
|
|
64
64
|
### Epic flow
|
|
65
65
|
|
|
@@ -82,6 +82,7 @@ Opt in per repository in the root `package.json`:
|
|
|
82
82
|
`sync` writes these files and `check` compares them, ignoring line endings:
|
|
83
83
|
|
|
84
84
|
- `.editorconfig`, `.gitattributes`, `.gitignore`, `.gitleaks.toml`, `mise.toml`, `.github/dependabot.yaml`, `.githooks/commit-msg`, `.githooks/pre-push`
|
|
85
|
+
- `.github/dependabot.yaml` updates npm and GitHub Actions. When the repository has a `go.mod` at the root, a `gomod` entry is appended (same schedule, rebase strategy and cooldown, minor and patch grouped). Without one it is left out, because Dependabot fails on a missing `go.mod`
|
|
85
86
|
- `.claude/settings.json`: only the hooks, `attribution`, and `permissions.deny` are managed. Other settings and hooks are kept
|
|
86
87
|
- `pnpm-workspace.yaml`: `minimumReleaseAge` and `minimumReleaseAgeExclude`, matching the Dependabot `cooldown`
|
|
87
88
|
|
package/dist/files.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 利用側のリポにある共通ファイルの同期・検査
|
|
2
2
|
// - マスタ: パッケージの `files/`(npm は `.gitignore` を同梱しない → 先頭の `.` を除いた名前で格納)
|
|
3
3
|
// - 比較は改行コードを LF に正規化(Windows の作業ツリーは CRLF になりうる)
|
|
4
|
+
// - `append`: 条件のファイルがあるリポのみ末尾に追加(例: go.mod のないリポで gomod の更新はエラー)
|
|
4
5
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
6
|
import { dirname, join } from 'node:path';
|
|
6
7
|
import { hasStop, managedSettings } from "./settings.js";
|
|
@@ -10,7 +11,7 @@ const FILES = [
|
|
|
10
11
|
{ from: 'gitignore', to: '.gitignore' },
|
|
11
12
|
{ from: 'gitleaks.toml', to: '.gitleaks.toml' },
|
|
12
13
|
{ from: 'mise.toml', to: 'mise.toml' },
|
|
13
|
-
{ from: 'dependabot.yaml', to: '.github/dependabot.yaml' },
|
|
14
|
+
{ from: 'dependabot.yaml', to: '.github/dependabot.yaml', append: { from: 'dependabot-gomod.yaml', if: 'go.mod' } },
|
|
14
15
|
{ from: 'commit-msg', to: '.githooks/commit-msg', mode: 0o755 },
|
|
15
16
|
{ from: 'pre-push', to: '.githooks/pre-push', mode: 0o755 },
|
|
16
17
|
];
|
|
@@ -27,11 +28,12 @@ const RELEASE_AGE = [
|
|
|
27
28
|
];
|
|
28
29
|
const lf = (s) => s.replaceAll('\r\n', '\n');
|
|
29
30
|
const read = (path) => (existsSync(path) ? lf(readFileSync(path, 'utf8')) : undefined);
|
|
31
|
+
const master = (name) => lf(readFileSync(new URL(`../files/${name}`, import.meta.url), 'utf8'));
|
|
30
32
|
/** マスタとの差分 */
|
|
31
33
|
export function drifts(root, options = {}) {
|
|
32
34
|
const out = [];
|
|
33
35
|
for (const f of FILES) {
|
|
34
|
-
const expected =
|
|
36
|
+
const expected = master(f.from) + (f.append && existsSync(join(root, f.append.if)) ? master(f.append.from) : '');
|
|
35
37
|
if (read(join(root, f.to)) !== expected)
|
|
36
38
|
out.push({ path: f.to, expected, message: 'マスタと不一致' });
|
|
37
39
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
# Go のモジュール(ルートに go.mod があるリポのみ `sync` が追加)
|
|
3
|
+
- package-ecosystem: gomod
|
|
4
|
+
directory: "/"
|
|
5
|
+
# 頻度・rebase・公開直後のバージョンの回避は npm と同じ
|
|
6
|
+
schedule:
|
|
7
|
+
interval: monthly
|
|
8
|
+
rebase-strategy: disabled
|
|
9
|
+
cooldown:
|
|
10
|
+
default-days: 2
|
|
11
|
+
commit-message:
|
|
12
|
+
prefix: build
|
|
13
|
+
include: scope
|
|
14
|
+
groups:
|
|
15
|
+
# minor・patch は1つの PR にまとめる(Go の major はモジュールのパスが変わるため Dependabot の対象外)
|
|
16
|
+
minor-and-patch:
|
|
17
|
+
update-types:
|
|
18
|
+
- minor
|
|
19
|
+
- patch
|
package/files/pre-push
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# push の前の検査(`check` のスクリプトを持つリポのみ。CI の失敗・Actions の消費を手元で防止)
|
|
3
|
+
# jobgate があれば資源の空きを待って実行(並行するエージェント・リポの重い検査によるメモリの枯渇を防止)
|
|
4
|
+
# `check` のないリポは枠を待たない
|
|
5
|
+
if command -v jobgate >/dev/null 2>&1 && grep -q '"check":' package.json 2>/dev/null; then
|
|
6
|
+
exec jobgate run --weight 2 -- pnpm run check
|
|
7
|
+
fi
|
|
3
8
|
exec pnpm run --if-present check
|