Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions packages/assets/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
# SMRT auto-generated routes (from Vite plugin)
src/routes/api/**/+server.ts
# BEGIN SMRT auto-generated routes (Vite plugin)
src/routes/api/_changes/+server.ts
src/routes/api/_events/+server.ts
src/routes/api/assetassociations/\[id\]/+server.ts
src/routes/api/assetassociations/+server.ts
src/routes/api/assetassociations/attach/+server.ts
src/routes/api/assetassociations/byLeft/+server.ts
src/routes/api/assetassociations/byRight/+server.ts
src/routes/api/assetassociations/detach/+server.ts
src/routes/api/assetassociations/setLinks/+server.ts
src/routes/api/assetmetafields/\[id\]/+server.ts
src/routes/api/assetmetafields/+server.ts
src/routes/api/assetmetafields/getOrCreate/+server.ts
src/routes/api/assetmetafields/initializeCommonMetafields/+server.ts
src/routes/api/assets/\[id\]/+server.ts
src/routes/api/assets/+server.ts
src/routes/api/assets/addTag/+server.ts
src/routes/api/assets/createNewVersion/+server.ts
src/routes/api/assets/findByTenant/+server.ts
src/routes/api/assets/findGlobal/+server.ts
src/routes/api/assets/findWithGlobals/+server.ts
src/routes/api/assets/getByFolder/+server.ts
src/routes/api/assets/getByMimeType/+server.ts
src/routes/api/assets/getByOwner/+server.ts
src/routes/api/assets/getByStatus/+server.ts
src/routes/api/assets/getByTag/+server.ts
src/routes/api/assets/getByType/+server.ts
src/routes/api/assets/getDerivatives/+server.ts
src/routes/api/assets/getLatestVersion/+server.ts
src/routes/api/assets/listVersions/+server.ts
src/routes/api/assets/removeTag/+server.ts
src/routes/api/assets/rollbackToVersion/+server.ts
src/routes/api/assetstatuses/\[id\]/+server.ts
src/routes/api/assetstatuses/+server.ts
src/routes/api/assetstatuses/getOrCreate/+server.ts
src/routes/api/assetstatuses/initializeCommonStatuses/+server.ts
src/routes/api/assettypes/\[id\]/+server.ts
src/routes/api/assettypes/+server.ts
src/routes/api/assettypes/getOrCreate/+server.ts
src/routes/api/assettypes/initializeCommonTypes/+server.ts
src/routes/api/folders/\[id\]/+server.ts
src/routes/api/folders/+server.ts
src/routes/api/folders/getContents/+server.ts
src/routes/api/folders/getPath/+server.ts
src/routes/api/folders/getTree/+server.ts
src/routes/api/folders/moveAsset/+server.ts
src/routes/api/sync/apply/+server.ts
# END SMRT auto-generated routes (Vite plugin)
114 changes: 113 additions & 1 deletion packages/content/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,115 @@
# SMRT auto-generated routes (from Vite plugin)
# Spillover guard (#2199). `svelte-check`, via `pnpm typecheck`, runs a second
# route-generation pass using the plugin's DEFAULT routesDir, emitting a
# duplicate API surface directly under src/routes/api/. This package's real
# generated routes live under src/routes/api/v1 and are listed in the
# generator-managed block below; the handwritten handlers there are re-included
# by the negation, so they stay tracked and linted. Delete both lines when
# #2199 removes the duplicate pass.
#
# Write handwritten handlers under src/routes/api/v1 only. One placed directly
# under src/routes/api/ is indistinguishable from the duplicate surface and
# would be ignored here without warning.
src/routes/api/**/+server.ts
!src/routes/api/v1/**/+server.ts

# BEGIN SMRT auto-generated routes (Vite plugin)
src/routes/api/v1/_changes/+server.ts
src/routes/api/v1/_events/+server.ts
src/routes/api/v1/contentcontributionattachments/\[id\]/+server.ts
src/routes/api/v1/contentcontributionattachments/+server.ts
src/routes/api/v1/contentcontributionattachments/listForContribution/+server.ts
src/routes/api/v1/contentcontributionattachments/listForRevision/+server.ts
src/routes/api/v1/contentcontributionrevisions/\[id\]/+server.ts
src/routes/api/v1/contentcontributionrevisions/+server.ts
src/routes/api/v1/contentcontributionrevisions/getLatestForContribution/+server.ts
src/routes/api/v1/contentcontributionrevisions/listForContribution/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/approve/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/promote/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/reject/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/request-changes/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/revisions/+server.ts
src/routes/api/v1/contentcontributions/\[id\]/withdraw/+server.ts
src/routes/api/v1/contentcontributions/+server.ts
src/routes/api/v1/contentcontributions/by-contributor/+server.ts
src/routes/api/v1/contentcontributions/inbox/+server.ts
src/routes/api/v1/contentcontributions/ingest-email/+server.ts
src/routes/api/v1/contentcontributions/submit/+server.ts
src/routes/api/v1/contentcontributions/types/+server.ts
src/routes/api/v1/contentcontributiontypes/\[id\]/+server.ts
src/routes/api/v1/contentcontributiontypes/+server.ts
src/routes/api/v1/contentcontributiontypes/getByKey/+server.ts
src/routes/api/v1/contentcontributors/\[id\]/+server.ts
src/routes/api/v1/contentcontributors/+server.ts
src/routes/api/v1/contentcontributors/findOrCreateByEmail/+server.ts
src/routes/api/v1/contentcontributors/getByEmail/+server.ts
src/routes/api/v1/contentcontributors/getByProfileId/+server.ts
src/routes/api/v1/contentcorrections/\[id\]/+server.ts
src/routes/api/v1/contentcorrections/+server.ts
src/routes/api/v1/contentcorrections/getPublishedForContent/+server.ts
src/routes/api/v1/contentcorrections/issue/+server.ts
src/routes/api/v1/contentcorrections/listForContent/+server.ts
src/routes/api/v1/contentfeedsources/\[id\]/+server.ts
src/routes/api/v1/contentfeedsources/+server.ts
src/routes/api/v1/contentfeedsources/findActive/+server.ts
src/routes/api/v1/contentfeedsources/findByFeedUrl/+server.ts
src/routes/api/v1/contentfeedsources/findByStatus/+server.ts
src/routes/api/v1/contentgovernanceassignments/\[id\]/+server.ts
src/routes/api/v1/contentgovernanceassignments/+server.ts
src/routes/api/v1/contentgovernanceassignments/getByKey/+server.ts
src/routes/api/v1/contentgovernanceassignments/resolveForContent/+server.ts
src/routes/api/v1/contentgovernancepolicies/\[id\]/+server.ts
src/routes/api/v1/contentgovernancepolicies/+server.ts
src/routes/api/v1/contentgovernancepolicies/getByKey/+server.ts
src/routes/api/v1/contentgovernanceprofiles/\[id\]/+server.ts
src/routes/api/v1/contentgovernanceprofiles/+server.ts
src/routes/api/v1/contentgovernanceprofiles/getByKey/+server.ts
src/routes/api/v1/contentreferences/\[id\]/+server.ts
src/routes/api/v1/contentreferences/+server.ts
src/routes/api/v1/contentreferences/attach/+server.ts
src/routes/api/v1/contentreferences/byLeft/+server.ts
src/routes/api/v1/contentreferences/byRight/+server.ts
src/routes/api/v1/contentreferences/detach/+server.ts
src/routes/api/v1/contentreferences/getForSource/+server.ts
src/routes/api/v1/contentreferences/getForTarget/+server.ts
src/routes/api/v1/contentreferences/setLinks/+server.ts
src/routes/api/v1/contentreferences/unlink/+server.ts
src/routes/api/v1/contentreviews/\[id\]/+server.ts
src/routes/api/v1/contentreviews/+server.ts
src/routes/api/v1/contentreviews/createFromResult/+server.ts
src/routes/api/v1/contentreviews/getLatestForContent/+server.ts
src/routes/api/v1/contentreviews/getLatestForPolicyKey/+server.ts
src/routes/api/v1/contentreviews/listForContent/+server.ts
src/routes/api/v1/contentreviews/listForContentByPolicyKey/+server.ts
src/routes/api/v1/contents/\[id\]/+server.ts
src/routes/api/v1/contents/\[id\]/corrections/+server.ts
src/routes/api/v1/contents/\[id\]/fact-audit/+server.ts
src/routes/api/v1/contents/\[id\]/fact-audit/claims/recheck/+server.ts
src/routes/api/v1/contents/\[id\]/fact-audit/evidence/repair/+server.ts
src/routes/api/v1/contents/\[id\]/fact-audit/evidence/status/+server.ts
src/routes/api/v1/contents/\[id\]/fact-audit/repair/+server.ts
src/routes/api/v1/contents/\[id\]/facts/+server.ts
src/routes/api/v1/contents/\[id\]/governance/+server.ts
src/routes/api/v1/contents/\[id\]/review-profiles/\[profileKey\]/+server.ts
src/routes/api/v1/contents/\[id\]/review-profiles/+server.ts
src/routes/api/v1/contents/\[id\]/reviews/+server.ts
src/routes/api/v1/contents/\[id\]/transparency/+server.ts
src/routes/api/v1/contents/\[id\]/transparency/preview/+server.ts
src/routes/api/v1/contents/\[id\]/versions/+server.ts
src/routes/api/v1/contents/+server.ts
src/routes/api/v1/contents/by-slug/+server.ts
src/routes/api/v1/contents/facts/+server.ts
src/routes/api/v1/contents/governance/+server.ts
src/routes/api/v1/contents/governance/resolve/+server.ts
src/routes/api/v1/contentversions/\[id\]/+server.ts
src/routes/api/v1/contentversions/\[id\]/transparency/+server.ts
src/routes/api/v1/contentversions/+server.ts
src/routes/api/v1/contentversions/createSnapshot/+server.ts
src/routes/api/v1/contentversions/getLatestForContent/+server.ts
src/routes/api/v1/contentversions/getLatestPublishedForContent/+server.ts
src/routes/api/v1/contentversions/getNextVersionNumber/+server.ts
src/routes/api/v1/contentversions/getVersion/+server.ts
src/routes/api/v1/contentversions/listForContent/+server.ts
src/routes/api/v1/contentversions/restoreIntoContent/+server.ts
src/routes/api/v1/sync/apply/+server.ts
# END SMRT auto-generated routes (Vite plugin)
4 changes: 4 additions & 0 deletions packages/content/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,9 @@ import {
- **Publish readiness enforcement**: `save()` throws `ValidationError` if blocking requirements aren't met when setting status to `'published'`
- **Transparency snapshots**: published transparency is frozen into `ContentVersion.metadata.transparency` — use published for public display, preview for editors
- **Reference pinning**: `ContentReference` is keyed on `(source_id, target_id)`; `targetVersion` is an attribute of the edge, not part of identity. Re-calling `addReference(target, { targetVersion })` updates the pin in place. Unpinned references (`targetVersion: null`) report `isDrifted: false` regardless of how stale the target is — pin them only when you want drift to be detectable.
- **Generated API routes are not tracked**: everything the vite plugin emits under `src/routes/api/v1` is build output, listed in the bounded `.gitignore` block and regenerated on `npm run dev`. The handwritten handlers beside them (`contents/[id]/chat/**`, `images/**`) stay tracked and linted. Do not commit generated routes — they are not Biome-formatted, so tracking them turns the Lint job red (#2198)
- **`pnpm typecheck` still rewrites the `.gitignore` block**: `svelte-check` runs a second generation pass at the plugin's default `routesDir`, so the managed block flips between the `src/routes/api/v1/*` shape (`pnpm dev`) and the `src/routes/api/*` shape. The spillover guard above the block keeps route files out of `git status` in both shapes; only the `.gitignore` itself churns. Discard that churn until #2199 lands
- **Tests import generated routes and that is fine**: `contents-api.test.ts` imports `contents/+server.ts` and `contents/[id]/+server.ts` to exercise the generated CRUD handlers against a real SQLite database. The `test` script runs `svelte-kit sync` first, which regenerates the whole route tree, so those files exist by the time Vitest loads — no committed copy needed. Run `pnpm test`, never bare `vitest`, or the imports fail to resolve
- **`generate:test` exists for the callers that bypass `test`**: `scripts/check-coverage.mjs` runs bare `vitest --coverage`, so without a `generate:test` hook the route imports above fail and the Coverage Gate reports `no coverage produced` rather than a real percentage. It is `cache: false` in `packages/content/turbo.json` — the root task's `outputs` describe core's manifest, so a turbo cache hit would restore nothing and silently skip `svelte-kit sync`
- **Chat tables**: chat endpoint requires `@happyvertical/smrt-chat` tables; dev server handles missing tables gracefully
- **Dev server bootstraps all classes**: `hooks.server.ts` generates schemas for all 13 local `@smrt()` classes plus cross-package manifests
1 change: 1 addition & 0 deletions packages/content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"clean": "rm -rf dist",
"dev": "vite dev",
"prepack": "node ../../scripts/prepack-package.js",
"generate:test": "svelte-kit sync",
"test": "svelte-kit sync && vitest run",
"test:watch": "svelte-kit sync && vitest",
"test:e2e": "pnpm exec playwright test -c playwright.config.ts",
Expand Down
Loading
Loading