@nazty_labs/common-ground 0.5.1
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/LICENSE +21 -0
- package/README.md +64 -0
- package/SETUP.md +219 -0
- package/dist/access.d.ts +172 -0
- package/dist/access.js +175 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +198 -0
- package/dist/commands.d.ts +189 -0
- package/dist/commands.js +202 -0
- package/dist/discovery.d.ts +73 -0
- package/dist/discovery.js +417 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +22 -0
- package/dist/export.d.ts +14 -0
- package/dist/export.js +86 -0
- package/dist/guidance.d.ts +11 -0
- package/dist/guidance.js +75 -0
- package/dist/hooks.d.ts +4 -0
- package/dist/hooks.js +141 -0
- package/dist/init.d.ts +304 -0
- package/dist/init.js +150 -0
- package/dist/maintenance.d.ts +126 -0
- package/dist/maintenance.js +23 -0
- package/dist/matching.d.ts +17 -0
- package/dist/matching.js +32 -0
- package/dist/model.d.ts +974 -0
- package/dist/model.js +21 -0
- package/dist/navigation.d.ts +164 -0
- package/dist/navigation.js +164 -0
- package/dist/operations.d.ts +10 -0
- package/dist/operations.js +130 -0
- package/dist/paging.d.ts +5 -0
- package/dist/paging.js +32 -0
- package/dist/retrieval.d.ts +146 -0
- package/dist/retrieval.js +150 -0
- package/dist/review-files.d.ts +3 -0
- package/dist/review-files.js +106 -0
- package/dist/review.d.ts +86 -0
- package/dist/review.js +124 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.js +105 -0
- package/dist/source-search.d.ts +63 -0
- package/dist/source-search.js +245 -0
- package/dist/store.d.ts +452 -0
- package/dist/store.js +718 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/workflow.d.ts +450 -0
- package/dist/workflow.js +317 -0
- package/docs/architecture.md +65 -0
- package/docs/audit-0.4.0.md +42 -0
- package/docs/demo.md +42 -0
- package/docs/discovery.md +70 -0
- package/docs/knowledge-policy.md +51 -0
- package/docs/pillar-contract.md +98 -0
- package/docs/quiet-workflow.md +98 -0
- package/docs/releases.md +157 -0
- package/package.json +52 -0
- package/schemas/admission.schema.json +75 -0
- package/schemas/knowledge.schema.json +192 -0
- package/schemas/patch.schema.json +220 -0
- package/schemas/update.schema.json +218 -0
package/dist/commands.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
// CLI syntax only. Domain validation and execution live in operations.ts for both interfaces.
|
|
3
|
+
export const options = {
|
|
4
|
+
'skip-hook': { type: 'boolean', label: '--skip-hook', description: 'Finish repository setup without installing the advisory Git hook; install it later with cground hook install' },
|
|
5
|
+
both: { type: 'boolean', label: '--both', description: 'Include both CLI payload and MCP operation schemas' },
|
|
6
|
+
exclude: { type: 'string', label: '--exclude <paths>', description: 'Comma-separated repository-relative paths to exclude from discovery' },
|
|
7
|
+
verify: { type: 'boolean', label: '--verify', description: 'Check selected facts and upstream source freshness' },
|
|
8
|
+
review: { type: 'boolean', label: '--review', description: 'Include complete chapters and source/documentation paths before knowledge correction' },
|
|
9
|
+
stdin: { type: 'boolean', label: '--stdin', description: 'Read the JSON payload from stdin instead of a file' },
|
|
10
|
+
example: { type: 'boolean', label: '--example', description: 'Show a copyable JSON payload with help' },
|
|
11
|
+
verbose: { type: 'boolean', label: '--verbose', description: 'Include lookup matching diagnostics or complete mutation objects' },
|
|
12
|
+
'all-results': { type: 'boolean', label: '--all-results', description: 'Include passing validation rows' },
|
|
13
|
+
'dry-run': { type: 'boolean', label: '--dry-run', description: 'Preflight without writing knowledge or requiring approval' },
|
|
14
|
+
preflight: { type: 'string', label: '--preflight <token>', description: 'Token from the reviewed dry run; rejects source or payload changes' },
|
|
15
|
+
help: { type: 'boolean', short: 'h', label: '-h, --help', description: 'Show help without running the command' },
|
|
16
|
+
version: { type: 'boolean', short: 'V', label: '-V, --version', description: 'Show the installed version' },
|
|
17
|
+
root: { type: 'string', label: '--root <path>', description: 'Repository root (default: current directory)' },
|
|
18
|
+
json: { type: 'boolean', label: '--json', description: 'Return JSON; never prompt for input' },
|
|
19
|
+
cursor: { type: 'string', label: '--cursor <token>', description: 'Continue a paginated result' },
|
|
20
|
+
limit: { type: 'string', label: '--limit <1..20>', description: 'Maximum records per page (default: 10; search: 8)' },
|
|
21
|
+
staged: { type: 'boolean', label: '--staged', description: 'Review staged knowledge instead of the working file' },
|
|
22
|
+
evidence: { type: 'boolean', label: '--evidence', description: 'Include exact changed evidence quotes in the review' },
|
|
23
|
+
cleanup: { type: 'string', label: '--cleanup <y|n>', description: 'Start or decline agent-led cleanup when stale' },
|
|
24
|
+
approve: { type: 'boolean', label: '--approve', description: 'Declare explicit developer approval of the proposed content' },
|
|
25
|
+
path: { type: 'string', label: '--path <path>', description: 'Repository-relative source path for ownership routing' },
|
|
26
|
+
signal: { type: 'string', label: '--signal <text>', description: 'Short symptom or routing hint' },
|
|
27
|
+
touched: { type: 'string', label: '--touched <paths>', description: 'Comma-separated paths touched by this task; empty means none' },
|
|
28
|
+
chapter: { type: 'string', label: '--chapter <id>', description: 'Restrict search to pillar/chapter' },
|
|
29
|
+
facts: { type: 'string', label: '--facts <ids>', description: 'Comma-separated fact IDs to review' },
|
|
30
|
+
profile: { type: 'string', label: '--profile <compact|full>', description: 'MCP tool profile (default: compact)' },
|
|
31
|
+
'standalone-reason': { type: 'string', label: '--standalone-reason <text>', description: 'Why an additional pillar owns an uncovered responsibility' },
|
|
32
|
+
};
|
|
33
|
+
const paging = ['cursor', 'limit'];
|
|
34
|
+
const define = (name, args, description, flags, example, group = 'Agent workflows') => ({ name, operation: name.replace(' ', '-'), arguments: args, description, flags, example, group });
|
|
35
|
+
export const commands = [
|
|
36
|
+
define('lookup', '[query...]', 'Find compact facts, coverage and navigation without task bookkeeping', ['path', 'verify', 'verbose', 'limit', 'cursor'], 'cground lookup --path src/runtime.ts', 'Everyday'),
|
|
37
|
+
define('source-search', '<query...>', 'Search explicit source paths for live evidence, separately from stored facts', ['path', 'limit'], 'cground source-search "version 1.4" --path src', 'Navigation'),
|
|
38
|
+
define('assess', '', 'Check actual task changes; expand review only when needed', ['touched', 'review', ...paging], 'cground assess --touched src/runtime.ts', 'Everyday'),
|
|
39
|
+
define('init', '', 'Set up guidance, MCP, local Markdown and advisory Git hook', ['skip-hook'], 'cground init', 'Everyday'),
|
|
40
|
+
define('check', '[target]', 'Check all knowledge or one pillar, chapter or fact', ['cleanup', 'all-results', ...paging], 'cground check cicd --cleanup n', 'Everyday'),
|
|
41
|
+
define('validate', '[target]', 'Alias of check: validate structure, evidence and freshness', ['cleanup', 'all-results', ...paging], 'cground validate all --json', 'Everyday'),
|
|
42
|
+
define('tidy', '<target>', 'Plan developer-requested cleanup; agent verifies and applies it', paging, 'cground tidy all', 'Everyday'),
|
|
43
|
+
define('review', '[target]', 'Summarize knowledge changes for agent-led human review', ['staged', 'evidence', ...paging], 'cground review --staged', 'Everyday'),
|
|
44
|
+
define('export', '', 'Refresh .common-ground/local/knowledge.md', [], 'cground export', 'Everyday'),
|
|
45
|
+
define('refresh-guidance', '', 'Refresh managed instructions without changing knowledge, MCP configuration or hooks', [], 'cground refresh-guidance', 'Everyday'),
|
|
46
|
+
define('doctor', '', 'Check repository setup and registry health', [], 'cground doctor', 'Everyday'),
|
|
47
|
+
define('hook check', '', 'Run the advisory staged-index check; never block commits', [], 'cground hook check', 'Everyday'),
|
|
48
|
+
define('hook install', '', 'Install the advisory hook or explain existing hook integration', [], 'cground hook install', 'Everyday'),
|
|
49
|
+
define('hook mute', '', 'Suppress pre-commit reminders in this checkout', [], 'cground hook mute', 'Everyday'),
|
|
50
|
+
define('hook unmute', '', 'Restore pre-commit reminders in this checkout', [], 'cground hook unmute', 'Everyday'),
|
|
51
|
+
define('serve', '', 'Start the local stdio MCP server', ['profile'], 'cground serve --root /path/to/repo', 'Everyday'),
|
|
52
|
+
define('list', '', 'List pillars', paging, 'cground list', 'Navigation'),
|
|
53
|
+
define('chapters', '<pillar>', 'List chapters in a pillar', paging, 'cground chapters cicd', 'Navigation'),
|
|
54
|
+
define('read', '<chapter>', 'Read a chapter in pages', paging, 'cground read cicd/pipelines', 'Navigation'),
|
|
55
|
+
define('fact', '<chapter> <fact>', 'Read one fact with its exact evidence', [], 'cground fact cicd/pipelines build', 'Navigation'),
|
|
56
|
+
define('search', '<query...>', 'Find relevant fact summaries', ['chapter', 'limit'], 'cground search build pipeline', 'Navigation'),
|
|
57
|
+
define('start', '[signal...]', 'Route from a symptom or source path', ['path', 'signal', ...paging], 'cground start "build failed"', 'Navigation'),
|
|
58
|
+
define('owners', '[signal...]', 'Find candidate owners for a source path or symptom', ['path', 'signal', ...paging], 'cground owners --path src/build.ts', 'Navigation'),
|
|
59
|
+
define('graph', '[pillar]', 'Read recorded pillar dependencies', paging, 'cground graph cicd', 'Navigation'),
|
|
60
|
+
define('schema', '<operation>', 'Show the CLI payload schema; --both also includes MCP arguments', ['both'], 'cground schema seed'),
|
|
61
|
+
define('bootstrap', '<plan.json>', 'Preflight and publish an initial map and fact batches together', ['stdin', 'dry-run', 'preflight'], 'cground bootstrap bootstrap.json --dry-run'),
|
|
62
|
+
define('seed-batch', '<batch.json>', 'Preflight and populate several approved empty chapters atomically', ['stdin', 'dry-run', 'preflight'], 'cground seed-batch batch.json --dry-run'),
|
|
63
|
+
define('scan', '', 'Discover a proposed responsibility map; does not approve it', ['exclude'], 'cground scan'),
|
|
64
|
+
define('approve', '<plan.json>', 'Create developer-approved pillar definitions', ['approve', 'standalone-reason'], 'cground approve .common-ground/local/bootstrap.json --approve'),
|
|
65
|
+
define('approve-chapters', '<pillar> <plan.json>', 'Add developer-approved chapters', ['approve'], 'cground approve-chapters cicd chapters.json --approve'),
|
|
66
|
+
define('seed', '<chapter> <facts.json>', 'Populate an approved empty chapter', ['approve'], 'cground seed cicd/pipelines facts.json --approve'),
|
|
67
|
+
define('admit', '<chapter> <facts.json>', 'Admit developer-approved facts to a chapter', ['approve'], 'cground admit cicd/pipelines facts.json --approve'),
|
|
68
|
+
define('migrate', '', 'Migrate schema-v1 knowledge after approval', ['approve'], 'cground migrate --approve'),
|
|
69
|
+
define('task start', '', 'Start a local task context', ['touched', 'signal'], 'cground task start --touched src/build.ts'),
|
|
70
|
+
define('task assess', '<task-id>', 'Assess the paths this task actually touched', ['touched', ...paging], 'cground task assess TASK_ID --touched src/build.ts'),
|
|
71
|
+
define('task finish', '<task-id>', 'Finish a task and collect corrections and pending approvals', paging, 'cground task finish TASK_ID'),
|
|
72
|
+
define('read-knowledge', '<request.json>', 'Read structured knowledge, drafts or review checklists', [], 'cground read-knowledge request.json'),
|
|
73
|
+
define('review-plan', '<chapter>', 'Find all linked chapters that require review', ['facts'], 'cground review-plan cicd/pipelines'),
|
|
74
|
+
define('review-checklist', '[chapters...]', 'List evidence and documentation to read this session', ['touched', ...paging], 'cground review-checklist cicd/pipelines'),
|
|
75
|
+
define('prepare-patch', '<patch.json>', 'Prepare verified changes to existing facts', [], 'cground prepare-patch patch.json'),
|
|
76
|
+
define('prepare', '<update.json>', 'Prepare a complete multi-chapter review transaction', [], 'cground prepare update.json'),
|
|
77
|
+
define('commit', '<proposal-id>', 'Apply a prepared knowledge transaction (not a Git commit)', [], 'cground commit PROPOSAL_ID'),
|
|
78
|
+
define('propose-facts', '<task-id> <chapter> <facts.json>', 'Queue new facts locally for developer review', [], 'cground propose-facts TASK_ID cicd/pipelines facts.json'),
|
|
79
|
+
define('drop-facts', '<task-id> <facts...>', 'Discard selected local proposals by qualified fact ID', [], 'cground drop-facts TASK_ID cicd/pipelines/build'),
|
|
80
|
+
define('accept-facts', '<task-id> <review.json>', 'Admit the developer-approved finished-task batch', ['approve'], 'cground accept-facts TASK_ID review.json --approve'),
|
|
81
|
+
];
|
|
82
|
+
for (const command of commands) {
|
|
83
|
+
if (command.arguments.includes('.json>'))
|
|
84
|
+
command.flags.push('stdin');
|
|
85
|
+
if (['approve', 'approve-chapters', 'seed', 'admit'].includes(command.name))
|
|
86
|
+
command.flags.push('verbose');
|
|
87
|
+
if (['bootstrap', 'seed-batch'].includes(command.name))
|
|
88
|
+
command.flags.push('approve');
|
|
89
|
+
command.flags = [...new Set(command.flags)];
|
|
90
|
+
}
|
|
91
|
+
export const factExample = { id: 'runtime-mode', statement: 'The runtime uses the first mode.', evidence: [{ path: 'src/runtime.ts', quote: 'mode = "first"' }], sourceScope: ['src'], dependsOn: [] };
|
|
92
|
+
export const payloadExamples = { seed: [factExample], admit: [factExample],
|
|
93
|
+
'seed-batch': { batches: [{ chapterId: 'runtime/overview', facts: [factExample] }] },
|
|
94
|
+
bootstrap: { pillars: [{ id: 'runtime', title: 'Runtime', scope: 'Application runtime behavior.', excludes: 'Build tooling.', chapters: [{ id: 'overview', title: 'Overview', scope: 'Application runtime behavior.', excludes: 'Build tooling.', paths: ['src'] }] }], batches: [{ chapterId: 'runtime/overview', facts: [factExample] }] } };
|
|
95
|
+
const usageError = (code, message, fields, recovery) => Object.assign(new Error(message), { code, fields, recovery });
|
|
96
|
+
export function parseCommand(argv) {
|
|
97
|
+
const parsed = (() => {
|
|
98
|
+
try {
|
|
99
|
+
return parseArgs({ args: argv, options, allowPositionals: true, strict: true });
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
const failure = error;
|
|
103
|
+
throw usageError(failure.code === 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE' ? 'INVALID_OPTION_VALUE' : failure.code ?? 'INVALID_ARGUMENT', failure.message, failure.message.match(/--[a-z][a-z-]*/g) ?? [], 'Check the named option and its value using cground <command> --help.');
|
|
104
|
+
}
|
|
105
|
+
})();
|
|
106
|
+
const values = parsed.values;
|
|
107
|
+
const words = [...parsed.positionals];
|
|
108
|
+
const help = values.help === true || words[0] === 'help';
|
|
109
|
+
if (words[0] === 'help')
|
|
110
|
+
words.shift();
|
|
111
|
+
const name = ['hook', 'task'].includes(words[0]) ? words.splice(0, Math.min(2, words.length)).join(' ') : words.shift();
|
|
112
|
+
if (!name) {
|
|
113
|
+
if (words.length)
|
|
114
|
+
throw new Error('Unexpected arguments.');
|
|
115
|
+
for (const flag of Object.keys(values))
|
|
116
|
+
if (!['help', 'version', 'root', 'json'].includes(flag))
|
|
117
|
+
throw new Error(`Option --${flag} requires a command.`);
|
|
118
|
+
return { values, help: !values.version || help, command: undefined, positionals: [], group: undefined };
|
|
119
|
+
}
|
|
120
|
+
if (values.version)
|
|
121
|
+
throw new Error('Use cground --version without a command.');
|
|
122
|
+
if (['hook', 'task'].includes(name)) {
|
|
123
|
+
for (const flag of Object.keys(values))
|
|
124
|
+
if (!['help', 'root', 'json'].includes(flag))
|
|
125
|
+
throw new Error(`Option --${flag} requires a ${name} subcommand.`);
|
|
126
|
+
return { values, help: true, command: undefined, positionals: [], group: name };
|
|
127
|
+
}
|
|
128
|
+
const command = commands.find(c => c.name === name);
|
|
129
|
+
if (!command)
|
|
130
|
+
throw usageError('UNKNOWN_COMMAND', `Unknown command "${name}". Run cground --help.`, [name], 'Run cground --help and choose a listed command.');
|
|
131
|
+
for (const flag of Object.keys(values))
|
|
132
|
+
if (!['help', 'root', 'json', 'example', ...command.flags].includes(flag))
|
|
133
|
+
throw new Error(`Option --${flag} is not supported by ${name}. Run cground ${name} --help.`);
|
|
134
|
+
if (values.example && !help)
|
|
135
|
+
throw new Error('Use --example with --help.');
|
|
136
|
+
if (!help) {
|
|
137
|
+
if (values.stdin) {
|
|
138
|
+
const expected = command.arguments.split(' ').filter(Boolean).length;
|
|
139
|
+
if (words.length !== expected - 1)
|
|
140
|
+
throw new Error('Use --stdin instead of the JSON filename.');
|
|
141
|
+
words.push('-');
|
|
142
|
+
}
|
|
143
|
+
const args = command.arguments.split(' ').filter(Boolean), minimum = args.filter(a => a.startsWith('<')).length;
|
|
144
|
+
const maximum = args.some(a => a.includes('...')) ? Infinity : args.length;
|
|
145
|
+
if (words.length < minimum || words.length > maximum)
|
|
146
|
+
throw new Error(`Usage: cground ${name} ${command.arguments}. Run cground ${name} --help.`);
|
|
147
|
+
if (['assess', 'task assess'].includes(name) && values.touched === undefined)
|
|
148
|
+
throw new Error('Supply --touched for actual task paths.');
|
|
149
|
+
const maxLimit = ['lookup', 'source-search'].includes(name) ? 5 : 20;
|
|
150
|
+
if (values.limit !== undefined && (!/^\d+$/.test(String(values.limit)) || Number(values.limit) < 1 || Number(values.limit) > maxLimit))
|
|
151
|
+
throw usageError('INVALID_OPTION_VALUE', `--limit must be an integer from 1 to ${maxLimit}.`, ['--limit'], `Supply --limit with an integer from 1 to ${maxLimit}.`);
|
|
152
|
+
if (values.cleanup !== undefined && !['y', 'n'].includes(String(values.cleanup).toLowerCase()))
|
|
153
|
+
throw usageError('INVALID_OPTION_VALUE', 'Use --cleanup y or --cleanup n.', ['--cleanup'], 'Choose y or n for --cleanup.');
|
|
154
|
+
if (values.profile !== undefined && !['compact', 'full'].includes(String(values.profile)))
|
|
155
|
+
throw usageError('INVALID_OPTION_VALUE', 'Use --profile compact or --profile full.', ['--profile'], 'Choose compact or full for --profile.');
|
|
156
|
+
}
|
|
157
|
+
return { values, help, command, positionals: words, group: undefined };
|
|
158
|
+
}
|
|
159
|
+
export function helpText(command, group) {
|
|
160
|
+
const lines = command ? [`Usage: cground ${command.name}${command.arguments ? ' ' + command.arguments : ''} [options]`, '', command.description, '']
|
|
161
|
+
: [`Common Ground — shared, Git-backed repository knowledge`, '', `Usage: cground ${group ? group + ' ' : ''}<command> [options]`, ''];
|
|
162
|
+
if (!command)
|
|
163
|
+
for (const category of ['Everyday', 'Navigation', 'Agent workflows']) {
|
|
164
|
+
const selected = commands.filter(c => (!group || c.name.startsWith(group + ' ')) && c.group === category);
|
|
165
|
+
if (selected.length)
|
|
166
|
+
lines.push(`${category}:`, ...selected.map(c => ` ${(c.name + ' ' + c.arguments).trim().padEnd(47)} ${c.description}`), '');
|
|
167
|
+
}
|
|
168
|
+
const flags = ['help', 'root', 'json', ...(command && payloadExamples[command.name] ? ['example'] : []), ...(command?.flags ?? (!group ? ['version'] : []))];
|
|
169
|
+
lines.push('Options:', ...flags.map(flag => {
|
|
170
|
+
const option = flag === 'limit' && command && ['lookup', 'source-search'].includes(command.name)
|
|
171
|
+
? { label: '--limit <1..5>', description: 'Maximum returned results (default: 5)' }
|
|
172
|
+
: flag === 'path' && command?.name === 'source-search'
|
|
173
|
+
? { label: '--path <paths>', description: 'Required files or directories to search, comma-separated and repository-relative' }
|
|
174
|
+
: options[flag];
|
|
175
|
+
return ` ${option.label.padEnd(32)} ${option.description}`;
|
|
176
|
+
}), '');
|
|
177
|
+
if (command) {
|
|
178
|
+
lines.push('Example:', ` ${command.example}`, '');
|
|
179
|
+
if (command.name !== 'serve')
|
|
180
|
+
lines.push(`Input schema: cground schema ${command.operation}`);
|
|
181
|
+
if (payloadExamples[command.name])
|
|
182
|
+
lines.push('JSON payload (replace synthetic paths and quotes with verified source):', JSON.stringify(payloadExamples[command.name], null, 2), '');
|
|
183
|
+
if (command.flags.includes('stdin'))
|
|
184
|
+
lines.push('Use --stdin instead of the JSON filename, or use - as the filename.', '');
|
|
185
|
+
}
|
|
186
|
+
else
|
|
187
|
+
lines.push('Get started: cground init → review the proposed knowledge with your agent → cground check', 'Help: cground <command> --help, cground help <command>, cground hook --help', '');
|
|
188
|
+
if (command && ['seed', 'admit', 'bootstrap', 'prepare-patch'].includes(command.name))
|
|
189
|
+
lines.push('sourceScope stays within the owning chapter paths. Supporting evidence may cross ownership boundaries: for a chapter owning src, use sourceScope:["src"] with evidence:[{path:"shared/config.ts",quote:"mode = 1"}]. External evidence is tracked automatically; do not add shared/config.ts to sourceScope.', '');
|
|
190
|
+
if (command?.name === 'lookup')
|
|
191
|
+
lines.push('Default: compact stored facts and explicit weak coverage; freshness is not checked. Use --verify for fact freshness and --verbose for matching diagnostics. Source-search suggestions are not executed.', '');
|
|
192
|
+
if (command?.name === 'source-search')
|
|
193
|
+
lines.push('Requires --path FILE_OR_DIRECTORY (or comma-separated scopes). Reads bounded live source; results are separate from stored facts and never write knowledge.', '');
|
|
194
|
+
if (command?.name === 'assess')
|
|
195
|
+
lines.push('No task start or finish required. No local/shared writes. Use --review only when a correction needs whole-chapter review.', '');
|
|
196
|
+
if (command && ['check', 'validate', 'tidy'].includes(command.name))
|
|
197
|
+
lines.push('Targets: all, pillar, pillar/chapter, pillar/chapter/fact, or a unique fact ID.', 'Cleanup returns a plan and tidyId. Your agent must read source and submit verified corrections.', 'Check/validate exit 1 while stale or unpopulated, even after cleanup is accepted.', '');
|
|
198
|
+
if (command?.flags.includes('approve'))
|
|
199
|
+
lines.push('Approval flags declare developer direction; they do not grant autonomous agent permission.', '');
|
|
200
|
+
lines.push('Terminal: concise summaries where available. Pipes or --json: structured results.', 'Exit codes: 0 success; 1 needs attention or command failed. Git hook checks are advisory.');
|
|
201
|
+
return lines.join('\n');
|
|
202
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Store } from './store.js';
|
|
2
|
+
type Detection = {
|
|
3
|
+
root: string;
|
|
4
|
+
technologies: string[];
|
|
5
|
+
evidence: string[];
|
|
6
|
+
evidenceCount: number;
|
|
7
|
+
chapterId: string;
|
|
8
|
+
pathHintCount: number;
|
|
9
|
+
pathsTruncated: boolean;
|
|
10
|
+
matchedFileCount: number;
|
|
11
|
+
ownershipCoverage: 'incomplete' | 'scanned-files';
|
|
12
|
+
rationale: string;
|
|
13
|
+
directoryHints: string[];
|
|
14
|
+
};
|
|
15
|
+
export declare function discover(store: Store, exclude?: string[]): Promise<{
|
|
16
|
+
schemaVersion: number;
|
|
17
|
+
requiresDeveloperApproval: boolean;
|
|
18
|
+
scan: {
|
|
19
|
+
inspectedFiles: number;
|
|
20
|
+
inspectedEntries: number;
|
|
21
|
+
truncated: boolean;
|
|
22
|
+
limit: number;
|
|
23
|
+
excludedPaths: string[];
|
|
24
|
+
skipped: {
|
|
25
|
+
path: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
}[];
|
|
28
|
+
skippedCount: number;
|
|
29
|
+
manifestBytesRead: number;
|
|
30
|
+
manifestByteLimit: number;
|
|
31
|
+
};
|
|
32
|
+
pillars: {
|
|
33
|
+
id: string;
|
|
34
|
+
title: string;
|
|
35
|
+
scope: string;
|
|
36
|
+
excludes: string;
|
|
37
|
+
chapters: {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
scope: string;
|
|
41
|
+
excludes: string;
|
|
42
|
+
paths: string[];
|
|
43
|
+
}[];
|
|
44
|
+
}[];
|
|
45
|
+
detections: Detection[];
|
|
46
|
+
detectedProjectCount: number;
|
|
47
|
+
projectsTruncated: boolean;
|
|
48
|
+
responsibilityHints: {
|
|
49
|
+
responsibility: string;
|
|
50
|
+
paths: string[];
|
|
51
|
+
pathCount: number;
|
|
52
|
+
pathsTruncated: boolean;
|
|
53
|
+
rationale: string;
|
|
54
|
+
}[];
|
|
55
|
+
ownershipIncomplete: boolean;
|
|
56
|
+
next: string;
|
|
57
|
+
coveragePrompts: {
|
|
58
|
+
responsibility: string;
|
|
59
|
+
paths: string[];
|
|
60
|
+
pathCount: number;
|
|
61
|
+
pathsTruncated: boolean;
|
|
62
|
+
questions: string[];
|
|
63
|
+
basis: string;
|
|
64
|
+
}[];
|
|
65
|
+
warnings: {
|
|
66
|
+
path: string;
|
|
67
|
+
reason: string;
|
|
68
|
+
}[];
|
|
69
|
+
warningCount: number;
|
|
70
|
+
unclassifiedSample: string[];
|
|
71
|
+
note: string;
|
|
72
|
+
}>;
|
|
73
|
+
export {};
|