@topogram/cli 0.3.63 → 0.3.65
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/package.json +1 -1
- package/src/adoption/plan/index.js +703 -0
- package/src/adoption/plan.d.ts +6 -0
- package/src/adoption/plan.js +12 -703
- package/src/adoption/reporting.d.ts +10 -0
- package/src/adoption/review-groups.d.ts +6 -0
- package/src/agent-brief.d.ts +3 -0
- package/src/agent-brief.js +495 -0
- package/src/agent-ops/query-builders/auth.js +375 -0
- package/src/agent-ops/query-builders/change-risk/change-plan.js +123 -0
- package/src/agent-ops/query-builders/change-risk/import-plan.js +49 -0
- package/src/agent-ops/query-builders/change-risk/maintained.js +286 -0
- package/src/agent-ops/query-builders/change-risk/review-packets.js +123 -0
- package/src/agent-ops/query-builders/change-risk/risk.js +189 -0
- package/src/agent-ops/query-builders/change-risk.js +25 -0
- package/src/agent-ops/query-builders/common.js +149 -0
- package/src/agent-ops/query-builders/maintained-risk.js +539 -0
- package/src/agent-ops/query-builders/maintained-shared.js +120 -0
- package/src/agent-ops/query-builders/multi-agent.js +547 -0
- package/src/agent-ops/query-builders/projection-impacts.js +514 -0
- package/src/agent-ops/query-builders/work-packets.js +417 -0
- package/src/agent-ops/query-builders/workflow-context-shared.js +300 -0
- package/src/agent-ops/query-builders/workflow-context.js +398 -0
- package/src/agent-ops/query-builders/workflow-presets-core.js +676 -0
- package/src/agent-ops/query-builders/workflow-presets.js +341 -0
- package/src/agent-ops/query-builders.d.ts +26 -0
- package/src/agent-ops/query-builders.js +42 -5021
- package/src/archive/archive.d.ts +2 -0
- package/src/archive/compact.d.ts +1 -0
- package/src/archive/unarchive.d.ts +1 -0
- package/src/catalog/constants.js +10 -0
- package/src/catalog/copy.js +60 -0
- package/src/catalog/diagnostics.js +15 -0
- package/src/catalog/entries.js +42 -0
- package/src/catalog/files.js +67 -0
- package/src/catalog/provenance.js +122 -0
- package/src/catalog/source.js +150 -0
- package/src/catalog/validation.js +252 -0
- package/src/catalog.d.ts +12 -0
- package/src/catalog.js +18 -750
- package/src/cli/catalog-alias.d.ts +1 -0
- package/src/cli/command-parser.js +38 -0
- package/src/cli/command-parsers/core.js +102 -0
- package/src/cli/command-parsers/generator.js +39 -0
- package/src/cli/command-parsers/import.js +44 -0
- package/src/cli/command-parsers/legacy-workflow.js +21 -0
- package/src/cli/command-parsers/project.js +47 -0
- package/src/cli/command-parsers/sdlc.js +47 -0
- package/src/cli/command-parsers/shared.js +51 -0
- package/src/cli/command-parsers/template.js +48 -0
- package/src/cli/commands/agent.js +47 -0
- package/src/cli/commands/catalog/check.js +31 -0
- package/src/cli/commands/catalog/copy.js +59 -0
- package/src/cli/commands/catalog/doctor.js +248 -0
- package/src/cli/commands/catalog/help.js +21 -0
- package/src/cli/commands/catalog/list.js +52 -0
- package/src/cli/commands/catalog/runner.js +92 -0
- package/src/cli/commands/catalog/shared.js +17 -0
- package/src/cli/commands/catalog/show.js +134 -0
- package/src/cli/commands/catalog.js +32 -0
- package/src/cli/commands/check.js +268 -0
- package/src/cli/commands/doctor.js +268 -0
- package/src/cli/commands/emit.js +149 -0
- package/src/cli/commands/generate.js +96 -0
- package/src/cli/commands/generator-policy/package-info.js +162 -0
- package/src/cli/commands/generator-policy/payloads.js +372 -0
- package/src/cli/commands/generator-policy/printers.js +159 -0
- package/src/cli/commands/generator-policy/runner.js +81 -0
- package/src/cli/commands/generator-policy/shared.js +39 -0
- package/src/cli/commands/generator-policy.js +17 -0
- package/src/cli/commands/generator.js +443 -0
- package/src/cli/commands/import/adopt.js +170 -0
- package/src/cli/commands/import/check.js +91 -0
- package/src/cli/commands/import/diff.js +84 -0
- package/src/cli/commands/import/help.js +47 -0
- package/src/cli/commands/import/paths.js +277 -0
- package/src/cli/commands/import/plan.js +284 -0
- package/src/cli/commands/import/refresh.js +470 -0
- package/src/cli/commands/import/status-history.js +196 -0
- package/src/cli/commands/import/workspace.js +230 -0
- package/src/cli/commands/import-runner.js +157 -0
- package/src/cli/commands/import.js +35 -0
- package/src/cli/commands/inspect.js +55 -0
- package/src/cli/commands/new.js +94 -0
- package/src/cli/commands/package/constants.js +17 -0
- package/src/cli/commands/package/doctor.js +240 -0
- package/src/cli/commands/package/help.js +27 -0
- package/src/cli/commands/package/lockfile.js +135 -0
- package/src/cli/commands/package/npm.js +97 -0
- package/src/cli/commands/package/reporting.js +35 -0
- package/src/cli/commands/package/runner.js +33 -0
- package/src/cli/commands/package/shared.js +9 -0
- package/src/cli/commands/package/update-cli.js +252 -0
- package/src/cli/commands/package/versions.js +35 -0
- package/src/cli/commands/package.js +31 -0
- package/src/cli/commands/query/change-plan.js +68 -0
- package/src/cli/commands/query/definitions.js +202 -0
- package/src/cli/commands/query/import-adopt.js +121 -0
- package/src/cli/commands/query/runner/artifacts.js +102 -0
- package/src/cli/commands/query/runner/boundaries.js +211 -0
- package/src/cli/commands/query/runner/change.js +182 -0
- package/src/cli/commands/query/runner/import-adopt.js +111 -0
- package/src/cli/commands/query/runner/index.js +31 -0
- package/src/cli/commands/query/runner/output.js +12 -0
- package/src/cli/commands/query/runner/workflow.js +241 -0
- package/src/cli/commands/query/runner.js +3 -0
- package/src/cli/commands/query/workflow-context.js +5 -0
- package/src/cli/commands/query/workspace.js +274 -0
- package/src/cli/commands/query.js +11 -0
- package/src/cli/commands/release-rollout.js +257 -0
- package/src/cli/commands/release-shared.js +528 -0
- package/src/cli/commands/release-status.js +429 -0
- package/src/cli/commands/release.js +107 -0
- package/src/cli/commands/sdlc.js +168 -0
- package/src/cli/commands/setup.js +76 -0
- package/src/cli/commands/source.js +291 -0
- package/src/cli/commands/template/baseline.js +100 -0
- package/src/cli/commands/template/check.js +466 -0
- package/src/cli/commands/template/constants.js +8 -0
- package/src/cli/commands/template/diagnostics.js +26 -0
- package/src/cli/commands/template/help.js +28 -0
- package/src/cli/commands/template/lifecycle.js +404 -0
- package/src/cli/commands/template/list-show.js +287 -0
- package/src/cli/commands/template/policy.js +422 -0
- package/src/cli/commands/template/shared.js +127 -0
- package/src/cli/commands/template/updates.js +352 -0
- package/src/cli/commands/template-runner.js +198 -0
- package/src/cli/commands/template.js +43 -0
- package/src/cli/commands/trust.js +219 -0
- package/src/cli/commands/version.js +40 -0
- package/src/cli/commands/widget.js +168 -0
- package/src/cli/commands/workflow.js +63 -0
- package/src/cli/dispatcher.js +392 -0
- package/src/cli/help-dispatch.js +188 -0
- package/src/cli/help.js +296 -0
- package/src/cli/migration-guidance.js +59 -0
- package/src/cli/options.js +96 -0
- package/src/cli/output-safety.js +107 -0
- package/src/cli/path-normalization.js +29 -0
- package/src/cli.js +47 -11711
- package/src/example-implementation.d.ts +2 -0
- package/src/format.d.ts +1 -0
- package/src/generator/api/contracts.js +497 -0
- package/src/generator/api/metadata.js +221 -0
- package/src/generator/api/openapi.js +559 -0
- package/src/generator/api/schema.js +124 -0
- package/src/generator/api/types.d.ts +98 -0
- package/src/generator/api.js +3 -1195
- package/src/generator/check.d.ts +1 -0
- package/src/generator/context/bundle.d.ts +1 -0
- package/src/generator/context/shared/domain-sdlc.js +282 -0
- package/src/generator/context/shared/maintained-boundary.js +665 -0
- package/src/generator/context/shared/metrics.js +85 -0
- package/src/generator/context/shared/primitives.js +64 -0
- package/src/generator/context/shared/relationships.js +453 -0
- package/src/generator/context/shared/summaries.js +263 -0
- package/src/generator/context/shared/types.d.ts +207 -0
- package/src/generator/context/shared.d.ts +44 -0
- package/src/generator/context/shared.js +80 -1390
- package/src/generator/context/slice/core.js +397 -0
- package/src/generator/context/slice/sdlc.js +417 -0
- package/src/generator/context/slice/ui-packets.js +183 -0
- package/src/generator/context/slice.js +2 -859
- package/src/generator/native/parity-bundle.js +2 -1
- package/src/generator/registry/index.js +507 -0
- package/src/generator/registry.js +18 -504
- package/src/generator/runtime/environment/index.js +666 -0
- package/src/generator/runtime/environment.js +4 -666
- package/src/generator/runtime/runtime-check/index.js +554 -0
- package/src/generator/runtime/runtime-check.js +4 -554
- package/src/generator/runtime/shared/index.js +572 -0
- package/src/generator/runtime/shared.js +19 -570
- package/src/generator/shared.d.ts +2 -0
- package/src/generator/surfaces/shared.d.ts +3 -0
- package/src/generator/surfaces/web/html-escape.js +22 -0
- package/src/generator/surfaces/web/react.js +10 -8
- package/src/generator/surfaces/web/sveltekit.js +7 -5
- package/src/generator/surfaces/web/vanilla.js +8 -4
- package/src/generator/widget-conformance/behavior-report.js +258 -0
- package/src/generator/widget-conformance/checks.js +371 -0
- package/src/generator/widget-conformance/projection-context.js +200 -0
- package/src/generator/widget-conformance/report.js +166 -0
- package/src/generator/widget-conformance/types.d.ts +121 -0
- package/src/generator/widget-conformance.js +3 -824
- package/src/generator.d.ts +2 -0
- package/src/github-client.js +520 -0
- package/src/import/core/context.d.ts +3 -0
- package/src/import/core/contracts.d.ts +1 -0
- package/src/import/core/registry.d.ts +4 -0
- package/src/import/core/runner/candidates.js +217 -0
- package/src/import/core/runner/options.js +22 -0
- package/src/import/core/runner/reports.js +50 -0
- package/src/import/core/runner/run.js +79 -0
- package/src/import/core/runner/tracks.js +150 -0
- package/src/import/core/runner/ui-drafts.js +337 -0
- package/src/import/core/runner.js +3 -698
- package/src/import/core/shared/api-routes.js +221 -0
- package/src/import/core/shared/candidates.js +97 -0
- package/src/import/core/shared/files.js +177 -0
- package/src/import/core/shared/next-app.js +389 -0
- package/src/import/core/shared/types.d.ts +51 -0
- package/src/import/core/shared/ui-routes.js +230 -0
- package/src/import/core/shared.js +67 -910
- package/src/import/extractors/api/flutter-dio.js +4 -8
- package/src/import/extractors/api/react-native-repository.js +4 -8
- package/src/import/index.d.ts +4 -0
- package/src/import/provenance.d.ts +4 -0
- package/src/new-project/constants.js +128 -0
- package/src/new-project/create.js +83 -0
- package/src/new-project/json.js +28 -0
- package/src/new-project/metadata.js +96 -0
- package/src/new-project/package-spec.js +161 -0
- package/src/new-project/project-files.js +348 -0
- package/src/new-project/template-policy.js +269 -0
- package/src/new-project/template-resolution.js +368 -0
- package/src/new-project/template-snapshots.js +430 -0
- package/src/new-project/template-updates.js +512 -0
- package/src/new-project/types.d.ts +83 -0
- package/src/new-project.js +6 -2188
- package/src/npm-safety.js +79 -0
- package/src/parser.d.ts +87 -0
- package/src/parser.js +118 -0
- package/src/path-helpers.d.ts +1 -0
- package/src/path-helpers.js +20 -0
- package/src/policy/review-boundaries.d.ts +15 -0
- package/src/project-config/index.js +564 -0
- package/src/project-config.js +19 -560
- package/src/reconcile/docs.d.ts +8 -0
- package/src/reconcile/journeys.d.ts +1 -0
- package/src/resolver/enrich/acceptance-criterion.js +2 -0
- package/src/resolver/enrich/bug.js +2 -0
- package/src/resolver/enrich/pitch.js +2 -0
- package/src/resolver/enrich/requirement.js +2 -0
- package/src/resolver/enrich/task.js +2 -0
- package/src/resolver/index.js +19 -2089
- package/src/resolver/normalize.js +384 -1
- package/src/resolver/plans.js +168 -0
- package/src/resolver/projections-api.js +494 -0
- package/src/resolver/projections-db.js +133 -0
- package/src/resolver/projections-ui.js +317 -0
- package/src/resolver/shapes.js +251 -0
- package/src/resolver/shared.js +278 -0
- package/src/resolver/widgets.js +132 -0
- package/src/resolver.d.ts +1 -0
- package/src/runtime-support.js +29 -0
- package/src/sdlc/adopt.d.ts +1 -0
- package/src/sdlc/check.d.ts +1 -0
- package/src/sdlc/explain.d.ts +1 -0
- package/src/sdlc/release.d.ts +1 -0
- package/src/sdlc/scaffold.d.ts +1 -0
- package/src/sdlc/transition.d.ts +1 -0
- package/src/template-trust/constants.js +62 -0
- package/src/template-trust/content.js +258 -0
- package/src/template-trust/diff.js +92 -0
- package/src/template-trust/policy.js +61 -0
- package/src/template-trust/record.js +90 -0
- package/src/template-trust/status.js +182 -0
- package/src/template-trust.js +24 -687
- package/src/text-helpers.d.ts +7 -0
- package/src/text-helpers.js +245 -0
- package/src/topogram-config.js +306 -0
- package/src/topogram-types.d.ts +69 -0
- package/src/validator/common.js +488 -0
- package/src/validator/data-model.js +237 -0
- package/src/validator/docs.js +167 -0
- package/src/validator/expressions.js +146 -1
- package/src/validator/index.d.ts +23 -0
- package/src/validator/index.js +32 -3585
- package/src/validator/kinds.d.ts +41 -0
- package/src/validator/kinds.js +2 -0
- package/src/validator/model-helpers.js +46 -0
- package/src/validator/per-kind/acceptance-criterion.js +5 -0
- package/src/validator/per-kind/bug.js +6 -0
- package/src/validator/per-kind/domain.js +15 -2
- package/src/validator/per-kind/pitch.js +7 -0
- package/src/validator/per-kind/requirement.js +5 -0
- package/src/validator/per-kind/task.js +7 -0
- package/src/validator/per-kind/widget.js +14 -0
- package/src/validator/projections/api-http-async.js +410 -0
- package/src/validator/projections/api-http-authz.js +88 -0
- package/src/validator/projections/api-http-core.js +205 -0
- package/src/validator/projections/api-http-policies.js +339 -0
- package/src/validator/projections/api-http-responses.js +233 -0
- package/src/validator/projections/api-http.js +44 -0
- package/src/validator/projections/db.js +353 -0
- package/src/validator/projections/generator-defaults.js +45 -0
- package/src/validator/projections/helpers.js +87 -0
- package/src/validator/projections/ui-helpers.js +214 -0
- package/src/validator/projections/ui-navigation.js +344 -0
- package/src/validator/projections/ui-structure.js +364 -0
- package/src/validator/projections/ui-widgets.js +493 -0
- package/src/validator/projections/ui.js +46 -0
- package/src/validator/registry.js +48 -1
- package/src/validator/utils.d.ts +20 -0
- package/src/validator/utils.js +115 -12
- package/src/validator.d.ts +2 -0
- package/src/widget-behavior.d.ts +1 -0
- package/src/workflows/adoption/index.js +26 -0
- package/src/workflows/docs-generate.js +262 -0
- package/src/workflows/docs-scan.js +703 -0
- package/src/workflows/docs.js +15 -0
- package/src/workflows/import-app/api/collect.js +221 -0
- package/src/workflows/import-app/api/openapi.js +257 -0
- package/src/workflows/import-app/api/routes.js +327 -0
- package/src/workflows/import-app/api/sources.js +22 -0
- package/src/workflows/import-app/api.js +4 -0
- package/src/workflows/import-app/db.js +538 -0
- package/src/workflows/import-app/index.js +30 -0
- package/src/workflows/import-app/shared.js +218 -0
- package/src/workflows/import-app/ui.js +443 -0
- package/src/workflows/import-app/workflow.js +159 -0
- package/src/workflows/reconcile/adoption-plan/build.js +208 -0
- package/src/workflows/reconcile/adoption-plan/dependencies.js +75 -0
- package/src/workflows/reconcile/adoption-plan/outputs.js +143 -0
- package/src/workflows/reconcile/adoption-plan/paths.js +58 -0
- package/src/workflows/reconcile/adoption-plan/projection-patches.js +177 -0
- package/src/workflows/reconcile/adoption-plan/reasons.js +107 -0
- package/src/workflows/reconcile/adoption-plan.js +32 -0
- package/src/workflows/reconcile/auth/closures.js +115 -0
- package/src/workflows/reconcile/auth/formatters.js +142 -0
- package/src/workflows/reconcile/auth/inference.js +330 -0
- package/src/workflows/reconcile/auth/roles.js +122 -0
- package/src/workflows/reconcile/auth.js +37 -0
- package/src/workflows/reconcile/bundle-core/index.js +600 -0
- package/src/workflows/reconcile/bundle-core.js +14 -0
- package/src/workflows/reconcile/bundle-shared.js +75 -0
- package/src/workflows/reconcile/candidate-model.js +477 -0
- package/src/workflows/reconcile/canonical-surface.js +264 -0
- package/src/workflows/reconcile/gap-report.js +333 -0
- package/src/workflows/reconcile/ids.js +6 -0
- package/src/workflows/reconcile/impacts/adoption-plan.js +192 -0
- package/src/workflows/reconcile/impacts/indexes.js +101 -0
- package/src/workflows/reconcile/impacts/patches.js +252 -0
- package/src/workflows/reconcile/impacts/reports.js +80 -0
- package/src/workflows/reconcile/impacts.js +16 -0
- package/src/workflows/reconcile/index.js +7 -0
- package/src/workflows/reconcile/renderers.js +461 -0
- package/src/workflows/reconcile/summary.js +90 -0
- package/src/workflows/reconcile/workflow.js +309 -0
- package/src/workflows/shared.js +189 -0
- package/src/workflows/types.d.ts +93 -0
- package/src/workflows.d.ts +1 -0
- package/src/workflows.js +10 -7652
- package/src/workspace-docs.d.ts +29 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {
|
|
2
|
+
customizationTemplateFromProviderPreset,
|
|
3
|
+
findDerivedTeamPreset,
|
|
4
|
+
loadWorkflowPresetArtifacts,
|
|
5
|
+
providerManifestWorkflowPresetDeclarations,
|
|
6
|
+
summarizeWorkflowPreset,
|
|
7
|
+
workflowPresetChangedFields,
|
|
8
|
+
workflowPresetComparableShape,
|
|
9
|
+
workflowPresetDeltaPayload,
|
|
10
|
+
workflowPresetDerivedSource,
|
|
11
|
+
workflowPresetFingerprint,
|
|
12
|
+
workflowPresetRequiresFreshReview,
|
|
13
|
+
refreshBaselineForProviderPreset,
|
|
14
|
+
recommendedCustomizationAction,
|
|
15
|
+
customizationStatusForPreset,
|
|
16
|
+
defaultLocalWorkflowPresetPath
|
|
17
|
+
} from "./workflow-presets-core.js";
|
|
18
|
+
import { stableSortedStrings } from "./common.js";
|
|
19
|
+
export function findProviderWorkflowPreset(providerPresets = [], providerId, presetId) {
|
|
20
|
+
return providerPresets.find((preset) => {
|
|
21
|
+
if (providerId && (preset.provider?.id || preset.provenance?.provider_id) !== providerId) return false;
|
|
22
|
+
if (presetId && preset.id !== presetId) return false;
|
|
23
|
+
return true;
|
|
24
|
+
}) || null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function buildCustomizationStatus(currentPreset, derivedTeamPreset = null) {
|
|
28
|
+
const status = customizationStatusForPreset(currentPreset, derivedTeamPreset);
|
|
29
|
+
return {
|
|
30
|
+
...status,
|
|
31
|
+
recommended_customization_action: recommendedCustomizationAction(currentPreset, status)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function workflowPresetDiffRecord({ currentPreset = null, derivedTeamPreset = null }) {
|
|
36
|
+
if (!currentPreset && !derivedTeamPreset) return null;
|
|
37
|
+
|
|
38
|
+
if (!currentPreset && derivedTeamPreset) {
|
|
39
|
+
const derived = workflowPresetDerivedSource(derivedTeamPreset.derived_from);
|
|
40
|
+
const customizationStatus = {
|
|
41
|
+
status: "customization_orphaned",
|
|
42
|
+
derived_preset_exists: true,
|
|
43
|
+
fingerprint_matches_current_source: false,
|
|
44
|
+
recommended_local_path: defaultLocalWorkflowPresetPath(derived?.provider_id || "provider", derived?.provider_preset_id || "preset"),
|
|
45
|
+
source_fingerprint: derived?.source_fingerprint || null
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
provider_id: derived?.provider_id || null,
|
|
49
|
+
preset_id: derived?.provider_preset_id || null,
|
|
50
|
+
change_status: "orphaned_customization",
|
|
51
|
+
changed_fields: [],
|
|
52
|
+
review_class_delta: null,
|
|
53
|
+
recommended_task_mode_delta: null,
|
|
54
|
+
preferred_queries_delta: null,
|
|
55
|
+
review_policy_delta: null,
|
|
56
|
+
verification_policy_delta: null,
|
|
57
|
+
multi_agent_policy_delta: null,
|
|
58
|
+
tool_hints_delta: null,
|
|
59
|
+
customization_overlap: stableSortedStrings(Object.keys(workflowPresetComparableShape(derivedTeamPreset))),
|
|
60
|
+
requires_fresh_review: true,
|
|
61
|
+
recommended_customization_action: recommendedCustomizationAction(null, customizationStatus),
|
|
62
|
+
provenance: {
|
|
63
|
+
current: null,
|
|
64
|
+
previous: derivedTeamPreset.provenance || null
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const derivedSource = workflowPresetDerivedSource(derivedTeamPreset?.derived_from);
|
|
70
|
+
const derivedMatchesCurrent = Boolean(
|
|
71
|
+
derivedSource &&
|
|
72
|
+
derivedSource.source_fingerprint &&
|
|
73
|
+
derivedSource.source_fingerprint === workflowPresetFingerprint(currentPreset)
|
|
74
|
+
);
|
|
75
|
+
const baselinePreset = refreshBaselineForProviderPreset(currentPreset);
|
|
76
|
+
const hasDerivedTeamPreset = Boolean(derivedTeamPreset);
|
|
77
|
+
|
|
78
|
+
if (hasDerivedTeamPreset) {
|
|
79
|
+
const delta = baselinePreset ? workflowPresetDeltaPayload(currentPreset, baselinePreset) : {
|
|
80
|
+
changed_fields: [],
|
|
81
|
+
review_class_delta: null,
|
|
82
|
+
recommended_task_mode_delta: null,
|
|
83
|
+
preferred_queries_delta: null,
|
|
84
|
+
review_policy_delta: null,
|
|
85
|
+
verification_policy_delta: null,
|
|
86
|
+
multi_agent_policy_delta: null,
|
|
87
|
+
tool_hints_delta: null
|
|
88
|
+
};
|
|
89
|
+
const customizationOverlap = stableSortedStrings(workflowPresetChangedFields(derivedTeamPreset, currentPreset));
|
|
90
|
+
const customizationStatus = customizationStatusForPreset(currentPreset, derivedTeamPreset);
|
|
91
|
+
return {
|
|
92
|
+
provider_id: currentPreset.provider?.id || currentPreset.provenance?.provider_id || null,
|
|
93
|
+
preset_id: currentPreset.id,
|
|
94
|
+
change_status: derivedMatchesCurrent ? "locally_customized" : "locally_customized",
|
|
95
|
+
...delta,
|
|
96
|
+
customization_overlap: customizationOverlap,
|
|
97
|
+
requires_fresh_review: true,
|
|
98
|
+
recommended_customization_action: recommendedCustomizationAction(currentPreset, customizationStatus),
|
|
99
|
+
provenance: {
|
|
100
|
+
current: currentPreset.provenance || null,
|
|
101
|
+
previous: derivedTeamPreset.provenance || null
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (baselinePreset) {
|
|
107
|
+
const delta = workflowPresetDeltaPayload(currentPreset, baselinePreset);
|
|
108
|
+
const changed = (delta.changed_fields || []).length > 0;
|
|
109
|
+
const customizationStatus = customizationStatusForPreset(currentPreset, null);
|
|
110
|
+
return {
|
|
111
|
+
provider_id: currentPreset.provider?.id || currentPreset.provenance?.provider_id || null,
|
|
112
|
+
preset_id: currentPreset.id,
|
|
113
|
+
change_status: changed ? "changed" : "unchanged",
|
|
114
|
+
...delta,
|
|
115
|
+
customization_overlap: [],
|
|
116
|
+
requires_fresh_review: workflowPresetRequiresFreshReview(changed ? "changed" : "unchanged", currentPreset, delta),
|
|
117
|
+
recommended_customization_action: recommendedCustomizationAction(currentPreset, customizationStatus),
|
|
118
|
+
provenance: {
|
|
119
|
+
current: currentPreset.provenance || null,
|
|
120
|
+
previous: baselinePreset.provenance || null
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const status = ["accept", "accepted"].includes(currentPreset.adoption_state) ? "unchanged" : "new";
|
|
126
|
+
const customizationStatus = customizationStatusForPreset(currentPreset, null);
|
|
127
|
+
return {
|
|
128
|
+
provider_id: currentPreset.provider?.id || currentPreset.provenance?.provider_id || null,
|
|
129
|
+
preset_id: currentPreset.id,
|
|
130
|
+
change_status: status,
|
|
131
|
+
changed_fields: [],
|
|
132
|
+
review_class_delta: null,
|
|
133
|
+
recommended_task_mode_delta: null,
|
|
134
|
+
preferred_queries_delta: null,
|
|
135
|
+
review_policy_delta: null,
|
|
136
|
+
verification_policy_delta: null,
|
|
137
|
+
multi_agent_policy_delta: null,
|
|
138
|
+
tool_hints_delta: null,
|
|
139
|
+
customization_overlap: [],
|
|
140
|
+
requires_fresh_review: status === "new" && currentPreset.review_class === "manual_decision",
|
|
141
|
+
recommended_customization_action: recommendedCustomizationAction(currentPreset, customizationStatus),
|
|
142
|
+
provenance: {
|
|
143
|
+
current: currentPreset.provenance || null,
|
|
144
|
+
previous: null
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function buildWorkflowPresetInventory({
|
|
150
|
+
workspace = null,
|
|
151
|
+
providerPresets = null,
|
|
152
|
+
teamPresets = null,
|
|
153
|
+
providerManifests = null,
|
|
154
|
+
selectors = {}
|
|
155
|
+
} = {}) {
|
|
156
|
+
const loaded = (providerPresets && teamPresets)
|
|
157
|
+
? { provider_presets: providerPresets, team_presets: teamPresets, provider_manifests: providerManifests || [] }
|
|
158
|
+
: loadWorkflowPresetArtifacts(workspace);
|
|
159
|
+
const provider = loaded.provider_presets.map((preset) => summarizeWorkflowPreset(preset, selectors));
|
|
160
|
+
const team = loaded.team_presets.map((preset) => summarizeWorkflowPreset(preset, selectors));
|
|
161
|
+
const manifestDeclarations = providerManifestWorkflowPresetDeclarations(loaded.provider_manifests || [], loaded.provider_presets || []);
|
|
162
|
+
return {
|
|
163
|
+
provider: provider.sort((a, b) => String(a.id).localeCompare(String(b.id))),
|
|
164
|
+
team: team.sort((a, b) => String(a.id).localeCompare(String(b.id))),
|
|
165
|
+
active_provider_count: provider.filter((preset) => preset.active_for_context && ["accept", "accepted"].includes(preset.adoption_state)).length,
|
|
166
|
+
active_team_count: team.filter((preset) => preset.active_for_context && !["reject", "rejected", "stage", "staged"].includes(preset.adoption_state)).length,
|
|
167
|
+
provider_manifest_declarations: manifestDeclarations,
|
|
168
|
+
provider_manifest_summary: {
|
|
169
|
+
manifest_count: (loaded.provider_manifests || []).length,
|
|
170
|
+
declared_workflow_preset_count: manifestDeclarations.length,
|
|
171
|
+
imported_declared_workflow_preset_count: manifestDeclarations.filter((entry) => entry.imported).length,
|
|
172
|
+
missing_declared_workflow_preset_count: manifestDeclarations.filter((entry) => !entry.imported).length,
|
|
173
|
+
invalid_declared_workflow_preset_count: manifestDeclarations.filter((entry) => !entry.valid).length
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function buildWorkflowPresetDiffPayload({
|
|
179
|
+
workspace = null,
|
|
180
|
+
providerId = null,
|
|
181
|
+
presetId = null,
|
|
182
|
+
providerPresets = null,
|
|
183
|
+
teamPresets = null
|
|
184
|
+
} = {}) {
|
|
185
|
+
const loaded = (providerPresets && teamPresets)
|
|
186
|
+
? { provider_presets: providerPresets, team_presets: teamPresets }
|
|
187
|
+
: loadWorkflowPresetArtifacts(workspace);
|
|
188
|
+
const matchingProviderPresets = loaded.provider_presets.filter((preset) => {
|
|
189
|
+
if (providerId && (preset.provider?.id || preset.provenance?.provider_id) !== providerId) return false;
|
|
190
|
+
if (presetId && preset.id !== presetId) return false;
|
|
191
|
+
return true;
|
|
192
|
+
});
|
|
193
|
+
const matchingTeamPresets = loaded.team_presets.filter((preset) => {
|
|
194
|
+
const derived = workflowPresetDerivedSource(preset.derived_from);
|
|
195
|
+
if (!derived) return false;
|
|
196
|
+
if (providerId && derived.provider_id !== providerId) return false;
|
|
197
|
+
if (presetId && derived.provider_preset_id !== presetId) return false;
|
|
198
|
+
return true;
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const seenKeys = new Set();
|
|
202
|
+
const diffs = [];
|
|
203
|
+
for (const preset of matchingProviderPresets) {
|
|
204
|
+
const derivedTeamPreset = findDerivedTeamPreset(loaded.team_presets, preset);
|
|
205
|
+
seenKeys.add(providerPresetMatchKey(preset));
|
|
206
|
+
diffs.push(workflowPresetDiffRecord({
|
|
207
|
+
currentPreset: preset,
|
|
208
|
+
derivedTeamPreset
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
for (const teamPreset of matchingTeamPresets) {
|
|
212
|
+
const derived = workflowPresetDerivedSource(teamPreset.derived_from);
|
|
213
|
+
const key = `${derived?.provider_id || "unknown"}::${derived?.provider_preset_id || "unknown"}`;
|
|
214
|
+
if (seenKeys.has(key)) continue;
|
|
215
|
+
diffs.push(workflowPresetDiffRecord({
|
|
216
|
+
currentPreset: null,
|
|
217
|
+
derivedTeamPreset: teamPreset
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const records = diffs.filter(Boolean).sort((a, b) =>
|
|
222
|
+
`${a.provider_id || ""}:${a.preset_id || ""}`.localeCompare(`${b.provider_id || ""}:${b.preset_id || ""}`)
|
|
223
|
+
);
|
|
224
|
+
return {
|
|
225
|
+
type: "workflow_preset_diff_query",
|
|
226
|
+
provider_id: providerId || null,
|
|
227
|
+
preset_id: presetId || null,
|
|
228
|
+
diffs: records,
|
|
229
|
+
summary: {
|
|
230
|
+
diff_count: records.length,
|
|
231
|
+
new_count: records.filter((entry) => entry.change_status === "new").length,
|
|
232
|
+
unchanged_count: records.filter((entry) => entry.change_status === "unchanged").length,
|
|
233
|
+
changed_count: records.filter((entry) => entry.change_status === "changed").length,
|
|
234
|
+
locally_customized_count: records.filter((entry) => entry.change_status === "locally_customized").length,
|
|
235
|
+
orphaned_customization_count: records.filter((entry) => entry.change_status === "orphaned_customization").length,
|
|
236
|
+
requires_fresh_review_count: records.filter((entry) => entry.requires_fresh_review).length
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function buildWorkflowPresetState({
|
|
242
|
+
workspace = null,
|
|
243
|
+
providerPresets = null,
|
|
244
|
+
teamPresets = null,
|
|
245
|
+
providerManifests = null,
|
|
246
|
+
selectors = {}
|
|
247
|
+
} = {}) {
|
|
248
|
+
const loaded = (providerPresets && teamPresets)
|
|
249
|
+
? { provider_presets: providerPresets, team_presets: teamPresets, provider_manifests: providerManifests || [] }
|
|
250
|
+
: loadWorkflowPresetArtifacts(workspace);
|
|
251
|
+
const inventory = buildWorkflowPresetInventory({
|
|
252
|
+
workspace,
|
|
253
|
+
providerPresets: loaded.provider_presets,
|
|
254
|
+
teamPresets: loaded.team_presets,
|
|
255
|
+
providerManifests: loaded.provider_manifests,
|
|
256
|
+
selectors
|
|
257
|
+
});
|
|
258
|
+
const workflowPresetSurfaces = loaded.provider_presets
|
|
259
|
+
.filter((preset) => !selectors.provider_id || (preset.provider?.id || preset.provenance?.provider_id) === selectors.provider_id)
|
|
260
|
+
.filter((preset) => !selectors.preset_id || preset.id === selectors.preset_id)
|
|
261
|
+
.map((preset) => {
|
|
262
|
+
const summary = summarizeWorkflowPreset(preset, selectors);
|
|
263
|
+
const derivedTeamPreset = findDerivedTeamPreset(loaded.team_presets, preset);
|
|
264
|
+
const customizationStatus = buildCustomizationStatus(preset, derivedTeamPreset);
|
|
265
|
+
const manifestDeclaration = (inventory.provider_manifest_declarations || []).find((entry) =>
|
|
266
|
+
entry.provider_id === summary.provider_id && entry.declaration_id === summary.id
|
|
267
|
+
) || null;
|
|
268
|
+
return {
|
|
269
|
+
...summary,
|
|
270
|
+
recommended_state: preset.adoption_state || "stage",
|
|
271
|
+
derived_team_preset_path: derivedTeamPreset?.file_path || null,
|
|
272
|
+
customization_status: customizationStatus,
|
|
273
|
+
recommended_local_path: customizationStatus.recommended_local_path,
|
|
274
|
+
recommended_customization_action: customizationStatus.recommended_customization_action,
|
|
275
|
+
manifest_declared: Boolean(manifestDeclaration),
|
|
276
|
+
manifest_declaration: manifestDeclaration
|
|
277
|
+
};
|
|
278
|
+
})
|
|
279
|
+
.sort((a, b) => `${a.provider_id || ""}:${a.id}`.localeCompare(`${b.provider_id || ""}:${b.id}`));
|
|
280
|
+
const refreshSummary = buildWorkflowPresetDiffPayload({
|
|
281
|
+
workspace,
|
|
282
|
+
providerPresets: loaded.provider_presets,
|
|
283
|
+
teamPresets: loaded.team_presets,
|
|
284
|
+
providerId: selectors.provider_id || null,
|
|
285
|
+
presetId: selectors.preset_id || null
|
|
286
|
+
});
|
|
287
|
+
return {
|
|
288
|
+
...inventory,
|
|
289
|
+
workflow_preset_surfaces: workflowPresetSurfaces,
|
|
290
|
+
workflow_preset_refresh_summary: refreshSummary
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function buildWorkflowPresetCustomizationPayload({
|
|
295
|
+
workspace = null,
|
|
296
|
+
providerId = null,
|
|
297
|
+
presetId = null,
|
|
298
|
+
providerPresets = null,
|
|
299
|
+
teamPresets = null
|
|
300
|
+
} = {}) {
|
|
301
|
+
const loaded = (providerPresets && teamPresets)
|
|
302
|
+
? { provider_presets: providerPresets, team_presets: teamPresets }
|
|
303
|
+
: loadWorkflowPresetArtifacts(workspace);
|
|
304
|
+
const currentPreset = findProviderWorkflowPreset(loaded.provider_presets, providerId, presetId);
|
|
305
|
+
if (!currentPreset) {
|
|
306
|
+
throw new Error(`No provider workflow preset found for provider '${providerId || "unknown"}' and preset '${presetId || "unknown"}'.`);
|
|
307
|
+
}
|
|
308
|
+
const derivedTeamPreset = findDerivedTeamPreset(loaded.team_presets, currentPreset);
|
|
309
|
+
const customizationStatus = buildCustomizationStatus(currentPreset, derivedTeamPreset);
|
|
310
|
+
const resolvedWorkspace = workspace ? path.resolve(workspace) : null;
|
|
311
|
+
const customizationTemplate = customizationTemplateFromProviderPreset(currentPreset, resolvedWorkspace);
|
|
312
|
+
const warnings = [];
|
|
313
|
+
if (currentPreset.adoption_state !== "customize") {
|
|
314
|
+
warnings.push("Provider preset is not currently marked customize; generating a local customization scaffold anyway.");
|
|
315
|
+
}
|
|
316
|
+
if (customizationStatus.status === "customization_present") {
|
|
317
|
+
warnings.push("A derived local team preset already exists for this provider preset.");
|
|
318
|
+
}
|
|
319
|
+
if (customizationStatus.status === "customization_stale") {
|
|
320
|
+
warnings.push("The existing derived local team preset is stale relative to the current provider preset fingerprint.");
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
type: "workflow_preset_customization_query",
|
|
324
|
+
provider_id: currentPreset.provider?.id || currentPreset.provenance?.provider_id || null,
|
|
325
|
+
preset_id: currentPreset.id,
|
|
326
|
+
source_provider_preset: summarizeWorkflowPreset(currentPreset, {}),
|
|
327
|
+
recommended_local_path: customizationStatus.recommended_local_path,
|
|
328
|
+
customization_template: customizationTemplate,
|
|
329
|
+
required_provenance: customizationTemplate.derived_from,
|
|
330
|
+
suggested_fields_to_customize: [
|
|
331
|
+
"preferred_queries",
|
|
332
|
+
"artifact_load_order",
|
|
333
|
+
"review_policy",
|
|
334
|
+
"verification_policy",
|
|
335
|
+
"multi_agent_policy",
|
|
336
|
+
"handoff_defaults",
|
|
337
|
+
"tool_hints"
|
|
338
|
+
],
|
|
339
|
+
warnings
|
|
340
|
+
};
|
|
341
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function buildAuthHintsQueryPayload(...args: unknown[]): any;
|
|
2
|
+
export function buildAuthReviewPacketPayload(...args: unknown[]): any;
|
|
3
|
+
export function buildCanonicalWritesPayloadForChangePlan(...args: unknown[]): any;
|
|
4
|
+
export function buildCanonicalWritesPayloadForImportPlan(...args: unknown[]): any;
|
|
5
|
+
export function buildChangePlanPayload(...args: unknown[]): any;
|
|
6
|
+
export function buildHandoffStatusPayload(...args: unknown[]): any;
|
|
7
|
+
export function buildImportPlanPayload(...args: unknown[]): any;
|
|
8
|
+
export function buildLaneStatusPayload(...args: unknown[]): any;
|
|
9
|
+
export function buildMaintainedConformancePayload(...args: unknown[]): any;
|
|
10
|
+
export function buildMaintainedDriftPayload(...args: unknown[]): any;
|
|
11
|
+
export function buildMaintainedRiskSummary(...args: unknown[]): any;
|
|
12
|
+
export function buildMultiAgentPlanPayload(...args: unknown[]): any;
|
|
13
|
+
export function buildResolvedWorkflowContextPayload(...args: unknown[]): any;
|
|
14
|
+
export function buildReviewPacketPayloadForChangePlan(...args: unknown[]): any;
|
|
15
|
+
export function buildReviewPacketPayloadForImportPlan(...args: unknown[]): any;
|
|
16
|
+
export function buildRiskSummaryPayload(...args: unknown[]): any;
|
|
17
|
+
export function buildSeamCheckPayload(...args: unknown[]): any;
|
|
18
|
+
export function buildSingleAgentPlanPayload(...args: unknown[]): any;
|
|
19
|
+
export function buildWorkflowPresetActivationPayload(...args: unknown[]): any;
|
|
20
|
+
export function buildWorkflowPresetCustomizationPayload(...args: unknown[]): any;
|
|
21
|
+
export function buildWorkflowPresetDiffPayload(...args: unknown[]): any;
|
|
22
|
+
export function buildWorkflowPresetState(...args: unknown[]): any;
|
|
23
|
+
export function buildWorkPacketPayload(...args: unknown[]): any;
|
|
24
|
+
export function classifyRisk(...args: unknown[]): any;
|
|
25
|
+
export function proceedDecisionFromRisk(...args: unknown[]): any;
|
|
26
|
+
export function summarizeDiffArtifact(...args: unknown[]): any;
|