@wipcomputer/wip-ai-devops-toolbox 1.9.20

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.
Files changed (146) hide show
  1. package/.license-guard.json +7 -0
  2. package/.publish-skill.json +4 -0
  3. package/CHANGELOG.md +1120 -0
  4. package/CLA.md +19 -0
  5. package/DEV-GUIDE-GENERAL-PUBLIC.md +882 -0
  6. package/LICENSE +52 -0
  7. package/README.md +238 -0
  8. package/SKILL.md +728 -0
  9. package/TECHNICAL.md +282 -0
  10. package/UNIVERSAL-INTERFACE.md +180 -0
  11. package/_trash/RELEASE-NOTES-v1-8-0.md +29 -0
  12. package/_trash/RELEASE-NOTES-v1-8-1.md +7 -0
  13. package/_trash/RELEASE-NOTES-v1-8-2.md +7 -0
  14. package/_trash/RELEASE-NOTES-v1-9-0.md +37 -0
  15. package/_trash/RELEASE-NOTES-v1-9-1.md +38 -0
  16. package/_trash/RELEASE-NOTES-v1-9-10.md +40 -0
  17. package/_trash/RELEASE-NOTES-v1-9-2.md +40 -0
  18. package/_trash/RELEASE-NOTES-v1-9-6.md +72 -0
  19. package/_trash/RELEASE-NOTES-v1-9-7.md +23 -0
  20. package/_trash/RELEASE-NOTES-v1-9-9.md +75 -0
  21. package/_trash/guide 2/DEV-GUIDE.md +487 -0
  22. package/_trash/guide 2/scripts/deploy-public.sh +152 -0
  23. package/package.json +27 -0
  24. package/scripts/SKILL-deploy-public.md +61 -0
  25. package/scripts/SKILL-post-merge-rename.md +47 -0
  26. package/scripts/deploy-public.sh +264 -0
  27. package/scripts/post-merge-rename.sh +205 -0
  28. package/scripts/publish-skill.sh +134 -0
  29. package/tools/deploy-public/LICENSE +52 -0
  30. package/tools/deploy-public/README.md +31 -0
  31. package/tools/deploy-public/SKILL.md +71 -0
  32. package/tools/deploy-public/deploy-public.sh +264 -0
  33. package/tools/deploy-public/package.json +9 -0
  34. package/tools/ldm-jobs/LICENSE +52 -0
  35. package/tools/ldm-jobs/README.md +46 -0
  36. package/tools/ldm-jobs/backup.sh +16 -0
  37. package/tools/ldm-jobs/branch-protect.sh +39 -0
  38. package/tools/ldm-jobs/crystal-capture.sh +19 -0
  39. package/tools/ldm-jobs/setup-shell.sh +27 -0
  40. package/tools/ldm-jobs/visibility-audit.sh +27 -0
  41. package/tools/post-merge-rename/LICENSE +52 -0
  42. package/tools/post-merge-rename/README.md +29 -0
  43. package/tools/post-merge-rename/SKILL.md +57 -0
  44. package/tools/post-merge-rename/package.json +9 -0
  45. package/tools/post-merge-rename/post-merge-rename.sh +122 -0
  46. package/tools/wip-branch-guard/INSTALL.md +41 -0
  47. package/tools/wip-branch-guard/guard.mjs +259 -0
  48. package/tools/wip-branch-guard/package.json +11 -0
  49. package/tools/wip-file-guard/CHANGELOG.md +6 -0
  50. package/tools/wip-file-guard/LICENSE +52 -0
  51. package/tools/wip-file-guard/README.md +113 -0
  52. package/tools/wip-file-guard/REFERENCE.md +86 -0
  53. package/tools/wip-file-guard/SKILL.md +105 -0
  54. package/tools/wip-file-guard/guard.mjs +128 -0
  55. package/tools/wip-file-guard/openclaw.plugin.json +8 -0
  56. package/tools/wip-file-guard/package.json +27 -0
  57. package/tools/wip-file-guard/test.sh +119 -0
  58. package/tools/wip-license-guard/LICENSE +52 -0
  59. package/tools/wip-license-guard/README.md +32 -0
  60. package/tools/wip-license-guard/SKILL.md +65 -0
  61. package/tools/wip-license-guard/cli.mjs +464 -0
  62. package/tools/wip-license-guard/core.mjs +310 -0
  63. package/tools/wip-license-guard/hook.mjs +146 -0
  64. package/tools/wip-license-guard/package.json +15 -0
  65. package/tools/wip-license-hook/CHANGELOG.md +17 -0
  66. package/tools/wip-license-hook/LICENSE +52 -0
  67. package/tools/wip-license-hook/README.md +200 -0
  68. package/tools/wip-license-hook/SKILL.md +111 -0
  69. package/tools/wip-license-hook/dist/cli/index.d.ts +15 -0
  70. package/tools/wip-license-hook/dist/cli/index.js +170 -0
  71. package/tools/wip-license-hook/dist/cli/index.js.map +1 -0
  72. package/tools/wip-license-hook/dist/core/detector.d.ts +12 -0
  73. package/tools/wip-license-hook/dist/core/detector.js +104 -0
  74. package/tools/wip-license-hook/dist/core/detector.js.map +1 -0
  75. package/tools/wip-license-hook/dist/core/index.d.ts +4 -0
  76. package/tools/wip-license-hook/dist/core/index.js +5 -0
  77. package/tools/wip-license-hook/dist/core/index.js.map +1 -0
  78. package/tools/wip-license-hook/dist/core/ledger.d.ts +49 -0
  79. package/tools/wip-license-hook/dist/core/ledger.js +72 -0
  80. package/tools/wip-license-hook/dist/core/ledger.js.map +1 -0
  81. package/tools/wip-license-hook/dist/core/reporter.d.ts +14 -0
  82. package/tools/wip-license-hook/dist/core/reporter.js +227 -0
  83. package/tools/wip-license-hook/dist/core/reporter.js.map +1 -0
  84. package/tools/wip-license-hook/dist/core/scanner.d.ts +39 -0
  85. package/tools/wip-license-hook/dist/core/scanner.js +325 -0
  86. package/tools/wip-license-hook/dist/core/scanner.js.map +1 -0
  87. package/tools/wip-license-hook/hooks/pre-pull.sh +55 -0
  88. package/tools/wip-license-hook/hooks/pre-push.sh +51 -0
  89. package/tools/wip-license-hook/mcp-server.mjs +119 -0
  90. package/tools/wip-license-hook/package-lock.json +54 -0
  91. package/tools/wip-license-hook/package.json +43 -0
  92. package/tools/wip-license-hook/src/cli/index.ts +189 -0
  93. package/tools/wip-license-hook/src/core/detector.ts +130 -0
  94. package/tools/wip-license-hook/src/core/index.ts +4 -0
  95. package/tools/wip-license-hook/src/core/ledger.ts +116 -0
  96. package/tools/wip-license-hook/src/core/reporter.ts +255 -0
  97. package/tools/wip-license-hook/src/core/scanner.ts +367 -0
  98. package/tools/wip-license-hook/tsconfig.json +16 -0
  99. package/tools/wip-readme-format/README.md +49 -0
  100. package/tools/wip-readme-format/SKILL.md +84 -0
  101. package/tools/wip-readme-format/format.mjs +570 -0
  102. package/tools/wip-readme-format/package.json +15 -0
  103. package/tools/wip-release/CHANGELOG.md +42 -0
  104. package/tools/wip-release/LICENSE +52 -0
  105. package/tools/wip-release/README.md +45 -0
  106. package/tools/wip-release/REFERENCE.md +100 -0
  107. package/tools/wip-release/SKILL.md +139 -0
  108. package/tools/wip-release/cli.js +161 -0
  109. package/tools/wip-release/core.mjs +1174 -0
  110. package/tools/wip-release/mcp-server.mjs +109 -0
  111. package/tools/wip-release/package.json +36 -0
  112. package/tools/wip-repo-init/README.md +38 -0
  113. package/tools/wip-repo-init/SKILL.md +77 -0
  114. package/tools/wip-repo-init/init.mjs +142 -0
  115. package/tools/wip-repo-init/package.json +11 -0
  116. package/tools/wip-repo-permissions-hook/LICENSE +52 -0
  117. package/tools/wip-repo-permissions-hook/README.md +86 -0
  118. package/tools/wip-repo-permissions-hook/SKILL.md +73 -0
  119. package/tools/wip-repo-permissions-hook/cli.js +83 -0
  120. package/tools/wip-repo-permissions-hook/core.mjs +122 -0
  121. package/tools/wip-repo-permissions-hook/guard.mjs +64 -0
  122. package/tools/wip-repo-permissions-hook/mcp-server.mjs +92 -0
  123. package/tools/wip-repo-permissions-hook/openclaw.plugin.json +8 -0
  124. package/tools/wip-repo-permissions-hook/package.json +31 -0
  125. package/tools/wip-repos/LICENSE +52 -0
  126. package/tools/wip-repos/README.md +77 -0
  127. package/tools/wip-repos/SKILL.md +80 -0
  128. package/tools/wip-repos/cli.mjs +176 -0
  129. package/tools/wip-repos/core.mjs +290 -0
  130. package/tools/wip-repos/mcp-server.mjs +157 -0
  131. package/tools/wip-repos/package.json +34 -0
  132. package/tools/wip-universal-installer/CHANGELOG.md +57 -0
  133. package/tools/wip-universal-installer/LICENSE +52 -0
  134. package/tools/wip-universal-installer/README.md +81 -0
  135. package/tools/wip-universal-installer/REFERENCE.md +122 -0
  136. package/tools/wip-universal-installer/SKILL.md +87 -0
  137. package/tools/wip-universal-installer/SPEC.md +180 -0
  138. package/tools/wip-universal-installer/detect.mjs +130 -0
  139. package/tools/wip-universal-installer/examples/minimal/README.md +20 -0
  140. package/tools/wip-universal-installer/examples/minimal/SKILL.md +28 -0
  141. package/tools/wip-universal-installer/examples/minimal/cli.mjs +4 -0
  142. package/tools/wip-universal-installer/examples/minimal/core.mjs +8 -0
  143. package/tools/wip-universal-installer/examples/minimal/mcp-server.mjs +27 -0
  144. package/tools/wip-universal-installer/examples/minimal/package.json +12 -0
  145. package/tools/wip-universal-installer/install.js +930 -0
  146. package/tools/wip-universal-installer/package.json +36 -0
@@ -0,0 +1,882 @@
1
+ # Dev Guide ... Best Practices for AI-Assisted Development
2
+
3
+ **WIP team members: also read [the private Dev Guide](ai/DEV-GUIDE-FOR-WIP-ONLY-PRIVATE.md).** It covers WIP-specific conventions (branch prefixes, agent IDs, deploy paths, incidents) that supplement everything below. Neither guide is complete without the other.
4
+
5
+ ## Repo Structure Convention
6
+
7
+ Every project follows this split:
8
+
9
+ ### Public Repo
10
+ Clean. Code only.
11
+ - `README.md` ... what it is, how to use it
12
+ - `LICENSE` ... MIT (verified, always)
13
+ - `SKILL.md` ... agent skill definition (if applicable)
14
+ - `src/` or `core/` ... source code
15
+ - `cli/` ... CLI wrapper
16
+ - `package.json` / `pyproject.toml` ... package config
17
+ - `CHANGELOG.md` ... release notes
18
+
19
+ **No dev noise.** No todos, no conversations, no internal notes.
20
+
21
+ ### Plans and Dev Notes (per-repo `ai/` folder)
22
+
23
+ Plans, todos, dev updates, and conversations live in the repo's own `ai/` folder. See the `ai/` folder section under Git Conventions for the full structure.
24
+
25
+ ### Architecture (4-piece pattern)
26
+
27
+ Every tool follows the dual-interface architecture:
28
+ 1. **core.ts** ... pure logic, zero framework deps
29
+ 2. **cli.ts** ... thin wrapper (argv -> core -> stdout)
30
+ 3. **mcp-server.ts** ... MCP wrapper for agents
31
+ 4. *(optional)* **plugin wrapper** ... platform-specific integration
32
+
33
+ CLI is the universal fallback. MCP and plugin wrappers are optimizations.
34
+
35
+ ## Release Process
36
+
37
+ ### Branch, PR, Merge, Publish
38
+
39
+ ```
40
+ 1. Create feature branch: git checkout -b <prefix>/<feature>
41
+ 2. Make changes, commit
42
+ 3. Write release notes: RELEASE-NOTES-v{next-version}.md (see below)
43
+ 4. Push branch: git push -u origin <prefix>/<feature>
44
+ 5. Create PR: gh pr create --title "..." --body "..."
45
+ 6. Merge PR: gh pr merge <number> --merge --delete-branch
46
+ 7. Rename merged branch: (see Post-Merge Branch Rename below)
47
+ 8. Pull merged main: git checkout main && git pull origin main
48
+ 9. Release: wip-release patch
49
+ # wip-release auto-detects the RELEASE-NOTES file
50
+ # flags: --dry-run (preview), --no-publish (bump + tag only)
51
+ ```
52
+
53
+ **Important:**
54
+ - **Every change goes through a PR.** No direct pushes to main. Not even "just a README fix." Branch, PR, merge. Every time.
55
+ - **Never squash merge.** Every commit has co-authors and tells the story of how something was built. Squashing destroys attribution and history. Always use `--merge` or fast-forward. This applies to `gh pr merge`, manual merges, deploy-public.sh, and any other merge path. No exceptions. Always include `--delete-branch` so the PR branch is cleaned up automatically.
56
+ - **Never delete branches.** Branches are history. They tell the story of what was built and when. After merging, rename them (see below). Never `git branch -D` or `git push --delete` without renaming first.
57
+ - **Never use `--no-publish` before deploying to public.** `deploy-public.sh` pulls release notes from the private repo's GitHub release. If you skip the release with `--no-publish`, the public repo gets empty notes. Run the full pipeline first.
58
+ - After merging, switch back to your dev branch. Don't sit on main.
59
+
60
+ ### Release Notes on the Branch
61
+
62
+ **Every PR must include a `RELEASE-NOTES-v{next-version}.md` file.** This is how release notes get reviewed before publishing. Same pattern as code review: the notes are on the branch, visible in the PR, reviewed alongside the changes.
63
+
64
+ **How it works:**
65
+
66
+ 1. Figure out the next version. Current is v0.7.2, this is a patch, so next is v0.7.3.
67
+ 2. Create `RELEASE-NOTES-v0-7-3.md` in the repo root. **Dashes, not dots** in the filename.
68
+ 3. Write the summary: what changed, why it matters, what it fixes. Narrative, not a changelog.
69
+ 4. Commit it with the rest of your changes. It ships with the branch.
70
+ 5. The PR now shows code changes AND release notes. Both get reviewed.
71
+ 6. After merge, `wip-release patch` auto-detects the file and uses it as the release summary.
72
+ 7. After release, `wip-release` moves the file to `ai/_trash/` automatically.
73
+
74
+ **The file is the summary paragraph.** `wip-release` builds the full structured release (Changes, Fixes, Docs, Files changed, Install, Attribution, Changelog) from git history. Your file provides the human-written context at the top.
75
+
76
+ **Three-source priority** (first match wins):
77
+ 1. `--notes-file=path` ... explicit file path via CLI flag
78
+ 2. `RELEASE-NOTES-v{ver}.md` ... auto-detected from repo root (this is the standard)
79
+ 3. `ai/dev-updates/` ... today's dev update files (fallback only)
80
+
81
+ **If no release notes file exists,** `wip-release` falls back to `--notes="..."` or dev updates. But the standard is: write the file, commit it, review it in the PR. Don't skip this.
82
+
83
+ ### Post-Merge Branch Rename
84
+
85
+ **Never delete branches after merging.** Instead, rename them with `--merged-YYYY-MM-DD` appended. This preserves history and makes it instantly clear which branches are done and when they were merged.
86
+
87
+ **Format:**
88
+ ```
89
+ <original-branch-name>--merged-YYYY-MM-DD
90
+ ```
91
+
92
+ **Examples:**
93
+ ```
94
+ dev/fix-search -> dev/fix-search--merged-2026-03-08
95
+ agent-a/weekly-tuning -> agent-a/weekly-tuning--merged-2026-03-08
96
+ team-b/add-relay -> team-b/add-relay--merged-2026-03-08
97
+ ```
98
+
99
+ **After merging a PR:**
100
+ ```bash
101
+ # 1. Rename locally
102
+ git branch -m <prefix>/<feature> <prefix>/<feature>--merged-$(date +%Y-%m-%d)
103
+
104
+ # 2. Push renamed branch to remote
105
+ git push origin <prefix>/<feature>--merged-$(date +%Y-%m-%d)
106
+
107
+ # 3. Remove old remote branch name
108
+ git push origin --delete <prefix>/<feature>
109
+
110
+ # 4. Scan for any other merged branches that missed renaming
111
+ git branch --merged main | grep -v main | grep -v "\-\-merged\-" | while read branch; do
112
+ echo "WARNING: $branch is merged but not renamed"
113
+ done
114
+ ```
115
+
116
+ **The scan step is mandatory.** Every time you merge, check for stale branches that missed renaming. If you find any, rename them with the date they were merged (check `git log main` for the merge date, not today's date).
117
+
118
+ **Automation:** `wip-release` runs this scan automatically as step 10 of the release pipeline. It finds all local branches merged into main that haven't been renamed yet, renames them with the correct merge date, and pushes to remote. You don't have to do anything extra on release.
119
+
120
+ For repos where you merge but don't release immediately, use the standalone script:
121
+ ```bash
122
+ bash scripts/post-merge-rename.sh # scan + rename all
123
+ bash scripts/post-merge-rename.sh --dry-run # preview only
124
+ bash scripts/post-merge-rename.sh <branch> # rename specific branch
125
+ ```
126
+ - Use scoped npm tokens for publishing, not personal credentials.
127
+
128
+ ### Release Quality Standards
129
+
130
+ **Every release must have exhaustive, categorized notes.** People use our software. Sloppy notes are embarrassing. Look at [OpenClaw releases](https://github.com/openclaw/openclaw/releases) as the benchmark.
131
+
132
+ `wip-release` generates structured notes automatically:
133
+
134
+ 1. **Changes** ... new features, refactors, additions. One bullet per commit with hash.
135
+ 2. **Fixes** ... bug fixes, hotfixes. One bullet per commit with hash.
136
+ 3. **Docs** ... README, TECHNICAL, RELAY, any documentation changes.
137
+ 4. **Files changed** ... diffstat (excludes `ai/` folder).
138
+ 5. **Install** ... npm install command + git pull.
139
+ 6. **Attribution** ... Built-by line.
140
+ 7. **Full changelog** ... GitHub compare URL.
141
+
142
+ The `--notes` flag provides the summary paragraph at the top. The tool builds everything else from git history.
143
+
144
+ **For major releases (minor/major bumps):** the auto-generated notes are a starting point. Always review and expand them. Add context, describe architectural changes, explain why things changed. A commit subject like "Add cc-poller.ts" should become a paragraph explaining what the poller does, why it replaces the old hook, and what problem it solves.
145
+
146
+ **For patch releases:** auto-generated notes are usually sufficient. Review before publishing.
147
+
148
+ **Never publish a release with just a one-liner.** If two days of work went into it, the release notes should reflect that.
149
+
150
+ #### Release Checklist
151
+
152
+ Every release must also have:
153
+
154
+ 1. **All contributors represented.** Every team member (human and AI) must have authored at least one commit in the repo. GitHub tracks contributors by commit author, not co-author trailers. If a contributor is missing, make a real commit with `--author`.
155
+ 2. **Release on both repos.** The private repo gets the release from wip-release. The public repo gets a matching release from deploy-public.sh. Both must show the release in their GitHub Releases tab.
156
+ 3. **npm package published.** Available via `npm install <package-name>@<version>`. Verify after publishing.
157
+ 4. **CHANGELOG.md updated.** wip-release handles this, but verify it's accurate and complete.
158
+
159
+ **After every release, verify all of these.** Check the public repo's GitHub page. Does it show the release? Does it show all three contributors? Are the release notes complete? Is the npm package available? If any of these are missing, fix it before moving on.
160
+
161
+ ### Release Order (Critical)
162
+
163
+ The release flow must happen in this exact order:
164
+
165
+ 1. **Merge PR to main** on the private repo
166
+ 2. **`wip-release`** on the private repo (bumps version, creates tag, creates GitHub release with full notes, publishes npm)
167
+ 3. **`deploy-public`** to sync to the public repo (pulls release notes from private repo's GitHub release)
168
+
169
+ If you skip step 2 or do it manually (e.g. `git tag` + `git push` without creating a GitHub release), `deploy-public` will create the public release with empty notes. The script pulls notes from the private repo's GitHub release. No release on private = no notes on public.
170
+
171
+ ### Merge, Deploy, Install ... Three Separate Steps
172
+
173
+ These are three distinct actions. Never combine them.
174
+
175
+ | Step | What it means | What happens |
176
+ |------|--------------|-------------|
177
+ | **Merge** | Development done | PR merged to private repo's main. Code lands. Nothing else changes. |
178
+ | **Deploy** | Ship to public | `wip-release` + `deploy-public.sh`. Package published. Available to the world. **Not on your machine yet.** |
179
+ | **Install** | Put it on your system | Run the install prompt (`crystal init`, `ldm install`, etc.). Only when the user says "install." |
180
+
181
+ After Deploy, stop. Do not copy files to extension directories. Do not run `npm install -g`. Do not run `npm link`. The user tests the install flow by running the install prompt. That's how you dogfood.
182
+
183
+ **If you must release manually** (no root package.json, toolbox repos, etc.):
184
+ 1. Update CHANGELOG.md and SKILL.md version
185
+ 2. Commit, PR, merge
186
+ 3. `git tag vX.Y.Z && git push origin vX.Y.Z`
187
+ 4. `gh release create vX.Y.Z --title "vX.Y.Z" --notes "..."` on the PRIVATE repo first
188
+ 5. THEN run `deploy-public`
189
+
190
+ The GitHub release on the private repo must exist before deploy-public runs. This is not optional.
191
+
192
+ ### Universal Installer Checklist
193
+
194
+ Every tool must be verified with the Universal Installer before release. This is not optional.
195
+
196
+ **Before every release:**
197
+ ```bash
198
+ wip-install /path/to/tool --dry-run
199
+ ```
200
+
201
+ This shows which interfaces are detected and which are missing.
202
+
203
+ **Minimum for agent-callable tools:**
204
+ - Module (`main` or `exports` in package.json)
205
+ - Skill (SKILL.md with YAML frontmatter)
206
+ - MCP Server (`mcp-server.mjs` wrapping the core module)
207
+
208
+ **Full interface coverage (the goal):**
209
+ - CLI (`bin` in package.json)
210
+ - Module (`main`/`exports`)
211
+ - MCP Server (`mcp-server.mjs`)
212
+ - OpenClaw Plugin (`openclaw.plugin.json`, only for tools with lifecycle hooks)
213
+ - Skill (`SKILL.md`)
214
+ - Claude Code Hook (`guard.mjs` or `claudeCode.hook`, only for tools that guard operations)
215
+
216
+ **For toolbox repos** (repos with multiple tools in `tools/` subfolders): apply this checklist to each sub-tool, not just the root. Every sub-tool gets its own package.json, SKILL.md, and interface files.
217
+
218
+ **Dogfood rule:** After releasing, run `wip-install` on the toolbox itself to reinstall. Eat your own cooking.
219
+
220
+ ### Pre-Publish Checklist
221
+
222
+ Before any repo goes public:
223
+
224
+ 1. [ ] Code complete (all punchlist items done)
225
+ 2. [ ] Code review (architecture, edge cases, quality)
226
+ 3. [ ] Human review (spec, UX, direction)
227
+ 4. [ ] LICENSE file present (MIT, verified)
228
+ 5. [ ] README covers usage, installation, examples
229
+ 6. [ ] CHANGELOG started
230
+ 7. [ ] npm package published (scoped)
231
+ 8. [ ] GitHub release created with tag
232
+ 9. [ ] License compliance ledger initialized for all dependencies
233
+
234
+ ## Cloudflare Workers Deploy
235
+
236
+ Some repos deploy to Cloudflare Workers via `wrangler deploy`. Same rules as git: **never deploy uncommitted code.**
237
+
238
+ ### The Rule
239
+
240
+ **Commit first. Deploy second. Always.** The source that produced the deployed worker must exist in git before it goes to Cloudflare. If something breaks, we need to know exactly what's running.
241
+
242
+ ### Deploy Workflow
243
+
244
+ ```
245
+ 1. Write code on feature branch
246
+ 2. Build: npm run build:demo (or whatever the build script is)
247
+ 3. Test locally: npm run dev:demo (wrangler dev)
248
+ 4. Commit source: git add src/worker-*.ts wrangler-*.toml && git commit
249
+ 5. Push + PR + merge: normal PR flow
250
+ 6. Deploy: npm run deploy:demo (wrangler deploy)
251
+ ```
252
+
253
+ **Steps 4-5 happen BEFORE step 6.** Not after. Not "I'll commit later." The deploy command should never run on uncommitted code.
254
+
255
+ ### Deploy Guard
256
+
257
+ Every repo with a `wrangler*.toml` should use guarded deploy scripts in package.json:
258
+
259
+ ```json
260
+ "deploy:demo": "bash -c 'git diff --quiet HEAD -- src/ wrangler-demo.toml || (echo \"ERROR: uncommitted changes. commit before deploying.\" && exit 1)' && wrangler deploy --config wrangler-demo.toml"
261
+ ```
262
+
263
+ This checks that all source files are committed before `wrangler deploy` runs. If anything is dirty, it refuses.
264
+
265
+ ### What Gets Tracked
266
+
267
+ The deployed worker is the compiled output of committed source. The chain is:
268
+
269
+ ```
270
+ source (git) -> build (tsup) -> dist/*.js -> wrangler deploy -> Cloudflare edge
271
+ ```
272
+
273
+ We track the source. The build is reproducible from source. The deploy is reproducible from the build. If we have the git commit, we can reconstruct exactly what's running.
274
+
275
+ ## License Compliance
276
+
277
+ Use `wip-license-hook` for license rug-pull detection:
278
+ - Pre-pull hook: blocks upstream merges if license changed
279
+ - Pre-push hook: alerts if upstream has drifted
280
+ - LICENSE snapshots archived at adoption
281
+ - Daily cron scan of all dependencies
282
+ - Dashboard published for public verification
283
+
284
+ **Rule: never merge upstream if license changed. Hard stop.**
285
+
286
+ ## Git Conventions
287
+
288
+ ### Never Work on Main
289
+
290
+ **Main is for merged, released code only.** Never make changes directly on main. Every repo should have a dev branch checked out as the working branch at all times.
291
+
292
+ When you clone a repo or finish a PR, immediately create or switch to a dev branch:
293
+
294
+ ```bash
295
+ git checkout -b <prefix>/dev # new repo, first time
296
+ git checkout <prefix>/<feature> # existing feature work
297
+ ```
298
+
299
+ If you find yourself on main with uncommitted changes, stash, branch, and apply:
300
+
301
+ ```bash
302
+ git stash
303
+ git checkout -b <prefix>/fix-name
304
+ git stash pop
305
+ ```
306
+
307
+ ### Branch Prefixes
308
+
309
+ Branch names use the **harness name** (agent + machine) as the prefix. Every harness is a distinct entity. Claude Code on the Mini is not the same as Claude Code on the Air.
310
+
311
+ ```
312
+ <harness>/<feature>
313
+ ```
314
+
315
+ Examples: `dev/fix-search`, `agent-a/add-relay`, `team-b/weekly-tuning`
316
+
317
+ ### Multi-Agent Clone Workflow
318
+
319
+ **Every harness gets their own clone of every repo.** This prevents checkout collisions when multiple agents work on the same repo at the same time.
320
+
321
+ ```
322
+ staff/
323
+ Agent-A/
324
+ repos/
325
+ my-project-private/ <- agent-a works here, agent-a/ branches
326
+ Agent-B/
327
+ repos/
328
+ my-project-private/ <- agent-b works here, agent-b/ branches
329
+ Human/
330
+ repos/
331
+ my-project-private/ <- human works here, dev/ branches
332
+ ```
333
+
334
+ **Rules:**
335
+ - Never work in another agent's folder. If Agent-A originated a repo, Agent-B still clones it to their own folder.
336
+ - Each harness uses their own branch prefix.
337
+ - PRs merge to `main` on GitHub. That's the shared integration point.
338
+ - If something needs to change in another agent's working tree, open a PR or ask them.
339
+
340
+ **When a new repo is created:**
341
+ 1. Whoever creates it pushes to GitHub
342
+ 2. Every other agent clones it to their own repos folder
343
+ 3. Each agent creates their dev branch with their prefix
344
+
345
+ This is how we avoid the "two agents have different branches checked out in the same folder" problem. It doesn't work. Separate folders, separate clones, shared remote.
346
+
347
+ ### Commit Messages
348
+
349
+ - Imperative mood, concise (`add: license scanner`, `fix: offline detection`)
350
+ - Co-author trailers for all contributors on every commit
351
+ - PRs for cross-agent edits: don't edit another agent's working tree directly
352
+ - Never push directly to main. Always branch, PR, merge. No exceptions.
353
+
354
+ ### File Naming Convention
355
+
356
+ All files authored by an agent use this format:
357
+
358
+ ```
359
+ YYYY-MM-DD--HH-MM-SS--{agent}--{description}.md
360
+ ```
361
+
362
+ Single dashes within date and time. Double dashes between segments. 24-hour clock.
363
+
364
+ This applies to dev updates, plans, todos, notes, session exports, daily logs ... everything with an author and a timestamp.
365
+
366
+ ### Daily Logs
367
+
368
+ Each entry is its own file, not appended to a shared file.
369
+
370
+ ```
371
+ agents/{agent-id}/memory/daily/
372
+ 2026-02-27--17-45-30--agent-a--feature-deploy.md
373
+ 2026-02-27--19-12-00--agent-a--config-migration.md
374
+ ```
375
+
376
+ One file per entry. Full timestamp. Agent ID in the name. Nothing gets overwritten or collided.
377
+
378
+ ### The `ai/` Folder (per-repo standard)
379
+
380
+ Every repo gets an `ai/` folder. It holds all the thinking between humans and agents ... plans, dev updates, todos, conversations, notes. Scoped to the repo it belongs to.
381
+
382
+ ```
383
+ ai/
384
+ plan/ ... architecture plans, roadmaps, convention notes
385
+ dev-updates/ ... what was built, session logs
386
+ todos/
387
+ Human-todo.md ... human lead's action items
388
+ Agent-A-todo.md ... Agent A's action items
389
+ Agent-B-todo.md ... Agent B's action items
390
+ notes/ ... research, raw conversation logs, references
391
+ ```
392
+
393
+ ### Todo Files
394
+
395
+ One file per person/agent. Named `{Name}-todo.md`. Lives in `ai/todos/`.
396
+
397
+ **Three sections, always in this order:**
398
+
399
+ ```markdown
400
+ # {Name} ... {Project} To-Do
401
+
402
+ **Updated:** YYYY-MM-DD
403
+
404
+ ---
405
+
406
+ ## To Do
407
+ - [ ] Thing that needs doing
408
+ - [ ] Another thing
409
+
410
+ ---
411
+
412
+ ## Done
413
+ - [x] Thing that was completed ... YYYY-MM-DD
414
+
415
+ ---
416
+
417
+ ## Deprecated
418
+ - ~~Thing that's no longer needed~~ ... reason. (YYYY-MM-DD)
419
+ ```
420
+
421
+ **Rules:**
422
+ - **Never delete anything.** Items move between sections, never off the page.
423
+ - **To Do** ... work that needs to happen.
424
+ - **Done** ... work that was completed. Check the box, add the date.
425
+ - **Deprecated** ... work that was planned but is no longer needed (code changed, approach changed, requirement dropped). Strikethrough the text, add the reason and date. This is NOT the same as Done. Deprecated means "we decided not to do this."
426
+ - **Update the date** at the top of the file every time you edit it.
427
+ - Each person/agent has exactly one file. Don't create per-date or per-feature todo files.
428
+
429
+ **Example todo files:**
430
+
431
+ | File | Who |
432
+ |------|-----|
433
+ | `Human-todo.md` | Human lead (setup, deploy, review) |
434
+ | `Agent-A-todo.md` | Agent A (code, docs, builds) |
435
+ | `Agent-B-todo.md` | Agent B (testing, integration) |
436
+
437
+ Add more as agents or team members are added.
438
+
439
+ ### GitHub Issues
440
+
441
+ **Use GitHub Issues for actionable bugs, feature requests, and tasks.** The `ai/todos/` files are for rough planning and brainstorming. Once something becomes a concrete action item, it goes on GitHub.
442
+
443
+ **Why both?** Todos are quick, local, and low-friction. Issues are trackable, cross-referenceable, and visible to all agents and humans. Todos are where you think. Issues are where you commit to doing.
444
+
445
+ #### Filing Convention
446
+
447
+ Every issue filed by an agent must include:
448
+
449
+ 1. **Attribution line** at the top of the body:
450
+ ```
451
+ > Filed by: <agent-name> (<agent-id>) on <YYYY-MM-DD>
452
+ ```
453
+
454
+ 2. **`filed-by` label** identifying the author:
455
+ ```
456
+ filed-by:<agent-id>
457
+ ```
458
+ This makes issues filterable by who created them. Create these labels per-agent on every repo in the org.
459
+
460
+ 3. **Clear problem/solution structure.** State what's wrong, then what should change.
461
+
462
+ #### When to use issues vs todos
463
+
464
+ | Use | When |
465
+ |-----|------|
466
+ | GitHub Issue | Bug, feature request, task with a clear definition of done |
467
+ | `ai/todos/` | Brainstorming, rough planning, "we should think about..." |
468
+ | Both | Start in todos, promote to issue when it's concrete |
469
+
470
+ #### Public vs Private Issues
471
+
472
+ For repos following the public/private pattern:
473
+
474
+ - **Public repo issues** are for users. Someone installs your tool, finds a bug, files an issue on the public repo. Triage and respond there.
475
+ - **Private repo issues** are for the team. Internal work, architecture decisions, agent coordination.
476
+
477
+ **When a public issue needs internal work:**
478
+ 1. Respond on the public issue ("Looking into this")
479
+ 2. Open a private issue with the full context, link back (`Public: org/repo#42`)
480
+ 3. Fix in private, release, deploy to public
481
+ 4. Close the public issue with the version (`Fixed in v0.5.0`)
482
+
483
+ **When you find a bug internally:**
484
+ 1. File on the private repo
485
+ 2. Fix, release, deploy
486
+ 3. No public issue needed unless it's worth announcing
487
+
488
+ The release is what connects public and private. No issue syncing, no mirroring. Public issues are the front door. Private issues are the workshop.
489
+
490
+ #### Agent ID Convention
491
+
492
+ Agents are identified by a structured ID that encodes platform, name, and machine:
493
+
494
+ ```
495
+ [platform]-[agent]-[machine]
496
+ ```
497
+
498
+ Examples: `oc-lesa-mini` (OpenClaw, Lesa, on mini), `cc-mini` (Claude Code, on mini), `cc-air` (Claude Code, on air).
499
+
500
+ This ID is used in:
501
+ - GitHub issue labels (`filed-by:*`)
502
+ - Memory systems (agent_id field)
503
+ - LDM agent config (`~/.ldm/agents/<id>/config.json`)
504
+ - Git branch prefixes
505
+
506
+ ## Branch Protection
507
+
508
+ All repos should have branch protection on `main` with `enforce_admins=true`. This means:
509
+ - No direct pushes to main (even for admins)
510
+ - All changes go through PRs
511
+
512
+ **To add protection:**
513
+ ```bash
514
+ gh api "repos/<org>/<repo>/branches/main/protection" -X PUT \
515
+ -F "required_pull_request_reviews[required_approving_review_count]=0" \
516
+ -F "enforce_admins=true" \
517
+ -F "restrictions=null" \
518
+ -F "required_status_checks=null"
519
+ ```
520
+
521
+ ## Worktree Workflow
522
+
523
+ **Every session starts in a worktree. No one works directly in the main working tree.**
524
+
525
+ The main working tree stays on `main` and is read-only in practice. All development happens in git worktrees. This keeps the primary clone clean, prevents accidental commits to main, and enables parallel work within a single agent.
526
+
527
+ ### Starting a Worktree
528
+
529
+ From Claude Code:
530
+ ```bash
531
+ claude --worktree <name>
532
+ ```
533
+
534
+ Or mid-session, say "work in a worktree" and the session will move into one.
535
+
536
+ Worktrees live at `.claude/worktrees/` inside the repo. Each worktree gets its own directory with a full checkout on a separate branch.
537
+
538
+ ### Branch Naming
539
+
540
+ Worktree branches follow the same prefix convention as regular branches:
541
+
542
+ ```
543
+ <harness>/<feature>
544
+ ```
545
+
546
+ Examples: `cc-mini/fix-search`, `lesa-mini/add-relay`, `cc-air/weekly-tuning`
547
+
548
+ The worktree name and the branch name don't have to match, but the branch must use your harness prefix.
549
+
550
+ ### Subagents and Parallel Work
551
+
552
+ Subagents use `isolation: "worktree"` for parallel tasks. Each subagent gets its own worktree, its own branch, and can commit independently without interfering with the parent session or other subagents.
553
+
554
+ This is the safe way to do parallel work within a single agent. Repos-per-agent solves cross-agent isolation. Worktrees solve within-agent parallelism.
555
+
556
+ ### Commit Before Session Ends
557
+
558
+ **Always commit and push before a session ends.** Worktree cleanup deletes the entire worktree directory, including any uncommitted work. If it's not committed and pushed, it's gone.
559
+
560
+ ```bash
561
+ git add <files>
562
+ git commit -m "description"
563
+ git push -u origin <prefix>/<feature>
564
+ ```
565
+
566
+ ### Release from the Main Working Tree
567
+
568
+ **`wip-release` must run from the main working tree, not a worktree.** The release pipeline expects to be on `main` in the primary clone. After merging your PR, switch to the main working tree to run the release:
569
+
570
+ ```bash
571
+ cd /path/to/repo # the main working tree, not .claude/worktrees/...
572
+ git checkout main && git pull
573
+ wip-release patch --notes="description"
574
+ ```
575
+
576
+ ### Gitignore
577
+
578
+ **`.claude/worktrees/` must be in `.gitignore`.** Worktrees are local, ephemeral, and per-machine. They should never be committed.
579
+
580
+ ```
581
+ # .gitignore
582
+ .claude/worktrees/
583
+ ```
584
+
585
+ Add this to every repo that uses worktrees.
586
+
587
+ ## Review Flow
588
+
589
+ ```
590
+ Agent builds -> pushes to dev branch
591
+ -> Code review (another agent or human)
592
+ -> Human reviews (direction, spec)
593
+ -> merge to main
594
+ -> publish (npm, GitHub, skill registry)
595
+ ```
596
+
597
+ ## PR Checklist (Private Repos)
598
+
599
+ Every PR to a private repo must include product doc updates. This is not optional. Do it before merging, not after.
600
+
601
+ ### Required on every PR:
602
+
603
+ 1. **Dev update.** Write a dev update in `ai/dev-updates/` documenting what changed, key decisions, and what's next. Format: `YYYY-MM-DD--HH-MM--agent--description.md`.
604
+
605
+ 2. **Roadmap update.** Review `ai/product/plans-prds/roadmap.md`:
606
+ - Move completed items from **Upcoming** to **Done** (with `[x]` checkboxes)
607
+ - Add new items to **Upcoming** if the work revealed them
608
+ - Move abandoned items to **Deprecated** (never delete)
609
+
610
+ 3. **readme-first update.** Review `ai/product/readme-first.md`:
611
+ - Update **What's Built** and **What's Missing** sections
612
+ - Update any stats, counts, or version references
613
+ - Update the **Databases** or architecture sections if they changed
614
+
615
+ 4. **Plan archival.** If a plan in `plans-prds/current/` is complete, move it to `plans-prds/archive-complete/`.
616
+
617
+ ### Why this matters:
618
+
619
+ Product docs drift fast. If roadmap updates only happen "when someone remembers," the roadmap becomes fiction. Tying updates to PRs means the docs stay current by default, not by heroics.
620
+
621
+ ### Release notes:
622
+
623
+ Release notes are the public face of the project. They must be comprehensive. One-liners like "Release v0.6.0" are unacceptable. Every feature, every change, documented section by section. This applies to both private and public GitHub releases.
624
+
625
+ ## Repo Directory Structure
626
+
627
+ ### The Standard Layout
628
+
629
+ All repos are organized into this directory structure. Every agent on every machine must follow this layout. The folders are organizational categories, not monorepos. Each repo inside is its own independent git repo.
630
+
631
+ ```
632
+ repos/
633
+ ├── <project>/ ← NOT a repo. Organizes project repos by category.
634
+ │ ├── apis/ ← API integrations
635
+ │ ├── apps/ ← user-facing apps
636
+ │ ├── components/ ← core components
637
+ │ ├── operations/ ← dev tools, release pipeline
638
+ │ └── utilities/ ← support tools
639
+ ├── <company>/ ← Repo. Company docs (always private).
640
+ ├── third-party-repos/ ← NOT a repo. Forks and external repos.
641
+ ├── _sort/ ← NOT a repo. Repos not yet categorized.
642
+ ├── _sunsetted/ ← NOT a repo. Deprecated repos.
643
+ └── _trash/ ← NOT a repo. Deleted repos.
644
+ ```
645
+
646
+ ### Staging Folder Conventions
647
+
648
+ - **`_to-privatize/`** ... repos staged for privatization
649
+ - **`_sort/`** ... repos that need to be categorized or figured out
650
+ - **`_trash/`** ... deleted items (never truly delete, move here)
651
+ - **Underscore prefix** (`_`) keeps staging folders sorted to the top, visually separated from real repos
652
+
653
+ These conventions apply at every level: top-level `repos/`, inside project categories, and nested within staging folders.
654
+
655
+ ### Creating a New Repo
656
+
657
+ **Always create repos as `-private` from day one.** Do not create a repo and privatize it later. Start with the right name and structure.
658
+
659
+ ```bash
660
+ # 1. Pick the category
661
+ # apis, apps, components, operations, utilities
662
+
663
+ # 2. Create on GitHub as private with -private suffix
664
+ gh repo create <org>/<name>-private --private
665
+
666
+ # 3. Clone into the correct category folder
667
+ cd repos/<project>/<category>/
668
+ git clone git@github.com:<org>/<name>-private.git
669
+
670
+ # 4. Create the ai/ folder structure
671
+ cd <name>-private
672
+ mkdir -p ai/product/plans-prds/{upcoming,current,archive-complete}
673
+ mkdir -p ai/product/plans-prds/todos
674
+ mkdir -p ai/product/product-ideas
675
+ mkdir -p ai/product/notes/research
676
+ mkdir -p ai/dev-updates
677
+
678
+ # 5. Create your dev branch
679
+ git checkout -b <prefix>/dev
680
+ ```
681
+
682
+ **Never create a repo without picking its category first.** If you don't know where it goes, put it in `_sort/` and figure it out before starting work.
683
+
684
+ ### The Manifest
685
+
686
+ `repos/repos-manifest.json` is the source of truth for where every repo lives. It maps local paths to GitHub remotes. When a repo is created, moved, or renamed, update the manifest.
687
+
688
+ Every agent can use the manifest to sync their local directory structure. The goal: every agent on every machine has the same layout.
689
+
690
+ ### Privatize Before You Work
691
+
692
+ **Do not start any work on a non-privatized repo.** If a repo is in `_to-privatize` and you need to work on it, run it through the privatization process first:
693
+
694
+ 1. Rename the GitHub repo to `<name>-private`
695
+ 2. Update the local remote URL (`git remote set-url origin ...`)
696
+ 3. Rename the local folder to match
697
+ 4. Then start your work
698
+
699
+ Working on a non-privatized repo means your `ai/` content (plans, todos, dev updates) gets committed to a repo that could accidentally go public. No exceptions.
700
+
701
+ ---
702
+
703
+ ## Public/Private Repo Pattern
704
+
705
+ ### The Rule
706
+
707
+ **Never make a repo public unless it has a `-private` counterpart with all `ai/` content separated out.** If a repo doesn't have a `-private` counterpart yet, it stays private until one is created. No exceptions. Violating this exposes internal plans, todos, and development context.
708
+
709
+ **The private repo is the working repo. The public repo is everything except `ai/`.**
710
+
711
+ **You only need the private repo locally.** Clone `<name>-private`, work in it, release from it, deploy to public from it. Never clone the public repo for development. The public repo is a deployment target, not a working tree. The deploy script handles syncing.
712
+
713
+ Every repo has an `ai/` folder where agents and humans collaborate ... plans, todos, dev updates, notes, conversations. This is the development process. It doesn't ship publicly.
714
+
715
+ The private repo tracks everything, including `ai/`. The public repo is the same codebase without `ai/`. Two repos, same code, clean boundary.
716
+
717
+ ```
718
+ <name>-private/ <- working repo (clone this one, work here)
719
+ src/, README.md, LICENSE, package.json, SKILL.md ...
720
+ ai/ <- plans, todos, notes, dev updates
721
+ plan/
722
+ todos/
723
+ dev-updates/
724
+ notes/
725
+
726
+ <name>/ <- public repo (deploy target only, never clone for dev)
727
+ src/, README.md, LICENSE, package.json, SKILL.md ...
728
+ (no ai/ folder)
729
+ ```
730
+
731
+ ### Why
732
+
733
+ The `ai/` folder contains personal notes, half-formed ideas, internal debates, agent inboxes. Useful for the team. Irrelevant to users. Can be taken out of context. Should not be public.
734
+
735
+ The public repo has everything an LLM or human needs to understand and use the project: README, code, docs, SKILL.md, LICENSE. The `ai/` folder is operational context, not conceptual context.
736
+
737
+ ### Workflow
738
+
739
+ 1. All work happens in the private repo
740
+ 2. Merge PR to main on the private repo
741
+ 3. Run `wip-release` on the private repo (version bump, changelog, npm publish, GitHub release)
742
+ 4. Deploy to public repo (everything except `ai/`)
743
+
744
+ **The order matters.** Release first, then deploy. The public repo should always reflect a released version with correct version numbers, changelog, and SKILL.md.
745
+
746
+ ```bash
747
+ # Step 1-2: normal PR flow on private repo
748
+ cd /path/to/private-repo
749
+ git checkout main && git pull origin main
750
+
751
+ # Step 3: release (MUST create GitHub release for deploy-public.sh to pull notes)
752
+ wip-release patch --notes="description of changes"
753
+
754
+ # Step 4: deploy to public (code sync + release)
755
+ bash deploy-public.sh /path/to/private-repo <org>/<public-repo>
756
+ ```
757
+
758
+ **Never use `--no-publish` before deploying to public.** The `deploy-public.sh` script pulls release notes from the private repo's GitHub release. If the GitHub release doesn't exist (because `--no-publish` skipped it), the public release gets empty notes. Always run the full `wip-release` pipeline before `deploy-public.sh`.
759
+
760
+ The deploy script:
761
+ 1. Clones the public repo
762
+ 2. Rsyncs everything except `ai/` and `.git/`
763
+ 3. Creates a branch, commits, opens a PR, merges it
764
+ 4. Creates a matching GitHub release on the public repo (pulls notes from the private repo's release)
765
+
766
+ **After deploy, the public repo should show:**
767
+ - Updated code (matching private minus `ai/`)
768
+ - A GitHub release with the version tag and release notes
769
+ - npm package available via `npm install <package-name>`
770
+
771
+ **What goes where:**
772
+
773
+ | Artifact | Where it lives |
774
+ |----------|---------------|
775
+ | npm package | Public npm registry (anyone can install) |
776
+ | GitHub release (private) | `<name>-private` repo (internal reference) |
777
+ | GitHub release (public) | `<name>` repo (what users see) |
778
+ | GitHub Packages | Not used (npm registry is the source of truth) |
779
+
780
+ ### Config-specific splits
781
+
782
+ Some repos also have deployment config that shouldn't be public (real paths, contacts, secrets references). Same pattern applies ... the private repo has `config.json`, the public repo has `config.example.json`.
783
+
784
+ **Key rule:** never put real paths, contacts, personal notes, or deployment values in the public repo.
785
+
786
+ ## Scheduled Automation (.app Pattern)
787
+
788
+ macOS restricts cron and shell scripts from accessing protected files (Full Disk Access). The workaround: wrap automation in a native `.app` bundle and grant FDA to the app.
789
+
790
+ ### How it works
791
+
792
+ A minimal macOS `.app` bundle that:
793
+ 1. Contains a compiled Mach-O binary (so macOS recognizes it as a real app)
794
+ 2. The binary calls a shell script that dispatches to individual job scripts
795
+ 3. Jobs live in `YourApp.app/Contents/Resources/jobs/*.sh`
796
+ 4. Adding a new job = dropping a new `.sh` file in that folder
797
+
798
+ ### Structure
799
+
800
+ ```
801
+ ~/Applications/YourDevTools.app/
802
+ Contents/
803
+ Info.plist ... app metadata (bundle ID, version)
804
+ MacOS/
805
+ your-dev-tools ... compiled binary (Mach-O, calls dispatcher)
806
+ your-dev-tools-run ... shell dispatcher (routes to jobs)
807
+ Resources/
808
+ jobs/
809
+ backup.sh ... daily backup of databases + state
810
+ branch-protect.sh ... audit + enforce branch protection across org
811
+ visibility-audit.sh ... audit public repos for missing -private counterparts
812
+ ```
813
+
814
+ ### Setup
815
+
816
+ 1. Build the app (or copy from dev-tools repo)
817
+ 2. Drag the `.app` into **System Settings > Privacy & Security > Full Disk Access**
818
+ 3. Schedule via cron:
819
+
820
+ ```bash
821
+ 0 0 * * * open -W ~/Applications/YourDevTools.app --args backup >> /tmp/dev-tools/cron.log 2>&1
822
+ 0 1 * * * open -W ~/Applications/YourDevTools.app --args branch-protect >> /tmp/dev-tools/cron.log 2>&1
823
+ ```
824
+
825
+ ### Why not LaunchAgents?
826
+
827
+ LaunchAgents have been unreliable across macOS updates. FDA grants to `/bin/bash` and `cron` don't persist. The `.app` bundle is the one thing macOS consistently respects for FDA permissions.
828
+
829
+ ### Adding a new job
830
+
831
+ Create a file in `Contents/Resources/jobs/`:
832
+
833
+ ```bash
834
+ # ~/Applications/YourDevTools.app/Contents/Resources/jobs/my-job.sh
835
+ #!/bin/bash
836
+ echo "=== My job: $(date) ==="
837
+ # ... your automation here
838
+ echo "=== Done ==="
839
+ ```
840
+
841
+ Then: `open -W ~/Applications/YourDevTools.app --args my-job`
842
+
843
+ ### Logs
844
+
845
+ All job output goes to `/tmp/dev-tools/`:
846
+ - `dev-tools.log` ... dispatcher log (which jobs ran, exit codes)
847
+ - `<job-name>.log` ... individual job output
848
+ - `<job-name>-last-exit` ... last exit code (for monitoring)
849
+ - `<job-name>-last-run` ... last run timestamp
850
+
851
+ ## The _trash Convention
852
+
853
+ **Never delete files. Move them to `_trash/`.** Every directory that might have discarded files should have a `_trash/` subfolder.
854
+
855
+ ### Why:
856
+
857
+ - Space is cheap. Recovery from `_trash/` is instant. Recovery from git history requires knowing the commit, the path, and the exact filename.
858
+ - Files in `_trash/` are visible. You can browse them, grep them, copy them back. Deleted files are invisible unless you know they existed.
859
+ - It prevents the "wait, who deleted that?" conversation.
860
+
861
+ ### Where it applies:
862
+
863
+ - **Repos:** `ai/product/plans-prds/_trash/`, `ai/product/product-ideas/_trash/`, etc.
864
+ - **Agent data:** workspace files, config backups, old extension versions
865
+ - **Extension installs:** old plugin versions before upgrade
866
+
867
+ ### How:
868
+
869
+ ```bash
870
+ # Instead of this:
871
+ rm old-file.md
872
+
873
+ # Do this:
874
+ mkdir -p _trash
875
+ mv old-file.md _trash/
876
+ ```
877
+
878
+ Use `git mv` if the file is tracked. The underscore prefix sorts `_trash/` to the top of directory listings so it stays visible but out of the way.
879
+
880
+ ### When to clean up:
881
+
882
+ Rarely. Maybe annually. If `_trash/` gets huge, archive it. But the default is: leave it. The cost of keeping files around is near zero. The cost of needing a file you deleted is real.