@tiinex/core 0.1.1
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/LICENSE +201 -0
- package/NOTICE +31 -0
- package/README.md +45 -0
- package/package.json +176 -0
- package/src/actions/record.actions.js +312 -0
- package/src/adapters/adapter.contracts.js +143 -0
- package/src/adapters/archive/archive.adapter.js +502 -0
- package/src/adapters/archive/archive.portableChangeset.js +141 -0
- package/src/adapters/archive/archive.transport.js +124 -0
- package/src/artifacts/artifact.localDraft.js +27 -0
- package/src/artifacts/artifact.normalize.js +28 -0
- package/src/artifacts/artifact.parse.js +207 -0
- package/src/artifacts/artifact.record.js +83 -0
- package/src/audit/audit.run.js +103 -0
- package/src/audit/audit.summary.js +7 -0
- package/src/diagnostics/sourceBoundary.report.js +112 -0
- package/src/export/package.apply.js +349 -0
- package/src/export/package.builder.js +366 -0
- package/src/export/package.bytes.js +164 -0
- package/src/export/package.controlIntegrity.js +42 -0
- package/src/export/package.controlTopology.js +97 -0
- package/src/export/package.fileMap.js +174 -0
- package/src/export/package.manifest.js +401 -0
- package/src/export/package.preflight.js +204 -0
- package/src/export/package.sourceReference.js +81 -0
- package/src/export/package.workspaceContext.js +144 -0
- package/src/export/package.zip.js +128 -0
- package/src/export/tree.bundle.js +278 -0
- package/src/governance/governance.boundary.js +196 -0
- package/src/integrity/integrity.c14nV2.js +190 -0
- package/src/integrity/integrity.methodReference.js +73 -0
- package/src/integrity/integrity.validate.js +56 -0
- package/src/lineage/lineage.candidateResolution.js +46 -0
- package/src/lineage/lineage.githubIssueComment.js +106 -0
- package/src/lineage/lineage.githubIssueLocal.js +196 -0
- package/src/lineage/lineage.githubIssueTarget.js +89 -0
- package/src/lineage/lineage.integrity.js +133 -0
- package/src/lineage/lineage.materialPreference.js +26 -0
- package/src/lineage/lineage.model.js +63 -0
- package/src/lineage/lineage.parentAuthority.js +5 -0
- package/src/lineage/lineage.parentBinding.js +104 -0
- package/src/lineage/lineage.pathBasis.js +47 -0
- package/src/lineage/lineage.resolve.js +388 -0
- package/src/lineage/lineage.sourceScope.js +74 -0
- package/src/lineage/lineage.targetKeys.js +80 -0
- package/src/lineage/lineage.traverse.js +132 -0
- package/src/public/applicationProjection.js +236 -0
- package/src/public/companionResources.js +246 -0
- package/src/public/index.js +16 -0
- package/src/public/node.js +2 -0
- package/src/public/schemaAncestry.js +26 -0
- package/src/publication/publication.contract.js +196 -0
- package/src/publication/publication.preflight.js +159 -0
- package/src/publication/publication.targetContract.js +241 -0
- package/src/reingest/reingest.plan.js +162 -0
- package/src/release/plan.mjs +28 -0
- package/src/release/policy.mjs +100 -0
- package/src/release/run.mjs +74 -0
- package/src/schemas/capability.registry.js +226 -0
- package/src/schemas/companion.js +245 -0
- package/src/schemas/contracts.js +6 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.js +14 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.json +23 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.runtime.json +4283 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.source.js +9 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.js +26 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.json +23 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.runtime.json +1985 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.source.js +9 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.js +14 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.json +24 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.runtime.json +1700 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.capabilities.js +14 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.en.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.findings.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.presenter.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.js +32 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.json +24 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.runtime.json +2184 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.source.js +9 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.sv.i18n.json +6 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.transitions.js +1 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.validate.js +10 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.js +14 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.json +23 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.runtime.json +1773 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.capabilities.js +11 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.contract.js +40 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.en.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.findings.js +12 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.localMaterialization.js +89 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.presenter.js +8 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.js +34 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.json +23 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.runtime.json +2029 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.source.js +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.sv.i18n.json +9 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.transitions.js +1 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.validate.js +25 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.capabilities.js +14 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.en.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.findings.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.presenter.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.js +31 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.json +23 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.runtime.json +2033 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.source.js +9 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.sv.i18n.json +6 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.transitions.js +1 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.validate.js +10 -0
- package/src/schemas/core/relation/tiinex.relation.v1.capabilities.js +7 -0
- package/src/schemas/core/relation/tiinex.relation.v1.contract.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.findings.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.localMaterialization.js +153 -0
- package/src/schemas/core/relation/tiinex.relation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.js +20 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.json +23 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.runtime.json +1668 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/tiinex.relation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/tiinex.relation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/tiinex.relation.v1.validate.js +36 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.capabilities.js +14 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.contract.js +57 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.en.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.findings.js +13 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.presenter.js +3 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.js +20 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.json +24 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.runtime.json +3315 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.source.js +9 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.sv.i18n.json +4 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.transitions.js +1 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.validate.js +78 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.js +14 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.json +23 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.runtime.json +1733 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.capabilities.js +11 -0
- package/src/schemas/core/task/tiinex.task.v1.contract.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.en.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.findings.js +18 -0
- package/src/schemas/core/task/tiinex.task.v1.localMaterialization.js +148 -0
- package/src/schemas/core/task/tiinex.task.v1.presenter.js +8 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.js +35 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.json +23 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.runtime.json +1708 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.source.js +9 -0
- package/src/schemas/core/task/tiinex.task.v1.sv.i18n.json +15 -0
- package/src/schemas/core/task/tiinex.task.v1.transitions.js +3 -0
- package/src/schemas/core/task/tiinex.task.v1.validate.js +41 -0
- package/src/schemas/core/topic/tiinex.topic.v1.capabilities.js +14 -0
- package/src/schemas/core/topic/tiinex.topic.v1.creation.js +46 -0
- package/src/schemas/core/topic/tiinex.topic.v1.en.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.findings.js +11 -0
- package/src/schemas/core/topic/tiinex.topic.v1.localMaterialization.js +135 -0
- package/src/schemas/core/topic/tiinex.topic.v1.presenter.js +1 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.js +34 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.json +23 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.runtime.json +1699 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.source.js +9 -0
- package/src/schemas/core/topic/tiinex.topic.v1.sv.i18n.json +8 -0
- package/src/schemas/core/topic/tiinex.topic.v1.transitions.js +31 -0
- package/src/schemas/core/topic/tiinex.topic.v1.validate.js +11 -0
- package/src/schemas/creation.capability.js +289 -0
- package/src/schemas/creation.contracts.js +334 -0
- package/src/schemas/creation.executionSnapshot.js +79 -0
- package/src/schemas/creation.factoryQualification.js +73 -0
- package/src/schemas/creation.renderer.js +244 -0
- package/src/schemas/creation.representation.js +279 -0
- package/src/schemas/creation.rootMetadata.js +6 -0
- package/src/schemas/creation.schemaReferences.js +65 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.js +14 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.json +23 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.runtime.json +1873 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.source.js +9 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.js +14 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.json +23 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.runtime.json +1839 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.source.js +9 -0
- package/src/schemas/generic.artifact.module.js +25 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.js +26 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.json +23 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.runtime.json +2249 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.source.js +9 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.js +26 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.json +24 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.runtime.json +2091 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.capabilities.js +14 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.en.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.findings.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.presenter.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.js +29 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.json +21 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.runtime.json +2180 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.sv.i18n.json +4 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.transitions.js +1 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.validate.js +1 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.js +26 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.json +23 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.runtime.json +1733 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.source.js +9 -0
- package/src/schemas/reference.shapes.js +33 -0
- package/src/schemas/registry.js +36 -0
- package/src/schemas/resolver.js +13 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.capabilities.js +14 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.en.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.findings.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.presenter.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.js +29 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.json +21 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.runtime.json +2093 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.source.js +9 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.sv.i18n.json +4 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.transitions.js +1 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.validate.js +1 -0
- package/src/schemas/schema.factory.descriptor.js +104 -0
- package/src/schemas/schema.githubSourceTarget.js +131 -0
- package/src/schemas/schema.identity.js +10 -0
- package/src/schemas/schema.reference.js +133 -0
- package/src/schemas/schema.source.js +239 -0
- package/src/schemas/tiinex.root.v1.capabilities.js +14 -0
- package/src/schemas/tiinex.root.v1.classify.js +55 -0
- package/src/schemas/tiinex.root.v1.en.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.fallback.js +84 -0
- package/src/schemas/tiinex.root.v1.findings.js +19 -0
- package/src/schemas/tiinex.root.v1.presenter.js +5 -0
- package/src/schemas/tiinex.root.v1.schema.js +29 -0
- package/src/schemas/tiinex.root.v1.schema.json +24 -0
- package/src/schemas/tiinex.root.v1.schema.runtime.json +1574 -0
- package/src/schemas/tiinex.root.v1.schema.source.js +9 -0
- package/src/schemas/tiinex.root.v1.sv.i18n.json +24 -0
- package/src/schemas/tiinex.root.v1.transitions.js +1 -0
- package/src/schemas/tiinex.root.v1.validate.js +36 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.js +14 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.json +23 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.runtime.json +2027 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.source.js +9 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.js +14 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.json +23 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.runtime.json +1848 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.source.js +9 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.js +14 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.json +23 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.runtime.json +2015 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.capabilities.js +12 -0
- package/src/schemas/workspace/tiinex.workspace.v1.en.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.findings.js +5 -0
- package/src/schemas/workspace/tiinex.workspace.v1.presenter.js +27 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.js +30 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.json +23 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.runtime.json +1596 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.source.js +9 -0
- package/src/schemas/workspace/tiinex.workspace.v1.sv.i18n.json +7 -0
- package/src/schemas/workspace/tiinex.workspace.v1.transitions.js +10 -0
- package/src/schemas/workspace/tiinex.workspace.v1.validate.js +10 -0
- package/src/sources/github/github.issueTarget.js +127 -0
- package/src/sources/origin.references.js +249 -0
- package/src/sources/source.explicitTargets.js +49 -0
- package/src/sources/transport.levels.js +107 -0
- package/src/tooling/portable/adapters/cli/cli.cold-start-input.js +34 -0
- package/src/tooling/portable/adapters/cli/cli.command-input.js +455 -0
- package/src/tooling/portable/adapters/cli/cli.common-author.js +249 -0
- package/src/tooling/portable/adapters/cli/cli.common-output.js +330 -0
- package/src/tooling/portable/adapters/cli/cli.editor-assistance.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.ground-materialize.js +96 -0
- package/src/tooling/portable/adapters/cli/cli.ground-recovery.js +99 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-manufacture.js +345 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.js +31 -0
- package/src/tooling/portable/adapters/cli/cli.help.js +80 -0
- package/src/tooling/portable/adapters/cli/cli.land.js +13 -0
- package/src/tooling/portable/adapters/cli/cli.local-output.js +72 -0
- package/src/tooling/portable/adapters/cli/cli.material-policy.js +6 -0
- package/src/tooling/portable/adapters/cli/cli.operator-bridge.js +18 -0
- package/src/tooling/portable/adapters/cli/cli.reduction-input.js +14 -0
- package/src/tooling/portable/adapters/cli/cli.run.js +434 -0
- package/src/tooling/portable/adapters/llm/llm.entrypoint.js +34 -0
- package/src/tooling/portable/adapters/node/checkpoint.verify.js +267 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.bootstrap.js +109 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.enumeration.js +94 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.js +193 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.multiRoot.js +49 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.packageParent.js +130 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.requirements.js +353 -0
- package/src/tooling/portable/adapters/node/handoff.manufacture.scope.js +147 -0
- package/src/tooling/portable/adapters/node/workspaceCarrier.manufacture.js +62 -0
- package/src/tooling/portable/assets/asset.operations.js +170 -0
- package/src/tooling/portable/audit/audit.capability.js +119 -0
- package/src/tooling/portable/bootstrap/artifact.result.selfverify.mjs +109 -0
- package/src/tooling/portable/bootstrap/bootstrap.case.mjs +43 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.md +814 -0
- package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.pointer.json +25 -0
- package/src/tooling/portable/checkpoint/portable.checkpoint.js +89 -0
- package/src/tooling/portable/conformance/checkpoint.qualification.js +271 -0
- package/src/tooling/portable/draft/draft.create.js +389 -0
- package/src/tooling/portable/draft/draft.crud.js +175 -0
- package/src/tooling/portable/draft/draft.exact.js +173 -0
- package/src/tooling/portable/draft/draft.operations.js +265 -0
- package/src/tooling/portable/draft/draft.qualification.js +45 -0
- package/src/tooling/portable/draft/draft.set.js +193 -0
- package/src/tooling/portable/draft/draft.validation-context.js +7 -0
- package/src/tooling/portable/editor/authoring.parent.js +37 -0
- package/src/tooling/portable/editor/editor.assistance.js +221 -0
- package/src/tooling/portable/editor/staged.validation.js +96 -0
- package/src/tooling/portable/engine.facade.js +468 -0
- package/src/tooling/portable/findings.js +92 -0
- package/src/tooling/portable/grounding/grounding.capsule.js +128 -0
- package/src/tooling/portable/grounding/grounding.continuity.js +283 -0
- package/src/tooling/portable/grounding/grounding.participantAuthority.js +20 -0
- package/src/tooling/portable/grounding/grounding.planningContext.js +34 -0
- package/src/tooling/portable/grounding/grounding.readiness.authority.js +17 -0
- package/src/tooling/portable/grounding/grounding.readiness.js +316 -0
- package/src/tooling/portable/grounding/grounding.readiness.support.js +245 -0
- package/src/tooling/portable/grounding/grounding.sourceEvidence.js +71 -0
- package/src/tooling/portable/grounding/grounding.workContext.js +72 -0
- package/src/tooling/portable/grounding/grounding.workProvenance.js +153 -0
- package/src/tooling/portable/handoff/carrierLineage.js +214 -0
- package/src/tooling/portable/handoff/carrierProfile.js +54 -0
- package/src/tooling/portable/handoff/carrierProjection.js +193 -0
- package/src/tooling/portable/handoff/carrierProjection.routeQualification.js +228 -0
- package/src/tooling/portable/handoff/carrierProjection.shared.js +7 -0
- package/src/tooling/portable/handoff/carrierProjection.workspaces.js +54 -0
- package/src/tooling/portable/handoff/coldConsumerEntrypoint.js +185 -0
- package/src/tooling/portable/handoff/coldStartQualification.contract.js +184 -0
- package/src/tooling/portable/handoff/coldStartQualification.grounding.js +392 -0
- package/src/tooling/portable/handoff/coldStartQualification.js +22 -0
- package/src/tooling/portable/handoff/coldStartQualification.materials.js +364 -0
- package/src/tooling/portable/handoff/coldStartQualification.observation.js +220 -0
- package/src/tooling/portable/handoff/coldStartQualification.run.js +81 -0
- package/src/tooling/portable/handoff/coldStartQualification.shared.js +57 -0
- package/src/tooling/portable/handoff/coldStartRolePointers.js +39 -0
- package/src/tooling/portable/handoff/contextAudit.js +247 -0
- package/src/tooling/portable/handoff/contracts/tiinex.handoff.package.v1.schema.md +409 -0
- package/src/tooling/portable/handoff/handoffAuthoringPlan.js +35 -0
- package/src/tooling/portable/handoff/handoffEndpointProjection.js +61 -0
- package/src/tooling/portable/handoff/handoffLeafProjection.js +91 -0
- package/src/tooling/portable/handoff/humanOutputPresentation.js +21 -0
- package/src/tooling/portable/handoff/manufacture.js +84 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.binding.js +72 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.direct.js +160 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.indexes.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.js +247 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.projectionProvider.js +44 -0
- package/src/tooling/portable/handoff/materialClosure.archiveV2.workspace.js +226 -0
- package/src/tooling/portable/handoff/materialClosure.descriptor.js +169 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.js +372 -0
- package/src/tooling/portable/handoff/materialClosure.inputBinding.support.js +62 -0
- package/src/tooling/portable/handoff/materialClosure.materialized.js +143 -0
- package/src/tooling/portable/handoff/materialClosure.materials.js +116 -0
- package/src/tooling/portable/handoff/materialClosure.package.js +181 -0
- package/src/tooling/portable/handoff/materialClosure.plan.js +204 -0
- package/src/tooling/portable/handoff/materialClosure.readiness.js +36 -0
- package/src/tooling/portable/handoff/materialClosure.requirements.js +137 -0
- package/src/tooling/portable/handoff/operatorContextProjection.js +105 -0
- package/src/tooling/portable/handoff/pointerEntrypoint.js +138 -0
- package/src/tooling/portable/handoff/qualifiedHandoffFixture.js +34 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.build.js +321 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.closure.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.materials.js +207 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.projection.js +69 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.roles.js +166 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.routes.js +113 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.shared.js +87 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirst.workspaces.js +160 -0
- package/src/tooling/portable/handoff/recipientV2.artifactFirstPhase1.js +44 -0
- package/src/tooling/portable/handoff/recipientV2.artifactInspection.js +55 -0
- package/src/tooling/portable/handoff/recipientV2.artifacts.js +174 -0
- package/src/tooling/portable/handoff/recipientV2.coldProjection.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.delivery.js +48 -0
- package/src/tooling/portable/handoff/recipientV2.endpointRolePointers.js +179 -0
- package/src/tooling/portable/handoff/recipientV2.entryContract.js +28 -0
- package/src/tooling/portable/handoff/recipientV2.humanOutput.js +78 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.helpers.js +218 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.js +194 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.pathToken.js +9 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.projection.js +58 -0
- package/src/tooling/portable/handoff/recipientV2.inspect.workspaces.js +177 -0
- package/src/tooling/portable/handoff/recipientV2.lineage.js +142 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +147 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.constants.js +4 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.contract.js +101 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.helpers.js +126 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.js +185 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.js +12 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.shared.js +24 -0
- package/src/tooling/portable/handoff/recipientV2.packageV1.workspaceProjection.js +22 -0
- package/src/tooling/portable/handoff/recipientV2.pointer.js +40 -0
- package/src/tooling/portable/handoff/recipientV2.routeSelection.js +16 -0
- package/src/tooling/portable/handoff/recipientV2.topology.helpers.js +20 -0
- package/src/tooling/portable/handoff/recipientV2.topology.js +320 -0
- package/src/tooling/portable/handoff/recipientV2.topology.materials.js +70 -0
- package/src/tooling/portable/handoff/recipientV2.topology.workspaces.js +193 -0
- package/src/tooling/portable/handoff/recipientV2.transportManifest.js +123 -0
- package/src/tooling/portable/handoff/recipientV2.workspaceRepresentation.js +163 -0
- package/src/tooling/portable/handoff/routeArtifactConformance.js +130 -0
- package/src/tooling/portable/handoff/toolingBootstrap.js +67 -0
- package/src/tooling/portable/handoff/transportCompanion.js +175 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.archive.js +95 -0
- package/src/tooling/portable/handoff/workspaceByteProvider.js +271 -0
- package/src/tooling/portable/handoff/workspaceCarrier.manufacture.js +93 -0
- package/src/tooling/portable/handoff/workspaceLandingPlan.js +142 -0
- package/src/tooling/portable/handoff/workspacePackageSources.js +105 -0
- package/src/tooling/portable/handoff/workspaceQualifiedReference.js +10 -0
- package/src/tooling/portable/handoff/workspaceSourceIdentity.js +52 -0
- package/src/tooling/portable/handoff/workspaceTargetConformance.js +134 -0
- package/src/tooling/portable/host/host.capabilities.js +181 -0
- package/src/tooling/portable/host/tool.bindings.js +357 -0
- package/src/tooling/portable/host/tool.receiptNormalization.js +141 -0
- package/src/tooling/portable/index.js +52 -0
- package/src/tooling/portable/input/node.input.js +184 -0
- package/src/tooling/portable/input/portable.input.js +249 -0
- package/src/tooling/portable/lifecycle/lifecycle.action.js +11 -0
- package/src/tooling/portable/lifecycle/lifecycle.material.js +173 -0
- package/src/tooling/portable/lifecycle/lifecycle.operations.js +34 -0
- package/src/tooling/portable/lifecycle/lifecycle.readiness.js +247 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.audit.js +22 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.evidence.js +36 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.js +306 -0
- package/src/tooling/portable/lineage/lineage.integrity.apply.structure.js +178 -0
- package/src/tooling/portable/lineage/lineage.integrity.plan.js +377 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.human.js +82 -0
- package/src/tooling/portable/lineage/lineage.integrity.projection.js +349 -0
- package/src/tooling/portable/lineage/lineage.operations.js +32 -0
- package/src/tooling/portable/lineage/lineage.print.js +398 -0
- package/src/tooling/portable/lineage/lineage.print.render.js +88 -0
- package/src/tooling/portable/lineage/lineage.print.utils.js +58 -0
- package/src/tooling/portable/lineage/lineage.publicationProviderReceipts.js +141 -0
- package/src/tooling/portable/lineage/lineage.publicationQualification.js +183 -0
- package/src/tooling/portable/lineage/lineage.search.js +301 -0
- package/src/tooling/portable/live/live.artifact.js +192 -0
- package/src/tooling/portable/live/live.export.js +107 -0
- package/src/tooling/portable/live/live.lineage.closure.js +71 -0
- package/src/tooling/portable/live/live.lineage.js +338 -0
- package/src/tooling/portable/live/live.protocol.js +181 -0
- package/src/tooling/portable/materialization/durable.materialize.js +162 -0
- package/src/tooling/portable/materialization/epistemic.plan.js +239 -0
- package/src/tooling/portable/materialization/loaded.parent.js +54 -0
- package/src/tooling/portable/materialization/materialization.facade.js +30 -0
- package/src/tooling/portable/operation.catalog.js +393 -0
- package/src/tooling/portable/operation.catalog.package.js +183 -0
- package/src/tooling/portable/operation.result.js +25 -0
- package/src/tooling/portable/orchestration/task.prepare.js +191 -0
- package/src/tooling/portable/output/artifact.result.package.js +308 -0
- package/src/tooling/portable/output/deterministic.zip.js +88 -0
- package/src/tooling/portable/output/node.artifact-set.js +223 -0
- package/src/tooling/portable/output/node.draft.js +41 -0
- package/src/tooling/portable/output/node.zip.js +39 -0
- package/src/tooling/portable/output/recipientV2.zip.js +59 -0
- package/src/tooling/portable/overview/blockingCue.js +16 -0
- package/src/tooling/portable/overview/operatingOverview.js +413 -0
- package/src/tooling/portable/package/generation.binding.js +314 -0
- package/src/tooling/portable/package/generation.binding.projection.js +128 -0
- package/src/tooling/portable/package/material.graph.js +236 -0
- package/src/tooling/portable/package/runtime.package.js +321 -0
- package/src/tooling/portable/package/schema.transition.companion.js +196 -0
- package/src/tooling/portable/package/semantic.package.graph.js +272 -0
- package/src/tooling/portable/package/semantic.package.js +203 -0
- package/src/tooling/portable/package/semantic.package.schema-resolution.js +158 -0
- package/src/tooling/portable/package/semantic.package.transition-registry.js +189 -0
- package/src/tooling/portable/package/semantic.package.types.js +18 -0
- package/src/tooling/portable/providers/schema.bootstrap.provenance.js +10 -0
- package/src/tooling/portable/providers/schema.provider.qualification.js +52 -0
- package/src/tooling/portable/providers/schema.providers.js +458 -0
- package/src/tooling/portable/publication/runtime.publication.js +53 -0
- package/src/tooling/portable/qualification.js +150 -0
- package/src/tooling/portable/reduction/reduction.composition.js +229 -0
- package/src/tooling/portable/reduction/reduction.eligibility.helpers.js +258 -0
- package/src/tooling/portable/reduction/reduction.eligibility.js +191 -0
- package/src/tooling/portable/reduction/reduction.operations.js +30 -0
- package/src/tooling/portable/reduction/reduction.preflight.js +85 -0
- package/src/tooling/portable/reduction/reduction.shared.js +173 -0
- package/src/tooling/portable/schema/bootstrap/canonical.pack.js +24 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/party/role/tiinex.party.role.v1.schema.md +289 -0
- package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/validation/report/tiinex.validation.report.v1.schema.md +300 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.runtime-projection.json +48 -0
- package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.schema.md +865 -0
- package/src/tooling/portable/schema/contract.compile.js +406 -0
- package/src/tooling/portable/schema/contract.compile.utils.js +9 -0
- package/src/tooling/portable/schema/contract.constraints.js +117 -0
- package/src/tooling/portable/schema/contract.envelope.validate.js +177 -0
- package/src/tooling/portable/schema/contract.field-domain.compile.js +399 -0
- package/src/tooling/portable/schema/contract.field-domain.js +247 -0
- package/src/tooling/portable/schema/contract.field-shape.compile.js +34 -0
- package/src/tooling/portable/schema/contract.inheritance.inline.js +103 -0
- package/src/tooling/portable/schema/contract.inheritance.js +210 -0
- package/src/tooling/portable/schema/contract.inheritance.record.js +76 -0
- package/src/tooling/portable/schema/contract.machine-shape.js +309 -0
- package/src/tooling/portable/schema/contract.project.js +81 -0
- package/src/tooling/portable/schema/contract.semantic-resolution.js +82 -0
- package/src/tooling/portable/schema/contract.validate.js +0 -0
- package/src/tooling/portable/schema/lexical.shape.v1.js +338 -0
- package/src/tooling/portable/schema/llm.companion.js +108 -0
- package/src/tooling/portable/schema/named.declarations.js +162 -0
- package/src/tooling/portable/schema/ordinary.contract.js +193 -0
- package/src/tooling/portable/schema/ordinary.fields.js +205 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.projection.js +70 -0
- package/src/tooling/portable/schema/qualifiedLocalRoot.runtime.js +170 -0
- package/src/tooling/portable/schema/schema.contract.js +465 -0
- package/src/tooling/portable/schema/schema.guide.js +326 -0
- package/src/tooling/portable/schema/schema.snapshot.js +119 -0
- package/src/tooling/portable/session/portable.session.js +145 -0
- package/src/tooling/portable/transfer/transfer.plan.js +102 -0
- package/src/transitions/record.transitions.js +484 -0
- package/src/transitions/transition.validate.js +129 -0
- package/src/validation/findings.js +76 -0
- package/src/validation/validateArtifact.js +216 -0
- package/src/workspaces/workspace.entrypointCapability.js +44 -0
- package/src/workspaces/workspace.materialRole.js +242 -0
- package/src/workspaces/workspace.recordPaths.js +426 -0
- package/tools/tiinex-portable.mjs +6 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { canonicalPath, githubRepoRelativePathFromUrl } from './lineage.targetKeys.js';
|
|
2
|
+
|
|
3
|
+
export function declaredParentBindingTargetValuesForNode(node = {}, rawTarget = '') {
|
|
4
|
+
const record = node?.record || node || {};
|
|
5
|
+
const values = [
|
|
6
|
+
record?.sourceTarget?.parentRawUrl,
|
|
7
|
+
record?.sourceTarget?.parentSourceUrl,
|
|
8
|
+
record?.snapshot?.parentRawUrl,
|
|
9
|
+
record?.snapshot?.parentSourceUrl,
|
|
10
|
+
record?.sourceTarget?.parentArtifactPath,
|
|
11
|
+
record?.snapshot?.parentArtifactPath,
|
|
12
|
+
record?.parentOrigin,
|
|
13
|
+
record?.origin
|
|
14
|
+
];
|
|
15
|
+
const out = [];
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
for (const value of values) {
|
|
18
|
+
const raw = String(value || '').trim();
|
|
19
|
+
if (!raw || seen.has(raw)) continue;
|
|
20
|
+
seen.add(raw);
|
|
21
|
+
const githubFilePath = githubRepoRelativePathFromUrl(raw);
|
|
22
|
+
const filePath = githubFilePath || (isExternalUrl(raw) ? '' : canonicalPath(raw));
|
|
23
|
+
if (!filePath && !isGitHubIssueTarget(raw)) continue;
|
|
24
|
+
if (!declaredParentBindingMatchesTarget(raw, rawTarget)) continue;
|
|
25
|
+
if (!isStrongDeclaredParentBinding(raw, filePath)) continue;
|
|
26
|
+
out.push(Object.freeze({ raw, filePath, isGitHubIssueTarget: isGitHubIssueTarget(raw) }));
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isSyntheticPublicationLineageNode(node = {}) {
|
|
32
|
+
const record = node?.record || node || {};
|
|
33
|
+
const mode = String(record.sourceMode || record.recoveryKind || '').toLowerCase();
|
|
34
|
+
const targetKind = String(record.sourceTarget?.targetKind || record.snapshot?.sourceKind || '').toLowerCase();
|
|
35
|
+
const path = canonicalPath(record.path || node?.path || '').toLowerCase();
|
|
36
|
+
const recovered = String(record.recoveredFromUrl || record.sourceTarget?.inputTarget || record.snapshot?.sourceUrl || '').trim();
|
|
37
|
+
return Boolean(
|
|
38
|
+
mode.includes('github-issue') ||
|
|
39
|
+
mode.includes('github-comment') ||
|
|
40
|
+
targetKind.includes('github-issue') ||
|
|
41
|
+
targetKind.includes('github-comment') ||
|
|
42
|
+
path.includes('/.issues/') ||
|
|
43
|
+
path.includes('/.github/.issues/') ||
|
|
44
|
+
isGitHubIssueTarget(recovered)
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function declaredParentBindingMatchesTarget(parent = '', target = '') {
|
|
49
|
+
const parentPath = githubRepoRelativePathFromUrl(parent) || canonicalPath(parent);
|
|
50
|
+
const targetPath = githubRepoRelativePathFromUrl(target) || canonicalPath(target);
|
|
51
|
+
if (isGitHubIssueTarget(parent)) {
|
|
52
|
+
if (isGitHubIssueTarget(target)) return normalizeGitHubIssueTarget(parent) === normalizeGitHubIssueTarget(target);
|
|
53
|
+
const parentCommentId = githubIssueCommentIdFromValue(parent);
|
|
54
|
+
const targetCommentId = githubIssueCommentIdFromValue(targetPath || target);
|
|
55
|
+
if (parentCommentId && targetCommentId && parentCommentId === targetCommentId) return true;
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (!parentPath) return false;
|
|
59
|
+
if (!targetPath) return true;
|
|
60
|
+
if (parentPath === targetPath || parentPath.endsWith(`/${targetPath}`) || targetPath.endsWith(`/${parentPath}`)) return true;
|
|
61
|
+
const parentBase = basename(parentPath);
|
|
62
|
+
const targetBase = basename(targetPath);
|
|
63
|
+
return Boolean(parentBase && targetBase && parentBase === targetBase && parentPath.includes('/'));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
function githubIssueCommentIdFromValue(value = '') {
|
|
68
|
+
const raw = String(value || '').trim();
|
|
69
|
+
if (!raw) return '';
|
|
70
|
+
const direct = raw.match(/(?:issuecomment-|issues\/comments\/|comment-(?:\d+-)?)(\d{4,})/i)?.[1] || '';
|
|
71
|
+
if (direct) return direct;
|
|
72
|
+
try {
|
|
73
|
+
const url = new URL(raw);
|
|
74
|
+
return url.hash.match(/issuecomment-(\d+)/i)?.[1] || '';
|
|
75
|
+
} catch (_) {}
|
|
76
|
+
return '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function isStrongDeclaredParentBinding(raw = '', path = '') {
|
|
80
|
+
if (isGitHubIssueTarget(raw)) return true;
|
|
81
|
+
const clean = canonicalPath(path || raw);
|
|
82
|
+
if (!clean) return false;
|
|
83
|
+
if (/^\.topics(?:\/|$)/.test(clean)) return true;
|
|
84
|
+
return clean.includes('/');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function isExternalUrl(value = '') { try { const url = new URL(String(value || '').trim()); return /^https?:$/i.test(url.protocol); } catch (_) { return false; } }
|
|
88
|
+
|
|
89
|
+
function isGitHubIssueTarget(value = '') {
|
|
90
|
+
try {
|
|
91
|
+
const url = new URL(String(value || '').trim());
|
|
92
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
93
|
+
return (url.hostname === 'github.com' || url.hostname.endsWith('.github.com') || url.hostname === 'api.github.com') && parts.includes('issues');
|
|
94
|
+
} catch (_) { return false; }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function normalizeGitHubIssueTarget(value = '') {
|
|
98
|
+
try {
|
|
99
|
+
const url = new URL(String(value || '').trim());
|
|
100
|
+
return `${url.hostname.toLowerCase()}${url.pathname.toLowerCase()}${url.hash.toLowerCase()}`;
|
|
101
|
+
} catch (_) { return String(value || '').trim().toLowerCase(); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function basename(path = '') { return canonicalPath(path).split('/').filter(Boolean).pop() || ''; }
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export function lineageBasePathForNode(node = {}) {
|
|
2
|
+
return lineageBasePathForRecord(node?.record || { path: node?.path || '' }, node?.path || '');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function lineageBasePathForRecord(record = {}, fallbackPath = '') {
|
|
6
|
+
const recordPath = firstNonEmpty(fallbackPath, record.path);
|
|
7
|
+
const sourcePath = firstNonEmpty(record.sourceTarget?.sourceArtifactPath, record.snapshot?.sourceArtifactPath, record.sourcePath, record.source?.path);
|
|
8
|
+
if (isSyntheticIssueMaterialPath(recordPath)) return sourcePath || recordPath;
|
|
9
|
+
return recordPath || sourcePath;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function firstNonEmpty(...items) { return items.map((item) => String(item || '').trim()).find(Boolean) || ''; }
|
|
13
|
+
|
|
14
|
+
function isSyntheticIssueMaterialPath(path = '') {
|
|
15
|
+
const raw = String(path || '').trim();
|
|
16
|
+
const clean = canonicalPath(raw).toLowerCase();
|
|
17
|
+
if (!clean) return false;
|
|
18
|
+
if (/^https?:\/\/github\.com\//i.test(raw)) return true;
|
|
19
|
+
return clean.includes('/.github/.issues/') || clean.includes('/.issues/github/') || clean.includes('/issues/') || /^github\.com\/[^/]+\/[^/]+\/issues\/\d+/.test(clean);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function canonicalPath(value = '') {
|
|
23
|
+
let raw = String(value || '').trim();
|
|
24
|
+
if (!raw) return '';
|
|
25
|
+
const githubPath = githubRepoRelativePathFromUrl(raw);
|
|
26
|
+
if (githubPath) raw = githubPath;
|
|
27
|
+
else { try { const url = new URL(raw); raw = url.pathname.replace(/^\/+/, ''); } catch (_) {} }
|
|
28
|
+
const out = [];
|
|
29
|
+
for (const part of raw.replace(/\\/g, '/').split('/')) {
|
|
30
|
+
if (!part || part === '.') continue;
|
|
31
|
+
if (part === '..') out.pop();
|
|
32
|
+
else out.push(part);
|
|
33
|
+
}
|
|
34
|
+
return out.join('/');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
function githubRepoRelativePathFromUrl(value = '') {
|
|
39
|
+
try {
|
|
40
|
+
const url = new URL(String(value || '').trim());
|
|
41
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
42
|
+
const host = url.hostname.toLowerCase();
|
|
43
|
+
if (host === 'raw.githubusercontent.com' && parts.length >= 4) return parts.slice(3).join('/');
|
|
44
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 5 && parts[2] === 'blob') return parts.slice(4).join('/');
|
|
45
|
+
} catch (_) {}
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { createLineageEdge, createLineageFinding, createLineageNode, LINEAGE_VIEW_MODEL_SCHEMA_ID, LineageEdgeKind, LineageResolutionStatus } from './lineage.model.js';
|
|
2
|
+
import { issueLocalPathKeysForNode, issueLocalPathMatches } from './lineage.githubIssueLocal.js';
|
|
3
|
+
import { filterGitHubIssueCommentCandidatesForTarget, githubIssueCommentIdFromValue, githubIssueCommentIdsForNode } from './lineage.githubIssueComment.js';
|
|
4
|
+
import { filterExactGitHubIssueCandidatesForTarget } from './lineage.githubIssueTarget.js';
|
|
5
|
+
import { isDotRelativeReference, isSimpleRelativeReference, isUrlLike, relativeCandidatePath, resolveCandidateNodes } from './lineage.candidateResolution.js';
|
|
6
|
+
import { canonicalIntegrityValue, parentIntegrityValuesForTarget, selfIntegrityValuesForNode, verifiedIntegrityMatch, withParentIntegrityStatus } from './lineage.integrity.js';
|
|
7
|
+
import { canonicalPath, canonicalToken, githubRepoRelativePathFromUrl, provenanceTargetKeysForValue, sourceKeyFromTarget } from './lineage.targetKeys.js';
|
|
8
|
+
import { declaredParentBindingTargetValuesForNode, isSyntheticPublicationLineageNode } from './lineage.parentBinding.js';
|
|
9
|
+
import { exactUnloadedParent } from './lineage.parentAuthority.js';
|
|
10
|
+
import { exactPathMatches, findPathSuffixMatches, sourceConstraintFromNode, sourceConstraintFromTarget } from './lineage.sourceScope.js';
|
|
11
|
+
export function resolveLineage(artifacts = [], options = {}) {
|
|
12
|
+
const records = Array.isArray(artifacts) ? artifacts : [];
|
|
13
|
+
const nodes = records.map((record, index) => createLineageNode(record, index));
|
|
14
|
+
const index = buildLineageIndex(nodes);
|
|
15
|
+
const edges = [];
|
|
16
|
+
const findings = [];
|
|
17
|
+
for (const node of nodes) {
|
|
18
|
+
const targets = declaredTargetsFor(node);
|
|
19
|
+
if (!targets.length) {
|
|
20
|
+
findings.push(createLineageFinding('lineage.root', 'No declared parent trace/origin; artifact is treated as a lineage root in the loaded set.', 'info', { nodeId: node.id }));
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const traceTarget = targets.find((target) => target.kind === LineageEdgeKind.parent);
|
|
24
|
+
const originTarget = targets.find((target) => target.kind === LineageEdgeKind.origin);
|
|
25
|
+
const parentMatch = traceTarget ? resolveTarget(traceTarget.value, index, node, { expectedIntegrityValues: traceTarget.integrityValues, targetKind: LineageEdgeKind.parent }) : null;
|
|
26
|
+
const originMatch = originTarget ? resolveTarget(originTarget.value, index, node, { targetKind: LineageEdgeKind.origin }) : null;
|
|
27
|
+
if (parentMatch?.selfReference) {
|
|
28
|
+
findings.push(createLineageFinding('lineage.parent.selfReference', 'Declared Parent Trace resolves to the declaring artifact itself; no parent edge was created.', 'warning', { nodeId: node.id, target: traceTarget.value }));
|
|
29
|
+
if (originMatch?.ambiguous) {
|
|
30
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
31
|
+
} else if (originMatch?.blocked) {
|
|
32
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
33
|
+
} else if (originTarget && originMatch && originMatch.id !== node.id) {
|
|
34
|
+
edges.push(createLineageEdge(originMatch.id, node.id, LineageEdgeKind.origin, {
|
|
35
|
+
target: originTarget.value,
|
|
36
|
+
method: originMatch.method,
|
|
37
|
+
label: 'origin recovery hint',
|
|
38
|
+
status: LineageResolutionStatus.degraded
|
|
39
|
+
}));
|
|
40
|
+
findings.push(createLineageFinding('lineage.parent.selfReferenceOriginFallback', 'Parent Trace resolved to self; Origin resolved as recovery context only.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
41
|
+
} else if (originTarget && !originMatch) {
|
|
42
|
+
findings.push(createLineageFinding('lineage.origin.unresolved', 'Origin not present in loaded material.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (parentMatch?.blocked) {
|
|
47
|
+
findings.push(createLineageFinding(parentMatch.code || 'lineage.target.outOfBoundary', parentMatch.message || 'Lineage target outside boundary; no edge created.', 'warning', { nodeId: node.id, target: traceTarget.value }));
|
|
48
|
+
if (originMatch?.ambiguous) {
|
|
49
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
50
|
+
} else if (originTarget && originMatch && !originMatch.blocked) {
|
|
51
|
+
edges.push(createLineageEdge(originMatch.id, node.id, LineageEdgeKind.origin, {
|
|
52
|
+
target: originTarget.value,
|
|
53
|
+
method: originMatch.method,
|
|
54
|
+
label: 'origin fallback edge',
|
|
55
|
+
status: LineageResolutionStatus.degraded
|
|
56
|
+
}));
|
|
57
|
+
findings.push(createLineageFinding('lineage.parent.boundaryBlocked', 'Parent Trace was outside boundary; Origin is recovery context.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
58
|
+
} else if (originMatch?.blocked) {
|
|
59
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
60
|
+
} else if (originTarget) {
|
|
61
|
+
findings.push(createLineageFinding('lineage.origin.unresolved', 'Origin not present in loaded material.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
62
|
+
}
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (parentMatch?.unresolvedExact) {
|
|
66
|
+
const recoveryTarget = parentMatch.recoveryTarget || traceTarget?.value || '';
|
|
67
|
+
edges.push(createLineageEdge('', node.id, LineageEdgeKind.parent, {
|
|
68
|
+
status: LineageResolutionStatus.missing,
|
|
69
|
+
target: recoveryTarget,
|
|
70
|
+
method: parentMatch.method || 'declared-parent-unloaded',
|
|
71
|
+
label: 'declared parent known but not loaded'
|
|
72
|
+
}));
|
|
73
|
+
findings.push(createLineageFinding('lineage.parent.exactTargetNotLoaded', 'Declared parent identity is known but its artifact is not loaded yet.', 'warning', { nodeId: node.id, target: recoveryTarget }));
|
|
74
|
+
if (originMatch?.ambiguous) {
|
|
75
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
76
|
+
} else if (originMatch?.blocked) {
|
|
77
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
78
|
+
} else if (originTarget && originMatch) {
|
|
79
|
+
edges.push(createLineageEdge(originMatch.id, node.id, LineageEdgeKind.origin, { target: originTarget.value, method: originMatch.method, label: 'origin recovery hint', status: LineageResolutionStatus.degraded }));
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (parentMatch?.ambiguous) {
|
|
84
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Parent Trace ambiguous; no edge created.', 'warning', { nodeId: node.id, target: traceTarget.value, candidates: parentMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
85
|
+
if (originMatch?.ambiguous) {
|
|
86
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
87
|
+
} else if (originMatch?.blocked) {
|
|
88
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
89
|
+
} else if (originTarget && !originMatch) {
|
|
90
|
+
findings.push(createLineageFinding('lineage.origin.unresolved', 'Origin not present in loaded material.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (parentMatch) {
|
|
95
|
+
edges.push(createLineageEdge(parentMatch.id, node.id, LineageEdgeKind.parent, {
|
|
96
|
+
target: traceTarget.value,
|
|
97
|
+
method: parentMatch.method,
|
|
98
|
+
label: 'declared parent trace',
|
|
99
|
+
status: parentMatch.status || LineageResolutionStatus.resolved,
|
|
100
|
+
diagnostics: parentMatch.diagnostics || []
|
|
101
|
+
}));
|
|
102
|
+
if (parentMatch.status === LineageResolutionStatus.mismatch) {
|
|
103
|
+
findings.push(createLineageFinding('lineage.parent.integrityMismatch', 'Declared parent was found by stable identity, but its loaded integrity value does not match the child declaration.', 'error', { nodeId: node.id, target: traceTarget.value }));
|
|
104
|
+
} else if (parentMatch.status === LineageResolutionStatus.probable) {
|
|
105
|
+
findings.push(createLineageFinding('lineage.parent.probable', 'Declared parent was found by stable identity, but no loaded self-integrity value was available to verify the edge.', 'info', { nodeId: node.id, target: traceTarget.value }));
|
|
106
|
+
}
|
|
107
|
+
if (originMatch?.ambiguous) {
|
|
108
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
109
|
+
} else if (originMatch?.blocked) {
|
|
110
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
111
|
+
} else if (originTarget && originMatch && originMatch.id !== parentMatch.id) {
|
|
112
|
+
edges.push(createLineageEdge(originMatch.id, node.id, LineageEdgeKind.origin, {
|
|
113
|
+
target: originTarget.value,
|
|
114
|
+
method: originMatch.method,
|
|
115
|
+
label: 'origin recovery hint'
|
|
116
|
+
}));
|
|
117
|
+
} else if (originTarget && !originMatch) {
|
|
118
|
+
findings.push(createLineageFinding('lineage.origin.unresolved', 'Origin not present in loaded material.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (traceTarget) {
|
|
123
|
+
edges.push(createLineageEdge('', node.id, LineageEdgeKind.parent, {
|
|
124
|
+
status: LineageResolutionStatus.missing,
|
|
125
|
+
target: traceTarget.value,
|
|
126
|
+
method: 'unresolved-trace',
|
|
127
|
+
label: 'missing parent trace'
|
|
128
|
+
}));
|
|
129
|
+
findings.push(createLineageFinding('lineage.parent.missing', 'Parent Trace target not loaded.', 'warning', { nodeId: node.id, target: traceTarget.value }));
|
|
130
|
+
}
|
|
131
|
+
if (originMatch?.ambiguous) {
|
|
132
|
+
findings.push(createLineageFinding('lineage.target.ambiguous', 'Origin ambiguous; no edge created.', 'warning', { nodeId: node.id, target: originTarget.value, candidates: originMatch.candidates.map((candidate) => candidate.id).join(', ') }));
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (originMatch?.blocked) {
|
|
136
|
+
findings.push(createLineageFinding(originMatch.code || 'lineage.target.outOfBoundary', originMatch.message || 'Declared Origin is outside boundary; no edge was created.', 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
if (originTarget && originMatch) {
|
|
140
|
+
edges.push(createLineageEdge(originMatch.id, node.id, LineageEdgeKind.origin, {
|
|
141
|
+
target: originTarget.value,
|
|
142
|
+
method: originMatch.method,
|
|
143
|
+
label: 'origin fallback edge',
|
|
144
|
+
status: traceTarget ? LineageResolutionStatus.degraded : LineageResolutionStatus.resolved
|
|
145
|
+
}));
|
|
146
|
+
if (traceTarget) {
|
|
147
|
+
findings.push(createLineageFinding('lineage.parent.originFallback', 'Parent Trace is missing; Origin is recovery context.', 'info', { nodeId: node.id, target: originTarget.value }));
|
|
148
|
+
}
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
if (originTarget) {
|
|
152
|
+
findings.push(createLineageFinding('lineage.origin.unresolved', 'Origin not present in loaded material.', traceTarget ? 'info' : 'warning', { nodeId: node.id, target: originTarget.value }));
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
schema: LINEAGE_VIEW_MODEL_SCHEMA_ID,
|
|
157
|
+
nodes,
|
|
158
|
+
artifacts: records,
|
|
159
|
+
edges,
|
|
160
|
+
findings,
|
|
161
|
+
stats: {
|
|
162
|
+
nodes: nodes.length,
|
|
163
|
+
edges: edges.filter((edge) => edge.status !== LineageResolutionStatus.missing).length,
|
|
164
|
+
missingEdges: edges.filter((edge) => edge.status === LineageResolutionStatus.missing).length,
|
|
165
|
+
roots: findings.filter((finding) => finding.code === 'lineage.root').length,
|
|
166
|
+
warnings: findings.filter((finding) => finding.severity === 'warning' || finding.severity === 'error').length
|
|
167
|
+
},
|
|
168
|
+
options: { depth: options.depth || 'loaded' }
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function declaredTargetsFor(node = {}) {
|
|
172
|
+
const targets = [];
|
|
173
|
+
if (node.trace) targets.push({ kind: LineageEdgeKind.parent, value: node.trace, integrityValues: parentIntegrityValuesForTarget(node, node.trace) });
|
|
174
|
+
if (node.origin) targets.push({ kind: LineageEdgeKind.origin, value: node.origin });
|
|
175
|
+
return targets;
|
|
176
|
+
}
|
|
177
|
+
function buildLineageIndex(nodes = []) {
|
|
178
|
+
const index = { byId: new Map(), byRecordTrace: new Map(), byPath: new Map(), bySourcePath: new Map(), byProvenance: new Map(), byIssueLocalPath: new Map(), byGitHubIssueCommentId: new Map(), bySelfIntegrity: new Map() };
|
|
179
|
+
for (const node of nodes) {
|
|
180
|
+
const id = canonicalToken(node.id);
|
|
181
|
+
if (id) {
|
|
182
|
+
addIndexed(index.byId, id, node);
|
|
183
|
+
addIndexed(index.byRecordTrace, `record:${id}`, node);
|
|
184
|
+
}
|
|
185
|
+
const path = canonicalPath(node.path);
|
|
186
|
+
if (path) addIndexed(index.byPath, path, node);
|
|
187
|
+
for (const sourcePath of sourcePathsForNode(node)) addIndexed(index.bySourcePath, sourcePath, node);
|
|
188
|
+
for (const target of provenanceTargetsForNode(node)) addIndexed(index.byProvenance, target, node);
|
|
189
|
+
for (const commentId of githubIssueCommentIdsForNode(node)) addIndexed(index.byGitHubIssueCommentId, commentId, node);
|
|
190
|
+
for (const hash of selfIntegrityValuesForNode(node)) addIndexed(index.bySelfIntegrity, hash, node);
|
|
191
|
+
for (const issueLocalPath of issueLocalPathKeysForNode(node)) addIndexed(index.byIssueLocalPath, issueLocalPath, node);
|
|
192
|
+
}
|
|
193
|
+
return index;
|
|
194
|
+
}
|
|
195
|
+
function sourcePathsForNode(node = {}) {
|
|
196
|
+
const record = node.record || {};
|
|
197
|
+
const values = [record.source?.path, record.sourcePath, record.sourceTarget?.sourceArtifactPath, record.snapshot?.sourceArtifactPath].map(canonicalPath).filter(Boolean);
|
|
198
|
+
return Array.from(new Set(values));
|
|
199
|
+
}
|
|
200
|
+
function provenanceTargetsForNode(node = {}) {
|
|
201
|
+
const record = node.record || {};
|
|
202
|
+
const snapshot = record.snapshot || {};
|
|
203
|
+
const sourceTarget = record.sourceTarget || {};
|
|
204
|
+
const target = snapshot.target || {};
|
|
205
|
+
const values = [
|
|
206
|
+
record.recoveredFromUrl,
|
|
207
|
+
record.sourceOrigin,
|
|
208
|
+
record.rawUrl,
|
|
209
|
+
record.browseUrl,
|
|
210
|
+
sourceTarget.inputTarget,
|
|
211
|
+
sourceTarget.rawUrl,
|
|
212
|
+
sourceTarget.browseUrl,
|
|
213
|
+
snapshot.sourceUrl,
|
|
214
|
+
target.canonicalUrl,
|
|
215
|
+
target.html_url,
|
|
216
|
+
target.url
|
|
217
|
+
];
|
|
218
|
+
return Array.from(new Set(values.flatMap(provenanceTargetKeysForValue).filter(Boolean)));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function addIndexed(map, key, node) {
|
|
222
|
+
if (!key || !node) return;
|
|
223
|
+
const existing = map.get(key);
|
|
224
|
+
if (!existing) map.set(key, [node]);
|
|
225
|
+
else existing.push(node);
|
|
226
|
+
}
|
|
227
|
+
function resolveTarget(target, index, declaringNode = null, options = {}) {
|
|
228
|
+
const raw = String(target || '').trim();
|
|
229
|
+
if (!raw) return null;
|
|
230
|
+
|
|
231
|
+
const expectedIntegrityValues = Array.isArray(options.expectedIntegrityValues) ? options.expectedIntegrityValues.map(canonicalIntegrityValue).filter(Boolean) : [];
|
|
232
|
+
if (expectedIntegrityValues.length) {
|
|
233
|
+
const integrityMatch = resolveIntegrityTarget(expectedIntegrityValues, index, declaringNode);
|
|
234
|
+
if (integrityMatch) return integrityMatch;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const token = canonicalToken(raw);
|
|
238
|
+
const path = canonicalPath(raw);
|
|
239
|
+
const urlFilePath = githubRepoRelativePathFromUrl(raw);
|
|
240
|
+
const urlSourceKey = sourceKeyFromTarget(raw);
|
|
241
|
+
const declaringConstraint = sourceConstraintFromNode(declaringNode);
|
|
242
|
+
const relative = relativeCandidatePath(raw, declaringNode);
|
|
243
|
+
const simpleRelative = isSimpleRelativeReference(raw);
|
|
244
|
+
const dotRelative = isDotRelativeReference(raw);
|
|
245
|
+
const urlLike = isUrlLike(raw);
|
|
246
|
+
const recordToken = /^record:/i.test(raw);
|
|
247
|
+
const finalize = (match) => withParentIntegrityStatus(match, expectedIntegrityValues);
|
|
248
|
+
|
|
249
|
+
const resolveDirectToken = () => {
|
|
250
|
+
const directTokenCandidates = [
|
|
251
|
+
['record-trace', index.byRecordTrace.get(token)],
|
|
252
|
+
['id', index.byId.get(token)]
|
|
253
|
+
];
|
|
254
|
+
for (const [method, nodes] of directTokenCandidates) {
|
|
255
|
+
const resolved = resolveCandidateNodes(nodes || [], method, declaringNode);
|
|
256
|
+
if (resolved) return finalize(resolved);
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const resolveProvenanceTarget = () => {
|
|
262
|
+
for (const targetKey of provenanceTargetKeysForValue(raw)) {
|
|
263
|
+
const resolved = resolveCandidateNodes(index.byProvenance.get(targetKey) || [], 'provenance-target', declaringNode);
|
|
264
|
+
if (resolved) return finalize(resolved);
|
|
265
|
+
}
|
|
266
|
+
return null;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const resolveGithubIssueCommentTarget = (method = 'github-issue-comment-id') => {
|
|
270
|
+
const commentId = githubIssueCommentIdFromValue(raw);
|
|
271
|
+
if (!commentId) return null;
|
|
272
|
+
const candidates = filterGitHubIssueCommentCandidatesForTarget(index.byGitHubIssueCommentId?.get(commentId) || [], raw, declaringNode);
|
|
273
|
+
const resolved = resolveCandidateNodes(candidates, method, declaringNode);
|
|
274
|
+
return resolved ? finalize(resolved) : null;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const resolveDeclaredParentBinding = () => {
|
|
278
|
+
if (options.targetKind !== LineageEdgeKind.parent) return null;
|
|
279
|
+
const bindings = declaredParentBindingTargetValuesForNode(declaringNode, raw);
|
|
280
|
+
let unresolvedExact = null;
|
|
281
|
+
for (const binding of bindings) {
|
|
282
|
+
if (binding.isGitHubIssueTarget) {
|
|
283
|
+
const commentId = githubIssueCommentIdFromValue(binding.raw);
|
|
284
|
+
if (commentId) {
|
|
285
|
+
const exactCommentCandidates = filterGitHubIssueCommentCandidatesForTarget(index.byGitHubIssueCommentId?.get(commentId) || [], binding.raw, declaringNode);
|
|
286
|
+
const resolvedComment = resolveCandidateNodes(exactCommentCandidates, 'declared-parent-github-comment-id', declaringNode);
|
|
287
|
+
if (resolvedComment) return finalize(resolvedComment);
|
|
288
|
+
unresolvedExact ||= exactUnloadedParent(binding.raw, 'declared-parent-github-comment-unloaded');
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const issueCandidates = [];
|
|
292
|
+
for (const targetKey of provenanceTargetKeysForValue(binding.raw)) issueCandidates.push(...(index.byProvenance.get(targetKey) || []));
|
|
293
|
+
const exactIssueCandidates = filterExactGitHubIssueCandidatesForTarget(issueCandidates, binding.raw, declaringNode);
|
|
294
|
+
const resolvedIssue = resolveCandidateNodes(exactIssueCandidates, 'declared-parent-github-issue', declaringNode);
|
|
295
|
+
if (resolvedIssue) return finalize(resolvedIssue);
|
|
296
|
+
unresolvedExact ||= exactUnloadedParent(binding.raw, 'declared-parent-github-issue-unloaded');
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
const sourceKey = sourceKeyFromTarget(binding.raw);
|
|
300
|
+
const constraint = sourceKey ? sourceConstraintFromTarget(sourceKey) : declaringConstraint;
|
|
301
|
+
const exact = exactPathMatches(binding.filePath, index, constraint, Boolean(constraint.hasConstraint));
|
|
302
|
+
const resolvedExact = resolveCandidateNodes(exact, 'declared-parent-path', declaringNode);
|
|
303
|
+
if (resolvedExact) return finalize(resolvedExact);
|
|
304
|
+
if (canonicalPath(binding.filePath).includes('/')) {
|
|
305
|
+
const suffix = [
|
|
306
|
+
...findPathSuffixMatches(binding.filePath, index.byPath, constraint, Boolean(constraint.hasConstraint)),
|
|
307
|
+
...findPathSuffixMatches(binding.filePath, index.bySourcePath, constraint, Boolean(constraint.hasConstraint))
|
|
308
|
+
];
|
|
309
|
+
const resolvedSuffix = resolveCandidateNodes(suffix, 'declared-parent-path-suffix', declaringNode);
|
|
310
|
+
if (resolvedSuffix) return finalize(resolvedSuffix);
|
|
311
|
+
}
|
|
312
|
+
unresolvedExact ||= exactUnloadedParent(binding.raw || binding.filePath, 'declared-parent-path-unloaded');
|
|
313
|
+
}
|
|
314
|
+
return unresolvedExact;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
if (recordToken) return finalize(resolveDirectToken());
|
|
318
|
+
|
|
319
|
+
// A declared parent binding is stronger evidence than cwd/path inference.
|
|
320
|
+
// Evaluate it before relative aliases so a weak ambiguous path cannot veto an
|
|
321
|
+
// exact publication/comment/source binding carried by the declaring artifact.
|
|
322
|
+
const strongDeclaredParent = resolveDeclaredParentBinding();
|
|
323
|
+
if (strongDeclaredParent) return strongDeclaredParent;
|
|
324
|
+
|
|
325
|
+
if ((simpleRelative || dotRelative) && relative) {
|
|
326
|
+
if (relative.blocked) return relative;
|
|
327
|
+
const contextual = exactPathMatches(relative.path, index, declaringConstraint, true);
|
|
328
|
+
const resolved = resolveCandidateNodes(contextual, relative.method, declaringNode);
|
|
329
|
+
if (resolved) return finalize(resolved);
|
|
330
|
+
const issueLocal = issueLocalPathMatches(raw, index, declaringNode);
|
|
331
|
+
const resolvedIssueLocal = resolveCandidateNodes(issueLocal, 'issue-local-relative-path', declaringNode);
|
|
332
|
+
if (resolvedIssueLocal) return finalize(resolvedIssueLocal);
|
|
333
|
+
const commentIdMatch = resolveGithubIssueCommentTarget('github-issue-comment-id-relative-path');
|
|
334
|
+
if (commentIdMatch) return commentIdMatch;
|
|
335
|
+
if (dotRelative && isSyntheticPublicationLineageNode(declaringNode) && path.includes('/')) {
|
|
336
|
+
const suffix = [
|
|
337
|
+
...findPathSuffixMatches(path, index.byPath, declaringConstraint, Boolean(declaringConstraint.hasConstraint)),
|
|
338
|
+
...findPathSuffixMatches(path, index.bySourcePath, declaringConstraint, Boolean(declaringConstraint.hasConstraint))
|
|
339
|
+
];
|
|
340
|
+
const resolvedSuffix = resolveCandidateNodes(suffix, 'synthetic-parent-path-suffix', declaringNode);
|
|
341
|
+
if (resolvedSuffix) return finalize(resolvedSuffix);
|
|
342
|
+
}
|
|
343
|
+
return null;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
if (urlLike && !urlFilePath) {
|
|
347
|
+
const provenance = resolveProvenanceTarget();
|
|
348
|
+
if (provenance) return finalize(provenance);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const issueLocal = issueLocalPathMatches(raw, index, declaringNode);
|
|
352
|
+
const resolvedIssueLocal = resolveCandidateNodes(issueLocal, 'issue-local-path', declaringNode);
|
|
353
|
+
if (resolvedIssueLocal) return finalize(resolvedIssueLocal);
|
|
354
|
+
const commentIdMatch = resolveGithubIssueCommentTarget('github-issue-comment-id');
|
|
355
|
+
if (commentIdMatch) return commentIdMatch;
|
|
356
|
+
|
|
357
|
+
const direct = resolveDirectToken();
|
|
358
|
+
if (direct) return finalize(direct);
|
|
359
|
+
|
|
360
|
+
const pathConstraint = urlSourceKey ? sourceConstraintFromTarget(urlSourceKey) : declaringConstraint;
|
|
361
|
+
const exact = exactPathMatches(path, index, pathConstraint, Boolean(pathConstraint.hasConstraint));
|
|
362
|
+
const resolvedExact = resolveCandidateNodes(exact, 'path', declaringNode);
|
|
363
|
+
if (resolvedExact) return finalize(resolvedExact);
|
|
364
|
+
|
|
365
|
+
const suffixConstraint = urlSourceKey ? sourceConstraintFromTarget(urlSourceKey) : declaringConstraint;
|
|
366
|
+
const suffixCandidates = [
|
|
367
|
+
['path-suffix', findPathSuffixMatches(path, index.byPath, suffixConstraint, Boolean(urlSourceKey))],
|
|
368
|
+
['source-path-suffix', findPathSuffixMatches(path, index.bySourcePath, suffixConstraint, Boolean(urlSourceKey))]
|
|
369
|
+
];
|
|
370
|
+
for (const [method, nodes] of suffixCandidates) {
|
|
371
|
+
const resolved = resolveCandidateNodes(nodes || [], method, declaringNode);
|
|
372
|
+
if (resolved) return finalize(resolved);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (urlLike) return finalize(resolveProvenanceTarget());
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
function resolveIntegrityTarget(expectedIntegrityValues = [], index = {}, declaringNode = null) {
|
|
381
|
+
const nodes = [];
|
|
382
|
+
for (const value of expectedIntegrityValues.map(canonicalIntegrityValue).filter(Boolean)) {
|
|
383
|
+
nodes.push(...(index.bySelfIntegrity?.get(value) || []));
|
|
384
|
+
}
|
|
385
|
+
const resolved = resolveCandidateNodes(nodes, 'integrity-self-hash', declaringNode);
|
|
386
|
+
if (!resolved || resolved.ambiguous || resolved.selfReference || resolved.blocked) return resolved;
|
|
387
|
+
return verifiedIntegrityMatch(resolved);
|
|
388
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { canonicalPath, normalizeRef, normalizeRepoKey } from './lineage.targetKeys.js';
|
|
2
|
+
|
|
3
|
+
export function exactPathMatches(path, index, constraint = {}, strictSource = false) {
|
|
4
|
+
const source = [
|
|
5
|
+
...(index.byPath.get(canonicalPath(path)) || []),
|
|
6
|
+
...(index.bySourcePath.get(canonicalPath(path)) || [])
|
|
7
|
+
];
|
|
8
|
+
return uniqueNodes(filterBySource(source, constraint, strictSource));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function findPathSuffixMatches(targetPath, pathIndex = new Map(), constraint = {}, strictSource = false) {
|
|
12
|
+
const path = canonicalPath(targetPath);
|
|
13
|
+
if (!path || !path.includes('/')) return [];
|
|
14
|
+
let bestLength = -1;
|
|
15
|
+
let matches = [];
|
|
16
|
+
for (const [candidatePath, nodes] of pathIndex.entries()) {
|
|
17
|
+
if (!candidatePath || path === candidatePath) continue;
|
|
18
|
+
if (!(path.endsWith(`/${candidatePath}`) || path.endsWith(candidatePath) || candidatePath.endsWith(`/${path}`) || candidatePath.endsWith(path))) continue;
|
|
19
|
+
const filtered = filterBySource(nodes, constraint, strictSource);
|
|
20
|
+
if (!filtered.length) continue;
|
|
21
|
+
if (candidatePath.length > bestLength) {
|
|
22
|
+
bestLength = candidatePath.length;
|
|
23
|
+
matches = filtered.slice();
|
|
24
|
+
} else if (candidatePath.length === bestLength) matches.push(...filtered);
|
|
25
|
+
}
|
|
26
|
+
return uniqueNodes(matches);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function sourceConstraintFromNode(node = {}) {
|
|
30
|
+
const source = node?.record?.source || {};
|
|
31
|
+
const adapterId = String(source.adapterId || '').trim().toLowerCase();
|
|
32
|
+
const sourceId = String(source.id || '').trim();
|
|
33
|
+
if (adapterId === 'local' || sourceId === 'local' || source.kind === 'local-session') return { hasConstraint: false, sourceId: '', repo: '', ref: '', adapterId: '' };
|
|
34
|
+
const repo = normalizeRepoKey(source.repo || source.repository || source.config?.repo || '');
|
|
35
|
+
const ref = normalizeRef(source.ref || source.config?.ref || '');
|
|
36
|
+
return { hasConstraint: Boolean(sourceId || repo || adapterId), sourceId, repo, ref, adapterId };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function sourceConstraintFromTarget(repo = '') {
|
|
40
|
+
const key = normalizeRepoKey(repo);
|
|
41
|
+
return { hasConstraint: Boolean(key), repo: key, sourceId: '', ref: '', adapterId: 'github' };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function filterBySource(nodes = [], constraint = {}, strictSource = false) {
|
|
45
|
+
const items = Array.isArray(nodes) ? nodes : [];
|
|
46
|
+
if (!constraint?.hasConstraint) return items;
|
|
47
|
+
const filtered = items.filter((node) => nodeMatchesSourceConstraint(node, constraint));
|
|
48
|
+
if (filtered.length) return filtered;
|
|
49
|
+
if (strictSource && items.length && items.every((node) => !sourceConstraintFromNode(node).hasConstraint)) return items;
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function nodeMatchesSourceConstraint(node = {}, constraint = {}) {
|
|
54
|
+
const candidate = sourceConstraintFromNode(node);
|
|
55
|
+
if (constraint.sourceId && candidate.sourceId && constraint.sourceId !== candidate.sourceId) return false;
|
|
56
|
+
if (constraint.adapterId && candidate.adapterId && constraint.adapterId !== candidate.adapterId) return false;
|
|
57
|
+
if (constraint.repo && candidate.repo !== constraint.repo) return false;
|
|
58
|
+
if (constraint.ref && candidate.ref && constraint.ref !== candidate.ref) return false;
|
|
59
|
+
if (constraint.repo && !candidate.repo) return false;
|
|
60
|
+
if (constraint.adapterId && !candidate.adapterId) return false;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function uniqueNodes(nodes = []) {
|
|
65
|
+
const seen = new Set();
|
|
66
|
+
const out = [];
|
|
67
|
+
for (const node of Array.isArray(nodes) ? nodes : []) {
|
|
68
|
+
const key = node?.id || node?.path || JSON.stringify(node || {});
|
|
69
|
+
if (!key || seen.has(key)) continue;
|
|
70
|
+
seen.add(key);
|
|
71
|
+
out.push(node);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|