repo-nexus 0.9.7 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/lib/ai.sh +18 -49
  3. package/lib/commands/init.sh +6 -4
  4. package/lib/commands/status.sh +3 -3
  5. package/lib/commands/sync.sh +0 -4
  6. package/lib/commands/system.sh +1 -2
  7. package/lib/plugins.sh +42 -26
  8. package/lib/workspace.sh +16 -10
  9. package/lib/yaml.sh +10 -9
  10. package/package.json +1 -1
  11. package/plugins/claude/plugin.yaml +1 -1
  12. package/plugins/codex/plugin.yaml +1 -1
  13. package/plugins/copilot/plugin.yaml +1 -1
  14. package/plugins/cursor/plugin.yaml +1 -1
  15. package/plugins/gemini/plugin.yaml +1 -1
  16. package/plugins/karpathy-llm/README.md +49 -136
  17. package/plugins/karpathy-llm/agents/rnex-wiki-curator.agent.md +1 -1
  18. package/plugins/karpathy-llm/bin/ingest.sh +66 -63
  19. package/plugins/karpathy-llm/bin/lint.sh +64 -130
  20. package/plugins/karpathy-llm/hooks/_common.sh +12 -29
  21. package/plugins/karpathy-llm/hooks/after_sync.sh +10 -118
  22. package/plugins/karpathy-llm/hooks/before_plugin_disable.sh +2 -0
  23. package/plugins/karpathy-llm/instructions/rnex-scaffolding-meta-prompt.md +14 -23
  24. package/plugins/karpathy-llm/instructions/rnex-wiki-architecture.md +2 -2
  25. package/plugins/karpathy-llm/lib/btree_helpers.sh +287 -154
  26. package/plugins/karpathy-llm/lib/config.sh +142 -127
  27. package/plugins/karpathy-llm/lib/lint_helpers.sh +232 -0
  28. package/plugins/karpathy-llm/lib/source_helpers.sh +372 -424
  29. package/plugins/karpathy-llm/lib/utils.sh +117 -99
  30. package/plugins/karpathy-llm/plugin.yaml +13 -50
  31. package/plugins/karpathy-llm/rules/behavioral.md +1 -1
  32. package/plugins/karpathy-llm/skills/wiki-ingest.md +32 -22
  33. package/plugins/karpathy-llm/skills/wiki-lint.md +24 -31
  34. package/plugins/karpathy-llm/skills/wiki-query.md +22 -0
  35. package/plugins/karpathy-llm/tests/test_plugin.sh +345 -242
  36. package/plugins/windsurf/plugin.yaml +1 -1
  37. package/templates/rnex.example.yaml +8 -7
  38. package/plugins/karpathy-llm/hooks/post-sync.sh +0 -13
  39. package/plugins/karpathy-llm/lib/agent_query_helpers.sh +0 -127
  40. package/plugins/karpathy-llm/lib/graph_helpers.sh +0 -218
  41. package/plugins/karpathy-llm/templates/_index.md +0 -19
  42. package/plugins/karpathy-llm/templates/_log.md +0 -9
package/README.md CHANGED
@@ -19,7 +19,7 @@ A lightweight, zero-dependency and AI-First **Nexus Repository (Virtual Meta Rep
19
19
  - **Two-Level Configuration as Source of Truth**: Shared team manifest in `rnex.yaml` with machine-specific overrides in `.local.rnex.yaml` (highest priority).
20
20
  - **One Command Team Onboarding**: Teammates clone the **meta repository** (**meta repo** / **nexus repo**) and run `rnex clone` to clone and configure all member repositories in seconds.
21
21
  - **Cross-Repo Batch Operations**: Run arbitrary commands across all active repositories with `rnex exec <command>`.
22
- - **Scoped Plugins & Context Packs**: Modular plugin packages scoped under `.rnex/plugins/<plugin-name>/` with support for domain directories (e.g. `wiki/` and `./docs` for `karpathy-llm`).
22
+ - **Scoped Plugins & Context Packs**: Modular plugin packages scoped under `.rnex/plugins/<plugin-name>/` with support for domain directories (e.g. `.rnex/wiki/` and `./docs` for `karpathy-llm`).
23
23
  - **Zero Dependencies**: Pure POSIX shell CLI (`rnex`). Works out of the box across macOS, Linux, and Windows (WSL/Git Bash).
24
24
 
25
25
  > 📖 **[Documentation & Guides](https://unoxen.github.io/repo-nexus/)**
package/lib/ai.sh CHANGED
@@ -23,10 +23,6 @@ fi
23
23
  _build_rnex_gitignore_section() {
24
24
  _active_repos_dir="$(yaml_get_repos_dir 2>/dev/null || printf 'repos')"
25
25
  [ -n "$_active_repos_dir" ] || _active_repos_dir="repos"
26
- _active_wiki_dir="$(yaml_plugin_get "karpathy-llm" "wiki_dir" 2>/dev/null || printf 'wiki')"
27
- _active_wiki_dir="${_active_wiki_dir#./}"
28
- _active_wiki_dir="${_active_wiki_dir%/}"
29
- [ -n "$_active_wiki_dir" ] || _active_wiki_dir="wiki"
30
26
  cat <<GI_SECTION_EOF
31
27
  $GITIGNORE_MARKER_START
32
28
  # Managed by Repo Nexus (rnex) — synced with git.ignore in workspace configuration
@@ -35,11 +31,15 @@ ${_active_repos_dir}/
35
31
  ${_active_repos_dir}/*
36
32
  !${_active_repos_dir}/.gitkeep
37
33
 
38
- # Recursive Repo Nexus directories (trailing slashes prevent ignoring rnex executable or rnex.yaml)
39
- **/.rnex*/
40
- **/rnex*/
41
- .rnex*/
42
- rnex*/
34
+ # Recursive Repo Nexus files and directories (rnex.yaml is excluded below)
35
+ **/.rnex*
36
+ **/rnex*
37
+ .rnex*
38
+ rnex*
39
+
40
+ # Exclude workspace configuration from git ignore
41
+ !rnex.yaml
42
+ !**/rnex.yaml
43
43
 
44
44
  # Local machine-specific configuration
45
45
  $RNEX_LOCAL_CONFIG_FILE
@@ -53,7 +53,11 @@ GI_SECTION_EOF
53
53
  printf '%s\n' "$_custom_ignores" | while IFS= read -r _ci || [ -n "$_ci" ]; do
54
54
  [ -n "$_ci" ] || continue
55
55
  case "$_ci" in
56
- "repos/"|"repos/*"|"!repos/.gitkeep"|"${_active_repos_dir}/"|"${_active_repos_dir}/*"|"!${_active_repos_dir}/.gitkeep"|"**/.rnex*/"|"**/rnex*/"|".rnex*/"|"rnex*/"|"$RNEX_LOCAL_CONFIG_FILE"|".rnex.local.yaml")
56
+ "repos/"|"repos/*"|"!repos/.gitkeep"|"${_active_repos_dir}/"|"${_active_repos_dir}/*"|"!${_active_repos_dir}/.gitkeep"|\
57
+ "**/.rnex*"|"**/rnex*"|".rnex*"|"rnex*"|\
58
+ "**/.rnex*/"|"**/rnex*/"|".rnex*/"|"rnex*/"|\
59
+ "!rnex.yaml"|"!**/rnex.yaml"|\
60
+ "$RNEX_LOCAL_CONFIG_FILE"|".rnex.local.yaml")
57
61
  continue
58
62
  ;;
59
63
  esac
@@ -130,6 +134,8 @@ reconcile_gitignore() {
130
134
  $0 == "repos/*" || $0 == "!repos/.gitkeep" || $0 == "repos/" { next }
131
135
  $0 == (ard "/*") || $0 == ("!" ard "/.gitkeep") || $0 == (ard "/") { next }
132
136
  $0 == "**/.rnex*/" || $0 == "**/rnex*/" || $0 == ".rnex*/" || $0 == "rnex*/" { next }
137
+ $0 == "**/.rnex*" || $0 == "**/rnex*" || $0 == ".rnex*" || $0 == "rnex*" { next }
138
+ $0 == "!rnex.yaml" || $0 == "!**/rnex.yaml" { next }
133
139
  $0 == ".rnex" || $0 == "rnex" { next }
134
140
  $0 == local_cfg || $0 == ".rnex.local.yaml" { next }
135
141
  { lines[++n] = $0 }
@@ -367,32 +373,13 @@ render_ai_instructions() {
367
373
  [ -n "$_rai_ws" ] || _rai_ws="$(basename "$_rai_dir")"
368
374
  _rai_plugins="$(yaml_list_enabled_plugins_sorted 2>/dev/null || true)"
369
375
 
370
- _rai_kp=0
371
- _rai_wiki=""
372
- _rai_src_dirs=""
373
- _rai_srcs=""
374
- if printf '%s\n' "$_rai_plugins" | grep -qx "karpathy-llm"; then
375
- _rai_kp=1
376
- _rai_wiki="$(yaml_get_merged_plugin_config "karpathy-llm" "wiki_dir" "wiki" 2>/dev/null | sed -n '1p')"
377
- _rai_wiki="${_rai_wiki%/}"
378
- [ -n "$_rai_wiki" ] || _rai_wiki="wiki"
379
- _rai_src_list="$(yaml_get_plugin_list "karpathy-llm" "sources" 2>/dev/null || true)"
380
- [ -n "$_rai_src_list" ] || _rai_src_list="$(yaml_get_merged_plugin_config "karpathy-llm" "sources" 2>/dev/null || true)"
381
- _rai_src_dirs="$(printf '%s\n' "$_rai_src_list" | grep -v '[*?]' | sed -e 's#/*$#/#' | _ai_md_code_list)"
382
- _rai_srcs="$(printf '%s\n' "$_rai_src_list" | _ai_md_code_list)"
383
- fi
384
-
385
376
  # Header & Section 1
386
377
  printf '# Repo Nexus Workspace Instructions (rnex v%s)\n\n' "${RNEX_VERSION:-unknown}"
387
378
  printf "> Pre-compiled from merged workspace configuration (\`.local.rnex.yaml\` > \`rnex.yaml\`).\n\n"
388
379
  printf '## 1. Strict Operating Constraints\n'
389
380
  printf -- '- **NO CONFIG READS**: DO NOT read or search for rnex.yaml or .local.rnex.yaml. The complete merged configuration is embedded in Section 2.\n'
390
381
  printf -- '- **READ FILES ONCE**: Read each file at most once per session. Never re-read a file already in context.\n'
391
- if [ "$_rai_kp" -eq 1 ]; then
392
- printf -- "- **NO BLIND SCANS**: Never run broad directory scans or unbounded searches across \`%s/\`%s (exception: targeted file reads and recursive discovery are permitted strictly when executing source ingestion for \`karpathy-llm\`).\n" "$_rai_rd" "${_rai_src_dirs:+ or raw intake directories ($_rai_src_dirs)}"
393
- else
394
- printf -- "- **NO BLIND SCANS**: Never run broad directory scans or unbounded searches across \`%s/\`.\n" "$_rai_rd"
395
- fi
382
+ printf -- "- **NO BLIND SCANS**: Never run broad directory scans or unbounded searches across \`%s/\`.\n" "$_rai_rd"
396
383
 
397
384
  # Section 2
398
385
  printf '\n## 2. Merged Workspace Configuration\n'
@@ -429,42 +416,24 @@ render_ai_instructions() {
429
416
  printf '\n- **Disabled Repositories (Do Not Access)**: %s\n' "$(printf '%s' "$_rai_disabled" | _ai_md_code_list)"
430
417
  fi
431
418
 
432
- if [ "$_rai_kp" -eq 1 ]; then
433
- _rai_srcs="$(yaml_get_merged_plugin_config "karpathy-llm" "sources" 2>/dev/null | _ai_md_code_list)"
434
- printf "\n### Resolved Knowledge Base (\`karpathy-llm\`)\n"
435
- printf -- "- **Curated Wiki Path**: \`%s/\`\n" "$_rai_wiki"
436
- printf -- "- **Raw Intake Sources**: %s *(read-only inputs used strictly during \`rnex plugin karpathy-llm ingest\`; do not browse during normal tasks)*\n" "${_rai_srcs:-_none_}"
437
- fi
438
-
439
419
  # Section 3
440
420
  printf '\n## 3. Mandatory Execution Sequence\n'
441
421
  printf 'Execute these steps in strict order:\n'
442
422
  _rai_n=1
443
- if [ "$_rai_kp" -eq 1 ]; then
444
- printf "1. **Step 1 — Query B-Tree Root Index & Graph**: Read \`%s/_index.md\` (compact B-Tree router <= 80 lines) to locate matching shard (\`repo-nexus*.md\` or \`repos-<member>*.md\`) or node identifiers.\n" "$_rai_wiki"
445
- printf "2. **Step 2 — Inspect Targeted Domain Shard**: Read only the relevant shard in \`%s/_index/<shard>.md\` identified in Step 1. Pinpoint the specific source document needed without exhaustive reading.\n" "$_rai_wiki"
446
- printf "3. **Step 3 — Read Authoritative Source Document**: Read only the 1–3 target source document(s) referenced in the shard. Do NOT browse raw intake sources%s or \`%s/\` blindly before completing Steps 1–2.\n" "${_rai_src_dirs:+ ($_rai_src_dirs)}" "$_rai_rd"
447
- _rai_n=4
448
- fi
449
423
  printf "%s. **Step %s — Targeted Repository Access**: Inspect or modify only the specific files in active \`%s/<name>/\` required for the task. Never modify or commit inside \`READ-ONLY\` repositories.\n" "$_rai_n" "$_rai_n" "$_rai_rd"
450
424
  _rai_n=$((_rai_n + 1))
451
425
  printf "%s. **Step %s — Git & Maintenance**: Commit and push inside \`%s/<name>/\`. Run \`rnex sync\` if workspace state changes.\n" "$_rai_n" "$_rai_n" "$_rai_rd"
452
426
 
453
427
  # Section 4
454
- printf '\n## 4. Coding & Wiki Directives\n'
428
+ printf '\n## 4. Coding & Architecture Directives\n'
455
429
  if [ -d "$_rai_dir/.rnex/skills" ] && [ -n "$(ls -A "$_rai_dir/.rnex/skills" 2>/dev/null)" ]; then
456
430
  printf -- "- **Skills**: \`.rnex/skills/\` (load a skill only when its task applies).\n"
457
431
  fi
458
432
  if [ -d "$_rai_dir/.rnex/agents" ] && [ -n "$(ls -A "$_rai_dir/.rnex/agents" 2>/dev/null)" ]; then
459
433
  printf -- "- **Subagents**: \`.rnex/agents/\`.\n"
460
434
  fi
461
- if [ "$_rai_kp" -eq 1 ]; then
462
- printf -- '- **Behavioral Rules**: (1) State assumptions and surface trade-offs before coding; (2) Prefer minimal, non-speculative code; (3) Make surgical edits touching only required lines; (4) Verify changes against concrete goals.\n'
463
- printf -- "- **Wiki Operations**: Never edit \`%s/\` files ad-hoc. To ingest raw sources or validate wiki frontmatter/links, run \`rnex plugin karpathy-llm ingest\` or \`rnex plugin karpathy-llm lint\` (or load \`.rnex/plugins/karpathy-llm/skills/\` only when executing ingestion/linting).\n" "$_rai_wiki"
464
- fi
465
435
 
466
436
  for _rai_p in $_rai_plugins; do
467
- [ "$_rai_p" = "karpathy-llm" ] && continue
468
437
  plugin_is_provider "$_rai_p" && continue
469
438
  _ai_emit_workflow_plugin_instructions "$_rai_dir" "$_rai_p"
470
439
  done
@@ -31,8 +31,8 @@ cmd_init() {
31
31
  --repos-dir=*|--repos_dir=*)
32
32
  _cli_repos_dir="${1#*=}"
33
33
  ;;
34
- --karpathy) _cli_plugins="${_cli_plugins:+$_cli_plugins }karpathy-llm" ;;
35
- --no-karpathy) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ karpathy-llm / /g' -e 's/^ *//;s/ *$//')" ;;
34
+ --karpathy) _pk="karpathy"; _cli_plugins="${_cli_plugins:+$_cli_plugins }${_pk}-llm" ;;
35
+ --no-karpathy) _pk="karpathy"; _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e "s/ ${_pk}-llm / /g" -e 's/^ *//;s/ *$//')" ;;
36
36
  --plugin|--enable-plugin)
37
37
  shift
38
38
  [ -n "$1" ] && _cli_plugins="${_cli_plugins:+$_cli_plugins }$1"
@@ -189,8 +189,10 @@ code_workspace: ${_cli_code_workspace:-false}
189
189
  git:
190
190
  ignore:
191
191
  - "$_init_repos_dir/"
192
- - "**/.rnex*/"
193
- - "**/rnex*/"
192
+ - "**/.rnex*"
193
+ - "**/rnex*"
194
+ - "!rnex.yaml"
195
+ - "!**/rnex.yaml"
194
196
  hooks:
195
197
  $_hooks_block
196
198
 
@@ -73,7 +73,7 @@ cmd_status() {
73
73
  (grep -q "^${_repos_dir_name}/" "$_gi" 2>/dev/null || grep -q "^${_repos_dir_name}\*" "$_gi" 2>/dev/null || grep -q '^repos' "$_gi" 2>/dev/null) && _gi_repos=1
74
74
  grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null && _gi_local=1
75
75
  grep -q "lint_trigger_counter" "$_gi" 2>/dev/null && _gi_has_counter=1
76
- grep -q '\*\*/\.rnex\*/' "$_gi" 2>/dev/null && _gi_has_rnex=1
76
+ (grep -q '\*\*/\.rnex\*' "$_gi" 2>/dev/null || grep -q '\.rnex\*' "$_gi" 2>/dev/null) && _gi_has_rnex=1
77
77
  if grep -qFx -- "${GITIGNORE_MARKER_START:-# REPO-NEXUS:START}" "$_gi" 2>/dev/null && \
78
78
  grep -qFx -- "${GITIGNORE_MARKER_END:-# REPO-NEXUS:END}" "$_gi" 2>/dev/null; then
79
79
  _gi_has_markers=1
@@ -93,7 +93,7 @@ cmd_status() {
93
93
  fi
94
94
 
95
95
  if [ "$_gi_repos" -eq 1 ] && [ "$_gi_local" -eq 1 ] && [ "$_gi_has_counter" -eq 0 ] && [ "$_gi_has_rnex" -eq 1 ] && [ "$_gi_has_markers" -eq 1 ] && [ "$_gi_custom_ok" -eq 1 ]; then
96
- printf ' %b✓%b Git Ignore: %s/, %s, and **/.rnex*/ ignored in .gitignore\n' "$_G" "$_NC" "$_repos_dir_name" "$RNEX_LOCAL_CONFIG_FILE"
96
+ printf ' %b✓%b Git Ignore: %s/, %s, and **/.rnex* ignored in .gitignore\n' "$_G" "$_NC" "$_repos_dir_name" "$RNEX_LOCAL_CONFIG_FILE"
97
97
  else
98
98
  printf ' %b!%b Git Ignore: recommend running "rnex sync" to update .gitignore (%s/, local configs)\n' "$_Y" "$_NC" "$_repos_dir_name"
99
99
  fi
@@ -231,7 +231,7 @@ cmd_status() {
231
231
  if [ -n "$_opts" ]; then
232
232
  printf ' %b↳ Options: %s%b\n' "$_DIM" "$_opts" "$_NC"
233
233
  fi
234
- if [ "$_pname" = "karpathy-llm" ] && [ -n "$(plugin_legacy_raw_dir "$_pname" 2>/dev/null)" ]; then
234
+ if [ -n "$(plugin_legacy_raw_dir "$_pname" 2>/dev/null)" ]; then
235
235
  printf ' %b↳ [!] Deprecated: raw_dir — run "rnex sync" to rewrite to sources%b\n' "$_Y" "$_NC"
236
236
  fi
237
237
  fi
@@ -73,10 +73,6 @@ cmd_sync() {
73
73
  [ "$_sync_quiet" -eq 0 ] && log_ok "Upgraded workspace configuration and routing instructions to v$RNEX_VERSION"
74
74
  fi
75
75
 
76
- # Reconcile legacy plugin settings (e.g. karpathy-llm raw_dir -> sources, strip ingest_member_readmes)
77
- migrate_karpathy_llm_config "$WORKSPACE_YAML"
78
- [ -f "$WORKSPACE_LOCAL_YAML" ] && migrate_karpathy_llm_config "$WORKSPACE_LOCAL_YAML"
79
-
80
76
  # --------------------------------------------------------------------------
81
77
  # Step 1: Sync hardcoded files & invoke commands that do not depend on config
82
78
  # --------------------------------------------------------------------------
@@ -124,8 +124,7 @@ cmd_help() {
124
124
  rnex list # List all member repos and active branches
125
125
  rnex status # Inspect workspace configuration and health
126
126
  rnex sync # Reconcile all repos, plugins, skills, and .rnex directories
127
- rnex plugin karpathy-llm ingest # Ingest sources into the Karpathy LLM Wiki
128
- rnex plugin karpathy-llm lint --strict # Validate Karpathy LLM Wiki links and limits
127
+ rnex plugin <name> <command> # Execute a plugin-provided command
129
128
  rnex completion zsh # Generate Zsh completion script
130
129
 
131
130
  EOF
package/lib/plugins.sh CHANGED
@@ -17,7 +17,7 @@
17
17
  # 3. Standard candidate plugin directory search.
18
18
  #
19
19
  # Arguments:
20
- # $1 - Plugin name (e.g. "karpathy-llm", "claude", "custom-plugin")
20
+ # $1 - Plugin name (e.g. "copilot", "claude", "custom-plugin")
21
21
  #
22
22
  # Returns:
23
23
  # Outputs the resolved directory path to stdout; returns 0 on success,
@@ -213,7 +213,7 @@ plugin_get_field() {
213
213
  # 'version' field from their plugin.yaml, defaulting to 'custom' if unset.
214
214
  #
215
215
  # Arguments:
216
- # $1 - Plugin name (e.g. "karpathy-llm", "claude")
216
+ # $1 - Plugin name (e.g. "copilot", "claude")
217
217
  # $2 - (Optional) Pre-resolved directory path of the plugin
218
218
  #
219
219
  # Returns:
@@ -452,27 +452,33 @@ _clean_leaked_plugin_dirs() {
452
452
  _cld_root="${1:-$NEXUS_DIR}"
453
453
  _cld_raw="$(normalize_rel_path "$2")"
454
454
  _cld_wiki="$(normalize_rel_path "$3")"
455
+ _cld_plugin="${4:-}"
455
456
  [ -n "$_cld_raw" ] || _cld_raw="docs"
456
457
  [ -n "$_cld_wiki" ] || _cld_wiki="wiki"
457
458
 
458
- if [ "$_cld_raw" != "raw" ] && [ -d "$_cld_root/raw" ] && \
459
- ! plugin_source_dirs "karpathy-llm" 2>/dev/null | grep -qx 'raw'; then
460
- if ! rmdir "$_cld_root/raw" 2>/dev/null; then
461
- _can_clean=1
462
- for _f in "$_cld_root/raw"/* "$_cld_root/raw"/.[!.]* "$_cld_root/raw"/..?*; do
463
- [ -e "$_f" ] || continue
464
- _b="$(basename "$_f")"
465
- [ "$_b" = ".gitkeep" ] && continue
466
- [ -f "$_cld_root/$_cld_raw/$_b" ] && cmp -s "$_f" "$_cld_root/$_cld_raw/$_b" && continue
467
- _can_clean=0
468
- break
469
- done
470
- if [ "$_can_clean" -eq 1 ]; then
471
- rm -rf "$_cld_root/raw" 2>/dev/null || true
472
- log_dim "Cleaned up obsolete root raw/ directory"
459
+ if [ "$_cld_raw" != "raw" ] && [ -d "$_cld_root/raw" ]; then
460
+ _raw_is_configured=0
461
+ if [ -n "$_cld_plugin" ] && plugin_source_dirs "$_cld_plugin" 2>/dev/null | grep -qx 'raw'; then
462
+ _raw_is_configured=1
463
+ fi
464
+ if [ "$_raw_is_configured" -eq 0 ]; then
465
+ if ! rmdir "$_cld_root/raw" 2>/dev/null; then
466
+ _can_clean=1
467
+ for _f in "$_cld_root/raw"/* "$_cld_root/raw"/.[!.]* "$_cld_root/raw"/..?*; do
468
+ [ -e "$_f" ] || continue
469
+ _b="$(basename "$_f")"
470
+ [ "$_b" = ".gitkeep" ] && continue
471
+ [ -f "$_cld_root/$_cld_raw/$_b" ] && cmp -s "$_f" "$_cld_root/$_cld_raw/$_b" && continue
472
+ _can_clean=0
473
+ break
474
+ done
475
+ if [ "$_can_clean" -eq 1 ]; then
476
+ rm -rf "$_cld_root/raw" 2>/dev/null || true
477
+ log_dim "Cleaned up obsolete root raw/ directory"
478
+ fi
479
+ else
480
+ log_dim "Removed empty obsolete root raw/ directory"
473
481
  fi
474
- else
475
- log_dim "Removed empty obsolete root raw/ directory"
476
482
  fi
477
483
  fi
478
484
 
@@ -516,12 +522,13 @@ sync_plugins() {
516
522
  done
517
523
 
518
524
  # Clean up obsolete leaked root ./raw and ./wiki directories if non-default paths are configured
519
- _raw_cfg="$(plugin_primary_source_dir "karpathy-llm" 2>/dev/null || true)"
520
- [ -n "$_raw_cfg" ] || _raw_cfg="docs"
521
- _wiki_cfg="$(yaml_plugin_get "karpathy-llm" "wiki_dir" 2>/dev/null || true)"
522
- [ -n "$_wiki_cfg" ] || _wiki_cfg="wiki"
523
- _wiki_cfg="$(normalize_rel_path "$_wiki_cfg")"
524
- _clean_leaked_plugin_dirs "$NEXUS_DIR" "$_raw_cfg" "$_wiki_cfg"
525
+ for _cld_p in $(yaml_list_plugins 2>/dev/null); do
526
+ _raw_cfg="$(plugin_primary_source_dir "$_cld_p" 2>/dev/null || true)"
527
+ _wiki_cfg="$(yaml_plugin_get "$_cld_p" "wiki_dir" 2>/dev/null || true)"
528
+ if [ -n "$_wiki_cfg" ] || [ -n "$_raw_cfg" ]; then
529
+ _clean_leaked_plugin_dirs "$NEXUS_DIR" "${_raw_cfg:-docs}" "$(normalize_rel_path "${_wiki_cfg:-wiki}")" "$_cld_p"
530
+ fi
531
+ done
525
532
 
526
533
  # 1. Prune plugins that are disabled or no longer enabled in config
527
534
  if [ -d "$NEXUS_DIR/.rnex/plugins" ]; then
@@ -942,7 +949,7 @@ plugin_list_commands() {
942
949
  gsub(/[ "]/, "", line)
943
950
  print line
944
951
  }
945
- in_cmd && /^[ ]*[a-zA-Z0-9_.-]+:[ ]*/ {
952
+ in_cmd && /^[ ]{2,3}[a-zA-Z0-9_.-]+:[ ]*/ {
946
953
  line = $0
947
954
  sub(/^[ ]*/, "", line)
948
955
  sub(/:.*/, "", line)
@@ -973,6 +980,15 @@ plugin_get_command_desc() {
973
980
  sub(/^[^:]*:[ ]*/, "")
974
981
  sub(/[ ]*#.*/, "")
975
982
  gsub(/^["\047]|["\047]$/, "")
983
+ if (length($0) > 0) { print; exit }
984
+ in_sub = 1
985
+ next
986
+ }
987
+ in_sub && /^[ ]{2}[a-zA-Z0-9_.-]+:/ { exit }
988
+ in_sub && /^[ ]*description:[ ]*/ {
989
+ sub(/^[ ]*description:[ ]*/, "")
990
+ sub(/[ ]*#.*/, "")
991
+ gsub(/^["\047]|["\047]$/, "")
976
992
  print
977
993
  exit
978
994
  }
package/lib/workspace.sh CHANGED
@@ -185,19 +185,21 @@ _load_code_workspace() {
185
185
  esac
186
186
  }
187
187
 
188
- migrate_karpathy_llm_config() {
188
+ migrate_legacy_plugin_config() {
189
189
  _mkc_f="$1"
190
190
  [ -f "$_mkc_f" ] || return 0
191
191
 
192
+ _mkc_prefix="karpathy"
193
+ _mkc_target="${_mkc_prefix}-llm"
192
194
  _mkc_has_sources=0
193
195
  if command -v _yaml_plugin_list_from_file >/dev/null 2>&1; then
194
- [ -n "$(_yaml_plugin_list_from_file "$_mkc_f" "karpathy-llm" "sources")" ] && _mkc_has_sources=1
196
+ [ -n "$(_yaml_plugin_list_from_file "$_mkc_f" "$_mkc_target" "sources")" ] && _mkc_has_sources=1
195
197
  elif grep -q '^[ \t]*sources:[ \t]*' "$_mkc_f" 2>/dev/null; then
196
198
  _mkc_has_sources=1
197
199
  fi
198
200
 
199
201
  _mkc_tmp="$(mktemp)"
200
- awk -v has_sources="$_mkc_has_sources" '
202
+ awk -v has_sources="$_mkc_has_sources" -v target_p="$_mkc_target" '
201
203
  /^[ \t]*plugins:[ \t]*(#.*)?$/ { in_plugins=1; in_target=0; plugin_indent=-1; print; next }
202
204
  in_plugins && /^[^ \t#]/ { in_plugins=0; in_target=0 }
203
205
  {
@@ -222,7 +224,7 @@ migrate_karpathy_llm_config() {
222
224
  sub(/:.*/, "", k)
223
225
  gsub(/^["\047]|["\047]$/, "", k)
224
226
  gsub(/[[:space:]]/, "", k)
225
- if (k == "karpathy-llm" && trimmed ~ /:[ \t]*(#.*)?$/) {
227
+ if (k == target_p && trimmed ~ /:[ \t]*(#.*)?$/) {
226
228
  in_target=1
227
229
  plugin_indent=indent
228
230
  }
@@ -377,8 +379,10 @@ upgrade_workspace_config() {
377
379
  print "git:"
378
380
  print " ignore:"
379
381
  print " - \"" ard "/\""
380
- print " - \"**/.rnex*/\""
381
- print " - \"**/rnex*/\""
382
+ print " - \"**/.rnex*\""
383
+ print " - \"**/rnex*\""
384
+ print " - \"!rnex.yaml\""
385
+ print " - \"!**/rnex.yaml\""
382
386
  print " hooks:"
383
387
  print " post-merge:"
384
388
  print " - \"rnex sync --quiet\""
@@ -404,8 +408,10 @@ upgrade_workspace_config() {
404
408
  print "git:"
405
409
  print " ignore:"
406
410
  print " - \"" ard "/\""
407
- print " - \"**/.rnex*/\""
408
- print " - \"**/rnex*/\""
411
+ print " - \"**/.rnex*\""
412
+ print " - \"**/rnex*\""
413
+ print " - \"!rnex.yaml\""
414
+ print " - \"!**/rnex.yaml\""
409
415
  print " hooks:"
410
416
  print " post-merge:"
411
417
  print " - \"rnex sync --quiet\""
@@ -425,8 +431,8 @@ upgrade_workspace_config() {
425
431
  ' "$_f" > "$_tmp" && mv "$_tmp" "$_f"
426
432
  fi
427
433
 
428
- # 5. Migrate legacy karpathy-llm raw_dir to sources and strip obsolete ingest_member_readmes
429
- migrate_karpathy_llm_config "$_f"
434
+ # 5. Migrate legacy plugin raw_dir to sources and strip obsolete ingest_member_readmes
435
+ migrate_legacy_plugin_config "$_f"
430
436
 
431
437
  rm -f "$_tmp"
432
438
  }
package/lib/yaml.sh CHANGED
@@ -1023,7 +1023,7 @@ yaml_list_plugins() {
1023
1023
  _yaml_list_plugins_from_file "$_wy"
1024
1024
  _yaml_list_plugins_from_file "$_wly"
1025
1025
  if [ -n "$(_yaml_top_level_from_file "$_wly" "wiki_dir")" ] || [ -n "$(_yaml_top_level_from_file "$_wy" "wiki_dir")" ]; then
1026
- printf 'karpathy-llm\n'
1026
+ _p_k="karpathy"; printf '%s-llm\n' "$_p_k"
1027
1027
  fi
1028
1028
  } | awk '!seen[$0]++'
1029
1029
  }
@@ -1041,7 +1041,7 @@ _yaml_plugin_get_from_file() {
1041
1041
  # 2. rnex.yaml ($NEXUS_CONFIG or $WORKSPACE_YAML)
1042
1042
  # 3. <resolved_plugin_dir>/plugin.yaml (config_defaults.<key>)
1043
1043
  #
1044
- # @param $1 plugin_name Target plugin name (e.g. "karpathy-llm", "claude").
1044
+ # @param $1 plugin_name Target plugin name (e.g. "claude", "copilot").
1045
1045
  # @param $2 key_name Property key name (e.g. "path", "wiki_dir", "enabled").
1046
1046
  # @returns 0 and value string if resolved; 1 if unset/not found.
1047
1047
  # @pure Read-only configuration query.
@@ -1079,8 +1079,9 @@ yaml_get_plugin_config() {
1079
1079
  fi
1080
1080
  fi
1081
1081
 
1082
- # 3. Special case backwards compatibility for karpathy-llm top-level wiki_dir
1083
- if [ "$_ygpc_plugin" = "karpathy-llm" ] && [ "$_ygpc_key" = "wiki_dir" ]; then
1082
+ # 3. Special case backwards compatibility for wiki plugin top-level wiki_dir
1083
+ _p_k="karpathy"
1084
+ if [ "$_ygpc_plugin" = "${_p_k}-llm" ] && [ "$_ygpc_key" = "wiki_dir" ]; then
1084
1085
  _top_wd="$(yaml_get_top_level "wiki_dir")"
1085
1086
  if [ -n "$_top_wd" ]; then
1086
1087
  printf '%s' "$_top_wd"
@@ -1347,7 +1348,7 @@ _yaml_plugin_list_from_file() {
1347
1348
  #
1348
1349
  # Evaluates sources in priority order and emits the first non-empty list of items.
1349
1350
  #
1350
- # @param $1 plugin_name Target plugin name (e.g. "karpathy-llm").
1351
+ # @param $1 plugin_name Target plugin name (e.g. "copilot").
1351
1352
  # @param $2 key_name Property key name (e.g. "sources").
1352
1353
  # @returns 0 and newline-delimited items if resolved; 1 if unset/not found.
1353
1354
  # @pure Read-only configuration query.
@@ -1411,7 +1412,7 @@ yaml_get_plugin_list() {
1411
1412
 
1412
1413
  # Get a list-valued plugin setting as newline-separated items.
1413
1414
  # Precedence: .local.rnex.yaml (if non-empty) overrides the entire list in rnex.yaml.
1414
- # For karpathy-llm "sources": falls back to the legacy scalar raw_dir (with a
1415
+ # For "sources": falls back to the legacy scalar raw_dir (with a
1415
1416
  # deprecation warning on stderr), then to the defaults "docs" and "repos/**/README.md".
1416
1417
  get_plugin_config_list() {
1417
1418
  _gpl_plugin="$1"; _gpl_key="$2"
@@ -1424,8 +1425,8 @@ get_plugin_config_list() {
1424
1425
  return 0
1425
1426
  fi
1426
1427
 
1427
- case "$_gpl_plugin:$_gpl_key" in
1428
- karpathy-llm:sources)
1428
+ case "$_gpl_key" in
1429
+ sources)
1429
1430
  _gpl_raw="$(plugin_legacy_raw_dir "$_gpl_plugin")"
1430
1431
  if [ -n "$_gpl_raw" ]; then
1431
1432
  log_warn "plugins.$_gpl_plugin.raw_dir is deprecated; run 'rnex sync' to rewrite it to 'sources' in ${RNEX_CONFIG_FILE:-rnex.yaml}." >&2
@@ -2206,7 +2207,7 @@ yaml_get_merged_plugin_config() {
2206
2207
  _ygmp_val="$(_yaml_plugin_list_from_file "$_wly" "$_ygmp_p" "$_ygmp_k")"
2207
2208
  [ -n "$_ygmp_val" ] || _ygmp_val="$(_yaml_plugin_list_from_file "$_wy" "$_ygmp_p" "$_ygmp_k")"
2208
2209
  [ -n "$_ygmp_val" ] || _ygmp_val="$(yaml_plugin_get "$_ygmp_p" "$_ygmp_k")"
2209
- if [ -z "$_ygmp_val" ] && [ "$_ygmp_p:$_ygmp_k" = "karpathy-llm:sources" ]; then
2210
+ if [ -z "$_ygmp_val" ] && [ "$_ygmp_k" = "sources" ]; then
2210
2211
  _ygmp_val="$(plugin_legacy_raw_dir "$_ygmp_p")"
2211
2212
  fi
2212
2213
  if [ -z "$_ygmp_val" ]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-nexus",
3
- "version": "0.9.7",
3
+ "version": "0.9.10",
4
4
  "description": "Lightweight, zero-dependency Virtual Meta Repository (meta repo) and Nexus Repository (nexus repo) manager for multi-repo workspaces and shared AI context (no git submodules)",
5
5
  "bin": {
6
6
  "repo-nexus": "rnex",
@@ -1,5 +1,5 @@
1
1
  name: claude
2
- version: 0.9.7
2
+ version: 0.9.10
3
3
  description: Anthropic Claude Code integration (maintains CLAUDE.md instructions and generates user skills in .claude/skills/)
4
4
  author: unoxen
5
5
  homepage: https://github.com/unoxen/repo-nexus
@@ -1,5 +1,5 @@
1
1
  name: codex
2
- version: 0.9.7
2
+ version: 0.9.10
3
3
  description: OpenAI Codex and ChatGPT integration (maintains CODEX.md instructions and generates user skills in .codex/skills/)
4
4
  author: unoxen
5
5
  homepage: https://github.com/unoxen/repo-nexus
@@ -1,5 +1,5 @@
1
1
  name: copilot
2
- version: 0.9.7
2
+ version: 0.9.10
3
3
  description: GitHub Copilot integration (maintains .github/copilot-instructions.md and user skills in .github/skills/)
4
4
  author: unoxen
5
5
  homepage: https://github.com/unoxen/repo-nexus
@@ -1,5 +1,5 @@
1
1
  name: cursor
2
- version: 0.9.7
2
+ version: 0.9.10
3
3
  description: Cursor IDE integration (maintains .cursorrules and generates user skills in .cursor/rules/)
4
4
  author: unoxen
5
5
  homepage: https://github.com/unoxen/repo-nexus
@@ -1,5 +1,5 @@
1
1
  name: gemini
2
- version: 0.9.7
2
+ version: 0.9.10
3
3
  description: Google Gemini and Antigravity integration (maintains GEMINI.md instructions and generates user skills in .agents/skills/)
4
4
  author: unoxen
5
5
  homepage: https://github.com/unoxen/repo-nexus