@open-agent-toolkit/cli 0.2.50 → 0.2.52
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/bootstrap.md +6 -2
- package/assets/docs/cli-utilities/tool-packs.md +87 -33
- package/assets/docs/provider-sync/commands.md +30 -2
- package/assets/docs/provider-sync/config.md +19 -0
- package/assets/docs/provider-sync/manifest-and-drift.md +37 -0
- package/assets/docs/provider-sync/providers.md +69 -2
- package/assets/docs/provider-sync/scope-and-surface.md +44 -0
- package/assets/docs/reference/cli-reference.md +21 -5
- package/assets/docs/reference/file-locations.md +8 -2
- package/assets/docs/reference/oat-directory-structure.md +25 -9
- package/assets/docs/workflows/projects/artifacts.md +9 -4
- package/assets/docs/workflows/projects/evidence-layers.md +110 -1
- package/assets/docs/workflows/projects/implementation-execution.md +13 -0
- package/assets/docs/workflows/projects/lifecycle.md +17 -5
- package/assets/docs/workflows/projects/orchestration-model.md +18 -0
- package/assets/docs/workflows/projects/picking-up-projects.md +26 -9
- package/assets/docs/workflows/projects/pr-flow.md +5 -3
- package/assets/docs/workflows/projects/reviewing-oat-prs.md +12 -8
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-dispatch-subagents/SKILL.md +57 -1
- package/assets/skills/oat-dispatch-subagents/references/record-schema.md +77 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +3 -3
- package/assets/skills/oat-project-complete/SKILL.md +193 -26
- package/assets/skills/oat-project-complete/scripts/execute-synced-archive-entry.mjs +306 -0
- package/assets/skills/oat-project-complete/scripts/finalize-synced-archive.mjs +125 -0
- package/assets/skills/oat-project-complete/scripts/parse-synced-archive-resume-fields.mjs +106 -0
- package/assets/skills/oat-project-complete/scripts/recover-completion-receipts.mjs +110 -0
- package/assets/skills/oat-project-complete/scripts/resolve-synced-archive-entry.mjs +164 -0
- package/assets/skills/oat-project-dispatch-subagents/SKILL.md +24 -1
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +11 -0
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-plan-writing/SKILL.md +12 -1
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-review-provide/SKILL.md +12 -1
- package/assets/skills/oat-project-review-provide-remote/SKILL.md +12 -1
- package/dist/agents/canonical/index.d.ts +2 -0
- package/dist/agents/canonical/index.d.ts.map +1 -1
- package/dist/agents/canonical/index.js +1 -0
- package/dist/agents/canonical/resolve.d.ts +45 -0
- package/dist/agents/canonical/resolve.d.ts.map +1 -0
- package/dist/agents/canonical/resolve.js +175 -0
- package/dist/commands/decision/agents-guidance.d.ts +2 -2
- package/dist/commands/decision/agents-guidance.d.ts.map +1 -1
- package/dist/commands/decision/agents-guidance.js +1 -4
- package/dist/commands/decision/index.d.ts.map +1 -1
- package/dist/commands/decision/index.js +25 -6
- package/dist/commands/docs/init/index.d.ts +7 -1
- package/dist/commands/docs/init/index.d.ts.map +1 -1
- package/dist/commands/docs/init/index.js +53 -20
- package/dist/commands/doctor/index.d.ts +8 -2
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +157 -46
- package/dist/commands/init/index.d.ts +8 -3
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +64 -26
- package/dist/commands/init/tools/index.d.ts +12 -12
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +430 -99
- package/dist/commands/init/tools/install-state.d.ts +2 -0
- package/dist/commands/init/tools/install-state.d.ts.map +1 -1
- package/dist/commands/init/tools/install-state.js +11 -0
- package/dist/commands/init/tools/project-guidance.d.ts +49 -0
- package/dist/commands/init/tools/project-guidance.d.ts.map +1 -0
- package/dist/commands/init/tools/project-guidance.js +144 -0
- package/dist/commands/init/tools/workflows/index.d.ts +7 -0
- package/dist/commands/init/tools/workflows/index.d.ts.map +1 -1
- package/dist/commands/init/tools/workflows/index.js +160 -7
- package/dist/commands/pjm/index.d.ts.map +1 -1
- package/dist/commands/pjm/index.js +28 -3
- package/dist/commands/pjm/init.d.ts +5 -0
- package/dist/commands/pjm/init.d.ts.map +1 -1
- package/dist/commands/pjm/init.js +19 -3
- package/dist/commands/project/archive/archive-utils.d.ts +8 -1
- package/dist/commands/project/archive/archive-utils.d.ts.map +1 -1
- package/dist/commands/project/archive/archive-utils.js +147 -50
- package/dist/commands/project/archive/push-runner.d.ts.map +1 -1
- package/dist/commands/project/archive/push-runner.js +15 -2
- package/dist/commands/project/dispatch/index.d.ts +10 -0
- package/dist/commands/project/dispatch/index.d.ts.map +1 -0
- package/dist/commands/project/dispatch/index.js +137 -0
- package/dist/commands/project/dispatch/record.d.ts +91 -0
- package/dist/commands/project/dispatch/record.d.ts.map +1 -0
- package/dist/commands/project/dispatch/record.js +402 -0
- package/dist/commands/project/index.d.ts.map +1 -1
- package/dist/commands/project/index.js +2 -0
- package/dist/commands/project/links/compute.d.ts +1 -0
- package/dist/commands/project/links/compute.d.ts.map +1 -1
- package/dist/commands/project/links/compute.js +5 -4
- package/dist/commands/project/links/index.d.ts +9 -0
- package/dist/commands/project/links/index.d.ts.map +1 -1
- package/dist/commands/project/links/index.js +71 -2
- package/dist/commands/project/list.d.ts +10 -2
- package/dist/commands/project/list.d.ts.map +1 -1
- package/dist/commands/project/list.js +205 -29
- package/dist/commands/project/open/index.d.ts +2 -0
- package/dist/commands/project/open/index.d.ts.map +1 -1
- package/dist/commands/project/open/index.js +16 -1
- package/dist/commands/project/prune/index.d.ts +10 -4
- package/dist/commands/project/prune/index.d.ts.map +1 -1
- package/dist/commands/project/prune/index.js +85 -15
- package/dist/commands/project/pull/index.d.ts +4 -0
- package/dist/commands/project/pull/index.d.ts.map +1 -1
- package/dist/commands/project/pull/index.js +82 -3
- package/dist/commands/project/sync/git.d.ts +9 -0
- package/dist/commands/project/sync/git.d.ts.map +1 -1
- package/dist/commands/project/sync/git.js +18 -0
- package/dist/commands/project/sync/ref-sync.d.ts +16 -1
- package/dist/commands/project/sync/ref-sync.d.ts.map +1 -1
- package/dist/commands/project/sync/ref-sync.js +288 -17
- package/dist/commands/project/sync/resolve-target.d.ts +10 -0
- package/dist/commands/project/sync/resolve-target.d.ts.map +1 -1
- package/dist/commands/project/sync/resolve-target.js +56 -1
- package/dist/commands/providers/inspect/inspect.d.ts +8 -1
- package/dist/commands/providers/inspect/inspect.d.ts.map +1 -1
- package/dist/commands/providers/inspect/inspect.js +146 -26
- package/dist/commands/providers/list/list.d.ts +8 -1
- package/dist/commands/providers/list/list.d.ts.map +1 -1
- package/dist/commands/providers/list/list.js +139 -23
- package/dist/commands/providers/providers.types.d.ts +25 -1
- package/dist/commands/providers/providers.types.d.ts.map +1 -1
- package/dist/commands/providers/set/index.d.ts +9 -1
- package/dist/commands/providers/set/index.d.ts.map +1 -1
- package/dist/commands/providers/set/index.js +43 -33
- package/dist/commands/remove/skill/remove-skill.d.ts.map +1 -1
- package/dist/commands/remove/skill/remove-skill.js +11 -0
- package/dist/commands/shared/agents-md.d.ts +42 -14
- package/dist/commands/shared/agents-md.d.ts.map +1 -1
- package/dist/commands/shared/agents-md.js +364 -70
- package/dist/commands/shared/project-scope.d.ts +2 -0
- package/dist/commands/shared/project-scope.d.ts.map +1 -1
- package/dist/commands/shared/project-scope.js +5 -0
- package/dist/commands/state/generate.d.ts +2 -0
- package/dist/commands/state/generate.d.ts.map +1 -1
- package/dist/commands/state/generate.js +93 -28
- package/dist/commands/status/index.d.ts +8 -3
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +147 -32
- package/dist/commands/sync/apply.d.ts.map +1 -1
- package/dist/commands/sync/apply.js +220 -29
- package/dist/commands/sync/dry-run.d.ts.map +1 -1
- package/dist/commands/sync/dry-run.js +30 -6
- package/dist/commands/sync/index.d.ts +17 -2
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +106 -41
- package/dist/commands/sync/sync.types.d.ts +39 -2
- package/dist/commands/sync/sync.types.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.d.ts +5 -1
- package/dist/commands/sync/sync.utils.d.ts.map +1 -1
- package/dist/commands/sync/sync.utils.js +73 -0
- package/dist/commands/tools/info/info-tool.d.ts +2 -0
- package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
- package/dist/commands/tools/info/info-tool.js +34 -12
- package/dist/commands/tools/install/index.d.ts.map +1 -1
- package/dist/commands/tools/install/index.js +19 -3
- package/dist/commands/tools/list/list-tools.d.ts +2 -0
- package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
- package/dist/commands/tools/list/list-tools.js +36 -7
- package/dist/commands/tools/remove/index.d.ts.map +1 -1
- package/dist/commands/tools/remove/index.js +150 -21
- package/dist/commands/tools/remove/remove-tools.d.ts +20 -0
- package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
- package/dist/commands/tools/remove/remove-tools.js +122 -1
- package/dist/commands/tools/shared/format-pack-inventory.d.ts +19 -0
- package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/format-pack-inventory.js +109 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts +66 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-evidence.js +132 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts +1 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts +44 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.js +91 -0
- package/dist/commands/tools/update/index.d.ts.map +1 -1
- package/dist/commands/tools/update/index.js +74 -4
- package/dist/commands/tools/update/update-tools.d.ts +5 -0
- package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
- package/dist/commands/tools/update/update-tools.js +64 -2
- package/dist/config/oat-config.d.ts +5 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +17 -5
- package/dist/config/user-sync-config.d.ts +1 -0
- package/dist/config/user-sync-config.d.ts.map +1 -1
- package/dist/config/user-sync-config.js +8 -0
- package/dist/drift/detector.d.ts +2 -2
- package/dist/drift/detector.d.ts.map +1 -1
- package/dist/drift/detector.js +18 -0
- package/dist/drift/strays.d.ts.map +1 -1
- package/dist/drift/strays.js +5 -0
- package/dist/engine/collection-sync.d.ts +14 -0
- package/dist/engine/collection-sync.d.ts.map +1 -0
- package/dist/engine/collection-sync.js +282 -0
- package/dist/engine/compute-plan.d.ts +8 -1
- package/dist/engine/compute-plan.d.ts.map +1 -1
- package/dist/engine/compute-plan.js +303 -12
- package/dist/engine/engine.types.d.ts +61 -0
- package/dist/engine/engine.types.d.ts.map +1 -1
- package/dist/engine/execute-plan.d.ts +22 -2
- package/dist/engine/execute-plan.d.ts.map +1 -1
- package/dist/engine/execute-plan.js +459 -27
- package/dist/engine/provider-path-safety.d.ts +1 -0
- package/dist/engine/provider-path-safety.d.ts.map +1 -1
- package/dist/engine/provider-path-safety.js +15 -0
- package/dist/engine/scanner.d.ts +2 -2
- package/dist/engine/scanner.d.ts.map +1 -1
- package/dist/engine/scanner.js +21 -4
- package/dist/fs/io.d.ts +67 -0
- package/dist/fs/io.d.ts.map +1 -1
- package/dist/fs/io.js +536 -3
- package/dist/manifest/index.d.ts +2 -2
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +1 -1
- package/dist/manifest/manager.d.ts +2 -2
- package/dist/manifest/manager.d.ts.map +1 -1
- package/dist/manifest/manager.js +20 -3
- package/dist/manifest/manifest.types.d.ts +704 -13
- package/dist/manifest/manifest.types.d.ts.map +1 -1
- package/dist/manifest/manifest.types.js +131 -15
- package/dist/providers/codex/codec/sync-extension.d.ts.map +1 -1
- package/dist/providers/codex/codec/sync-extension.js +41 -10
- package/dist/providers/cursor/codec/sync-extension.d.ts.map +1 -1
- package/dist/providers/cursor/codec/sync-extension.js +41 -10
- package/dist/providers/identity/absolute-paths.d.ts +68 -0
- package/dist/providers/identity/absolute-paths.d.ts.map +1 -0
- package/dist/providers/identity/absolute-paths.js +144 -0
- package/dist/providers/identity/claude-runtime-observation.d.ts +105 -0
- package/dist/providers/identity/claude-runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.d.ts +40 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.d.ts.map +1 -0
- package/dist/providers/identity/claude-runtime-observation.fixtures.js +146 -0
- package/dist/providers/identity/claude-runtime-observation.js +229 -0
- package/dist/providers/identity/codex-runtime-observation.d.ts +75 -0
- package/dist/providers/identity/codex-runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.d.ts +37 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.d.ts.map +1 -0
- package/dist/providers/identity/codex-runtime-observation.fixtures.js +539 -0
- package/dist/providers/identity/codex-runtime-observation.js +255 -0
- package/dist/providers/identity/generic-dispatch-record.d.ts +313 -0
- package/dist/providers/identity/generic-dispatch-record.d.ts.map +1 -0
- package/dist/providers/identity/generic-dispatch-record.js +539 -0
- package/dist/providers/identity/oat-dispatch-record.d.ts +1964 -0
- package/dist/providers/identity/oat-dispatch-record.d.ts.map +1 -0
- package/dist/providers/identity/oat-dispatch-record.js +691 -0
- package/dist/providers/identity/runtime-observation.d.ts +100 -0
- package/dist/providers/identity/runtime-observation.d.ts.map +1 -0
- package/dist/providers/identity/runtime-observation.js +169 -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 +12 -0
- package/dist/providers/shared/materialization-extension.d.ts.map +1 -1
- package/dist/providers/shared/registry.d.ts +69 -0
- package/dist/providers/shared/registry.d.ts.map +1 -0
- package/dist/providers/shared/registry.js +252 -0
- package/dist/providers/shared/restart-adviser.d.ts +26 -0
- package/dist/providers/shared/restart-adviser.d.ts.map +1 -0
- package/dist/providers/shared/restart-adviser.js +96 -0
- package/dist/shared/types.d.ts +4 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,24 +1,161 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { getProviderRegistrations, } from '../../providers/shared/registry.js';
|
|
2
|
+
import { adviseProviderRefresh, } from '../../providers/shared/restart-adviser.js';
|
|
3
|
+
import { buildCollectionLifecycle, countPlannedOperations, formatCollectionLifecycle, toSyncOutputPlan, } from './sync.utils.js';
|
|
4
|
+
function extensionResultContentKind(registrations, result) {
|
|
5
|
+
const registration = registrations.find(({ adapter }) => adapter.name === result.provider);
|
|
6
|
+
const candidates = registration?.capabilities.filter(({ scope, support, projectionModes }) => scope === result.scope &&
|
|
7
|
+
support === 'supported' &&
|
|
8
|
+
projectionModes.includes('materialization-extension'));
|
|
9
|
+
// Extension operation identities do not carry a canonical asset kind.
|
|
10
|
+
// Attribute only when provider capability evidence gives one unambiguous
|
|
11
|
+
// content kind; otherwise leave the exact result unattributed.
|
|
12
|
+
return candidates?.length === 1 ? candidates[0].contentKind : undefined;
|
|
13
|
+
}
|
|
14
|
+
function buildProviderRefreshAdvice(input) {
|
|
15
|
+
const registrations = getProviderRegistrations();
|
|
16
|
+
const changed = [
|
|
17
|
+
...input.operationResults
|
|
18
|
+
.filter(({ status }) => status === 'changed')
|
|
19
|
+
.map(({ scope, provider, contentKind }) => ({
|
|
20
|
+
scope,
|
|
21
|
+
provider,
|
|
22
|
+
contentKind,
|
|
23
|
+
})),
|
|
24
|
+
...input.extensionResults
|
|
25
|
+
.filter(({ status }) => status === 'changed')
|
|
26
|
+
.flatMap((result) => {
|
|
27
|
+
const contentKind = extensionResultContentKind(registrations, result);
|
|
28
|
+
return contentKind === undefined
|
|
29
|
+
? []
|
|
30
|
+
: [{ scope: result.scope, provider: result.provider, contentKind }];
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
const seen = new Set();
|
|
34
|
+
return changed.flatMap(({ scope, provider, contentKind }) => {
|
|
35
|
+
const key = `${scope}:${provider}:${contentKind}`;
|
|
36
|
+
if (seen.has(key))
|
|
37
|
+
return [];
|
|
38
|
+
seen.add(key);
|
|
39
|
+
const policy = registrations
|
|
40
|
+
.find(({ adapter }) => adapter.name === provider)
|
|
41
|
+
?.capabilities.find((capability) => capability.scope === scope && capability.contentKind === contentKind)?.catalogRefresh ?? {
|
|
42
|
+
state: 'unknown',
|
|
43
|
+
reason: 'Provider or capability is not registered',
|
|
44
|
+
};
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
scope,
|
|
48
|
+
provider,
|
|
49
|
+
contentKind,
|
|
50
|
+
materialization: 'changed',
|
|
51
|
+
visibility: adviseProviderRefresh({
|
|
52
|
+
policy,
|
|
53
|
+
materialization: 'changed',
|
|
54
|
+
}),
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function formatProviderRefreshAdvice(advice) {
|
|
60
|
+
return advice
|
|
61
|
+
.map(({ scope, provider, contentKind, visibility }) => {
|
|
62
|
+
const recovery = visibility.recovery[0]?.message;
|
|
63
|
+
return `Provider visibility [${scope}] ${provider}/${contentKind}: ${visibility.state} — ${recovery ?? visibility.reason}`;
|
|
64
|
+
})
|
|
65
|
+
.join('\n');
|
|
66
|
+
}
|
|
67
|
+
function countSkippedExtensionEntries(scopePlans) {
|
|
3
68
|
return scopePlans.reduce((total, scopePlan) => {
|
|
4
69
|
const extensionSkipped = scopePlan.materializationExtensions.reduce((count, extension) => count +
|
|
5
70
|
extension.operations.filter((operation) => operation.action === 'skip')
|
|
6
71
|
.length, 0);
|
|
7
|
-
return
|
|
8
|
-
scopePlan.plan.entries.filter((entry) => entry.operation === 'skip')
|
|
9
|
-
.length +
|
|
10
|
-
extensionSkipped);
|
|
72
|
+
return total + extensionSkipped;
|
|
11
73
|
}, 0);
|
|
12
74
|
}
|
|
13
|
-
function buildSummary(scopePlans,
|
|
75
|
+
function buildSummary(scopePlans, coreApplied, coreFailed, coreSkipped, extensionApplied, extensionFailed) {
|
|
14
76
|
return {
|
|
15
77
|
plannedOperations: countPlannedOperations(scopePlans),
|
|
16
|
-
applied,
|
|
17
|
-
failed,
|
|
18
|
-
skipped:
|
|
78
|
+
applied: coreApplied + extensionApplied,
|
|
79
|
+
failed: coreFailed + extensionFailed,
|
|
80
|
+
skipped: coreSkipped + countSkippedExtensionEntries(scopePlans),
|
|
19
81
|
};
|
|
20
82
|
}
|
|
21
|
-
function
|
|
83
|
+
function normalizeOperationResults(plan, result) {
|
|
84
|
+
if (result.operations) {
|
|
85
|
+
return result.operations;
|
|
86
|
+
}
|
|
87
|
+
const plannedOperations = [...plan.entries, ...plan.removals];
|
|
88
|
+
return plannedOperations.map((operation) => {
|
|
89
|
+
return {
|
|
90
|
+
scope: plan.scope,
|
|
91
|
+
provider: operation.provider,
|
|
92
|
+
contentKind: operation.canonical.type,
|
|
93
|
+
asset: operation.canonical.name,
|
|
94
|
+
action: operation.operation,
|
|
95
|
+
status: operation.operation === 'skip' ? 'current' : 'unknown',
|
|
96
|
+
};
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function materializationOperationIdentity(operation) {
|
|
100
|
+
return JSON.stringify([
|
|
101
|
+
operation.provider,
|
|
102
|
+
operation.target,
|
|
103
|
+
operation.path,
|
|
104
|
+
operation.action,
|
|
105
|
+
operation.entryName ?? null,
|
|
106
|
+
]);
|
|
107
|
+
}
|
|
108
|
+
function syncOperationIdentity(operation) {
|
|
109
|
+
return JSON.stringify([
|
|
110
|
+
operation.scope,
|
|
111
|
+
operation.provider,
|
|
112
|
+
operation.contentKind,
|
|
113
|
+
operation.asset,
|
|
114
|
+
operation.action,
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
function coreHumanStatus(status) {
|
|
118
|
+
switch (status) {
|
|
119
|
+
case 'changed':
|
|
120
|
+
case 'current':
|
|
121
|
+
case 'failed':
|
|
122
|
+
case 'missing':
|
|
123
|
+
case 'unknown':
|
|
124
|
+
return status;
|
|
125
|
+
default:
|
|
126
|
+
return 'unknown';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function formatCoreResults(plan, evidence, dependencies) {
|
|
130
|
+
const operations = [...plan.entries, ...plan.removals];
|
|
131
|
+
if (operations.length === 0) {
|
|
132
|
+
if ((plan.collections?.length ?? 0) > 0) {
|
|
133
|
+
return 'Core results\nNo per-entry operations.';
|
|
134
|
+
}
|
|
135
|
+
return dependencies.formatSyncPlan(plan, true);
|
|
136
|
+
}
|
|
137
|
+
const resultsByIdentity = new Map((evidence?.operationResults ?? []).map((result) => [
|
|
138
|
+
syncOperationIdentity(result),
|
|
139
|
+
result,
|
|
140
|
+
]));
|
|
141
|
+
const lines = operations.map((operation) => {
|
|
142
|
+
const result = resultsByIdentity.get(syncOperationIdentity({
|
|
143
|
+
scope: plan.scope,
|
|
144
|
+
provider: operation.provider,
|
|
145
|
+
contentKind: operation.canonical.type,
|
|
146
|
+
asset: operation.canonical.name,
|
|
147
|
+
action: operation.operation,
|
|
148
|
+
}));
|
|
149
|
+
const status = coreHumanStatus(result?.status);
|
|
150
|
+
const failure = result?.failure ? ` — ${result.failure}` : '';
|
|
151
|
+
return `- ${plan.scope}:${operation.provider}:${operation.canonical.type}:${operation.operation} ${operation.canonical.name}\n reason: ${operation.reason}\n result: ${status}${failure}`;
|
|
152
|
+
});
|
|
153
|
+
const aggregate = evidence?.aggregateOnly
|
|
154
|
+
? `\nCore aggregate result: applied ${evidence.aggregate.applied}, failed ${evidence.aggregate.failed}, skipped ${evidence.aggregate.skipped}; non-skip named outcomes remain unknown.`
|
|
155
|
+
: '';
|
|
156
|
+
return `Core results${aggregate}\n${lines.join('\n')}`;
|
|
157
|
+
}
|
|
158
|
+
function formatAppliedOutput(scopePlans, coreApplyEvidence, dependencies) {
|
|
22
159
|
if (scopePlans.length === 0) {
|
|
23
160
|
return dependencies.formatSyncPlan({
|
|
24
161
|
scope: 'project',
|
|
@@ -28,28 +165,53 @@ function formatAppliedOutput(scopePlans, dependencies) {
|
|
|
28
165
|
}
|
|
29
166
|
return scopePlans
|
|
30
167
|
.map((scopePlan) => {
|
|
31
|
-
const syncOutput =
|
|
168
|
+
const syncOutput = formatCoreResults(scopePlan.plan, coreApplyEvidence.find((evidence) => evidence.plan === scopePlan.plan), dependencies);
|
|
169
|
+
const collectionOutput = formatCollectionLifecycle(buildCollectionLifecycle(scopePlan, coreApplyEvidence.find((evidence) => evidence.plan === scopePlan.plan)
|
|
170
|
+
?.collectionResults));
|
|
32
171
|
if (scopePlan.materializationExtensions.length === 0) {
|
|
33
|
-
return `Scope: ${scopePlan.scope}\n${syncOutput}
|
|
172
|
+
return [`Scope: ${scopePlan.scope}\n${syncOutput}`, collectionOutput]
|
|
173
|
+
.filter(Boolean)
|
|
174
|
+
.join('\n\n');
|
|
34
175
|
}
|
|
35
176
|
const extensionSections = scopePlan.materializationExtensions.map((extension) => {
|
|
177
|
+
const resultsByIdentity = new Map((extension.operationResults ?? []).map((result) => [
|
|
178
|
+
materializationOperationIdentity(result),
|
|
179
|
+
result,
|
|
180
|
+
]));
|
|
36
181
|
const lines = extension.operations.map((operation) => {
|
|
37
182
|
const entry = operation.entryName
|
|
38
183
|
? ` (${operation.entryName})`
|
|
39
184
|
: '';
|
|
40
|
-
|
|
185
|
+
const result = resultsByIdentity.get(materializationOperationIdentity(operation));
|
|
186
|
+
const status = result?.status ?? 'unknown';
|
|
187
|
+
const failure = result?.failure ? ` — ${result.failure}` : '';
|
|
188
|
+
return `- ${operation.provider}:${operation.target}:${operation.action} ${operation.path}${entry}\n reason: ${operation.reason}\n result: ${status}${failure}`;
|
|
41
189
|
});
|
|
42
|
-
return `${extension.provider} extension
|
|
190
|
+
return `${extension.provider} extension results\n${lines.join('\n')}`;
|
|
43
191
|
});
|
|
44
|
-
return
|
|
192
|
+
return [
|
|
193
|
+
`Scope: ${scopePlan.scope}\n${syncOutput}`,
|
|
194
|
+
collectionOutput,
|
|
195
|
+
extensionSections.join('\n\n'),
|
|
196
|
+
]
|
|
197
|
+
.filter(Boolean)
|
|
198
|
+
.join('\n\n');
|
|
45
199
|
})
|
|
46
200
|
.join('\n\n');
|
|
47
201
|
}
|
|
48
202
|
export async function runSyncApply(context, scopePlans, dependencies) {
|
|
49
|
-
let
|
|
50
|
-
let
|
|
203
|
+
let extensionApplied = 0;
|
|
204
|
+
let extensionFailed = 0;
|
|
205
|
+
let coreApplied = 0;
|
|
206
|
+
let coreFailed = 0;
|
|
207
|
+
let coreSkipped = 0;
|
|
208
|
+
const operationResults = [];
|
|
209
|
+
const coreApplyEvidence = [];
|
|
210
|
+
const extensionOperationResults = [];
|
|
51
211
|
for (const scopePlan of scopePlans) {
|
|
52
|
-
const hasSyncEntries = scopePlan.plan.entries.length > 0 ||
|
|
212
|
+
const hasSyncEntries = scopePlan.plan.entries.length > 0 ||
|
|
213
|
+
scopePlan.plan.removals.length > 0 ||
|
|
214
|
+
(scopePlan.plan.collections?.length ?? 0) > 0;
|
|
53
215
|
const hasExtensionPlannedOperations = scopePlan.materializationExtensionPlans.some((plan) => plan.operations.some((operation) => operation.action !== 'skip'));
|
|
54
216
|
// Derived from the same diagnostic that produced the pre-mutation advisory
|
|
55
217
|
// (`detectVersionSkew` in ./index), so the restamp and the warning cannot
|
|
@@ -63,8 +225,18 @@ export async function runSyncApply(context, scopePlans, dependencies) {
|
|
|
63
225
|
}
|
|
64
226
|
if (hasSyncEntries || shouldRefreshManifestVersion) {
|
|
65
227
|
const result = await dependencies.executeSyncPlan(scopePlan.plan, scopePlan.manifest, scopePlan.manifestPath);
|
|
66
|
-
|
|
67
|
-
|
|
228
|
+
coreApplied += result.applied;
|
|
229
|
+
coreFailed += result.failed;
|
|
230
|
+
coreSkipped += result.skipped;
|
|
231
|
+
const normalizedResults = normalizeOperationResults(scopePlan.plan, result);
|
|
232
|
+
operationResults.push(...normalizedResults);
|
|
233
|
+
coreApplyEvidence.push({
|
|
234
|
+
plan: scopePlan.plan,
|
|
235
|
+
operationResults: normalizedResults,
|
|
236
|
+
aggregateOnly: result.operations === undefined,
|
|
237
|
+
aggregate: result,
|
|
238
|
+
collectionResults: result.collectionResults ?? [],
|
|
239
|
+
});
|
|
68
240
|
}
|
|
69
241
|
for (const plan of scopePlan.materializationExtensionPlans) {
|
|
70
242
|
if (!plan.operations.some((operation) => operation.action !== 'skip')) {
|
|
@@ -77,15 +249,22 @@ export async function runSyncApply(context, scopePlans, dependencies) {
|
|
|
77
249
|
throw new Error(`Materialization extension ${plan.provider} disappeared before apply.`);
|
|
78
250
|
}
|
|
79
251
|
const result = await dependencies.applyMaterializationExtensionPlan(extension, scopePlan.scopeRoot, plan);
|
|
80
|
-
|
|
81
|
-
|
|
252
|
+
extensionApplied += result.applied;
|
|
253
|
+
extensionFailed += result.failed;
|
|
254
|
+
extensionOperationResults.push(...(result.operations ?? []).map((operation) => ({
|
|
255
|
+
...operation,
|
|
256
|
+
scope: scopePlan.scope,
|
|
257
|
+
})));
|
|
82
258
|
const summary = scopePlan.materializationExtensions.find((candidate) => candidate.provider === plan.provider);
|
|
83
259
|
if (summary) {
|
|
84
|
-
|
|
260
|
+
summary.applied = result.applied;
|
|
261
|
+
summary.failed = result.failed;
|
|
262
|
+
summary.skipped = result.skipped;
|
|
263
|
+
summary.operationResults = result.operations;
|
|
85
264
|
}
|
|
86
265
|
}
|
|
87
266
|
}
|
|
88
|
-
const summary = buildSummary(scopePlans,
|
|
267
|
+
const summary = buildSummary(scopePlans, coreApplied, coreFailed, coreSkipped, extensionApplied, extensionFailed);
|
|
89
268
|
const providerMismatches = scopePlans
|
|
90
269
|
.map((scopePlan) => scopePlan.providerMismatches)
|
|
91
270
|
.filter((mismatch) => mismatch !== undefined);
|
|
@@ -109,29 +288,41 @@ export async function runSyncApply(context, scopePlans, dependencies) {
|
|
|
109
288
|
failed: extension.failed,
|
|
110
289
|
skipped: extension.skipped,
|
|
111
290
|
}));
|
|
291
|
+
const providerRefreshAdvice = buildProviderRefreshAdvice({
|
|
292
|
+
operationResults,
|
|
293
|
+
extensionResults: extensionOperationResults,
|
|
294
|
+
});
|
|
295
|
+
const collectionOperations = scopePlans.flatMap((scopePlan) => buildCollectionLifecycle(scopePlan, coreApplyEvidence.find((evidence) => evidence.plan === scopePlan.plan)
|
|
296
|
+
?.collectionResults));
|
|
112
297
|
if (context.json) {
|
|
113
298
|
context.logger.json({
|
|
114
299
|
scope: context.scope,
|
|
115
300
|
dryRun: false,
|
|
116
|
-
plans: scopePlans.map(
|
|
301
|
+
plans: scopePlans.map(toSyncOutputPlan),
|
|
302
|
+
collectionOperations,
|
|
117
303
|
summary,
|
|
118
304
|
providerMismatches,
|
|
119
305
|
versionSkew,
|
|
120
306
|
materializationExtensions,
|
|
307
|
+
operationResults,
|
|
121
308
|
codexExtensions,
|
|
309
|
+
providerRefreshAdvice,
|
|
122
310
|
});
|
|
123
311
|
}
|
|
124
312
|
else {
|
|
125
|
-
context.logger.info(formatAppliedOutput(scopePlans, dependencies));
|
|
313
|
+
context.logger.info(formatAppliedOutput(scopePlans, coreApplyEvidence, dependencies));
|
|
126
314
|
if (summary.plannedOperations === 0) {
|
|
127
315
|
context.logger.info('\nNo changes required.');
|
|
128
316
|
}
|
|
129
|
-
else if (failed > 0) {
|
|
317
|
+
else if (summary.failed > 0) {
|
|
130
318
|
context.logger.warn('\nSync completed with partial failures.');
|
|
131
319
|
}
|
|
132
320
|
else {
|
|
133
321
|
context.logger.success('\nSync applied successfully.');
|
|
134
322
|
}
|
|
323
|
+
if (providerRefreshAdvice.length > 0) {
|
|
324
|
+
context.logger.info(`\n${formatProviderRefreshAdvice(providerRefreshAdvice)}`);
|
|
325
|
+
}
|
|
135
326
|
}
|
|
136
|
-
process.exitCode = failed > 0 ? 1 : 0;
|
|
327
|
+
process.exitCode = summary.failed > 0 ? 1 : 0;
|
|
137
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dry-run.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/dry-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"dry-run.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/dry-run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EAExB,MAAM,cAAc,CAAC;AAsGtB,wBAAgB,aAAa,CAC3B,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,aAAa,EAAE,EAC3B,YAAY,EAAE,uBAAuB,GACpC,IAAI,CAqDN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { countPlannedOperations } from './sync.utils.js';
|
|
1
|
+
import { buildCollectionLifecycle, countPlannedOperations, formatCollectionLifecycle, toSyncOutputPlan, } from './sync.utils.js';
|
|
2
2
|
function summarize(scopePlans) {
|
|
3
3
|
return {
|
|
4
4
|
plannedOperations: countPlannedOperations(scopePlans),
|
|
@@ -10,10 +10,21 @@ function summarize(scopePlans) {
|
|
|
10
10
|
return (total +
|
|
11
11
|
scopePlan.plan.entries.filter((entry) => entry.operation === 'skip')
|
|
12
12
|
.length +
|
|
13
|
+
(scopePlan.plan.collections ?? []).filter(({ action }) => action === 'fallback-per-entry').length +
|
|
13
14
|
extensionSkipped);
|
|
14
15
|
}, 0),
|
|
15
16
|
};
|
|
16
17
|
}
|
|
18
|
+
function buildOperationResults(scopePlans) {
|
|
19
|
+
return scopePlans.flatMap((scopePlan) => [...scopePlan.plan.entries, ...scopePlan.plan.removals].map((operation) => ({
|
|
20
|
+
scope: scopePlan.scope,
|
|
21
|
+
provider: operation.provider,
|
|
22
|
+
contentKind: operation.canonical.type,
|
|
23
|
+
asset: operation.canonical.name,
|
|
24
|
+
action: operation.operation,
|
|
25
|
+
status: operation.operation === 'skip' ? 'current' : 'planned',
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
17
28
|
function formatMaterializationExtensions(scopePlan) {
|
|
18
29
|
return scopePlan.materializationExtensions
|
|
19
30
|
.map((extension) => {
|
|
@@ -35,11 +46,20 @@ function formatDryRunOutput(scopePlans, dependencies) {
|
|
|
35
46
|
}
|
|
36
47
|
return scopePlans
|
|
37
48
|
.map((scopePlan) => {
|
|
38
|
-
const
|
|
49
|
+
const collectionOutput = formatCollectionLifecycle(buildCollectionLifecycle(scopePlan));
|
|
50
|
+
const syncOutput = collectionOutput &&
|
|
51
|
+
scopePlan.plan.entries.length === 0 &&
|
|
52
|
+
scopePlan.plan.removals.length === 0
|
|
53
|
+
? 'Per-entry sync plan\nNo per-entry operations.'
|
|
54
|
+
: dependencies.formatSyncPlan(scopePlan.plan, false);
|
|
39
55
|
const extensionOutput = formatMaterializationExtensions(scopePlan);
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
return [
|
|
57
|
+
`Scope: ${scopePlan.scope}\n${syncOutput}`,
|
|
58
|
+
collectionOutput,
|
|
59
|
+
extensionOutput,
|
|
60
|
+
]
|
|
61
|
+
.filter(Boolean)
|
|
62
|
+
.join('\n\n');
|
|
43
63
|
})
|
|
44
64
|
.join('\n\n');
|
|
45
65
|
}
|
|
@@ -52,6 +72,8 @@ export function runSyncDryRun(context, scopePlans, dependencies) {
|
|
|
52
72
|
.map((scopePlan) => scopePlan.versionSkew)
|
|
53
73
|
.filter((skew) => skew !== undefined);
|
|
54
74
|
const materializationExtensions = scopePlans.flatMap((scopePlan) => scopePlan.materializationExtensions);
|
|
75
|
+
const operationResults = buildOperationResults(scopePlans);
|
|
76
|
+
const collectionOperations = scopePlans.flatMap((scopePlan) => buildCollectionLifecycle(scopePlan));
|
|
55
77
|
const codexExtensions = materializationExtensions
|
|
56
78
|
.filter((extension) => extension.provider === 'codex')
|
|
57
79
|
.map((extension) => ({
|
|
@@ -69,11 +91,13 @@ export function runSyncDryRun(context, scopePlans, dependencies) {
|
|
|
69
91
|
context.logger.json({
|
|
70
92
|
scope: context.scope,
|
|
71
93
|
dryRun: true,
|
|
72
|
-
plans: scopePlans.map(
|
|
94
|
+
plans: scopePlans.map(toSyncOutputPlan),
|
|
95
|
+
collectionOperations,
|
|
73
96
|
summary,
|
|
74
97
|
providerMismatches,
|
|
75
98
|
versionSkew,
|
|
76
99
|
materializationExtensions,
|
|
100
|
+
operationResults,
|
|
77
101
|
codexExtensions,
|
|
78
102
|
});
|
|
79
103
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
+
import { type SyncConfig } from '../../config/index.js';
|
|
2
|
+
import { type ProviderScopeContext } from '../../providers/shared/index.js';
|
|
3
|
+
import { type CanonicalScanTarget, type ConcreteScope } from '../../shared/types.js';
|
|
1
4
|
import { Command } from 'commander';
|
|
2
|
-
import type { SyncCommandDependencies } from './sync.types.js';
|
|
3
|
-
|
|
5
|
+
import type { ScopeSyncPlan, SyncCommandDependencies } from './sync.types.js';
|
|
6
|
+
type ContextualSyncDependencies = Omit<SyncCommandDependencies, 'computeSyncPlan' | 'scanCanonical'> & {
|
|
7
|
+
scanCanonical: (scopeRoot: string, scope: ConcreteScope, targets?: readonly CanonicalScanTarget[]) => ReturnType<SyncCommandDependencies['scanCanonical']>;
|
|
8
|
+
computeSyncPlan: (args: Parameters<SyncCommandDependencies['computeSyncPlan']>[0] & {
|
|
9
|
+
extensionOwnedCanonicalPathsByProvider?: Readonly<Record<string, readonly string[]>>;
|
|
10
|
+
}) => ReturnType<SyncCommandDependencies['computeSyncPlan']>;
|
|
11
|
+
resolveProviderScopeContext?: (input: {
|
|
12
|
+
scope: ScopeSyncPlan['scope'];
|
|
13
|
+
scopeRoot: string;
|
|
14
|
+
config: SyncConfig;
|
|
15
|
+
}) => Promise<ProviderScopeContext>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createSyncCommand(overrides?: Partial<ContextualSyncDependencies>): Command;
|
|
18
|
+
export {};
|
|
4
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,eAAe,CAAC;AAUvB,OAAO,EAOL,KAAK,oBAAoB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,OAAO,KAAK,EACV,aAAa,EAEb,uBAAuB,EAGxB,MAAM,cAAc,CAAC;AAEtB,KAAK,0BAA0B,GAAG,IAAI,CACpC,uBAAuB,EACvB,iBAAiB,GAAG,eAAe,CACpC,GAAG;IACF,aAAa,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,aAAa,EACpB,OAAO,CAAC,EAAE,SAAS,mBAAmB,EAAE,KACrC,UAAU,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC;IAC1D,eAAe,EAAE,CACf,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAChE,sCAAsC,CAAC,EAAE,QAAQ,CAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAClC,CAAC;KACH,KACE,UAAU,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5D,2BAA2B,CAAC,EAAE,CAAC,KAAK,EAAE;QACpC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,UAAU,CAAC;KACpB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACrC,CAAC;AA2eF,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,0BAA0B,CAAM,GAClD,OAAO,CA+DT"}
|