@ryusenkei/conventions 0.3.0 → 0.4.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 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
 
@@ -83,6 +83,7 @@ Opt in per repository in the root `package.json`:
83
83
 
84
84
  - `.editorconfig`, `.gitattributes`, `.gitignore`, `.gitleaks.toml`, `mise.toml`, `.github/dependabot.yaml`, `.githooks/commit-msg`, `.githooks/pre-push`
85
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`
86
+ - When the repository has a `Cargo.toml` at the root, a `cargo` entry is appended to `.github/dependabot.yaml` after any `gomod` entry (same settings as `gomod`, covering workspace members), and `target/` is appended to `.gitignore`. `Cargo.lock` stays tracked
86
87
  - `.claude/settings.json`: only the hooks, `attribution`, and `permissions.deny` are managed. Other settings and hooks are kept
87
88
  - `pnpm-workspace.yaml`: `minimumReleaseAge` and `minimumReleaseAgeExclude`, matching the Dependabot `cooldown`
88
89
 
package/dist/files.js CHANGED
@@ -1,17 +1,24 @@
1
1
  // 利用側のリポにある共通ファイルの同期・検査
2
2
  // - マスタ: パッケージの `files/`(npm は `.gitignore` を同梱しない → 先頭の `.` を除いた名前で格納)
3
3
  // - 比較は改行コードを LF に正規化(Windows の作業ツリーは CRLF になりうる)
4
- // - `append`: 条件のファイルがあるリポのみ末尾に追加(例: go.mod のないリポで gomod の更新はエラー)
4
+ // - `append`: 条件のファイルがあるリポのみ、記載の順に末尾に追加(例: go.mod のないリポで gomod の更新はエラー)
5
5
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
6
6
  import { dirname, join } from 'node:path';
7
7
  import { hasStop, managedSettings } from "./settings.js";
8
8
  const FILES = [
9
9
  { from: 'editorconfig', to: '.editorconfig' },
10
10
  { from: 'gitattributes', to: '.gitattributes' },
11
- { from: 'gitignore', to: '.gitignore' },
11
+ { from: 'gitignore', to: '.gitignore', append: [{ from: 'gitignore-cargo', if: 'Cargo.toml' }] },
12
12
  { from: 'gitleaks.toml', to: '.gitleaks.toml' },
13
13
  { from: 'mise.toml', to: 'mise.toml' },
14
- { from: 'dependabot.yaml', to: '.github/dependabot.yaml', append: { from: 'dependabot-gomod.yaml', if: 'go.mod' } },
14
+ {
15
+ from: 'dependabot.yaml',
16
+ to: '.github/dependabot.yaml',
17
+ append: [
18
+ { from: 'dependabot-gomod.yaml', if: 'go.mod' },
19
+ { from: 'dependabot-cargo.yaml', if: 'Cargo.toml' },
20
+ ],
21
+ },
15
22
  { from: 'commit-msg', to: '.githooks/commit-msg', mode: 0o755 },
16
23
  { from: 'pre-push', to: '.githooks/pre-push', mode: 0o755 },
17
24
  ];
@@ -33,7 +40,8 @@ const master = (name) => lf(readFileSync(new URL(`../files/${name}`, import.meta
33
40
  export function drifts(root, options = {}) {
34
41
  const out = [];
35
42
  for (const f of FILES) {
36
- const expected = master(f.from) + (f.append && existsSync(join(root, f.append.if)) ? master(f.append.from) : '');
43
+ const appended = (f.append ?? []).filter((a) => existsSync(join(root, a.if))).map((a) => master(a.from));
44
+ const expected = master(f.from) + appended.join('');
37
45
  if (read(join(root, f.to)) !== expected)
38
46
  out.push({ path: f.to, expected, message: 'マスタと不一致' });
39
47
  }
@@ -0,0 +1,19 @@
1
+
2
+ # Rust のクレート(ルートに Cargo.toml があるリポのみ `sync` が追加)。ワークスペースのメンバーも横断
3
+ - package-ecosystem: cargo
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 にまとめる(major は個別の PR でレビュー)
16
+ minor-and-patch:
17
+ update-types:
18
+ - minor
19
+ - patch
@@ -0,0 +1,3 @@
1
+
2
+ # ---- Rust(ルートに Cargo.toml があるリポのみ `sync` が追加。Cargo.lock は追跡) ----
3
+ target/
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryusenkei/conventions",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "RYUSENKEI のモノリポの共通の規約(Claude Code の規約・hook、共通ファイルの同期)",
5
5
  "license": "MIT",
6
6
  "author": "RYUSENKEI",