@productbrain/cli 0.1.0-beta.1770 → 0.1.0-beta.1777
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/dist/commands/files.d.ts +26 -0
- package/dist/commands/files.d.ts.map +1 -0
- package/dist/commands/files.js +160 -0
- package/dist/commands/files.js.map +1 -0
- package/dist/commands/files.test.d.ts +2 -0
- package/dist/commands/files.test.d.ts.map +1 -0
- package/dist/commands/files.test.js +243 -0
- package/dist/commands/files.test.js.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/productbrain-files.d.ts +94 -0
- package/dist/lib/productbrain-files.d.ts.map +1 -0
- package/dist/lib/productbrain-files.js +212 -0
- package/dist/lib/productbrain-files.js.map +1 -0
- package/dist/lib/productbrain-files.test.d.ts +2 -0
- package/dist/lib/productbrain-files.test.d.ts.map +1 -0
- package/dist/lib/productbrain-files.test.js +237 -0
- package/dist/lib/productbrain-files.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ClassifiedFile, type Exposure } from '../lib/productbrain-files.js';
|
|
2
|
+
export interface FilesResult {
|
|
3
|
+
workspace: string | null;
|
|
4
|
+
root: string | null;
|
|
5
|
+
git: boolean;
|
|
6
|
+
files: ClassifiedFile[];
|
|
7
|
+
exposures: Exposure[];
|
|
8
|
+
fix?: {
|
|
9
|
+
added: string[];
|
|
10
|
+
skipped: string[];
|
|
11
|
+
refused?: string;
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
trackedExposed?: string[];
|
|
14
|
+
stillExposed?: string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function resolveFiles(opts: {
|
|
18
|
+
fix: boolean;
|
|
19
|
+
dryRun: boolean;
|
|
20
|
+
}): Promise<FilesResult>;
|
|
21
|
+
export declare function formatFilesPretty(d: FilesResult): string;
|
|
22
|
+
export declare function runFiles(opts: {
|
|
23
|
+
fix?: boolean;
|
|
24
|
+
dryRun?: boolean;
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/commands/files.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,cAAc,EAAE,KAAK,QAAQ,EACnC,MAAM,8BAA8B,CAAC;AAGtC,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,GAAG,EAAE,OAAO,CAAC;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,GAAG,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CACtI;AAUD,wBAAsB,YAAY,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAmEhG;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAsDxD;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAKvF"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pb files — the .productbrain file-contract legend (WP-471 / WP-3).
|
|
3
|
+
* Read-only by default; opt-in --fix seals the gitignore boundary. No session
|
|
4
|
+
* required; never throws (mirrors whoami's internal-guard pattern — runCliCommand
|
|
5
|
+
* re-throws, so each read is guarded here).
|
|
6
|
+
*/
|
|
7
|
+
import { runCliCommand } from '../lib/runner.js';
|
|
8
|
+
import { resolvePbRoot, listProductbrainEntries, makeGitIgnoreChecker, makeGitTrackedChecker, classifyTree, detectExposures, planGitignoreLines, applyGitignoreFix, } from '../lib/productbrain-files.js';
|
|
9
|
+
import { readLocalProjectConfig, getPreviewBinding } from '../lib/config.js';
|
|
10
|
+
function localWorkspaceName() {
|
|
11
|
+
try {
|
|
12
|
+
const local = readLocalProjectConfig();
|
|
13
|
+
if (local?.workspaceName)
|
|
14
|
+
return local.workspaceName;
|
|
15
|
+
}
|
|
16
|
+
catch { /* ignore */ }
|
|
17
|
+
try {
|
|
18
|
+
return getPreviewBinding()?.workspaceName ?? null;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export async function resolveFiles(opts) {
|
|
25
|
+
let root = null;
|
|
26
|
+
let git = false;
|
|
27
|
+
let isToplevel = false;
|
|
28
|
+
try {
|
|
29
|
+
({ root, git, isToplevel } = resolvePbRoot());
|
|
30
|
+
}
|
|
31
|
+
catch { /* degrade: treat as not-a-pb-project */ }
|
|
32
|
+
let files = [];
|
|
33
|
+
let exposures = [];
|
|
34
|
+
if (root) {
|
|
35
|
+
try {
|
|
36
|
+
const isIgnored = makeGitIgnoreChecker(root);
|
|
37
|
+
files = classifyTree({ presentEntries: listProductbrainEntries(root), isIgnored });
|
|
38
|
+
exposures = detectExposures(files);
|
|
39
|
+
}
|
|
40
|
+
catch { /* degrade to empty — never throw */ }
|
|
41
|
+
}
|
|
42
|
+
const result = { workspace: localWorkspaceName(), root, git, files, exposures };
|
|
43
|
+
if (opts.fix) {
|
|
44
|
+
if (!root) {
|
|
45
|
+
result.fix = { added: [], skipped: [], refused: 'Not in a Product Brain project (no .productbrain found) — nothing to fix.' };
|
|
46
|
+
}
|
|
47
|
+
else if (!isToplevel) {
|
|
48
|
+
const lines = planGitignoreLines(files);
|
|
49
|
+
const hint = lines.length
|
|
50
|
+
? ` to ${root}/.gitignore (patterns are relative to that file):\n ${lines.join('\n ')}`
|
|
51
|
+
: ' (none needed).';
|
|
52
|
+
result.fix = { added: [], skipped: [], refused: `pb files --fix only writes the git-toplevel .gitignore, and this .productbrain isn't at the git toplevel — add these manually${hint}` };
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
try {
|
|
56
|
+
const isTracked = makeGitTrackedChecker(root);
|
|
57
|
+
const PREFIX = '.productbrain/';
|
|
58
|
+
// planGitignoreLines covers every must/should path git doesn't yet ignore — present OR
|
|
59
|
+
// absent (a preemptive rule for a path a future write would expose). Write each rule once.
|
|
60
|
+
const planned = planGitignoreLines(files);
|
|
61
|
+
const applied = applyGitignoreFix(root, planned, { dryRun: opts.dryRun });
|
|
62
|
+
// A tracked+present path needs `git rm --cached` too: the rule blocks FUTURE commits but
|
|
63
|
+
// can't un-index the copy already committed. Only a PRESENT file can be tracked, so tracking
|
|
64
|
+
// is probed for those alone (keeps git spawns down).
|
|
65
|
+
const presentPaths = new Set(files.filter((f) => f.present).map((f) => PREFIX + f.path));
|
|
66
|
+
const trackedExposed = planned
|
|
67
|
+
.filter((line) => presentPaths.has(line) && isTracked(line) === true)
|
|
68
|
+
.map((line) => line.slice(PREFIX.length));
|
|
69
|
+
let stillExposed;
|
|
70
|
+
if (!opts.dryRun) {
|
|
71
|
+
// Re-read git AFTER the write: refresh files/exposures to post-fix truth, and surface any
|
|
72
|
+
// must/should path git STILL doesn't ignore — a negation (root-anchored, or a lower-level
|
|
73
|
+
// .productbrain/.gitignore git gives precedence to) is overriding the rule. Tracked paths
|
|
74
|
+
// always read "not ignored", so they're reported via trackedExposed, not double-counted here.
|
|
75
|
+
const recheck = makeGitIgnoreChecker(root);
|
|
76
|
+
files = classifyTree({ presentEntries: listProductbrainEntries(root), isIgnored: recheck });
|
|
77
|
+
exposures = detectExposures(files);
|
|
78
|
+
result.files = files;
|
|
79
|
+
result.exposures = exposures;
|
|
80
|
+
const trackedSet = new Set(trackedExposed.map((p) => PREFIX + p));
|
|
81
|
+
const notSealed = planned.filter((line) => !trackedSet.has(line) && recheck(line) !== true);
|
|
82
|
+
if (notSealed.length)
|
|
83
|
+
stillExposed = notSealed;
|
|
84
|
+
}
|
|
85
|
+
result.fix = {
|
|
86
|
+
...applied,
|
|
87
|
+
dryRun: opts.dryRun,
|
|
88
|
+
...(trackedExposed.length ? { trackedExposed } : {}),
|
|
89
|
+
...(stillExposed?.length ? { stillExposed } : {}),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
result.fix = { added: [], skipped: [], refused: `couldn't write .gitignore: ${err.message}` };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
export function formatFilesPretty(d) {
|
|
100
|
+
if (!d.root)
|
|
101
|
+
return 'Not in a Product Brain project (no .productbrain/ found). Run `pb connect <token>`.';
|
|
102
|
+
const ws = d.workspace ? `workspace: ${d.workspace} ` : '';
|
|
103
|
+
const lines = [`.productbrain/ file contract — ${ws}(${d.root})`, ''];
|
|
104
|
+
const owned = d.files.filter((f) => f.kind !== 'committed');
|
|
105
|
+
const committed = d.files.filter((f) => f.kind === 'committed' && f.present);
|
|
106
|
+
lines.push(' pb-owned & machine-local · gitignored — pb regenerates its own; .local/ is yours');
|
|
107
|
+
for (const f of owned) {
|
|
108
|
+
const mark = !f.present ? '–' : f.exposed ? '⚠ EXPOSED' : d.git ? 'present' : 'present (git?)';
|
|
109
|
+
lines.push(` ${f.path.padEnd(22)} ${mark.padEnd(11)} ← ${f.writer}`);
|
|
110
|
+
}
|
|
111
|
+
if (committed.length) {
|
|
112
|
+
lines.push('', ' committed · you & your team own these, tracked in git');
|
|
113
|
+
lines.push(' ' + committed.map((f) => f.path).join(' '));
|
|
114
|
+
}
|
|
115
|
+
lines.push('');
|
|
116
|
+
if (d.exposures.length) {
|
|
117
|
+
const secret = d.exposures.find((e) => e.severity === 'high');
|
|
118
|
+
lines.push(secret
|
|
119
|
+
? `⚠ ${secret.path} is pb-owned and NOT gitignored — a commit could leak it.`
|
|
120
|
+
: `⚠ ${d.exposures.length} pb-owned file(s) are not gitignored.`);
|
|
121
|
+
lines.push(' Fix automatically: pb files --fix');
|
|
122
|
+
}
|
|
123
|
+
else if (d.git) {
|
|
124
|
+
lines.push('✓ all present pb-owned files are gitignored.');
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
lines.push('(git unavailable — cannot check gitignore status.)');
|
|
128
|
+
}
|
|
129
|
+
if (d.fix) {
|
|
130
|
+
lines.push('');
|
|
131
|
+
if (d.fix.refused)
|
|
132
|
+
lines.push(d.fix.refused);
|
|
133
|
+
else {
|
|
134
|
+
if (d.fix.added.length)
|
|
135
|
+
lines.push(d.fix.dryRun
|
|
136
|
+
? `Would add to .gitignore (dry-run, nothing written): ${d.fix.added.join(', ')}`
|
|
137
|
+
: `Added to .gitignore: ${d.fix.added.join(', ')}`);
|
|
138
|
+
else if (!d.fix.trackedExposed?.length && !d.fix.stillExposed?.length) {
|
|
139
|
+
lines.push('Nothing to fix — all pb-owned paths already gitignored.');
|
|
140
|
+
}
|
|
141
|
+
if (d.fix.trackedExposed?.length) {
|
|
142
|
+
const flag = d.fix.trackedExposed.some((p) => p.endsWith('/')) ? '-r --cached' : '--cached';
|
|
143
|
+
lines.push(`⚠ already tracked in git — the rule blocks future commits but won't remove the indexed copy: ${d.fix.trackedExposed.join(', ')}`);
|
|
144
|
+
lines.push(` Untrack then commit: git rm ${flag} ${d.fix.trackedExposed.map((p) => '.productbrain/' + p).join(' ')}`);
|
|
145
|
+
}
|
|
146
|
+
if (d.fix.stillExposed?.length) {
|
|
147
|
+
lines.push(`⚠ still exposed — a negation rule (in .gitignore or a lower-level .productbrain/.gitignore) is overriding the pattern: ${d.fix.stillExposed.join(', ')}`);
|
|
148
|
+
lines.push(` Remove the negation for these paths so the rule takes effect.`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return lines.join('\n');
|
|
153
|
+
}
|
|
154
|
+
export async function runFiles(opts) {
|
|
155
|
+
await runCliCommand({
|
|
156
|
+
fn: () => resolveFiles({ fix: !!opts.fix, dryRun: !!opts.dryRun }),
|
|
157
|
+
formatPretty: formatFilesPretty,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/commands/files.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,aAAa,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,YAAY,EACjG,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,GAEvD,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAW7E,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,sBAAsB,EAAE,CAAC;QACvC,IAAI,KAAK,EAAE,aAAa;YAAE,OAAO,KAAK,CAAC,aAAa,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IACxB,IAAI,CAAC;QAAC,OAAO,iBAAiB,EAAE,EAAE,aAAa,IAAI,IAAI,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;AACnF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAuC;IACxE,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,GAAG,GAA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,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QAClE,YAAY,EAAE,iBAAiB;KAChC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.test.d.ts","sourceRoot":"","sources":["../../src/commands/files.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// packages/cli/src/commands/files.test.ts
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, readFileSync } from 'node:fs';
|
|
4
|
+
import { tmpdir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { execSync } from 'node:child_process';
|
|
7
|
+
import { resolveFiles, formatFilesPretty } from './files.js';
|
|
8
|
+
function tmpRepoWith(files, gitignore) {
|
|
9
|
+
const dir = mkdtempSync(join(tmpdir(), 'pbcmd-'));
|
|
10
|
+
execSync('git init -q', { cwd: dir });
|
|
11
|
+
mkdirSync(join(dir, '.productbrain'), { recursive: true });
|
|
12
|
+
for (const [p, c] of Object.entries(files))
|
|
13
|
+
writeFileSync(join(dir, '.productbrain', p), c);
|
|
14
|
+
if (gitignore !== undefined)
|
|
15
|
+
writeFileSync(join(dir, '.gitignore'), gitignore);
|
|
16
|
+
return dir;
|
|
17
|
+
}
|
|
18
|
+
describe('resolveFiles', () => {
|
|
19
|
+
it('classifies present files and finds an exposed secret', async () => {
|
|
20
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}', 'soul.md': '#' }, '');
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
try {
|
|
23
|
+
process.chdir(dir);
|
|
24
|
+
const res = await resolveFiles({ fix: false, dryRun: false });
|
|
25
|
+
expect(res.git).toBe(true);
|
|
26
|
+
expect(res.files.find((f) => f.path === 'config.local.json').exposed).toBe(true);
|
|
27
|
+
expect(res.exposures.some((e) => e.path === 'config.local.json')).toBe(true);
|
|
28
|
+
// pretty output is legible: names the secret + the fix command
|
|
29
|
+
const pretty = formatFilesPretty(res);
|
|
30
|
+
expect(pretty).toMatch(/config\.local\.json/);
|
|
31
|
+
expect(pretty).toMatch(/pb files --fix/);
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
process.chdir(cwd);
|
|
35
|
+
rmSync(dir, { recursive: true, force: true });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
it('all-clear when the secret is gitignored', async () => {
|
|
39
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '.productbrain/config.local.json\n');
|
|
40
|
+
const cwd = process.cwd();
|
|
41
|
+
try {
|
|
42
|
+
process.chdir(dir);
|
|
43
|
+
const res = await resolveFiles({ fix: false, dryRun: false });
|
|
44
|
+
expect(res.exposures).toHaveLength(0);
|
|
45
|
+
expect(formatFilesPretty(res)).toMatch(/all present pb-owned files are gitignored/i);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
process.chdir(cwd);
|
|
49
|
+
rmSync(dir, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('resolveFiles --json shape + --fix', () => {
|
|
54
|
+
it('returns the documented --json schema', async () => {
|
|
55
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '');
|
|
56
|
+
const cwd = process.cwd();
|
|
57
|
+
try {
|
|
58
|
+
process.chdir(dir);
|
|
59
|
+
const res = await resolveFiles({ fix: false, dryRun: false });
|
|
60
|
+
expect(res).toHaveProperty('workspace');
|
|
61
|
+
expect(res).toHaveProperty('root');
|
|
62
|
+
expect(res).toHaveProperty('git');
|
|
63
|
+
expect(Array.isArray(res.files)).toBe(true);
|
|
64
|
+
expect(Array.isArray(res.exposures)).toBe(true);
|
|
65
|
+
const row = res.files[0];
|
|
66
|
+
expect(row).toMatchObject({
|
|
67
|
+
path: expect.any(String), kind: expect.any(String), writer: expect.any(String),
|
|
68
|
+
when: expect.any(String), present: expect.any(Boolean),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
process.chdir(cwd);
|
|
73
|
+
rmSync(dir, { recursive: true, force: true });
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
it('--fix --dry-run computes lines but writes nothing', async () => {
|
|
77
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '');
|
|
78
|
+
const cwd = process.cwd();
|
|
79
|
+
try {
|
|
80
|
+
process.chdir(dir);
|
|
81
|
+
const res = await resolveFiles({ fix: true, dryRun: true });
|
|
82
|
+
expect(res.fix.added).toContain('.productbrain/config.local.json');
|
|
83
|
+
// dry-run: .gitignore unchanged (still empty)
|
|
84
|
+
expect(readFileSync(join(dir, '.gitignore'), 'utf8')).not.toMatch(/config\.local\.json/);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
process.chdir(cwd);
|
|
88
|
+
rmSync(dir, { recursive: true, force: true });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
it('--fix actually seals the boundary (idempotent on re-run)', async () => {
|
|
92
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '');
|
|
93
|
+
const cwd = process.cwd();
|
|
94
|
+
try {
|
|
95
|
+
process.chdir(dir);
|
|
96
|
+
const first = await resolveFiles({ fix: true, dryRun: false });
|
|
97
|
+
expect(first.fix.added).toContain('.productbrain/config.local.json');
|
|
98
|
+
expect(first.exposures).toHaveLength(0); // recomputed post-write: no stale exposure in the same call
|
|
99
|
+
const second = await resolveFiles({ fix: true, dryRun: false });
|
|
100
|
+
expect(second.fix.added).not.toContain('.productbrain/config.local.json');
|
|
101
|
+
expect(second.exposures).toHaveLength(0); // now sealed
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
process.chdir(cwd);
|
|
105
|
+
rmSync(dir, { recursive: true, force: true });
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
it('nested root — fix refused message names <root>/.gitignore, not toplevel', async () => {
|
|
109
|
+
const dir = mkdtempSync(join(tmpdir(), 'pbcmd-nested-'));
|
|
110
|
+
const cwd = process.cwd();
|
|
111
|
+
try {
|
|
112
|
+
execSync('git init -q', { cwd: dir });
|
|
113
|
+
const sub = join(dir, 'sub');
|
|
114
|
+
mkdirSync(join(sub, '.productbrain'), { recursive: true });
|
|
115
|
+
writeFileSync(join(sub, '.productbrain', 'config.json'), '{}');
|
|
116
|
+
process.chdir(sub);
|
|
117
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
118
|
+
expect(res.fix.refused).toContain(sub + '/.gitignore');
|
|
119
|
+
expect(res.fix.refused).toContain('patterns are relative to that file');
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
process.chdir(cwd);
|
|
123
|
+
rmSync(dir, { recursive: true, force: true });
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
it('--fix reports a tracked+exposed secret as needing git rm --cached, not sealed', async () => {
|
|
127
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '.productbrain/config.local.json\n');
|
|
128
|
+
const cwd = process.cwd();
|
|
129
|
+
try {
|
|
130
|
+
// commit the secret so it is TRACKED despite the gitignore line
|
|
131
|
+
execSync('git add -f .productbrain/config.local.json', { cwd: dir });
|
|
132
|
+
execSync('git -c user.email=t@t -c user.name=t commit -qm seed', { cwd: dir });
|
|
133
|
+
process.chdir(dir);
|
|
134
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
135
|
+
expect(res.fix.trackedExposed).toContain('config.local.json');
|
|
136
|
+
expect(res.fix.added).not.toContain('.productbrain/config.local.json');
|
|
137
|
+
expect(formatFilesPretty(res)).toMatch(/git rm --cached/);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
process.chdir(cwd);
|
|
141
|
+
rmSync(dir, { recursive: true, force: true });
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
it('--fix reports stillExposed when a nested .productbrain/.gitignore negation overrides the root', async () => {
|
|
145
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, ''); // empty root .gitignore
|
|
146
|
+
const cwd = process.cwd();
|
|
147
|
+
try {
|
|
148
|
+
// nested negation un-ignores the secret; a root pattern cannot override it (git precedence)
|
|
149
|
+
writeFileSync(join(dir, '.productbrain', '.gitignore'), '!config.local.json\n');
|
|
150
|
+
process.chdir(dir);
|
|
151
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
152
|
+
expect(res.fix.stillExposed).toContain('.productbrain/config.local.json');
|
|
153
|
+
expect(formatFilesPretty(res)).toMatch(/still exposed/);
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
process.chdir(cwd);
|
|
157
|
+
rmSync(dir, { recursive: true, force: true });
|
|
158
|
+
}
|
|
159
|
+
}, 20000);
|
|
160
|
+
it('--fix writes the rule for a tracked+exposed secret AND flags git rm --cached (coherent output)', async () => {
|
|
161
|
+
// realistic bootstrap: the secret is committed BEFORE any .gitignore rule exists
|
|
162
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, ''); // empty root .gitignore
|
|
163
|
+
const cwd = process.cwd();
|
|
164
|
+
try {
|
|
165
|
+
execSync('git add -f .productbrain/config.local.json', { cwd: dir });
|
|
166
|
+
execSync('git -c user.email=t@t -c user.name=t commit -qm seed', { cwd: dir });
|
|
167
|
+
process.chdir(dir);
|
|
168
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
169
|
+
// the rule IS written — after `git rm --cached` it keeps the secret ignored (Codex: add the rule)
|
|
170
|
+
expect(res.fix.added).toContain('.productbrain/config.local.json');
|
|
171
|
+
expect(readFileSync(join(dir, '.gitignore'), 'utf8')).toMatch(/^\.productbrain\/config\.local\.json$/m);
|
|
172
|
+
// and the untrack step is surfaced — coherently, WITHOUT the old contradictory "will NOT remove"
|
|
173
|
+
expect(res.fix.trackedExposed).toContain('config.local.json');
|
|
174
|
+
const pretty = formatFilesPretty(res);
|
|
175
|
+
expect(pretty).toMatch(/Added to \.gitignore/);
|
|
176
|
+
expect(pretty).toMatch(/git rm --cached [^\n]*config\.local\.json/);
|
|
177
|
+
expect(pretty).not.toMatch(/will NOT remove/);
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
process.chdir(cwd);
|
|
181
|
+
rmSync(dir, { recursive: true, force: true });
|
|
182
|
+
}
|
|
183
|
+
}, 20000);
|
|
184
|
+
it('--fix does not duplicate a root line on repeat runs, and never prints a false all-clear', async () => {
|
|
185
|
+
const dir = tmpRepoWith({ 'config.local.json': '{}' }, '');
|
|
186
|
+
const cwd = process.cwd();
|
|
187
|
+
try {
|
|
188
|
+
writeFileSync(join(dir, '.productbrain', '.gitignore'), '!config.local.json\n');
|
|
189
|
+
process.chdir(dir);
|
|
190
|
+
await resolveFiles({ fix: true, dryRun: false });
|
|
191
|
+
const second = await resolveFiles({ fix: true, dryRun: false });
|
|
192
|
+
// still exposed (nested negation wins), but the root line is appended at most once
|
|
193
|
+
expect(second.fix.added).not.toContain('.productbrain/config.local.json');
|
|
194
|
+
expect(second.fix.stillExposed).toContain('.productbrain/config.local.json');
|
|
195
|
+
const gi = readFileSync(join(dir, '.gitignore'), 'utf8');
|
|
196
|
+
expect(gi.match(/^\.productbrain\/config\.local\.json$/gm) ?? []).toHaveLength(1);
|
|
197
|
+
// Codex: no "Nothing to fix — all gitignored" while a path remains exposed
|
|
198
|
+
const pretty = formatFilesPretty(second);
|
|
199
|
+
expect(pretty).not.toMatch(/Nothing to fix/);
|
|
200
|
+
expect(pretty).toMatch(/still exposed/);
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
process.chdir(cwd);
|
|
204
|
+
rmSync(dir, { recursive: true, force: true });
|
|
205
|
+
}
|
|
206
|
+
}, 20000);
|
|
207
|
+
it('--fix REPORTS (does not silently pass) an absent path a same-file negation keeps exposed', async () => {
|
|
208
|
+
// self-contradictory pair: the next preview.json write would be committable → must be surfaced
|
|
209
|
+
const dir = tmpRepoWith({}, '.productbrain/preview.json\n!.productbrain/preview.json\n');
|
|
210
|
+
const cwd = process.cwd();
|
|
211
|
+
try {
|
|
212
|
+
process.chdir(dir);
|
|
213
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
214
|
+
// the descriptor line is already present, so it isn't re-added; the residual exposure is reported
|
|
215
|
+
expect(res.fix.added).not.toContain('.productbrain/preview.json');
|
|
216
|
+
expect(res.fix.stillExposed).toContain('.productbrain/preview.json');
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
process.chdir(cwd);
|
|
220
|
+
rmSync(dir, { recursive: true, force: true });
|
|
221
|
+
}
|
|
222
|
+
}, 20000);
|
|
223
|
+
it('--fix uses -r --cached when a tracked exposed entry is a directory', async () => {
|
|
224
|
+
const dir = mkdtempSync(join(tmpdir(), 'pbcmd-dir-'));
|
|
225
|
+
const cwd = process.cwd();
|
|
226
|
+
try {
|
|
227
|
+
execSync('git init -q', { cwd: dir });
|
|
228
|
+
mkdirSync(join(dir, '.productbrain', 'drafts'), { recursive: true });
|
|
229
|
+
writeFileSync(join(dir, '.productbrain', 'drafts', 'foo.md'), 'x');
|
|
230
|
+
execSync('git add -f .productbrain/drafts/foo.md', { cwd: dir });
|
|
231
|
+
execSync('git -c user.email=t@t -c user.name=t commit -qm seed', { cwd: dir });
|
|
232
|
+
process.chdir(dir);
|
|
233
|
+
const res = await resolveFiles({ fix: true, dryRun: false });
|
|
234
|
+
expect(res.fix.trackedExposed).toContain('drafts/');
|
|
235
|
+
expect(formatFilesPretty(res)).toMatch(/git rm -r --cached/);
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
process.chdir(cwd);
|
|
239
|
+
rmSync(dir, { recursive: true, force: true });
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
//# sourceMappingURL=files.test.js.map
|
|
@@ -0,0 +1 @@
|
|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E,CAAC,CAAC;YACrE,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC;YACnE,QAAQ,CAAC,wCAAwC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;YACjE,QAAQ,CAAC,sDAAsD,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;YAC/E,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACnB,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YAC7D,MAAM,CAAC,GAAG,CAAC,GAAI,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACrD,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QAC/D,CAAC;gBAAS,CAAC;YAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -48,6 +48,7 @@ import { runWorkspaceVerify, runWorkspaceRepair, runDefinitionsDiff } from './co
|
|
|
48
48
|
import { runAuthorityDomainsActivateCutover, runAuthorityDomainsAdd, runAuthorityDomainsDeactivateCutover, runAuthorityDomainsBenchmark, runAuthorityDomainsDiscardPending, runAuthorityDomainsPropose, runAuthorityDomainsQueueTag, runAuthorityDomainsRatify, runAuthorityDomainsReadiness, runAuthorityDomainsRecordSample, runAuthorityDomainsReject, runAuthorityDomainsReview, runAuthorityDomainsPrincipleDistribution, } from './commands/authority-domains.js';
|
|
49
49
|
import { runDoctor } from './commands/doctor.js';
|
|
50
50
|
import { runWhoami } from './commands/whoami.js';
|
|
51
|
+
import { runFiles } from './commands/files.js';
|
|
51
52
|
import { runUpgrade } from './commands/upgrade.js';
|
|
52
53
|
import { runProfileList, runProfileCreate, runProfileUse, runProfileDelete } from './commands/profile.js';
|
|
53
54
|
import { runInit } from './commands/init.js';
|
|
@@ -494,6 +495,14 @@ program
|
|
|
494
495
|
.action(async () => {
|
|
495
496
|
await runWhoami();
|
|
496
497
|
});
|
|
498
|
+
program
|
|
499
|
+
.command('files')
|
|
500
|
+
.description('Show which .productbrain files are pb-owned vs committed, and what writes each.')
|
|
501
|
+
.option('--fix', 'Add any exposed pb-owned files to .gitignore (idempotent)')
|
|
502
|
+
.option('--dry-run', 'With --fix: preview the .gitignore lines without writing')
|
|
503
|
+
.action(async (opts) => {
|
|
504
|
+
await runFiles({ fix: opts.fix, dryRun: opts.dryRun });
|
|
505
|
+
});
|
|
497
506
|
program
|
|
498
507
|
.command('setup')
|
|
499
508
|
.description('Canonical pb-setup entry (DEC-995): detect surfaces, read state, emit JSON for the skill body.')
|