@open-agent-toolkit/cli 0.1.72 → 0.1.74
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/README.md +1 -0
- package/assets/config/dispatch-matrix-recommendation.json +13 -17
- package/assets/docs/cli-utilities/configuration.md +42 -60
- package/assets/docs/cli-utilities/index.md +1 -0
- package/assets/docs/cli-utilities/project-log.md +183 -0
- package/assets/docs/cli-utilities/workflow-gates.md +38 -2
- package/assets/docs/provider-sync/providers.md +15 -17
- package/assets/docs/reference/cli-reference.md +1 -0
- package/assets/docs/workflows/projects/artifacts.md +1 -1
- package/assets/docs/workflows/projects/dispatch-ceiling.md +29 -33
- package/assets/docs/workflows/projects/implementation-execution.md +7 -4
- package/assets/docs/workflows/projects/lifecycle.md +4 -3
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-dispatch-subagents/SKILL.md +1 -1
- package/assets/skills/oat-dispatch-subagents/references/provider-cursor.md +27 -15
- package/assets/skills/oat-project-autonomous/SKILL.md +1 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +4 -3
- package/assets/skills/oat-project-complete/SKILL.md +60 -1
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +4 -3
- package/assets/skills/oat-project-implement/SKILL.md +18 -2
- package/assets/skills/oat-project-implement/references/completion-and-closeout.md +17 -15
- package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +15 -9
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +4 -3
- package/assets/skills/oat-project-implement/references/phase-execution.md +11 -5
- package/assets/skills/oat-project-import-plan/SKILL.md +30 -8
- package/assets/skills/oat-project-plan/SKILL.md +30 -8
- package/assets/skills/oat-project-plan-writing/SKILL.md +12 -9
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +4 -3
- package/assets/skills/oat-project-quick-start/SKILL.md +30 -8
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +4 -3
- package/assets/skills/oat-project-review-provide/SKILL.md +19 -11
- package/assets/skills/oat-project-review-provide-remote/SKILL.md +27 -4
- package/assets/skills/oat-project-summary/SKILL.md +122 -18
- package/assets/templates/project-log.md +47 -0
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +41 -0
- package/dist/commands/doctor/index.d.ts +2 -1
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +37 -1
- package/dist/commands/gate/index.d.ts +3 -1
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +134 -7
- package/dist/commands/init/index.d.ts +1 -1
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +40 -8
- package/dist/commands/init/tools/shared/skill-manifest.d.ts +1 -1
- package/dist/commands/init/tools/shared/skill-manifest.d.ts.map +1 -1
- package/dist/commands/init/tools/shared/skill-manifest.js +1 -0
- package/dist/commands/project/dispatch-ceiling/index.d.ts.map +1 -1
- package/dist/commands/project/dispatch-ceiling/index.js +17 -9
- package/dist/commands/project/index.d.ts.map +1 -1
- package/dist/commands/project/index.js +2 -0
- package/dist/commands/project/log/append.d.ts +41 -0
- package/dist/commands/project/log/append.d.ts.map +1 -0
- package/dist/commands/project/log/append.js +241 -0
- package/dist/commands/project/log/check.d.ts +66 -0
- package/dist/commands/project/log/check.d.ts.map +1 -0
- package/dist/commands/project/log/check.js +194 -0
- package/dist/commands/project/log/grammar.d.ts +28 -0
- package/dist/commands/project/log/grammar.d.ts.map +1 -0
- package/dist/commands/project/log/grammar.js +31 -0
- package/dist/commands/project/log/index.d.ts +9 -0
- package/dist/commands/project/log/index.d.ts.map +1 -0
- package/dist/commands/project/log/index.js +13 -0
- package/dist/commands/project/log/rollup.d.ts +40 -0
- package/dist/commands/project/log/rollup.d.ts.map +1 -0
- package/dist/commands/project/log/rollup.js +203 -0
- package/dist/commands/project/log/synthesize.d.ts +23 -0
- package/dist/commands/project/log/synthesize.d.ts.map +1 -0
- package/dist/commands/project/log/synthesize.js +112 -0
- package/dist/commands/project/new/index.d.ts +1 -0
- package/dist/commands/project/new/index.d.ts.map +1 -1
- package/dist/commands/project/new/index.js +7 -0
- package/dist/commands/project/new/scaffold.d.ts +1 -0
- package/dist/commands/project/new/scaffold.d.ts.map +1 -1
- package/dist/commands/project/new/scaffold.js +24 -0
- package/dist/commands/shared/codex-strays.d.ts +9 -0
- package/dist/commands/shared/codex-strays.d.ts.map +1 -1
- package/dist/commands/shared/codex-strays.js +4 -0
- package/dist/commands/status/index.d.ts +7 -1
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +53 -17
- package/dist/commands/sync/apply.d.ts.map +1 -1
- package/dist/commands/sync/apply.js +50 -24
- package/dist/commands/sync/dry-run.d.ts.map +1 -1
- package/dist/commands/sync/dry-run.js +31 -18
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +34 -25
- package/dist/commands/sync/sync.types.d.ts +26 -11
- package/dist/commands/sync/sync.types.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.js +3 -2
- package/dist/config/oat-config.d.ts +3 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +7 -0
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +2 -0
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.d.ts.map +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/scanner.d.ts +3 -1
- package/dist/engine/scanner.d.ts.map +1 -1
- package/dist/engine/scanner.js +4 -2
- package/dist/providers/ceiling/registry.d.ts +2 -0
- package/dist/providers/ceiling/registry.d.ts.map +1 -1
- package/dist/providers/ceiling/registry.js +20 -4
- package/dist/providers/codex/codec/sync-extension.d.ts +11 -10
- package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
- package/dist/providers/codex/codec/sync-extension.js +42 -14
- package/dist/providers/cursor/codec/catalog.d.ts +18 -0
- package/dist/providers/cursor/codec/catalog.d.ts.map +1 -0
- package/dist/providers/cursor/codec/catalog.js +39 -0
- package/dist/providers/cursor/codec/materialize.d.ts +24 -0
- package/dist/providers/cursor/codec/materialize.d.ts.map +1 -0
- package/dist/providers/cursor/codec/materialize.js +166 -0
- package/dist/providers/cursor/codec/shared.d.ts +14 -0
- package/dist/providers/cursor/codec/shared.d.ts.map +1 -0
- package/dist/providers/cursor/codec/shared.js +76 -0
- package/dist/providers/cursor/codec/sync-extension.d.ts +37 -0
- package/dist/providers/cursor/codec/sync-extension.d.ts.map +1 -0
- package/dist/providers/cursor/codec/sync-extension.js +393 -0
- package/dist/providers/cursor/index.d.ts +3 -0
- package/dist/providers/cursor/index.d.ts.map +1 -1
- package/dist/providers/cursor/index.js +3 -0
- package/dist/providers/identity/availability.d.ts +7 -0
- package/dist/providers/identity/availability.d.ts.map +1 -1
- package/dist/providers/identity/availability.js +23 -0
- package/dist/providers/shared/index.d.ts +2 -0
- package/dist/providers/shared/index.d.ts.map +1 -1
- package/dist/providers/shared/index.js +1 -0
- package/dist/providers/shared/materialization-extension.d.ts +44 -0
- package/dist/providers/shared/materialization-extension.d.ts.map +1 -0
- package/dist/providers/shared/materialization-extension.js +26 -0
- package/package.json +2 -2
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
4
|
+
import { buildCommandContext, } from '../../../app/command-context.js';
|
|
5
|
+
import { readGlobalOptions } from '../../shared/shared.utils.js';
|
|
6
|
+
import { resolveActiveProject, } from '../../../config/oat-config.js';
|
|
7
|
+
import { resolveEffectiveConfig } from '../../../config/resolve.js';
|
|
8
|
+
import { dirExists, fileExists } from '../../../fs/io.js';
|
|
9
|
+
import { resolveProjectRoot } from '../../../fs/paths.js';
|
|
10
|
+
import { Command } from 'commander';
|
|
11
|
+
import { parseProjectLogEntries, PROJECT_LOG_FILENAME, } from './check.js';
|
|
12
|
+
const DEFAULT_LEDGER_PATH = '.oat/repo/reference/project-observations.md';
|
|
13
|
+
const WORKFLOW_OBSERVATIONS_HEADING = '## Workflow Observations';
|
|
14
|
+
export const DEFAULT_PROJECT_LOG_ARTIFACT_TARGET = {
|
|
15
|
+
filename: PROJECT_LOG_FILENAME,
|
|
16
|
+
summaryHeading: WORKFLOW_OBSERVATIONS_HEADING,
|
|
17
|
+
};
|
|
18
|
+
const DEFAULT_ROLLUP_DEPENDENCIES = {
|
|
19
|
+
resolveActiveProject,
|
|
20
|
+
resolveEffectiveConfig,
|
|
21
|
+
};
|
|
22
|
+
const DEFAULT_COMMAND_DEPENDENCIES = {
|
|
23
|
+
...DEFAULT_ROLLUP_DEPENDENCIES,
|
|
24
|
+
buildCommandContext,
|
|
25
|
+
resolveProjectRoot,
|
|
26
|
+
};
|
|
27
|
+
async function resolveTargetProject(input, dependencies) {
|
|
28
|
+
if (input.project) {
|
|
29
|
+
const projectPath = isAbsolute(input.project)
|
|
30
|
+
? resolve(input.project)
|
|
31
|
+
: resolve(input.repoRoot, input.project);
|
|
32
|
+
if (!(await dirExists(projectPath)) ||
|
|
33
|
+
!(await fileExists(join(projectPath, 'state.md')))) {
|
|
34
|
+
throw new Error(`Project path is missing or invalid: ${input.project}. Pass --project <path> for a directory containing state.md.`);
|
|
35
|
+
}
|
|
36
|
+
return projectPath;
|
|
37
|
+
}
|
|
38
|
+
const active = await dependencies.resolveActiveProject(input.repoRoot);
|
|
39
|
+
if (active.status !== 'active' || !active.path) {
|
|
40
|
+
throw new Error('No active project resolves. Set activeProject or pass --project <path>.');
|
|
41
|
+
}
|
|
42
|
+
return resolve(input.repoRoot, active.path);
|
|
43
|
+
}
|
|
44
|
+
function renderEntries(entries) {
|
|
45
|
+
return entries
|
|
46
|
+
.map((entry) => entry.body ? `${entry.heading}\n\n${entry.body}` : entry.heading)
|
|
47
|
+
.join('\n\n');
|
|
48
|
+
}
|
|
49
|
+
function writeSummarySection(content, heading, body) {
|
|
50
|
+
const escapedHeading = heading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
51
|
+
const marker = new RegExp(`^${escapedHeading}\\s*$`, 'm').exec(content);
|
|
52
|
+
const section = `${heading}\n\n${body}\n`;
|
|
53
|
+
if (!marker) {
|
|
54
|
+
return {
|
|
55
|
+
content: `${content.trimEnd()}\n\n${section}`,
|
|
56
|
+
outcome: 'written',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const remainder = content.slice(marker.index + marker[0].length);
|
|
60
|
+
const nextHeading = /^## .+$/m.exec(remainder);
|
|
61
|
+
const end = nextHeading?.index === undefined
|
|
62
|
+
? content.length
|
|
63
|
+
: marker.index + marker[0].length + nextHeading.index;
|
|
64
|
+
return {
|
|
65
|
+
content: `${content.slice(0, marker.index)}${section}${end < content.length ? `\n${content.slice(end).trimStart()}` : ''}`,
|
|
66
|
+
outcome: 'updated',
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export async function resolveProjectLogLedgerTarget(repoRoot, home, dependencies = DEFAULT_ROLLUP_DEPENDENCIES) {
|
|
70
|
+
const effective = await dependencies.resolveEffectiveConfig(repoRoot, join(home, '.oat'));
|
|
71
|
+
const entry = effective.resolved['workflow.projectLogLedgerPath'];
|
|
72
|
+
const configuredPath = typeof entry?.value === 'string' && entry.value.trim()
|
|
73
|
+
? entry.value.trim()
|
|
74
|
+
: DEFAULT_LEDGER_PATH;
|
|
75
|
+
return {
|
|
76
|
+
path: isAbsolute(configuredPath)
|
|
77
|
+
? resolve(configuredPath)
|
|
78
|
+
: resolve(repoRoot, configuredPath),
|
|
79
|
+
explicitlyConfigured: entry?.source !== 'default',
|
|
80
|
+
defaultReferenceLayer: resolve(repoRoot, dirname(DEFAULT_LEDGER_PATH)),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function ledgerKey(entry) {
|
|
84
|
+
return `${entry.date}\u0000${entry.area.toLowerCase()}`;
|
|
85
|
+
}
|
|
86
|
+
function existingLedgerKeys(content) {
|
|
87
|
+
const keys = new Set();
|
|
88
|
+
const headingPattern = /^### (\d{4}-\d{2}-\d{2}) · (?:project|general) · (?:bug|friction|worked-well|feedback) · ([^·\r\n]+)$/gm;
|
|
89
|
+
for (const match of content.matchAll(headingPattern)) {
|
|
90
|
+
keys.add(`${match[1]}\u0000${match[2].trim().toLowerCase()}`);
|
|
91
|
+
}
|
|
92
|
+
return keys;
|
|
93
|
+
}
|
|
94
|
+
async function rollupLedger(input, entries, dependencies) {
|
|
95
|
+
const target = await resolveProjectLogLedgerTarget(input.repoRoot, input.home ?? homedir(), dependencies);
|
|
96
|
+
if (!target.explicitlyConfigured &&
|
|
97
|
+
!(await dirExists(target.defaultReferenceLayer))) {
|
|
98
|
+
return 'skipped_permitted';
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
const existing = (await fileExists(target.path))
|
|
102
|
+
? await readFile(target.path, 'utf8')
|
|
103
|
+
: '# Project Observations\n\n## Entries\n';
|
|
104
|
+
const keys = existingLedgerKeys(existing);
|
|
105
|
+
const candidates = entries.filter((entry) => entry.class === 'judgment' && entry.scope === 'general');
|
|
106
|
+
const additions = [];
|
|
107
|
+
for (const entry of candidates) {
|
|
108
|
+
const key = ledgerKey(entry);
|
|
109
|
+
if (keys.has(key)) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
keys.add(key);
|
|
113
|
+
additions.push(entry);
|
|
114
|
+
}
|
|
115
|
+
if (additions.length === 0) {
|
|
116
|
+
return 'deduplicated';
|
|
117
|
+
}
|
|
118
|
+
await mkdir(dirname(target.path), { recursive: true });
|
|
119
|
+
await writeFile(target.path, `${existing.trimEnd()}\n\n${renderEntries(additions)}\n`, 'utf8');
|
|
120
|
+
return 'appended';
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return 'failed';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export async function rollupProjectLog(input, overrides = {}) {
|
|
127
|
+
const dependencies = {
|
|
128
|
+
...DEFAULT_ROLLUP_DEPENDENCIES,
|
|
129
|
+
...overrides,
|
|
130
|
+
};
|
|
131
|
+
const artifactTarget = {
|
|
132
|
+
...DEFAULT_PROJECT_LOG_ARTIFACT_TARGET,
|
|
133
|
+
...input.artifactTarget,
|
|
134
|
+
};
|
|
135
|
+
const projectPath = await resolveTargetProject(input, dependencies);
|
|
136
|
+
const logPath = join(projectPath, artifactTarget.filename);
|
|
137
|
+
if (!(await fileExists(logPath))) {
|
|
138
|
+
throw new Error(`Project log does not exist: ${logPath}.`);
|
|
139
|
+
}
|
|
140
|
+
const summaryPath = input.summaryPath
|
|
141
|
+
? isAbsolute(input.summaryPath)
|
|
142
|
+
? resolve(input.summaryPath)
|
|
143
|
+
: resolve(input.repoRoot, input.summaryPath)
|
|
144
|
+
: join(projectPath, 'summary.md');
|
|
145
|
+
if (!(await fileExists(summaryPath))) {
|
|
146
|
+
throw new Error(`summary.md does not exist: ${summaryPath}. Author the project summary before roll-up.`);
|
|
147
|
+
}
|
|
148
|
+
const parsed = parseProjectLogEntries(await readFile(logPath, 'utf8'));
|
|
149
|
+
const summaryUpdate = writeSummarySection(await readFile(summaryPath, 'utf8'), artifactTarget.summaryHeading ?? WORKFLOW_OBSERVATIONS_HEADING, renderEntries(parsed.entries));
|
|
150
|
+
await writeFile(summaryPath, summaryUpdate.content, 'utf8');
|
|
151
|
+
const ledgerOutcome = await rollupLedger(input, parsed.entries, dependencies);
|
|
152
|
+
return {
|
|
153
|
+
status: ledgerOutcome === 'failed' ? 'failed' : 'ok',
|
|
154
|
+
summarySection: summaryUpdate.outcome,
|
|
155
|
+
ledgerOutcome,
|
|
156
|
+
entriesRolledUp: parsed.entries.length,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async function runRollupCommand(options, context, dependencies) {
|
|
160
|
+
try {
|
|
161
|
+
const repoRoot = await dependencies.resolveProjectRoot(context.cwd);
|
|
162
|
+
const result = await rollupProjectLog({
|
|
163
|
+
repoRoot,
|
|
164
|
+
home: context.home,
|
|
165
|
+
project: options.project,
|
|
166
|
+
summaryPath: options.summaryPath,
|
|
167
|
+
}, dependencies);
|
|
168
|
+
if (context.json) {
|
|
169
|
+
context.logger.json(result);
|
|
170
|
+
}
|
|
171
|
+
else if (result.status === 'ok') {
|
|
172
|
+
context.logger.success(`Rolled up ${result.entriesRolledUp} project log entries.`);
|
|
173
|
+
if (result.ledgerOutcome === 'skipped_permitted') {
|
|
174
|
+
context.logger.warn('Skipped the project-observations ledger because the default reference layer is absent.');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
context.logger.error('Project log summary was written, but the configured ledger write failed.');
|
|
179
|
+
}
|
|
180
|
+
process.exitCode = result.status === 'ok' ? 0 : 1;
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
184
|
+
if (context.json) {
|
|
185
|
+
context.logger.json({ status: 'error', message });
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
context.logger.error(message);
|
|
189
|
+
}
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export function createProjectLogRollupCommand(overrides = {}) {
|
|
194
|
+
const dependencies = { ...DEFAULT_COMMAND_DEPENDENCIES, ...overrides };
|
|
195
|
+
return new Command('rollup')
|
|
196
|
+
.description('Write project-log observations to summary and repository ledger')
|
|
197
|
+
.option('--project <path>', 'Explicit project path; defaults to the active project')
|
|
198
|
+
.option('--summary-path <path>', 'Summary path relative to the repository; defaults to project summary.md')
|
|
199
|
+
.action(async (options, command) => {
|
|
200
|
+
const context = dependencies.buildCommandContext(readGlobalOptions(command));
|
|
201
|
+
await runRollupCommand(options, context, dependencies);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type CommandContext, type GlobalOptions } from '../../../app/command-context.js';
|
|
2
|
+
import { type ActiveProjectResolution } from '../../../config/oat-config.js';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
export interface SynthesizeProjectLogInput {
|
|
5
|
+
repoRoot: string;
|
|
6
|
+
project?: string;
|
|
7
|
+
body?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectLogSynthesizeResult {
|
|
10
|
+
status: 'synthesized';
|
|
11
|
+
logPath: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SynthesizeProjectLogDependencies {
|
|
14
|
+
resolveActiveProject: (repoRoot: string) => Promise<ActiveProjectResolution>;
|
|
15
|
+
}
|
|
16
|
+
export interface ProjectLogSynthesizeCommandDependencies extends SynthesizeProjectLogDependencies {
|
|
17
|
+
buildCommandContext: (options: GlobalOptions) => CommandContext;
|
|
18
|
+
resolveProjectRoot: (cwd: string) => Promise<string>;
|
|
19
|
+
readStdin: () => Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
export declare function synthesizeProjectLog(input: SynthesizeProjectLogInput, overrides?: Partial<SynthesizeProjectLogDependencies>): Promise<ProjectLogSynthesizeResult>;
|
|
22
|
+
export declare function createProjectLogSynthesizeCommand(overrides?: Partial<ProjectLogSynthesizeCommandDependencies>): Command;
|
|
23
|
+
//# sourceMappingURL=synthesize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/log/synthesize.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,oBAAoB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,uCAAwC,SAAQ,gCAAgC;IAC/F,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CAClC;AA+CD,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,EAChC,SAAS,GAAE,OAAO,CAAC,gCAAgC,CAAM,GACxD,OAAO,CAAC,0BAA0B,CAAC,CAwDrC;AAqCD,wBAAgB,iCAAiC,CAC/C,SAAS,GAAE,OAAO,CAAC,uCAAuC,CAAM,GAC/D,OAAO,CAeT"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { isAbsolute, join, resolve } from 'node:path';
|
|
3
|
+
import { buildCommandContext, } from '../../../app/command-context.js';
|
|
4
|
+
import { readGlobalOptions } from '../../shared/shared.utils.js';
|
|
5
|
+
import { resolveActiveProject, } from '../../../config/oat-config.js';
|
|
6
|
+
import { dirExists, fileExists } from '../../../fs/io.js';
|
|
7
|
+
import { resolveProjectRoot } from '../../../fs/paths.js';
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { findCanonicalProjectLogSynthesisSection, PROJECT_LOG_FILENAME, SYNTHESIS_COMPLETE_HEADING, SYNTHESIS_PENDING_HEADING, } from './check.js';
|
|
10
|
+
const DEFAULT_SYNTHESIZE_DEPENDENCIES = {
|
|
11
|
+
resolveActiveProject,
|
|
12
|
+
};
|
|
13
|
+
const DEFAULT_COMMAND_DEPENDENCIES = {
|
|
14
|
+
...DEFAULT_SYNTHESIZE_DEPENDENCIES,
|
|
15
|
+
buildCommandContext,
|
|
16
|
+
resolveProjectRoot,
|
|
17
|
+
readStdin: async () => {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
for await (const chunk of process.stdin) {
|
|
20
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
21
|
+
}
|
|
22
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
async function resolveTargetProject(input, dependencies) {
|
|
26
|
+
if (input.project) {
|
|
27
|
+
const projectPath = isAbsolute(input.project)
|
|
28
|
+
? resolve(input.project)
|
|
29
|
+
: resolve(input.repoRoot, input.project);
|
|
30
|
+
if (!(await dirExists(projectPath)) ||
|
|
31
|
+
!(await fileExists(join(projectPath, 'state.md')))) {
|
|
32
|
+
throw new Error(`Project path is missing or invalid: ${input.project}. Pass --project <path> for a directory containing state.md.`);
|
|
33
|
+
}
|
|
34
|
+
return projectPath;
|
|
35
|
+
}
|
|
36
|
+
const active = await dependencies.resolveActiveProject(input.repoRoot);
|
|
37
|
+
if (active.status !== 'active' || !active.path) {
|
|
38
|
+
throw new Error('No active project resolves. Set activeProject or pass --project <path>.');
|
|
39
|
+
}
|
|
40
|
+
return resolve(input.repoRoot, active.path);
|
|
41
|
+
}
|
|
42
|
+
export async function synthesizeProjectLog(input, overrides = {}) {
|
|
43
|
+
const dependencies = {
|
|
44
|
+
...DEFAULT_SYNTHESIZE_DEPENDENCIES,
|
|
45
|
+
...overrides,
|
|
46
|
+
};
|
|
47
|
+
const body = input.body?.trim();
|
|
48
|
+
if (!body) {
|
|
49
|
+
throw new Error('--body is required and must contain non-whitespace text.');
|
|
50
|
+
}
|
|
51
|
+
if (body
|
|
52
|
+
.split(/\r?\n/)
|
|
53
|
+
.some((line) => line === SYNTHESIS_PENDING_HEADING ||
|
|
54
|
+
line === SYNTHESIS_COMPLETE_HEADING)) {
|
|
55
|
+
throw new Error('--body must not recreate command-owned project-log synthesis markers.');
|
|
56
|
+
}
|
|
57
|
+
const projectPath = await resolveTargetProject(input, dependencies);
|
|
58
|
+
const logPath = join(projectPath, PROJECT_LOG_FILENAME);
|
|
59
|
+
if (!(await fileExists(logPath))) {
|
|
60
|
+
throw new Error(`Project log does not exist: ${logPath}. Append an entry before synthesizing.`);
|
|
61
|
+
}
|
|
62
|
+
const content = await readFile(logPath, 'utf8');
|
|
63
|
+
const synthesis = findCanonicalProjectLogSynthesisSection(content);
|
|
64
|
+
if (synthesis.status === 'complete') {
|
|
65
|
+
throw new Error('End-of-run synthesis is already written; append a correction judgment instead of replacing it.');
|
|
66
|
+
}
|
|
67
|
+
if (synthesis.status === 'ambiguous') {
|
|
68
|
+
throw new Error('Project log must contain one unique canonical end-of-run synthesis section and cannot be synthesized safely.');
|
|
69
|
+
}
|
|
70
|
+
if (synthesis.status === 'missing') {
|
|
71
|
+
throw new Error('Project log is missing the pending synthesis marker and cannot be synthesized safely.');
|
|
72
|
+
}
|
|
73
|
+
const suffix = content.slice(synthesis.section.end);
|
|
74
|
+
const nextContent = `${content.slice(0, synthesis.section.start)}${SYNTHESIS_COMPLETE_HEADING}\n\n${body}\n${suffix ? '\n' : ''}${suffix}`;
|
|
75
|
+
await writeFile(logPath, nextContent, 'utf8');
|
|
76
|
+
return { status: 'synthesized', logPath };
|
|
77
|
+
}
|
|
78
|
+
async function runSynthesizeCommand(options, context, dependencies) {
|
|
79
|
+
try {
|
|
80
|
+
const repoRoot = await dependencies.resolveProjectRoot(context.cwd);
|
|
81
|
+
const body = options.body === '-' ? await dependencies.readStdin() : options.body;
|
|
82
|
+
const result = await synthesizeProjectLog({ repoRoot, project: options.project, body }, dependencies);
|
|
83
|
+
if (context.json) {
|
|
84
|
+
context.logger.json(result);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
context.logger.success(`Wrote project log synthesis: ${result.logPath}`);
|
|
88
|
+
}
|
|
89
|
+
process.exitCode = 0;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
93
|
+
if (context.json) {
|
|
94
|
+
context.logger.json({ status: 'error', message });
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
context.logger.error(message);
|
|
98
|
+
}
|
|
99
|
+
process.exitCode = 1;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export function createProjectLogSynthesizeCommand(overrides = {}) {
|
|
103
|
+
const dependencies = { ...DEFAULT_COMMAND_DEPENDENCIES, ...overrides };
|
|
104
|
+
return new Command('synthesize')
|
|
105
|
+
.description('Complete the project log end-of-run synthesis')
|
|
106
|
+
.option('--body <text>', 'Synthesis body, or - to read from stdin')
|
|
107
|
+
.option('--project <path>', 'Explicit project path; defaults to the active project')
|
|
108
|
+
.action(async (options, command) => {
|
|
109
|
+
const context = dependencies.buildCommandContext(readGlobalOptions(command));
|
|
110
|
+
await runSynthesizeCommand(options, context, dependencies);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
@@ -11,6 +11,7 @@ interface ProjectNewDependencies {
|
|
|
11
11
|
setActive: boolean;
|
|
12
12
|
refreshDashboard: boolean;
|
|
13
13
|
commit: boolean;
|
|
14
|
+
projectLog?: boolean;
|
|
14
15
|
}) => Promise<ScaffoldProjectResult>;
|
|
15
16
|
}
|
|
16
17
|
export declare function createProjectNewCommand(overrides?: Partial<ProjectNewDependencies>): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/new/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAE5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/new/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAE5C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC3B,MAAM,YAAY,CAAC;AAkBpB,UAAU,sBAAsB;IAC9B,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,eAAe,EAAE,CAAC,OAAO,EAAE;QACzB,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,mBAAmB,CAAC;QAC1B,KAAK,EAAE,OAAO,CAAC;QACf,SAAS,EAAE,OAAO,CAAC;QACnB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,MAAM,EAAE,OAAO,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACtC;AA0FD,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,OAAO,CA0CT"}
|
|
@@ -58,6 +58,11 @@ async function runProjectNew(projectName, options, context, dependencies) {
|
|
|
58
58
|
setActive: options.setActive,
|
|
59
59
|
refreshDashboard: options.dashboard,
|
|
60
60
|
commit: options.commit,
|
|
61
|
+
projectLog: options.withProjectLog === true
|
|
62
|
+
? true
|
|
63
|
+
: options.projectLog === false
|
|
64
|
+
? false
|
|
65
|
+
: undefined,
|
|
61
66
|
});
|
|
62
67
|
reportSuccess(context, projectName, result);
|
|
63
68
|
process.exitCode = 0;
|
|
@@ -88,6 +93,8 @@ export function createProjectNewCommand(overrides = {}) {
|
|
|
88
93
|
.option('--no-set-active', 'Do not update active project in local config')
|
|
89
94
|
.option('--no-dashboard', 'Do not refresh .oat/state.md after scaffold')
|
|
90
95
|
.option('--no-commit', 'Do not git-commit the scaffolded project directory')
|
|
96
|
+
.option('--with-project-log', 'Create project-log.md regardless of workflow.projectLog config')
|
|
97
|
+
.option('--no-project-log', 'Do not create project-log.md during scaffolding')
|
|
91
98
|
.action(async (name, options, command) => {
|
|
92
99
|
if (name.startsWith('-')) {
|
|
93
100
|
command.help();
|
|
@@ -6,6 +6,7 @@ export interface ScaffoldProjectOptions {
|
|
|
6
6
|
force?: boolean;
|
|
7
7
|
setActive?: boolean;
|
|
8
8
|
refreshDashboard?: boolean;
|
|
9
|
+
projectLog?: boolean;
|
|
9
10
|
/**
|
|
10
11
|
* Commit the freshly scaffolded project directory so the artifact baseline is
|
|
11
12
|
* git-tracked from t=0. Opt-in (default false) so library callers that manage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/new/scaffold.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../../src/commands/project/new/scaffold.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAErE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAC5B,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,GACjB,QAAQ,CAAC;AAEb,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,oBAAoB,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAmWD,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAuGhC"}
|
|
@@ -2,9 +2,11 @@ import { execFileSync } from 'node:child_process';
|
|
|
2
2
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
+
import { instantiateProjectLogTemplate } from '../../project/log/append.js';
|
|
5
6
|
import { resolveProjectsRoot } from '../../shared/oat-paths.js';
|
|
6
7
|
import { generateStateDashboard } from '../../state/generate.js';
|
|
7
8
|
import { setActiveProject } from '../../../config/oat-config.js';
|
|
9
|
+
import { resolveEffectiveConfig } from '../../../config/resolve.js';
|
|
8
10
|
import { resolveAssetsRoot } from '../../../fs/assets.js';
|
|
9
11
|
import { fileExists } from '../../../fs/io.js';
|
|
10
12
|
import { assertValidProjectStateContent } from '../../../validation/project-state.js';
|
|
@@ -199,6 +201,17 @@ async function scaffoldModeTemplates(userOatRoot, repoRoot, projectPath, project
|
|
|
199
201
|
}
|
|
200
202
|
return { createdFiles, skippedFiles };
|
|
201
203
|
}
|
|
204
|
+
async function scaffoldProjectLog(userOatRoot, repoRoot, projectPath, projectName, today) {
|
|
205
|
+
const templateFile = 'project-log.md';
|
|
206
|
+
const dest = join(repoRoot, projectPath, templateFile);
|
|
207
|
+
if (await fileExists(dest)) {
|
|
208
|
+
return 'skipped';
|
|
209
|
+
}
|
|
210
|
+
const src = await resolveTemplateSource(userOatRoot, repoRoot, templateFile);
|
|
211
|
+
const template = await readFile(src, 'utf8');
|
|
212
|
+
await writeFile(dest, instantiateProjectLogTemplate(template, projectName, today), 'utf8');
|
|
213
|
+
return 'created';
|
|
214
|
+
}
|
|
202
215
|
async function resolveTemplateSource(userOatRoot, repoRoot, templateFile) {
|
|
203
216
|
const userSource = join(userOatRoot, 'templates', templateFile);
|
|
204
217
|
if (await fileExists(userSource)) {
|
|
@@ -247,6 +260,17 @@ export async function scaffoldProject(options) {
|
|
|
247
260
|
void options.force;
|
|
248
261
|
await ensureStructure(options.repoRoot, projectPath, mode);
|
|
249
262
|
const { createdFiles, skippedFiles } = await scaffoldModeTemplates(userOatRoot, options.repoRoot, projectPath, options.projectName, mode, today, nowUtc);
|
|
263
|
+
const effectiveProjectLog = options.projectLog ??
|
|
264
|
+
(await resolveEffectiveConfig(options.repoRoot, userOatRoot, env)).resolved['workflow.projectLog']?.value === true;
|
|
265
|
+
if (effectiveProjectLog) {
|
|
266
|
+
const projectLogResult = await scaffoldProjectLog(userOatRoot, options.repoRoot, projectPath, options.projectName, today);
|
|
267
|
+
if (projectLogResult === 'created') {
|
|
268
|
+
createdFiles.push('project-log.md');
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
skippedFiles.push('project-log.md');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
250
274
|
if (setActive) {
|
|
251
275
|
await setActiveProject(options.repoRoot, projectPath);
|
|
252
276
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CanonicalEntry } from '../../engine/index.js';
|
|
2
2
|
import type { CodexExtensionPlan } from '../../providers/codex/codec/sync-extension.js';
|
|
3
|
+
import type { MaterializationPlan } from '../../providers/shared/index.js';
|
|
3
4
|
export interface CodexRoleStray {
|
|
4
5
|
roleName: string;
|
|
5
6
|
providerPath: string;
|
|
@@ -11,6 +12,14 @@ export interface CodexRegenerationDependencies {
|
|
|
11
12
|
computeExtensionPlan: (scopeRoot: string, canonicalEntries: CanonicalEntry[]) => Promise<CodexExtensionPlan>;
|
|
12
13
|
applyExtensionPlan: (scopeRoot: string, plan: CodexExtensionPlan) => Promise<unknown>;
|
|
13
14
|
}
|
|
15
|
+
interface ProviderStrayCandidate {
|
|
16
|
+
provider: string;
|
|
17
|
+
report: {
|
|
18
|
+
providerPath: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function filterMaterializationManagedStrays<TCandidate extends ProviderStrayCandidate>(candidates: TCandidate[], plans: readonly MaterializationPlan[]): TCandidate[];
|
|
14
22
|
export declare function detectCodexRoleStrays(scopeRoot: string, canonicalEntries: CanonicalEntry[], managedRoleNames?: Set<string>): Promise<CodexRoleStray[]>;
|
|
15
23
|
export declare function regenerateCodexAfterAdoption({ scopeRoot, scanCanonical, computeExtensionPlan, applyExtensionPlan, }: CodexRegenerationDependencies): Promise<void>;
|
|
24
|
+
export {};
|
|
16
25
|
//# sourceMappingURL=codex-strays.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-strays.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/codex-strays.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"cod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AE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/C"}
|
|
@@ -2,6 +2,10 @@ import { readdir, readFile, stat } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import TOML from '@iarna/toml';
|
|
4
4
|
import { isOatManagedCodexRoleFile } from '../../providers/codex/codec/shared.js';
|
|
5
|
+
export function filterMaterializationManagedStrays(candidates, plans) {
|
|
6
|
+
const managedPaths = new Set(plans.flatMap((plan) => plan.operations.map((operation) => `${plan.provider}|${operation.path.replaceAll('\\', '/')}`)));
|
|
7
|
+
return candidates.filter((candidate) => !managedPaths.has(`${candidate.provider}|${candidate.report.providerPath.replaceAll('\\', '/')}`));
|
|
8
|
+
}
|
|
5
9
|
function canonicalRoleNames(canonicalEntries) {
|
|
6
10
|
return new Set(canonicalEntries
|
|
7
11
|
.filter((entry) => entry.type === 'agent' && entry.isFile)
|
|
@@ -7,6 +7,7 @@ import { type CopyTransform, type DriftReport } from '../../drift/index.js';
|
|
|
7
7
|
import { type CanonicalEntry } from '../../engine/index.js';
|
|
8
8
|
import type { Manifest } from '../../manifest/index.js';
|
|
9
9
|
import { type CodexExtensionPlan } from '../../providers/codex/codec/sync-extension.js';
|
|
10
|
+
import { type CursorExtensionPlan } from '../../providers/cursor/codec/sync-extension.js';
|
|
10
11
|
import { type PathMapping, type ProviderAdapter } from '../../providers/shared/index.js';
|
|
11
12
|
import { type ConcreteScope, type Scope } from '../../shared/types.js';
|
|
12
13
|
import { Command } from 'commander';
|
|
@@ -18,7 +19,7 @@ interface StatusDependencies {
|
|
|
18
19
|
readUserConfig: (userConfigDir: string) => Promise<UserConfig>;
|
|
19
20
|
saveManifest: (manifestPath: string, manifest: Manifest) => Promise<void>;
|
|
20
21
|
scanCanonical: (scopeRoot: string, scope: ConcreteScope) => Promise<CanonicalEntry[]>;
|
|
21
|
-
|
|
22
|
+
scanBundledManagedAgents: () => Promise<CanonicalEntry[]>;
|
|
22
23
|
getAdapters: () => ProviderAdapter[];
|
|
23
24
|
getActiveAdapters: (adapters: ProviderAdapter[], scopeRoot: string) => Promise<ProviderAdapter[]>;
|
|
24
25
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
@@ -30,6 +31,11 @@ interface StatusDependencies {
|
|
|
30
31
|
env?: NodeJS.ProcessEnv;
|
|
31
32
|
}) => Promise<CodexExtensionPlan>;
|
|
32
33
|
applyCodexProjectExtensionPlan: (scopeRoot: string, plan: CodexExtensionPlan) => Promise<unknown>;
|
|
34
|
+
computeCursorProjectExtensionPlan: (scopeRoot: string, canonicalEntries: CanonicalEntry[], allowedCanonicalPaths?: string[], options?: {
|
|
35
|
+
userConfigDir?: string;
|
|
36
|
+
env?: NodeJS.ProcessEnv;
|
|
37
|
+
}) => Promise<CursorExtensionPlan>;
|
|
38
|
+
applyCursorProjectExtensionPlan: (scopeRoot: string, plan: CursorExtensionPlan) => Promise<unknown>;
|
|
33
39
|
selectManyWithAbort: <T extends string>(message: string, choices: MultiSelectChoice<T>[], ctx: PromptContext) => Promise<T[] | null>;
|
|
34
40
|
confirmAction: (message: string, ctx: PromptContext) => Promise<boolean>;
|
|
35
41
|
adoptStray: (scopeRoot: string, stray: StatusStrayCandidate, manifest: Manifest, options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/status/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAEL,KAAK,i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