okf: extract into flakes/okf sub-flake - #26
Merged
Merged
Conversation
Move scripts/okf -> flakes/okf (git mv, history preserved) and make it a real sub-flake per the house extraction pattern — the first step toward spinning okf out as an independent project: - packages.<system>.okf: sources + vendored node_modules (fixed-output bun install; pure-JS lock, one hash for all systems) under a `bun run --no-install` wrapper. No bun compile: `okf viz` runs Bun.build + bun-plugin-svelte at CLI runtime. - checks.<system>.test: the 238 viewer tests, offline in the sandbox. - lib.ts repoRoot() is now cwd-based (git rev-parse --show-toplevel) so the store binary operates on the caller's repo — the only generalization taken now; bundle dir stays knowledge/. - Dev shell keeps the impure working-tree wrapper (fast iteration unchanged); root re-exports the package (perSystem + aarch64-linux); no overlay. Pages workflow stays bun-native, paths repointed. - Reference sweep across AGENTS.md/README/skills/knowledge (log.md history untouched); new okf catalog concept + okf-subflake decision record; okf validate --strict clean. Verified: bun test (238), standalone + root nix builds, store-binary validate/viz, nix flake check (both flakes), Linux drv evals, darwinConfigurations.k build, nebula toplevel cross-eval.
repoRoot() now reports "could not run git" when the binary itself can't be spawned (r.error, e.g. ENOENT), instead of the misleading "not inside a git repository" message that case previously shared with a real non-repo cwd. Also switches the memoization to the file's existing `x ??= compute()` idiom (matches gitDates below it) instead of a bespoke if-check-then-assign. Cosmetic follow-ups from the okf-subflake code review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Moves the okf knowledge-bundle CLI from
scripts/okf/toflakes/okf/(git mv, history preserved) and makes it a self-contained sub-flake per the house extraction pattern (AGENTS.md /flakes/ccglassprecedent) — the first step toward spinning okf out as an independent project consumable by many repos.packages.<system>.okfships the TypeScript sources plus vendorednode_modules— a fixed-outputbun installkeyed onbun.lock(the pattern nixpkgs uses for opencode/helix-gpt; no bun packaging helper exists) — under abun run --prefer-offline --no-installwrapper. Nobun build --compile:okf vizbundles the Svelte viewer withBun.build+ bun-plugin-svelte at CLI runtime, so the bun runtime and deps must be present. The lock is pure JS (no os/cpu-conditional packages), so one FOD hash serves all three systems.lib.tsrepoRoot()switched fromimport.meta.dir/../..togit rev-parse --show-toplevel, so the store-run binary operates on whatever repo it's invoked in. This is the only generalization taken now — bundle dir stays hardcodedknowledge/, scaffold stays dotfiles-shaped.modules/dev.nix, path repointed) — edits stay live with no rebuild. The nix package is for external consumption/parity.flakes/okf.follows; re-exports inmodules/packages.nix(perSystem + theaarch64-linuxblock). No overlay — nothing installs okf system-wide.scripts/okfreference sweep (log.md history untouched); newknowledge/packages/okf.mdconcept andknowledge/decisions/okf-subflake.mddecision record.Reviewer notes
bun.lockchanges or a nixpkgs bump changes bun's install layout — loud hash-mismatch failure; procedure documented inflakes/okf/README.md(passthru.node_modulesmakes it one command).okf viz --check/--perfare dev-tree-only (svelte-check writes intonode_modules, read-only in the store;--perfneeds local Chrome) — documented in the README.nix flake checkdoesn't run the sub-flake's checks; usenix flake check ./flakes/okf.workflow_dispatchof the pages workflow confirms the publish end-to-end.Verification
bun test: 238 pass (working tree) and offline in the nix sandbox (checks.<system>.test)nix build ./flakes/okf#okfstandalone; store binary ranvalidateandviz(full 2.5 MB viz.html through the store node_modules symlink)nix flake checkon both flakes;nix build .#okf(exact drv parity with standalone);nix evalof the aarch64-linux/x86_64-linux re-exportsnix build .#darwinConfigurations.k.systemand nebulatoplevelcross-eval both greenokf validate --strict: 0 errors, 0 warnings; fmt/statix/deadnix: no new findings