Skip to content

Phase 3: lokf new — scaffold a publishable Astro knowledge base - #14

Merged
nicholsn merged 3 commits into
mainfrom
feat/lokf-new-scaffold
Jul 4, 2026
Merged

Phase 3: lokf new — scaffold a publishable Astro knowledge base#14
nicholsn merged 3 commits into
mainfrom
feat/lokf-new-scaffold

Conversation

@nicholsn

@nicholsn nicholsn commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Phase 3 of 3. Stacked on #13 (base = `feat/lokf-tables`) — GitHub retargets to `main` as the stack merges.

Closes the loop: from an idea to a published knowledge graph. `lokf new ` scaffolds a complete, self-contained repo — in the spirit of linkml-cookiecutter — and the new KB gets the full LOKF experience, not a plain doc site.

`lokf new`

lokf new my-kb --title "My Knowledge Base" --base-iri https://myorg.github.io/my-kb/

Writes a repo with:

  • `knowledge/` — a starter LOKF bundle (index + two example concepts wired with a typed `measures` relation).
  • A full Astro site rendering the bundle: home (concepts by type), a page per concept with forward + backward typed-relation panels, an interactive `/graph` cytoscape browser (search, type/relation filters, click-through, ?focus= deep-links, full-screen), and `graph.json` + `graph.jsonld` endpoints. site/base are derived from --base-iri, so it works on a domain or as a GitHub project page under /<repo>/.
  • `.github/workflows/pages.yml` (Astro build → Pages), `justfile` (just setup | dev | site for the app; serve | rdf | tables for the toolkit via uvx), `.claude/skills/` (the bundled agent skills), README, .gitignore.

The template lives at src/lokf/templates/kb/ and is copied + token-substituted by scaffold.py; the scaffolded bundle is valid LOKF out of the box.

scaffold-knowledge-base agent skill

A new bundled skill that drives idea → lokf new → author concepts → validate → publish, handing off to author-concept / enrich-relations.

Packaging fix (found by adversarial review)

The sdist was 132 MB — hatchling was leaking web/node_modules (20k files), over PyPI's limit. Excluded web/ and build caches from the sdist → 383 KB; the wheel still ships all 20 template files.

Verified

astro build on a freshly scaffolded KB (4 pages), preview-checked (home, concept pages with forward+back relations, the graph browser rendering Weekly Active Users → measures → Active User, graph.json/graph.jsonld), wheel/sdist inspected, 133 tests green.


Completes the arc: #12 bindings + relational schema, #13 lokf.tables, #14 the Astro scaffolder. Merge order: #12#13#14.

nicholsn added 3 commits July 4, 2026 07:52
The instance-level tabular projection (phase 1 added the schema-level bindings +
relational DDL). A bundle becomes one DataFrame per concept type (the nodes)
plus a single `relations` edge table (source, predicate, target).

- lokf.tables: to_frames (pandas | polars), writers (CSV, Parquet, SQLite), and
  external_table_ddl for a BigQuery/Athena lakehouse over the Parquet.
- `lokf tables <bundle> --format {csv|parquet|sqlite|bigquery|athena}` CLI.
- pandas/pyarrow live in a new `tables` extra; the core stays light.
- 9 tests; a toolkit/tables docs page; README + .gitignore updated.

126 tests green.
`lokf new <name>` writes a self-contained repo: a starter LOKF bundle, a MkDocs
site + GitHub Pages workflow that publishes it, a justfile driving the toolkit
via uvx (no install), and the bundled agent skills. In the spirit of
linkml-cookiecutter — idea -> bundle -> published site.

- lokf.scaffold + `lokf new` CLI.
- New `scaffold-knowledge-base` agent skill (idea -> lokf new -> author ->
  validate -> publish).
- Tests: the scaffolded repo has the expected files, ships the skills, and its
  bundle projects to valid RDF. test_skills updated for the new skill.
- Docs: toolkit/scaffold page; README "Start your own".

130 tests green.
Replace the MkDocs scaffold with a packaged Astro template
(src/lokf/templates/kb/) that `lokf new` copies + tokenizes, so a fresh KB gets
the full LOKF experience: concept pages with typed-relation panels, an
interactive /graph cytoscape browser, and graph.json + graph.jsonld endpoints —
base-path-aware so it also works as a GitHub project page under /<repo>/.

- scaffold.py: copy the template tree, substitute __KB_*__ tokens (site/base
  split from base_iri), rename _github/_gitignore dotfiles, harden the
  target/template guards.
- Packaging: exclude web/ (+ node_modules/.astro/dist) from the sdist — it was
  132 MB (node_modules leaked) and over PyPI's 100 MB limit; now 383 KB. Wheel
  still ships the 20 template files.
- Tests updated for the Astro tree, token substitution, and base derivation;
  133 pass. Verified end-to-end: scaffold -> npm build -> preview (home,
  concept pages with forward+back relations, /graph, graph.json/jsonld).
- Docs / skill / README updated (Astro, not MkDocs).
@nicholsn nicholsn changed the title Phase 3: lokf new — scaffold a publishable knowledge base Phase 3: lokf new — scaffold a publishable Astro knowledge base Jul 4, 2026
@nicholsn
nicholsn changed the base branch from feat/lokf-tables to main July 4, 2026 15:26
@nicholsn
nicholsn merged commit e41e6cf into main Jul 4, 2026
2 checks passed
@nicholsn
nicholsn deleted the feat/lokf-new-scaffold branch July 4, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant