@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,106 @@
|
|
|
1
|
+
import { canonicalPath } from './lineage.targetKeys.js';
|
|
2
|
+
|
|
3
|
+
export function githubIssueCommentIdFromValue(value = '') {
|
|
4
|
+
const raw = String(value || '').trim();
|
|
5
|
+
if (!raw) return '';
|
|
6
|
+
const direct = raw.match(/(?:issuecomment-|issues\/comments\/|comment-(?:\d+-)?)(\d{4,})/i)?.[1] || '';
|
|
7
|
+
if (direct) return direct;
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(raw);
|
|
10
|
+
return url.hash.match(/issuecomment-(\d+)/i)?.[1] || '';
|
|
11
|
+
} catch (_) {}
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function githubIssueCommentIdsForNode(node = {}) {
|
|
16
|
+
const record = node.record || {};
|
|
17
|
+
const snapshot = record.snapshot || {};
|
|
18
|
+
const sourceTarget = record.sourceTarget || {};
|
|
19
|
+
const target = snapshot.target || {};
|
|
20
|
+
const values = [
|
|
21
|
+
node.id,
|
|
22
|
+
node.path,
|
|
23
|
+
record.id,
|
|
24
|
+
record.path,
|
|
25
|
+
record.source?.path,
|
|
26
|
+
record.sourcePath,
|
|
27
|
+
record.recoveredFromUrl,
|
|
28
|
+
record.sourceOrigin,
|
|
29
|
+
record.rawUrl,
|
|
30
|
+
record.browseUrl,
|
|
31
|
+
sourceTarget.inputTarget,
|
|
32
|
+
sourceTarget.rawUrl,
|
|
33
|
+
sourceTarget.browseUrl,
|
|
34
|
+
sourceTarget.sourceArtifactPath,
|
|
35
|
+
snapshot.sourceUrl,
|
|
36
|
+
snapshot.sourceArtifactPath,
|
|
37
|
+
target.canonicalUrl,
|
|
38
|
+
target.html_url,
|
|
39
|
+
target.url
|
|
40
|
+
];
|
|
41
|
+
return Array.from(new Set(values.map(githubIssueCommentIdFromValue).filter(Boolean)));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function filterGitHubIssueCommentCandidatesForTarget(candidates = [], raw = '', declaringNode = null) {
|
|
45
|
+
const targetIssue = githubIssueContextForValue(raw) || githubIssueContextForNode(declaringNode);
|
|
46
|
+
const unique = uniqueNodes(candidates || []);
|
|
47
|
+
if (!targetIssue) return unique;
|
|
48
|
+
return unique.filter((candidate) => sameGithubIssueContext(githubIssueContextForNode(candidate), targetIssue));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function githubIssueContextForNode(node = {}) {
|
|
52
|
+
const record = node.record || {};
|
|
53
|
+
const snapshot = record.snapshot || {};
|
|
54
|
+
const sourceTarget = record.sourceTarget || {};
|
|
55
|
+
const target = snapshot.target || {};
|
|
56
|
+
const values = [node.path, record.path, record.recoveredFromUrl, sourceTarget.inputTarget, sourceTarget.rawUrl, sourceTarget.browseUrl, snapshot.sourceUrl, target.canonicalUrl, target.html_url, target.url];
|
|
57
|
+
for (const value of values) {
|
|
58
|
+
const context = githubIssueContextForValue(value);
|
|
59
|
+
if (context) return context;
|
|
60
|
+
}
|
|
61
|
+
if (target.repository && target.number) return { repo: normalizeRepoKey(target.repository), number: String(target.number) };
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function githubIssueContextForValue(value = '') {
|
|
66
|
+
const raw = String(value || '').trim();
|
|
67
|
+
if (!raw) return null;
|
|
68
|
+
try {
|
|
69
|
+
const url = new URL(raw);
|
|
70
|
+
const host = url.hostname.toLowerCase();
|
|
71
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
72
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 4 && parts[2] === 'issues') {
|
|
73
|
+
const repo = normalizeRepoKey(`${parts[0]}/${parts[1]}`);
|
|
74
|
+
const number = String(parts[3] || '').trim();
|
|
75
|
+
if (repo && number) return { repo, number };
|
|
76
|
+
}
|
|
77
|
+
if (host === 'api.github.com' && parts.length >= 5 && parts[0] === 'repos' && parts[3] === 'issues') {
|
|
78
|
+
const repo = normalizeRepoKey(`${parts[1]}/${parts[2]}`);
|
|
79
|
+
const number = String(parts[4] || '').trim();
|
|
80
|
+
if (repo && number) return { repo, number };
|
|
81
|
+
}
|
|
82
|
+
} catch (_) {}
|
|
83
|
+
const pathParts = canonicalPath(raw).split('/').filter(Boolean);
|
|
84
|
+
const dotIssuesIndex = pathParts.findIndex((part) => part.toLowerCase() === '.issues');
|
|
85
|
+
if (dotIssuesIndex >= 0 && pathParts[dotIssuesIndex + 1]?.toLowerCase() === 'github') {
|
|
86
|
+
const repo = normalizeSyntheticRepoToken(pathParts[dotIssuesIndex + 2] || '');
|
|
87
|
+
const number = String(pathParts[dotIssuesIndex + 3] || '').trim();
|
|
88
|
+
if (repo && /^\d+$/.test(number)) return { repo, number };
|
|
89
|
+
}
|
|
90
|
+
const legacyDotGithubIndex = pathParts.findIndex((part, index) => part.toLowerCase() === '.issues' && pathParts[index - 1]?.toLowerCase() === '.github');
|
|
91
|
+
if (legacyDotGithubIndex >= 0) {
|
|
92
|
+
const legacy = legacyIssueFolderContext(pathParts[legacyDotGithubIndex + 1] || '');
|
|
93
|
+
if (legacy) return legacy;
|
|
94
|
+
}
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function sameGithubIssueContext(a = null, b = null) {
|
|
99
|
+
if (!a || !b) return false;
|
|
100
|
+
return normalizeRepoKey(a.repo || '') === normalizeRepoKey(b.repo || '') && String(a.number || '') === String(b.number || '');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function normalizeRepoKey(value = '') { const parts = String(value || '').trim().toLowerCase().split('/').filter(Boolean); return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : ''; }
|
|
104
|
+
function normalizeSyntheticRepoToken(value = '') { const parts = String(value || '').trim().toLowerCase().split('-').filter(Boolean); if (parts.length < 2) return ''; const owner = parts.shift(); const repo = parts.join('-'); return owner && repo ? `${owner}/${repo}` : ''; }
|
|
105
|
+
function legacyIssueFolderContext(value = '') { const parts = String(value || '').trim().toLowerCase().split('-').filter(Boolean); const numberIndex = parts.findIndex((part, index) => index >= 2 && /^\d+$/.test(part)); if (numberIndex < 2) return null; const owner = parts[0] || ''; const repoParts = parts.slice(1, numberIndex).filter((part) => part !== 'issue' && part !== 'issues'); const repo = normalizeRepoKey(`${owner}/${repoParts.join('-')}`); const number = parts[numberIndex] || ''; return repo && number ? { repo, number } : null; }
|
|
106
|
+
function uniqueNodes(nodes = []) { const seen = new Set(); const out = []; for (const node of Array.isArray(nodes) ? nodes : []) { const key = node?.id || node?.path || JSON.stringify(node || {}); if (!key || seen.has(key)) continue; seen.add(key); out.push(node); } return out; }
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export function issueLocalPathKeysForNode(node = {}) {
|
|
2
|
+
const issue = githubIssueContextForNode(node);
|
|
3
|
+
if (!issue) return [];
|
|
4
|
+
const record = node.record || {};
|
|
5
|
+
const paths = [node.path, record.path, ...(sourcePathsForNode(node))].map(canonicalPath).filter(Boolean);
|
|
6
|
+
const keys = [];
|
|
7
|
+
const add = (item = '') => { const clean = String(item || '').trim().toLowerCase(); if (clean && !keys.includes(clean)) keys.push(clean); };
|
|
8
|
+
for (const path of paths) {
|
|
9
|
+
add(issueLocalKey(issue, path));
|
|
10
|
+
const base = basename(path);
|
|
11
|
+
if (base && base !== path) add(issueLocalKey(issue, base));
|
|
12
|
+
}
|
|
13
|
+
for (const alias of issueLocalAliasesForNode(node)) add(issueLocalKey(issue, alias));
|
|
14
|
+
return keys;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function issueLocalPathMatches(target = '', index = {}, declaringNode = null) {
|
|
18
|
+
const issue = githubIssueContextForNode(declaringNode);
|
|
19
|
+
if (!issue) return [];
|
|
20
|
+
const targetPath = canonicalPath(target);
|
|
21
|
+
if (!targetPath) return [];
|
|
22
|
+
const keys = [issueLocalKey(issue, targetPath), issueLocalKey(issue, basename(targetPath))].filter(Boolean);
|
|
23
|
+
const commentId = githubIssueCommentIdFromValue(target);
|
|
24
|
+
if (commentId) keys.push(issueLocalKey(issue, `comment-id-${commentId}`));
|
|
25
|
+
const out = [];
|
|
26
|
+
for (const key of keys) out.push(...(index.byIssueLocalPath?.get(key) || []));
|
|
27
|
+
return uniqueNodes(out);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function sourcePathsForNode(node = {}) {
|
|
31
|
+
const record = node.record || {};
|
|
32
|
+
const values = [record.source?.path, record.sourcePath, record.sourceTarget?.sourceArtifactPath, record.snapshot?.sourceArtifactPath].map(canonicalPath).filter(Boolean);
|
|
33
|
+
return Array.from(new Set(values));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function issueLocalAliasesForNode(node = {}) {
|
|
37
|
+
const record = node.record || {};
|
|
38
|
+
const title = String(node.title || record.title || '').trim();
|
|
39
|
+
const sourceTarget = record.sourceTarget || {};
|
|
40
|
+
const targetKind = String(sourceTarget.targetKind || record.snapshot?.sourceKind || '').toLowerCase();
|
|
41
|
+
const recovered = String(record.recoveredFromUrl || sourceTarget.inputTarget || record.snapshot?.sourceUrl || '').trim();
|
|
42
|
+
const aliases = [];
|
|
43
|
+
const add = (item = '') => { const clean = canonicalPath(item); if (clean && !aliases.includes(clean)) aliases.push(clean); };
|
|
44
|
+
const isIssueRoot = githubIssueContextFromValue(recovered) && !/issuecomment-/i.test(recovered) && !targetKind.includes('comment');
|
|
45
|
+
if (isIssueRoot && title) {
|
|
46
|
+
const slug = slugPart(title).slice(0, 52) || 'artifact';
|
|
47
|
+
add(`issue-root-recovered-${slug}.trace.md`);
|
|
48
|
+
add(`issue-root-recovered-${slug}.workspace.md`);
|
|
49
|
+
}
|
|
50
|
+
const commentId = githubIssueCommentIdForNode(node);
|
|
51
|
+
if (commentId) {
|
|
52
|
+
add(`comment-id-${commentId}`);
|
|
53
|
+
if (title) {
|
|
54
|
+
const slug = slugPart(title).slice(0, 52) || 'artifact';
|
|
55
|
+
add(`comment-${commentId}-recovered-${slug}.trace.md`);
|
|
56
|
+
add(`comment-${commentId}-recovered-${slug}.workspace.md`);
|
|
57
|
+
add(`issuecomment-${commentId}-recovered-${slug}.trace.md`);
|
|
58
|
+
add(`issuecomment-${commentId}-recovered-${slug}.workspace.md`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return aliases;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
function githubIssueCommentIdForNode(node = {}) {
|
|
66
|
+
const record = node.record || {};
|
|
67
|
+
const sourceTarget = record.sourceTarget || {};
|
|
68
|
+
const snapshot = record.snapshot || {};
|
|
69
|
+
const target = snapshot.target || {};
|
|
70
|
+
const candidates = [
|
|
71
|
+
record.recoveredFromUrl,
|
|
72
|
+
sourceTarget.inputTarget,
|
|
73
|
+
sourceTarget.rawUrl,
|
|
74
|
+
sourceTarget.browseUrl,
|
|
75
|
+
snapshot.sourceUrl,
|
|
76
|
+
target.canonicalUrl,
|
|
77
|
+
target.html_url,
|
|
78
|
+
target.url,
|
|
79
|
+
node.path,
|
|
80
|
+
record.path,
|
|
81
|
+
record.source?.path,
|
|
82
|
+
record.sourcePath,
|
|
83
|
+
sourceTarget.sourceArtifactPath,
|
|
84
|
+
snapshot.sourceArtifactPath
|
|
85
|
+
];
|
|
86
|
+
for (const candidate of candidates) {
|
|
87
|
+
const id = githubIssueCommentIdFromValue(candidate);
|
|
88
|
+
if (id) return id;
|
|
89
|
+
}
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function githubIssueContextForNode(node = {}) {
|
|
94
|
+
const record = node?.record || {};
|
|
95
|
+
const snapshot = record.snapshot || {};
|
|
96
|
+
const target = snapshot.target || {};
|
|
97
|
+
const sourceTarget = record.sourceTarget || {};
|
|
98
|
+
const candidates = [node.path, record.path, record.recoveredFromUrl, sourceTarget.inputTarget, sourceTarget.rawUrl, sourceTarget.browseUrl, snapshot.sourceUrl, target.canonicalUrl, target.html_url, target.url];
|
|
99
|
+
for (const candidate of candidates) {
|
|
100
|
+
const parsed = githubIssueContextFromValue(candidate);
|
|
101
|
+
if (parsed) return parsed;
|
|
102
|
+
}
|
|
103
|
+
if (target.repository && target.number) return { repo: target.repository, number: target.number };
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function githubIssueCommentIdFromValue(value = '') {
|
|
108
|
+
const raw = String(value || '').trim();
|
|
109
|
+
if (!raw) return '';
|
|
110
|
+
const direct = raw.match(/(?:issuecomment-|issues\/comments\/|comment-(?:\d+-)?)(\d{4,})/i)?.[1] || '';
|
|
111
|
+
if (direct) return direct;
|
|
112
|
+
try {
|
|
113
|
+
const url = new URL(raw);
|
|
114
|
+
return url.hash.match(/issuecomment-(\d+)/i)?.[1] || '';
|
|
115
|
+
} catch (_) {}
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function githubIssueContextFromValue(value = '') {
|
|
120
|
+
const raw = String(value || '').trim();
|
|
121
|
+
if (!raw) return null;
|
|
122
|
+
try {
|
|
123
|
+
const url = new URL(raw);
|
|
124
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
125
|
+
const host = url.hostname.toLowerCase();
|
|
126
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 4 && parts[2] === 'issues') {
|
|
127
|
+
const repo = normalizeRepoKey(`${parts[0]}/${parts[1]}`);
|
|
128
|
+
const number = String(parts[3] || '').trim();
|
|
129
|
+
if (repo && number) return { repo, number };
|
|
130
|
+
}
|
|
131
|
+
if (host === 'api.github.com' && parts.length >= 5 && parts[0] === 'repos' && parts[3] === 'issues') {
|
|
132
|
+
const repo = normalizeRepoKey(`${parts[1]}/${parts[2]}`);
|
|
133
|
+
const number = String(parts[4] || '').trim();
|
|
134
|
+
if (repo && number) return { repo, number };
|
|
135
|
+
}
|
|
136
|
+
} catch (error) {}
|
|
137
|
+
const pathParts = canonicalPath(raw).split('/').filter(Boolean);
|
|
138
|
+
const dotIssuesIndex = pathParts.findIndex((part) => part.toLowerCase() === '.issues');
|
|
139
|
+
if (dotIssuesIndex >= 0 && pathParts[dotIssuesIndex + 1]?.toLowerCase() === 'github') {
|
|
140
|
+
const repoToken = String(pathParts[dotIssuesIndex + 2] || '').trim();
|
|
141
|
+
const number = String(pathParts[dotIssuesIndex + 3] || '').trim();
|
|
142
|
+
const repo = normalizeSyntheticRepoToken(repoToken);
|
|
143
|
+
if (repo && /^\d+$/.test(number)) return { repo, number };
|
|
144
|
+
}
|
|
145
|
+
const legacyDotGithubIndex = pathParts.findIndex((part, index) => part.toLowerCase() === '.issues' && pathParts[index - 1]?.toLowerCase() === '.github');
|
|
146
|
+
if (legacyDotGithubIndex >= 0) {
|
|
147
|
+
const legacy = legacyIssueFolderContext(pathParts[legacyDotGithubIndex + 1] || '');
|
|
148
|
+
if (legacy) return legacy;
|
|
149
|
+
}
|
|
150
|
+
const issueIndex = pathParts.findIndex((part) => part.toLowerCase() === 'issues');
|
|
151
|
+
if (issueIndex >= 2 && pathParts.length > issueIndex + 1) {
|
|
152
|
+
const repo = normalizeRepoKey(`${pathParts[issueIndex - 2]}/${pathParts[issueIndex - 1]}`);
|
|
153
|
+
const number = String(pathParts[issueIndex + 1] || '').trim();
|
|
154
|
+
if (repo && /^\d+$/.test(number)) return { repo, number };
|
|
155
|
+
}
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function issueLocalKey(issue = {}, path = '') {
|
|
160
|
+
const repo = normalizeRepoKey(issue.repo || '');
|
|
161
|
+
const number = String(issue.number || '').trim();
|
|
162
|
+
const clean = canonicalPath(path).toLowerCase();
|
|
163
|
+
return repo && number && clean ? `github-issue-local:${repo}#${number}:${clean}` : '';
|
|
164
|
+
}
|
|
165
|
+
function basename(path = '') { return canonicalPath(path).split('/').filter(Boolean).pop() || ''; }
|
|
166
|
+
function uniqueNodes(nodes = []) { const seen = new Set(); const out = []; for (const node of Array.isArray(nodes) ? nodes : []) { const key = node?.id || node?.path || JSON.stringify(node || {}); if (!key || seen.has(key)) continue; seen.add(key); out.push(node); } return out; }
|
|
167
|
+
function normalizeRepoKey(value = '') { const parts = String(value || '').trim().toLowerCase().split('/').filter(Boolean); return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : ''; }
|
|
168
|
+
function normalizeSyntheticRepoToken(value = '') {
|
|
169
|
+
const token = String(value || '').trim().toLowerCase();
|
|
170
|
+
const parts = token.split('-').filter(Boolean);
|
|
171
|
+
if (parts.length < 2) return '';
|
|
172
|
+
const owner = parts.shift();
|
|
173
|
+
const repo = parts.join('-');
|
|
174
|
+
return owner && repo ? `${owner}/${repo}` : '';
|
|
175
|
+
}
|
|
176
|
+
function legacyIssueFolderContext(value = '') {
|
|
177
|
+
const token = String(value || '').trim().toLowerCase();
|
|
178
|
+
const parts = token.split('-').filter(Boolean);
|
|
179
|
+
const numberIndex = parts.findIndex((part, index) => index >= 2 && /^\d+$/.test(part));
|
|
180
|
+
if (numberIndex < 2) return null;
|
|
181
|
+
const owner = parts[0] || '';
|
|
182
|
+
const repoParts = parts.slice(1, numberIndex).filter((part) => part !== 'issue' && part !== 'issues');
|
|
183
|
+
const repo = normalizeRepoKey(`${owner}/${repoParts.join('-')}`);
|
|
184
|
+
const number = parts[numberIndex] || '';
|
|
185
|
+
return repo && number ? { repo, number } : null;
|
|
186
|
+
}
|
|
187
|
+
function canonicalPath(value = '') {
|
|
188
|
+
let raw = String(value || '').trim();
|
|
189
|
+
if (!raw) return '';
|
|
190
|
+
raw = raw.replace(/^record:/i, '');
|
|
191
|
+
try { const url = new URL(raw); raw = url.pathname.replace(/^\/+/, ''); } catch (e) {}
|
|
192
|
+
const out = [];
|
|
193
|
+
for (const part of raw.replace(/\\/g, '/').split('/')) { if (!part || part === '.') continue; if (part === '..') out.pop(); else out.push(part); }
|
|
194
|
+
return out.join('/');
|
|
195
|
+
}
|
|
196
|
+
function slugPart(value = '') { return String(value || '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'item'; }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export function filterExactGitHubIssueCandidatesForTarget(candidates = [], rawTarget = '', declaringNode = null) {
|
|
2
|
+
const expected = canonicalExactGitHubIssueTarget(rawTarget);
|
|
3
|
+
if (!expected || expected.commentId) return [];
|
|
4
|
+
return uniqueNodes(candidates).filter((candidate) => {
|
|
5
|
+
if (sameLineageNode(candidate, declaringNode)) return false;
|
|
6
|
+
return exactGitHubIssueProvenanceValuesForNode(candidate).some((value) => {
|
|
7
|
+
const actual = canonicalExactGitHubIssueTarget(value);
|
|
8
|
+
return Boolean(actual && !actual.commentId && actual.repo === expected.repo && actual.number === expected.number);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function exactGitHubIssueProvenanceValuesForNode(node = {}) {
|
|
14
|
+
const record = node.record || node || {};
|
|
15
|
+
const sourceTarget = record.sourceTarget || {};
|
|
16
|
+
const snapshot = record.snapshot || {};
|
|
17
|
+
const target = snapshot.target || {};
|
|
18
|
+
return [
|
|
19
|
+
record.recoveredFromUrl,
|
|
20
|
+
record.sourceOrigin,
|
|
21
|
+
record.rawUrl,
|
|
22
|
+
record.browseUrl,
|
|
23
|
+
sourceTarget.inputTarget,
|
|
24
|
+
sourceTarget.rawUrl,
|
|
25
|
+
sourceTarget.browseUrl,
|
|
26
|
+
snapshot.sourceUrl,
|
|
27
|
+
target.canonicalUrl,
|
|
28
|
+
target.html_url,
|
|
29
|
+
target.url
|
|
30
|
+
].map((value) => String(value || '').trim()).filter(Boolean);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function canonicalExactGitHubIssueTarget(value = '') {
|
|
34
|
+
try {
|
|
35
|
+
const url = new URL(String(value || '').trim());
|
|
36
|
+
const host = url.hostname.toLowerCase();
|
|
37
|
+
const parts = url.pathname.split('/').filter(Boolean);
|
|
38
|
+
if ((host === 'github.com' || host.endsWith('.github.com')) && parts.length >= 4 && parts[2] === 'issues') {
|
|
39
|
+
const repo = `${String(parts[0] || '').toLowerCase()}/${String(parts[1] || '').toLowerCase()}`;
|
|
40
|
+
const number = String(parts[3] || '').trim();
|
|
41
|
+
return repo && number ? { repo, number, commentId: githubIssueCommentIdFromValue(value) } : null;
|
|
42
|
+
}
|
|
43
|
+
if (host === 'api.github.com' && parts.length >= 5 && parts[0] === 'repos' && parts[3] === 'issues') {
|
|
44
|
+
const repo = `${String(parts[1] || '').toLowerCase()}/${String(parts[2] || '').toLowerCase()}`;
|
|
45
|
+
const number = String(parts[4] || '').trim();
|
|
46
|
+
return repo && number ? { repo, number, commentId: '' } : null;
|
|
47
|
+
}
|
|
48
|
+
} catch (_) {}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function githubIssueCommentIdFromValue(value = '') {
|
|
53
|
+
const raw = String(value || '').trim();
|
|
54
|
+
if (!raw) return '';
|
|
55
|
+
const direct = raw.match(/(?:issuecomment-|issues\/comments\/|comment-(?:\d+-)?)(\d{4,})/i)?.[1] || '';
|
|
56
|
+
if (direct) return direct;
|
|
57
|
+
try { return new URL(raw).hash.match(/issuecomment-(\d+)/i)?.[1] || ''; } catch (_) { return ''; }
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function sameLineageNode(candidate = {}, declaringNode = null) {
|
|
61
|
+
if (!candidate || !declaringNode) return false;
|
|
62
|
+
const candidateId = String(candidate.id || '').trim();
|
|
63
|
+
const declaringId = String(declaringNode.id || '').trim();
|
|
64
|
+
if (candidateId && declaringId) return candidateId === declaringId;
|
|
65
|
+
const candidatePath = canonicalPath(candidate.path || candidate.record?.path || '');
|
|
66
|
+
const declaringPath = canonicalPath(declaringNode.path || declaringNode.record?.path || '');
|
|
67
|
+
return Boolean(candidatePath && declaringPath && candidatePath === declaringPath);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function canonicalPath(value = '') {
|
|
71
|
+
const out = [];
|
|
72
|
+
for (const part of String(value || '').replace(/^record:/i, '').replace(/\\/g, '/').split('/')) {
|
|
73
|
+
if (!part || part === '.') continue;
|
|
74
|
+
if (part === '..') out.pop(); else out.push(part);
|
|
75
|
+
}
|
|
76
|
+
return out.join('/');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function uniqueNodes(nodes = []) {
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const node of Array.isArray(nodes) ? nodes : []) {
|
|
83
|
+
const key = node?.id || node?.path || JSON.stringify(node || {});
|
|
84
|
+
if (!key || seen.has(key)) continue;
|
|
85
|
+
seen.add(key);
|
|
86
|
+
out.push(node);
|
|
87
|
+
}
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { LineageResolutionStatus } from './lineage.model.js';
|
|
2
|
+
import { canonicalPath, canonicalToken, provenanceTargetKeysForValue } from './lineage.targetKeys.js';
|
|
3
|
+
|
|
4
|
+
export function verifiedIntegrityMatch(match = null) {
|
|
5
|
+
if (!match || match.ambiguous || match.selfReference || match.blocked) return match;
|
|
6
|
+
return Object.assign({}, match, {
|
|
7
|
+
status: LineageResolutionStatus.verified,
|
|
8
|
+
diagnostics: [lineageDiagnostic('integrity.verified', 'Loaded parent self-integrity matches the child declaration.', { basis: 'checksum' })]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function withParentIntegrityStatus(match = null, expectedIntegrityValues = []) {
|
|
13
|
+
if (!match || !Array.isArray(expectedIntegrityValues) || !expectedIntegrityValues.length) return match;
|
|
14
|
+
if (match.ambiguous || match.selfReference || match.blocked) return match;
|
|
15
|
+
if (match.status === LineageResolutionStatus.verified || match.status === LineageResolutionStatus.mismatch || match.status === LineageResolutionStatus.probable) return match;
|
|
16
|
+
const expected = expectedIntegrityValues.map(canonicalIntegrityValue).filter(Boolean);
|
|
17
|
+
const actual = selfIntegrityValuesForNode(match);
|
|
18
|
+
if (!actual.length) {
|
|
19
|
+
return Object.assign({}, match, {
|
|
20
|
+
status: LineageResolutionStatus.probable,
|
|
21
|
+
diagnostics: [lineageDiagnostic('integrity.unavailable', 'Declared parent found, but loaded parent has no self-integrity value to verify against.', { basis: match.method || '' })]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const matched = expected.some((value) => actual.includes(value));
|
|
25
|
+
if (matched) {
|
|
26
|
+
return Object.assign({}, match, {
|
|
27
|
+
status: LineageResolutionStatus.verified,
|
|
28
|
+
diagnostics: [lineageDiagnostic('integrity.verified', 'Declared parent found and self-integrity matches the child declaration.', { basis: match.method || '' })]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return Object.assign({}, match, {
|
|
32
|
+
status: LineageResolutionStatus.mismatch,
|
|
33
|
+
diagnostics: [lineageDiagnostic('integrity.mismatch', 'Declared parent found, but loaded parent self-integrity does not match the child declaration.', { basis: match.method || '', expected: expected.join(', '), actual: actual.join(', ') })]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function parentIntegrityValuesForTarget(node = {}, target = '') {
|
|
38
|
+
const targetKeys = lineageTargetComparisonKeys(target);
|
|
39
|
+
if (!targetKeys.length) return [];
|
|
40
|
+
const entries = integrityEntriesForNode(node);
|
|
41
|
+
const values = [];
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
const towards = String(entry.towards || '').trim();
|
|
44
|
+
if (!towards || /^self$/i.test(towards)) continue;
|
|
45
|
+
const entryKeys = lineageTargetComparisonKeys(towards);
|
|
46
|
+
if (!entryKeys.some((key) => targetKeys.includes(key))) continue;
|
|
47
|
+
const value = canonicalIntegrityValue(entry.value);
|
|
48
|
+
if (value) values.push(value);
|
|
49
|
+
}
|
|
50
|
+
return Array.from(new Set(values));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function selfIntegrityValuesForNode(node = {}) {
|
|
54
|
+
const entries = integrityEntriesForNode(node);
|
|
55
|
+
return Array.from(new Set(entries
|
|
56
|
+
.filter((entry) => /^self$/i.test(String(entry.towards || '').trim()))
|
|
57
|
+
.map((entry) => canonicalIntegrityValue(entry.value))
|
|
58
|
+
.filter(Boolean)));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function integrityEntriesForNode(node = {}) {
|
|
62
|
+
const record = node?.record || node || {};
|
|
63
|
+
const entries = Array.isArray(record.integrity?.entries) ? record.integrity.entries : [];
|
|
64
|
+
if (entries.length) return entries;
|
|
65
|
+
return parseIntegrityEntriesFromMarkdown(record.markdown || '');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function parseIntegrityEntriesFromMarkdown(markdown = '') {
|
|
69
|
+
const text = String(markdown || '');
|
|
70
|
+
const start = text.search(/^#\s+Continuity Integrity\s*$/im);
|
|
71
|
+
if (start === -1) return [];
|
|
72
|
+
const lines = text.slice(start).split('\n');
|
|
73
|
+
const entries = [];
|
|
74
|
+
let current = null;
|
|
75
|
+
const flush = () => {
|
|
76
|
+
if (!current) return;
|
|
77
|
+
const method = current.fields.Method || current.label || '';
|
|
78
|
+
entries.push({
|
|
79
|
+
method: stripMarkdown(method),
|
|
80
|
+
towards: normalizeIntegrityField(current.fields.Towards || ''),
|
|
81
|
+
value: stripMarkdown(current.fields.Value || ''),
|
|
82
|
+
raw: current.lines.join('\n')
|
|
83
|
+
});
|
|
84
|
+
current = null;
|
|
85
|
+
};
|
|
86
|
+
for (const line of lines) {
|
|
87
|
+
const top = line.match(/^-\s+(.+?)\s*$/);
|
|
88
|
+
if (top) {
|
|
89
|
+
flush();
|
|
90
|
+
current = { label: top[1].trim(), fields: {}, lines: [line] };
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (!current) continue;
|
|
94
|
+
current.lines.push(line);
|
|
95
|
+
const field = line.match(/^\s+-\s*([A-Za-z][A-Za-z0-9 _+-]{0,40}):\s*(.+?)\s*$/);
|
|
96
|
+
if (field) current.fields[field[1].trim()] = field[2].trim();
|
|
97
|
+
}
|
|
98
|
+
flush();
|
|
99
|
+
return entries.filter((entry) => entry.method || entry.towards || entry.value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function lineageTargetComparisonKeys(value = '') {
|
|
103
|
+
const raw = String(value || '').trim();
|
|
104
|
+
const keys = [];
|
|
105
|
+
const add = (item = '') => {
|
|
106
|
+
const clean = String(item || '').trim().toLowerCase();
|
|
107
|
+
if (clean && !keys.includes(clean)) keys.push(clean);
|
|
108
|
+
};
|
|
109
|
+
add(canonicalToken(raw));
|
|
110
|
+
add(canonicalPath(raw));
|
|
111
|
+
for (const key of provenanceTargetKeysForValue(raw)) add(key);
|
|
112
|
+
return keys.filter(Boolean);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function canonicalIntegrityValue(value = '') {
|
|
116
|
+
return String(value || '').trim();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function normalizeIntegrityField(value = '') {
|
|
120
|
+
const raw = String(value || '').trim();
|
|
121
|
+
const link = raw.match(/^\[([^\]]*)\]\(([^)]+)\)$/);
|
|
122
|
+
if (link) return String(link[2] || link[1] || '').trim();
|
|
123
|
+
return stripMarkdown(raw);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function stripMarkdown(value = '') {
|
|
127
|
+
return String(value || '').replace(/^\[([^\]]+)\]\([^)]+\)$/, '$1').trim();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function lineageDiagnostic(code, message, extra = {}) {
|
|
131
|
+
return Object.freeze(Object.assign({ code, message }, extra || {}));
|
|
132
|
+
}
|
|
133
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function preferredLineageMaterialCandidates(nodes = [], method = '') {
|
|
2
|
+
const unique = uniqueNodes(nodes || []);
|
|
3
|
+
if (unique.length <= 1) return unique;
|
|
4
|
+
const text = String(method || '');
|
|
5
|
+
const publicationIdentity = text.includes('provenance') || text.includes('issue-local') || text.includes('github-comment') || text.includes('github-issue');
|
|
6
|
+
if (!publicationIdentity) return unique;
|
|
7
|
+
const embedded = unique.filter((node) => isEmbeddedRecoveredArtifact(node));
|
|
8
|
+
return embedded.length ? embedded : unique;
|
|
9
|
+
}
|
|
10
|
+
function isEmbeddedRecoveredArtifact(node = {}) {
|
|
11
|
+
const record = node.record || {};
|
|
12
|
+
const mode = String(record.sourceMode || node.sourceMode || '').toLowerCase();
|
|
13
|
+
const kind = String(record.recoveryKind || record.sourceTarget?.targetKind || record.snapshot?.sourceKind || '').toLowerCase();
|
|
14
|
+
return Boolean(record.snapshot?.embedded || mode.includes('embedded-artifact') || kind.includes('embedded') || kind.includes('recovered'));
|
|
15
|
+
}
|
|
16
|
+
function uniqueNodes(nodes = []) {
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
const out = [];
|
|
19
|
+
for (const node of Array.isArray(nodes) ? nodes : []) {
|
|
20
|
+
const key = node?.id || node?.path || JSON.stringify(node || {});
|
|
21
|
+
if (!key || seen.has(key)) continue;
|
|
22
|
+
seen.add(key);
|
|
23
|
+
out.push(node);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { schemaIdForRecord } from '../schemas/schema.identity.js';
|
|
2
|
+
|
|
3
|
+
export const LINEAGE_VIEW_MODEL_SCHEMA_ID = 'tiinex.lineage.view.v1';
|
|
4
|
+
|
|
5
|
+
export const LineageEdgeKind = Object.freeze({
|
|
6
|
+
parent: 'parent',
|
|
7
|
+
origin: 'origin',
|
|
8
|
+
transition: 'transition'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const LineageResolutionStatus = Object.freeze({
|
|
12
|
+
root: 'root',
|
|
13
|
+
resolved: 'resolved',
|
|
14
|
+
verified: 'verified',
|
|
15
|
+
probable: 'probable',
|
|
16
|
+
mismatch: 'mismatch',
|
|
17
|
+
ambiguous: 'ambiguous',
|
|
18
|
+
missing: 'missing',
|
|
19
|
+
degraded: 'degraded'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export function createLineageNode(record = {}, index = 0) {
|
|
23
|
+
return {
|
|
24
|
+
id: record.id || record.path || `lineage-node-${index}`,
|
|
25
|
+
title: record.title || record.path || 'Untitled artifact',
|
|
26
|
+
path: record.path || '',
|
|
27
|
+
schemaId: schemaIdForRecord(record),
|
|
28
|
+
sourceId: record.source?.id || '',
|
|
29
|
+
sourceMode: record.sourceMode || '',
|
|
30
|
+
boundary: record.boundary || record.source?.boundary || '',
|
|
31
|
+
trace: record.trace || '',
|
|
32
|
+
origin: record.origin || '',
|
|
33
|
+
parentSchemaId: record.parentSchemaId || '',
|
|
34
|
+
hasContinuityContext: Boolean(record.hasContinuityContext),
|
|
35
|
+
hasIntegrity: Boolean(record.hasIntegrity),
|
|
36
|
+
record
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function createLineageEdge(from, to, kind = LineageEdgeKind.parent, input = {}) {
|
|
41
|
+
return {
|
|
42
|
+
id: input.id || `${kind}:${from || 'missing'}->${to || 'missing'}`,
|
|
43
|
+
from: from || '',
|
|
44
|
+
to: to || '',
|
|
45
|
+
kind,
|
|
46
|
+
status: input.status || LineageResolutionStatus.resolved,
|
|
47
|
+
target: input.target || '',
|
|
48
|
+
method: input.method || '',
|
|
49
|
+
label: input.label || kind,
|
|
50
|
+
diagnostics: input.diagnostics || []
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function createLineageFinding(code, message, severity = 'warning', input = {}) {
|
|
55
|
+
return {
|
|
56
|
+
code,
|
|
57
|
+
message,
|
|
58
|
+
severity,
|
|
59
|
+
nodeId: input.nodeId || '',
|
|
60
|
+
target: input.target || '',
|
|
61
|
+
source: 'tiinex.lineage.v1'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LineageResolutionStatus } from './lineage.model.js';
|
|
2
|
+
|
|
3
|
+
export function exactUnloadedParent(recoveryTarget = '', method = 'declared-parent-unloaded') {
|
|
4
|
+
return { unresolvedExact: true, recoveryTarget: String(recoveryTarget || '').trim(), method, status: LineageResolutionStatus.missing };
|
|
5
|
+
}
|