repo-nexus 0.10.0 → 0.10.2

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.
@@ -124,10 +124,20 @@ cmd_sync() {
124
124
  validate_configured_plugins || _sync_validation_failed=1
125
125
  fi
126
126
 
127
- _sync_quiet="$_old_sync_quiet"
128
127
  if [ "$_sync_validation_failed" -ne 0 ]; then
128
+ _sync_quiet="$_old_sync_quiet"
129
129
  return 1
130
130
  fi
131
+
132
+ # 3.6. Reconcile workspace config version with active CLI version (after validation passes)
133
+ if command -v sync_workspace_config_version >/dev/null 2>&1; then
134
+ sync_workspace_config_version "$_sync_quiet" || {
135
+ _sync_quiet="$_old_sync_quiet"
136
+ return 1
137
+ }
138
+ fi
139
+
140
+ _sync_quiet="$_old_sync_quiet"
131
141
  if [ "$_sync_quiet" -eq 0 ]; then
132
142
  log_ok "Sync complete — workspace, plugins, skills, and member repositories reconciled"
133
143
  fi
package/lib/workspace.sh CHANGED
@@ -202,3 +202,47 @@ _load_code_workspace() {
202
202
  ;;
203
203
  esac
204
204
  }
205
+
206
+ # ----------------------------------------------------------------------------
207
+ # sync_workspace_config_version
208
+ # Summary: Updates the top-level `version:` property in $WORKSPACE_YAML to
209
+ # match $RNEX_VERSION whenever the existing version is missing or older
210
+ # than the active CLI version. Never downgrades a newer version.
211
+ # @param $1: quiet - Optional quiet flag (0 = log update notice, 1 = silent).
212
+ # @returns: 0 if up to date or updated successfully; 1 on write failure.
213
+ # @sideEffects: May update `version:` in $WORKSPACE_YAML, reload
214
+ # WORKSPACE_CONFIG_VERSION, and refresh .rnex/sync_stamp.
215
+ # ----------------------------------------------------------------------------
216
+ sync_workspace_config_version() {
217
+ _swv_quiet="${1:-0}"
218
+ [ -n "${RNEX_VERSION:-}" ] || return 0
219
+ [ -f "${WORKSPACE_YAML:-}" ] || return 0
220
+
221
+ # Read version strictly from primary workspace config so local overrides
222
+ # cannot mask a stale or missing team config version.
223
+ _swv_cur="$(_yaml_top_level_from_file "$WORKSPACE_YAML" "version")"
224
+ _swv_norm_cur="${_swv_cur#v}"
225
+ _swv_norm_cur="${_swv_norm_cur#V}"
226
+ _swv_norm_cli="${RNEX_VERSION#v}"
227
+ _swv_norm_cli="${_swv_norm_cli#V}"
228
+
229
+ _swv_cmp=0
230
+ version_cmp "$_swv_norm_cur" "$_swv_norm_cli" || _swv_cmp=$?
231
+ [ "$_swv_cmp" -eq 2 ] || return 0
232
+
233
+ if yaml_set_top_level "version" "$_swv_norm_cli"; then
234
+ _load_workspace_version
235
+ if [ -n "${NEXUS_DIR:-}" ]; then
236
+ update_sync_stamp "$NEXUS_DIR"
237
+ fi
238
+ if [ "$_swv_quiet" -eq 0 ]; then
239
+ if [ -n "$_swv_cur" ]; then
240
+ log_ok "Updated workspace configuration version from v$_swv_cur to v$_swv_norm_cli"
241
+ else
242
+ log_ok "Set workspace configuration version to v$_swv_norm_cli"
243
+ fi
244
+ fi
245
+ return 0
246
+ fi
247
+ return 1
248
+ }
package/lib/yaml.sh CHANGED
@@ -2558,43 +2558,88 @@ yaml_set_local() {
2558
2558
 
2559
2559
  # ---- Top-Level Key Setters -------------------------------------------------
2560
2560
 
2561
- # Set a top-level key/value pair in a specific YAML file, inserting before 'plugins:' or 'repos:'.
2561
+ # Set or insert a top-level scalar property in a specific YAML file atomically.
2562
+ # Updates ONLY the first matching column-0 key in-place; if absent, inserts it
2563
+ # after any YAML document start marker ('---') and leading header comments.
2564
+ # Avoids rewriting the file when bytes are unchanged.
2565
+ #
2566
+ # @param $1 file Target YAML file path.
2567
+ # @param $2 key Top-level property key name (alphanumeric, '_', '.', '-').
2568
+ # @param $3 value Single-line scalar value string.
2569
+ # @returns 0 on success; 1 if file missing/unwritable or arguments invalid.
2570
+ # @sideEffects Atomically updates target YAML file via mktemp + mv when changed.
2562
2571
  _yaml_set_top_level_in_file() {
2563
2572
  _file="$1"; _key="$2"; _val="$3"
2564
- [ -f "$_file" ] || return 0
2565
- _tmp="$(mktemp)"
2566
- if grep -q "^[ ]*${_key}:" "$_file" 2>/dev/null; then
2567
- awk -v key="$_key" -v val="$_val" '
2568
- $0 ~ ("^[ ]*" key ":") {
2573
+ [ -f "$_file" ] && [ -w "$_file" ] || return 1
2574
+
2575
+ # Reject unsafe key names (regex/awk metacharacters) or multi-line values
2576
+ case "$_key" in
2577
+ ""|*[!a-zA-Z0-9_.-]*) return 1 ;;
2578
+ esac
2579
+ case "$_val" in
2580
+ *"
2581
+ "*) return 1 ;;
2582
+ esac
2583
+
2584
+ _tmp="$(mktemp)" || return 1
2585
+ _yst_ok=0
2586
+ if awk -v pat="^${_key}[ \t]*:" 'BEGIN { f = 0 } $0 ~ pat { f = 1; exit } END { exit !f }' "$_file" 2>/dev/null; then
2587
+ if _YST_VAL="$_val" awk -v key="$_key" '
2588
+ BEGIN { val = ENVIRON["_YST_VAL"]; updated = 0 }
2589
+ !updated && $0 ~ ("^" key "[ \t]*:") {
2569
2590
  print key ": " val
2591
+ updated = 1
2570
2592
  next
2571
2593
  }
2572
2594
  { print }
2573
- ' "$_file" > "$_tmp" && mv "$_tmp" "$_file"
2595
+ ' "$_file" > "$_tmp"; then
2596
+ _yst_ok=1
2597
+ fi
2574
2598
  else
2575
- awk -v key="$_key" -v val="$_val" '
2576
- BEGIN { inserted=0 }
2577
- /^[ ]*(plugins|repos):/ && !inserted {
2599
+ if _YST_VAL="$_val" awk -v key="$_key" '
2600
+ BEGIN { val = ENVIRON["_YST_VAL"]; inserted = 0 }
2601
+ !inserted && $0 !~ /^[ \t]*(#.*)?$/ && $0 !~ /^---([ \t]*#.*)?$/ {
2578
2602
  print key ": " val
2579
2603
  print ""
2580
- inserted=1
2604
+ inserted = 1
2581
2605
  }
2582
2606
  { print }
2583
2607
  END {
2584
2608
  if (!inserted) {
2585
- print ""
2586
2609
  print key ": " val
2587
2610
  }
2588
2611
  }
2589
- ' "$_file" > "$_tmp" && mv "$_tmp" "$_file"
2612
+ ' "$_file" > "$_tmp"; then
2613
+ _yst_ok=1
2614
+ fi
2590
2615
  fi
2616
+
2617
+ if [ "$_yst_ok" -eq 1 ]; then
2618
+ if ! cmp -s "$_file" "$_tmp"; then
2619
+ mv "$_tmp" "$_file"
2620
+ else
2621
+ rm -f "$_tmp"
2622
+ fi
2623
+ return 0
2624
+ fi
2625
+
2591
2626
  rm -f "$_tmp"
2627
+ return 1
2592
2628
  }
2593
2629
 
2630
+ # Set or insert a top-level scalar property in team workspace config (rnex.yaml).
2631
+ # @param $1 key Top-level scalar key name.
2632
+ # @param $2 value Single-line scalar value string.
2633
+ # @returns 0 on success; non-zero on failure.
2594
2634
  yaml_set_top_level() {
2595
- _yaml_set_top_level_in_file "$WORKSPACE_YAML" "$1" "$2"
2635
+ _yaml_resolve_files
2636
+ _yaml_set_top_level_in_file "${WORKSPACE_YAML:-$_wy}" "$1" "$2"
2596
2637
  }
2597
2638
 
2639
+ # Set or insert a top-level scalar property in local override config (.local.rnex.yaml).
2640
+ # @param $1 key Top-level scalar key name.
2641
+ # @param $2 value Single-line scalar value string.
2642
+ # @returns 0 on success; non-zero on failure.
2598
2643
  yaml_set_top_level_local() {
2599
2644
  _ensure_local_yaml_file ""
2600
2645
  _yaml_set_top_level_in_file "$WORKSPACE_LOCAL_YAML" "$1" "$2"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-nexus",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
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",
@@ -64,4 +64,4 @@
64
64
  "esbuild": "^0.25.0",
65
65
  "vite": "^6.4.4"
66
66
  }
67
- }
67
+ }
@@ -1,5 +1,5 @@
1
1
  name: claude
2
- version: 0.10.0
2
+ version: 0.10.2
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.10.0
2
+ version: 0.10.2
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.10.0
2
+ version: 0.10.2
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.10.0
2
+ version: 0.10.2
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.10.0
2
+ version: 0.10.2
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
@@ -117,12 +117,18 @@ The `llm-wiki` plugin exposes a streamlined 2-command CLI:
117
117
  # Ingest missing sources from configured plugins.llm-wiki.sources
118
118
  rnex plugin llm-wiki ingest
119
119
 
120
- # Ingest a specific markdown source file directly in place
120
+ # Ingest a specific markdown source file or directory directly in place
121
121
  rnex plugin llm-wiki ingest <source_path>
122
- rnex plugin llm-wiki ingest --file <source_path>
123
122
 
124
- # Lint existing wiki structure, link integrity, and zero-symlink invariants
123
+ # Force re-index existing entries for a modified file, directory, or all configured sources
124
+ rnex plugin llm-wiki ingest --force [<source_path>]
125
+ rnex plugin llm-wiki ingest -f [<source_path>]
126
+
127
+ # Validate and auto-heal existing wiki docs, headers, link integrity, and B-Tree shards
125
128
  rnex plugin llm-wiki lint
129
+
130
+ # Fast link-and-structure-only validation without reading source document content
131
+ rnex plugin llm-wiki lint --shallow
126
132
  ```
127
133
 
128
134
  ### Automated Synchronization Hooks (Strictly Opt-In)
@@ -3,15 +3,15 @@
3
3
  # =============================================================================
4
4
  # File: plugins/llm-wiki/bin/ingest.sh
5
5
  # Architectural Layer: Plugin CLI Entrypoint (ingest)
6
- # Single Responsibility: Ingest ONLY missing Markdown documentation sources into
7
- # the encapsulated .rnex/wiki/ B-Tree store.
6
+ # Single Responsibility: Ingest Markdown documentation sources into the
7
+ # encapsulated .rnex/wiki/ B-Tree store.
8
8
  #
9
9
  # Constraints & Principles:
10
- # - Single Responsibility Principle (SRP): Confined strictly to missing-source
10
+ # - Single Responsibility Principle (SRP): Confined strictly to source
11
11
  # ingestion. Performs zero linting or graph operations.
12
- # - Idempotency & Missing-Only: Never overwrites already-indexed sources;
13
- # processes only missing sources discovered via CLI argument or configured
14
- # sources in .local.rnex.yaml / rnex.yaml.
12
+ # - Strategy Pattern: By default ingests ONLY missing sources (preserving
13
+ # existing entries). With `--force` (`-f`), re-indexes existing entries
14
+ # matched by the positional path or configured sources.
15
15
  # - POSIX Compliance: Standard /bin/sh syntax without bashisms.
16
16
  # =============================================================================
17
17
  set -e
@@ -39,8 +39,10 @@ esac
39
39
  # main_ingest
40
40
  # Summary: Entrypoint for the `rnex plugin llm-wiki ingest` CLI command.
41
41
  # Parses CLI arguments, loads the wiki configuration contract,
42
- # resolves missing source files, and ingests them into B-Tree shards.
43
- # @param $@: CLI arguments ([<source_path>], --file/-f, --rewrite-links,
42
+ # resolves missing (or forced candidate) source files from a
43
+ # positional file/directory/glob path or configured sources, and
44
+ # ingests them into B-Tree shards.
45
+ # @param $@: CLI arguments ([<source_path>], --force/-f, --rewrite-links,
44
46
  # --strip-links, --quiet/-q, --help/-h).
45
47
  # @returns: 0 on successful ingestion; 1 on configuration or source error.
46
48
  # @sideEffects: Mutates configured wikiDir shards, indexFile, and logFile.
@@ -50,17 +52,13 @@ main_ingest() {
50
52
  load_wiki_config_contract "$_ws_root" || exit 1
51
53
 
52
54
  _source_arg=""
55
+ _force=0
53
56
  _quiet=0
54
57
 
55
58
  while [ $# -gt 0 ]; do
56
59
  case "$1" in
57
- --file|-f|--source|-s)
58
- shift
59
- _source_arg="${1:-}"
60
- if [ -z "$_source_arg" ]; then
61
- printf 'Error [ingest]: Missing path argument after flag.\n' >&2
62
- exit 1
63
- fi
60
+ --force|-f)
61
+ _force=1
64
62
  shift
65
63
  ;;
66
64
  --quiet|-q)
@@ -78,14 +76,18 @@ main_ingest() {
78
76
  shift
79
77
  ;;
80
78
  --help|-h)
81
- printf 'Usage: rnex plugin llm-wiki ingest [<source_path>] [--file <path>] [--rewrite-links] [--strip-links] [--quiet]\n'
79
+ printf 'Usage: rnex plugin llm-wiki ingest [<source_path>] [--force|-f] [--rewrite-links] [--strip-links] [--quiet|-q]\n'
82
80
  exit 0
83
81
  ;;
84
82
  -*)
85
- printf 'Error [ingest]: Unknown option "%s". Usage: rnex plugin llm-wiki ingest [<source_path>]\n' "$1" >&2
83
+ printf 'Error [ingest]: Unknown option "%s". Usage: rnex plugin llm-wiki ingest [<source_path>] [--force|-f] [--rewrite-links] [--strip-links] [--quiet|-q]\n' "$1" >&2
86
84
  exit 1
87
85
  ;;
88
86
  *)
87
+ if [ -n "$_source_arg" ]; then
88
+ printf 'Error [ingest]: Unexpected extra argument "%s". Pass at most one <source_path>.\n' "$1" >&2
89
+ exit 1
90
+ fi
89
91
  _source_arg="$1"
90
92
  shift
91
93
  ;;
@@ -93,19 +95,30 @@ main_ingest() {
93
95
  done
94
96
 
95
97
  mkdir -p "$RNEX_WIKI_ROOT"
96
- _missing_manifest="${RNEX_WIKI_ROOT}/.missing_sources.$$"
97
- if ! resolve_missing_sources_to_ingest "$_source_arg" "$_missing_manifest"; then
98
- rm -f "$_missing_manifest"
99
- exit 1
100
- fi
101
-
102
- if [ "$_quiet" -eq 1 ]; then
103
- ingest_missing_sources_into_btree "$_missing_manifest" "$_source_arg" >/dev/null
98
+ _manifest="${RNEX_WIKI_ROOT}/.ingest_sources.$$"
99
+ if [ "$_force" -eq 1 ]; then
100
+ if ! resolve_candidate_sources "$_source_arg" "$_manifest"; then
101
+ rm -f "$_manifest"
102
+ exit 1
103
+ fi
104
+ if [ "$_quiet" -eq 1 ]; then
105
+ force_reingest_sources_into_btree "$_manifest" "$_source_arg" >/dev/null
106
+ else
107
+ force_reingest_sources_into_btree "$_manifest" "$_source_arg"
108
+ fi
104
109
  else
105
- ingest_missing_sources_into_btree "$_missing_manifest" "$_source_arg"
110
+ if ! resolve_missing_sources_to_ingest "$_source_arg" "$_manifest"; then
111
+ rm -f "$_manifest"
112
+ exit 1
113
+ fi
114
+ if [ "$_quiet" -eq 1 ]; then
115
+ ingest_missing_sources_into_btree "$_manifest" "$_source_arg" >/dev/null
116
+ else
117
+ ingest_missing_sources_into_btree "$_manifest" "$_source_arg"
118
+ fi
106
119
  fi
107
120
  _rc=$?
108
- rm -f "$_missing_manifest"
121
+ rm -f "$_manifest"
109
122
  exit "$_rc"
110
123
  }
111
124
 
@@ -3,13 +3,18 @@
3
3
  # =============================================================================
4
4
  # File: plugins/llm-wiki/bin/lint.sh
5
5
  # Architectural Layer: Plugin CLI Entrypoint (lint)
6
- # Single Responsibility: Lint ONLY existing documentation and references inside
7
- # .rnex/wiki/. Does NOT inspect rnex config `sources` and does NOT run ingestion.
6
+ # Single Responsibility: Validate and auto-heal existing documentation and
7
+ # references inside .rnex/wiki/. Does NOT inspect rnex config `sources` and
8
+ # does NOT ingest missing documents.
8
9
  #
9
10
  # Design Patterns & Principles:
10
- # - Single Responsibility Principle (SRP): Confined strictly to read-only
11
- # structural and link verification. Zero compilation or mutation.
12
- # - Fail-Fast Principle: Exits with non-zero status on the first invariant failure.
11
+ # - Single Responsibility Principle (SRP): Confined strictly to existing
12
+ # wiki verification and auto-healing. Zero missing-source ingestion.
13
+ # - Strategy Pattern: Deep content validation by default (refreshes stale
14
+ # entry titles and summaries from authoritative sources); `--shallow`
15
+ # validates and heals links and B-Tree structure only without reading
16
+ # document content.
17
+ # - Fail-Fast Principle: Exits with non-zero status on unresolvable errors.
13
18
  #
14
19
  # Standards: Pure POSIX Shell (/bin/sh), zero external runtime dependencies.
15
20
  # =============================================================================
@@ -40,22 +45,22 @@ esac
40
45
  # -----------------------------------------------------------------------------
41
46
  # main_lint
42
47
  # Summary: Entrypoint for the `rnex plugin llm-wiki lint` CLI command.
43
- # Parses CLI arguments, loads configuration, and delegates to the
44
- # pure lint helper.
45
- # @param $@: CLI arguments (--strict, --quiet/-q, --help/-h).
46
- # @returns: 0 on successful validation; 1 on any structural or reference error.
48
+ # Parses CLI arguments, loads configuration, and delegates to
49
+ # lint_existing_wiki_directory.
50
+ # @param $@: CLI arguments (--shallow, --quiet/-q, --help/-h).
51
+ # @returns: 0 on successful validation/healing; 1 on any unresolvable error.
47
52
  # -----------------------------------------------------------------------------
48
53
  main_lint() {
49
54
  _ws_root="${RNEX_WORKSPACE_ROOT:-${RNEX_ROOT:-$(pwd)}}"
50
55
  load_wiki_config_contract "$_ws_root" || exit 1
51
56
 
57
+ _shallow=0
52
58
  _quiet=0
53
- _strict=0
54
59
 
55
60
  while [ $# -gt 0 ]; do
56
61
  case "$1" in
57
- --strict)
58
- _strict=1
62
+ --shallow)
63
+ _shallow=1
59
64
  shift
60
65
  ;;
61
66
  --quiet|-q)
@@ -63,15 +68,15 @@ main_lint() {
63
68
  shift
64
69
  ;;
65
70
  --help|-h)
66
- printf 'Usage: rnex plugin llm-wiki lint [--strict] [--quiet]\n'
71
+ printf 'Usage: rnex plugin llm-wiki lint [--shallow] [--quiet|-q]\n'
67
72
  printf '\n'
68
- printf 'Validates existing wiki documentation, B-Tree shard links, and references.\n'
69
- printf 'Does not inspect workspace sources or trigger ingestion.\n'
73
+ printf 'Validates and auto-heals existing wiki documentation, headers, B-Tree shards, and references.\n'
74
+ printf 'Use --shallow to validate only links and structure without reading source document content.\n'
70
75
  exit 0
71
76
  ;;
72
77
  -*)
73
78
  printf 'Error [lint]: Unknown option "%s".\n' "$1" >&2
74
- printf 'Usage: rnex plugin llm-wiki lint [--strict] [--quiet]\n' >&2
79
+ printf 'Usage: rnex plugin llm-wiki lint [--shallow] [--quiet|-q]\n' >&2
75
80
  exit 1
76
81
  ;;
77
82
  *)
@@ -81,9 +86,9 @@ main_lint() {
81
86
  done
82
87
 
83
88
  if [ "$_quiet" -eq 1 ]; then
84
- lint_existing_wiki_directory "$_strict" "$_quiet" >/dev/null
89
+ lint_existing_wiki_directory "$_shallow" "$_quiet" >/dev/null
85
90
  else
86
- lint_existing_wiki_directory "$_strict" "$_quiet"
91
+ lint_existing_wiki_directory "$_shallow" "$_quiet"
87
92
  fi
88
93
  }
89
94