repo-nexus 0.7.39 → 0.8.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.
Files changed (40) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +15 -15
  3. package/lib/ai.sh +47 -6
  4. package/lib/commands/completion.sh +36 -41
  5. package/lib/commands/init.sh +32 -11
  6. package/lib/commands/plugin.sh +142 -59
  7. package/lib/commands/repo.sh +397 -166
  8. package/lib/commands/status.sh +26 -43
  9. package/lib/commands/sync.sh +8 -34
  10. package/lib/commands/system.sh +19 -34
  11. package/lib/hooks.sh +140 -169
  12. package/lib/plugins.sh +199 -6
  13. package/lib/sdk.sh +7 -0
  14. package/lib/workspace.sh +53 -17
  15. package/lib/yaml.sh +386 -4
  16. package/package.json +5 -3
  17. package/rnex +8 -13
  18. package/templates/rnex.example.yaml +99 -154
  19. package/toolkit/plugins/claude/hooks/before_plugin_disable.sh +1 -2
  20. package/toolkit/plugins/codex/hooks/before_plugin_disable.sh +1 -2
  21. package/toolkit/plugins/copilot/hooks/before_plugin_disable.sh +1 -2
  22. package/toolkit/plugins/cursor/hooks/before_plugin_disable.sh +1 -2
  23. package/toolkit/plugins/gemini/hooks/before_plugin_disable.sh +1 -2
  24. package/toolkit/plugins/karpathy-llm/README.md +39 -45
  25. package/toolkit/plugins/karpathy-llm/agents/rnex-wiki-curator.agent.md +1 -1
  26. package/toolkit/plugins/karpathy-llm/commands/ingest.sh +564 -0
  27. package/toolkit/plugins/karpathy-llm/commands/lint.sh +229 -0
  28. package/toolkit/plugins/karpathy-llm/hooks/_common.sh +1 -4
  29. package/toolkit/plugins/karpathy-llm/instructions/rnex-scaffolding-meta-prompt.md +15 -15
  30. package/toolkit/plugins/karpathy-llm/instructions/rnex-wiki-architecture.md +8 -8
  31. package/toolkit/plugins/karpathy-llm/plugin.yaml +5 -5
  32. package/toolkit/plugins/karpathy-llm/rules/behavioral.md +1 -1
  33. package/toolkit/plugins/karpathy-llm/skills/wiki-ingest.md +10 -2
  34. package/toolkit/plugins/karpathy-llm/skills/wiki-lint.md +10 -2
  35. package/toolkit/plugins/karpathy-llm/templates/rnex-llm-wiki.sample.md +1 -1
  36. package/toolkit/plugins/windsurf/hooks/before_plugin_disable.sh +1 -2
  37. package/toolkit/plugins/karpathy-llm/hooks/git_post-commit.sh +0 -18
  38. package/toolkit/plugins/karpathy-llm/hooks/git_post-merge.sh +0 -18
  39. package/toolkit/plugins/karpathy-llm/hooks/git_pre-commit.sh +0 -18
  40. package/toolkit/plugins/karpathy-llm/hooks/git_pre-push.sh +0 -59
package/LICENSE CHANGED
@@ -1,21 +1,201 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Repo Nexus Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or exemplary damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Repo Nexus
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/unoxen/repo-nexus/actions/workflows/ci.yml/badge.svg)](https://github.com/unoxen/repo-nexus/actions/workflows/ci.yml)
4
4
  [![npm version](https://img.shields.io/npm/v/repo-nexus.svg)](https://www.npmjs.com/package/repo-nexus)
5
- [![License: MIT](https://img.shields.io/github/license/unoxen/repo-nexus)](LICENSE)
5
+ [![License: Apache 2.0](https://img.shields.io/github/license/unoxen/repo-nexus)](LICENSE)
6
6
  [![POSIX Compatible](https://img.shields.io/badge/POSIX-compatible-success)](#)
7
7
  [![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows-lightgrey)](#)
8
8
  [![Documentation Site](https://img.shields.io/badge/docs-site-blue.svg)](https://unoxen.github.io/repo-nexus/)
@@ -16,19 +16,19 @@ A **Virtual Meta-Repo** companion for multi-repo workspaces and shared AI contex
16
16
  - **Two-Level Configuration as Source of Truth**: Shared team manifest in `rnex.yaml` with machine-specific overrides in `.local.rnex.yaml` (highest priority).
17
17
  - **One Command Team Onboarding**: Teammates clone the meta-repo and run `rnex clone` to clone and configure all member repos in seconds.
18
18
  - **Cross-Repo Batch Operations**: Run arbitrary commands across all active repositories with `rnex exec <command>`.
19
- - **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`).
19
+ - **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`).
20
20
  - **Zero Dependencies**: Pure POSIX shell CLI (`rnex`). Works out of the box across macOS, Linux, and Windows (WSL/Git Bash).
21
21
 
22
22
  > 📖 **Documentation & Guides**
23
23
  >
24
24
  > Explore the comprehensive documentation, architecture guides, and interactive references on the **[Documentation Site](https://unoxen.github.io/repo-nexus/)**:
25
25
  >
26
- > - 🚀 **[Getting Started](https://unoxen.github.io/repo-nexus/guide/getting-started)** — Step-by-step onboarding walkthrough and workspace setup
27
- > - 📐 **[Architecture](https://unoxen.github.io/repo-nexus/guide/architecture)** & **[Why Repo Nexus?](https://unoxen.github.io/repo-nexus/guide/why-repo-nexus)** — Virtual Meta-Repo model, directory layout, and design rationale
28
- > - 💻 **[CLI Reference](https://unoxen.github.io/repo-nexus/cli/)** — Complete command syntax, global flags, batch execution (`rnex exec`), and Git hooks
29
- > - 🧩 **[Plugins Guide](https://unoxen.github.io/repo-nexus/plugins/)** — AI provider integrations (Claude, Copilot, Cursor, Gemini, Windsurf) and Karpathy LLM Wiki
30
- > - ⚙️ **[Configuration Schema](https://unoxen.github.io/repo-nexus/guide/configuration)** — Two-level `rnex.yaml` and `.local.rnex.yaml` specification
31
- > - ❓ **[Frequently Asked Questions (FAQ)](https://unoxen.github.io/repo-nexus/faq/)** — Common questions, Git submodule differences, and context strategies
26
+ > - 🚀 **[Getting Started](https://unoxen.github.io/repo-nexus/introduction/quick-start)** — Step-by-step onboarding walkthrough and workspace setup
27
+ > - 📐 **[Architecture](https://unoxen.github.io/repo-nexus/documentation/architecture)** & **[Why Repo Nexus?](https://unoxen.github.io/repo-nexus/introduction/why-rnex)** — Virtual Meta-Repo model, directory layout, and design rationale
28
+ > - 💻 **[CLI Reference](https://unoxen.github.io/repo-nexus/reference/cli)** — Complete command syntax, global flags, batch execution (`rnex exec`), and Git hooks
29
+ > - 🧩 **[Plugins Guide](https://unoxen.github.io/repo-nexus/documentation/plugin-ecosystem)** — AI provider integrations (Claude, Codex, Copilot, Cursor, Gemini, Windsurf) and Karpathy LLM Wiki
30
+ > - ⚙️ **[Configuration Schema](https://unoxen.github.io/repo-nexus/documentation/configuration)** — Two-level `rnex.yaml` and `.local.rnex.yaml` specification
31
+ > - ❓ **[Frequently Asked Questions (FAQ)](https://unoxen.github.io/repo-nexus/faq/general)** — Common questions, Git submodule differences, and context strategies
32
32
 
33
33
  ---
34
34
 
@@ -114,8 +114,8 @@ mkdir my-workspace && cd my-workspace
114
114
  rnex init
115
115
 
116
116
  # 2. Register and clone repositories
117
- rnex add backend git@github.com:myorg/backend-api.git
118
- rnex add frontend https://github.com/myorg/web-app.git
117
+ rnex repo add git@github.com:myorg/backend-api.git --name backend
118
+ rnex repo add https://github.com/myorg/web-app.git --name frontend
119
119
 
120
120
  # 3. Check workspace health
121
121
  rnex status
@@ -145,11 +145,11 @@ repo-nexus/
145
145
  │ ├── ai-instructions.sample.md # Base template for .rnex/ai-instructions.md
146
146
  │ └── rnex.example.yaml # Full config reference with examples
147
147
  ├── docs/
148
- │ ├── guide/ # Architecture, workflows, and getting started
149
- │ ├── cli/ # Comprehensive CLI reference manual
148
+ │ ├── introduction/ # Welcome, Why rnex?, Quick Start, and Pure Examples
149
+ │ ├── documentation/ # Architecture, Configuration, Workflows, Lifecycle, Plugins
150
+ │ ├── reference/ # CLI Reference, RNEX Hooks, Git Hooks, and Environment
150
151
  │ ├── plugins/ # Scoped plugin guides and specifications
151
- │ ├── examples/ # Multi-repo patterns and case studies
152
- │ └── faq/ # Frequently Asked Questions
152
+ │ └── faq/ # Frequently Asked Questions & Troubleshooting
153
153
  ├── .github/
154
154
  │ └── workflows/ci.yml # GitHub Actions CI workflow
155
155
  ├── scripts/
@@ -183,4 +183,4 @@ Contributions are welcome! Please read [CONTRIBUTION.md](CONTRIBUTION.md) for co
183
183
 
184
184
  ## License
185
185
 
186
- [MIT](LICENSE)
186
+ [Apache 2.0](LICENSE)
package/lib/ai.sh CHANGED
@@ -20,11 +20,17 @@ reconcile_gitignore() {
20
20
  repos/*
21
21
  !repos/.gitkeep
22
22
 
23
+ # Recursive Repo Nexus directories (trailing slashes prevent ignoring rnex executable or rnex.yaml)
24
+ **/.rnex*/
25
+ **/rnex*/
26
+ .rnex*/
27
+ rnex*/
28
+
23
29
  # Local machine-specific configuration
24
30
  $RNEX_LOCAL_CONFIG_FILE
25
31
  .rnex.local.yaml
26
32
  GI_EOF
27
- log_ok "Created .gitignore (ignoring repos/ and $RNEX_LOCAL_CONFIG_FILE)"
33
+ log_ok "Created .gitignore (ignoring repos/, recursive .rnex directories, and $RNEX_LOCAL_CONFIG_FILE)"
28
34
  else
29
35
  # 1. Strip any legacy lint_trigger_counter entries if present
30
36
  if grep -q "lint_trigger_counter" "$_gi" 2>/dev/null; then
@@ -33,11 +39,10 @@ GI_EOF
33
39
  log_ok "Removed legacy lint trigger counter entries from .gitignore"
34
40
  fi
35
41
 
36
- # 2. Strip legacy .rnex/ entries if present (.rnex/ contains tracked plugins, skills, and hooks)
37
- if grep -qE '^[ ]*#?[ ]*Repo Nexus internal state' "$_gi" 2>/dev/null || grep -qE '^\.rnex/?$' "$_gi" 2>/dev/null; then
42
+ # 2. Strip any legacy un-slashed .rnex or rnex rules that might match files
43
+ if grep -qE '^[ ]*#?[ ]*Repo Nexus internal state' "$_gi" 2>/dev/null || grep -qE '^(\.rnex|rnex)$' "$_gi" 2>/dev/null; then
38
44
  _tmp="$(mktemp)"
39
- grep -vE '(^[ ]*#?[ ]*Repo Nexus internal state|^\.rnex/?$)' "$_gi" > "$_tmp" && mv "$_tmp" "$_gi"
40
- log_ok "Removed .rnex/ from .gitignore (.rnex should be tracked in git)"
45
+ grep -vE '(^[ ]*#?[ ]*Repo Nexus internal state|^(\.rnex|rnex)$)' "$_gi" > "$_tmp" && mv "$_tmp" "$_gi"
41
46
  fi
42
47
 
43
48
  # 3. Ensure repos/* is ignored
@@ -46,7 +51,19 @@ GI_EOF
46
51
  log_dim "Added repos/* to .gitignore"
47
52
  fi
48
53
 
49
- # 4. Ensure local config files are ignored
54
+ # 4. Ensure recursive directory-only rnex rules are present
55
+ _added_rnex_rules=0
56
+ for _pat in "**/.rnex*/" "**/rnex*/" ".rnex*/" "rnex*/"; do
57
+ if ! grep -qFx -- "$_pat" "$_gi" 2>/dev/null; then
58
+ if [ "$_added_rnex_rules" -eq 0 ]; then
59
+ printf '\n# Recursive Repo Nexus directories (trailing slashes prevent ignoring rnex binary or rnex.yaml)\n' >> "$_gi"
60
+ _added_rnex_rules=1
61
+ fi
62
+ printf '%s\n' "$_pat" >> "$_gi"
63
+ fi
64
+ done
65
+
66
+ # 5. Ensure local config files are ignored
50
67
  if ! grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null; then
51
68
  printf '\n# Local machine-specific configuration\n%s\n' "$RNEX_LOCAL_CONFIG_FILE" >> "$_gi"
52
69
  log_dim "Added $RNEX_LOCAL_CONFIG_FILE to .gitignore"
@@ -56,6 +73,30 @@ GI_EOF
56
73
  fi
57
74
  fi
58
75
 
76
+ # 6. Append any custom file and directory patterns from git.ignore
77
+ _custom_ignores="$(yaml_get_git_ignore 2>/dev/null || true)"
78
+ if [ -n "$_custom_ignores" ]; then
79
+ _added_custom_header=0
80
+ _old_ifs="$IFS"
81
+ IFS='
82
+ '
83
+ for _ci in $_custom_ignores; do
84
+ IFS="$_old_ifs"
85
+ [ -n "$_ci" ] || continue
86
+ if [ "$_ci" = "repos/" ] && grep -qFx -- "repos/*" "$_gi" 2>/dev/null; then
87
+ continue
88
+ fi
89
+ if ! grep -qFx -- "$_ci" "$_gi" 2>/dev/null; then
90
+ if [ "$_added_custom_header" -eq 0 ]; then
91
+ printf '\n# Custom entries from git.ignore in workspace configuration\n' >> "$_gi"
92
+ _added_custom_header=1
93
+ fi
94
+ printf '%s\n' "$_ci" >> "$_gi"
95
+ fi
96
+ done
97
+ IFS="$_old_ifs"
98
+ fi
99
+
59
100
  # Universal search tool ignore file (ripgrep, Claude Code, VS Code, Zed)
60
101
  ensure_provider_ignore "$_dir/.ignore" \
61
102
  "Member repos (un-ignored for ripgrep, Claude Code, VS Code, and search tools)" \
@@ -14,17 +14,22 @@ cmd_completion() {
14
14
  bash)
15
15
  cat <<'EOF'
16
16
  _rnex_completions() {
17
- local cur prev commands
17
+ local cur prev commands repo_subcommands
18
18
  COMPREPLY=()
19
19
  cur="${COMP_WORDS[COMP_CWORD]}"
20
20
  prev="${COMP_WORDS[COMP_CWORD-1]}"
21
- commands="init install add clone exec remove enable disable readonly list sync status rnex-dir update upgrade hooks plugin completion version help"
21
+ commands="init install repo clone exec list sync status plugin completion version help"
22
+ repo_subcommands="add remove set clone status exec list"
22
23
 
23
24
  case "$prev" in
24
25
  rnex)
25
26
  COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
26
27
  return 0
27
28
  ;;
29
+ repo)
30
+ COMPREPLY=( $(compgen -W "$repo_subcommands" -- "$cur") )
31
+ return 0
32
+ ;;
28
33
  sync)
29
34
  COMPREPLY=( $(compgen -W "-y --yes -q --quiet --upgrade" -- "$cur") )
30
35
  return 0
@@ -34,14 +39,12 @@ _rnex_completions() {
34
39
  return 0
35
40
  ;;
36
41
  plugin)
37
- COMPREPLY=( $(compgen -W "list info enable install update disable" -- "$cur") )
38
- return 0
39
- ;;
40
- hooks)
41
- COMPREPLY=( $(compgen -W "install uninstall status" -- "$cur") )
42
+ local plugins
43
+ plugins=$(rnex plugin list 2>/dev/null | awk 'NR>3 && $2 ~ /^\[/ {print $3}')
44
+ COMPREPLY=( $(compgen -W "list info enable install update disable help $plugins" -- "$cur") )
42
45
  return 0
43
46
  ;;
44
- enable|disable|readonly|remove|show|hide|rnex-dir)
47
+ remove|clone|status|exec|set)
45
48
  local repos
46
49
  repos=$(rnex list 2>/dev/null | awk 'NR>2 {print $1}')
47
50
  COMPREPLY=( $(compgen -W "$repos" -- "$cur") )
@@ -79,20 +82,12 @@ _rnex() {
79
82
  commands=(
80
83
  'init:Initialize a new Repo Nexus workspace'
81
84
  'install:Install rnex globally into ~/.local/bin'
82
- 'add:Register and clone a member repository'
85
+ 'repo:Single-repository management (add, remove, set, clone, status, exec, list)'
83
86
  'clone:Clone missing member repositories'
84
87
  'exec:Execute a command across all member repositories'
85
- 'remove:Unregister and delete a repository'
86
- 'enable:Enable a repository in active workspace'
87
- 'disable:Disable a repository in workspace'
88
- 'readonly:Toggle read-only (information-only) status for a repo'
89
88
  'list:List member repositories'
90
89
  'sync:Reconcile workspace, plugins, skills, and member .rnex directories'
91
90
  'status:Inspect workspace health and status (read-only)'
92
- 'rnex-dir:Toggle .rnex directory integration for a repo'
93
- 'update:Upgrade workspace configuration and routing instructions'
94
- 'upgrade:Alias for update'
95
- 'hooks:Manage automated Git hooks'
96
91
  'plugin:Manage plugins'
97
92
  'completion:Generate shell completions'
98
93
  'version:Display version'
@@ -112,6 +107,21 @@ _rnex() {
112
107
  ;;
113
108
  args)
114
109
  case "$words[1]" in
110
+ repo)
111
+ if [ "$CURRENT" -eq 2 ]; then
112
+ local -a repo_cmds
113
+ repo_cmds=('add:Add and optionally clone a member repository' 'remove:Remove a repository from configuration' 'set:Update repository configuration flags' 'clone:Clone a single repository' 'status:Show status of a repository' 'exec:Execute command in repository directory' 'list:List member repositories')
114
+ _describe -t repo_cmds 'repo subcommand' repo_cmds
115
+ elif [ "$words[2]" = "set" ]; then
116
+ local -a set_opts
117
+ set_opts=('--enable[Enable repository]' '--disable[Disable repository]' '--readonly[Mark repository read-only]' '--readwrite[Allow writing to repository]' '--global[Update team rnex.yaml]' '--local[Update workstation .local.rnex.yaml]')
118
+ _describe -t set_opts 'repo set option' set_opts
119
+ else
120
+ local -a repos
121
+ repos=($(rnex list 2>/dev/null | awk 'NR>2 {print $1}'))
122
+ _describe -t repos 'repository' repos
123
+ fi
124
+ ;;
115
125
  sync)
116
126
  local -a sync_opts
117
127
  sync_opts=('(-y --yes)'{-y,--yes}'[Automatically answer yes to prompts]' '(-q --quiet)'{-q,--quiet}'[Suppress non-error output]' '--upgrade[Upgrade workspace configuration schema]')
@@ -121,19 +131,9 @@ _rnex() {
121
131
  ;;
122
132
  plugin)
123
133
  local -a plugin_cmds
124
- plugin_cmds=('list:List plugins' 'info:Show plugin details' 'enable:Enable plugin' 'install:Install/enable plugin' 'update:Update enabled plugin(s)' 'disable:Disable plugin')
134
+ plugin_cmds=('list:List plugins' 'info:Show plugin details' 'enable:Enable plugin' 'install:Install/enable plugin' 'update:Update enabled plugin(s)' 'disable:Disable plugin' 'help:Display plugin help')
125
135
  _describe -t plugin_cmds 'plugin command' plugin_cmds
126
136
  ;;
127
- hooks)
128
- local -a hook_cmds
129
- hook_cmds=('install:Install Git hooks' 'uninstall:Uninstall Git hooks' 'status:Show Git hooks status')
130
- _describe -t hook_cmds 'hooks command' hook_cmds
131
- ;;
132
- enable|disable|readonly|remove|show|hide|rnex-dir)
133
- local -a repos
134
- repos=($(rnex list 2>/dev/null | awk 'NR>2 {print $1}'))
135
- _describe -t repos 'repository' repos
136
- ;;
137
137
  completion)
138
138
  local -a shells
139
139
  shells=('bash:Bash completion' 'zsh:Zsh completion' 'fish:Fish completion')
@@ -162,27 +162,22 @@ EOF
162
162
  cat <<'EOF'
163
163
  complete -c rnex -n "__fish_use_subcommand" -a init -d "Initialize a new workspace"
164
164
  complete -c rnex -n "__fish_use_subcommand" -a install -d "Install rnex globally"
165
- complete -c rnex -n "__fish_use_subcommand" -a add -d "Register and clone a repository"
165
+ complete -c rnex -n "__fish_use_subcommand" -a repo -d "Member repository management"
166
+ complete -c rnex -n "__fish_seen_subcommand_from repo" -a "add remove set clone status exec list"
167
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l readonly -d "Mark repository read-only"
168
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l readwrite -d "Allow writing to repository"
169
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l enable -d "Enable repository"
170
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l disable -d "Disable repository"
171
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l global -d "Apply in team configuration"
172
+ complete -c rnex -n "__fish_seen_subcommand_from set" -l local -d "Apply in local configuration"
166
173
  complete -c rnex -n "__fish_use_subcommand" -a clone -d "Clone missing repositories"
167
174
  complete -c rnex -n "__fish_use_subcommand" -a exec -d "Execute command across member repos"
168
- complete -c rnex -n "__fish_use_subcommand" -a remove -d "Remove a repository"
169
- complete -c rnex -n "__fish_use_subcommand" -a enable -d "Enable a repository"
170
- complete -c rnex -n "__fish_use_subcommand" -a disable -d "Disable a repository"
171
- complete -c rnex -n "__fish_use_subcommand" -a readonly -d "Toggle read-only status for a repo"
172
- complete -c rnex -n "__fish_seen_subcommand_from readonly" -a "enable disable"
173
- complete -c rnex -n "__fish_seen_subcommand_from readonly" -l local -d "Apply locally"
174
175
  complete -c rnex -n "__fish_use_subcommand" -a list -d "List repositories"
175
- complete -c rnex -n "__fish_use_subcommand" -a rnex-dir -d "Toggle .rnex directory integration for a repo"
176
- complete -c rnex -n "__fish_seen_subcommand_from rnex-dir" -a "enable disable"
177
- complete -c rnex -n "__fish_seen_subcommand_from rnex-dir" -l local -d "Apply locally"
178
176
  complete -c rnex -n "__fish_use_subcommand" -a sync -d "Reconcile workspace, plugins, skills, and repos"
179
177
  complete -c rnex -n "__fish_seen_subcommand_from sync" -l yes -s y -d "Automatically answer yes to prompts"
180
178
  complete -c rnex -n "__fish_seen_subcommand_from sync" -l quiet -s q -d "Suppress non-error output"
181
179
  complete -c rnex -n "__fish_seen_subcommand_from sync" -l upgrade -d "Upgrade workspace configuration schema"
182
180
  complete -c rnex -n "__fish_use_subcommand" -a status -d "Inspect workspace status (read-only)"
183
- complete -c rnex -n "__fish_use_subcommand" -a update -d "Upgrade workspace configuration"
184
- complete -c rnex -n "__fish_use_subcommand" -a upgrade -d "Upgrade workspace configuration"
185
- complete -c rnex -n "__fish_use_subcommand" -a hooks -d "Manage Git hooks"
186
181
  complete -c rnex -n "__fish_use_subcommand" -a plugin -d "Manage plugins"
187
182
  complete -c rnex -n "__fish_use_subcommand" -a completion -d "Generate completions"
188
183
  complete -c rnex -n "__fish_use_subcommand" -a version -d "Show version"
@@ -135,6 +135,20 @@ cmd_init() {
135
135
  done
136
136
  fi
137
137
 
138
+ if [ "$_init_git_hooks" = "false" ]; then
139
+ _hooks_block=' post-merge: []
140
+ post-checkout: []
141
+ pre-commit: []
142
+ pre-push: []'
143
+ else
144
+ _hooks_block=' post-merge:
145
+ - "rnex sync --quiet"
146
+ post-checkout:
147
+ - "rnex sync --quiet"
148
+ pre-commit: []
149
+ pre-push: []'
150
+ fi
151
+
138
152
  cat > "$_target_yaml" <<YAML_EOF
139
153
  # Repo Nexus workspace configuration
140
154
  # See templates/rnex.example.yaml for a comprehensive example with all options.
@@ -147,8 +161,21 @@ repos_dir: ./repos
147
161
  # VS Code / Cursor multi-root workspace file (default: false; e.g. true or workspace.code-workspace)
148
162
  code_workspace: ${_cli_code_workspace:-false}
149
163
 
150
- # Automated workspace Git hooks (default: true; e.g. post-merge auto-sync, plugin triggers)
151
- git_hooks: $_init_git_hooks
164
+ # Git Integration (Ignore rules & Git hooks)
165
+ git:
166
+ ignore:
167
+ - "repos/"
168
+ - "**/.rnex*/"
169
+ - "**/rnex*/"
170
+ hooks:
171
+ $_hooks_block
172
+
173
+ # RNEX Lifecycle Hooks
174
+ rnex_hooks:
175
+ before_sync: []
176
+ after_sync: []
177
+ before_clone: []
178
+ after_clone: []
152
179
 
153
180
  # Workspace plugins
154
181
  plugins:
@@ -167,9 +194,7 @@ YAML_EOF
167
194
  WORKSPACE_LOCAL_YAML="$_init_dir/$RNEX_LOCAL_CONFIG_FILE"
168
195
 
169
196
  # ---- 2. Merge routing instructions into AI instructions files ------------
170
- if ! has_active_provider_instructions "$_init_dir"; then
171
- merge_rnex_instructions "$_init_dir/AGENTS.md"
172
- fi
197
+ merge_rnex_instructions "$_init_dir/AGENTS.md"
173
198
  for _if in CLAUDE.md GEMINI.md CODEX.md .cursorrules .windsurfrules .github/copilot-instructions.md; do
174
199
  [ -f "$_init_dir/$_if" ] && merge_rnex_instructions "$_init_dir/$_if"
175
200
  done
@@ -203,11 +228,7 @@ YAML_EOF
203
228
 
204
229
  # ---- 7. Setup automated Git hooks if inside a Git repository ------------
205
230
  if [ "$_is_git_ws" -eq 1 ]; then
206
- if [ "$_init_git_hooks" = "true" ]; then
207
- cmd_hooks_install_dir "$_init_dir"
208
- else
209
- log_dim "Skipping Git hooks setup (run 'rnex hooks install' later to enable)"
210
- fi
231
+ install_git_hooks "$_init_dir"
211
232
  fi
212
233
 
213
234
  _write_auto_sync_script "$_init_dir"
@@ -221,7 +242,7 @@ YAML_EOF
221
242
  log_dim "Created $_created_items"
222
243
  printf '\n'
223
244
  log_info "Next steps:"
224
- log_dim "1. Add repositories with: rnex add [<name>] <git-url>"
245
+ log_dim "1. Add repositories with: rnex repo add <git-url> [--name <name>]"
225
246
  log_dim "2. Clone team repositories: rnex clone"
226
247
  log_dim "3. Run commands across all repos: rnex exec <command>"
227
248
  fi