Skip to content

Commit e9d0852

Browse files
evanharmon1claude
andauthored
docs(standardize-repo): harden the v2→v3 adopt flow (pre-commit/gitleaks/gitignore/AGENTS) (#45)
From the harmon-ops v2.3.1→v3.9.0 re-template, three traps cost real time: - Stale pre-commit hook: deleting .pre-commit-config.yaml leaves .git/hooks/pre-commit, which blocks every commit ("No .pre-commit-config.yaml file was found") -- run `pre-commit uninstall` then `task install:hooks`. - gitleaks scans full history on adoption -> surfaces pre-existing leaks that fail the pre-push hook + CI; allowlist each KNOWN finding's fingerprint in .gitleaksignore AND rotate the secret (urgent if the repo is public). - Mis-shebanged scripts (#!/bin/sh using bash features) make shfmt fail. Also: Path B --overwrite resets .gitignore -> re-merge the repo's custom ignores (minus what v3 now tracks). And strengthen the AGENTS.md fold guidance to fold the *substantive* old guidance, not just a one-line blurb (a thin fold dropped real content this session). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent deb2614 commit e9d0852

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

ai/skills/repo/standardize-repo/references/mode-adopt-existing.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,12 @@ These are the recurring drifts harmon-init exists to fix (source:
248248
ln -sf ../AGENTS.md .github/copilot-instructions.md # note: ../ from .github/
249249
```
250250

251-
Merge any unique guidance from the old real file into `AGENTS.md` *before*
252-
replacing it with a symlink. Then confirm the tool excludes are in place so
251+
**Fold the old file's *substantive* guidance** — architecture, directory
252+
structure, real commands, project-specific conventions — into `AGENTS.md`
253+
*before* replacing it with a symlink. Don't settle for a thin fold that keeps
254+
only the one-line project blurb (and a `TODO: run /init`): the old file's real
255+
content is the whole point of the merge. Then confirm the tool excludes are
256+
in place so
253257
linters don't choke on the symlinks: `lefthook.yml`'s prettier hook must
254258
`exclude` `CLAUDE.md`, `GEMINI.md`, and `.github/copilot-instructions.md`
255259
(these are explicit excludes in the template's `lefthook.yml`).
@@ -313,6 +317,25 @@ These are the recurring drifts harmon-init exists to fix (source:
313317
verify`; drop `.pre-commit-config.yaml`/`.ansible-lint` mentions). Fold the old
314318
real `CLAUDE.md` into `AGENTS.md` per step 1.
315319

320+
**Three traps that block the first commit/push after a v2→v3 render:**
321+
(a) **Stale pre-commit hook** — deleting `.pre-commit-config.yaml` leaves the
322+
installed `.git/hooks/pre-commit` behind, which blocks *every* commit with
323+
"No .pre-commit-config.yaml file was found"; run **`pre-commit uninstall`**,
324+
then `task install:hooks` (lefthook) to wire the v3 hooks. (b) **gitleaks
325+
scans full history** — adopting it surfaces pre-existing leaks (a committed
326+
key/cert/`.env`) that fail the pre-push hook *and* CI; for each KNOWN finding
327+
add its fingerprint (`gitleaks detect --report-format json``.Fingerprint`)
328+
to **`.gitleaksignore`** AND **rotate the secret** (urgent if the repo is
329+
public — the allowlist stops re-flagging, it does not un-expose the key).
330+
(c) **Mis-shebanged scripts** — a `#!/bin/sh` script that uses bash features
331+
(`&>`, `function`, arrays) makes `shfmt` parse it as POSIX and fail; fix the
332+
shebang to `#!/usr/bin/env bash`.
333+
334+
Path B's `--overwrite` also **resets `.gitignore`** to the template's —
335+
re-merge the repo's custom ignores (binary/cache patterns like `*.dll`,
336+
`.output/`) from `main`, but NOT what v3 now tracks (`*.code-workspace`,
337+
`.vscode/settings.json`, `.meta/`).
338+
316339
7. **Scope the repo's linters past reference/example content.** A repo that
317340
*houses* example or vendored content — a boilerplate library (`templates/`,
318341
`snippets/`), copy-paste Windows scripts, an agent-skill source — should not be

0 commit comments

Comments
 (0)