diff --git a/.githooks/ARCHITECTURE.md b/.githooks/ARCHITECTURE.md index 4326d60..822569c 100644 --- a/.githooks/ARCHITECTURE.md +++ b/.githooks/ARCHITECTURE.md @@ -1,5 +1,6 @@ -The `.githooks/` directory contains local git hooks that keep generated source in sync before a commit is created. +The `.githooks/` directory contains local git hooks that run publish-friendly +checks before a commit is created. -The current pre-commit hook runs `npm run sync:linear-layout-examples`. That command rewrites the baked linear-layout examples in the demo extension from the Python `demo_linear_layout.py` source when that source is present. This matters in the LL-viz checkout because the static demo must show the same examples as the Python script without asking contributors to edit generated TypeScript by hand. - -Standalone `tensor-viz` checkouts may not include the LL-viz Python demo source. In that case the sync tool leaves the baked examples unchanged, so normal tensor-viz commits are not blocked by a file that only exists in the parent project. +The current pre-commit hook runs `npm run check:ts-docs:staged`. That audits +staged TypeScript files for the documentation and helper-use rules in +`AGENTS.md` without forcing a full codebase audit on every small commit. diff --git a/.githooks/pre-commit b/.githooks/pre-commit index ac5e944..cc1342a 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -5,6 +5,3 @@ repo_root="$(git rev-parse --show-toplevel)" cd "$repo_root" npm run check:ts-docs:staged -npm run sync:linear-layout-examples -unset GIT_DIR GIT_WORK_TREE -git -C "$repo_root" add packages/viewer-demo/src/extensions/linear-layout/linear-layout.ts diff --git a/.gitignore b/.gitignore index 5db6197..98fb333 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules/ python/src/*.egg-info/ python/src/tensor_viz/static/ packages/*/dist/ +packages/*/lib/ packages/*/node_modules/ docs/_build/ docs/_extra/ diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index cc9fb04..7f99363 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -2,7 +2,7 @@ The `tensor-viz/` repository is a small monorepo because the project has three j First, `packages/viewer-core/` is the reusable viewer engine. It knows how to store tensors, parse tensor-view expressions, compute visible coordinates, and render the result. If a behavior should work in any host application, it belongs in core. -Second, `packages/viewer-demo/` is the browser application. It turns the core viewer into a complete UI with tabs, menus, widgets, a command palette, and optional extensions. The demo can add workflows such as linear-layout presets without teaching core about GPU instruction families. +Second, `packages/viewer-demo/` is the browser application and shell package. It turns the core viewer into a complete UI with tabs, menus, widgets, a command palette, and optional extension hooks. The stock tensor-viz app registers no domain-specific extensions; downstream packages such as LL-viz pass extension factories into the shell at startup. Third, `python/src/tensor_viz/` is the Python transport layer. It converts Python arrays or metadata into the same manifest format that the TypeScript viewer loads, then serves the built frontend and tensor bytes locally. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6fc7cf8..13d0d8c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,8 +62,7 @@ npm run check:ts-docs npm run check:ts-docs:staged ``` -The pre-commit hook runs `npm run check:ts-docs:staged` and -`npm run sync:linear-layout-examples`. Enable it with: +The pre-commit hook runs `npm run check:ts-docs:staged`. Enable it with: ```bash git config core.hooksPath .githooks @@ -74,7 +73,7 @@ useful. It requires `OPENAI_API_KEY` unless you pass `--print-prompt`. | Goal | Command | | --- | --- | -| Test the linear-layout parser example | `npm run check:ts-docs:llm-example` | +| Test the tensor-view parser example | `npm run check:ts-docs:llm-example` | | Test the example and auto-apply suggested JSDoc replacements | `npm run check:ts-docs:llm-example -- --apply` | | Audit staged TypeScript files that have no extra unstaged edits | `npm run check:ts-docs:llm` | | Audit all staged TypeScript blobs from the git index | `npm run check:ts-docs:llm -- --staged` | @@ -102,8 +101,8 @@ reads git-index blobs that may not match the working tree. Other useful LLM audit options: ```bash ---file=packages/viewer-demo/src/extensions/linear-layout/linear-layout-parser.ts ---symbol=parseLayoutSpecs +--file=packages/viewer-core/src/view.ts +--symbol=parseTensorView --include-direct-helpers --limit=10 --batch-size=4 @@ -115,9 +114,7 @@ Other useful LLM audit options: - `packages/viewer-core/src/`: reusable viewer engine, layout math, session model, rendering, and core tests. - `packages/viewer-demo/src/`: browser demo shell, command palette, widget - lifecycle, extension registry, and app tests. -- `packages/viewer-demo/src/extensions/linear-layout/`: linear-layout extension, - parser/model code, preset catalog, widgets, and tests. + lifecycle, extension registry, extension API exports, and app tests. - `python/src/tensor_viz/`: Python package, session builder, local server, and built frontend assets. - `python/tests/`: Python API and documentation-example tests. @@ -131,9 +128,6 @@ Architecture docs live next to the code they describe. Start with: - [Repository architecture](./ARCHITECTURE.md) - [Viewer core](./packages/viewer-core/src/ARCHITECTURE.md) - [Demo app shell](./packages/viewer-demo/src/ARCHITECTURE.md) -- [Linear layout extension](./packages/viewer-demo/src/extensions/linear-layout/ARCHITECTURE.md) -- [Linear layout presets](./packages/viewer-demo/src/extensions/linear-layout/presets/ARCHITECTURE.md) -- [Linear layout widgets](./packages/viewer-demo/src/extensions/linear-layout/widgets/ARCHITECTURE.md) - [Python package](./python/src/tensor_viz/ARCHITECTURE.md) - [Maintenance tools](./tools/ARCHITECTURE.md) - [Browser e2e tests](./packages/viewer-demo/e2e/ARCHITECTURE.md) diff --git a/package.json b/package.json index b107a2c..ea93ad3 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "check:ts-docs:llm": "node tools/check-ts-docs-llm.mjs", "check:ts-docs:llm-example": "node tools/llm-doc-audit-example.mjs", "check:ts-docs:staged": "node tools/check-ts-docs.mjs --staged", - "sync:linear-layout-examples": "python tools/sync-linear-layout-examples.py", "test": "npm run test:unit && npm run test:e2e", "test:e2e": "playwright test", "test:unit": "npm run test --workspace @tensor-viz/viewer-core && npm run test --workspace @tensor-viz/viewer-demo && PYTHONPATH=python/src python -m unittest discover -s python/tests -p 'test_*.py'", diff --git a/packages/viewer-core/src/viewer-graphics.ts b/packages/viewer-core/src/viewer-graphics.ts index ce319c1..cadc7dd 100644 --- a/packages/viewer-core/src/viewer-graphics.ts +++ b/packages/viewer-core/src/viewer-graphics.ts @@ -12,7 +12,7 @@ import { Vector3, } from 'three'; import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js'; -import helvetikerBoldFont from 'three/examples/fonts/helvetiker_bold.typeface.json'; +import helvetikerBoldFont from 'three/examples/fonts/helvetiker_bold.typeface.json' with { type: 'json' }; import { VIEWER_LIMITS } from './validation.js'; const LABEL_FONT = new FontLoader().parse(helvetikerBoldFont as never); diff --git a/packages/viewer-demo/e2e/viewer-smoke.spec.ts b/packages/viewer-demo/e2e/viewer-smoke.spec.ts index 2def74d..92c4a76 100644 --- a/packages/viewer-demo/e2e/viewer-smoke.spec.ts +++ b/packages/viewer-demo/e2e/viewer-smoke.spec.ts @@ -28,14 +28,10 @@ test('viewer demo boots, paints tensors, and exposes core controls', async ({ pa // startup await expect(page.locator('.ribbon')).toBeVisible(); await expect(page.locator('#viewport')).toBeVisible(); - expect(await page.locator('.tab-button').count()).toBeGreaterThan(0); - // extension widgets - await expect(page.locator('#linear-layout-preset-widget')).toBeVisible(); - await expect(page.locator('#linear-layout-widget')).toBeVisible(); + // core widgets await expect(page.locator('#tensor-view-widget')).toBeVisible(); - await expect(page.getByText('Preset', { exact: true })).toBeVisible(); - await expect(page.getByText('Layout Specs', { exact: true })).toBeVisible(); + await expect(page.locator('#inspector-widget')).toBeVisible(); // viewport paint await page.waitForFunction(() => ( diff --git a/packages/viewer-demo/index.html b/packages/viewer-demo/index.html index e04adba..45b7977 100644 --- a/packages/viewer-demo/index.html +++ b/packages/viewer-demo/index.html @@ -4,7 +4,7 @@ -