@open-agent-toolkit/cli 0.2.48 → 0.2.50
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/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/tool-packs.md +35 -24
- package/assets/docs/cli-utilities/workflow-gates.md +19 -0
- package/assets/docs/contributing/skills.md +6 -4
- package/assets/docs/reference/cli-reference.md +1 -1
- package/assets/docs/reference/troubleshooting.md +22 -4
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-project-design/SKILL.md +13 -6
- package/assets/skills/oat-project-discover/SKILL.md +13 -6
- package/assets/skills/oat-project-import-plan/SKILL.md +8 -2
- package/assets/skills/oat-project-plan/SKILL.md +8 -2
- package/assets/skills/oat-project-quick-start/SKILL.md +8 -2
- package/dist/commands/doctor/index.d.ts +7 -0
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +44 -23
- package/dist/commands/gate/__fixtures__/fake-runtime.mjs +10 -0
- package/dist/commands/gate/configured-command.d.ts +12 -0
- package/dist/commands/gate/configured-command.d.ts.map +1 -0
- package/dist/commands/gate/configured-command.js +120 -0
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +51 -0
- package/dist/commands/pjm/index.d.ts +0 -2
- package/dist/commands/pjm/index.d.ts.map +1 -1
- package/dist/commands/pjm/index.js +5 -4
- package/dist/commands/pjm/migrate.d.ts +2 -1
- package/dist/commands/pjm/migrate.d.ts.map +1 -1
- package/dist/commands/pjm/migrate.js +23 -17
- package/dist/commands/status/index.d.ts +3 -1
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +77 -10
- package/dist/commands/tools/shared/pack-inventory.d.ts +10 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-inventory.js +71 -21
- package/package.json +2 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
const INVALID_GATE_REVIEW_COMMAND_MESSAGE = 'Configured oat gate review commands must use the structured-output contract `oat --json gate review ...`.';
|
|
2
|
+
function tokenizeCommand(command) {
|
|
3
|
+
const tokens = [];
|
|
4
|
+
let token = '';
|
|
5
|
+
let tokenStarted = false;
|
|
6
|
+
let quote = null;
|
|
7
|
+
let escaped = false;
|
|
8
|
+
for (let index = 0; index < command.length; index += 1) {
|
|
9
|
+
const character = command[index];
|
|
10
|
+
if (quote === "'") {
|
|
11
|
+
if (character === "'") {
|
|
12
|
+
quote = null;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
token += character;
|
|
16
|
+
}
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
if (escaped) {
|
|
20
|
+
if (character === '\n') {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
token += character;
|
|
24
|
+
tokenStarted = true;
|
|
25
|
+
escaped = false;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (character === '\\') {
|
|
29
|
+
escaped = true;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (quote) {
|
|
33
|
+
if (character === quote) {
|
|
34
|
+
quote = null;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (character === '`' ||
|
|
38
|
+
(character === '$' && command[index + 1] === '(')) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
token += character;
|
|
42
|
+
}
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (character === '"' || character === "'") {
|
|
46
|
+
quote = character;
|
|
47
|
+
tokenStarted = true;
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (character === '\n' || character === '`') {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
if (/\s/.test(character)) {
|
|
54
|
+
if (tokenStarted) {
|
|
55
|
+
tokens.push(token);
|
|
56
|
+
token = '';
|
|
57
|
+
tokenStarted = false;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if ('|;&<>'.includes(character) ||
|
|
62
|
+
(character === '$' && command[index + 1] === '(')) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
token += character;
|
|
66
|
+
tokenStarted = true;
|
|
67
|
+
}
|
|
68
|
+
if (escaped || quote) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
if (tokenStarted) {
|
|
72
|
+
tokens.push(token);
|
|
73
|
+
}
|
|
74
|
+
return tokens;
|
|
75
|
+
}
|
|
76
|
+
function isDirectGateReview(tokens) {
|
|
77
|
+
if (tokens[0] !== 'oat') {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
let index = 1;
|
|
81
|
+
while (index < tokens.length) {
|
|
82
|
+
const token = tokens[index];
|
|
83
|
+
if (token === 'gate') {
|
|
84
|
+
return (tokens[index + 1] === 'review' ||
|
|
85
|
+
(tokens[index + 1] === '--json' && tokens[index + 2] === 'review'));
|
|
86
|
+
}
|
|
87
|
+
if (token === '--json' ||
|
|
88
|
+
token === '--verbose' ||
|
|
89
|
+
token.startsWith('--cwd=')) {
|
|
90
|
+
index += 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (token === '--cwd') {
|
|
94
|
+
if (tokens[index + 1] === undefined) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
index += 2;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
export function validateConfiguredGateCommand(command) {
|
|
105
|
+
const tokens = tokenizeCommand(command);
|
|
106
|
+
if (!tokens || !isDirectGateReview(tokens)) {
|
|
107
|
+
return { kind: 'not-applicable' };
|
|
108
|
+
}
|
|
109
|
+
if (tokens[1] === '--json' &&
|
|
110
|
+
tokens[2] === 'gate' &&
|
|
111
|
+
tokens[3] === 'review' &&
|
|
112
|
+
tokens.filter((token) => token === '--json').length === 1) {
|
|
113
|
+
return { kind: 'valid', command: 'gate-review' };
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
kind: 'invalid',
|
|
117
|
+
command: 'gate-review',
|
|
118
|
+
message: INVALID_GATE_REVIEW_COMMAND_MESSAGE,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/gate/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAShE,OAAO,EAWL,KAAK,UAAU,EAIf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAExB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,uBAAuB,EAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/gate/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AA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C/B,UAAU,EAAE,kBAAkB,CAAC;QAC/B,MAAM,EAAE,WAAW,CAAC;QACpB,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACvC,aAAa,EAAE,WAAW,EAAE,CAAC;QAC7B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAgyCD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAC9C,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,kBAAkB,EACzB,gBAAgB,CAAC,EAAE,oBAAoB,GACtC,kBAAkB,GAAG,IAAI,CAS3B;AAyjED,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,OAAO,CA4NT"}
|
|
@@ -21,6 +21,7 @@ import YAML from 'yaml';
|
|
|
21
21
|
import { createGateActivityProbe, } from './activity-probes.js';
|
|
22
22
|
import { createBranchLocalGateCli, currentGateCliLaunch, readGateRouteReceipt, removeBranchLocalGateCli, } from './branch-local-cli.js';
|
|
23
23
|
import { runChildProcess, } from './child-process.js';
|
|
24
|
+
import { validateConfiguredGateCommand } from './configured-command.js';
|
|
24
25
|
import { parseReviewGateVerdict, severityDisplayName, } from './review-verdict.js';
|
|
25
26
|
import { createGateRouteCommand } from './route.js';
|
|
26
27
|
const DEFAULT_DEPENDENCIES = {
|
|
@@ -71,6 +72,7 @@ const VALID_IDENTITY_PROVENANCES = [
|
|
|
71
72
|
];
|
|
72
73
|
const REVIEW_GATE_CONTEXT_NOTE = [
|
|
73
74
|
'This review is gate-originated. If you run `oat-project-review-provide`, set `oat_review_invocation: gate` in the review artifact. Write a canonical review artifact with `### Critical`, `### Important`, `### Medium`, and `### Minor` headings in that order, using `None` for empty sections.',
|
|
75
|
+
'Complete the review, artifact write, and required bookkeeping inline or through a synchronously awaited child before this headless process exits. Do not start background tasks, monitors, or waiters that outlive this turn.',
|
|
74
76
|
"Artifact hygiene contract: Before finishing or committing, format every file you created or edited. Use the concrete write/fix formatting command supplied by the governing plan, task, or brief. If none is usable, discover the repository's documented write/fix command from applicable `AGENTS.md`/`CLAUDE.md` instructions and relevant package manifests; do not infer or hardcode a formatter. Prefer a file-scoped invocation when supported, and avoid rewriting unrelated files. If no command is discoverable, warn once with `no format command discovered in repo instructions; skipping`, then continue.",
|
|
75
77
|
].join('\n\n');
|
|
76
78
|
const GATE_CHECK_TIMEOUT_MS = 5_000;
|
|
@@ -1528,6 +1530,32 @@ function writeReviewGateArtifactValidationFailure(context, payload) {
|
|
|
1528
1530
|
context.logger.error(`Review completed but artifact validation failed: ${payload.message}`);
|
|
1529
1531
|
context.logger.error(payload.recovery);
|
|
1530
1532
|
}
|
|
1533
|
+
function writeReviewGateArtifactMissing(context, payload) {
|
|
1534
|
+
const message = `Review target ${payload.target} completed without producing the required correlated review artifact.`;
|
|
1535
|
+
const recovery = 'Fix the accepted headless target so it can write and finalize the review artifact before the process exits, then start a new gate run.';
|
|
1536
|
+
if (context.json) {
|
|
1537
|
+
context.logger.json({
|
|
1538
|
+
status: 'artifact_missing',
|
|
1539
|
+
outcome: 'review_completed_artifact_missing',
|
|
1540
|
+
runId: payload.runId,
|
|
1541
|
+
target: payload.target,
|
|
1542
|
+
project: payload.project,
|
|
1543
|
+
projectResolutionSource: payload.projectResolutionSource,
|
|
1544
|
+
artifactPath: null,
|
|
1545
|
+
generatedAt: null,
|
|
1546
|
+
gateInvocation: payload.gateInvocation,
|
|
1547
|
+
dispatchReport: payload.dispatchReport,
|
|
1548
|
+
receiveEligible: false,
|
|
1549
|
+
remediable: false,
|
|
1550
|
+
handoff: null,
|
|
1551
|
+
message,
|
|
1552
|
+
recovery,
|
|
1553
|
+
});
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
context.logger.error(message);
|
|
1557
|
+
context.logger.error(recovery);
|
|
1558
|
+
}
|
|
1531
1559
|
function writeReviewGateTargetingFailure(context, payload) {
|
|
1532
1560
|
const corroboration = {
|
|
1533
1561
|
run: payload.corroboration.run,
|
|
@@ -1712,6 +1740,12 @@ async function runGateSet(skillName, options, context, dependencies) {
|
|
|
1712
1740
|
const layer = parseLayer(options.layer);
|
|
1713
1741
|
const normalizedSkill = trimRequired(skillName, '<skill>');
|
|
1714
1742
|
const gate = parseGateConfig(options);
|
|
1743
|
+
if (gate) {
|
|
1744
|
+
const validation = validateConfiguredGateCommand(gate.command);
|
|
1745
|
+
if (validation.kind === 'invalid') {
|
|
1746
|
+
throw new Error(validation.message);
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1715
1749
|
const warnings = gate
|
|
1716
1750
|
? detectDevBuildGateCommandWarnings(gate.command)
|
|
1717
1751
|
: [];
|
|
@@ -2068,6 +2102,23 @@ async function runReviewGate(prompt, options, context, dependencies) {
|
|
|
2068
2102
|
const producedArtifact = artifactResolution.artifact;
|
|
2069
2103
|
if (!producedArtifact) {
|
|
2070
2104
|
const diagnosticArtifact = artifactResolution.diagnosticArtifact;
|
|
2105
|
+
if (!diagnosticArtifact &&
|
|
2106
|
+
artifactResolution.matchingArtifactPaths.length === 0) {
|
|
2107
|
+
if (projectLogFinalization) {
|
|
2108
|
+
projectLogFinalization.status = 'artifact_missing';
|
|
2109
|
+
projectLogFinalization.exitCode = 1;
|
|
2110
|
+
}
|
|
2111
|
+
writeReviewGateArtifactMissing(context, {
|
|
2112
|
+
runId,
|
|
2113
|
+
target: selected.id,
|
|
2114
|
+
project: projectPath,
|
|
2115
|
+
projectResolutionSource: reviewProject.source,
|
|
2116
|
+
gateInvocation,
|
|
2117
|
+
dispatchReport,
|
|
2118
|
+
});
|
|
2119
|
+
process.exitCode = 1;
|
|
2120
|
+
return;
|
|
2121
|
+
}
|
|
2071
2122
|
const message = artifactResolution.matchingArtifactPaths.length > 1
|
|
2072
2123
|
? `Multiple direct review artifacts carried gate run ID ${runId}.`
|
|
2073
2124
|
: initialTargetCorroboration.run === 'mismatched'
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildCommandContext } from '../../app/command-context.js';
|
|
2
|
-
import { readOatConfig } from '../../config/oat-config.js';
|
|
3
2
|
import { resolveAssetsRoot } from '../../fs/assets.js';
|
|
4
3
|
import { resolveProjectRoot } from '../../fs/paths.js';
|
|
5
4
|
import { Command } from 'commander';
|
|
@@ -11,7 +10,6 @@ interface PjmCommandDependencies {
|
|
|
11
10
|
buildCommandContext: typeof buildCommandContext;
|
|
12
11
|
resolveProjectRoot: typeof resolveProjectRoot;
|
|
13
12
|
resolveAssetsRoot: typeof resolveAssetsRoot;
|
|
14
|
-
readOatConfig: typeof readOatConfig;
|
|
15
13
|
resolvePjmAdoption: typeof resolvePjmAdoption;
|
|
16
14
|
initializeRepoReference: typeof initializeRepoReference;
|
|
17
15
|
runPjmDoctorChecks: typeof runPjmDoctorChecks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAiBnE,UAAU,sBAAsB;IAC9B,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,cAAc,EAAE,OAAO,cAAc,CAAC;IACtC,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA6FD,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC9C,OAAO,CA8JT"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import { buildCommandContext } from '../../app/command-context.js';
|
|
3
3
|
import { readGlobalOptions } from '../shared/shared.utils.js';
|
|
4
|
-
import { readOatConfig } from '../../config/oat-config.js';
|
|
5
4
|
import { resolveAssetsRoot } from '../../fs/assets.js';
|
|
6
5
|
import { resolveProjectRoot } from '../../fs/paths.js';
|
|
7
6
|
import { formatDoctorResults } from '../../ui/output.js';
|
|
@@ -14,7 +13,6 @@ const DEFAULT_DEPENDENCIES = {
|
|
|
14
13
|
buildCommandContext,
|
|
15
14
|
resolveProjectRoot,
|
|
16
15
|
resolveAssetsRoot,
|
|
17
|
-
readOatConfig,
|
|
18
16
|
resolvePjmAdoption,
|
|
19
17
|
initializeRepoReference,
|
|
20
18
|
runPjmDoctorChecks,
|
|
@@ -176,13 +174,16 @@ export function createPjmCommand(overrides = {}) {
|
|
|
176
174
|
process.exitCode = 0;
|
|
177
175
|
return;
|
|
178
176
|
}
|
|
179
|
-
const
|
|
177
|
+
const adoption = await dependencies.resolvePjmAdoption({
|
|
178
|
+
projectRoot,
|
|
179
|
+
repoRoot,
|
|
180
|
+
});
|
|
180
181
|
const result = await dependencies.migratePjmRepo({
|
|
181
182
|
repoRoot,
|
|
182
183
|
assetsRoot,
|
|
183
184
|
templatesRoot: resolve(projectRoot, '.oat', 'templates'),
|
|
184
185
|
home: context.home,
|
|
185
|
-
|
|
186
|
+
adoption,
|
|
186
187
|
apply: options.dryRun ? false : (options.apply ?? false),
|
|
187
188
|
});
|
|
188
189
|
if (context.json) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type DecisionMigrationMapping } from '../decision/migrate.js';
|
|
2
|
+
import type { PjmAdoption } from './adoption.js';
|
|
2
3
|
export type PjmMigrationActionType = 'move' | 'create' | 'migrate-backlog' | 'migrate-decisions' | 'propose';
|
|
3
4
|
export type PjmMigrationActionResult = 'planned' | 'applied' | 'skipped';
|
|
4
5
|
export interface PjmMigrationAction {
|
|
@@ -29,7 +30,7 @@ export interface PjmMigrationOptions {
|
|
|
29
30
|
assetsRoot: string;
|
|
30
31
|
templatesRoot?: string;
|
|
31
32
|
home?: string;
|
|
32
|
-
|
|
33
|
+
adoption: PjmAdoption;
|
|
33
34
|
apply?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export declare function migratePjmRepo(options: PjmMigrationOptions): Promise<PjmMigrationResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/migrate.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/migrate.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL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,CAClC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAoG7B;AAED,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
|
@@ -7,7 +7,7 @@ import { initializeDecisionRecords } from '../decision/init.js';
|
|
|
7
7
|
import { migrateDecisionRecords, } from '../decision/migrate.js';
|
|
8
8
|
import { stripTemplateFrontmatter } from '../shared/strip-template-frontmatter.js';
|
|
9
9
|
import YAML from 'yaml';
|
|
10
|
-
import { initializeRepoReference } from './init.js';
|
|
10
|
+
import { CANONICAL_REPO_REFERENCE_PATHS, initializeRepoReference, } from './init.js';
|
|
11
11
|
const ACTIVE_MOVES = [
|
|
12
12
|
{ source: 'reference/current-state.md', target: 'pjm/current-state.md' },
|
|
13
13
|
{ source: 'reference/roadmap.md', target: 'pjm/roadmap.md' },
|
|
@@ -17,6 +17,10 @@ const JUDGMENT_TARGETS = [
|
|
|
17
17
|
'reference/backlog.md',
|
|
18
18
|
'reference/backlog-completed.md',
|
|
19
19
|
];
|
|
20
|
+
const LEGACY_MIGRATION_PATHS = [
|
|
21
|
+
...ACTIVE_MOVES.map((move) => move.source),
|
|
22
|
+
'reference/decision-record.md',
|
|
23
|
+
];
|
|
20
24
|
async function pathExists(path) {
|
|
21
25
|
try {
|
|
22
26
|
await access(path);
|
|
@@ -228,19 +232,17 @@ async function collectJudgmentProposals(repoRoot) {
|
|
|
228
232
|
}
|
|
229
233
|
return actions;
|
|
230
234
|
}
|
|
231
|
-
async function
|
|
232
|
-
const
|
|
233
|
-
const hasDecisions = await pathExists(join(repoRoot, 'reference', 'decisions'));
|
|
234
|
-
if (!hasPjm || !hasDecisions) {
|
|
235
|
-
return false;
|
|
236
|
-
}
|
|
237
|
-
for (const legacyPath of [
|
|
238
|
-
'reference/current-state.md',
|
|
239
|
-
'reference/roadmap.md',
|
|
240
|
-
'reference/backlog',
|
|
241
|
-
'reference/decision-record.md',
|
|
242
|
-
]) {
|
|
235
|
+
async function hasRecognizedLegacySources(repoRoot) {
|
|
236
|
+
for (const legacyPath of LEGACY_MIGRATION_PATHS) {
|
|
243
237
|
if (await pathExists(join(repoRoot, legacyPath))) {
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
async function isAlreadyMigrated(repoRoot) {
|
|
244
|
+
for (const relativePath of CANONICAL_REPO_REFERENCE_PATHS) {
|
|
245
|
+
if (!(await pathExists(join(repoRoot, relativePath)))) {
|
|
244
246
|
return false;
|
|
245
247
|
}
|
|
246
248
|
}
|
|
@@ -305,12 +307,16 @@ function buildEmptyResult(options, status, reason) {
|
|
|
305
307
|
};
|
|
306
308
|
}
|
|
307
309
|
export async function migratePjmRepo(options) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
if (await isAlreadyMigrated(options.repoRoot)) {
|
|
310
|
+
const hasLegacySources = await hasRecognizedLegacySources(options.repoRoot);
|
|
311
|
+
if (!hasLegacySources && (await isAlreadyMigrated(options.repoRoot))) {
|
|
312
312
|
return buildEmptyResult(options, 'already-migrated');
|
|
313
313
|
}
|
|
314
|
+
if (!hasLegacySources) {
|
|
315
|
+
const reason = options.adoption.state === 'partial-initialization'
|
|
316
|
+
? 'PJM initialization is partial and no recognized legacy migration input was found; run oat pjm init to complete initialization'
|
|
317
|
+
: 'No recognized PJM migration input was found; run oat pjm init to initialize this repository';
|
|
318
|
+
return buildEmptyResult(options, 'skipped', reason);
|
|
319
|
+
}
|
|
314
320
|
const apply = options.apply ?? false;
|
|
315
321
|
const activeMoves = await planActiveMoves(options.repoRoot);
|
|
316
322
|
const judgmentProposals = await collectJudgmentProposals(options.repoRoot);
|
|
@@ -24,7 +24,9 @@ interface StatusDependencies {
|
|
|
24
24
|
scanCanonical: (scopeRoot: string, scope: ConcreteScope) => Promise<CanonicalEntry[]>;
|
|
25
25
|
scanBundledManagedAgents: () => Promise<CanonicalEntry[]>;
|
|
26
26
|
getAdapters: () => ProviderAdapter[];
|
|
27
|
-
|
|
27
|
+
getConfigAwareAdapters: (adapters: ProviderAdapter[], scopeRoot: string, config: SyncConfig) => Promise<{
|
|
28
|
+
activeAdapters: ProviderAdapter[];
|
|
29
|
+
}>;
|
|
28
30
|
getSyncMappings: (adapter: ProviderAdapter, scope: Scope) => PathMapping[];
|
|
29
31
|
getAdoptionSources: (adapter: ProviderAdapter, scope: Scope) => AdoptionSource[];
|
|
30
32
|
detectDrift: (entry: Manifest['entries'][number], scopeRoot: string, copyTransform?: CopyTransform) => Promise<DriftReport>;
|
|
@@ -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;AAC9B,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,
|
|
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;AAC9B,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAIL,KAAK,sBAAsB,EAC5B,MAAM,2CAA2C,CAA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Option } from '../shared/scope-option.js';
|
|
8
8
|
import { confirmAction, selectManyWithAbort, selectWithAbort, } from '../shared/shared.prompts.js';
|
|
9
9
|
import { readGlobalOptions, resolveConcreteScopes, } from '../shared/shared.utils.js';
|
|
10
|
-
import { hasScopedPackPlacementEvidence, inventoryPack, } from '../tools/shared/pack-inventory.js';
|
|
10
|
+
import { attributeSharedOwnerDiagnostics, hasScopedPackPlacementEvidence, inventoryPack, } from '../tools/shared/pack-inventory.js';
|
|
11
11
|
import { PACK_NAMES } from '../tools/shared/pack-manifest.js';
|
|
12
12
|
import { formatPackPath, formatPackPaths, updatePackRecovery, } from '../tools/shared/pack-paths.js';
|
|
13
13
|
import { DEFAULT_SYNC_CONFIG, loadSyncConfig, } from '../../config/index.js';
|
|
@@ -24,12 +24,45 @@ import { copilotAdapter } from '../../providers/copilot/index.js';
|
|
|
24
24
|
import { cursorAdapter } from '../../providers/cursor/index.js';
|
|
25
25
|
import { applyCursorProjectExtensionPlan, computeCursorProjectExtensionPlan, } from '../../providers/cursor/codec/sync-extension.js';
|
|
26
26
|
import { geminiAdapter } from '../../providers/gemini/index.js';
|
|
27
|
-
import {
|
|
27
|
+
import { getConfigAwareAdapters, getSyncMappings, } from '../../providers/shared/index.js';
|
|
28
28
|
import { getAdoptionSources } from '../../providers/shared/adapter.utils.js';
|
|
29
29
|
import { SCOPE_CONTENT_TYPES, } from '../../shared/types.js';
|
|
30
30
|
import { formatStatusTable } from '../../ui/output.js';
|
|
31
31
|
import { Command } from 'commander';
|
|
32
32
|
const DEFAULT_REMEDIATION = 'Run "oat init" to adopt stray entries.';
|
|
33
|
+
function unavailablePackReport(error, roots, unavailableScopes) {
|
|
34
|
+
let detail = error instanceof Error ? error.message : 'Unknown error.';
|
|
35
|
+
const replacements = [
|
|
36
|
+
...(roots.projectRoot
|
|
37
|
+
? [
|
|
38
|
+
[`${roots.projectRoot}/`, ''],
|
|
39
|
+
[roots.projectRoot, '.'],
|
|
40
|
+
]
|
|
41
|
+
: []),
|
|
42
|
+
...(roots.userRoot
|
|
43
|
+
? [
|
|
44
|
+
[`${roots.userRoot}/`, '~/'],
|
|
45
|
+
[roots.userRoot, '~'],
|
|
46
|
+
]
|
|
47
|
+
: []),
|
|
48
|
+
].sort(([left], [right]) => right.length - left.length);
|
|
49
|
+
for (const [root, replacement] of replacements) {
|
|
50
|
+
detail = detail.replaceAll(root, replacement);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
availability: {
|
|
54
|
+
status: 'unavailable',
|
|
55
|
+
diagnostic: {
|
|
56
|
+
code: 'packs:inventory',
|
|
57
|
+
message: `Unable to inventory managed packs: ${detail}`,
|
|
58
|
+
recovery: 'Run `pnpm build` and rerun `oat status`.',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
states: [],
|
|
62
|
+
unavailableScopes,
|
|
63
|
+
pjm: null,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
33
66
|
const DEFAULT_DEPENDENCIES = {
|
|
34
67
|
buildCommandContext,
|
|
35
68
|
async resolveScopeRoot(scope, context) {
|
|
@@ -55,7 +88,7 @@ const DEFAULT_DEPENDENCIES = {
|
|
|
55
88
|
geminiAdapter,
|
|
56
89
|
];
|
|
57
90
|
},
|
|
58
|
-
|
|
91
|
+
getConfigAwareAdapters,
|
|
59
92
|
getSyncMappings,
|
|
60
93
|
getAdoptionSources,
|
|
61
94
|
detectDrift,
|
|
@@ -210,7 +243,7 @@ function shouldReportPjmAdoption(adoption, states) {
|
|
|
210
243
|
const pjm = states.find(({ pack }) => pack === 'project-management');
|
|
211
244
|
return (pjm?.scopes ?? []).some(({ scope }) => scope === 'project');
|
|
212
245
|
}
|
|
213
|
-
async function collectPackReport(scopeRoots, unavailableScopes, dependencies) {
|
|
246
|
+
async function collectPackReport(scopeRoots, unavailableScopes, userManagedRoleMaterialization, dependencies) {
|
|
214
247
|
const roots = {
|
|
215
248
|
...(scopeRoots.has('project')
|
|
216
249
|
? { projectRoot: scopeRoots.get('project') }
|
|
@@ -218,22 +251,46 @@ async function collectPackReport(scopeRoots, unavailableScopes, dependencies) {
|
|
|
218
251
|
...(scopeRoots.has('user') ? { userRoot: scopeRoots.get('user') } : {}),
|
|
219
252
|
};
|
|
220
253
|
if (scopeRoots.size === 0) {
|
|
221
|
-
return {
|
|
254
|
+
return {
|
|
255
|
+
availability: { status: 'available' },
|
|
256
|
+
states: [],
|
|
257
|
+
unavailableScopes,
|
|
258
|
+
pjm: null,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
let inventories;
|
|
262
|
+
try {
|
|
263
|
+
const assetsRoot = await dependencies.resolveAssetsRoot();
|
|
264
|
+
inventories = attributeSharedOwnerDiagnostics(await Promise.all(PACK_NAMES.map((pack) => dependencies.inventoryPack({
|
|
265
|
+
pack,
|
|
266
|
+
assetsRoot,
|
|
267
|
+
...roots,
|
|
268
|
+
...(scopeRoots.has('user')
|
|
269
|
+
? { userManagedRoleMaterialization }
|
|
270
|
+
: {}),
|
|
271
|
+
}))));
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
return unavailablePackReport(error, roots, unavailableScopes);
|
|
222
275
|
}
|
|
223
|
-
const assetsRoot = await dependencies.resolveAssetsRoot();
|
|
224
|
-
const inventories = await Promise.all(PACK_NAMES.map((pack) => dependencies.inventoryPack({ pack, assetsRoot, ...roots })));
|
|
225
276
|
const states = inventories
|
|
226
277
|
.map((inventory) => toStatusPackState(inventory, roots))
|
|
227
278
|
.filter((state) => state !== null);
|
|
228
279
|
const projectRoot = scopeRoots.get('project');
|
|
229
280
|
if (!projectRoot) {
|
|
230
|
-
return {
|
|
281
|
+
return {
|
|
282
|
+
availability: { status: 'available' },
|
|
283
|
+
states,
|
|
284
|
+
unavailableScopes,
|
|
285
|
+
pjm: null,
|
|
286
|
+
};
|
|
231
287
|
}
|
|
232
288
|
const adoption = await dependencies.resolvePjmAdoption({
|
|
233
289
|
projectRoot,
|
|
234
290
|
repoRoot: join(projectRoot, '.oat', 'repo'),
|
|
235
291
|
});
|
|
236
292
|
return {
|
|
293
|
+
availability: { status: 'available' },
|
|
237
294
|
states,
|
|
238
295
|
unavailableScopes,
|
|
239
296
|
pjm: {
|
|
@@ -262,6 +319,9 @@ function describePackScope(state) {
|
|
|
262
319
|
}
|
|
263
320
|
function formatPackReport(report) {
|
|
264
321
|
const lines = [];
|
|
322
|
+
if (report.availability.diagnostic) {
|
|
323
|
+
lines.push(`${report.availability.diagnostic.code}: ${report.availability.diagnostic.message}`, ` Fix: ${report.availability.diagnostic.recovery}`);
|
|
324
|
+
}
|
|
265
325
|
if (report.states.length > 0) {
|
|
266
326
|
lines.push('Pack state:');
|
|
267
327
|
for (const state of report.states) {
|
|
@@ -275,6 +335,9 @@ function formatPackReport(report) {
|
|
|
275
335
|
}
|
|
276
336
|
for (const diagnostic of scope.diagnostics) {
|
|
277
337
|
lines.push(` ${diagnostic.code}: ${diagnostic.message}`);
|
|
338
|
+
if (diagnostic.paths.length > 0) {
|
|
339
|
+
lines.push(` Affected: ${formatPackPaths(diagnostic.paths, {})}`);
|
|
340
|
+
}
|
|
278
341
|
if (diagnostic.recovery) {
|
|
279
342
|
lines.push(` Fix: ${diagnostic.recovery}`);
|
|
280
343
|
}
|
|
@@ -285,6 +348,9 @@ function formatPackReport(report) {
|
|
|
285
348
|
}
|
|
286
349
|
for (const diagnostic of state.diagnostics) {
|
|
287
350
|
lines.push(` ${diagnostic.code}: ${diagnostic.message}`);
|
|
351
|
+
if (diagnostic.paths.length > 0) {
|
|
352
|
+
lines.push(` Affected: ${formatPackPaths(diagnostic.paths, {})}`);
|
|
353
|
+
}
|
|
288
354
|
if (diagnostic.recovery) {
|
|
289
355
|
lines.push(` Fix: ${diagnostic.recovery}`);
|
|
290
356
|
}
|
|
@@ -316,7 +382,7 @@ async function collectScopeReports(scope, context, dependencies) {
|
|
|
316
382
|
dependencies.resolveUserSyncConfig(userConfigDir),
|
|
317
383
|
]);
|
|
318
384
|
const adapters = dependencies.getAdapters();
|
|
319
|
-
const activeAdapters = await dependencies.
|
|
385
|
+
const { activeAdapters } = await dependencies.getConfigAwareAdapters(adapters, scopeRoot, scope === 'user' ? userSyncConfig : syncConfig);
|
|
320
386
|
const reports = [];
|
|
321
387
|
const strayCandidates = [];
|
|
322
388
|
const trackedCanonicalByProvider = new Set(manifest.entries.map((entry) => `${entry.provider}|${normalizeToPosixPath(entry.canonicalPath)}`));
|
|
@@ -526,7 +592,8 @@ async function runStatusCommand(context, dependencies, options = {}) {
|
|
|
526
592
|
}
|
|
527
593
|
return;
|
|
528
594
|
}
|
|
529
|
-
const packReport = await collectPackReport(scopeRoots, unavailableScopes,
|
|
595
|
+
const packReport = await collectPackReport(scopeRoots, unavailableScopes, scopeCollections.some(({ scope, activeAdapterNames }) => scope === 'user' &&
|
|
596
|
+
activeAdapterNames.some((name) => name === 'codex' || name === 'cursor')), dependencies);
|
|
530
597
|
if (context.json) {
|
|
531
598
|
const payload = {
|
|
532
599
|
scope: context.scope,
|
|
@@ -33,14 +33,24 @@ export interface InventoryScopedPackInput {
|
|
|
33
33
|
scope: ConcreteScope;
|
|
34
34
|
scopeRoot: string;
|
|
35
35
|
assetsRoot: string;
|
|
36
|
+
managedRoleMaterialization?: boolean;
|
|
36
37
|
}
|
|
37
38
|
export interface InventoryPackInput {
|
|
38
39
|
pack: PackName;
|
|
39
40
|
assetsRoot: string;
|
|
40
41
|
projectRoot?: string;
|
|
41
42
|
userRoot?: string;
|
|
43
|
+
userManagedRoleMaterialization?: boolean;
|
|
42
44
|
}
|
|
43
45
|
export declare function inventoryScopedPack(input: InventoryScopedPackInput): Promise<ScopedPackInventory>;
|
|
44
46
|
export declare function hasScopedPackPlacementEvidence(inventory: ScopedPackInventory): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Attribute each present shared asset only after every candidate pack has been
|
|
49
|
+
* inventoried. Shared presence cannot establish placement, so applicable
|
|
50
|
+
* owners are limited to packs with independent intent or non-shared managed
|
|
51
|
+
* assets. The observation is attached once to the first applicable owner in
|
|
52
|
+
* canonical pack order while naming the complete applicable owner set.
|
|
53
|
+
*/
|
|
54
|
+
export declare function attributeSharedOwnerDiagnostics(inventories: PackInventory[]): PackInventory[];
|
|
45
55
|
export declare function inventoryPack(input: InventoryPackInput): Promise<PackInventory>;
|
|
46
56
|
//# sourceMappingURL=pack-inventory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-inventory.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-inventory.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EACA,uBAAuB,GACvB,iBAAiB,GACjB,0BAA0B,GAC1B,2BAA2B,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,YAAY,EAAE,gBAAgB,CAAC;IAC/B,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC;IACvD,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,WAAW,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"pack-inventory.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-inventory.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,eAAe,CAAC;AAIvB,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,QAAQ,EACT,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EACA,uBAAuB,GACvB,iBAAiB,GACjB,0BAA0B,GAC1B,2BAA2B,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB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