ontoref/reflection/hooks/git-event.nu
Jesús Pérez 472952e29b
Some checks failed
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
feat: domain extension system, VCS abstraction, personal/provisioning domains, web subpages
Domain extension system (ADR-012): bash-layer dispatch activates repo_kind-conditional CLI
  domains. install.nu copies domains/ tree; short_alias wrappers generated (personal, prov).
  ore help and describe capabilities domain-aware.

  personal domain (PersonalOntology): career skills/talks/publications/positioning, CFP
  pipeline (Watching→Delivered), opportunities lifecycle, content pipeline, Sessionize
  integration. Daemon pages: /career, /personal.

  provisioning domain (DevWorkspace/Mixed): FSM state, next transitions, connections graph,
  gates, workspace card, capabilities, backlog. Daemon page: /provisioning.

  VCS abstraction layer (ADR-013): reflection/modules/vcs.nu — uniform jj/git API via
  filesystem detection (.jj/ vs .git/). opmode.nu and git-event.nu migrated off ^git.
  reflection/bin/jjw.nu — jj + ontoref + Radicle agent workspace lifecycle. jjw-ncl-merge.nu
  registered as jj merge tool for .ontology/ NCL conflicts. init-repo.nu for new_project mode.
  jj/rad not in ontoref requirements — belong in orchestration project manifests.

  'Framework RepoKind: ontology/schemas/manifest.ncl gains 'Framework variant; ontoref
  self-identifies as framework — no domain activates for the protocol itself.

  Web presence: personal.html and provisioning.html domain subpages. index.html gains
  "Project Types — Domain Extensions" section with type cards and subpage links. Nav
  compacted (Arch/Prov labels, solid backdrop-filter background).

  on+re: vcs-abstraction (adrs: adr-013) and agent-workspace-orchestration Practice nodes;
  21 manifest capabilities; state.ncl catalysts updated.
2026-04-07 23:08:29 +01:00

52 lines
2 KiB
Text

#!/usr/bin/env nu
# reflection/hooks/git-event.nu — called by git post-merge and post-checkout hooks.
#
# For jj repos, this hook is never installed (jj has no hook system).
# The jjw wrapper calls `on-vcs-event` directly after relevant jj operations.
# Core event handler — callable from both the git hook and the jjw wrapper.
#
# Triggers: mode detection, project-context regeneration, daemon sync.
# Never fails the calling operation — all steps are best-effort.
export def "on-vcs-event" [event_type: string = ""]: nothing -> nothing {
let ontoref_root = ($env.ONTOREF_ROOT? | default "")
if ($ontoref_root | is-empty) { return }
let wrapper = $"($ontoref_root)/ontoref"
if not ($wrapper | path exists) { return }
# Trigger mode detection + transition. Sync runs inside on-enter-daemon if mode changed.
do { ^nu $wrapper mode-detect } | complete | null
# Regenerate static project context for Claude Code sessions.
let context_file = $"($ontoref_root)/.claude/project-context.md"
if ($context_file | path parent | path exists) {
let r = (do { ^nu $wrapper describe project --fmt text } | complete)
if $r.exit_code == 0 {
$r.stdout | save --force $context_file
}
}
# If daemon mode is active, push ontology for current VCS event.
let lock_file = $"($ontoref_root)/.ontoref/mode.lock"
if not ($lock_file | path exists) { return }
let lock = (
do { open $lock_file | from json } | complete
| get -o stdout
| default { mode: "local" }
)
if $lock.mode == "daemon" {
let store = $"($ontoref_root)/reflection/modules/store.nu"
let r = (do { ^nu -c $"use ($store) *; store sync-push" } | complete)
if $r.exit_code == 0 {
print $" (ansi green)ontoref(ansi reset) ontology synced to daemon"
}
}
}
# Git hook entry point — called by post-merge / post-checkout.
def main [event: string = ""]: nothing -> nothing {
on-vcs-event $event
}