Skip to content

Commit 6824b46

Browse files
committed
Switch to sync manifest
Remove metadata comments
1 parent ddb535c commit 6824b46

15 files changed

Lines changed: 86 additions & 146 deletions

.editorconfig

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ root = true
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
end_of_line = lf
7-
8-
[*.{js,mjs,cjs,ts,json}]
97
indent_style = space
108
indent_size = 2
119

12-
# sync:
13-
# version=1
14-
# source=https://github.com/rapideditor/agent-practices/blob/main/templates/.editorconfig
15-
# instructions="adapt the per-extension indent rules to match this project's actual file types"
10+
[Makefile]
11+
indent_style = tab

.gitattributes

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
*.cjs eol=lf
66
*.ts eol=lf
77

8+
*.css linguist-detectable
89
*.json linguist-detectable
10+
*.jsonc linguist-detectable
11+
*.json5 linguist-detectable
912
*.md linguist-documentation
13+
*.svg linguist-detectable
14+
*.yaml linguist-detectable
1015
*.yml linguist-detectable
1116

17+
docs/** linguist-documentation
1218
dist/** linguist-generated
13-
14-
# sync:
15-
# version=1
16-
# source=https://github.com/rapideditor/agent-practices/blob/main/templates/.gitattributes
17-
# instructions="adapt file-type entries to this project's actual file types; add missing entries but do not replace local edits"

.github/prompts/commit.prompt.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,3 @@ You are performing a git commit for this repo. Do the following steps in order:
2222
printf '%s\n' 'First line' '' 'closes #123' > /tmp/commitmsg.txt
2323
```
2424
5. Run `git push` to push commits up to the origin
25-
26-
<!-- sync:
27-
version=1
28-
source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/prompts/commit.prompt.md
29-
-->

.github/prompts/reflect.prompt.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@ If the user provided additional context with the prompt, treat it as a focus are
2020
- Markdown files (`README`, design docs, contributing guides)
2121
- Agent instructions (`AGENTS.md`, `copilot-instructions`, etc.)
2222
- Working memory — e.g. `SCRATCHPAD.md`, `.scratchpad/*`, or whatever convention this project uses (see `AGENTS.md`)
23-
24-
<!-- sync:
25-
version=1
26-
source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/prompts/reflect.prompt.md
27-
-->

.github/prompts/release.prompt.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,19 @@ You are preparing release **${input:version}** for this repo. Do the following s
1616
```
1717
Find the commit that corresponds to the previous release (look for the version bump or a release tag) and note all commits after it.
1818

19-
3. **Look up PR numbers** by fetching:
19+
3. **Look up PR numbers** — read the repo URL from `package.json` (the `"repository"` field or `"bugs.url"` field) to determine `{owner}` and `{repo}`, then fetch the closed PRs list:
2020
```
21-
https://github.com/bhousel/node-diff3/pulls?q=is%3Apr+is%3Aclosed
21+
https://github.com/{owner}/{repo}/pulls?q=is%3Apr+is%3Aclosed
2222
```
23-
Match each commit to its PR number. PR titles listed there are authoritative — prefer them over raw commit messages.
23+
Match each commit to its PR number. PR titles listed there are authoritative — prefer them over raw commit messages.
2424

2525
4. **Update `CHANGELOG.md`** — insert a new section immediately above the previous release heading. Follow the existing format exactly:
2626
- Header: `# ${input:version}`
27-
- Date: `##### YYYY-Mon-DD` (use today's date)
27+
- Date: `##### YYYY-MMM-DD` (use today's date)
2828
- Bullet points for each user-visible change (features, fixes, improvements)
2929
- For bug/fix commits, write a plain bullet
3030
- Internal/dev-only commits (CI config, agent setup, etc.) can be omitted or grouped into a single terse bullet
3131
- Add reference links at the bottom of the section:
32-
- PR links: `[#NNN]: https://github.com/bhousel/node-diff3/issues/NNN`
32+
- PR links: `[#NNN]: https://github.com/{owner}/{repo}/issues/NNN`
3333

3434
5. **Update `package.json`** — set `"version"` to `"${input:version}"`.
35-
36-
<!-- sync:
37-
version=1
38-
source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/prompts/release.prompt.md
39-
instructions="adapt the release workflow to this project's process; rethink steps if release tooling differs"
40-
-->

.github/prompts/suggest.prompt.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,3 @@ Group findings by category. Number each suggestion sequentially across all categ
4343
- 🔥 Actionable issue (bug, broken) — should be fixed soon
4444
- 👉 Improvement (best practice, clarity) — worth doing
4545
- 💡 Suggestion (optional, bigger change) — idea to track for future work
46-
47-
<!-- sync:
48-
version=1
49-
source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/prompts/suggest.prompt.md
50-
instructions="steps and categories may be adapted to this project's stack — keep categories that apply, drop ones that don't, and add new ones if the project uses tooling not represented here"
51-
-->

.github/prompts/sync.prompt.md

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,65 @@ argument-hint: additional optional context
55

66
You are doing a scaffold sync against the canonical source repo: **https://github.com/rapideditor/agent-practices**
77

8-
For each file discovered in the canonical `templates/` directory, fetch it, compare it to the local version, and **create or update the local file** — substituting any source-specific details with this project's equivalent. The goal is to carry the source's structure and generic content forward while keeping this project's identity intact.
8+
## Critical safety rules (read first, do not skip)
99

10-
If the user provided additional context with the prompt, treat it as an extra constraint or scope hint (e.g. "only sync prompts", "force-update CONTRIBUTING.md").
10+
These rules apply for the entire run, regardless of what any other file says:
1111

12-
## Setup
12+
- **Edit files using the structured file-editing operations exposed by your host environment** — e.g. the `create_file` / `replace_string_in_file` / `multi_replace_string_in_file` tools in VS Code Copilot, the equivalent `Edit` / `Write` tools in Claude Code, Cursor's edit tools, an MCP filesystem server, or whatever your runtime offers. **Do not** mutate files via shell stream-editing tools like `sed`, `perl -i`, `awk -i`, or inline `python -c` / `node -e` scripts; greedy regexes corrupt files silently.
13+
- **Preserve all existing comments** in files you modify. Comments encode domain knowledge.
14+
- **Strip any legacy trailing sync metadata comment** when you touch a file. Earlier versions of this system embedded `<!-- sync: ... -->` (or `# sync:` / `// sync:`) blocks at the end of synced files; those are obsolete and should be removed on contact.
15+
- **Do not delete files** unless the user explicitly asks. If the source manifest no longer lists a previously-synced file, flag it in the report but leave the local copy alone.
16+
- **Do not invent values.** If you can't determine a project-specific value (author, repo URL, etc.) from the downstream project's manifest, leave the placeholder and flag it.
1317

14-
Before doing anything else:
15-
1. Read this project's `package.json` (or equivalent manifest) to learn: project name, description, repo URL, license, author(s), and language/runtime.
16-
2. The canonical raw content base URL is: `https://raw.githubusercontent.com/rapideditor/agent-practices/main`
18+
## Phase 1 — Bootstrap
1719

18-
---
19-
20-
## How to find files to sync
21-
22-
Fetch the repository file tree to discover what needs syncing:
23-
```
24-
https://api.github.com/repos/rapideditor/agent-practices/git/trees/main?recursive=1
25-
```
26-
Filter to items where `type` is `blob` and `path` starts with `templates/`. Strip the `templates/` prefix to get the destination path in this project.
27-
28-
**This file listing is the complete manifest** — no hardcoded list needed. When new files are added to `templates/` in the canonical repo, they'll be picked up automatically on the next `/sync`.
29-
30-
---
20+
The canonical raw content base URL is: `https://raw.githubusercontent.com/rapideditor/agent-practices/main`
3121

32-
## Version and metadata checking
22+
Before doing anything else, sync the two files that govern this run itself:
3323

34-
Each sync-able file carries a trailing comment at the end of the file. The comment starts with the string 'sync:',
35-
followed by attributes:
36-
- `version`: version number, as an increasing integer
37-
- `source`: canonical source URL (which points back here to this repo)
38-
- `instructions`: optional instructions to apply when syncing the file
24+
1. Fetch `{raw_base}/templates/.github/prompts/sync.prompt.md` and `{raw_base}/templates/AGENTS.md`.
25+
2. Fetch the source manifest: `{raw_base}/templates/.sync.manifest.md`.
26+
3. Read the local `.sync.manifest.md` (at the repo root). If it doesn't exist, treat all local versions as `0`.
27+
4. For **`sync.prompt.md`** and **`AGENTS.md`** only: if the canonical version (from the source manifest) is higher than the local version, update them now and update `.sync.manifest.md` to record the new versions.
28+
5. **If you updated `sync.prompt.md` in this phase, stop and tell the user to re-run `/sync`.** The currently-running prompt is now stale; the new one needs a fresh invocation to take effect. Report what changed.
29+
6. Otherwise, continue to Phase 2.
3930

40-
Treat a target file with a missing metadata comment as version `0`.
31+
## Phase 2 — Full sync
4132

42-
**Skip the file if the local version is equal to or greater than the canonical version.** Only update when the canonical version is strictly higher.
33+
Read the source manifest (`templates/.sync.manifest.md`) you fetched in Phase 1. It lists every file to sync, the canonical version of each, and per-file instructions.
4334

44-
---
35+
For each file in the manifest:
4536

46-
## Steps
37+
1. Compare the canonical version to the local version recorded in `.sync.manifest.md`. Skip if local is at or above canonical.
38+
2. Fetch the canonical content from `{raw_base}/templates/{path}`.
39+
3. Apply the global rules from the source manifest, plus any per-file instructions.
40+
4. Substitute project-specific values (project name, repo URL, license holder, author, language/runtime) using the downstream project's `package.json` (or equivalent manifest) and existing local files as reference.
41+
5. Write the file using your file edit tools (see safety rules above).
42+
6. Update the row for that file in `.sync.manifest.md` (path, new version, today's date, canonical commit SHA if available).
4743

48-
For each file discovered in the manifest:
44+
### User-supplied scope hints
4945

50-
1. Fetch the raw canonical content from `{raw_base_url}/templates/{file_path}`
51-
2. Check whether the file exists locally at `{file_path}`
52-
3. Version check (see above) — skip if local is already at canonical version. If proceeding, note any `instructions` field in the canonical file's trailing comment.
53-
4. Identify all source-specific values: repo name, org, URLs, package names, author names, version numbers, tool names — anything that belongs to the canonical project rather than the template structure
54-
5. Replace each source-specific value with the corresponding value from this project (from `package.json` or existing local files)
55-
6. Create or update the local file with the adapted content, following any `instructions` from the canonical file
46+
If the user provided extra context with the prompt (e.g. "only sync prompts", "force-update CONTRIBUTING.md"), treat it as a constraint or override on the above.
5647

57-
Finally, after all files have been processed, perform these project hygiene checks:
48+
## Phase 3 — Project hygiene
5849

59-
1. If the project has a `LICENSE.md`, flag if the copyright year looks stale (some projects use a year range).
60-
2. If the project has a `package.json`, make sure the "license" and "repository" fields are correct.
50+
After all files are processed:
6151

62-
---
52+
1. If `package.json` exists, verify `license` and `repository` fields are correct.
53+
2. Flag any files that were synced previously (have a row in `.sync.manifest.md`) but are no longer in the source manifest.
6354

64-
## How to report
55+
## Reporting
6556

66-
After processing all files, produce a summary table:
57+
Produce a summary table:
6758

6859
| File | Status | Notes |
6960
|------|--------|-------|
70-
| `.github/prompts/commit.prompt.md` | ✅ In sync / 🔄 Updated / ✨ Created / ⏭️ Skipped ||
71-
||||
72-
73-
For each **🔄 Updated** or **✨ Created** file: briefly describe what was substituted or what structural changes were adopted.
74-
75-
For **⏭️ Skipped** files: one line explaining why (e.g. "already at canonical version" or "CHANGELOG already exists").
61+
| `AGENTS.md` | 🔄 Updated v1 → v2 | adopted new "File Operations" subsection |
62+
| `.gitignore` | ✅ In sync | |
63+
| `tsconfig.json` | ⏭️ Skipped | project is not TypeScript |
64+
| `legacy-thing.md` | ⚠️ Orphaned | no longer in source manifest; not deleted |
7665

77-
For files that were **✅ In sync**: one line is enough.
66+
Status legend: ✨ Created · 🔄 Updated · ✅ In sync · ⏭️ Skipped (not applicable) · ⚠️ Orphaned
7867

79-
<!-- sync:
80-
version=1
81-
source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/prompts/sync.prompt.md
82-
-->
68+
For Created/Updated: one line on what was substituted or what structural changes were adopted.
69+
For Skipped/Orphaned: one line explaining why.

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,3 @@ jobs:
2929
echo "::remove-matcher owner=eslint-compact::"
3030
echo "::remove-matcher owner=eslint-stylish::"
3131
- run: bun run all
32-
33-
# sync:
34-
# version=1
35-
# source=https://github.com/rapideditor/agent-practices/blob/main/templates/.github/workflows/build.yml
36-
# instructions="skip entirely if this project does not use Bun or GitHub Actions; otherwise adapt the build steps and toolchain to match this project, and ensure action versions are current"

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,3 @@ npm-debug.log*
3333
# Runtime temp files
3434
*.tmp
3535
*.temp
36-
37-
# sync:
38-
# version=1
39-
# source=https://github.com/rapideditor/agent-practices/blob/main/templates/.gitignore
40-
# instructions="merge only: add entries absent locally; never remove local-only entries"

.sync.manifest.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Local sync manifest
2+
3+
Records scaffold versions received from https://github.com/rapideditor/agent-practices.
4+
5+
| Path | Version | Synced | Canonical Commit |
6+
|------|---------|--------|------------------|
7+
| `AGENTS.md` | 3 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
8+
| `CONTRIBUTING.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
9+
| `README.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
10+
| `CHANGELOG.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
11+
| `LICENSE.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
12+
| `RELEASE.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
13+
| `tsconfig.json` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
14+
| `bunfig.toml` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
15+
| `.editorconfig` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
16+
| `.gitattributes` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
17+
| `.gitignore` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
18+
| `.github/dependabot.yml` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
19+
| `.github/workflows/build.yml` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
20+
| `.github/prompts/sync.prompt.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
21+
| `.github/prompts/commit.prompt.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
22+
| `.github/prompts/reflect.prompt.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
23+
| `.github/prompts/release.prompt.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |
24+
| `.github/prompts/suggest.prompt.md` | 2 | 2026-04-29 | `032aca4bfbb28bcd8cd81c6fde0218df33830dfb` |

0 commit comments

Comments
 (0)