Files
insights/bin/frontend-exclude-filter
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

59 lines
2.4 KiB
JavaScript
Executable File

#!/usr/bin/env node
/**
* Emit a paths-filter filter (YAML on stdout) that excludes the Node-only
* product workspaces from frontend / storybook CI gating.
*
* Why: the frontend and storybook gates match all product code with a broad
* `products/**\/*.ts(x)` rule (correctly — product frontend doesn't always live
* under `frontend/`; see products/games, products/data_warehouse,
* products/ai_observability/shared). That broad rule also matches product dirs
* that are their own Node services — they have their own CI, no stories, and
* nothing in the bundle, so a PR touching only them should skip
* frontend/storybook CI.
*
* Those Node dirs are exactly the product paths that declare nested pnpm
* workspaces in pnpm-workspace.yaml — `products/<...>/*` entries deeper than the
* bare `products/*` that covers the product packages themselves. Deriving the
* exclusion from there means a new product's services/ are excluded automatically
* once added to the workspace file — no product names hardcoded in the workflows.
*
* Output — an exclude-only filter that is true only when some changed file lives
* OUTSIDE every excluded dir. ci-storybook.yml and ci-frontend.yml feed it to the
* vendored .github/actions/paths-filter (include-exclude matching), where every
* `!` pattern vetoes and a filter with no positive includes matches any
* non-excluded file:
* outside_node_product_workspaces:
* - '!products/<product>/packages/**'
* - '!products/<product>/services/**'
*/
const fs = require('fs')
const path = require('path')
const REPO_ROOT = path.resolve(__dirname, '..')
const raw = fs.readFileSync(path.join(REPO_ROOT, 'pnpm-workspace.yaml'), 'utf-8')
// Match `- products/<dir>/*` workspace globs that are deeper than the bare
// `products/*` (which covers the product packages, i.e. their frontend). The
// captured dir is the Node workspace root to exclude.
const dirs = new Set()
for (const line of raw.split('\n')) {
const m = line.match(/^\s*-\s*['"]?(products\/[^'"\s]+)\/\*\s*['"]?\s*$/)
if (m) {
dirs.add(m[1])
}
}
const sorted = [...dirs].sort()
let out = 'outside_node_product_workspaces:\n'
if (sorted.length === 0) {
// No nested product workspaces — nothing to exclude; match everything so the
// filter is always true and never skips frontend CI.
out += " - '**'\n"
} else {
for (const dir of sorted) {
out += ` - '!${dir}/**'\n`
}
}
process.stdout.write(out)