ontoref/reflection/bin/init-repo.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

47 lines
1.6 KiB
Text

#!/usr/bin/env nu
# reflection/bin/init-repo.nu — VCS-aware repository initialization.
#
# Called by the new_project mode init_repo step.
# Detects existing VCS state and initializes accordingly:
# jj detected → jj git init --colocate (jj-native with git interop)
# git detected → commit initial empty commit if needed
# none detected → default to jj colocated (preferred for Radicle)
#
# Usage: nu reflection/bin/init-repo.nu <project_dir>
def main [project_dir: path]: nothing -> nothing {
let dir = ($project_dir | path expand)
if not ($dir | path exists) {
mkdir $dir
}
let has_jj = ($dir | path join ".jj" | path exists)
let has_git = ($dir | path join ".git" | path exists)
if $has_jj {
# Already a jj repo — nothing to do
print $" ($dir) already a jj repo"
return
}
if $has_git {
# Existing git repo — ensure at least one commit exists for worktree ops
let log = do { ^git -C $dir log --oneline -1 } | complete
if $log.exit_code != 0 or ($log.stdout | str trim | is-empty) {
std fs write-all $"($dir)/README" ""
do { ^git -C $dir add README } | complete | ignore
do { ^git -C $dir commit --allow-empty -m "chore: initial commit" } | complete | ignore
}
print $" ($dir) git repo ready"
return
}
# No VCS — initialize jj colocated (creates both .jj/ and .git/)
let r = do { ^jj git init --colocate $dir } | complete
if $r.exit_code != 0 {
error make { msg: $"init-repo: jj git init failed: ($r.stderr)" }
}
print $" ($dir) initialized as jj colocated repo"
}