Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

fix(blueprint): a name's parts match only as written [S1]

Corey Olson106d8d8ebcf8
diff --git a/src/blueprints.js b/src/blueprints.js
index 11af0dce..10ea1a22 100644
--- a/src/blueprints.js
+++ b/src/blueprints.js
@@ -358,19 +358,23 @@ const RULE_RE = /^(.+?) Why: (.+)$/u;
* a path, an email or any private name (a person, an agent, a model label or a machine) stays.
*
* @param {string} text
- * @param {string[]} names - Every private name known on this board and machine.
+ * @param {string[]} names - Every private name known on this board and machine, matched in any case.
+ * @param {string[]} [parts] - Parts of people's names, matched only as written.
* @returns {string | null}
*/
-export function privateTextReason(text, names) {
+export function privateTextReason(text, names, parts = []) {
if (PATH_RE.test(text)) return 'a file path';
if (EMAIL_RE.test(text)) return 'an email address';
- const lower = text.toLowerCase();
- for (const name of names) {
- const wanted = String(name ?? '').trim().toLowerCase();
- if (wanted.length < 3) continue;
- const escaped = wanted.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
- if (new RegExp(`(?:^|[^\\p{L}\\p{N}_-])${escaped}(?:$|[^\\p{L}\\p{N}_-])`, 'u').test(lower)) return 'a private name';
- }
+ /** True when the name stands as its own word in the text, in either case or exactly as written. */
+ const holds = (name, cased) => {
+ const wanted = String(name ?? '').trim();
+ if (wanted.length < 3) return false;
+ const escaped = (cased ? wanted : wanted.toLowerCase()).replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
+ return new RegExp(`(?:^|[^\\p{L}\\p{N}_-])${escaped}(?:$|[^\\p{L}\\p{N}_-])`, 'u').test(cased ? text : text.toLowerCase());
+ };
+ // A whole name matches in any case; a part of a person's name only as written, so the person
+ // "Test Agent" keeps "Test" out without losing every rule about a test.
+ if (names.some((name) => holds(name, false)) || parts.some((part) => holds(part, true))) return 'a private name';
return null;
}
@@ -383,17 +387,17 @@ export function privateTextReason(text, names) {
* rule with no "Why:" reason to carry, is left out and named in `left`, never rewritten [S1].
*
* @param {{ rows: any[] }} spec - The parsed SPEC.md.
- * @param {{ name: string, title: string, gate?: string, names: string[] }} board
+ * @param {{ name: string, title: string, gate?: string, names: string[], parts?: string[] }} board
* @returns {{ blueprint: Blueprint, left: { id: string, reason: string }[] }}
*/
-export function saveBlueprint(spec, { name, title, gate, names }) {
+export function saveBlueprint(spec, { name, title, gate, names, parts = [] }) {
const rules = [];
const questions = [];
const left = [];
for (const row of spec.rows) {
if (row.status !== 'approved') continue;
const text = String(row.text ?? '').trim();
- const privacy = privateTextReason(text, names);
+ const privacy = privateTextReason(text, names, parts);
if (privacy) { left.push({ id: row.id, reason: `it holds ${privacy}` }); continue; }
const question = QUESTION_RE.exec(text);
if (question) {
@@ -413,9 +417,9 @@ export function saveBlueprint(spec, { name, title, gate, names }) {
const value = {
blueprint: BLUEPRINT_FORMAT,
name: slug,
- title: cleanTitle && !/[\r\n|]/u.test(cleanTitle) && !privateTextReason(cleanTitle, names) ? cleanTitle : slug,
+ title: cleanTitle && !/[\r\n|]/u.test(cleanTitle) && !privateTextReason(cleanTitle, names, parts) ? cleanTitle : slug,
version: 1,
- ...(gate?.trim() && !/[\r\n|]/u.test(gate) && !privateTextReason(gate.trim(), names) ? { gate: gate.trim() } : {}),
+ ...(gate?.trim() && !/[\r\n|]/u.test(gate) && !privateTextReason(gate.trim(), names, parts) ? { gate: gate.trim() } : {}),
...(rules.length ? { rules } : {}),
...(questions.length ? { questions } : {}),
};
diff --git a/src/cli.js b/src/cli.js
index d4721345..560975cd 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -3496,8 +3496,8 @@ async function runCommand(argv, io) {
const file = resolve(io.cwd ?? process.cwd(), second ?? `${project}.blueprint.json`);
if (existsSync(file)) throw new Refused('BLUEPRINT_EXISTS', `${file} already exists; name another file: pullboard blueprint save <file>`);
const spec = loadSpec(root, ctx.config);
- const names = withBoard(ctx, (board) => privateNames(root, board, spec));
- const { blueprint, left } = saveBlueprint(spec, { name: project, title: project, gate: ctx.config.gate, names });
+ const { names, parts } = withBoard(ctx, (board) => privateNames(root, board, spec));
+ const { blueprint, left } = saveBlueprint(spec, { name: project, title: project, gate: ctx.config.gate, names, parts });
writeFileSync(file, `${JSON.stringify(blueprint, null, 2)}\n`, { flag: 'wx' });
io.result?.({ file, name: blueprint.name, rules: blueprint.rules?.length ?? 0, questions: blueprint.questions?.length ?? 0, left });
io.say(`saved ${blueprint.rules?.length ?? 0} rules and ${blueprint.questions?.length ?? 0} answered questions to ${file}`);
@@ -3537,17 +3537,19 @@ async function runCommand(argv, io) {
/**
* Every private name a saved blueprint must never carry: each agent's id, display name, model
- * and family, the person's Git name, its parts and email, everyone who signed off or signs rows,
- * and this machine's host name. Missing sources add nothing; they never stop the save [S1].
+ * and family, the person's Git name and email, everyone who signed off or signs rows, and this
+ * machine's host name, whole, plus the parts of each (a first name, an email's user) to match
+ * only as written. Missing sources add nothing; they never stop the save [S1].
*/
function privateNames(root, board, spec) {
const names = new Set();
+ const parts = new Set();
const add = (value) => {
const text = typeof value === 'string' ? value.trim() : '';
// "unknown" is the label for an undeclared model, not anyone's name.
if (!text || text === 'unknown') return;
names.add(text);
- for (const part of text.split(/[\s@.<>()]+/u)) if (part.length >= 3 && part !== 'unknown') names.add(part);
+ for (const part of text.split(/[\s@.<>()]+/u)) if (part.length >= 3 && part !== 'unknown' && part !== text) parts.add(part);
};
for (const agent of store.listAgents(board)) {
add(agent.agent_id); add(agent.agent_model); add(agent.agent_family); add(displayAgentName(agent)); add(displayAgentName(agent, 'prefix'));
@@ -3561,7 +3563,7 @@ function privateNames(root, board, spec) {
for (const row of spec.rows) for (const signer of row.signers ?? []) add(signer);
add(hostname());
add(hostname().split('.')[0]);
- return [...names];
+ return { names: [...names], parts: [...parts] };
}
/** Retain the primary branch on every command without creating a board for global help. */