@tiinex/app 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 +26 -0
- package/docs/CONSUMER-CONTRACT.md +65 -0
- package/package.json +94 -0
- package/src/acceptance/knownScenarios.case.mjs +48 -0
- package/src/acceptance/knownScenarios.js +89 -0
- package/src/acceptance/postV423CanonicalTransitionProductVerticalSlice.case.mjs +774 -0
- package/src/acceptance/postV437M0ETimePortalProductParityClosure.case.mjs +51 -0
- package/src/acceptance/postV447M0FGithubSocialPublicationProductIntegration.case.mjs +33 -0
- package/src/acceptance/postV450M0ProductAcceptanceHardening.case.mjs +82 -0
- package/src/acceptance/postV470SchemaReadingContractMaterializationIdentitySourceCoalescingAuthorityCorrection.case.mjs +236 -0
- package/src/acceptance/recoveryAcceptance.case.mjs +196 -0
- package/src/adapters/adapter.definition.schema.json +33 -0
- package/src/adapters/archive/archive.adapter.case.mjs +212 -0
- package/src/adapters/export/export.adapter.js +79 -0
- package/src/adapters/git-native/git-native.adapter.js +43 -0
- package/src/adapters/github/github.adapter.case.mjs +843 -0
- package/src/adapters/github/github.adapter.js +395 -0
- package/src/adapters/github/github.issueEmbedded.js +262 -0
- package/src/adapters/github/github.issueMirror.js +309 -0
- package/src/adapters/github/github.issueSnapshot.js +475 -0
- package/src/adapters/github/github.issueSurface.js +188 -0
- package/src/adapters/github/github.issueTransport.js +237 -0
- package/src/adapters/github/github.publicationRead.js +24 -0
- package/src/adapters/github/github.readTransport.js +18 -0
- package/src/adapters/github/github.repoDiscovery.js +222 -0
- package/src/adapters/github/github.repoMirror.js +255 -0
- package/src/adapters/github/github.repoProxy.js +276 -0
- package/src/adapters/github/github.repoSurface.js +60 -0
- package/src/adapters/github/github.transportDiagnostics.js +68 -0
- package/src/adapters/local/local.adapter.case.mjs +72 -0
- package/src/adapters/local/local.adapter.js +188 -0
- package/src/adapters/registry.js +35 -0
- package/src/adapters/static/static.adapter.js +84 -0
- package/src/app/App.js +1 -0
- package/src/app/TiinexApp.jsx +822 -0
- package/src/app/appShell.views.jsx +58 -0
- package/src/app/artifactAuthoringCapability.js +49 -0
- package/src/app/boot/bootApp.js +19 -0
- package/src/app/boot/environment.js +1 -0
- package/src/app/canonicalAuthoringValues.js +4 -0
- package/src/app/canonicalCreationProductController.js +57 -0
- package/src/app/canonicalCreationProductSettlement.case.mjs +10 -0
- package/src/app/canonicalCreationProductSettlement.js +11 -0
- package/src/app/canonicalReferenceLocalCreateCommand.js +210 -0
- package/src/app/canonicalReferenceTargets.js +73 -0
- package/src/app/canonicalTransitionLocalCreateCommand.js +217 -0
- package/src/app/defaultWorkspaceStart.case.mjs +39 -0
- package/src/app/defaultWorkspaceStart.js +65 -0
- package/src/app/defaultWorkspaceStartCommand.js +55 -0
- package/src/app/durableLocalMutationPolicy.js +21 -0
- package/src/app/githubMaterializationSummary.js +69 -0
- package/src/app/githubProgress.js +25 -0
- package/src/app/githubSourceInput.js +47 -0
- package/src/app/githubSourceMaterializationCommand.js +97 -0
- package/src/app/githubSourceOperation.js +226 -0
- package/src/app/governanceDialogData.js +27 -0
- package/src/app/handoffPackageImportCommand.js +182 -0
- package/src/app/historyAuthority.js +53 -0
- package/src/app/initialWorkspaceBootstrapOperation.js +105 -0
- package/src/app/lineageCommand.js +118 -0
- package/src/app/lineageSourceRecovery.js +339 -0
- package/src/app/localDraftMutationCommand.js +174 -0
- package/src/app/localMaterialCommand.js +124 -0
- package/src/app/nodeGraphVerse.case.mjs +111 -0
- package/src/app/persistenceOwnership.js +92 -0
- package/src/app/productStateBoundary.js +7 -0
- package/src/app/providers/AppProviders.js +1 -0
- package/src/app/providers/LocaleProvider.js +1 -0
- package/src/app/providers/SchemaRegistryProvider.js +1 -0
- package/src/app/providers/WorkspaceProvider.js +1 -0
- package/src/app/publicTarget.js +251 -0
- package/src/app/publicTargetRestoreCommand.js +149 -0
- package/src/app/recordUi.cache.js +35 -0
- package/src/app/recordUi.js +11 -0
- package/src/app/routes/RouteSurface.js +1 -0
- package/src/app/routes/routes.js +1 -0
- package/src/app/runtimeState.js +54 -0
- package/src/app/schemaCurrentDeclaration.js +69 -0
- package/src/app/schemaFactoryLocalCreateCommand.js +101 -0
- package/src/app/schemaFactoryViewerProof.case.mjs +134 -0
- package/src/app/schemaFactoryViewerProof.js +20 -0
- package/src/app/schemaNavigationCommand.js +285 -0
- package/src/app/schemaNavigationMaterialization.js +171 -0
- package/src/app/schemaNavigationRuntimeCatalog.js +25 -0
- package/src/app/schemaNavigationState.js +66 -0
- package/src/app/schemaReadingContractQualification.js +91 -0
- package/src/app/schemaSourceRecovery.js +373 -0
- package/src/app/scrollPersistence.js +30 -0
- package/src/app/semanticOperationHistory.js +18 -0
- package/src/app/shareActionCommand.js +55 -0
- package/src/app/shareProjection.js +190 -0
- package/src/app/shell/AppShell.js +1 -0
- package/src/app/shell/Header.js +1 -0
- package/src/app/shell/Navigation.js +1 -0
- package/src/app/shell/SurfaceSwitcher.js +1 -0
- package/src/app/sourceTransportRefresh.js +176 -0
- package/src/app/startupOwnership.js +40 -0
- package/src/app/startupPresentation.case.mjs +34 -0
- package/src/app/startupPresentation.js +33 -0
- package/src/app/startupPresentation.views.jsx +21 -0
- package/src/app/startupRenderPhase.js +9 -0
- package/src/app/startupWorkspaceCommand.js +62 -0
- package/src/app/startupWorkspaceConfigApplication.js +49 -0
- package/src/app/statePersistenceScheduler.js +106 -0
- package/src/app/tiinexAppConfigPlan.js +108 -0
- package/src/app/tiinexAppConfigSource.js +349 -0
- package/src/app/tiinexAppStartupSource.js +79 -0
- package/src/app/tiinexHostedWorkspaceConventions.js +572 -0
- package/src/app/timePortalHistoricalRead.js +114 -0
- package/src/app/timePortalSnapshotResolution.js +53 -0
- package/src/app/urlMaterialCommand.js +24 -0
- package/src/app/useCanonicalPlacementSelectionOptions.js +9 -0
- package/src/app/useCanonicalReferenceSelectionOptions.js +8 -0
- package/src/app/useLocalMaterialIntake.js +68 -0
- package/src/app/useTimePortalProductController.jsx +111 -0
- package/src/app/useWorkspaceEntrypointIntake.js +77 -0
- package/src/app/useWorkspaceSelectionProductController.jsx +21 -0
- package/src/app/viewState.js +35 -0
- package/src/app/viewport.js +21 -0
- package/src/app/visualDormancy.js +286 -0
- package/src/app/workspaceContinuityNotices.js +32 -0
- package/src/app/workspaceDisplayCounts.js +9 -0
- package/src/app/workspaceEntrypointIntakeCommand.js +87 -0
- package/src/app/workspaceEntrypointProductRouting.case.mjs +20 -0
- package/src/app/workspaceExportCommand.js +21 -0
- package/src/app/workspaceExportDownload.js +23 -0
- package/src/app/workspaceExportExecutionCommand.js +10 -0
- package/src/app/workspaceGithubPublication.js +237 -0
- package/src/app/workspaceHandoffExport.js +56 -0
- package/src/app/workspaceHomeTarget.js +9 -0
- package/src/app/workspaceMulticolumn.js +113 -0
- package/src/app/workspaceNavigationParity.case.mjs +110 -0
- package/src/app/workspaceOpenProgress.js +26 -0
- package/src/app/workspacePlacementOptions.js +46 -0
- package/src/app/workspaceRecordActions.js +158 -0
- package/src/app/workspaceScopedInteraction.js +68 -0
- package/src/app/workspaceSelectionOriginContext.js +29 -0
- package/src/app/workspaceSelectionSession.js +54 -0
- package/src/app/workspaceSourceCloseCommand.js +25 -0
- package/src/app/workspaceSpineProductRouting.case.mjs +22 -0
- package/src/app/workspaceStartupTransition.js +32 -0
- package/src/app/workspaceWindow.js +85 -0
- package/src/artifacts/artifact.fixture.js +1 -0
- package/src/artifacts/artifact.identity.js +6 -0
- package/src/artifacts/artifact.identityAggregation.js +218 -0
- package/src/artifacts/artifact.model.js +2 -0
- package/src/artifacts/artifact.parse.case.mjs +196 -0
- package/src/artifacts/artifact.participantIndex.js +189 -0
- package/src/artifacts/fixtures/evidence.trace.md +50 -0
- package/src/artifacts/fixtures/topic.trace.md +33 -0
- package/src/artifacts/fixtures/unknown-schema.trace.md +25 -0
- package/src/audit/audit.findings.js +1 -0
- package/src/audit/audit.model.js +2 -0
- package/src/audit/audit.plan.js +13 -0
- package/src/audit/audit.report.js +12 -0
- package/src/audit/audit.severity.js +1 -0
- package/src/audit/audit.traverse.js +119 -0
- package/src/audit/integrity/auditIntegrity.checks.js +1 -0
- package/src/audit/integrity/auditIntegrity.compare.js +1 -0
- package/src/audit/lineage/auditLineage.load.js +1 -0
- package/src/audit/lineage/auditLineage.plan.js +1 -0
- package/src/audit/lineage/auditLineage.resolve.js +12 -0
- package/src/audit/sources/auditSources.boundaries.js +1 -0
- package/src/audit/sources/auditSources.checks.js +1 -0
- package/src/audit/validation/auditValidation.recheck.js +1 -0
- package/src/audit/validation/auditValidation.run.js +1 -0
- package/src/build.identity.js +15 -0
- package/src/commands/command.vocabulary.js +14 -0
- package/src/conformance/conformance.fixtures.js +151 -0
- package/src/conformance/conformance.run.js +238 -0
- package/src/data/applicationDataStore.js +23 -0
- package/src/data/companionAccess.js +35 -0
- package/src/diagnostics/events.js +1 -0
- package/src/diagnostics/invariant.js +1 -0
- package/src/diagnostics/schemaBindingChecks.js +1 -0
- package/src/diagnostics/schemaModuleChecks.js +1 -0
- package/src/diagnostics/sourceBoundaryChecks.js +5 -0
- package/src/diagnostics/sourceTransport.report.js +190 -0
- package/src/discovery/discovery.controls.js +7 -0
- package/src/export/export.plan.js +182 -0
- package/src/export/handoff.plan.js +50 -0
- package/src/export/package.builder.case.mjs +97 -0
- package/src/export/package.controlTopology.case.mjs +130 -0
- package/src/export/package.zip.case.mjs +33 -0
- package/src/graph/artifactGraph.model.js +344 -0
- package/src/graph/artifactGraph.project.js +139 -0
- package/src/graph/artifactGraph.worker.js +10 -0
- package/src/i18n/i18n.keys.js +1 -0
- package/src/i18n/i18n.provider.js +1 -0
- package/src/i18n/i18n.resolve.js +5 -0
- package/src/i18n/locales/en/common.json +4 -0
- package/src/i18n/locales/en/schemas/evidence.json +3 -0
- package/src/i18n/locales/en/schemas/presentation-surface.json +3 -0
- package/src/i18n/locales/en/schemas/preservation.json +3 -0
- package/src/i18n/locales/en/schemas/root.json +3 -0
- package/src/i18n/locales/en/schemas/schema-module.json +3 -0
- package/src/i18n/locales/en/schemas/topic.json +3 -0
- package/src/i18n/locales/en/surfaces/audit.json +3 -0
- package/src/i18n/locales/en/surfaces/create.json +3 -0
- package/src/i18n/locales/en/surfaces/detail.json +3 -0
- package/src/i18n/locales/en/surfaces/display-options.json +3 -0
- package/src/i18n/locales/en/surfaces/edit.json +3 -0
- package/src/i18n/locales/en/surfaces/feed.json +3 -0
- package/src/i18n/locales/en/surfaces/lineage.json +3 -0
- package/src/i18n/locales/en/surfaces/preview.json +3 -0
- package/src/i18n/locales/en/surfaces/share.json +3 -0
- package/src/i18n/locales/en/surfaces/source-settings.json +3 -0
- package/src/i18n/locales/en/surfaces/tree.json +3 -0
- package/src/i18n/locales/sv/common.json +4 -0
- package/src/i18n/locales/sv/schemas/evidence.json +3 -0
- package/src/i18n/locales/sv/schemas/presentation-surface.json +3 -0
- package/src/i18n/locales/sv/schemas/preservation.json +3 -0
- package/src/i18n/locales/sv/schemas/root.json +3 -0
- package/src/i18n/locales/sv/schemas/schema-module.json +3 -0
- package/src/i18n/locales/sv/schemas/topic.json +3 -0
- package/src/i18n/locales/sv/surfaces/audit.json +3 -0
- package/src/i18n/locales/sv/surfaces/create.json +3 -0
- package/src/i18n/locales/sv/surfaces/detail.json +3 -0
- package/src/i18n/locales/sv/surfaces/display-options.json +3 -0
- package/src/i18n/locales/sv/surfaces/edit.json +3 -0
- package/src/i18n/locales/sv/surfaces/feed.json +3 -0
- package/src/i18n/locales/sv/surfaces/lineage.json +3 -0
- package/src/i18n/locales/sv/surfaces/preview.json +3 -0
- package/src/i18n/locales/sv/surfaces/share.json +3 -0
- package/src/i18n/locales/sv/surfaces/source-settings.json +3 -0
- package/src/i18n/locales/sv/surfaces/tree.json +3 -0
- package/src/index.js +10 -0
- package/src/integrity/integrity.testFixture.js +9 -0
- package/src/interaction/interaction.spine.js +12 -0
- package/src/lineage/lineage.audit.js +1 -0
- package/src/lineage/lineage.edges.js +1 -0
- package/src/main.js +319 -0
- package/src/main.jsx +34 -0
- package/src/multiverse/multiverse.model.js +10 -0
- package/src/parity/poc.m1ParityScenarios.js +42 -0
- package/src/parity/poc.parityLedger.js +261 -0
- package/src/publication/publication.githubSocialContract.case.mjs +247 -0
- package/src/publication/publication.preflight.case.mjs +64 -0
- package/src/react/TiinexApplication.jsx +39 -0
- package/src/react/VerseHost.jsx +29 -0
- package/src/react/applicationDataContext.jsx +30 -0
- package/src/react.js +2 -0
- package/src/readers/modes/audit.reader.js +1 -0
- package/src/readers/modes/detail.reader.js +1 -0
- package/src/readers/modes/handover.reader.js +1 -0
- package/src/readers/modes/mobile.reader.js +1 -0
- package/src/readers/modes/print.reader.js +1 -0
- package/src/readers/modes/scan.reader.js +1 -0
- package/src/readers/reader.model.js +1 -0
- package/src/readers/reader.resolve.js +2 -0
- package/src/reingest/reingest.plan.case.mjs +65 -0
- package/src/runtime.js +54 -0
- package/src/schemas/README.md +99 -0
- package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.md +614 -0
- package/src/schemas/coordination/project/tiinex.project.v1.schema.md +311 -0
- package/src/schemas/core/decision/tiinex.decision.v1.schema.md +227 -0
- package/src/schemas/core/evidence/tiinex.evidence.v1.schema.md +318 -0
- package/src/schemas/core/feedback/tiinex.feedback.v1.schema.md +243 -0
- package/src/schemas/core/interpretation/.transitions/evidence-to-interpretation-transition-definition.trace.md +102 -0
- package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.md +308 -0
- package/src/schemas/core/preservation/tiinex.preservation.v1.schema.md +312 -0
- package/src/schemas/core/relation/.generation/reference-relation-generation-authority.trace.md +185 -0
- package/src/schemas/core/relation/.transitions/topic-references-task-transition-definition.trace.md +119 -0
- package/src/schemas/core/relation/tiinex.relation.v1.schema.md +240 -0
- package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.md +550 -0
- package/src/schemas/core/signal/tiinex.signal.v1.schema.md +239 -0
- package/src/schemas/core/task/.transitions/create-task-transition-definition.trace.md +93 -0
- package/src/schemas/core/task/.transitions/topic-to-task-transition-definition.trace.md +102 -0
- package/src/schemas/core/task/task-semantic-package.trace.md +53 -0
- package/src/schemas/core/task/tiinex.task.v1-transitions.trace.md +33 -0
- package/src/schemas/core/task/tiinex.task.v1.authoring.js +65 -0
- package/src/schemas/core/task/tiinex.task.v1.schema.md +229 -0
- package/src/schemas/core/topic/.transitions/create-topic-transition-definition.trace.md +93 -0
- package/src/schemas/core/topic/tiinex.topic.v1-transitions.trace.md +33 -0
- package/src/schemas/core/topic/tiinex.topic.v1.schema.md +197 -0
- package/src/schemas/core/topic/topic-semantic-package.trace.md +53 -0
- package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.md +240 -0
- package/src/schemas/discovery/tiinex.discovery.v1.schema.md +294 -0
- package/src/schemas/manifest.json +367 -0
- package/src/schemas/origins.js +46 -0
- package/src/schemas/party/organization/tiinex.party.organization.v1.schema.md +290 -0
- package/src/schemas/party/role/tiinex.party.role.v1.schema.md +298 -0
- package/src/schemas/party/tiinex.party.v1.schema.js +14 -0
- package/src/schemas/party/tiinex.party.v1.schema.json +23 -0
- package/src/schemas/party/tiinex.party.v1.schema.md +311 -0
- package/src/schemas/party/tiinex.party.v1.schema.runtime.json +2033 -0
- package/src/schemas/party/tiinex.party.v1.schema.source.js +9 -0
- package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.md +476 -0
- package/src/schemas/reduction/tiinex.reduction.v1.schema.md +248 -0
- package/src/schemas/schema/module/tiinex.schema.module.v1.schema.md +465 -0
- package/src/schemas/schema.companionContract.case.mjs +259 -0
- package/src/schemas/schema.factory.case.mjs +256 -0
- package/src/schemas/schema.factory.viewerProjection.js +183 -0
- package/src/schemas/schemaMarkdownCatalog.js +19 -0
- package/src/schemas/tiinex.root.v1.schema.md +865 -0
- package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.md +309 -0
- package/src/schemas/validation/method/tiinex.validation.method.v1.schema.md +280 -0
- package/src/schemas/validation/report/tiinex.validation.report.v1.schema.md +300 -0
- package/src/schemas/workspace/tiinex.workspace.v1.schema.md +486 -0
- package/src/schemas/workspace/workspace.add.views.jsx +327 -0
- package/src/schemas/workspace/workspace.audit.views.jsx +160 -0
- package/src/schemas/workspace/workspace.auditBadge.views.jsx +98 -0
- package/src/schemas/workspace/workspace.canonicalReferenceDialog.views.jsx +63 -0
- package/src/schemas/workspace/workspace.canonicalTaskDialog.views.jsx +169 -0
- package/src/schemas/workspace/workspace.cardActions.js +9 -0
- package/src/schemas/workspace/workspace.cards.views.jsx +146 -0
- package/src/schemas/workspace/workspace.chrome.views.jsx +299 -0
- package/src/schemas/workspace/workspace.continuationDialog.views.jsx +80 -0
- package/src/schemas/workspace/workspace.discovery.views.jsx +63 -0
- package/src/schemas/workspace/workspace.discoveryRenderWindow.js +56 -0
- package/src/schemas/workspace/workspace.displayOptions.views.jsx +114 -0
- package/src/schemas/workspace/workspace.entrypointChoice.views.jsx +30 -0
- package/src/schemas/workspace/workspace.exportDialog.controller.jsx +40 -0
- package/src/schemas/workspace/workspace.exportDialog.views.jsx +142 -0
- package/src/schemas/workspace/workspace.governance.views.jsx +45 -0
- package/src/schemas/workspace/workspace.graph.views.jsx +134 -0
- package/src/schemas/workspace/workspace.lineage.views.jsx +307 -0
- package/src/schemas/workspace/workspace.read.views.jsx +105 -0
- package/src/schemas/workspace/workspace.recordActionButton.views.jsx +35 -0
- package/src/schemas/workspace/workspace.recordDialogs.views.jsx +257 -0
- package/src/schemas/workspace/workspace.selection.views.jsx +14 -0
- package/src/schemas/workspace/workspace.sourceReceipt.views.jsx +40 -0
- package/src/schemas/workspace/workspace.timePortal.views.jsx +56 -0
- package/src/schemas/workspace/workspace.tree.views.jsx +107 -0
- package/src/schemas/workspace/workspace.viewFormatting.js +172 -0
- package/src/schemas/workspace/workspace.views.jsx +210 -0
- package/src/source-settings/sourceSettings.model.js +7 -0
- package/src/sources/draft/draft.source.js +1 -0
- package/src/sources/github/github.loader.js +204 -0
- package/src/sources/github/github.permalink.js +1 -0
- package/src/sources/github/github.source.js +1 -0
- package/src/sources/github/github.transport.case.mjs +237 -0
- package/src/sources/github/github.transport.js +472 -0
- package/src/sources/local/local.source.js +1 -0
- package/src/sources/source.assetReferences.js +109 -0
- package/src/sources/source.boundaries.js +24 -0
- package/src/sources/source.identity.js +56 -0
- package/src/sources/source.model.case.mjs +26 -0
- package/src/sources/source.model.js +56 -0
- package/src/sources/source.presenter.js +66 -0
- package/src/sources/source.resolve.js +11 -0
- package/src/sources/static/static.source.js +1 -0
- package/src/sources/transport.policy.case.mjs +39 -0
- package/src/sources/transport.policy.js +81 -0
- package/src/storage/storage.policy.js +79 -0
- package/src/styles/app.css +8699 -0
- package/src/styles/responsive.css +10 -0
- package/src/styles/theme.css +4 -0
- package/src/styles/tokens.css +30 -0
- package/src/surfaces/audit/AuditSurface.js +1 -0
- package/src/surfaces/audit/audit.model.js +1 -0
- package/src/surfaces/audit/audit.render.js +1 -0
- package/src/surfaces/contracts.js +45 -0
- package/src/surfaces/create/CreateSurface.js +1 -0
- package/src/surfaces/create/create.model.js +1 -0
- package/src/surfaces/create/create.render.js +1 -0
- package/src/surfaces/detail/DetailSurface.js +1 -0
- package/src/surfaces/detail/detail.model.js +1 -0
- package/src/surfaces/detail/detail.render.js +1 -0
- package/src/surfaces/display-options/DisplayOptionsSurface.js +1 -0
- package/src/surfaces/display-options/displayOptions.model.js +1 -0
- package/src/surfaces/display-options/displayOptions.render.js +1 -0
- package/src/surfaces/edit/EditSurface.js +1 -0
- package/src/surfaces/edit/edit.model.js +1 -0
- package/src/surfaces/edit/edit.render.js +1 -0
- package/src/surfaces/feed/FeedSurface.js +1 -0
- package/src/surfaces/feed/feed.model.js +1 -0
- package/src/surfaces/feed/feed.render.js +1 -0
- package/src/surfaces/lineage/LineageSurface.js +1 -0
- package/src/surfaces/lineage/lineage.model.js +1 -0
- package/src/surfaces/lineage/lineage.render.js +1 -0
- package/src/surfaces/preview/PreviewSurface.js +1 -0
- package/src/surfaces/preview/preview.model.js +1 -0
- package/src/surfaces/preview/preview.render.js +1 -0
- package/src/surfaces/registry.js +58 -0
- package/src/surfaces/share/ShareSurface.js +1 -0
- package/src/surfaces/share/share.model.js +1 -0
- package/src/surfaces/share/share.render.js +1 -0
- package/src/surfaces/source-settings/SourceSettingsSurface.js +1 -0
- package/src/surfaces/source-settings/sourceSettings.model.js +1 -0
- package/src/surfaces/source-settings/sourceSettings.render.js +1 -0
- package/src/surfaces/surfaceContext.js +1 -0
- package/src/surfaces/tree/TreeSurface.js +1 -0
- package/src/surfaces/tree/tree.model.js +1 -0
- package/src/surfaces/tree/tree.render.js +1 -0
- package/src/tooling/portable/adapters/cli/cli.common-output.case.mjs +153 -0
- package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.case.mjs +52 -0
- package/src/tooling/portable/adapters/cli/cli.run.case.mjs +372 -0
- package/src/tooling/portable/adapters/cli/cli.summaryProjection.case.mjs +46 -0
- package/src/tooling/portable/audit/audit.capability.case.mjs +45 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/collaboration/dogfood/001-tiinex-development-dogfood-collaboration-model.trace.fixture.txt +37 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/handoff/tooling/001-v480-tooling-workflow-schema-enablement-handoff.trace.fixture.txt +108 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/handoff/tooling/002-v481-tooling-recipient-relative-handoff-material-closure-planner-foundation-handoff.trace.fixture.txt +130 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/loom/role/001-loom-role.trace.fixture.txt +61 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/sigma/role/001-1-sigma-role.trace.fixture.txt +61 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-1-1-site-tooling-v474-loaded-parent-identity-evidence-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-1-site-tooling-v474-loaded-parent-identity-evidence-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-1-site-tooling-v473-portable-parent-authority-coherence-metadata-fidelity-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-1-site-tooling-v473-portable-parent-authority-coherence-metadata-fidelity-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-1-site-tooling-v472-portable-exact-authoring-fidelity-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-1-site-tooling-v472-portable-exact-authoring-fidelity-closure.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-1-site-tooling-v471-portable-lineage-authoring-closure-result.trace.fixture.txt +48 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/001-site-tooling-v471-portable-lineage-authoring-closure.trace.fixture.txt +39 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/002-1-v475-canonical-artifact-envelope-reference-integrity-validation.trace.fixture.txt +43 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/003-1-v476-canonical-authority-binding-integrity-method-lineage-alloca.trace.fixture.txt +42 -0
- package/src/tooling/portable/fixtures/legacy-artifacts/tooling/dogfood/027-handoff-package-workspace-archive-and-control-plane-minimality-audit.trace.fixture.txt +56 -0
- package/src/tooling/portable/fixtures/legacyArtifactFixtures.mjs +34 -0
- package/src/tooling/portable/grounding/grounding.capsule.case.mjs +65 -0
- package/src/tooling/portable/grounding/grounding.readiness.case.mjs +543 -0
- package/src/tooling/portable/grounding/grounding.semanticIntegration.case.mjs +131 -0
- package/src/tooling/portable/handoff/boundedWorkspaceRepresentation.case.mjs +103 -0
- package/src/tooling/portable/handoff/carrierLineage.fixedWidth.case.mjs +97 -0
- package/src/tooling/portable/handoff/coldStartQualification.case.mjs +293 -0
- package/src/tooling/portable/handoff/fixtures/027-invalid-audit-result.fixture.txt +192 -0
- package/src/tooling/portable/handoff/fixtures/027-invalid-return-handoff.fixture.txt +92 -0
- package/src/tooling/portable/handoff/fixtures/cold-start-qualification.v1.examples.json +60 -0
- package/src/tooling/portable/handoff/handoff.manufacture.case.mjs +293 -0
- package/src/tooling/portable/handoff/materialClosure.case.mjs +727 -0
- package/src/tooling/portable/handoff/multiRootManufacture.case.mjs +615 -0
- package/src/tooling/portable/handoff/operatorBridgeCore.case.mjs +205 -0
- package/src/tooling/portable/handoff/workspaceLandingPlan.case.mjs +143 -0
- package/src/tooling/portable/input/node.input.case.mjs +293 -0
- package/src/tooling/portable/lifecycle/lifecycle.readiness.case.mjs +179 -0
- package/src/tooling/portable/lineage/fixtures/lineage.integrity.repair-projection.v1.examples.json +605 -0
- package/src/tooling/portable/lineage/lineage.integrity.shared-capability.case.mjs +37 -0
- package/src/tooling/portable/lineage/publicationProviderReceipt.fixture.mjs +50 -0
- package/src/tooling/portable/package/fixtures/reference-relation-generation-authority.trace.md +84 -0
- package/src/tooling/portable/package/fixtures/tiinex.root.v1.package-authority.contract-fixture.md +64 -0
- package/src/tooling/portable/package/fixtures/tiinex.schema.generation.v1.generation-binding.contract-fixture.md +140 -0
- package/src/tooling/portable/package/fixtures/tiinex.schema.transition.companion.v1.contract-fixture.md +73 -0
- package/src/tooling/portable/package/fixtures/tiinex.semantic.package.v1.contract-fixture.md +147 -0
- package/src/tooling/portable/package/fixtures/tiinex.transition.definition.v1.package-contract-fixture.md +77 -0
- package/src/tooling/portable/providers/schema.providers.genericity.case.mjs +31 -0
- package/src/tooling/portable/reduction/reduction.preflight.case.mjs +298 -0
- package/src/tooling/portable/schema/fixtures/evidence-preservation-body.inheritance-record-fixture.md +65 -0
- package/src/tooling/portable/schema/fixtures/tiinex.portal.time.v1.contract-fixture.md +294 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.contract-fixture.md +584 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.machine-shape.contract-fixture.md +44 -0
- package/src/tooling/portable/schema/fixtures/tiinex.root.v1.ordinary-target.contract-fixture.md +630 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.contract.v1.repeated-record.contract-fixture.md +69 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.generation.v1.repeated-record.contract-fixture.md +98 -0
- package/src/tooling/portable/schema/fixtures/tiinex.schema.inheritance.v1.repeated-record.contract-fixture.md +58 -0
- package/src/tooling/portable/schema/fixtures/tiinex.task.v1.contract-fixture.md +165 -0
- package/src/tooling/portable/schema/fixtures/tiinex.transition.definition.v1.contract-fixture.md +744 -0
- package/src/tooling/portable/schema/fixtures/tiinex.transition.definition.v1.field-domain.contract-fixture.md +319 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.relation.v1.schema.md +240 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.contract.v1.schema.md +391 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.generation.v1.schema.md +379 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.schema.transition.companion.v1.schema.md +265 -0
- package/src/transitions/canonical-schema-cache/053d46ce082d4ec261b82abc44ecca403d61e240/tiinex.semantic.package.v1.schema.md +402 -0
- package/src/transitions/canonical-schema-cache/52ecdea0a75893882ce282214d155f70e1309c2a/tiinex.topic.v1.schema.md +197 -0
- package/src/transitions/canonical-schema-cache/d69b8ff55a56b8cb9282b8684db6a938a4435b94/tiinex.root.v1.schema.md +797 -0
- package/src/transitions/canonical-schema-cache/d69b8ff55a56b8cb9282b8684db6a938a4435b94/tiinex.transition.definition.v1.schema.md +1062 -0
- package/src/transitions/canonicalTransition.packageContracts.js +22 -0
- package/src/transitions/canonicalTransition.productDefaults.js +105 -0
- package/src/transitions/canonicalTransition.schemaCache.case.mjs +45 -0
- package/src/transitions/canonicalTransition.schemaCache.js +81 -0
- package/src/transitions/canonicalTransition.semanticPackage.js +146 -0
- package/src/transitions/record.transitions.case.mjs +88 -0
- package/src/transitions/transition.authorityRepresentation.js +55 -0
- package/src/transitions/transition.availabilityPlanner.js +376 -0
- package/src/transitions/transition.availabilitySemantics.js +150 -0
- package/src/transitions/transition.definitionReadProjection.js +107 -0
- package/src/transitions/transition.definitionRegistry.js +355 -0
- package/src/transitions/transition.definitionRegistryAggregation.js +21 -0
- package/src/transitions/transition.definitions.js +46 -0
- package/src/transitions/transition.explicitGenerationPlanner.js +58 -0
- package/src/transitions/transition.generationInputPlanner.js +19 -0
- package/src/transitions/transition.interpretationMaterializer.js +2 -0
- package/src/transitions/transition.invocationBindingPacket.js +52 -0
- package/src/transitions/transition.invocationBindingPlanner.js +467 -0
- package/src/transitions/transition.legacyShorthand.js +133 -0
- package/src/transitions/transition.localArtifactMaterializers.js +16 -0
- package/src/transitions/transition.localCreateCapability.js +111 -0
- package/src/transitions/transition.outputMaterializationPlanner.js +336 -0
- package/src/transitions/transition.parentReference.js +90 -0
- package/src/transitions/transition.presentation.js +43 -0
- package/src/transitions/transition.productPreparation.js +377 -0
- package/src/transitions/transition.productPresentation.browser.js +28 -0
- package/src/transitions/transition.productPresentation.js +55 -0
- package/src/transitions/transition.referenceCreateCapability.js +119 -0
- package/src/transitions/transition.referenceTarget.js +50 -0
- package/src/transitions/transition.relationMaterializer.js +2 -0
- package/src/transitions/transition.resultSemantics.js +453 -0
- package/src/transitions/transition.taskMaterializer.js +2 -0
- package/src/transitions/transition.topicMaterializer.js +2 -0
- package/src/transitions/transition.validate.case.mjs +58 -0
- package/src/ui/cards/ArtifactCard.js +1 -0
- package/src/ui/cards/SchemaCard.js +1 -0
- package/src/ui/cards/SourceCard.js +1 -0
- package/src/ui/dialog.presenter.js +24 -0
- package/src/ui/feedback/DegradedNotice.js +1 -0
- package/src/ui/feedback/EmptyState.js +1 -0
- package/src/ui/feedback/ValidationNotice.js +1 -0
- package/src/ui/forms/FormRenderer.js +1 -0
- package/src/ui/forms/fields/MarkdownField.js +1 -0
- package/src/ui/forms/fields/SelectField.js +1 -0
- package/src/ui/forms/fields/SourcePickerField.js +1 -0
- package/src/ui/forms/fields/TextField.js +1 -0
- package/src/ui/icon.paths.js +37 -0
- package/src/ui/layout/Panel.js +1 -0
- package/src/ui/layout/ResponsiveFrame.js +1 -0
- package/src/ui/layout/SplitView.js +1 -0
- package/src/ui/layout/Stack.js +1 -0
- package/src/ui/panels/DetailPanel.js +1 -0
- package/src/ui/panels/LineagePanel.js +1 -0
- package/src/ui/panels/SourcePanel.js +1 -0
- package/src/ui/primitives/Badge.js +1 -0
- package/src/ui/primitives/Badge.jsx +5 -0
- package/src/ui/primitives/Button.js +1 -0
- package/src/ui/primitives/Button.jsx +12 -0
- package/src/ui/primitives/Card.js +1 -0
- package/src/ui/primitives/Field.js +1 -0
- package/src/ui/primitives/Field.jsx +21 -0
- package/src/ui/primitives/Icon.jsx +90 -0
- package/src/ui/primitives/Modal.jsx +27 -0
- package/src/validation/i18n.js +37 -0
- package/src/validation/validateArtifact.case.mjs +41 -0
- package/src/verses/column/ColumnVerse.js +1 -0
- package/src/verses/column/column.model.js +6 -0
- package/src/verses/column/column.project.js +7 -0
- package/src/verses/context.js +26 -0
- package/src/verses/contracts.js +1 -0
- package/src/verses/hostRegistry.js +47 -0
- package/src/verses/registry.js +22 -0
- package/src/verses/universe.model.js +8 -0
- package/src/verses/universe.presenter.js +8 -0
- package/src/verses/universe.project.js +12 -0
- package/src/viewer.js +34 -0
- package/src/workspace.model.js +5 -0
- package/src/workspaces/workspace.actions.js +1 -0
- package/src/workspaces/workspace.artifactActions.js +56 -0
- package/src/workspaces/workspace.auditView.js +153 -0
- package/src/workspaces/workspace.candidates.js +149 -0
- package/src/workspaces/workspace.config.js +153 -0
- package/src/workspaces/workspace.configuredSource.js +68 -0
- package/src/workspaces/workspace.discoveryProgress.js +34 -0
- package/src/workspaces/workspace.discoveryView.js +386 -0
- package/src/workspaces/workspace.displayFilters.js +63 -0
- package/src/workspaces/workspace.displayOptions.js +58 -0
- package/src/workspaces/workspace.emptyStateCopy.js +24 -0
- package/src/workspaces/workspace.entrypointLifecycle.js +131 -0
- package/src/workspaces/workspace.entrypointViewIntent.js +83 -0
- package/src/workspaces/workspace.entrypoints.js +157 -0
- package/src/workspaces/workspace.feedSort.js +152 -0
- package/src/workspaces/workspace.import.js +212 -0
- package/src/workspaces/workspace.importConflicts.js +200 -0
- package/src/workspaces/workspace.importLifecycle.case.mjs +103 -0
- package/src/workspaces/workspace.lifecycle.case.mjs +353 -0
- package/src/workspaces/workspace.lifecycle.js +357 -0
- package/src/workspaces/workspace.lineageView.js +244 -0
- package/src/workspaces/workspace.localSourceLifecycle.js +91 -0
- package/src/workspaces/workspace.materialLedger.js +110 -0
- package/src/workspaces/workspace.materialReconciliation.case.mjs +164 -0
- package/src/workspaces/workspace.materialReconciliation.js +390 -0
- package/src/workspaces/workspace.memberIdentity.js +140 -0
- package/src/workspaces/workspace.model.js +2 -0
- package/src/workspaces/workspace.navigation.js +20 -0
- package/src/workspaces/workspace.openSemantics.js +33 -0
- package/src/workspaces/workspace.pathTree.js +132 -0
- package/src/workspaces/workspace.persistence.case.mjs +271 -0
- package/src/workspaces/workspace.persistence.js +469 -0
- package/src/workspaces/workspace.persistenceCache.js +41 -0
- package/src/workspaces/workspace.persistenceClear.js +45 -0
- package/src/workspaces/workspace.persistencePresentation.js +93 -0
- package/src/workspaces/workspace.persistenceRecovery.js +147 -0
- package/src/workspaces/workspace.persistenceRouteCache.js +82 -0
- package/src/workspaces/workspace.publicationReceipts.case.mjs +36 -0
- package/src/workspaces/workspace.publicationReceipts.js +56 -0
- package/src/workspaces/workspace.recoverabilityView.js +264 -0
- package/src/workspaces/workspace.route.js +432 -0
- package/src/workspaces/workspace.runtimeCanonical.js +18 -0
- package/src/workspaces/workspace.sourceMaterial.js +71 -0
- package/src/workspaces/workspace.sourceRecordPath.js +5 -0
- package/src/workspaces/workspace.sourceRecords.js +75 -0
- package/src/workspaces/workspace.store.js +3 -0
- package/src/workspaces/workspace.summary.js +116 -0
- package/src/workspaces/workspace.timePortal.js +137 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { createGithubTransportFetch, normalizeGithubTransportTier } from '../../sources/github/github.transport.js';
|
|
2
|
+
import { createGithubIssueSnapshotRecords, githubIssueFetchWarning, parseGithubIssueSnapshotTarget, parseGithubIssueSnapshotTargets } from './github.issueSnapshot.js';
|
|
3
|
+
|
|
4
|
+
export function finding(severity, code, message, extra = {}) { return Object.assign({ severity, code, message }, extra); }
|
|
5
|
+
|
|
6
|
+
export function issueMirrorFetchForTier(source = {}, tier = '', fetchImpl, diagnostics = {}) {
|
|
7
|
+
const normalized = normalizeGithubTransportTier(tier);
|
|
8
|
+
if (normalized !== 'mirror' && normalized !== 'cache') return fetchImpl;
|
|
9
|
+
return async (url, init = {}) => {
|
|
10
|
+
const emit = (event) => diagnostics.transportEvents?.push?.(Object.assign({ adapterId: 'github', sourceId: source?.id || '', repo: source?.repo || source?.repository || '', tier: normalized, resource: 'api-json', url }, event));
|
|
11
|
+
if (!fetchImpl && normalized !== 'cache') {
|
|
12
|
+
emit({ code: `github.transport.${normalized}.unavailable`, severity: 'warning', message: 'Hosted issue snapshot mirror fetch is unavailable in this runtime.' });
|
|
13
|
+
return responseWithTransport(null, normalized);
|
|
14
|
+
}
|
|
15
|
+
emit({ code: `github.transport.${normalized}.try`, severity: 'info', url, resource: 'api-json' });
|
|
16
|
+
try {
|
|
17
|
+
const res = await fetchImpl(url, init);
|
|
18
|
+
if (res?.ok) emit({ code: `github.transport.${normalized}.ok`, severity: 'info', url, resource: 'api-json', status: res.status || 200 });
|
|
19
|
+
else emit({ code: `github.transport.${normalized}.failed`, severity: 'warning', url, resource: 'api-json', status: res?.status || 0, message: res?.statusText || '' });
|
|
20
|
+
return responseWithTransport(res, normalized);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
emit({ code: `github.transport.${normalized}.exception`, severity: 'warning', message: error?.message || String(error || '') });
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function issueApiFetchForTier(source = {}, tier = '', fetchImpl, diagnostics = {}, options = {}) {
|
|
29
|
+
const normalized = normalizeGithubTransportTier(tier);
|
|
30
|
+
if (normalized !== 'proxy') return fetchImpl;
|
|
31
|
+
const apiFetch = options.proxyFetchImpl || fetchImpl;
|
|
32
|
+
const emit = (event) => diagnostics.transportEvents?.push?.(Object.assign({ adapterId: 'github', sourceId: source?.id || '', repo: source?.repo || source?.repository || '', tier: 'proxy', resource: 'github-api-json' }, event));
|
|
33
|
+
if (!apiFetch) {
|
|
34
|
+
return async () => {
|
|
35
|
+
emit({ code: 'github.transport.proxy.unavailable', severity: 'warning', message: 'Proxy/API issue reader is unavailable in this runtime.' });
|
|
36
|
+
return responseWithTransport(null, 'proxy');
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const runtime = createGithubTransportFetch(source, Object.assign({}, options, {
|
|
40
|
+
fetchImpl: apiFetch,
|
|
41
|
+
transportPlan: undefined,
|
|
42
|
+
preferredTransports: ['direct'],
|
|
43
|
+
transportOrderExact: true,
|
|
44
|
+
allowCache: false,
|
|
45
|
+
onTransportEvent: (event = {}) => emit(Object.assign({}, event, {
|
|
46
|
+
tier: 'proxy',
|
|
47
|
+
code: String(event.code || '').replace('github.transport.direct.', 'github.transport.proxy.')
|
|
48
|
+
}))
|
|
49
|
+
}));
|
|
50
|
+
return async (url, init = {}) => {
|
|
51
|
+
const res = await runtime.fetch(url, init);
|
|
52
|
+
return responseWithTransport(res, 'proxy', true);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
export function directIssueDiscoveryUnavailable(source = {}, diagnostics = {}) {
|
|
58
|
+
const repo = source?.repo || source?.repository || '';
|
|
59
|
+
const warning = finding('warning', 'github.issue.direct.discovery-unavailable', 'Direct issue transport does not perform repository-wide issue discovery. Provide explicit issue URLs, use hosted mirror, or use proxy/API transport.', { surface: 'issueSnapshots', repo, transportTier: 'direct' });
|
|
60
|
+
diagnostics.transportEvents?.push?.({ adapterId: 'github', sourceId: source?.id || '', repo, tier: 'direct', resource: 'issue-raw', code: 'github.transport.direct.discovery-unavailable', severity: 'warning', message: warning.message });
|
|
61
|
+
return { schema: 'tiinex.github.issueSnapshot.discovery.v1', status: 'unavailable', targets: [], warnings: [warning], errors: [], counts: { discovered: 0, targets: 0, warnings: 1, errors: 0 }, transportTier: 'direct' };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function materializeDirectIssueTargets(targets = [], source = {}, options = {}, diagnostics = {}) {
|
|
65
|
+
const parsed = Array.isArray(targets) ? { targets, errors: [], counts: { targets: targets.length, errors: 0 } } : parseGithubIssueSnapshotTargets(targets || []);
|
|
66
|
+
const records = [];
|
|
67
|
+
const warnings = [];
|
|
68
|
+
const errors = [...(parsed.errors || [])];
|
|
69
|
+
const targetResults = [];
|
|
70
|
+
const fetchImpl = options.fetchImpl;
|
|
71
|
+
if (!fetchImpl) {
|
|
72
|
+
const warning = finding('warning', 'github.issue.direct.reader-unavailable', 'Direct issue transport has no raw fetch implementation in this runtime.', { surface: 'issueSnapshots', transportTier: 'direct' });
|
|
73
|
+
warnings.push(warning);
|
|
74
|
+
return { schema: 'tiinex.github.issueSnapshot.materialization.v1', records, warnings, errors, targetResults, counts: issueSurfaceMaterializationCounts(parsed.counts.targets, 0, warnings.length, errors.length, targetResults), transportTier: 'direct' };
|
|
75
|
+
}
|
|
76
|
+
for (const target of parsed.targets || []) {
|
|
77
|
+
const normalized = target.ok ? target : parseGithubIssueSnapshotTarget(target.canonicalUrl || target.html_url || target.url || '');
|
|
78
|
+
if (!normalized.ok) {
|
|
79
|
+
errors.push({ ref: target.input || target.url || '', error: normalized.error || 'invalid issue target' });
|
|
80
|
+
targetResults.push(issueSurfaceTargetResult(target, { status: 'failed', warningCode: 'invalid-issue-target', message: normalized.error || 'invalid issue target', transportTier: 'direct' }));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const directUrl = normalized.directRawUrl || normalized.canonicalUrl;
|
|
85
|
+
const res = await fetchImpl(directUrl, { headers: { Accept: 'text/markdown,text/plain,text/html,application/json,*/*' } });
|
|
86
|
+
if (!res?.ok) {
|
|
87
|
+
const warning = githubIssueFetchWarning(Object.assign(new Error(`${res?.status || 0} ${res?.statusText || ''}`.trim()), { status: res?.status || 0, statusText: res?.statusText || '', url: directUrl }), 'github.issue.direct.fetch-failed', `Direct raw issue fetch could not read ${directUrl}; no GitHub API request was made. Normal github.com issue pages may be blocked by browser CORS unless the URL is a browser-readable raw/static snapshot.`, { transportTier: 'direct' });
|
|
88
|
+
warnings.push(warning);
|
|
89
|
+
targetResults.push(issueSurfaceTargetResult(normalized, { status: 'failed', warningCode: warning.code, message: warning.message, transportTier: 'direct' }));
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const body = await res.text();
|
|
93
|
+
const issue = directIssueSnapshotFromRawBody(body, normalized);
|
|
94
|
+
const issueRecords = createGithubIssueSnapshotRecords(Object.assign({
|
|
95
|
+
target: normalized,
|
|
96
|
+
html_url: normalized.canonicalUrl,
|
|
97
|
+
number: normalized.number,
|
|
98
|
+
title: `Issue #${normalized.number}`,
|
|
99
|
+
state: '',
|
|
100
|
+
body,
|
|
101
|
+
user: { login: '' },
|
|
102
|
+
comments: [],
|
|
103
|
+
method: 'github-direct-raw-issue-reader'
|
|
104
|
+
}, issue || {}), options);
|
|
105
|
+
for (const record of issueRecords) {
|
|
106
|
+
record.sourceTarget = Object.assign({
|
|
107
|
+
schema: 'tiinex.source.material.target.v1',
|
|
108
|
+
surface: 'issueSnapshots',
|
|
109
|
+
targetKind: record.snapshot?.embedded ? `github-${normalized.kind}-embedded-artifact` : `github-${normalized.kind}-snapshot`,
|
|
110
|
+
inputTarget: record.snapshot?.sourceUrl || normalized.canonicalUrl,
|
|
111
|
+
transportTier: 'direct',
|
|
112
|
+
loaded: true
|
|
113
|
+
}, record.sourceTarget || {});
|
|
114
|
+
records.push(record);
|
|
115
|
+
}
|
|
116
|
+
targetResults.push(issueSurfaceTargetResult(normalized, { status: 'loaded', records: issueRecords.length, transportTier: 'direct' }));
|
|
117
|
+
} catch (error) {
|
|
118
|
+
const warning = githubIssueFetchWarning(error, 'github.issue.direct.fetch-exception', `Direct raw issue fetch could not read ${normalized.canonicalUrl}; no GitHub API request was made.`, { url: normalized.canonicalUrl, transportTier: 'direct' });
|
|
119
|
+
warnings.push(warning);
|
|
120
|
+
targetResults.push(issueSurfaceTargetResult(normalized, { status: 'failed', warningCode: warning.code, message: warning.message, transportTier: 'direct' }));
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { schema: 'tiinex.github.issueSnapshot.materialization.v1', records, warnings, errors, targetResults, counts: issueSurfaceMaterializationCounts(parsed.counts.targets, records.length, warnings.length, errors.length, targetResults), transportTier: 'direct' };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
function directIssueSnapshotFromRawBody(body = '', target = {}) {
|
|
128
|
+
if (String(target.directRawFormat || '').toLowerCase() !== 'json') return null;
|
|
129
|
+
try {
|
|
130
|
+
const parsed = JSON.parse(String(body || '{}'));
|
|
131
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) return null;
|
|
132
|
+
return Object.assign({}, parsed, {
|
|
133
|
+
target,
|
|
134
|
+
body: parsed.body || parsed.markdown || parsed.content || '',
|
|
135
|
+
comments: Array.isArray(parsed.comments) ? parsed.comments : [],
|
|
136
|
+
method: 'github-direct-static-issue-json'
|
|
137
|
+
});
|
|
138
|
+
} catch (_) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function issueSurfaceMaterializationCounts(targets = 0, records = 0, warnings = 0, errors = 0, targetResults = []) {
|
|
144
|
+
const results = Array.isArray(targetResults) ? targetResults : [];
|
|
145
|
+
return {
|
|
146
|
+
targets,
|
|
147
|
+
records,
|
|
148
|
+
warnings,
|
|
149
|
+
errors,
|
|
150
|
+
loadedTargets: results.filter((item) => item.status === 'loaded').length,
|
|
151
|
+
failedTargets: results.filter((item) => item.status === 'failed').length,
|
|
152
|
+
deferredTargets: results.filter((item) => item.status === 'deferred').length
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function issueSurfaceTargetResult(target = {}, patch = {}) {
|
|
157
|
+
const number = Number(target.number || 0);
|
|
158
|
+
const canonicalUrl = target.canonicalUrl || target.html_url || target.url || target.input || '';
|
|
159
|
+
return Object.assign({
|
|
160
|
+
schema: 'tiinex.github.issueSnapshot.targetResult.v1',
|
|
161
|
+
repository: target.repository || (target.owner && target.repo ? `${target.owner}/${target.repo}` : ''),
|
|
162
|
+
kind: target.kind || 'issue',
|
|
163
|
+
number: Number.isFinite(number) ? number : 0,
|
|
164
|
+
url: canonicalUrl,
|
|
165
|
+
status: 'pending',
|
|
166
|
+
records: 0,
|
|
167
|
+
transportTier: '',
|
|
168
|
+
warningCode: '',
|
|
169
|
+
message: ''
|
|
170
|
+
}, patch || {});
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function issueDirectFetchForTier(source = {}, fetchImpl, diagnostics = {}) {
|
|
174
|
+
return async (url, init = {}) => {
|
|
175
|
+
const emit = (event) => diagnostics.transportEvents?.push?.(Object.assign({ adapterId: 'github', sourceId: source?.id || '', repo: source?.repo || source?.repository || '', tier: 'direct', resource: 'issue-raw', url }, event));
|
|
176
|
+
if (!fetchImpl) {
|
|
177
|
+
emit({ code: 'github.transport.direct.unavailable', severity: 'warning', message: 'Direct issue raw fetch is unavailable in this runtime.' });
|
|
178
|
+
return responseWithTransport(null, 'direct');
|
|
179
|
+
}
|
|
180
|
+
emit({ code: 'github.transport.direct.try', severity: 'info' });
|
|
181
|
+
try {
|
|
182
|
+
const res = await fetchImpl(url, init);
|
|
183
|
+
if (res?.ok) emit({ code: 'github.transport.direct.ok', severity: 'info', status: res.status || 200 });
|
|
184
|
+
else emit({ code: 'github.transport.direct.failed', severity: 'warning', status: res?.status || 0, message: res?.statusText || '' });
|
|
185
|
+
return responseWithTransport(res, 'direct');
|
|
186
|
+
} catch (error) {
|
|
187
|
+
emit({ code: 'github.transport.direct.exception', severity: 'warning', message: error?.message || String(error || '') });
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function responseWithTransport(res, tier = '', forceTier = false) {
|
|
194
|
+
// Native Response fields are brand-checked accessors. Keep an ordinary
|
|
195
|
+
// delegating object rather than prototype-shelling real Fetch responses.
|
|
196
|
+
if (!res) return makeTransportResponse('', { ok: false, status: 503, statusText: 'Transport unavailable', tier, contentType: 'application/json' });
|
|
197
|
+
if (res.transportTier && !forceTier) return res;
|
|
198
|
+
const status = Number(res.status || 0) || (res.ok ? 200 : 500);
|
|
199
|
+
const ok = res.ok !== false && status >= 200 && status < 300;
|
|
200
|
+
const headers = res.headers || { get: () => null };
|
|
201
|
+
return Object.freeze({
|
|
202
|
+
ok,
|
|
203
|
+
status,
|
|
204
|
+
statusText: res.statusText || (ok ? 'OK' : 'Error'),
|
|
205
|
+
url: res.url || '',
|
|
206
|
+
transportTier: tier,
|
|
207
|
+
headers: { get: (name) => headers.get?.(name) ?? null },
|
|
208
|
+
text: async () => {
|
|
209
|
+
if (typeof res.clone === 'function') return res.clone().text();
|
|
210
|
+
if (typeof res.text === 'function') return res.text();
|
|
211
|
+
return String(res.body || '');
|
|
212
|
+
},
|
|
213
|
+
json: async () => {
|
|
214
|
+
if (typeof res.clone === 'function') return res.clone().json();
|
|
215
|
+
if (typeof res.json === 'function') return res.json();
|
|
216
|
+
return JSON.parse(String(res.body || '{}'));
|
|
217
|
+
},
|
|
218
|
+
clone: () => responseWithTransport(typeof res.clone === 'function' ? res.clone() : res, tier)
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function makeTransportResponse(body = '', options = {}) {
|
|
223
|
+
const text = String(body || '');
|
|
224
|
+
const status = Number(options.status || 0) || (options.ok === false ? 503 : 200);
|
|
225
|
+
const ok = options.ok !== false && status >= 200 && status < 300;
|
|
226
|
+
return Object.freeze({
|
|
227
|
+
ok,
|
|
228
|
+
status,
|
|
229
|
+
statusText: options.statusText || (ok ? 'OK' : 'Error'),
|
|
230
|
+
url: options.url || '',
|
|
231
|
+
transportTier: options.tier || '',
|
|
232
|
+
headers: { get: (name) => String(name || '').toLowerCase() === 'content-type' ? (options.contentType || 'application/json') : null },
|
|
233
|
+
text: async () => text,
|
|
234
|
+
json: async () => JSON.parse(text || '{}'),
|
|
235
|
+
clone: () => makeTransportResponse(text, options)
|
|
236
|
+
});
|
|
237
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fetchGithubJson } from './github.readTransport.js';
|
|
2
|
+
export async function readExactGithubIssuePublicationRepresentation(exactTarget = {}, options = {}) {
|
|
3
|
+
const fetchImpl = options.fetchImpl || (typeof fetch !== 'undefined' ? fetch : null);
|
|
4
|
+
if (!fetchImpl) throw new Error('github-publication-verification-fetch-unavailable');
|
|
5
|
+
if (!exactTarget?.ok || exactTarget?.provider !== 'github' || !exactTarget?.owner || !exactTarget?.repo || !exactTarget?.issueNumber) throw new Error('github-publication-verification-target-unqualified');
|
|
6
|
+
const comment = exactTarget.targetKind === 'github.issue.comment';
|
|
7
|
+
const url = comment
|
|
8
|
+
? `https://api.github.com/repos/${exactTarget.owner}/${exactTarget.repo}/issues/comments/${encodeURIComponent(String(exactTarget.commentId || ''))}`
|
|
9
|
+
: `https://api.github.com/repos/${exactTarget.owner}/${exactTarget.repo}/issues/${exactTarget.issueNumber}`;
|
|
10
|
+
if (comment && !exactTarget.commentId) throw new Error('github-publication-verification-comment-id-missing');
|
|
11
|
+
const body = await fetchGithubJson(url, fetchImpl);
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
schema: 'tiinex.github.publicationVerificationObservation.v1',
|
|
14
|
+
targetKind: exactTarget.targetKind,
|
|
15
|
+
inputTarget: exactTarget.inputTarget,
|
|
16
|
+
issueTarget: exactTarget.issueTarget,
|
|
17
|
+
content: String(body?.body || ''),
|
|
18
|
+
providerReceiptId: String(body?.id || (comment ? exactTarget.commentId : exactTarget.issueNumber)),
|
|
19
|
+
observedAt: String(body?.updated_at || body?.created_at || ''),
|
|
20
|
+
method: comment ? 'github-browser-issue-reader-exact-comment-body' : 'github-browser-issue-reader-exact-issue-body',
|
|
21
|
+
transportTier: String(body?.transportTier || ''),
|
|
22
|
+
boundary: 'Read-only body observation over a target already qualified by the shared exact GitHub social target authority; this owner does not parse publication target strings or mutate GitHub.'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export async function fetchGithubJson(url, fetchImpl) {
|
|
2
|
+
if (typeof fetchImpl !== 'function') throw new Error('github-read-fetch-unavailable');
|
|
3
|
+
const res = await fetchImpl(url, { headers: { Accept: 'application/vnd.github+json' } });
|
|
4
|
+
if (!res || !res.ok) {
|
|
5
|
+
const status = res?.status || 0;
|
|
6
|
+
const statusText = res?.statusText || '';
|
|
7
|
+
let bodyMessage = '';
|
|
8
|
+
try { const body = await res.json(); bodyMessage = body?.message ? String(body.message) : ''; } catch (_) {}
|
|
9
|
+
const err = new Error([status ? `GitHub API ${status}` : 'GitHub API', statusText, bodyMessage].filter(Boolean).join(' ').trim() || 'GitHub API request failed');
|
|
10
|
+
err.status = status;
|
|
11
|
+
err.statusText = statusText;
|
|
12
|
+
err.url = url;
|
|
13
|
+
throw err;
|
|
14
|
+
}
|
|
15
|
+
const body = await res.json();
|
|
16
|
+
if (body && typeof body === 'object' && !Array.isArray(body)) body.transportTier = res.transportTier || '';
|
|
17
|
+
return body;
|
|
18
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { governanceBoundaryFromRootFiles, isGovernanceNoticePath, isGovernancePolicyPath } from '@tiinex/core/governance/governance.boundary.js';
|
|
2
|
+
|
|
3
|
+
const MARKDOWN_EXTENSIONS = /\.(md|markdown|trace\.md|schema\.md|validator\.md|workspace\.md)$/i;
|
|
4
|
+
|
|
5
|
+
function repoParts(source = {}) {
|
|
6
|
+
const repo = String(source.repo || source.repository || '').trim();
|
|
7
|
+
const parts = repo.split('/').filter(Boolean);
|
|
8
|
+
if (parts.length < 2) throw new Error('source.repo missing or invalid');
|
|
9
|
+
return { repo: `${parts[0]}/${parts[1]}`, owner: parts[0], name: parts[1] };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function rootPaths(source = {}) {
|
|
13
|
+
return String(source.rootPath || '')
|
|
14
|
+
.split(/\r?\n|,/)
|
|
15
|
+
.map((item) => item.trim().replace(/^\.\//, '').replace(/^\/+/, '').replace(/\/+$/, ''))
|
|
16
|
+
.filter((item) => item && item !== '.');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function underRoots(path, roots) {
|
|
20
|
+
if (!roots.length) return true;
|
|
21
|
+
return roots.some((root) => path === root || path.startsWith(root + '/'));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isMarkdownPath(path) {
|
|
25
|
+
return MARKDOWN_EXTENSIONS.test(String(path || ''));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function githubWorkspaceMatchPatterns(source = {}, input = {}) {
|
|
29
|
+
return String(input.workspaceMatch || source.workspaceMatch || source.match || '')
|
|
30
|
+
.split(/\r?\n|,/)
|
|
31
|
+
.map((item) => item.trim())
|
|
32
|
+
.filter(Boolean);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function matchesGithubWorkspacePattern(path = '', patterns = []) {
|
|
36
|
+
const clean = String(path || '').replace(/^\/+/, '').replace(/\\/g, '/');
|
|
37
|
+
if (!patterns || !patterns.length) return true;
|
|
38
|
+
const name = clean.split('/').filter(Boolean).pop() || clean;
|
|
39
|
+
return patterns.some((pattern) => {
|
|
40
|
+
const raw = String(pattern || '').trim().replace(/^\.\//, '');
|
|
41
|
+
if (!raw) return true;
|
|
42
|
+
const target = raw.includes('/') ? clean : name;
|
|
43
|
+
return globToRegExp(raw).test(target);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function globToRegExp(pattern = '') {
|
|
48
|
+
const source = String(pattern || '')
|
|
49
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
50
|
+
.replace(/\*\*/g, '\u0000')
|
|
51
|
+
.replace(/\*/g, '[^/]*')
|
|
52
|
+
.replace(/\?/g, '[^/]')
|
|
53
|
+
.replace(/\u0000/g, '.*');
|
|
54
|
+
return new RegExp(`^${source}$`, 'i');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function fetchJson(url, fetchImpl) {
|
|
58
|
+
const res = await fetchImpl(url, { headers: { Accept: 'application/vnd.github+json' } });
|
|
59
|
+
if (!res || !res.ok) {
|
|
60
|
+
const status = res?.status || 'ERR';
|
|
61
|
+
const statusText = res?.statusText || '';
|
|
62
|
+
let bodyMessage = '';
|
|
63
|
+
try {
|
|
64
|
+
const body = await res.json();
|
|
65
|
+
bodyMessage = body?.message ? String(body.message) : '';
|
|
66
|
+
} catch (error) {
|
|
67
|
+
bodyMessage = '';
|
|
68
|
+
}
|
|
69
|
+
const message = [String(status), statusText, bodyMessage].filter(Boolean).join(' ').trim();
|
|
70
|
+
const err = new Error(message || 'GitHub API request failed');
|
|
71
|
+
err.status = status;
|
|
72
|
+
err.statusText = statusText;
|
|
73
|
+
err.url = url;
|
|
74
|
+
return Promise.reject(err);
|
|
75
|
+
}
|
|
76
|
+
return res.json();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export async function resolveGithubSourceRef(source, options = {}) {
|
|
80
|
+
const fetchImpl = options.fetchImpl || (typeof fetch !== 'undefined' ? fetch : null);
|
|
81
|
+
if (!fetchImpl) throw new Error('fetchImpl not available');
|
|
82
|
+
const explicit = String(source?.ref || '').trim();
|
|
83
|
+
if (explicit) return { ref: explicit, resolvedBy: 'source.ref' };
|
|
84
|
+
const { owner, name } = repoParts(source);
|
|
85
|
+
const data = await fetchJson(`https://api.github.com/repos/${owner}/${name}`, fetchImpl);
|
|
86
|
+
const ref = String(data.default_branch || '').trim();
|
|
87
|
+
if (!ref) throw new Error('default branch unavailable');
|
|
88
|
+
return { ref, resolvedBy: 'github.repo.default_branch' };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function exactGithubCommit(value = '') { const commit = String(value || '').trim(); return /^[0-9a-f]{40}$/i.test(commit) ? commit : ''; }
|
|
92
|
+
|
|
93
|
+
export function githubRefResolutionRequestCount(source = {}) {
|
|
94
|
+
if (exactGithubCommit(source?.materializedCommit)) return 0;
|
|
95
|
+
const ref = String(source?.ref || '').trim();
|
|
96
|
+
if (!ref) return 2;
|
|
97
|
+
return exactGithubCommit(ref) ? 0 : 1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function githubRepoDiscoveryRequestCount(source = {}) {
|
|
101
|
+
return githubRefResolutionRequestCount(source) + 1;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export async function resolveGithubMaterializedCommit(source, ref = '', options = {}) {
|
|
105
|
+
const fetchImpl = options.fetchImpl || (typeof fetch !== 'undefined' ? fetch : null);
|
|
106
|
+
if (!fetchImpl) throw new Error('fetchImpl not available');
|
|
107
|
+
const selectedRef = String(ref || source?.ref || '').trim();
|
|
108
|
+
const resolved = selectedRef ? { ref: selectedRef, resolvedBy: 'source.ref' } : await resolveGithubSourceRef(source, { fetchImpl });
|
|
109
|
+
if (exactGithubCommit(resolved.ref)) return { ...resolved, commit: resolved.ref, commitResolvedBy: 'source.ref.exact-commit' };
|
|
110
|
+
const { owner, name } = repoParts(source);
|
|
111
|
+
const data = await fetchJson(`https://api.github.com/repos/${owner}/${name}/commits/${encodeURIComponent(resolved.ref)}`, fetchImpl);
|
|
112
|
+
const commit = String(data.sha || '').trim();
|
|
113
|
+
if (!exactGithubCommit(commit)) throw new Error('resolved GitHub commit unavailable');
|
|
114
|
+
return { ...resolved, commit, commitResolvedBy: 'github.commit-resolution' };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
export async function tryResolveGithubMaterializedCommit(source, ref = '', options = {}) {
|
|
119
|
+
try { return exactGithubCommit((await resolveGithubMaterializedCommit(source, ref, options)).commit); }
|
|
120
|
+
catch (_) { return ''; }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function discoverGithubMarkdownRefs(source, options = {}) {
|
|
124
|
+
const fetchImpl = options.fetchImpl || (typeof fetch !== 'undefined' ? fetch : null);
|
|
125
|
+
if (!fetchImpl) throw new Error('fetchImpl not available');
|
|
126
|
+
const maxFiles = Math.max(1, Number(options.maxFiles || 500));
|
|
127
|
+
const { owner, name } = repoParts(source);
|
|
128
|
+
const prequalifiedCommit = exactGithubCommit(source?.materializedCommit);
|
|
129
|
+
const configuredRef = String(source?.ref || '').trim();
|
|
130
|
+
const resolved = prequalifiedCommit
|
|
131
|
+
? { ref: configuredRef, resolvedBy: configuredRef ? 'source.ref' : 'source.materializedCommit.prequalified' }
|
|
132
|
+
: await resolveGithubSourceRef(source, { fetchImpl });
|
|
133
|
+
const materializedCommit = prequalifiedCommit || await tryResolveGithubMaterializedCommit(source, resolved.ref, { fetchImpl });
|
|
134
|
+
const treeRef = materializedCommit || resolved.ref;
|
|
135
|
+
const treeUrl = `https://api.github.com/repos/${owner}/${name}/git/trees/${encodeURIComponent(treeRef)}?recursive=1`;
|
|
136
|
+
const tree = await fetchJson(treeUrl, fetchImpl);
|
|
137
|
+
const roots = rootPaths(source);
|
|
138
|
+
const patterns = githubWorkspaceMatchPatterns(source, options);
|
|
139
|
+
const refs = [];
|
|
140
|
+
const warnings = [];
|
|
141
|
+
const governanceRootFiles = [];
|
|
142
|
+
for (const item of Array.isArray(tree.tree) ? tree.tree : []) {
|
|
143
|
+
const path = String(item.path || '').replace(/^\/+/, '');
|
|
144
|
+
if (item.type !== 'blob') continue;
|
|
145
|
+
if (!path.includes('/') && (isGovernancePolicyPath(path) || isGovernanceNoticePath(path))) governanceRootFiles.push({ path, kind: path });
|
|
146
|
+
if (!underRoots(path, roots)) continue;
|
|
147
|
+
if (!isMarkdownPath(path)) continue;
|
|
148
|
+
if (!matchesGithubWorkspacePattern(path, patterns)) continue;
|
|
149
|
+
if (refs.length < maxFiles) refs.push(path);
|
|
150
|
+
}
|
|
151
|
+
refs.sort((a, b) => a.localeCompare(b));
|
|
152
|
+
if (tree.truncated) warnings.push({ code: 'github.tree.truncated', message: 'GitHub tree response was truncated.' });
|
|
153
|
+
const totalMarkdown = (Array.isArray(tree.tree) ? tree.tree : []).filter((item) => item.type === 'blob' && underRoots(String(item.path || ''), roots) && isMarkdownPath(item.path) && matchesGithubWorkspacePattern(String(item.path || ''), patterns)).length;
|
|
154
|
+
if (totalMarkdown > refs.length) warnings.push({ code: 'github.discovery.bounded', message: `Loaded first ${refs.length} of ${totalMarkdown} markdown files.` });
|
|
155
|
+
return { refs, warnings, ref: resolved.ref, resolvedBy: resolved.resolvedBy, materializedCommit, treeUrl, totalMarkdown, governanceBoundary: governanceBoundaryFromRootFiles(Object.assign({}, source, { ref: materializedCommit || resolved.ref }), governanceRootFiles, { rootChecked: true, discoveredFrom: 'github-tree-root-manifest' }) };
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function qualifyGithubSnapshotInput(source = {}, input = '') {
|
|
159
|
+
const target = String(input || '').trim();
|
|
160
|
+
if (!target) return snapshotFailure('github.snapshot.input.required', 'Enter an exact commit, GitHub tree/commit URL, or explicit ref.');
|
|
161
|
+
let configured;
|
|
162
|
+
try { configured = repoParts(source); }
|
|
163
|
+
catch (_) { return snapshotFailure('github.snapshot.source.unsupported', 'A configured GitHub repository source is required.'); }
|
|
164
|
+
|
|
165
|
+
if (exactGithubCommit(target)) return snapshotQualification(configured.repo, target, target, 'explicit-commit');
|
|
166
|
+
|
|
167
|
+
if (/^https?:\/\//i.test(target)) {
|
|
168
|
+
let url;
|
|
169
|
+
try { url = new URL(target); }
|
|
170
|
+
catch (_) { return snapshotFailure('github.snapshot.target.malformed', 'Snapshot target URL is malformed.'); }
|
|
171
|
+
if (url.hostname.toLowerCase() !== 'github.com') return snapshotFailure('github.snapshot.target.unsupported-host', 'Snapshot target must use github.com.');
|
|
172
|
+
const parts = url.pathname.replace(/^\/+|\/+$/g, '').split('/').filter(Boolean);
|
|
173
|
+
if (parts.length < 4) return snapshotFailure('github.snapshot.target.unsupported', 'Use a GitHub commit or tree URL.');
|
|
174
|
+
const repository = `${parts[0]}/${String(parts[1] || '').replace(/\.git$/i, '')}`;
|
|
175
|
+
if (repository.toLowerCase() !== configured.repo.toLowerCase()) return snapshotFailure('github.snapshot.repository.mismatch', 'Snapshot target must belong to the configured source repository.');
|
|
176
|
+
const kind = String(parts[2] || '').toLowerCase();
|
|
177
|
+
if (kind === 'commit') {
|
|
178
|
+
const commit = exactGithubCommit(parts[3]);
|
|
179
|
+
return commit
|
|
180
|
+
? snapshotQualification(repository, commit, target, 'github-commit-url')
|
|
181
|
+
: snapshotFailure('github.snapshot.commit-url.exact-required', 'GitHub commit URL must contain an exact 40-character commit SHA.');
|
|
182
|
+
}
|
|
183
|
+
if (kind === 'tree') {
|
|
184
|
+
if (exactGithubCommit(parts[3])) return snapshotQualification(repository, parts[3], target, 'github-tree-url-exact-commit');
|
|
185
|
+
if (parts.length !== 4) return snapshotFailure('github.snapshot.tree-ref.ambiguous', 'Tree URL ref is ambiguous with a repository path. Paste the ref directly or use an exact commit URL.');
|
|
186
|
+
return snapshotQualification(repository, parts[3], target, 'github-tree-url-ref');
|
|
187
|
+
}
|
|
188
|
+
return snapshotFailure('github.snapshot.target.unsupported', 'Use a GitHub commit or tree URL.');
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (/\s/.test(target) || target.includes('://')) return snapshotFailure('github.snapshot.ref.invalid', 'Git ref must be an explicit branch, tag, or commit without whitespace.');
|
|
192
|
+
return snapshotQualification(configured.repo, target, target, 'explicit-ref');
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export async function resolveGithubSnapshotInput(source = {}, input = '', options = {}) {
|
|
196
|
+
const qualified = qualifyGithubSnapshotInput(source, input);
|
|
197
|
+
if (!qualified.ok) return qualified;
|
|
198
|
+
const exact = exactGithubCommit(qualified.requestedRef);
|
|
199
|
+
if (exact) return Object.assign({}, qualified, { materializedCommit: exact.toLowerCase(), resolvedRef: exact.toLowerCase(), resolvedBy: qualified.resolvedBy });
|
|
200
|
+
try {
|
|
201
|
+
const resolved = await resolveGithubMaterializedCommit(source, qualified.requestedRef, options);
|
|
202
|
+
const commit = exactGithubCommit(resolved.commit);
|
|
203
|
+
if (!commit) return snapshotFailure('github.snapshot.commit.unavailable', 'Git ref did not resolve to an exact immutable commit.');
|
|
204
|
+
return Object.assign({}, qualified, {
|
|
205
|
+
materializedCommit: commit.toLowerCase(),
|
|
206
|
+
resolvedRef: String(resolved.ref || qualified.requestedRef).trim(),
|
|
207
|
+
resolvedBy: resolved.commitResolvedBy || resolved.resolvedBy || 'github.commit-resolution'
|
|
208
|
+
});
|
|
209
|
+
} catch (error) {
|
|
210
|
+
const failure = snapshotFailure('github.snapshot.resolution.failed', error?.message || 'GitHub snapshot resolution failed.');
|
|
211
|
+
failure.status = error?.status || null;
|
|
212
|
+
return failure;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function snapshotQualification(repository, requestedRef, inputTarget, resolvedBy) {
|
|
217
|
+
return { ok: true, schema: 'tiinex.github.snapshotInput.v1', repository, requestedRef: String(requestedRef || '').trim(), inputTarget: String(inputTarget || '').trim(), resolvedBy };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function snapshotFailure(code, message) {
|
|
221
|
+
return { ok: false, schema: 'tiinex.github.snapshotInput.v1', code, message };
|
|
222
|
+
}
|