From 3cfc6360c75efa3c4b39c0096050179999096cea Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sun, 9 Aug 2026 18:59:16 +0000 Subject: [PATCH] Make the @logicsrc packages publishable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @logicsrc/opencontext could not be installed from npm. Three defects, each of which alone breaks a published tarball: 1. opencontext depended on "@logicsrc/validators": "file:../validators". A file: specifier is unresolvable for anyone installing from the registry, so `npm install @logicsrc/opencontext` failed outright. 2. validators imported all 50 schemas by relative path across the repository ("../../schemas/schemas/*.json"). That resolves inside the monorepo and escapes the package once published, so an installed validators could not load a single schema. Now imported through @logicsrc/schemas package exports, with a real dependency declared. 3. Three of those schemas — repo, pull-request, openprd-prd — had no entry in the schemas exports map, so they were unreachable by package specifier. Added; the map is now sorted so it stays readable as it grows. validators also gained files/publishConfig/license so it publishes the same way its siblings do. Verified the way a stranger would: npm pack all three, install the tarballs into a clean project outside the monorepo, and run the installed binary — version, init, validate --strict (which exercises schema loading through the package exports), and resolve --explain all succeed. Full workspace suite green. Co-Authored-By: Claude Opus 5 (1M context) --- package-lock.json | 4 +- packages/opencontext/package.json | 2 +- packages/schemas/package.json | 75 ++++++++++---------- packages/validators/package.json | 10 ++- packages/validators/src/schemas.ts | 109 ++++++++++++++++------------- 5 files changed, 111 insertions(+), 89 deletions(-) diff --git a/package-lock.json b/package-lock.json index fcb71a5..977123c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7812,7 +7812,7 @@ "license": "MIT", "dependencies": { "@libsql/client": "^0.17.4", - "@logicsrc/validators": "file:../validators", + "@logicsrc/validators": "^0.1.0", "commander": "^14.0.2", "yaml": "^2.8.1" }, @@ -7885,7 +7885,9 @@ "packages/validators": { "name": "@logicsrc/validators", "version": "0.1.0", + "license": "MIT", "dependencies": { + "@logicsrc/schemas": "^0.1.0", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "yaml": "^2.8.1" diff --git a/packages/opencontext/package.json b/packages/opencontext/package.json index 7a0ac3f..49db4a5 100644 --- a/packages/opencontext/package.json +++ b/packages/opencontext/package.json @@ -43,7 +43,7 @@ }, "dependencies": { "@libsql/client": "^0.17.4", - "@logicsrc/validators": "file:../validators", + "@logicsrc/validators": "^0.1.0", "commander": "^14.0.2", "yaml": "^2.8.1" }, diff --git a/packages/schemas/package.json b/packages/schemas/package.json index 4df1e7a..461ac51 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -28,55 +28,58 @@ "access": "public" }, "exports": { - "./task": "./schemas/logicsrc-task.schema.json", - "./agent": "./schemas/logicsrc-agent.schema.json", - "./run": "./schemas/logicsrc-run.schema.json", - "./event": "./schemas/logicsrc-event.schema.json", - "./plugin": "./schemas/logicsrc-plugin.schema.json", - "./connected-account": "./schemas/logicsrc-connected-account.schema.json", - "./account-provider": "./schemas/logicsrc-account-provider.schema.json", - "./account-grant": "./schemas/logicsrc-account-grant.schema.json", "./account-audit-event": "./schemas/logicsrc-account-audit-event.schema.json", - "./email-message": "./schemas/logicsrc-email-message.schema.json", - "./social-post": "./schemas/logicsrc-social-post.schema.json", + "./account-grant": "./schemas/logicsrc-account-grant.schema.json", + "./account-provider": "./schemas/logicsrc-account-provider.schema.json", + "./agent": "./schemas/logicsrc-agent.schema.json", "./agentad-ad": "./schemas/agentad-ad.schema.json", - "./agentad-placement": "./schemas/agentad-placement.schema.json", "./agentad-ad-request": "./schemas/agentad-ad-request.schema.json", "./agentad-ad-response": "./schemas/agentad-ad-response.schema.json", - "./agentad-impression": "./schemas/agentad-impression.schema.json", - "./agentad-click": "./schemas/agentad-click.schema.json", "./agentad-campaign": "./schemas/agentad-campaign.schema.json", + "./agentad-click": "./schemas/agentad-click.schema.json", + "./agentad-impression": "./schemas/agentad-impression.schema.json", + "./agentad-placement": "./schemas/agentad-placement.schema.json", + "./connected-account": "./schemas/logicsrc-connected-account.schema.json", + "./credential-audit-event": "./schemas/logicsrc-credential-audit-event.schema.json", "./credential-provider": "./schemas/logicsrc-credential-provider.schema.json", "./credential-sync-plan": "./schemas/logicsrc-credential-sync-plan.schema.json", "./credential-sync-run": "./schemas/logicsrc-credential-sync-run.schema.json", - "./credential-audit-event": "./schemas/logicsrc-credential-audit-event.schema.json", + "./email-message": "./schemas/logicsrc-email-message.schema.json", + "./event": "./schemas/logicsrc-event.schema.json", + "./opencontext-audit-event": "./schemas/logicsrc-opencontext-audit-event.schema.json", + "./opencontext-bundle": "./schemas/logicsrc-opencontext-bundle.schema.json", + "./opencontext-conformance": "./fixtures/opencontext/conformance.json", + "./opencontext-decision": "./schemas/logicsrc-opencontext-decision.schema.json", + "./opencontext-diagnostic": "./schemas/logicsrc-opencontext-diagnostic.schema.json", + "./opencontext-manifest": "./schemas/logicsrc-opencontext-manifest.schema.json", + "./opencontext-object": "./schemas/logicsrc-opencontext-object.schema.json", + "./opencontext-provenance": "./schemas/logicsrc-opencontext-provenance.schema.json", + "./opencontext-role": "./schemas/logicsrc-opencontext-role.schema.json", + "./openontology-action": "./schemas/logicsrc-openontology-action.schema.json", + "./openontology-approval": "./schemas/logicsrc-openontology-approval.schema.json", + "./openontology-changeset": "./schemas/logicsrc-openontology-changeset.schema.json", + "./openontology-claim": "./schemas/logicsrc-openontology-claim.schema.json", + "./openontology-conformance": "./fixtures/openontology/conformance.json", + "./openontology-constraint": "./schemas/logicsrc-openontology-constraint.schema.json", + "./openontology-entity": "./schemas/logicsrc-openontology-entity.schema.json", + "./openontology-entity-type": "./schemas/logicsrc-openontology-entity-type.schema.json", + "./openontology-event": "./schemas/logicsrc-openontology-event.schema.json", + "./openontology-evidence": "./schemas/logicsrc-openontology-evidence.schema.json", "./openontology-manifest": "./schemas/logicsrc-openontology-manifest.schema.json", "./openontology-namespace": "./schemas/logicsrc-openontology-namespace.schema.json", - "./openontology-entity-type": "./schemas/logicsrc-openontology-entity-type.schema.json", + "./openontology-package": "./schemas/logicsrc-openontology-package.schema.json", "./openontology-property": "./schemas/logicsrc-openontology-property.schema.json", - "./openontology-relationship-type": "./schemas/logicsrc-openontology-relationship-type.schema.json", - "./openontology-constraint": "./schemas/logicsrc-openontology-constraint.schema.json", "./openontology-query": "./schemas/logicsrc-openontology-query.schema.json", - "./openontology-action": "./schemas/logicsrc-openontology-action.schema.json", - "./openontology-entity": "./schemas/logicsrc-openontology-entity.schema.json", - "./openontology-claim": "./schemas/logicsrc-openontology-claim.schema.json", - "./openontology-source": "./schemas/logicsrc-openontology-source.schema.json", - "./openontology-evidence": "./schemas/logicsrc-openontology-evidence.schema.json", - "./openontology-changeset": "./schemas/logicsrc-openontology-changeset.schema.json", + "./openontology-relationship-type": "./schemas/logicsrc-openontology-relationship-type.schema.json", "./openontology-review": "./schemas/logicsrc-openontology-review.schema.json", - "./openontology-approval": "./schemas/logicsrc-openontology-approval.schema.json", - "./openontology-event": "./schemas/logicsrc-openontology-event.schema.json", - "./openontology-package": "./schemas/logicsrc-openontology-package.schema.json", - "./openontology-conformance": "./fixtures/openontology/conformance.json", - "./opencontext-manifest": "./schemas/logicsrc-opencontext-manifest.schema.json", - "./opencontext-object": "./schemas/logicsrc-opencontext-object.schema.json", - "./opencontext-bundle": "./schemas/logicsrc-opencontext-bundle.schema.json", - "./opencontext-role": "./schemas/logicsrc-opencontext-role.schema.json", - "./opencontext-provenance": "./schemas/logicsrc-opencontext-provenance.schema.json", - "./opencontext-decision": "./schemas/logicsrc-opencontext-decision.schema.json", - "./opencontext-diagnostic": "./schemas/logicsrc-opencontext-diagnostic.schema.json", - "./opencontext-audit-event": "./schemas/logicsrc-opencontext-audit-event.schema.json", - "./opencontext-conformance": "./fixtures/opencontext/conformance.json" + "./openontology-source": "./schemas/logicsrc-openontology-source.schema.json", + "./openprd-prd": "./schemas/openprd-prd.schema.json", + "./plugin": "./schemas/logicsrc-plugin.schema.json", + "./pull-request": "./schemas/logicsrc-pull-request.schema.json", + "./repo": "./schemas/logicsrc-repo.schema.json", + "./run": "./schemas/logicsrc-run.schema.json", + "./social-post": "./schemas/logicsrc-social-post.schema.json", + "./task": "./schemas/logicsrc-task.schema.json" }, "files": [ "schemas", diff --git a/packages/validators/package.json b/packages/validators/package.json index 3a3c496..e1ca58c 100644 --- a/packages/validators/package.json +++ b/packages/validators/package.json @@ -14,11 +14,19 @@ "validate:fixtures": "node dist/cli.js task ../schemas/fixtures/task.yaml && node dist/cli.js agent ../schemas/fixtures/agent.yaml && node dist/cli.js agentad-ad ../schemas/fixtures/agentad-ad.yaml && node dist/cli.js agentad-placement ../schemas/fixtures/agentad-placement.yaml && node dist/cli.js repo ../schemas/fixtures/repo.yaml && node dist/cli.js pull-request ../schemas/fixtures/pull-request.yaml && node dist/cli.js openontology-manifest ../schemas/fixtures/openontology/valid/manifest.json && node dist/cli.js openontology-claim ../schemas/fixtures/openontology/valid/claim-relationship.json && node dist/cli.js openontology-changeset ../schemas/fixtures/openontology/valid/changeset.json && node dist/cli.js opencontext-manifest ../schemas/fixtures/opencontext/valid/manifest.json && node dist/cli.js opencontext-object ../schemas/fixtures/opencontext/valid/object-policy.json && node dist/cli.js opencontext-bundle ../schemas/fixtures/opencontext/valid/bundle.json && node dist/cli.js opencontext-decision ../schemas/fixtures/opencontext/valid/decision.json && node dist/cli.js opencontext-role ../schemas/fixtures/opencontext/valid/role.json && node dist/cli.js opencontext-provenance ../schemas/fixtures/opencontext/valid/provenance.json && node dist/cli.js opencontext-diagnostic ../schemas/fixtures/opencontext/valid/diagnostic.json && node dist/cli.js opencontext-audit-event ../schemas/fixtures/opencontext/valid/audit-event.json" }, "dependencies": { + "@logicsrc/schemas": "^0.1.0", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "yaml": "^2.8.1" }, "devDependencies": { "vitest": "^4.0.8" - } + }, + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "license": "MIT" } diff --git a/packages/validators/src/schemas.ts b/packages/validators/src/schemas.ts index b2c0feb..fccf685 100644 --- a/packages/validators/src/schemas.ts +++ b/packages/validators/src/schemas.ts @@ -1,54 +1,63 @@ -import agentSchema from "../../schemas/schemas/logicsrc-agent.schema.json" with { type: "json" }; -import accountAuditEventSchema from "../../schemas/schemas/logicsrc-account-audit-event.schema.json" with { type: "json" }; -import accountGrantSchema from "../../schemas/schemas/logicsrc-account-grant.schema.json" with { type: "json" }; -import accountProviderSchema from "../../schemas/schemas/logicsrc-account-provider.schema.json" with { type: "json" }; -import connectedAccountSchema from "../../schemas/schemas/logicsrc-connected-account.schema.json" with { type: "json" }; -import emailMessageSchema from "../../schemas/schemas/logicsrc-email-message.schema.json" with { type: "json" }; -import eventSchema from "../../schemas/schemas/logicsrc-event.schema.json" with { type: "json" }; -import pluginSchema from "../../schemas/schemas/logicsrc-plugin.schema.json" with { type: "json" }; -import pullRequestSchema from "../../schemas/schemas/logicsrc-pull-request.schema.json" with { type: "json" }; -import repoSchema from "../../schemas/schemas/logicsrc-repo.schema.json" with { type: "json" }; -import runSchema from "../../schemas/schemas/logicsrc-run.schema.json" with { type: "json" }; -import socialPostSchema from "../../schemas/schemas/logicsrc-social-post.schema.json" with { type: "json" }; -import taskSchema from "../../schemas/schemas/logicsrc-task.schema.json" with { type: "json" }; -import agentadAdSchema from "../../schemas/schemas/agentad-ad.schema.json" with { type: "json" }; -import agentadPlacementSchema from "../../schemas/schemas/agentad-placement.schema.json" with { type: "json" }; -import agentadAdRequestSchema from "../../schemas/schemas/agentad-ad-request.schema.json" with { type: "json" }; -import agentadAdResponseSchema from "../../schemas/schemas/agentad-ad-response.schema.json" with { type: "json" }; -import agentadImpressionSchema from "../../schemas/schemas/agentad-impression.schema.json" with { type: "json" }; -import agentadClickSchema from "../../schemas/schemas/agentad-click.schema.json" with { type: "json" }; -import agentadCampaignSchema from "../../schemas/schemas/agentad-campaign.schema.json" with { type: "json" }; -import credentialProviderSchema from "../../schemas/schemas/logicsrc-credential-provider.schema.json" with { type: "json" }; -import credentialSyncPlanSchema from "../../schemas/schemas/logicsrc-credential-sync-plan.schema.json" with { type: "json" }; -import credentialSyncRunSchema from "../../schemas/schemas/logicsrc-credential-sync-run.schema.json" with { type: "json" }; -import credentialAuditEventSchema from "../../schemas/schemas/logicsrc-credential-audit-event.schema.json" with { type: "json" }; -import openprdPrdSchema from "../../schemas/schemas/openprd-prd.schema.json" with { type: "json" }; -import ontologyManifestSchema from "../../schemas/schemas/logicsrc-openontology-manifest.schema.json" with { type: "json" }; -import ontologyNamespaceSchema from "../../schemas/schemas/logicsrc-openontology-namespace.schema.json" with { type: "json" }; -import ontologyEntityTypeSchema from "../../schemas/schemas/logicsrc-openontology-entity-type.schema.json" with { type: "json" }; -import ontologyPropertySchema from "../../schemas/schemas/logicsrc-openontology-property.schema.json" with { type: "json" }; -import ontologyRelationshipTypeSchema from "../../schemas/schemas/logicsrc-openontology-relationship-type.schema.json" with { type: "json" }; -import ontologyConstraintSchema from "../../schemas/schemas/logicsrc-openontology-constraint.schema.json" with { type: "json" }; -import ontologyQuerySchema from "../../schemas/schemas/logicsrc-openontology-query.schema.json" with { type: "json" }; -import ontologyActionSchema from "../../schemas/schemas/logicsrc-openontology-action.schema.json" with { type: "json" }; -import ontologyEntitySchema from "../../schemas/schemas/logicsrc-openontology-entity.schema.json" with { type: "json" }; -import ontologyClaimSchema from "../../schemas/schemas/logicsrc-openontology-claim.schema.json" with { type: "json" }; -import ontologySourceSchema from "../../schemas/schemas/logicsrc-openontology-source.schema.json" with { type: "json" }; -import ontologyEvidenceSchema from "../../schemas/schemas/logicsrc-openontology-evidence.schema.json" with { type: "json" }; -import ontologyChangeSetSchema from "../../schemas/schemas/logicsrc-openontology-changeset.schema.json" with { type: "json" }; -import ontologyReviewSchema from "../../schemas/schemas/logicsrc-openontology-review.schema.json" with { type: "json" }; -import ontologyApprovalSchema from "../../schemas/schemas/logicsrc-openontology-approval.schema.json" with { type: "json" }; -import ontologyEventSchema from "../../schemas/schemas/logicsrc-openontology-event.schema.json" with { type: "json" }; -import ontologyPackageSchema from "../../schemas/schemas/logicsrc-openontology-package.schema.json" with { type: "json" }; +/** + * Every LogicSRC JSON Schema, keyed by kind. + * + * Schemas are imported through @logicsrc/schemas package exports rather than by + * a relative path across the repository. A relative import works in the + * monorepo and breaks the moment this package is published: "../../schemas/..." + * resolves outside the published tarball, so an installed @logicsrc/validators + * could not load a single schema. + */ +import agentSchema from "@logicsrc/schemas/agent" with { type: "json" }; +import accountAuditEventSchema from "@logicsrc/schemas/account-audit-event" with { type: "json" }; +import accountGrantSchema from "@logicsrc/schemas/account-grant" with { type: "json" }; +import accountProviderSchema from "@logicsrc/schemas/account-provider" with { type: "json" }; +import connectedAccountSchema from "@logicsrc/schemas/connected-account" with { type: "json" }; +import emailMessageSchema from "@logicsrc/schemas/email-message" with { type: "json" }; +import eventSchema from "@logicsrc/schemas/event" with { type: "json" }; +import pluginSchema from "@logicsrc/schemas/plugin" with { type: "json" }; +import pullRequestSchema from "@logicsrc/schemas/pull-request" with { type: "json" }; +import repoSchema from "@logicsrc/schemas/repo" with { type: "json" }; +import runSchema from "@logicsrc/schemas/run" with { type: "json" }; +import socialPostSchema from "@logicsrc/schemas/social-post" with { type: "json" }; +import taskSchema from "@logicsrc/schemas/task" with { type: "json" }; +import agentadAdSchema from "@logicsrc/schemas/agentad-ad" with { type: "json" }; +import agentadPlacementSchema from "@logicsrc/schemas/agentad-placement" with { type: "json" }; +import agentadAdRequestSchema from "@logicsrc/schemas/agentad-ad-request" with { type: "json" }; +import agentadAdResponseSchema from "@logicsrc/schemas/agentad-ad-response" with { type: "json" }; +import agentadImpressionSchema from "@logicsrc/schemas/agentad-impression" with { type: "json" }; +import agentadClickSchema from "@logicsrc/schemas/agentad-click" with { type: "json" }; +import agentadCampaignSchema from "@logicsrc/schemas/agentad-campaign" with { type: "json" }; +import credentialProviderSchema from "@logicsrc/schemas/credential-provider" with { type: "json" }; +import credentialSyncPlanSchema from "@logicsrc/schemas/credential-sync-plan" with { type: "json" }; +import credentialSyncRunSchema from "@logicsrc/schemas/credential-sync-run" with { type: "json" }; +import credentialAuditEventSchema from "@logicsrc/schemas/credential-audit-event" with { type: "json" }; +import openprdPrdSchema from "@logicsrc/schemas/openprd-prd" with { type: "json" }; +import ontologyManifestSchema from "@logicsrc/schemas/openontology-manifest" with { type: "json" }; +import ontologyNamespaceSchema from "@logicsrc/schemas/openontology-namespace" with { type: "json" }; +import ontologyEntityTypeSchema from "@logicsrc/schemas/openontology-entity-type" with { type: "json" }; +import ontologyPropertySchema from "@logicsrc/schemas/openontology-property" with { type: "json" }; +import ontologyRelationshipTypeSchema from "@logicsrc/schemas/openontology-relationship-type" with { type: "json" }; +import ontologyConstraintSchema from "@logicsrc/schemas/openontology-constraint" with { type: "json" }; +import ontologyQuerySchema from "@logicsrc/schemas/openontology-query" with { type: "json" }; +import ontologyActionSchema from "@logicsrc/schemas/openontology-action" with { type: "json" }; +import ontologyEntitySchema from "@logicsrc/schemas/openontology-entity" with { type: "json" }; +import ontologyClaimSchema from "@logicsrc/schemas/openontology-claim" with { type: "json" }; +import ontologySourceSchema from "@logicsrc/schemas/openontology-source" with { type: "json" }; +import ontologyEvidenceSchema from "@logicsrc/schemas/openontology-evidence" with { type: "json" }; +import ontologyChangeSetSchema from "@logicsrc/schemas/openontology-changeset" with { type: "json" }; +import ontologyReviewSchema from "@logicsrc/schemas/openontology-review" with { type: "json" }; +import ontologyApprovalSchema from "@logicsrc/schemas/openontology-approval" with { type: "json" }; +import ontologyEventSchema from "@logicsrc/schemas/openontology-event" with { type: "json" }; +import ontologyPackageSchema from "@logicsrc/schemas/openontology-package" with { type: "json" }; -import ocManifestSchema from "../../schemas/schemas/logicsrc-opencontext-manifest.schema.json" with { type: "json" }; -import ocObjectSchema from "../../schemas/schemas/logicsrc-opencontext-object.schema.json" with { type: "json" }; -import ocBundleSchema from "../../schemas/schemas/logicsrc-opencontext-bundle.schema.json" with { type: "json" }; -import ocRoleSchema from "../../schemas/schemas/logicsrc-opencontext-role.schema.json" with { type: "json" }; -import ocProvenanceSchema from "../../schemas/schemas/logicsrc-opencontext-provenance.schema.json" with { type: "json" }; -import ocDecisionSchema from "../../schemas/schemas/logicsrc-opencontext-decision.schema.json" with { type: "json" }; -import ocDiagnosticSchema from "../../schemas/schemas/logicsrc-opencontext-diagnostic.schema.json" with { type: "json" }; -import ocAuditEventSchema from "../../schemas/schemas/logicsrc-opencontext-audit-event.schema.json" with { type: "json" }; +import ocManifestSchema from "@logicsrc/schemas/opencontext-manifest" with { type: "json" }; +import ocObjectSchema from "@logicsrc/schemas/opencontext-object" with { type: "json" }; +import ocBundleSchema from "@logicsrc/schemas/opencontext-bundle" with { type: "json" }; +import ocRoleSchema from "@logicsrc/schemas/opencontext-role" with { type: "json" }; +import ocProvenanceSchema from "@logicsrc/schemas/opencontext-provenance" with { type: "json" }; +import ocDecisionSchema from "@logicsrc/schemas/opencontext-decision" with { type: "json" }; +import ocDiagnosticSchema from "@logicsrc/schemas/opencontext-diagnostic" with { type: "json" }; +import ocAuditEventSchema from "@logicsrc/schemas/opencontext-audit-event" with { type: "json" }; export const schemas = { agent: agentSchema,