agentera 3.0.0-dev.25 → 3.0.0-dev.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -20
- package/bundle/CHANGELOG.md +15 -25
- package/bundle/README.md +13 -34
- package/bundle/UPGRADE.md +71 -165
- package/bundle/references/adapters/package-manifest-interface-model.yaml +40 -241
- package/bundle/references/adapters/package-registry.yaml +0 -145
- package/bundle/references/adapters/package-surface-characterization.md +13 -38
- package/bundle/references/adapters/runtime-lifecycle-adapters.yaml +5 -219
- package/bundle/references/adapters/runtime-lifecycle-authority.yaml +2 -29
- package/bundle/references/adapters/runtime-lifecycle-operation-contract.yaml +1 -1
- package/bundle/references/artifacts/state-storage-authority.yaml +43 -447
- package/bundle/references/cli/agent-ready-state-contract.yaml +9 -9
- package/bundle/references/cli/app-lifecycle-vocabulary.yaml +3 -4
- package/bundle/references/cli/bundle-skill-vocabulary.yaml +9 -18
- package/bundle/references/cli/capability-tool-classification.yaml +2 -2
- package/bundle/references/cli/prime-consumer-compatibility.yaml +28 -98
- package/bundle/references/cli/routing-execution-vocabulary.yaml +4 -22
- package/bundle/references/cli/upgrade-repair-wording.md +8 -28
- package/bundle/references/cli/v3-handoff-manifest.schema.yaml +2 -3
- package/bundle/references/cli/vocabulary.md +18 -23
- package/bundle/references/meta/documentation-inventory.md +1 -1
- package/bundle/skills/agentera/schemas/artifacts/docs.yaml +3 -11
- package/bundle/skills/agentera/schemas/artifacts/plan.yaml +1 -1
- package/dist/cli/capabilityContext/bespoke.js +8 -2
- package/dist/cli/capabilityContext/bespoke.js.map +1 -1
- package/dist/cli/capabilityContext/closeout.js +3 -3
- package/dist/cli/capabilityContext/closeout.js.map +1 -1
- package/dist/cli/capabilityContext/evidence.js +52 -40
- package/dist/cli/capabilityContext/evidence.js.map +1 -1
- package/dist/cli/capabilityContext/startup.js +1 -1
- package/dist/cli/capabilityContext/startup.js.map +1 -1
- package/dist/cli/commands/doctor.js +6 -64
- package/dist/cli/commands/doctor.js.map +1 -1
- package/dist/cli/commands/durability.js +12 -48
- package/dist/cli/commands/durability.js.map +1 -1
- package/dist/cli/commands/prime/briefOrientation.js +2 -19
- package/dist/cli/commands/prime/briefOrientation.js.map +1 -1
- package/dist/cli/commands/prime/bundleStatus.js +8 -2
- package/dist/cli/commands/prime/bundleStatus.js.map +1 -1
- package/dist/cli/commands/prime/collectEntityOrientation.js +27 -14
- package/dist/cli/commands/prime/collectEntityOrientation.js.map +1 -1
- package/dist/cli/commands/prime/collectOrientationState.js +31 -52
- package/dist/cli/commands/prime/collectOrientationState.js.map +1 -1
- package/dist/cli/commands/prime/orientationOutput.js +3 -11
- package/dist/cli/commands/prime/orientationOutput.js.map +1 -1
- package/dist/cli/commands/prime.js +0 -5
- package/dist/cli/commands/prime.js.map +1 -1
- package/dist/cli/commands/query.js +17 -49
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/schema.js +19 -78
- package/dist/cli/commands/schema.js.map +1 -1
- package/dist/cli/commands/state/decisions.js +11 -57
- package/dist/cli/commands/state/decisions.js.map +1 -1
- package/dist/cli/commands/state/docs.js +56 -120
- package/dist/cli/commands/state/docs.js.map +1 -1
- package/dist/cli/commands/state/experimentRecords.js +22 -121
- package/dist/cli/commands/state/experimentRecords.js.map +1 -1
- package/dist/cli/commands/state/experiments.js +9 -75
- package/dist/cli/commands/state/experiments.js.map +1 -1
- package/dist/cli/commands/state/get.js +62 -143
- package/dist/cli/commands/state/get.js.map +1 -1
- package/dist/cli/commands/state/health.js +9 -123
- package/dist/cli/commands/state/health.js.map +1 -1
- package/dist/cli/commands/state/index.js +2 -2
- package/dist/cli/commands/state/index.js.map +1 -1
- package/dist/cli/commands/state/list.js +20 -36
- package/dist/cli/commands/state/list.js.map +1 -1
- package/dist/cli/commands/state/objective.js +19 -86
- package/dist/cli/commands/state/objective.js.map +1 -1
- package/dist/cli/commands/state/plan.js +9 -388
- package/dist/cli/commands/state/plan.js.map +1 -1
- package/dist/cli/commands/state/planTasks.js +58 -93
- package/dist/cli/commands/state/planTasks.js.map +1 -1
- package/dist/cli/commands/state/plans.js +13 -40
- package/dist/cli/commands/state/plans.js.map +1 -1
- package/dist/cli/commands/state/progress.js +10 -55
- package/dist/cli/commands/state/progress.js.map +1 -1
- package/dist/cli/commands/state/todo.js +24 -133
- package/dist/cli/commands/state/todo.js.map +1 -1
- package/dist/cli/commands/state/write.js +11 -33
- package/dist/cli/commands/state/write.js.map +1 -1
- package/dist/cli/commands/upgrade.js +48 -18
- package/dist/cli/commands/upgrade.js.map +1 -1
- package/dist/cli/commands/upgradeVerify.js +21 -15
- package/dist/cli/commands/upgradeVerify.js.map +1 -1
- package/dist/cli/commands/validate.js +1 -9
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli/dispatch/check.js +5 -12
- package/dist/cli/dispatch/check.js.map +1 -1
- package/dist/cli/dispatch/index.js +30 -29
- package/dist/cli/dispatch/index.js.map +1 -1
- package/dist/cli/dispatch/lifecycle.js +23 -40
- package/dist/cli/dispatch/lifecycle.js.map +1 -1
- package/dist/cli/help.js +20 -100
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/migrationRequired.js +22 -19
- package/dist/cli/migrationRequired.js.map +1 -1
- package/dist/cli/orientation/attention.js +1 -97
- package/dist/cli/orientation/attention.js.map +1 -1
- package/dist/cli/stateQuery.js +1 -2
- package/dist/cli/stateQuery.js.map +1 -1
- package/dist/core/skillIdentity.js +24 -0
- package/dist/core/skillIdentity.js.map +1 -0
- package/dist/hooks/common.js +1 -1
- package/dist/hooks/common.js.map +1 -1
- package/dist/hooks/compaction/status.js +2 -1
- package/dist/hooks/compaction/status.js.map +1 -1
- package/dist/hooks/cursorSessionStart.js +4 -25
- package/dist/hooks/cursorSessionStart.js.map +1 -1
- package/dist/hooks/projectHookInput.js +26 -0
- package/dist/hooks/projectHookInput.js.map +1 -0
- package/dist/hooks/sessionStart.js +23 -239
- package/dist/hooks/sessionStart.js.map +1 -1
- package/dist/hooks/sessionStop.js +4 -12
- package/dist/hooks/sessionStop.js.map +1 -1
- package/dist/hooks/validateArtifact/traversal.js +1 -1
- package/dist/hooks/validateArtifact/traversal.js.map +1 -1
- package/dist/registries/artifactRegistry.js +2 -1
- package/dist/registries/artifactRegistry.js.map +1 -1
- package/dist/registries/packageRegistry.js +57 -231
- package/dist/registries/packageRegistry.js.map +1 -1
- package/dist/release/releaseMetadata.js +1 -13
- package/dist/release/releaseMetadata.js.map +1 -1
- package/dist/runtime/lifecycleAdapterContract.js +4 -4
- package/dist/runtime/lifecycleAdapterContract.js.map +1 -1
- package/dist/runtime/lifecycleAdapters.js +14 -2
- package/dist/runtime/lifecycleAdapters.js.map +1 -1
- package/dist/runtime/lifecycleAuthority.js +5 -43
- package/dist/runtime/lifecycleAuthority.js.map +1 -1
- package/dist/runtime/lifecycleOperationContract.js +3 -2
- package/dist/runtime/lifecycleOperationContract.js.map +1 -1
- package/dist/runtime/lifecyclePublication.js +21 -0
- package/dist/runtime/lifecyclePublication.js.map +1 -1
- package/dist/setup/opencode.js +20 -12
- package/dist/setup/opencode.js.map +1 -1
- package/dist/setup/sharedSkill.js +46 -0
- package/dist/setup/sharedSkill.js.map +1 -0
- package/dist/setup/smokeChecks.js +16 -43
- package/dist/setup/smokeChecks.js.map +1 -1
- package/dist/state/decisionEntities.js +7 -4
- package/dist/state/decisionEntities.js.map +1 -1
- package/dist/state/durability.js +4 -240
- package/dist/state/durability.js.map +1 -1
- package/dist/state/entityCutover.js +90 -186
- package/dist/state/entityCutover.js.map +1 -1
- package/dist/state/entityStorage.js +27 -8
- package/dist/state/entityStorage.js.map +1 -1
- package/dist/state/healthEntities.js +7 -4
- package/dist/state/healthEntities.js.map +1 -1
- package/dist/state/objectiveExperimentEntities.js +7 -5
- package/dist/state/objectiveExperimentEntities.js.map +1 -1
- package/dist/state/planEntities.js +14 -10
- package/dist/state/planEntities.js.map +1 -1
- package/dist/state/progressEntities.js +4 -2
- package/dist/state/progressEntities.js.map +1 -1
- package/dist/state/startupProjection.js +3 -2
- package/dist/state/startupProjection.js.map +1 -1
- package/dist/state/stateMode.js +7 -0
- package/dist/state/stateMode.js.map +1 -1
- package/dist/state/todoDocsEntities.js +6 -4
- package/dist/state/todoDocsEntities.js.map +1 -1
- package/dist/state/write/explain.js +1 -9
- package/dist/state/write/explain.js.map +1 -1
- package/dist/state/write/transaction.js +22 -532
- package/dist/state/write/transaction.js.map +1 -1
- package/dist/upgrade/appContentRefresh.js +43 -28
- package/dist/upgrade/appContentRefresh.js.map +1 -1
- package/dist/upgrade/doctor.js +5 -1
- package/dist/upgrade/doctor.js.map +1 -1
- package/dist/upgrade/installedHooksRetirement.js +46 -39
- package/dist/upgrade/installedHooksRetirement.js.map +1 -1
- package/dist/upgrade/legacyAgentCleanup.js +132 -32
- package/dist/upgrade/legacyAgentCleanup.js.map +1 -1
- package/dist/upgrade/lifecycleUpgrade.js +65 -378
- package/dist/upgrade/lifecycleUpgrade.js.map +1 -1
- package/dist/upgrade/migrateArtifactsV2ToV3.js +151 -52
- package/dist/upgrade/migrateArtifactsV2ToV3.js.map +1 -1
- package/dist/upgrade/migrationPublication.js +123 -0
- package/dist/upgrade/migrationPublication.js.map +1 -0
- package/dist/upgrade/projectIntegration.js +46 -113
- package/dist/upgrade/projectIntegration.js.map +1 -1
- package/dist/upgrade/projectIntegrationDecision.js +6 -96
- package/dist/upgrade/projectIntegrationDecision.js.map +1 -1
- package/dist/upgrade/runtimeMigration.js +222 -402
- package/dist/upgrade/runtimeMigration.js.map +1 -1
- package/dist/upgrade/upgradeCommands.js +5 -4
- package/dist/upgrade/upgradeCommands.js.map +1 -1
- package/dist/upgrade/upgradeLock.js +73 -41
- package/dist/upgrade/upgradeLock.js.map +1 -1
- package/dist/upgrade/upgradeOrchestrator.js +91 -158
- package/dist/upgrade/upgradeOrchestrator.js.map +1 -1
- package/dist/upgrade/v3CapabilitySurface.js +2 -2
- package/dist/validate/appHomeContract.js +0 -4
- package/dist/validate/appHomeContract.js.map +1 -1
- package/package.json +7 -5
- package/bundle/.codex-plugin/plugin.json +0 -92
- package/bundle/.cursor/agents/agentera.md +0 -7
- package/bundle/.cursor/hooks.json +0 -32
- package/bundle/.cursor-plugin/plugin.json +0 -34
- package/bundle/.github/hooks/postToolUse.json +0 -9
- package/bundle/.github/hooks/preToolUse.json +0 -8
- package/bundle/.github/hooks/sessionEnd.json +0 -8
- package/bundle/.github/hooks/sessionStart.json +0 -8
- package/bundle/.github/plugin/plugin.json +0 -7
- package/bundle/.opencode/agents/agentera.md +0 -12
- package/bundle/.opencode/commands/agentera.md +0 -5
- package/bundle/.opencode/package.json +0 -31
- package/bundle/.opencode/plugins/agentera.js +0 -820
- package/bundle/agents/openai.yaml +0 -87
- package/bundle/hooks/codex-hooks.json +0 -31
- package/bundle/hooks/codex-plugin-hooks.json +0 -31
- package/bundle/plugin.json +0 -13
- package/bundle/references/adapters/cursor.md +0 -224
- package/bundle/references/adapters/opencode.md +0 -529
- package/bundle/references/adapters/runtime-adapter-characterization.md +0 -44
- package/bundle/references/adapters/runtime-adapter-interface-model.yaml +0 -200
- package/bundle/references/adapters/runtime-adapter-registry.yaml +0 -387
- package/bundle/references/adapters/runtime-feature-parity.md +0 -129
- package/dist/cli/commands/backfill.js +0 -231
- package/dist/cli/commands/backfill.js.map +0 -1
- package/dist/cli/commands/migrate.js +0 -681
- package/dist/cli/commands/migrate.js.map +0 -1
- package/dist/registries/runtimeAdapterRegistry.js +0 -324
- package/dist/registries/runtimeAdapterRegistry.js.map +0 -1
- package/dist/setup/copilot.js +0 -227
- package/dist/setup/copilot.js.map +0 -1
- package/dist/setup/cursor.js +0 -129
- package/dist/setup/cursor.js.map +0 -1
- package/dist/setup/cursorSurfaces.js +0 -67
- package/dist/setup/cursorSurfaces.js.map +0 -1
- package/dist/setup/doctor/core.js +0 -296
- package/dist/setup/doctor/core.js.map +0 -1
- package/dist/setup/doctor/diagnostics.js +0 -201
- package/dist/setup/doctor/diagnostics.js.map +0 -1
- package/dist/setup/doctor/opencode.js +0 -301
- package/dist/setup/doctor/opencode.js.map +0 -1
- package/dist/setup/doctor/report.js +0 -425
- package/dist/setup/doctor/report.js.map +0 -1
- package/dist/setup/doctor.js +0 -10
- package/dist/setup/doctor.js.map +0 -1
- package/dist/state/gitBackfill.js +0 -561
- package/dist/state/gitBackfill.js.map +0 -1
- package/dist/state/gitBackfillAuthority.js +0 -141
- package/dist/state/gitBackfillAuthority.js.map +0 -1
- package/dist/state/gitBackfillHistory.js +0 -278
- package/dist/state/gitBackfillHistory.js.map +0 -1
- package/dist/state/gitBackfillOutput.js +0 -209
- package/dist/state/gitBackfillOutput.js.map +0 -1
- package/dist/state/legacyMigration.js +0 -516
- package/dist/state/legacyMigration.js.map +0 -1
- package/dist/state/legacyMigrationParser.js +0 -489
- package/dist/state/legacyMigrationParser.js.map +0 -1
- package/dist/state/migrationAuthority.js +0 -413
- package/dist/state/migrationAuthority.js.map +0 -1
- package/dist/state/migrationEnrichment.js +0 -35
- package/dist/state/migrationEnrichment.js.map +0 -1
- package/dist/state/projectionRecovery.js +0 -458
- package/dist/state/projectionRecovery.js.map +0 -1
- package/dist/upgrade/migrateArtifactsV1ToV2.js +0 -568
- package/dist/upgrade/migrateArtifactsV1ToV2.js.map +0 -1
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js +0 -93
- package/dist/validate/lifecycleAdapters/legacyPythonParity.js.map +0 -1
- package/dist/validate/lifecycleAdapters/lifecycleMain.js +0 -154
- package/dist/validate/lifecycleAdapters/lifecycleMain.js.map +0 -1
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js +0 -481
- package/dist/validate/lifecycleAdapters/nodeFormChecks.js.map +0 -1
- package/dist/validate/lifecycleAdapters/shared.js +0 -198
- package/dist/validate/lifecycleAdapters/shared.js.map +0 -1
- package/dist/validate/lifecycleAdapters.js +0 -10
- package/dist/validate/lifecycleAdapters.js.map +0 -1
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { loadYamlMapping } from "../core/yaml.js";
|
|
4
|
-
import { resolveSourceRoot } from "../core/sourceRoot.js";
|
|
5
|
-
const AUTHORITY_RELATIVE_PATH = "references/artifacts/state-storage-authority.yaml";
|
|
6
|
-
function mapping(value) {
|
|
7
|
-
return value !== null && typeof value === "object" && !Array.isArray(value)
|
|
8
|
-
? value
|
|
9
|
-
: {};
|
|
10
|
-
}
|
|
11
|
-
function requiredString(value, field) {
|
|
12
|
-
if (typeof value !== "string" || value.length === 0) {
|
|
13
|
-
throw new Error(`state storage authority field '${field}' must be a non-empty string`);
|
|
14
|
-
}
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
function requiredList(value, field) {
|
|
18
|
-
if (!Array.isArray(value) || value.some((item) => typeof item !== "string" || item.length === 0)) {
|
|
19
|
-
throw new Error(`state storage authority field '${field}' must be a list of non-empty strings`);
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
function requiredPositiveInteger(value, field) {
|
|
24
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) {
|
|
25
|
-
throw new Error(`state storage authority field '${field}' must be a positive integer`);
|
|
26
|
-
}
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
function requiredBoolean(value, field) {
|
|
30
|
-
if (typeof value !== "boolean") {
|
|
31
|
-
throw new Error(`state storage authority field '${field}' must be a boolean`);
|
|
32
|
-
}
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
function requiredMapping(value, field) {
|
|
36
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
37
|
-
throw new Error(`state storage authority field '${field}' must be a mapping`);
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
export function stateGitBackfillContract(sourceRoot = resolveSourceRoot()) {
|
|
42
|
-
const authority = loadYamlMapping(fs.readFileSync(path.join(sourceRoot, AUTHORITY_RELATIVE_PATH), "utf8"));
|
|
43
|
-
if (authority.schema_version !== "agentera.stateStorageAuthority.v1") {
|
|
44
|
-
throw new Error("state storage authority schema_version is unsupported");
|
|
45
|
-
}
|
|
46
|
-
if (authority.status !== "active_authority") {
|
|
47
|
-
throw new Error("state storage authority must be active_authority");
|
|
48
|
-
}
|
|
49
|
-
const api = mapping(authority.api);
|
|
50
|
-
const backfill = mapping(api.backfill);
|
|
51
|
-
const formats = requiredList(backfill.formats, "api.backfill.formats");
|
|
52
|
-
if (formats.join(",") !== "text,json,yaml") {
|
|
53
|
-
throw new Error("state storage authority backfill formats must be text, json, yaml");
|
|
54
|
-
}
|
|
55
|
-
const defaultLimit = requiredPositiveInteger(backfill.default_limit, "api.backfill.default_limit");
|
|
56
|
-
const maximumLimit = requiredPositiveInteger(backfill.maximum_limit, "api.backfill.maximum_limit");
|
|
57
|
-
if (defaultLimit > maximumLimit) {
|
|
58
|
-
throw new Error("state storage authority backfill default limit exceeds maximum limit");
|
|
59
|
-
}
|
|
60
|
-
const guarantees = requiredMapping(backfill.guarantees, "api.backfill.guarantees");
|
|
61
|
-
const omission = requiredMapping(backfill.omission, "api.backfill.omission");
|
|
62
|
-
const traceability = requiredMapping(backfill.traceability, "api.backfill.traceability");
|
|
63
|
-
const response = requiredMapping(backfill.response, "api.backfill.response");
|
|
64
|
-
return {
|
|
65
|
-
authorityPath: AUTHORITY_RELATIVE_PATH,
|
|
66
|
-
command: requiredString(backfill.command, "api.backfill.command"),
|
|
67
|
-
formats,
|
|
68
|
-
defaultLimit,
|
|
69
|
-
maximumLimit,
|
|
70
|
-
maximumCommits: requiredPositiveInteger(backfill.maximum_commits, "api.backfill.maximum_commits"),
|
|
71
|
-
maximumHistoryBytes: requiredPositiveInteger(backfill.maximum_history_bytes, "api.backfill.maximum_history_bytes"),
|
|
72
|
-
supportedArtifacts: requiredList(backfill.supported_artifacts, "api.backfill.supported_artifacts"),
|
|
73
|
-
reachableRefs: requiredList(backfill.reachable_refs, "api.backfill.reachable_refs"),
|
|
74
|
-
excludedRefs: requiredList(backfill.excluded_refs, "api.backfill.excluded_refs"),
|
|
75
|
-
applyRequires: requiredList(backfill.apply_requires, "api.backfill.apply_requires"),
|
|
76
|
-
ambiguityReasons: requiredList(backfill.ambiguity_reasons, "api.backfill.ambiguity_reasons"),
|
|
77
|
-
statusValues: requiredList(backfill.status_values, "api.backfill.status_values"),
|
|
78
|
-
responseRequiredFields: requiredList(response.required_fields, "api.backfill.response.required_fields"),
|
|
79
|
-
responseEntryFields: requiredList(response.entry_fields, "api.backfill.response.entry_fields"),
|
|
80
|
-
guarantees: {
|
|
81
|
-
readOnlyInventoryAndPreview: requiredBoolean(guarantees.read_only_inventory_and_preview, "api.backfill.guarantees.read_only_inventory_and_preview"),
|
|
82
|
-
applyRequiresForce: requiredBoolean(guarantees.apply_requires_force, "api.backfill.guarantees.apply_requires_force"),
|
|
83
|
-
previewOptional: requiredBoolean(guarantees.preview_optional, "api.backfill.guarantees.preview_optional"),
|
|
84
|
-
applyRevalidation: requiredString(guarantees.apply_revalidation, "api.backfill.guarantees.apply_revalidation"),
|
|
85
|
-
remoteContact: requiredString(guarantees.remote_contact, "api.backfill.guarantees.remote_contact"),
|
|
86
|
-
customRefs: requiredString(guarantees.custom_refs, "api.backfill.guarantees.custom_refs"),
|
|
87
|
-
projectionWrites: requiredString(guarantees.projection_writes, "api.backfill.guarantees.projection_writes"),
|
|
88
|
-
immutableConflicts: requiredString(guarantees.immutable_conflicts, "api.backfill.guarantees.immutable_conflicts"),
|
|
89
|
-
retry: requiredString(guarantees.retry, "api.backfill.guarantees.retry"),
|
|
90
|
-
failureProjectionRule: requiredString(guarantees.failure_projection_rule, "api.backfill.guarantees.failure_projection_rule"),
|
|
91
|
-
},
|
|
92
|
-
omission: {
|
|
93
|
-
fields: requiredList(omission.fields, "api.backfill.omission.fields"),
|
|
94
|
-
completeReason: requiredString(omission.complete_reason, "api.backfill.omission.complete_reason"),
|
|
95
|
-
boundedReason: requiredString(omission.bounded_reason, "api.backfill.omission.bounded_reason"),
|
|
96
|
-
continuation: requiredString(omission.continuation, "api.backfill.omission.continuation"),
|
|
97
|
-
},
|
|
98
|
-
traceabilityFields: requiredList(traceability.provenance_fields, "api.backfill.traceability.provenance_fields"),
|
|
99
|
-
archiveRecordForbids: requiredList(traceability.archive_record_forbids, "api.backfill.traceability.archive_record_forbids"),
|
|
100
|
-
recovery: requiredString(backfill.recovery, "api.backfill.recovery"),
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
export function gitBackfillContractProjection(contract) {
|
|
104
|
-
return {
|
|
105
|
-
authority: contract.authorityPath,
|
|
106
|
-
command: contract.command,
|
|
107
|
-
formats: contract.formats,
|
|
108
|
-
supported_artifacts: contract.supportedArtifacts,
|
|
109
|
-
limits: {
|
|
110
|
-
results: contract.maximumLimit,
|
|
111
|
-
history_units: contract.maximumCommits,
|
|
112
|
-
history_bytes: contract.maximumHistoryBytes,
|
|
113
|
-
},
|
|
114
|
-
reachable_refs: contract.reachableRefs,
|
|
115
|
-
excluded_refs: contract.excludedRefs,
|
|
116
|
-
apply_requires: contract.applyRequires,
|
|
117
|
-
status_values: contract.statusValues,
|
|
118
|
-
ambiguity_reasons: contract.ambiguityReasons,
|
|
119
|
-
response: {
|
|
120
|
-
required_fields: contract.responseRequiredFields,
|
|
121
|
-
entry_fields: contract.responseEntryFields,
|
|
122
|
-
},
|
|
123
|
-
consent: {
|
|
124
|
-
inventory: contract.guarantees.readOnlyInventoryAndPreview ? "read_only" : "mutation",
|
|
125
|
-
preview: contract.guarantees.previewOptional ? "optional_read_only" : "required_read_only",
|
|
126
|
-
apply: contract.guarantees.applyRequiresForce ? "--apply --force" : "--apply",
|
|
127
|
-
},
|
|
128
|
-
revalidation: contract.guarantees.applyRevalidation,
|
|
129
|
-
failure_projection: contract.guarantees.failureProjectionRule,
|
|
130
|
-
recovery: {
|
|
131
|
-
operation: contract.recovery,
|
|
132
|
-
retry: contract.guarantees.retry,
|
|
133
|
-
omission: contract.omission.continuation,
|
|
134
|
-
},
|
|
135
|
-
traceability: {
|
|
136
|
-
provenance_fields: contract.traceabilityFields,
|
|
137
|
-
archive_record_forbids: contract.archiveRecordForbids,
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=gitBackfillAuthority.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitBackfillAuthority.js","sourceRoot":"","sources":["../../src/state/gitBackfillAuthority.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,mDAAmD,CAAC;AA8EpF,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED,SAAS,cAAc,CAAC,KAAc,EAAE,KAAa;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,8BAA8B,CAAC,CAAC;IACzF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,EAAE,KAAa;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QACjG,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Q,CAAC,gBAAgB;QAC5C,QAAQ,EAAE;YACR,eAAe,EAAE,QAAQ,CAAC,sBAAsB;YAChD,YAAY,EAAE,QAAQ,CAAC,mBAAmB;SAC3C;QACD,OAAO,EAAE;YACP,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU;YACrF,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAoB;YAC1F,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;SAC9E;QACD,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,iBAAiB;QACnD,kBAAkB,EAAE,QAAQ,CAAC,UAAU,CAAC,qBAAqB;QAC7D,QAAQ,EAAE;YACR,SAAS,EAAE,QAAQ,CAAC,QAAQ;YAC5B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK;YAChC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,YAAY;SACzC;QACD,YAAY,EAAE;YACZ,iBAAiB,EAAE,QAAQ,CAAC,kBAAkB;YAC9C,sBAAsB,EAAE,QAAQ,CAAC,oBAAoB;SACtD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
function successful(result) {
|
|
3
|
-
return result.status === 0 && !result.timedOut && !result.error;
|
|
4
|
-
}
|
|
5
|
-
function failureReason(result, fallback = "git_probe_error") {
|
|
6
|
-
if (result.timedOut)
|
|
7
|
-
return "git_probe_timeout";
|
|
8
|
-
if (result.error || result.status === null)
|
|
9
|
-
return "git_probe_error";
|
|
10
|
-
return fallback;
|
|
11
|
-
}
|
|
12
|
-
function boundedGitRunner(scan, run, callbacks) {
|
|
13
|
-
return (args, cwd) => {
|
|
14
|
-
const result = run(args, cwd);
|
|
15
|
-
if (successful(result) && !callbacks.chargeHistoryBytes(scan, result.stdout)) {
|
|
16
|
-
return { ...result, status: 1, error: "history_bytes" };
|
|
17
|
-
}
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
function logPaths(chunk, fallback) {
|
|
22
|
-
const lines = chunk.split(/\r?\n/).filter((line) => line.length > 0);
|
|
23
|
-
const paths = [];
|
|
24
|
-
for (const line of lines.slice(1)) {
|
|
25
|
-
const fields = line.split("\t");
|
|
26
|
-
if (fields.length < 2)
|
|
27
|
-
continue;
|
|
28
|
-
const status = fields[0] ?? "";
|
|
29
|
-
const candidate = status.startsWith("R") || status.startsWith("C")
|
|
30
|
-
? fields[fields.length - 1]
|
|
31
|
-
: fields[1];
|
|
32
|
-
if (candidate && !paths.includes(candidate))
|
|
33
|
-
paths.push(candidate);
|
|
34
|
-
}
|
|
35
|
-
return paths.length > 0 ? paths : [fallback];
|
|
36
|
-
}
|
|
37
|
-
function historyLog(run, context, gitPath, maxCommits) {
|
|
38
|
-
if (!context.root)
|
|
39
|
-
return { commits: [], bounded: false, reason: context.reason ?? "git_unavailable" };
|
|
40
|
-
const result = run([
|
|
41
|
-
"log",
|
|
42
|
-
"--date-order",
|
|
43
|
-
"--format=%H",
|
|
44
|
-
"--name-status",
|
|
45
|
-
`--max-count=${maxCommits}`,
|
|
46
|
-
...context.refs,
|
|
47
|
-
"--",
|
|
48
|
-
path.posix.dirname(gitPath),
|
|
49
|
-
], context.root);
|
|
50
|
-
if (!successful(result))
|
|
51
|
-
return { commits: [], bounded: false, reason: failureReason(result) };
|
|
52
|
-
const commits = [];
|
|
53
|
-
const seen = new Set();
|
|
54
|
-
let currentCommit;
|
|
55
|
-
let currentLines = [];
|
|
56
|
-
const flush = () => {
|
|
57
|
-
if (!currentCommit || seen.has(currentCommit))
|
|
58
|
-
return;
|
|
59
|
-
seen.add(currentCommit);
|
|
60
|
-
commits.push({ commit: currentCommit, paths: logPaths([currentCommit, ...currentLines].join("\n"), gitPath) });
|
|
61
|
-
};
|
|
62
|
-
for (const line of result.stdout.split(/\r?\n/)) {
|
|
63
|
-
const value = line.trim();
|
|
64
|
-
if (/^[0-9a-f]{40,64}$/.test(value)) {
|
|
65
|
-
flush();
|
|
66
|
-
currentCommit = value;
|
|
67
|
-
currentLines = [];
|
|
68
|
-
}
|
|
69
|
-
else if (currentCommit) {
|
|
70
|
-
currentLines.push(line);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
flush();
|
|
74
|
-
return { commits: commits.slice(0, maxCommits), bounded: commits.length >= maxCommits };
|
|
75
|
-
}
|
|
76
|
-
function projectionPathFamily(gitPath, candidate) {
|
|
77
|
-
const directory = path.posix.dirname(gitPath);
|
|
78
|
-
const stem = path.posix.basename(gitPath, ".yaml");
|
|
79
|
-
const normalized = path.posix.normalize(candidate);
|
|
80
|
-
return (candidate !== "" &&
|
|
81
|
-
candidate === normalized &&
|
|
82
|
-
!path.posix.isAbsolute(candidate) &&
|
|
83
|
-
!candidate.split("/").includes("..") &&
|
|
84
|
-
path.posix.dirname(candidate) === directory &&
|
|
85
|
-
path.posix.basename(candidate).startsWith(`${stem}`) &&
|
|
86
|
-
candidate.endsWith(".yaml"));
|
|
87
|
-
}
|
|
88
|
-
function changedProjectionPaths(run, root, commit, gitPath) {
|
|
89
|
-
const result = run(["diff-tree", "--root", "-r", "-M", "--name-status", commit], root);
|
|
90
|
-
if (!successful(result))
|
|
91
|
-
return [];
|
|
92
|
-
const paths = [];
|
|
93
|
-
for (const line of result.stdout.split(/\r?\n/)) {
|
|
94
|
-
const fields = line.split("\t");
|
|
95
|
-
if (fields.length < 2)
|
|
96
|
-
continue;
|
|
97
|
-
const status = fields[0] ?? "";
|
|
98
|
-
const candidates = status.startsWith("R") || status.startsWith("C")
|
|
99
|
-
? fields.slice(1)
|
|
100
|
-
: [fields[1]];
|
|
101
|
-
for (const candidate of candidates) {
|
|
102
|
-
if (candidate && projectionPathFamily(gitPath, candidate) && !paths.includes(candidate))
|
|
103
|
-
paths.push(candidate);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return paths;
|
|
107
|
-
}
|
|
108
|
-
function projectionPathsAtCommit(run, root, commit, gitPath, parseTreeEntry) {
|
|
109
|
-
const result = run(["ls-tree", "-r", "-z", commit, "--", path.posix.dirname(gitPath)], root);
|
|
110
|
-
if (!successful(result))
|
|
111
|
-
return [];
|
|
112
|
-
const paths = [];
|
|
113
|
-
for (const item of result.stdout.split("\0")) {
|
|
114
|
-
if (!item)
|
|
115
|
-
continue;
|
|
116
|
-
const entry = parseTreeEntry(item);
|
|
117
|
-
if (entry && projectionPathFamily(gitPath, entry.path) && !paths.includes(entry.path))
|
|
118
|
-
paths.push(entry.path);
|
|
119
|
-
}
|
|
120
|
-
return paths;
|
|
121
|
-
}
|
|
122
|
-
function collectReachable(scan, run, context, callbacks) {
|
|
123
|
-
if (!context.root)
|
|
124
|
-
return;
|
|
125
|
-
const historicalRun = boundedGitRunner(scan, run, callbacks);
|
|
126
|
-
const targetIds = new Set(scan.targets.keys());
|
|
127
|
-
const artifactPaths = scan.contract.supportedArtifacts.map((artifactId) => ({
|
|
128
|
-
artifactId,
|
|
129
|
-
gitPath: callbacks.projectionGitPath(scan, context.root, artifactId),
|
|
130
|
-
}));
|
|
131
|
-
const seenOccurrences = new Set();
|
|
132
|
-
for (const item of artifactPaths) {
|
|
133
|
-
if (!item.gitPath) {
|
|
134
|
-
scan.diagnostics.push(`${item.artifactId} projection is outside the selected Git project`);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
const remainingCommits = scan.contract.maximumCommits - scan.historyWork;
|
|
138
|
-
if (remainingCommits <= 0) {
|
|
139
|
-
callbacks.markBounded(scan, "commit_count");
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
const log = historyLog(historicalRun, context, item.gitPath, remainingCommits);
|
|
143
|
-
if (log.reason) {
|
|
144
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
145
|
-
return;
|
|
146
|
-
scan.diagnostics.push(`${item.artifactId} history scan failed: ${log.reason}`);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (log.bounded)
|
|
150
|
-
callbacks.markBounded(scan, "commit_count");
|
|
151
|
-
for (const commit of log.commits) {
|
|
152
|
-
if (!callbacks.consumeHistoryWork(scan)) {
|
|
153
|
-
callbacks.markBounded(scan, "commit_count");
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
scan.reachableCommits.add(commit.commit);
|
|
157
|
-
const paths = [...new Set([
|
|
158
|
-
...commit.paths,
|
|
159
|
-
...changedProjectionPaths(historicalRun, context.root, commit.commit, item.gitPath),
|
|
160
|
-
...projectionPathsAtCommit(historicalRun, context.root, commit.commit, item.gitPath, callbacks.parseTreeEntry),
|
|
161
|
-
])].filter((candidate) => projectionPathFamily(item.gitPath, candidate));
|
|
162
|
-
for (const gitPath of paths) {
|
|
163
|
-
const tree = historicalRun(["ls-tree", "-r", "-z", commit.commit, "--", gitPath], context.root);
|
|
164
|
-
if (!successful(tree)) {
|
|
165
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
166
|
-
return;
|
|
167
|
-
scan.diagnostics.push(`cannot inspect ${commit.commit}:${gitPath}: ${failureReason(tree)}`);
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
const treeEntry = callbacks.parseTreeEntry(tree.stdout);
|
|
171
|
-
if (!treeEntry)
|
|
172
|
-
continue;
|
|
173
|
-
const display = callbacks.displayPath(scan.projectRoot, context.root, treeEntry.path);
|
|
174
|
-
if (!display)
|
|
175
|
-
continue;
|
|
176
|
-
const occurrenceKey = `${commit.commit}:${display}:${treeEntry.blobId}:${item.artifactId}`;
|
|
177
|
-
if (seenOccurrences.has(occurrenceKey))
|
|
178
|
-
continue;
|
|
179
|
-
seenOccurrences.add(occurrenceKey);
|
|
180
|
-
const content = historicalRun(["cat-file", "-p", treeEntry.blobId], context.root);
|
|
181
|
-
if (!successful(content)) {
|
|
182
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
183
|
-
return;
|
|
184
|
-
scan.diagnostics.push(`cannot read ${commit.commit}:${treeEntry.path}: ${failureReason(content)}`);
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
callbacks.occurrenceFromProjection(content.stdout, {
|
|
188
|
-
commit: commit.commit,
|
|
189
|
-
path: display,
|
|
190
|
-
gitPath: treeEntry.path,
|
|
191
|
-
blobId: treeEntry.blobId,
|
|
192
|
-
reachable: true,
|
|
193
|
-
}, item.artifactId, scan.sourceRoot, targetIds, scan.invalid, (occurrence) => callbacks.addGroup(scan.groups, occurrence));
|
|
194
|
-
}
|
|
195
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function collectRewritten(scan, run, context, callbacks) {
|
|
203
|
-
if (!context.root || scan.targets.size === 0)
|
|
204
|
-
return;
|
|
205
|
-
const historicalRun = boundedGitRunner(scan, run, callbacks);
|
|
206
|
-
const remainingCommits = scan.contract.maximumCommits - scan.historyWork;
|
|
207
|
-
if (remainingCommits <= 0) {
|
|
208
|
-
callbacks.markBounded(scan, "commit_count");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const reflog = historicalRun(["reflog", "show", "--format=%H", "--max-count", String(remainingCommits), "HEAD"], context.root);
|
|
212
|
-
if (!successful(reflog) || scan.boundedReasons.includes("history_bytes"))
|
|
213
|
-
return;
|
|
214
|
-
const targetIds = new Set(scan.targets.keys());
|
|
215
|
-
const paths = scan.contract.supportedArtifacts.map((artifactId) => ({
|
|
216
|
-
artifactId,
|
|
217
|
-
gitPath: callbacks.projectionGitPath(scan, context.root, artifactId),
|
|
218
|
-
}));
|
|
219
|
-
const commits = reflog.stdout
|
|
220
|
-
.split(/\r?\n/)
|
|
221
|
-
.map((value) => value.trim())
|
|
222
|
-
.filter((value) => /^[0-9a-f]{40,64}$/.test(value));
|
|
223
|
-
if (commits.length >= remainingCommits)
|
|
224
|
-
callbacks.markBounded(scan, "commit_count");
|
|
225
|
-
for (const commit of commits) {
|
|
226
|
-
if (!/^[0-9a-f]{40,64}$/.test(commit) || scan.reachableCommits.has(commit))
|
|
227
|
-
continue;
|
|
228
|
-
if (!callbacks.consumeHistoryWork(scan))
|
|
229
|
-
return;
|
|
230
|
-
for (const item of paths) {
|
|
231
|
-
if (!item.gitPath)
|
|
232
|
-
continue;
|
|
233
|
-
const historicalPaths = [...new Set([
|
|
234
|
-
...changedProjectionPaths(historicalRun, context.root, commit, item.gitPath),
|
|
235
|
-
...projectionPathsAtCommit(historicalRun, context.root, commit, item.gitPath, callbacks.parseTreeEntry),
|
|
236
|
-
])];
|
|
237
|
-
for (const gitPath of historicalPaths) {
|
|
238
|
-
const tree = historicalRun(["ls-tree", "-r", "-z", commit, "--", gitPath], context.root);
|
|
239
|
-
if (!successful(tree)) {
|
|
240
|
-
if (scan.boundedReasons.includes("history_bytes"))
|
|
241
|
-
return;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
const treeEntry = callbacks.parseTreeEntry(tree.stdout);
|
|
245
|
-
if (!treeEntry)
|
|
246
|
-
continue;
|
|
247
|
-
const display = callbacks.displayPath(scan.projectRoot, context.root, treeEntry.path);
|
|
248
|
-
if (!display)
|
|
249
|
-
continue;
|
|
250
|
-
const content = historicalRun(["cat-file", "-p", treeEntry.blobId], context.root);
|
|
251
|
-
if (!successful(content))
|
|
252
|
-
return;
|
|
253
|
-
callbacks.occurrenceFromProjection(content.stdout, {
|
|
254
|
-
commit,
|
|
255
|
-
path: display,
|
|
256
|
-
gitPath: treeEntry.path,
|
|
257
|
-
blobId: treeEntry.blobId,
|
|
258
|
-
reachable: false,
|
|
259
|
-
}, item.artifactId, scan.sourceRoot, targetIds, scan.invalid, (occurrence) => {
|
|
260
|
-
const values = scan.rewritten.get(occurrence.entryId) ?? [];
|
|
261
|
-
if (!values.some((value) => value.commit === occurrence.commit && value.contentHash === occurrence.contentHash)) {
|
|
262
|
-
values.push(occurrence);
|
|
263
|
-
}
|
|
264
|
-
scan.rewritten.set(occurrence.entryId, values);
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (scan.historyWork >= scan.contract.maximumCommits) {
|
|
269
|
-
callbacks.markBounded(scan, "commit_count");
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
export function collectGitHistory(scan, run, context, callbacks) {
|
|
275
|
-
collectReachable(scan, run, context, callbacks);
|
|
276
|
-
collectRewritten(scan, run, context, callbacks);
|
|
277
|
-
}
|
|
278
|
-
//# sourceMappingURL=gitBackfillHistory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gitBackfillHistory.js","sourceRoot":"","sources":["../../src/state/gitBackfillHistory.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAoC7B,SAAS,UAAU,CAAC,MAAwB;IAC1C,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,MAAwB,EAAE,QAAQ,GAAG,iBAAiB;IAC3E,IAAI,MAAM,CAAC,QAAQ;QAAE,OAAO,mBAAmB,CAAC;IAChD,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,iBAAiB,CAAC;IACrE,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAgB,EAAE,GAAqB,EAAE,SAAsC;IACvG,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACnB,MAAM,MAAM,GAAG,GAAG,CAAC,I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CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC;YACrD,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YAC5C,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAgB,EAChB,GAAqB,EACrB,OAAmB,EACnB,SAAsC;IAEtC,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAChD,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { canonicalRecordJson, discoverNumberedArchives, numberedArchiveContract, } from "./archiveDiscovery.js";
|
|
4
|
-
import { gitBackfillContractProjection } from "./gitBackfillAuthority.js";
|
|
5
|
-
import { serializeNumberedArchive } from "./archivePublication.js";
|
|
6
|
-
export function sortedGroups(scan, args) {
|
|
7
|
-
const groups = [...scan.groups.values()].filter((group) => (!args.artifact || group.artifactId === args.artifact) &&
|
|
8
|
-
(args.number === undefined || group.entryNumber === args.number));
|
|
9
|
-
for (const target of scan.targets.values()) {
|
|
10
|
-
if ((!args.artifact || target.artifactId === args.artifact) &&
|
|
11
|
-
(args.number === undefined || target.entryNumber === args.number) &&
|
|
12
|
-
!scan.groups.has(target.entryId)) {
|
|
13
|
-
groups.push({
|
|
14
|
-
artifactId: target.artifactId,
|
|
15
|
-
entryNumber: target.entryNumber,
|
|
16
|
-
entryId: target.entryId,
|
|
17
|
-
versions: new Map(),
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
groups.sort((a, b) => a.artifactId.localeCompare(b.artifactId) || a.entryNumber - b.entryNumber);
|
|
22
|
-
return groups;
|
|
23
|
-
}
|
|
24
|
-
export function occurrences(group) {
|
|
25
|
-
return [...group.versions.values()]
|
|
26
|
-
.flat()
|
|
27
|
-
.sort((a, b) => a.commit.localeCompare(b.commit) || a.path.localeCompare(b.path) || a.blobId.localeCompare(b.blobId));
|
|
28
|
-
}
|
|
29
|
-
export function groupReason(scan, group) {
|
|
30
|
-
if (!scan.gitRoot)
|
|
31
|
-
return "git_unavailable";
|
|
32
|
-
if (scan.headStatus === "changed")
|
|
33
|
-
return "changed_head";
|
|
34
|
-
if (scan.headStatus === "unavailable") {
|
|
35
|
-
return scan.gitReason === "missing_commit" ? "missing_history" : "git_unavailable";
|
|
36
|
-
}
|
|
37
|
-
const reachableHashes = new Set(group.versions.keys());
|
|
38
|
-
if ((scan.rewritten.get(group.entryId) ?? []).some((value) => !reachableHashes.has(value.contentHash))) {
|
|
39
|
-
return "history_rewritten";
|
|
40
|
-
}
|
|
41
|
-
if (scan.invalid.has(group.entryId))
|
|
42
|
-
return "corrupt_history";
|
|
43
|
-
if (scan.bounded)
|
|
44
|
-
return "scan_bounded";
|
|
45
|
-
if (scan.shallow)
|
|
46
|
-
return "shallow_history";
|
|
47
|
-
if (group.versions.size > 1)
|
|
48
|
-
return "conflicting_versions";
|
|
49
|
-
if (group.versions.size === 1)
|
|
50
|
-
return "none";
|
|
51
|
-
if (scan.rewritten.has(group.entryId))
|
|
52
|
-
return "history_rewritten";
|
|
53
|
-
return "missing_history";
|
|
54
|
-
}
|
|
55
|
-
export function provenanceFor(values) {
|
|
56
|
-
return values.map((value) => ({
|
|
57
|
-
commit: value.commit,
|
|
58
|
-
path: value.path,
|
|
59
|
-
blob_id: value.blobId,
|
|
60
|
-
entry_id: value.entryId,
|
|
61
|
-
content_hash: value.contentHash,
|
|
62
|
-
reachable: value.reachable,
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
function existingArchiveState(projectRoot, sourceRoot, group) {
|
|
66
|
-
const contract = numberedArchiveContract(group.artifactId, sourceRoot);
|
|
67
|
-
const archivePath = path.join(projectRoot, contract.archiveRoot, group.artifactId, `${group.entryNumber}${contract.archiveExtension}`);
|
|
68
|
-
const discovery = discoverNumberedArchives(projectRoot, {
|
|
69
|
-
sourceRoot,
|
|
70
|
-
artifactId: group.artifactId,
|
|
71
|
-
});
|
|
72
|
-
const existing = discovery.entries.find((entry) => entry.path === archivePath);
|
|
73
|
-
if (existing && group.versions.size === 1) {
|
|
74
|
-
const record = [...group.versions.values()][0]?.[0]?.record;
|
|
75
|
-
if (record && canonicalRecordJson(existing.record) === canonicalRecordJson(record))
|
|
76
|
-
return "same";
|
|
77
|
-
}
|
|
78
|
-
if (fs.existsSync(archivePath))
|
|
79
|
-
return "conflict";
|
|
80
|
-
return "none";
|
|
81
|
-
}
|
|
82
|
-
function occurrenceFor(scan, group, args) {
|
|
83
|
-
const values = [
|
|
84
|
-
...occurrences(group),
|
|
85
|
-
...(scan.rewritten.get(group.entryId) ?? []),
|
|
86
|
-
];
|
|
87
|
-
if (!args.commit && !args.path)
|
|
88
|
-
return values[0];
|
|
89
|
-
return values.find((value) => value.reachable &&
|
|
90
|
-
(!args.commit || value.commit === args.commit) &&
|
|
91
|
-
(!args.path || value.path === args.path));
|
|
92
|
-
}
|
|
93
|
-
export function buildEntryOutput(scan, group, args, includeBytes) {
|
|
94
|
-
const pinRequested = Boolean(args.commit || args.path);
|
|
95
|
-
const selected = occurrenceFor(scan, group, args);
|
|
96
|
-
const reason = pinRequested && !selected ? "no_matching_pin" : groupReason(scan, group);
|
|
97
|
-
const values = occurrences(group);
|
|
98
|
-
const rewritten = scan.rewritten.get(group.entryId) ?? [];
|
|
99
|
-
const invalid = scan.invalid.get(group.entryId) ?? [];
|
|
100
|
-
const eligible = reason === "none" && group.versions.size === 1 && selected?.reachable === true;
|
|
101
|
-
const source = selected ?? invalid[0];
|
|
102
|
-
const output = {
|
|
103
|
-
entry_id: group.entryId,
|
|
104
|
-
artifact_id: group.artifactId,
|
|
105
|
-
entry_number: group.entryNumber,
|
|
106
|
-
commit: source?.commit ?? null,
|
|
107
|
-
path: source?.path ?? null,
|
|
108
|
-
blob_id: source?.blobId ?? null,
|
|
109
|
-
content_hash: source?.contentHash ?? null,
|
|
110
|
-
ambiguity_reason: reason,
|
|
111
|
-
eligible,
|
|
112
|
-
reachable: source?.reachable ?? false,
|
|
113
|
-
provenance: provenanceFor([...values, ...rewritten, ...invalid]),
|
|
114
|
-
operation: eligible ? "candidate" : "refused",
|
|
115
|
-
...(reason === "no_matching_pin" ? { refusal: "no reachable occurrence matches the requested --commit/--path pin" } : {}),
|
|
116
|
-
};
|
|
117
|
-
if (includeBytes && eligible && selected) {
|
|
118
|
-
const serialized = serializeNumberedArchive(group.artifactId, group.entryNumber, selected.record, scan.sourceRoot);
|
|
119
|
-
output.proposed_archive_bytes = serialized.bytes;
|
|
120
|
-
output.record_sha256 = serialized.recordSha256;
|
|
121
|
-
}
|
|
122
|
-
return output;
|
|
123
|
-
}
|
|
124
|
-
export function archiveState(projectRoot, sourceRoot, group) {
|
|
125
|
-
return existingArchiveState(projectRoot, sourceRoot, group);
|
|
126
|
-
}
|
|
127
|
-
export function selectedOccurrence(scan, group, args) {
|
|
128
|
-
return occurrenceFor(scan, group, args);
|
|
129
|
-
}
|
|
130
|
-
export function buildResponse(scan, mode, entries, diagnostics, status, omittedCount = 0) {
|
|
131
|
-
const uniqueCandidates = entries.filter((entry) => entry.ambiguity_reason === "none").length;
|
|
132
|
-
const conflicting = entries.filter((entry) => entry.ambiguity_reason === "conflicting_versions").length;
|
|
133
|
-
const missing = entries.filter((entry) => ["missing_history", "history_rewritten", "corrupt_history"].includes(entry.ambiguity_reason)).length;
|
|
134
|
-
const occurrencesCount = entries.reduce((count, entry) => count + Math.max(entry.provenance.length, entry.commit ? 1 : 0), 0);
|
|
135
|
-
const applied = entries.filter((entry) => entry.operation === "applied").length;
|
|
136
|
-
const replayed = entries.filter((entry) => entry.operation === "replayed" || entry.operation === "already_archived").length;
|
|
137
|
-
const refused = entries.filter((entry) => entry.operation === "refused").length;
|
|
138
|
-
return {
|
|
139
|
-
command: scan.contract.command,
|
|
140
|
-
mode,
|
|
141
|
-
status,
|
|
142
|
-
project: scan.projectRoot,
|
|
143
|
-
read_only: mode !== "apply",
|
|
144
|
-
remote_contact: false,
|
|
145
|
-
head: {
|
|
146
|
-
before: scan.beforeHead ?? null,
|
|
147
|
-
after: scan.afterHead ?? null,
|
|
148
|
-
status: scan.headStatus,
|
|
149
|
-
},
|
|
150
|
-
scan: {
|
|
151
|
-
reachable_refs: scan.refs,
|
|
152
|
-
shallow: scan.shallow,
|
|
153
|
-
bounded: scan.bounded,
|
|
154
|
-
commits_limit: scan.contract.maximumCommits,
|
|
155
|
-
commits_used: scan.historyWork,
|
|
156
|
-
history_bytes_limit: scan.contract.maximumHistoryBytes,
|
|
157
|
-
history_bytes_used: scan.historyBytes,
|
|
158
|
-
bounded_reasons: scan.boundedReasons,
|
|
159
|
-
},
|
|
160
|
-
counts: {
|
|
161
|
-
targets: scan.targets.size,
|
|
162
|
-
occurrences: occurrencesCount,
|
|
163
|
-
unique_candidates: uniqueCandidates,
|
|
164
|
-
conflicting,
|
|
165
|
-
missing,
|
|
166
|
-
previewed: mode === "preview" ? entries.filter((entry) => entry.proposed_archive_bytes !== undefined).length : 0,
|
|
167
|
-
applied,
|
|
168
|
-
replayed,
|
|
169
|
-
refused,
|
|
170
|
-
},
|
|
171
|
-
active_projections_unchanged: true,
|
|
172
|
-
active_projection_hashes: scan.projectionHashes,
|
|
173
|
-
omitted: omittedCount > 0,
|
|
174
|
-
omitted_count: omittedCount,
|
|
175
|
-
omission_reason: omittedCount > 0 ? "result_limit" : "none",
|
|
176
|
-
continuation: {
|
|
177
|
-
available: false,
|
|
178
|
-
guidance: omittedCount > 0
|
|
179
|
-
? "No cursor is issued; use --artifact ARTIFACT --number N to retrieve an omitted entry because --limit is capped at 100."
|
|
180
|
-
: "No continuation is required.",
|
|
181
|
-
},
|
|
182
|
-
entries,
|
|
183
|
-
diagnostics,
|
|
184
|
-
source_contract: {
|
|
185
|
-
...gitBackfillContractProjection(scan.contract),
|
|
186
|
-
syntax: scan.contract.command,
|
|
187
|
-
read_only: mode !== "apply",
|
|
188
|
-
remote_contact: false,
|
|
189
|
-
archive_record_forbids: scan.contract.archiveRecordForbids,
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
export function renderGitBackfillText(response, out) {
|
|
194
|
-
out(`status=${response.status} | mode=${response.mode} | project=${response.project} | head=${response.head.status}\n`);
|
|
195
|
-
out(`counts=targets:${response.counts.targets} occurrences:${response.counts.occurrences} ` +
|
|
196
|
-
`unique:${response.counts.unique_candidates} conflicting:${response.counts.conflicting} ` +
|
|
197
|
-
`missing:${response.counts.missing} applied:${response.counts.applied} refused:${response.counts.refused}\n`);
|
|
198
|
-
for (const entry of response.entries) {
|
|
199
|
-
out(`- ${entry.entry_id} | ${entry.operation ?? "candidate"} | ` +
|
|
200
|
-
`reason=${entry.ambiguity_reason} | commit=${entry.commit ?? "-"} | path=${entry.path ?? "-"}\n`);
|
|
201
|
-
}
|
|
202
|
-
if (response.omitted) {
|
|
203
|
-
out(`omitted=${response.omitted_count} | reason=${response.omission_reason}\n`);
|
|
204
|
-
out(`continuation=${response.continuation.guidance}\n`);
|
|
205
|
-
}
|
|
206
|
-
for (const diagnostic of response.diagnostics)
|
|
207
|
-
out(`diagnostic=${diagnostic}\n`);
|
|
208
|
-
}
|
|
209
|
-
//# sourceMappingURL=gitBackfillOutput.js.map
|