agent-personalizer 0.6.5 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -0
- package/CHANGELOG.md +271 -0
- package/CODE_OF_CONDUCT.md +13 -0
- package/CONTRIBUTING.md +44 -0
- package/MAINTAINERS.md +6 -0
- package/README.md +109 -116
- package/RELEASING.md +22 -0
- package/SECURITY.md +17 -0
- package/SUPPORT.md +6 -0
- package/bin/agent-personalizer.js +265 -111
- package/bin/install-plan.cjs +89 -4
- package/bin/known-hashes.json +881 -0
- package/bin/uninstall.cjs +28 -17
- package/docs/README.md +1 -1
- package/docs/guarantees.md +16 -5
- package/docs/install.md +20 -11
- package/docs/paste-guide.md +15 -6
- package/examples/answers.json +44 -0
- package/examples/freelance-illustrator/.agent-personalizer.json +1 -1
- package/examples/freelance-illustrator/AGENT_ONBOARDING.md +1 -1
- package/hooks/README.md +1 -1
- package/llms.txt +7 -2
- package/package.json +11 -2
- package/render/onboarding.cjs +47 -4
- package/render/render.cjs +14 -12
package/bin/uninstall.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
// Plan every deletion from
|
|
2
|
+
// Plan every deletion from the complete recorded ownership history before changing anything.
|
|
3
3
|
// Installed JavaScript is compared as bytes, never loaded or executed.
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
@@ -7,13 +7,9 @@ const crypto = require('crypto');
|
|
|
7
7
|
const renderer = require('../render/render.cjs');
|
|
8
8
|
const onboarding = require('../render/onboarding.cjs');
|
|
9
9
|
const TARGETS = require('../render/targets.json');
|
|
10
|
-
const { installPlan } = require('./install-plan.cjs');
|
|
10
|
+
const { installPlan, recordedHash, validateInventory } = require('./install-plan.cjs');
|
|
11
11
|
const CONFIG = '.agent-personalizer.json';
|
|
12
12
|
const sha256 = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');
|
|
13
|
-
// The recorded hash for a path, or undefined for a config written before this field existed
|
|
14
|
-
// (0.5.x and earlier) or for a path install never recorded. undefined means: fall back to
|
|
15
|
-
// recomputing the expected bytes from the currently running package, exactly as before.
|
|
16
|
-
const recordedHash = (cfg, rel) => (cfg.installed && typeof cfg.installed === 'object' && !Array.isArray(cfg.installed)) ? cfg.installed[rel] : undefined;
|
|
17
13
|
|
|
18
14
|
function refuse(message) { throw new renderer.Refusal(message); }
|
|
19
15
|
function uninstall(dir, { dry = false } = {}) {
|
|
@@ -71,17 +67,14 @@ function run(dir, dry) {
|
|
|
71
67
|
try { return new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(bytes); }
|
|
72
68
|
catch (_) { refuse(`${rel} is not valid UTF-8; nothing was removed`); }
|
|
73
69
|
}
|
|
74
|
-
function parentDirs(rel) {
|
|
75
|
-
let parent = path.posix.dirname(rel);
|
|
76
|
-
while (parent !== '.') { dirs.add(parent); parent = path.posix.dirname(parent); }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
70
|
if (!read(CONFIG)) refuse(`missing config: expected ${path.join(root, CONFIG)}`);
|
|
80
71
|
let cfg;
|
|
81
72
|
try { cfg = renderer.readConfig(root); }
|
|
82
73
|
catch (e) { if (e instanceof renderer.Refusal) refuse(`${CONFIG}: ${e.message}`); throw e; }
|
|
83
74
|
if (!Array.isArray(cfg.targets) || !cfg.targets.length || !cfg.onboarding || !Number.isInteger(cfg.level))
|
|
84
75
|
refuse(`${CONFIG} needs stored targets, level and onboarding answers for --uninstall`);
|
|
76
|
+
try { validateInventory(cfg); } catch (e) { refuse(`${CONFIG}: ${e.message}; nothing was removed`); }
|
|
77
|
+
const modern = Object.hasOwn(cfg, 'installed');
|
|
85
78
|
const answers = cfg.onboarding;
|
|
86
79
|
const level = Math.min(cfg.level, 3);
|
|
87
80
|
const base = onboarding.baseFor(answers);
|
|
@@ -96,14 +89,17 @@ function run(dir, dry) {
|
|
|
96
89
|
if (expected.has(p.rel) && !expected.get(p.rel).equals(bytes)) refuse(`${p.rel}: conflicting install paths; nothing was removed`);
|
|
97
90
|
expected.set(p.rel, bytes);
|
|
98
91
|
}
|
|
99
|
-
const tracked = new Set([CONFIG, 'USER.md', ...recipe.map(p => p.rel)]);
|
|
100
|
-
for (const key of cfg.targets) {
|
|
92
|
+
const tracked = new Set(modern ? [CONFIG, ...Object.keys(cfg.installed)] : [CONFIG, 'USER.md', ...recipe.map(p => p.rel)]);
|
|
93
|
+
if (!modern) for (const key of cfg.targets) {
|
|
101
94
|
const target = TARGETS[key];
|
|
102
95
|
tracked.add(target.file);
|
|
103
96
|
for (const rel of Object.values(target.boxFiles || {})) tracked.add(rel);
|
|
104
97
|
}
|
|
105
98
|
// Check every tracked file first, including hook/runtime copies and raw paste files.
|
|
106
|
-
for (const rel of tracked)
|
|
99
|
+
for (const rel of tracked) read(rel);
|
|
100
|
+
// A file recipe says nothing about who created its parent. This applies to legacy
|
|
101
|
+
// configs too: absent creation records mean an empty directory stays in place.
|
|
102
|
+
for (const rel of cfg.createdDirectories || []) { dirs.add(rel); probe(rel, 'dir'); }
|
|
107
103
|
// Custom local rules also influence the render. Validate and snapshot them, including
|
|
108
104
|
// README.md which the rule loader skips, so a symlink there cannot hide from preflight.
|
|
109
105
|
if (probe('rules', 'dir')) {
|
|
@@ -111,11 +107,17 @@ function run(dir, dry) {
|
|
|
111
107
|
if (name.endsWith('.md')) read(`rules/${name}`);
|
|
112
108
|
}
|
|
113
109
|
}
|
|
114
|
-
const rendered =
|
|
110
|
+
const rendered = modern
|
|
111
|
+
? cfg.targets.flatMap(key => {
|
|
112
|
+
const target = TARGETS[key];
|
|
113
|
+
return [{ key, rel: target.file }, ...Object.values(target.boxFiles || {}).map(rel => ({ key, rel, raw: true }))];
|
|
114
|
+
})
|
|
115
|
+
: renderer.renderedContents(root, cfg);
|
|
115
116
|
const plan = [];
|
|
116
117
|
const add = (rel, action, output, reason) => plan.push({ rel, action, output, reason });
|
|
117
118
|
for (const entry of rendered) {
|
|
118
119
|
const { rel, key, block, raw } = entry;
|
|
120
|
+
if (!tracked.has(rel)) continue;
|
|
119
121
|
const bytes = read(rel);
|
|
120
122
|
if (!bytes) continue;
|
|
121
123
|
const recorded = recordedHash(cfg, rel);
|
|
@@ -129,7 +131,7 @@ function run(dir, dry) {
|
|
|
129
131
|
if (ms.kind === 'malformed') refuse(`${rel}: malformed marker block; nothing was removed`);
|
|
130
132
|
// Exact block bytes matter here. --check normalizes CRLF for drift reporting, but
|
|
131
133
|
// uninstall treats even a line-ending edit inside the owned block as an edit.
|
|
132
|
-
const generated = renderer.splice(null, block, rel);
|
|
134
|
+
const generated = modern ? '' : renderer.splice(null, block, rel);
|
|
133
135
|
const expectedBlock = generated.slice(0, -1);
|
|
134
136
|
const matchesBlock = ms.kind === 'one' && existing.slice(ms.bStart, ms.eEnd) === expectedBlock;
|
|
135
137
|
if (cfg.preservedTargets && cfg.preservedTargets.includes(key)) {
|
|
@@ -162,13 +164,14 @@ function run(dir, dry) {
|
|
|
162
164
|
}
|
|
163
165
|
add(rel, candidates.some(candidate => candidate.equals(bytes)) ? 'remove' : 'keep', null, 'edited or pre-existing content');
|
|
164
166
|
}
|
|
165
|
-
const user = read('USER.md');
|
|
167
|
+
const user = tracked.has('USER.md') ? read('USER.md') : null;
|
|
166
168
|
if (user) {
|
|
167
169
|
const recordedUser = recordedHash(cfg, 'USER.md');
|
|
168
170
|
const userUnedited = recordedUser ? sha256(user) === recordedUser : [false, true].some(ns => user.equals(Buffer.from(onboarding.renderUser(answers, { notesScaffolded: ns }))));
|
|
169
171
|
add('USER.md', userUnedited ? 'remove' : 'keep', null, 'edited');
|
|
170
172
|
}
|
|
171
173
|
for (const [rel, bytes] of expected) {
|
|
174
|
+
if (!tracked.has(rel)) continue;
|
|
172
175
|
const existing = read(rel);
|
|
173
176
|
if (!existing) continue;
|
|
174
177
|
const recorded = recordedHash(cfg, rel);
|
|
@@ -179,6 +182,14 @@ function run(dir, dry) {
|
|
|
179
182
|
const unedited = recorded ? sha256(existing) === recorded : existing.equals(bytes);
|
|
180
183
|
add(rel, unedited ? 'remove' : 'keep', null, 'edited');
|
|
181
184
|
}
|
|
185
|
+
// Earlier notes folders, retired rules and all other recorded paths are inventory too.
|
|
186
|
+
// Current answers cannot erase history, and an unrecorded file is never adopted here.
|
|
187
|
+
const planned = new Set(plan.map(p => p.rel));
|
|
188
|
+
if (modern) for (const rel of Object.keys(cfg.installed)) {
|
|
189
|
+
if (planned.has(rel)) continue;
|
|
190
|
+
const bytes = read(rel);
|
|
191
|
+
if (bytes) add(rel, sha256(bytes) === recordedHash(cfg, rel) ? 'remove' : 'keep', null, 'edited');
|
|
192
|
+
}
|
|
182
193
|
if (new Set(plan.map(p => p.rel)).size !== plan.length) refuse('conflicting tracked paths; nothing was removed');
|
|
183
194
|
const retained = plan.filter(p => p.action !== 'remove');
|
|
184
195
|
const removeConfig = retained.length === 0;
|
package/docs/README.md
CHANGED
|
@@ -10,4 +10,4 @@ agent-personalizer turns an interview into a profile and the instruction files e
|
|
|
10
10
|
| [Companion tools](companions.md) | Notes connectors, access controls and approval mechanisms. |
|
|
11
11
|
| [Guarantees](guarantees.md) | Rendering, drift detection, preflight, local operation and the forbidden-string gate. |
|
|
12
12
|
|
|
13
|
-
For contributors, read [CONTRIBUTING.md](../CONTRIBUTING.md), [the rule format](../rules/README.md) and [AGENTS.md](../AGENTS.md). Agents can use [llms.txt](../llms.txt) as the entry point.
|
|
13
|
+
For contributors, read [CONTRIBUTING.md](../CONTRIBUTING.md), [the rule format](../rules/README.md) and [AGENTS.md](../AGENTS.md). [SUPPORT.md](../SUPPORT.md) routes questions, bugs, features and security reports; [MAINTAINERS.md](../MAINTAINERS.md) names the owner and release responsibilities. Agents can use [llms.txt](../llms.txt) as the entry point.
|
package/docs/guarantees.md
CHANGED
|
@@ -6,9 +6,10 @@ agent-personalizer is an installer and renderer. Its checks enforce file consist
|
|
|
6
6
|
|
|
7
7
|
Each render comes from `USER.md`, the selected rule source and the onboarding answers in `.agent-personalizer.json`. At level 3, `rules/` is your local editable source; lower levels use the package's rules.
|
|
8
8
|
|
|
9
|
-
- **One source:** edit
|
|
9
|
+
- **One profile source:** edit `USER.md`, then regenerate. Every profile-bearing target uses it, including `chatgpt-box1.txt`. Untouched generated profiles retain the compact ChatGPT export. Edited generated identity fields can still compact; custom text or structure falls back to the profile's own text, with the same budget warning.
|
|
10
|
+
- **Rule and onboarding sources:** edit the rule files or onboarding answers, then regenerate the selected AI files together. Each target receives the rules selected for its format and budget.
|
|
10
11
|
- **Byte fidelity:** the renderer preserves bytes outside generated markers, including line endings.
|
|
11
|
-
- **Drift detection:** `node render/render.cjs --dir . --check` compares the current generated blocks with what the sources would render now.
|
|
12
|
+
- **Drift detection:** `node render/render.cjs --dir . --check` compares the current generated blocks and both ChatGPT paste files with what the sources would render now. Success is silent with exit `0`; it exits `1` and names drift when they differ.
|
|
12
13
|
- **Paste updates:** re-paste regenerated files into chat-app instruction fields. The check compares files on disk.
|
|
13
14
|
- **ChatGPT budget:** each box reports its character count against the limit in `render/targets.json`. Over-budget text is preserved and flagged. `--strict` exits `1` before writing when a box exceeds that limit.
|
|
14
15
|
|
|
@@ -21,11 +22,21 @@ The installer validates answers, configuration, source files and target marker s
|
|
|
21
22
|
- **Paths:** paths beneath the installation root must be real files and directories. Symlinks and paths outside the root are refused.
|
|
22
23
|
- **Markers:** each target may have one correctly ordered generated block or be ready for its first block. Malformed blocks are refused.
|
|
23
24
|
- **Encoding:** sources and targets must contain valid UTF-8; invalid bytes are refused instead of re-encoded.
|
|
24
|
-
- **Existing work:**
|
|
25
|
-
- **
|
|
25
|
+
- **Existing work:** edited and pre-existing profiles, notes templates, rules and tools are kept and named. Untouched installer-owned files update to the current answers and package. Obsolete untouched copies are removed; edited copies stay and are named.
|
|
26
|
+
- **Recovery:** the installer validates its complete plan before writing and restores changed files on failure. The renderer stages target writes with backups and rolls back a failed write. An incomplete restore keeps and names its backup with exit `2`.
|
|
26
27
|
- **Local operation:** the tool makes no network calls, sends no telemetry and reads no environment variables. `npx` fetches the package before execution.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
On a re-run, each home-file line that byte-matches the previous template is migrated to the new template or removed when obsolete. An edited pointer stays byte for byte and is named with its file and line for manual review. Other outer text stays byte for byte. The renderer owns only the marked block.
|
|
30
|
+
|
|
31
|
+
## Re-runs, upgrades and removal
|
|
32
|
+
|
|
33
|
+
- **Convergence:** after a re-run over untouched installer files, their bytes match a fresh install with the new answers, apart from the accumulated configuration and a previous notes folder kept in place.
|
|
34
|
+
- **Notes history:** changing the notes path creates the new scaffold and keeps the old folder. The log names both paths once; the recorded files from both remain available to uninstall.
|
|
35
|
+
- **Tool updates:** a recorded install hash recognizes untouched tools and rules. For older installs without hashes, a shipped table of earlier release hashes recognizes untouched verbatim copies. Edited tools remain intact; the log names the known origin version and the replacement step. The configuration records the installed tooling version.
|
|
36
|
+
- **Removal inventory:** uninstall checks the union of recorded installed paths across all runs. A matching hash permits removal, a changed file is kept and named, and a missing file is skipped. An unrecorded file is left alone. Legacy configurations without hashes use their known install recipe.
|
|
37
|
+
- **Removal paths:** every tracked path is validated before the first unlink and re-probed before each unlink. Removal is file by file. Only recorded install-created, empty directories are removed.
|
|
38
|
+
- **Configuration last:** the configuration is removed after tracked files are gone. Retained tracked files are named and keep the configuration for review.
|
|
39
|
+
- **Preview and manual steps:** `--uninstall --dry` makes the same decisions as removal and changes no files. A missing configuration exits `2` naming its path. Hook registration and pasted instructions are printed as manual cleanup steps.
|
|
29
40
|
|
|
30
41
|
## Forbidden-string gate
|
|
31
42
|
|
package/docs/install.md
CHANGED
|
@@ -4,7 +4,7 @@ The installer writes a profile, an onboarding manual and the instruction files f
|
|
|
4
4
|
|
|
5
5
|
## Requirements
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Node 22 or 24 (active LTS) is recommended; 18 or later runs. The installer, renderer and gate run on macOS, Linux and Windows. The shell harness and session-start hook need a POSIX shell; use WSL or Git Bash on Windows.
|
|
8
8
|
|
|
9
9
|
## Interactive setup
|
|
10
10
|
|
|
@@ -55,7 +55,11 @@ Answers from stdin:
|
|
|
55
55
|
npx agent-personalizer --dir . --ai claude,agents --level 2 --yes --answers - < my-answers.json
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Use [`
|
|
58
|
+
Use [`examples/answers.json`](../examples/answers.json) as a complete example, included in the npm package. Partial answer objects take defaults for the remaining fields. Unknown keys, invalid types and unknown choices are refused before writing files. Choose either `--answers` or `--defaults` for a run. A rerun using defaults preserves previously stored onboarding answers.
|
|
59
|
+
|
|
60
|
+
## Interview recording
|
|
61
|
+
|
|
62
|
+
The [README recording](../README.md#quick-start) shows the short interview and the files it creates. Follow the commands here for your own folder and answers.
|
|
59
63
|
|
|
60
64
|
## Installer flags
|
|
61
65
|
|
|
@@ -84,13 +88,18 @@ Installer exit codes: `0` completed, `1` unexpected error, `2` refused or invali
|
|
|
84
88
|
- **Level 2:** a local notes scaffold with `README.md`, `sessions/TEMPLATE-week.md`, `decisions.md` and `inbox/README.md`. Disk tools use your `notes_path`; read-only and other tools use the local `notes/` fallback. Cloud tools get connector pointers and keep their notes in their service.
|
|
85
89
|
- **Level 3:** your editable `rules/` copy, `render/` tools, the Claude Code session-start hook and the forbidden-string gate. [Register the hook](../hooks/README.md) in your AI settings and [configure the gate](guarantees.md#forbidden-string-gate).
|
|
86
90
|
|
|
87
|
-
An existing local notes scaffold is detected at any level.
|
|
91
|
+
An existing local notes scaffold is detected at any level. Edited notes and rule files stay yours and are named in the install log. Untouched installer copies update on re-runs. A `signature: no` answer omits the signature rule and its template lines; answering yes includes the signature line.
|
|
88
92
|
|
|
89
93
|
## Updating an install
|
|
90
94
|
|
|
91
|
-
Re-run the installer with your destination, AI selection and level.
|
|
95
|
+
Re-run the installer with your destination, AI selection and level. The interview starts from your saved answers. Enter keeps each one, and questions it does not ask keep their saved values. Type a new answer or use an `--answers` file to change onboarding answers. Existing targets remain in the stored selection, so the renderer updates them together.
|
|
96
|
+
|
|
97
|
+
`AGENT_ONBOARDING.md` and rendered blocks regenerate from the answers. `USER.md` regenerates only while it is an untouched installer profile. An edited or pre-existing profile stays; the installer names changed answers so you can update the profile by hand. Every profile-bearing target, including ChatGPT's profile export, uses that `USER.md`.
|
|
92
98
|
|
|
93
|
-
|
|
99
|
+
- **Re-runs:** untouched installer files converge to the files a fresh install with the new answers would create. Current notes templates and rule copies update together. An obsolete file, such as the signing rule after `signature: no`, is removed only while it is untouched.
|
|
100
|
+
- **Home pointers:** each line outside the markers that exactly matches the previous install template is updated or removed to match the new answers. An edited line stays byte for byte and the log names its file and line for manual review. Other text outside the markers stays byte for byte.
|
|
101
|
+
- **Notes path:** when you change `notes_path`, the old folder stays where it is. The log names the old and new folders once. Previously installed files remain in the uninstall inventory; your own notes stay yours.
|
|
102
|
+
- **Upgrades:** re-running a newer package refreshes untouched installed tools and rule copies. Recorded hashes establish ownership; older installs without hashes can be recognized from shipped release hashes. Edited copies stay byte for byte. The log identifies the edited file, its known origin version and how to take the new copy. Previously installed levels and targets remain available on a re-run.
|
|
94
103
|
|
|
95
104
|
At level 3, render your edited profile and rules:
|
|
96
105
|
|
|
@@ -99,9 +108,9 @@ node render/render.cjs --dir .
|
|
|
99
108
|
node render/render.cjs --dir . --check
|
|
100
109
|
```
|
|
101
110
|
|
|
102
|
-
The check returns `0` for current files, `1` for drift, and `2` for invalid inputs. `--targets claude,agents` selects specific renders; `--rules <folder>` selects a rule source. `--strict` returns `1` and writes nothing when a ChatGPT box is over the configured budget. Run `node render/render.cjs --help` for contract and target options.
|
|
111
|
+
The check returns `0` silently for current files, `1` for drift, and `2` for invalid inputs. `--targets claude,agents` selects specific renders; `--rules <folder>` selects a rule source. `--strict` returns `1` and writes nothing when a ChatGPT box is over the configured budget. Run `node render/render.cjs --help` for contract and target options.
|
|
103
112
|
|
|
104
|
-
Re-paste changed text into chat apps. See the [paste guide](paste-guide.md) for the files each app needs.
|
|
113
|
+
Re-paste changed text into chat apps. In ChatGPT, open Settings → Personalization and enable customization. Copy `chatgpt-box1.txt` (profile) and `chatgpt-box2.txt` (response instructions) into the fields your current interface provides, checking its displayed limits. See the [paste guide](paste-guide.md) for the files each app needs.
|
|
105
114
|
|
|
106
115
|
## npm cache permissions
|
|
107
116
|
|
|
@@ -126,15 +135,15 @@ npx agent-personalizer --uninstall --dir /path/to/project --dry
|
|
|
126
135
|
npx agent-personalizer --uninstall --dir /path/to/project
|
|
127
136
|
```
|
|
128
137
|
|
|
129
|
-
The uninstaller reads `/path/to/project/.agent-personalizer.json` and compares
|
|
138
|
+
The uninstaller reads `/path/to/project/.agent-personalizer.json` and compares files with their recorded install hashes. Its inventory includes every path recorded by any install run, including files under a previous notes path and rules omitted by later answers. Files absent from that inventory are left alone. Configurations from before hashes were recorded use the legacy comparison for their known recipe.
|
|
130
139
|
|
|
131
140
|
- **Generated files:** removed when unchanged. Edited files are kept and named in the output.
|
|
132
141
|
- **Existing home files:** user text stays; only an unchanged generated block is removed.
|
|
133
|
-
- **`USER.md`:** removed only when it
|
|
134
|
-
- **Notes scaffold:** unchanged
|
|
142
|
+
- **`USER.md`:** removed only when it matches its recorded install hash. Edited and pre-existing profiles stay.
|
|
143
|
+
- **Notes scaffold:** unchanged historically installed templates are removed. Edited templates are kept and named; user-written notes stay byte for byte. A directory is removed only when the install recorded that it created it and it is empty.
|
|
135
144
|
- **Rules and tools:** unchanged installed copies are removed file by file, including the session-start hook. Edited copies stay.
|
|
136
145
|
- **Hook registration:** remove the matching `SessionStart` entry from `.claude/settings.json` or `~/.claude/settings.json` yourself. The uninstaller prints this step; it never edits settings outside the installation.
|
|
137
|
-
- **Paths:** the uninstaller never follows symlinks or removes a path outside the named folder. A refused
|
|
146
|
+
- **Paths:** the whole removal plan is preflighted before the first unlink, and each path is re-probed before it is unlinked. The uninstaller never follows symlinks, deletes recursively or removes a path outside the named folder. A refused preflight leaves the removal plan unapplied.
|
|
138
147
|
- **Configuration:** `.agent-personalizer.json` is removed last, only after every path it tracks is gone. A retained file, including a pre-existing home file with its block removed, keeps the configuration available for review.
|
|
139
148
|
|
|
140
149
|
`--dry` previews the same decisions without writing. A missing configuration exits `2` and names the expected path. Keep the configuration while reviewing any edited files the uninstaller retained.
|
package/docs/paste-guide.md
CHANGED
|
@@ -8,7 +8,7 @@ The renderer writes one file per AI. This page says where each AI reads it, and
|
|
|
8
8
|
| `AGENT_ONBOARDING.md` | any AI | Named as the second thing to read in `CLAUDE.md` and `AGENTS.md`. Paste it wherever the AI has no file access (below). |
|
|
9
9
|
| `AGENTS.md` | Codex CLI, Cursor, and other agents that adopted the AGENTS.md convention | Automatically, from the repository root. Nothing to paste. |
|
|
10
10
|
| `GEMINI.md` | Gemini CLI | Automatically, from the folder. Nothing to paste. |
|
|
11
|
-
| `chatgpt-custom-instructions.md` | ChatGPT |
|
|
11
|
+
| `chatgpt-box1.txt`, `chatgpt-box2.txt` and `chatgpt-custom-instructions.md` | ChatGPT | Profile and response text to paste, with a preview and counts. |
|
|
12
12
|
| `system-prompt.md` | anything with a system-prompt field, shared bots, API calls | Paste as the system prompt. Universal rules only, no profile, safe to share. |
|
|
13
13
|
|
|
14
14
|
---
|
|
@@ -29,15 +29,24 @@ Re-paste after every re-render. `--check` verifies the files on disk; it cannot
|
|
|
29
29
|
|
|
30
30
|
## ChatGPT
|
|
31
31
|
|
|
32
|
-
Settings → Personalization
|
|
33
|
-
1. "What would you like ChatGPT to know about you?" ← Box 1 (your profile).
|
|
34
|
-
2. "How would you like ChatGPT to respond?" ← Box 2 (universal rules and the ChatGPT binding).
|
|
32
|
+
Open Settings → Personalization and enable customization. Copy the exported profile and response instructions into the fields your current interface provides, checking its displayed limits.
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
- **Profile:** `chatgpt-box1.txt` is the plain profile text. An edited or pre-existing `USER.md` is its source too.
|
|
35
|
+
- **Response instructions:** `chatgpt-box2.txt` is the plain onboarding and selected rule text.
|
|
36
|
+
- **Preview:** `chatgpt-custom-instructions.md` carries both exports inside fences with their character counts.
|
|
37
|
+
|
|
38
|
+
The configured budget is 1,500 characters per export in `render/targets.json`; your current interface displays its own limits. With onboarding answers, box 1 compacts the generated profile while its structure still parses, and preserves custom profile text in full when it does not. Box 2 places the onboarding block (always-ask, off-limits, write policy, then style) before the `inject: true` rules. The preview reports each count. Over-budget text is written in full and flagged OVER BUDGET; `--strict` refuses the write. Review the text against your displayed limits. For the full onboarding and rule source, create a ChatGPT Project and upload `AGENT_ONBOARDING.md` and `rules/` as project files.
|
|
37
39
|
|
|
38
40
|
## Codex CLI
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
Run the installer at the repo root, then start Codex in that project. Codex builds its instruction chain once per run:
|
|
43
|
+
|
|
44
|
+
- **Global guidance:** the first non-empty `AGENTS.override.md` or `AGENTS.md` in the Codex home directory, normally `~/.codex`.
|
|
45
|
+
- **Project guidance:** files from the repository root down to the working directory are merged in that order. Deeper files take precedence over earlier guidance. With no project root, discovery checks the working directory.
|
|
46
|
+
- **Per directory:** `AGENTS.override.md` is tried before `AGENTS.md`, followed by configured fallback filenames. At most one file is selected per directory.
|
|
47
|
+
- **Size cap:** the combined guidance has a default limit of 32 KiB, configurable with `project_doc_max_bytes`.
|
|
48
|
+
|
|
49
|
+
Verified against [OpenAI's Codex AGENTS.md documentation](https://learn.chatgpt.com/docs/agent-configuration/agents-md) on 2026-10-05. Restart Codex after an update so it rebuilds the instruction chain.
|
|
41
50
|
|
|
42
51
|
## Cursor
|
|
43
52
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Mara",
|
|
3
|
+
"pronouns": "she/her",
|
|
4
|
+
"work": "freelance illustrator: book covers and editorial work",
|
|
5
|
+
"focus": "a 12-cover fantasy series due in November, and a print shop",
|
|
6
|
+
"tone": "direct",
|
|
7
|
+
"length": "short",
|
|
8
|
+
"mistakes": "one-line",
|
|
9
|
+
"unsure": "ask-when-it-changes-the-build",
|
|
10
|
+
"lead_with": "verdict",
|
|
11
|
+
"structure": "tables-when-comparing",
|
|
12
|
+
"evidence": "inline",
|
|
13
|
+
"never": [
|
|
14
|
+
"em dashes",
|
|
15
|
+
"start a reply with Great question",
|
|
16
|
+
"client names outside their folder"
|
|
17
|
+
],
|
|
18
|
+
"read_first": [
|
|
19
|
+
"USER.md",
|
|
20
|
+
"AGENT_ONBOARDING.md",
|
|
21
|
+
"notes/README.md",
|
|
22
|
+
"rules/",
|
|
23
|
+
"notes/decisions.md"
|
|
24
|
+
],
|
|
25
|
+
"notes_path": "notes",
|
|
26
|
+
"tracker": "a kanban board the AI reads and I move",
|
|
27
|
+
"write_policy": "notes-freely",
|
|
28
|
+
"file_naming": "kebab-case",
|
|
29
|
+
"signature": "yes",
|
|
30
|
+
"off_limits": [
|
|
31
|
+
"health notes",
|
|
32
|
+
"the journal folder",
|
|
33
|
+
"signed contracts"
|
|
34
|
+
],
|
|
35
|
+
"always_ask": [
|
|
36
|
+
"delete",
|
|
37
|
+
"publish",
|
|
38
|
+
"send",
|
|
39
|
+
"spend",
|
|
40
|
+
"standing-rules"
|
|
41
|
+
],
|
|
42
|
+
"notes_tool": "obsidian",
|
|
43
|
+
"obsidian_tc": "yes"
|
|
44
|
+
}
|
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
"installed": {
|
|
53
53
|
"CLAUDE.md": "7c4206a8cd904266c9c559c745c865fc97d9f852e270f0d1c51da52ac1d364e2",
|
|
54
54
|
"AGENTS.md": "e2d2c9fe612a7868c1dcdb51e7181215371e394b76aee2774784798c318f26d8",
|
|
55
|
-
"AGENT_ONBOARDING.md": "
|
|
55
|
+
"AGENT_ONBOARDING.md": "b07ca321761107455dfe092495f7dba0d1e4b41ba872ecb39713afdbb53aed88"
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -37,7 +37,7 @@ _Generated by agent-personalizer from Mara's own answers (stored in `.agent-pers
|
|
|
37
37
|
|
|
38
38
|
### Where you may write
|
|
39
39
|
|
|
40
|
-
- **Notes live in Obsidian:** reach them as the vault at `notes/`, through **obsidian-tc** (governed MCP: folder ACLs, human-in-the-loop confirmation for destructive tools, audit log) rather than raw filesystem access; see https://github.com/aunysillyme/agent-personalizer/blob/v0.
|
|
40
|
+
- **Notes live in Obsidian:** reach them as the vault at `notes/`, through **obsidian-tc** (governed MCP: folder ACLs, human-in-the-loop confirmation for destructive tools, audit log) rather than raw filesystem access; see https://github.com/aunysillyme/agent-personalizer/blob/v0.7.0/docs/companions.md.
|
|
41
41
|
- You may create and edit files anywhere under `notes/`, under that folder's rules. Nowhere else without being asked.
|
|
42
42
|
- **Every folder you write into has a README.** Any write, edit or delete means that README is corrected in the same pass: the file's one-line description, the folder's status, settled decisions, next steps. A stale index is worse than none, because the next agent believes it.
|
|
43
43
|
- **Session log:** append a dated section to this week's note in `notes/sessions/`. **Decisions:** one line each in `notes/decisions.md`. **Inbox:** one file per item in `notes/inbox/`; finished items are deleted, not marked done.
|
package/hooks/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# hooks/
|
|
2
2
|
|
|
3
|
-
Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.
|
|
3
|
+
Tier 3 from the tiers doc (https://github.com/aunysillyme/agent-personalizer/blob/v0.7.0/docs/tiers.md): the few rules that must be in context at the moment of decision, injected in full at the start of every session. Injection puts the text in front of the model; whether the model follows it is up to the model and the host. This is the strongest placement available, not a guarantee.
|
|
4
4
|
|
|
5
5
|
Which rules? The ones with `inject: true` in their frontmatter. Keep that set small. Every injected rule costs tokens every session.
|
|
6
6
|
|
package/llms.txt
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# agent-personalizer
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Answer a few questions once, and every AI you use gets the same profile and the rules it can carry: Claude Code, Codex, Cursor, Gemini CLI and ChatGPT, rendered from one source and kept in sync.
|
|
4
4
|
|
|
5
|
-
Install with Node 18 or later
|
|
5
|
+
Install with `npx agent-personalizer`. Node 22 or 24 (active LTS) is recommended; 18 or later runs. Headless setup: `npx agent-personalizer --dir . --ai claude,agents --level 1 --yes --defaults`.
|
|
6
6
|
|
|
7
7
|
The installer writes USER.md, AGENT_ONBOARDING.md and each selected AI's instruction files. Level 2 adds local notes scaffolds for local and fallback notes tools. Level 3 adds editable rules, a renderer, a session-start hook, a drift check and a forbidden-string gate. Preview removal with `npx agent-personalizer --uninstall --dir . --dry`.
|
|
8
8
|
|
|
9
|
+
Re-runs update untouched installed files and pointer lines to the new answers. Edited copies stay and are named, old notes folders stay in place, and upgrades refresh untouched tools. USER.md supplies every profile export, including ChatGPT. Uninstall checks the history of recorded installed paths and keeps edited files and user-written notes.
|
|
10
|
+
|
|
9
11
|
## Docs
|
|
10
12
|
|
|
11
13
|
- [Documentation index](https://github.com/aunysillyme/agent-personalizer/blob/main/docs/README.md): Start here.
|
|
@@ -22,5 +24,8 @@ The installer writes USER.md, AGENT_ONBOARDING.md and each selected AI's instruc
|
|
|
22
24
|
- [Rule format](https://github.com/aunysillyme/agent-personalizer/blob/main/rules/README.md): Universal, personal, binding and origin sections.
|
|
23
25
|
- [Worked example](https://github.com/aunysillyme/agent-personalizer/tree/main/examples/freelance-illustrator): An invented illustrator's profile and rendered files.
|
|
24
26
|
- [Changelog](https://github.com/aunysillyme/agent-personalizer/blob/main/CHANGELOG.md): Release history.
|
|
27
|
+
- [Support](https://github.com/aunysillyme/agent-personalizer/blob/main/SUPPORT.md): Where to ask questions, report bugs, request features and report security issues privately.
|
|
28
|
+
- [Maintainers](https://github.com/aunysillyme/agent-personalizer/blob/main/MAINTAINERS.md): Who owns reviews, releases and support routes.
|
|
29
|
+
- [Releasing](https://github.com/aunysillyme/agent-personalizer/blob/main/RELEASING.md): Version sites, checks, tags, provenance and publication steps.
|
|
25
30
|
- [model-orchestrator](https://github.com/aunysillyme/model-orchestrator): Model router for AI coding agents: installs routing rules, 8 subagents, hooks and a CLI runner so your AI picks model and effort per task and saves tokens.
|
|
26
31
|
- [website-build-skill](https://github.com/aunysillyme/website-build-skill): A skill pack that teaches your AI current website-building expertise: research, design, code, accessibility, performance, search and security.
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-personalizer",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "AI custom instructions from one interview: a profile and rules for Claude Code, Codex, Cursor, Gemini CLI and ChatGPT, kept in sync from one source.",
|
|
5
5
|
"author": "aunysillyme (https://github.com/aunysillyme)",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"funding": "https://github.com/sponsors/aunysillyme",
|
|
7
8
|
"repository": "github:aunysillyme/agent-personalizer",
|
|
8
9
|
"homepage": "https://github.com/aunysillyme/agent-personalizer#readme",
|
|
9
10
|
"bugs": {
|
|
@@ -56,6 +57,14 @@
|
|
|
56
57
|
"README.md",
|
|
57
58
|
"LICENSE",
|
|
58
59
|
"CLA.md",
|
|
60
|
+
"CHANGELOG.md",
|
|
61
|
+
"SECURITY.md",
|
|
62
|
+
"CONTRIBUTING.md",
|
|
63
|
+
"CODE_OF_CONDUCT.md",
|
|
64
|
+
"AGENTS.md",
|
|
65
|
+
"MAINTAINERS.md",
|
|
66
|
+
"SUPPORT.md",
|
|
67
|
+
"RELEASING.md",
|
|
59
68
|
"llms.txt"
|
|
60
69
|
]
|
|
61
70
|
}
|
package/render/onboarding.cjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
DOCS points at the matching tag on GitHub so an installed copy never links to a file the
|
|
18
18
|
destination does not have.
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = '0.
|
|
20
|
+
const VERSION = '0.7.0';
|
|
21
21
|
const DOCS = `https://github.com/aunysillyme/agent-personalizer/blob/v${VERSION}/docs`;
|
|
22
22
|
|
|
23
23
|
/* THE single source for notes tools. Add a tool here and nowhere else: the interview option, the
|
|
@@ -112,8 +112,8 @@ const QUESTIONS = [
|
|
|
112
112
|
];
|
|
113
113
|
|
|
114
114
|
const IDS = new Set(QUESTIONS.map(q => q.id));
|
|
115
|
-
/* the short interview, which is what a bare `npx agent-personalizer` runs;
|
|
116
|
-
|
|
115
|
+
/* the short interview, which is what a bare `npx agent-personalizer` runs; other answers keep saved
|
|
116
|
+
values, or take defaults on the first install. --full asks the rest as well. */
|
|
117
117
|
const QUICK = ['name', 'tone', 'length', 'notes_tool', 'notes_path', 'write_policy', 'always_ask'];
|
|
118
118
|
/* Does this interview ask question q, given the answers so far? A question with a `when` is
|
|
119
119
|
CONDITIONAL: it is asked exactly when its condition holds, short interview or long, so nobody
|
|
@@ -137,6 +137,15 @@ function defaults() {
|
|
|
137
137
|
return a;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/* Interview defaults preserve even an empty saved answer. Asked answers override saved values;
|
|
141
|
+
package defaults fill only missing keys. Validation remains the caller's final step. */
|
|
142
|
+
function interviewDefault(q, saved) {
|
|
143
|
+
return saved && Object.hasOwn(saved, q.id) ? saved[q.id] : q.default;
|
|
144
|
+
}
|
|
145
|
+
function interviewAnswers(saved, asked = {}) {
|
|
146
|
+
return { ...defaults(), ...saved, ...asked };
|
|
147
|
+
}
|
|
148
|
+
|
|
140
149
|
/* Strict validation: unknown keys, wrong types and unknown choices are errors, never defaults.
|
|
141
150
|
Returns the completed answer set (missing keys take their default). */
|
|
142
151
|
const RESERVED = /<!--\s*agent-personalizer/i;
|
|
@@ -436,4 +445,38 @@ function compactProfile(a) {
|
|
|
436
445
|
].filter(Boolean).join('\n');
|
|
437
446
|
}
|
|
438
447
|
|
|
439
|
-
|
|
448
|
+
/* Compact an edited generated profile only when all its other bytes still match the scaffold.
|
|
449
|
+
The four captured values come from USER.md and are already Markdown-escaped, so they are not
|
|
450
|
+
escaped again or split on punctuation that could be part of a name or an off-limits topic.
|
|
451
|
+
A changed firmness rule, extra paragraph or custom profile is kept in full instead of silently
|
|
452
|
+
dropping the edit. The caller's usual budget warning then names any overflow, without cutting.
|
|
453
|
+
opts admits the generated level-1 notes placeholder as well as the default ready scaffold. */
|
|
454
|
+
function compactProfileFromUser(text, answers, opts) {
|
|
455
|
+
if (text === renderUser(answers)) return compactProfile(answers);
|
|
456
|
+
const fields = ['Name and pronouns', 'What I do', 'Current focus', 'Off limits'];
|
|
457
|
+
const parse = (source) => {
|
|
458
|
+
const values = {};
|
|
459
|
+
let scaffold = source;
|
|
460
|
+
for (const field of fields) {
|
|
461
|
+
const prefix = `- **${field}:** `;
|
|
462
|
+
const lines = source.split('\n').filter(line => line.startsWith(prefix));
|
|
463
|
+
if (lines.length !== 1 || !lines[0].slice(prefix.length)) return null;
|
|
464
|
+
values[field] = lines[0].slice(prefix.length);
|
|
465
|
+
scaffold = scaffold.replace(lines[0], `${prefix}<${field}>`);
|
|
466
|
+
}
|
|
467
|
+
return { values, scaffold };
|
|
468
|
+
};
|
|
469
|
+
const profile = parse(text);
|
|
470
|
+
const generated = [renderUser(answers), renderUser(answers, opts)].map(parse);
|
|
471
|
+
if (!profile || !generated.some(item => item && item.scaffold === profile.scaffold)) return text;
|
|
472
|
+
const v = profile.values;
|
|
473
|
+
return [
|
|
474
|
+
`Call me ${v['Name and pronouns']}.`,
|
|
475
|
+
v['What I do'] !== '(fill in)' ? `I do: ${v['What I do']}.` : null,
|
|
476
|
+
v['Current focus'] !== '(fill in)' ? `Current focus: ${v['Current focus']}.` : null,
|
|
477
|
+
v['Off limits'] !== 'nothing declared yet' ? `Off limits, never surfaced in any reply: ${v['Off limits']}.` : null,
|
|
478
|
+
'How firmly I mean things: "kind of" or a made-up word is a gesture; "I like" is a preference; "I always" is a practice; "never" or "I have to" is a rule. When unsure read one rung looser, never tighter; never loosen a stated prohibition.',
|
|
479
|
+
].filter(Boolean).join('\n');
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
module.exports = { QUESTIONS, QUICK, PINNED, TOOL, VERSION, DOCS, FALLBACK, NOTES_PENDING_MARK, notesPending, asks, defaults, interviewDefault, interviewAnswers, sparse, validate, parseAnswer, renderUser, renderOnboarding, contractBlock, compactProfile, compactProfileFromUser, kindOf, baseFor };
|
package/render/render.cjs
CHANGED
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
--targets which renders to write; default: <dir>/.agent-personalizer.json, else "claude,agents".
|
|
20
20
|
The "onboarding" target renders AGENT_ONBOARDING.md from the interview answers
|
|
21
21
|
stored in .agent-personalizer.json (render/onboarding.cjs).
|
|
22
|
-
--check render to memory, compare with disk
|
|
22
|
+
--check render to memory, compare with disk (both ChatGPT paste files included);
|
|
23
|
+
silent exit 0 when clean; exit 1 and name drift, 2 and name invalid input
|
|
23
24
|
--contract print the inject:true rules for one target to stdout (session-start hooks):
|
|
24
25
|
the onboarding block (how to work with this person) when answers exist and
|
|
25
26
|
personal content is allowed, then each rule: universal, personal (same
|
|
@@ -28,9 +29,11 @@
|
|
|
28
29
|
|
|
29
30
|
Rules render from the interview answers as well as the profile: a rule whose frontmatter says
|
|
30
31
|
`requires: <answer>=<value>` is left out of every render and every contract when the stored
|
|
31
|
-
answer differs (no stored answers = the defaults). The ChatGPT target
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
answer differs (no stored answers = the defaults). The ChatGPT target uses USER.md for its
|
|
33
|
+
profile: unchanged generated profiles keep the compact interview output, edited generated
|
|
34
|
+
profiles are compacted only while their scaffold matches, and other profiles are kept in full.
|
|
35
|
+
With answers, box 2 carries the contract block plus the inject:true rules; without answers it
|
|
36
|
+
carries every rule for that surface. Over-budget boxes are flagged, never cut.
|
|
34
37
|
|
|
35
38
|
Rendered text lives between two marker lines inside each target file. Bytes outside the
|
|
36
39
|
markers are preserved exactly (line endings included); a target that is not valid UTF-8 is
|
|
@@ -275,7 +278,7 @@ function loadProfile(root) {
|
|
|
275
278
|
if (!fs.existsSync(p) && !(() => { try { fs.lstatSync(p); return true; } catch (_) { return false; } })()) return null;
|
|
276
279
|
const text = readSource(p, 'USER.md');
|
|
277
280
|
fenceMap(text.split('\n'), 'USER.md'); // an unterminated fence in the profile is an error, not a surprise later
|
|
278
|
-
return text.replace(/^#\s+USER\.md\s*\n/, '').replace(/\n---\n\*Template from agent-personalizer[^\n]*\n?$/, '').trim();
|
|
281
|
+
return { source: text, body: text.replace(/^#\s+USER\.md\s*\n/, '').replace(/\n---\n\*Template from agent-personalizer[^\n]*\n?$/, '').trim() };
|
|
279
282
|
}
|
|
280
283
|
|
|
281
284
|
/* Resolve a target's relative filename to a path provably inside the real project root,
|
|
@@ -332,9 +335,9 @@ function renderTarget(key, target, profile, rules, cfg, root) {
|
|
|
332
335
|
const answers = answersOf(cfg);
|
|
333
336
|
const lines = [`## ${target.header}`, '', '_Generated by agent-personalizer from `USER.md`, `rules/` and your onboarding answers. Edit those, then re-render. Do not edit between the markers._', ''];
|
|
334
337
|
if (target.boxes) {
|
|
335
|
-
//
|
|
336
|
-
//
|
|
337
|
-
//
|
|
338
|
+
// The profile's own bytes win over stored answers. A generated profile can still be compact,
|
|
339
|
+
// but custom structure or prose stays in full. Box 2 uses the contract and inject:true rules
|
|
340
|
+
// when answers exist, or every rule for this surface without an interview.
|
|
338
341
|
const picked = rulesFor(rules, key, answers).filter(r => !answers || r.meta.inject === true);
|
|
339
342
|
const ruleText = picked.map(r => {
|
|
340
343
|
const s = r.sections, parts = [s.universal];
|
|
@@ -342,7 +345,7 @@ function renderTarget(key, target, profile, rules, cfg, root) {
|
|
|
342
345
|
if (target.binding && s[`binding:${target.binding}`]) parts.push(s[`binding:${target.binding}`]);
|
|
343
346
|
return parts.join('\n\n');
|
|
344
347
|
}).join('\n\n');
|
|
345
|
-
const box1 = answers ? onboarding.compactProfile(answers) : (profile
|
|
348
|
+
const box1 = answers ? (profile ? onboarding.compactProfileFromUser(profile.source, answers, { notesScaffolded: notesScaffolded(root, answers) }) : onboarding.compactProfile(answers)) : (profile ? profile.body : '(no USER.md found)');
|
|
346
349
|
const box2 = answers ? [onboarding.contractBlock(answers, { files: false, notesScaffolded: notesScaffolded(root, answers) }).split('\n').slice(2).join('\n'), ruleText].filter(Boolean).join('\n\n') : ruleText;
|
|
347
350
|
const over = [];
|
|
348
351
|
const warn = (label, text) => {
|
|
@@ -360,7 +363,7 @@ function renderTarget(key, target, profile, rules, cfg, root) {
|
|
|
360
363
|
renderTarget.overBudget = (renderTarget.overBudget || []).concat(over.map(l => `${target.file}: ${l}`));
|
|
361
364
|
return lines.join('\n');
|
|
362
365
|
}
|
|
363
|
-
if (target.profile && profile) lines.push('## Profile', '', profile, '');
|
|
366
|
+
if (target.profile && profile) lines.push('## Profile', '', profile.body, '');
|
|
364
367
|
lines.push('## Rules', '');
|
|
365
368
|
for (const r of rulesFor(rules, key, answers)) lines.push(renderRule(r, target), '');
|
|
366
369
|
return lines.join('\n').trimEnd();
|
|
@@ -510,9 +513,8 @@ function main() {
|
|
|
510
513
|
for (const p of plan) {
|
|
511
514
|
if (p.current === null) { console.log(`DRIFT ${p.target.file}: ${p.raw ? 'missing' : 'missing or no marker block'}`); drift++; }
|
|
512
515
|
else if (p.current !== p.block) { console.log(`DRIFT ${p.target.file}: rendered block differs from source`); drift++; }
|
|
513
|
-
else console.log(`ok ${p.target.file}`);
|
|
514
516
|
}
|
|
515
|
-
console.log(
|
|
517
|
+
if (drift) console.log(`\n${drift} file(s) drifted. Re-render with: node render/render.cjs --dir ${root}`);
|
|
516
518
|
process.exit(drift ? 1 : 0);
|
|
517
519
|
}
|
|
518
520
|
// Commit: stage every output beside its target under a per-run random name, back up every
|