@ryusenkei/conventions 0.8.0 → 0.8.2

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
@@ -54,8 +54,8 @@ The PreToolUse hook blocks the call and tells Claude why, so Claude can fix it a
54
54
  | No force push to `main` / `master` | Blocks `git push --force` / `-f` / `--force-with-lease` and `+<refspec>` targeting `main` or `master` (also the current branch when no refspec is given) |
55
55
  | PR title = squash commit message | Checks `gh pr create` / `gh pr edit` titles with prose-lint's commit rules |
56
56
  | No AI signature | `attribution` is empty, and the hook blocks PR bodies with an AI signature |
57
- | Squash merge | Blocks `gh pr merge --rebase`, and `--merge` except for a `dev/*` → `main` PR with the epic flow, which must use `--merge` |
58
- | Merge only after CI passes | Blocks `gh pr merge` unless every check of the PR has passed (`gh pr checks`). Pending, failed, missing, or unreadable checks are blocked, also with `--auto`. A PR may have no checks only when the repository has no workflow that runs on `pull_request` (the pre-push `pnpm check` is the gate), or with the epic flow when it targets `dev/*`. Right after a push, the checks may not be registered yet, so the hook points to `gh pr checks --watch` |
57
+ | Squash merge | Blocks `gh pr merge --rebase` and `--merge`, also for a `dev/*` → `main` PR with the epic flow |
58
+ | Merge only after CI passes | Blocks `gh pr merge` unless every check of the PR has passed (`gh pr checks`). Pending, failed, missing, or unreadable checks are blocked, also with `--auto`. A PR may have no checks only when the repository has no enabled workflow that runs on `pull_request` (workflows disabled on GitHub with `gh workflow disable` don't count; the pre-push `pnpm check` is the gate), or with the epic flow when it targets `dev/*`. Right after a push, the checks may not be registered yet, so the hook points to `gh pr checks --watch` |
59
59
  | Epic flow (opt-in) | See [Epic flow](#epic-flow) |
60
60
  | Do not edit `node_modules` | Blocks Edit and Write under `node_modules` |
61
61
  | Secrets | `permissions.deny` blocks reading `.env` and `.dev.vars` with Claude's file tools (not Bash) |
@@ -63,7 +63,7 @@ The PreToolUse hook blocks the call and tells Claude why, so Claude can fix it a
63
63
 
64
64
  The hook works out the target from the command itself. After `cd` or `git -C`, it checks against that repository (including its epic opt-in and `prose-lint.json`). After `git switch` or `git checkout`, it uses the new branch. Heredoc bodies are not parsed as commands.
65
65
 
66
- 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 [Hostslot](https://github.com/ryusenkei-inc/hostslot) (`hostslot`) is on the `PATH` and the repository has a `check` script, the check runs through `hostslot run`, so pushes from parallel agents and repositories wait for free memory instead of exhausting it.
66
+ 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` without the repository variables git passes to hooks (`GIT_DIR`, `GIT_WORK_TREE`, `GIT_INDEX_FILE`, and the rest of `git rev-parse --local-env-vars`), so git commands in tests cannot write to the pushing repository. A repository that defines a `check` script cannot push until it passes. It applies to people as well as Claude. When [Hostslot](https://github.com/ryusenkei-inc/hostslot) (`hostslot`) is on the `PATH` and the repository has a `check` script, the check runs through `hostslot run`, so pushes from parallel agents and repositories wait for free memory instead of exhausting it.
67
67
 
68
68
  ### Epic flow
69
69
 
@@ -78,7 +78,7 @@ Opt in per repository in the root `package.json`:
78
78
  - Each epic gets an integration branch `dev/<issue>-<name>` (e.g. `dev/12-search`). Sub-issue PRs target it, and only a `dev/*` branch is merged into `main` (on deploy).
79
79
  - `gh pr create` to `main` (`--base main`, or no `--base`) is blocked unless the head (`--head`, or the current branch) is `dev/*`.
80
80
  - A PR from any other branch must target a `dev/*` base. `gh pr edit` is checked only when it changes `--base`.
81
- - A `dev/*` → `main` PR is merged with a merge commit (`gh pr merge --merge`), not squashed. This keeps one commit per sub-issue on `main`, and keeps `dev/*` and `main` from diverging when work continues on the epic after a deploy. Turn on "Allow merge commits" in the repository settings.
81
+ - A `dev/*` → `main` PR is squashed like any other PR, so each deploy becomes one commit on `main`. The sub-issue commits stay in the merged sub-issue PRs. If the epic continues after a deploy, recreate `dev/*` from `main` and rebase the open sub-issue PRs onto it, as described in the `stacked-pr` skill.
82
82
  - A PR into `dev/*` runs no CI; the pre-push `pnpm check` is the gate. `gh pr merge` allows such a PR with no checks, but any checks it has must still pass.
83
83
  - Without the opt-in, none of this applies and `dev/*` branch names are rejected.
84
84
 
@@ -87,8 +87,9 @@ Opt in per repository in the root `package.json`:
87
87
  `sync` writes these files and `check` compares them, ignoring line endings:
88
88
 
89
89
  - `.editorconfig`, `.gitattributes`, `.gitignore`, `.gitleaks.toml`, `mise.toml`, `.github/dependabot.yaml`, `.githooks/commit-msg`, `.githooks/pre-push`
90
- - Skills in `.claude/skills/`: `stacked-pr` (cleaning up a stacked PR after its parent is squash-merged). Only these names are managed; other skills in the repository are kept
90
+ - Skills in `.claude/skills/`: `stacked-pr` (cleaning up a stacked PR after its parent is squash-merged, including sub-issue PRs after an epic's `dev/*` is squash-merged into `main`). Only these names are managed; other skills in the repository are kept
91
91
  - `.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`
92
+ - With `"ryusenkei": { "dependabot": false }` in the root `package.json`, `.github/dependabot.yaml` is not synced; `check` reports it if present and `sync` deletes it. Use this in private repositories to save GitHub Actions minutes, and update dependencies locally with `pnpm update`. Dependabot security updates are a separate repository setting
92
93
  - 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
93
94
  - `.claude/settings.json`: only the hooks, `attribution`, `permissions.deny`, and the writing plugins are managed. Other settings, hooks, and plugins are kept
94
95
  - The writing plugins are [yomiyasu](https://github.com/nanaism/yomiyasu) (Japanese) and [humanizer](https://github.com/blader/humanizer) (English). `extraKnownMarketplaces` registers their marketplaces and `enabledPlugins` turns them on. They load after you trust the folder, with no separate install. They are not bundled, and they do not auto-update; run `/plugin` to update them. To turn one off in a repository, set it to `false` in `enabledPlugins`
@@ -105,6 +106,8 @@ Opt in per repository in the root `package.json`:
105
106
 
106
107
  When the `rules.md` import is present, `sync` adds the missing ones right after it.
107
108
 
109
+ `check` also reports a root `package.json` without a `check` script, since the pre-push hook runs `pnpm check` and pushes unchecked without one. Add it by hand (for example `pnpm typecheck && pnpm test && pnpm lint:prose && ryusenkei-conventions check`).
110
+
108
111
  Dependabot runs monthly with `rebase-strategy: disabled` to save GitHub Actions minutes, so rebase a Dependabot PR (`@dependabot rebase`) before merging it. The `cooldown` excludes `@ryusenkei/*`. To pick up a new version sooner, run `pnpm update "@ryusenkei/*"`. After an update, `check` fails until `sync` is run.
109
112
 
110
113
  ## Dependency direction
@@ -186,6 +189,7 @@ jobs:
186
189
  | `reusable-ci.yaml` | Checkout (full history), mise, pnpm, `pnpm install --frozen-lockfile`, `pnpm typecheck`, `pnpm test`, `pnpm lint:prose`, the `checks` input, the PR title with prose-lint's commit rules (not for Dependabot), and a gitleaks scan with `.gitleaks.toml` |
187
190
  | `reusable-pr-title.yaml` | Re-checks the PR title when it is edited, with the `@ryusenkei/prose-lint` version from `package.json` and no install |
188
191
 
192
+ - `terraform`: space-separated directories to check with `terraform fmt -check` and `validate` (no backend, so no credentials). Terraform comes from the caller's `mise.toml`.
189
193
  - Language jobs (Go, Rust) stay in the calling workflow as extra jobs.
190
194
  - PR title edits run in their own workflow. In the same workflow, the later `edited` run would overwrite the `ci` job's result with "skipped" and hide a failure.
191
195
  - `@main` follows toolkit's `main`, so fixes reach every repository at once. A breaking change gets a new file name instead of changing these.
package/dist/files.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /** CLAUDE.md で共通の規約を読み込む import */
2
2
  export declare const IMPORT = "@node_modules/@ryusenkei/conventions/rules.md";
3
- /** 差分のあるファイル(`expected` が `undefined` = 自動で修正できない → `message` に対処) */
3
+ /** 差分のあるファイル(`expected` が `null` = 削除、`undefined` = 自動で修正できない → `message` に対処) */
4
4
  export type Drift = {
5
5
  path: string;
6
- expected?: string;
6
+ expected?: string | null;
7
7
  message: string;
8
8
  };
9
9
  /** マスタとの差分 */
package/dist/files.js CHANGED
@@ -2,7 +2,8 @@
2
2
  // - マスタ: パッケージの `files/`(npm は `.gitignore` を同梱しない → 先頭の `.` を除いた名前で格納)
3
3
  // - 比較は改行コードを LF に正規化(Windows の作業ツリーは CRLF になりうる)
4
4
  // - `append`: 条件のファイルがあるリポのみ、記載の順に末尾に追加(例: go.mod のないリポで gomod の更新はエラー)
5
- import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
5
+ // - `optOut`: `package.json` の `"ryusenkei"` のキーが `false` のリポでは配らず、残っていれば削除
6
+ import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
6
7
  import { dirname, join } from 'node:path';
7
8
  import { hasStop, managedSettings } from "./settings.js";
8
9
  const FILES = [
@@ -18,6 +19,8 @@ const FILES = [
18
19
  { from: 'dependabot-gomod.yaml', if: 'go.mod' },
19
20
  { from: 'dependabot-cargo.yaml', if: 'Cargo.toml' },
20
21
  ],
22
+ // 非公開のリポで GitHub Actions の消費を抑える → 依存は手元でまとめて更新
23
+ optOut: 'dependabot',
21
24
  },
22
25
  { from: 'commit-msg', to: '.githooks/commit-msg', mode: 0o755 },
23
26
  { from: 'pre-push', to: '.githooks/pre-push', mode: 0o755 },
@@ -35,14 +38,16 @@ const LANG_RULES = [
35
38
  { file: 'rules-rust.md', if: (root) => existsSync(join(root, 'Cargo.toml')) },
36
39
  { file: 'rules-ui.md', if: (root) => uiOptIn(root) },
37
40
  ];
38
- function uiOptIn(root) {
41
+ /** ルートの `package.json` の `"ryusenkei"` の設定(読めない → 空) */
42
+ function config(root) {
39
43
  try {
40
- return JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).ryusenkei?.ui === true;
44
+ return JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).ryusenkei ?? {};
41
45
  }
42
46
  catch {
43
- return false;
47
+ return {};
44
48
  }
45
49
  }
50
+ const uiOptIn = (root) => config(root).ui === true;
46
51
  // `.github/dependabot.yaml` の `cooldown` と同値
47
52
  const RELEASE_AGE = [
48
53
  '# 公開から2日未満のバージョンは解決しない(`.github/dependabot.yaml` の `cooldown` と同値)',
@@ -56,7 +61,13 @@ const master = (name) => lf(readFileSync(new URL(`../files/${name}`, import.meta
56
61
  /** マスタとの差分 */
57
62
  export function drifts(root, options = {}) {
58
63
  const out = [];
64
+ const settingsOf = config(root);
59
65
  for (const f of FILES) {
66
+ if (f.optOut && settingsOf[f.optOut] === false) {
67
+ if (existsSync(join(root, f.to)))
68
+ out.push({ path: f.to, expected: null, message: `\`"${f.optOut}": false\` のため削除` });
69
+ continue;
70
+ }
60
71
  const appended = (f.append ?? []).filter((a) => existsSync(join(root, a.if))).map((a) => master(a.from));
61
72
  const expected = master(f.from) + appended.join('');
62
73
  if (read(join(root, f.to)) !== expected)
@@ -74,6 +85,14 @@ export function drifts(root, options = {}) {
74
85
  else
75
86
  out.push({ path: WORKSPACE, expected: `${workspace.trimEnd()}\n\n${RELEASE_AGE.join('\n')}\n`, message: '`minimumReleaseAge` が未設定' });
76
87
  }
88
+ // pre-push の関門は `pnpm check`(`check` がないと何も検査されずに push される)
89
+ let scripts = {};
90
+ try {
91
+ scripts = JSON.parse(read(join(root, 'package.json')) ?? '{}').scripts ?? {};
92
+ }
93
+ catch { }
94
+ if (typeof scripts.check !== 'string')
95
+ out.push({ path: 'package.json', message: '`check` の script を追加(pre-push で動かす検査。型検査、テスト、lint など)' });
77
96
  const claude = read(join(root, 'CLAUDE.md')) ?? '';
78
97
  const lines = claude.split('\n');
79
98
  const at = lines.findIndex((l) => l.trim() === IMPORT);
@@ -93,6 +112,10 @@ export function sync(root, options = {}) {
93
112
  continue;
94
113
  }
95
114
  const path = join(root, d.path);
115
+ if (d.expected === null) {
116
+ rmSync(path);
117
+ continue;
118
+ }
96
119
  mkdirSync(dirname(path), { recursive: true });
97
120
  writeFileSync(path, d.expected);
98
121
  const mode = FILES.find((f) => f.to === d.path)?.mode;
package/dist/hook.js CHANGED
@@ -70,15 +70,28 @@ function prBase(pr, cwd) {
70
70
  const r = spawnSync('gh', ['pr', 'view', ...(pr ? [pr] : []), '--json', 'baseRefName', '--jq', '.baseRefName'], { cwd: cwd ?? root, encoding: 'utf8' });
71
71
  return (r.status === 0 && r.stdout.trim()) || undefined;
72
72
  }
73
+ // GitHub で無効にしたワークフローはチェックを出さない → 有効なものだけを数える
73
74
  // 読めなければ「ある」とみなす(チェックなしのマージを許可しない側に倒す)
74
75
  function hasPrWorkflow(cwd) {
75
76
  const dir = join(repoRoot(cwd) ?? root, '.github', 'workflows');
77
+ let files;
76
78
  try {
77
- return readdirSync(dir).some((f) => /\.ya?ml$/.test(f) && /^\s*pull_request(_target)?\s*:|^on:.*\bpull_request/m.test(readFileSync(join(dir, f), 'utf8')));
79
+ files = readdirSync(dir).filter((f) => /\.ya?ml$/.test(f) && /^\s*pull_request(_target)?\s*:|^on:.*\bpull_request/m.test(readFileSync(join(dir, f), 'utf8')));
78
80
  }
79
81
  catch (e) {
80
82
  return e.code !== 'ENOENT';
81
83
  }
84
+ if (files.length === 0)
85
+ return false;
86
+ const r = spawnSync('gh', ['workflow', 'list', '--all', '--json', 'path,state'], { cwd: cwd ?? root, encoding: 'utf8' });
87
+ try {
88
+ const states = new Map(JSON.parse(r.stdout).map((w) => [w.path, w.state]));
89
+ // GitHub にまだないファイル(未 push)は有効とみなす
90
+ return files.some((f) => (states.get(`.github/workflows/${f}`) ?? 'active') === 'active');
91
+ }
92
+ catch {
93
+ return true;
94
+ }
82
95
  }
83
96
  // `gh pr checks` は実行中・失敗で終了コードが0以外(8・1)→ 終了コードではなく出力で判定
84
97
  function prChecks(pr, cwd) {
package/dist/policy.d.ts CHANGED
@@ -24,7 +24,7 @@ export type Context = {
24
24
  prHead: (pr: string | undefined, cwd: string | undefined) => string | undefined;
25
25
  /** PR の base のブランチ(`pr` の省略時は現在のブランチの PR) */
26
26
  prBase: (pr: string | undefined, cwd: string | undefined) => string | undefined;
27
- /** PR で動くワークフロー(`pull_request`)がリポにあるか */
27
+ /** PR で動くワークフロー(`pull_request`)のうち、GitHub で有効なものがリポにあるか */
28
28
  hasPrWorkflow: (cwd: string | undefined) => boolean;
29
29
  /** PR のチェックの集計(`pr` の省略時は現在のブランチの PR) */
30
30
  prChecks: (pr: string | undefined, cwd: string | undefined) => Checks;
package/dist/policy.js CHANGED
@@ -234,24 +234,19 @@ function prReasons(sub, args, st, ctx) {
234
234
  return reasons;
235
235
  }
236
236
  // `--auto` も対象(必須のチェックがないリポでは即時にマージされる)
237
+ // - マージは常に squash(org のリポの設定が squash だけを許可。epic のフローの dev/* から main へも同じ)
237
238
  // - epic のフローの dev/* への PR: チェックなしを許可(CI を実行せず pre-push の `pnpm check` が関門)
238
- // - epic のフローの dev/* から main への PR: merge commit
239
- // squash すると sub-issue ごとのコミットが1つにまとまり、dev と main の履歴もずれる
240
239
  function mergeReasons(args, st, ctx) {
241
240
  const { cwd } = st;
242
241
  if (args.some((a) => a === '--rebase' || a === '-r'))
243
- return ['rebase でのマージは禁止(`--squash`、dev のブランチから main へは `--merge`)'];
242
+ return ['rebase でのマージは禁止(`--squash`)'];
243
+ if (args.some((a) => a === '--merge' || a === '-m'))
244
+ return ['マージは squash(`--squash`)。epic のフローの dev のブランチから main へも同じ'];
244
245
  const pr = positionals(args, MERGE_VALUE)[0];
245
- const merge = args.some((a) => a === '--merge' || a === '-m');
246
- const devToMain = epicFlow(st, ctx) && DEV_BRANCH.test(ctx.prHead(pr, cwd) ?? '') && PROTECTED.includes(ctx.prBase(pr, cwd) ?? '');
247
- if (devToMain && !merge)
248
- return ['dev のブランチから main へのマージは merge commit(`--merge`)。sub-issue ごとのコミットを残すため'];
249
- if (!devToMain && merge)
250
- return ['マージは squash(`--squash`)。merge commit は epic のフローで dev のブランチから main への PR だけ'];
251
246
  const checks = ctx.prChecks(pr, cwd);
252
247
  if (checks === 'pass')
253
248
  return [];
254
- // PR で動くワークフローがないリポ: CI の代わりに pre-push の `pnpm check` が関門
249
+ // PR で動く有効なワークフローがないリポ: CI の代わりに pre-push の `pnpm check` が関門
255
250
  if (checks === 'none' && !ctx.hasPrWorkflow(cwd))
256
251
  return [];
257
252
  if (checks === 'none' && epicFlow(st, ctx)) {
package/files/pre-push CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
2
  # push の前の検査(`check` のスクリプトを持つリポのみ。CI の失敗・Actions の消費を手元で防止)
3
+ # git がフックに渡す GIT_DIR などを外す(検査の中の git が push 元のリポを書き換えるのを防止)
4
+ unset $(git rev-parse --local-env-vars)
3
5
  # hostslot があれば資源の空きを待って実行(並行するエージェント・リポの重い検査によるメモリの枯渇を防止)
4
6
  # `check` のないリポは枠を待たない
5
7
  if grep -q '"check":' package.json 2>/dev/null && command -v hostslot >/dev/null 2>&1; then
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: stacked-pr
3
- description: 前の PR のブランチから作った PR(スタックした PR)を、前の PR のマージの後に整理する手順。親の PR を squash でマージした後、子の PR のベースの付け替え、rebase、親のブランチの削除をするときに使う
3
+ description: 前の PR のブランチから作った PR(スタックした PR)を、前の PR のマージの後に整理する手順。親の PR を squash でマージした後、子の PR のベースの付け替え、rebase、親のブランチの削除をするときに使う。epic のフローで dev のブランチを main へ squash でマージした後、epic を続けるときにも使う
4
4
  ---
5
5
 
6
6
  # スタックした PR の整理
@@ -56,3 +56,38 @@ description: 前の PR のブランチから作った PR(スタックした PR
56
56
 
57
57
  - 子の PR の差分に、子の変更だけが出ている(`gh pr diff <子の番号>`)
58
58
  - 子の PR の CI が通っている(`gh pr checks <子の番号> --watch`)
59
+
60
+ ## epic の dev のブランチを main へマージした後
61
+
62
+ epic のフローでは、デプロイのときに dev のブランチ(例: `dev/12-search`)を `main` へ squash でマージする。dev のブランチのコミットは `main` 上の1つのコミットになり、dev のブランチの履歴は `main` に残らない。epic がこれで終わるなら、追加の作業はない。デプロイの後も epic を続ける場合は、dev のブランチを親、開いている sub-issue の PR を子として、次を行う
63
+
64
+ 1. マージの前に、dev のブランチの先端のコミットを控える。手順4で `rebase --onto` の基準に使う
65
+
66
+ ```sh
67
+ git fetch origin
68
+ git rev-parse origin/dev/12-search
69
+ ```
70
+
71
+ 2. dev のブランチの PR を squash でマージする。リポの設定(マージの後にブランチを削除)で dev のブランチは消え、そこに向いていた sub-issue の PR のベースは GitHub が `main` に付け替える
72
+
73
+ ```sh
74
+ gh pr merge <dev の PR の番号> --squash
75
+ ```
76
+
77
+ 3. dev のブランチを最新の `main` から作り直して push する
78
+
79
+ ```sh
80
+ git fetch origin
81
+ git switch -C dev/12-search origin/main
82
+ git push -u origin dev/12-search
83
+ ```
84
+
85
+ 4. 開いている sub-issue の PR ごとに、ベースを dev のブランチに戻し、手順1のコミットより後のコミットだけを載せ直して push する。push していない手元の sub-issue のブランチも、同じ rebase で載せ直す
86
+
87
+ ```sh
88
+ gh pr edit <子の番号> --base dev/12-search
89
+ git rebase --onto origin/dev/12-search <手順1のコミット> feat/b
90
+ git push --force-with-lease origin feat/b
91
+ ```
92
+
93
+ 確認は上の「確認」と同じ。子の PR の差分に、すでに `main` に入った変更が出ていないことを見る
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryusenkei/conventions",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "RYUSENKEI のモノリポの共通の規約(Claude Code の規約・hook、共通ファイルの同期)",
5
5
  "license": "MIT",
6
6
  "author": "RYUSENKEI",
package/rules.md CHANGED
@@ -4,7 +4,9 @@
4
4
  - リポ内で共有するコードは `packages/*` に置く。リポをまたぐものは toolkit(npm の `@ryusenkei/*`)に置き、変更も toolkit で行う
5
5
  - エントリポイントでは外部で使うものだけを公開し、他パッケージのものを公開し直さない
6
6
  - テストは対象の近くに置く。言語ごとの置き方は `rules-ts.md`・`rules-go.md`・`rules-rust.md`
7
+ - テストで git を動かすときは、`GIT_DIR` などの git の環境変数を外す。フックから動くと、呼び出し元のリポを書き換える
7
8
  - 依存の更新は Dependabot の PR で行う。月1回で自動の rebase はしないので、マージの前に手で rebase する
9
+ - `package.json` に `"ryusenkei": { "dependabot": false }` を設定したリポでは、手元で `pnpm update` してまとめて更新する
8
10
 
9
11
  ## 設定と秘密値
10
12
 
@@ -54,15 +56,15 @@
54
56
  ## Git と PR
55
57
 
56
58
  - add は変更・追加したファイルをパスで指定する。一括の add はフックで止まる
57
- - push の前に `pnpm check` を通す。`check` を持つリポでは pre-push で強制される
59
+ - push の前に `pnpm check` を通す。pre-push で強制される(`check` の script はどのリポにも置く)
58
60
  - PR の本文は背景、変更、検証の順に書く
59
61
  - 前の PR のブランチから PR を重ねた場合は、親のマージの後にスキル `stacked-pr` の手順で整理する
60
62
  - マージは squash で、CI の全チェックの成功を確かめてから行う(フックで強制)
61
63
  - epic のフロー(有効にしたリポだけ)
62
64
  - epic ごとに `dev/<issue の番号>-<内容>` を作り、sub-issue の PR は dev のブランチに向ける
63
65
  - dev のブランチへのマージに CI は使わず、pre-push の `pnpm check` を関門にする。チェックがある場合は成功が必要
64
- - `main` へのマージは、デプロイのときに dev のブランチからだけ行う。方法は merge commit(`gh pr merge --merge`)で、sub-issue ごとのコミットを残し、dev と main の履歴をずらさない
65
- - リポの設定で merge commit を許可する(Settings → General → Allow merge commits)
66
+ - `main` へのマージは、デプロイのときに dev のブランチからだけ行う。方法はほかの PR と同じ squash で、sub-issue ごとのコミットは sub-issue の PR に残る
67
+ - デプロイの後も epic を続ける場合は、スキル `stacked-pr` の手順で dev のブランチを `main` から作り直し、開いている sub-issue の PR を載せ直す
66
68
 
67
69
  ## CI(GitHub Actions)
68
70