repo-nexus 0.7.32 → 0.7.34
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.
- package/lib/commands/init.sh +24 -60
- package/lib/commands/plugin.sh +6 -19
- package/lib/commands/repo.sh +23 -31
- package/lib/commands/status.sh +45 -52
- package/lib/plugins.sh +40 -41
- package/lib/workspace.sh +2 -1
- package/package.json +1 -1
- package/toolkit/plugins/claude/hooks/after_sync.sh +6 -47
- package/toolkit/plugins/claude/hooks/before_plugin_disable.sh +3 -4
- package/toolkit/plugins/copilot/hooks/after_sync.sh +6 -146
- package/toolkit/plugins/copilot/hooks/before_plugin_disable.sh +6 -95
- package/toolkit/plugins/cursor/hooks/after_sync.sh +8 -22
- package/toolkit/plugins/cursor/hooks/before_plugin_disable.sh +3 -4
- package/toolkit/plugins/gemini/hooks/after_sync.sh +9 -56
- package/toolkit/plugins/gemini/hooks/before_plugin_disable.sh +3 -4
- package/toolkit/plugins/karpathy-llm/hooks/_common.sh +66 -0
- package/toolkit/plugins/karpathy-llm/hooks/after_sync.sh +26 -233
- package/toolkit/plugins/karpathy-llm/hooks/before_plugin_disable.sh +3 -16
- package/toolkit/plugins/karpathy-llm/hooks/git_post-commit.sh +8 -87
- package/toolkit/plugins/karpathy-llm/hooks/git_post-merge.sh +8 -87
- package/toolkit/plugins/karpathy-llm/hooks/git_pre-commit.sh +8 -87
- package/toolkit/plugins/karpathy-llm/hooks/git_pre-push.sh +12 -94
- package/toolkit/plugins/windsurf/hooks/after_sync.sh +4 -7
- package/toolkit/plugins/windsurf/hooks/before_plugin_disable.sh +3 -4
package/lib/commands/init.sh
CHANGED
|
@@ -17,18 +17,8 @@ cmd_init() {
|
|
|
17
17
|
-y|--yes) _non_interactive=1 ;;
|
|
18
18
|
--hooks) _cli_hooks="true" ;;
|
|
19
19
|
--no-hooks) _cli_no_hooks=1; _cli_hooks="false" ;;
|
|
20
|
-
--
|
|
21
|
-
--no-
|
|
22
|
-
--claude) _cli_plugins="${_cli_plugins:+$_cli_plugins }claude" ;;
|
|
23
|
-
--no-claude) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ claude / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
24
|
-
--gemini) _cli_plugins="${_cli_plugins:+$_cli_plugins }gemini" ;;
|
|
25
|
-
--no-gemini) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ gemini / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
26
|
-
--cursor) _cli_plugins="${_cli_plugins:+$_cli_plugins }cursor" ;;
|
|
27
|
-
--no-cursor) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ cursor / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
28
|
-
--windsurf) _cli_plugins="${_cli_plugins:+$_cli_plugins }windsurf" ;;
|
|
29
|
-
--no-windsurf) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ windsurf / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
30
|
-
--karpathy|--karpathy-llm) _cli_plugins="${_cli_plugins:+$_cli_plugins }karpathy-llm" ;;
|
|
31
|
-
--no-karpathy|--no-karpathy-llm) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ karpathy-llm / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
20
|
+
--karpathy) _cli_plugins="${_cli_plugins:+$_cli_plugins }karpathy-llm" ;;
|
|
21
|
+
--no-karpathy) _cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e 's/ karpathy-llm / /g' -e 's/^ *//;s/ *$//')" ;;
|
|
32
22
|
--plugin|--enable-plugin)
|
|
33
23
|
shift
|
|
34
24
|
[ -n "$1" ] && _cli_plugins="${_cli_plugins:+$_cli_plugins }$1"
|
|
@@ -53,6 +43,18 @@ cmd_init() {
|
|
|
53
43
|
esac
|
|
54
44
|
fi
|
|
55
45
|
;;
|
|
46
|
+
--no-*)
|
|
47
|
+
_pflag="${1#--no-}"
|
|
48
|
+
if find_plugin_dir "$_pflag" >/dev/null 2>&1; then
|
|
49
|
+
_cli_plugins="$(printf '%s' " $_cli_plugins " | sed -e "s/ $_pflag / /g" -e 's/^ *//;s/ *$//')"
|
|
50
|
+
fi
|
|
51
|
+
;;
|
|
52
|
+
--*)
|
|
53
|
+
_pflag="${1#--}"
|
|
54
|
+
if find_plugin_dir "$_pflag" >/dev/null 2>&1; then
|
|
55
|
+
_cli_plugins="${_cli_plugins:+$_cli_plugins }$_pflag"
|
|
56
|
+
fi
|
|
57
|
+
;;
|
|
56
58
|
*)
|
|
57
59
|
if [ -z "$_init_dir" ]; then
|
|
58
60
|
_init_dir="$1"
|
|
@@ -155,9 +157,6 @@ YAML_EOF
|
|
|
155
157
|
fi
|
|
156
158
|
|
|
157
159
|
# Set active workspace context for initialization
|
|
158
|
-
_orig_nexus="$NEXUS_DIR"
|
|
159
|
-
_orig_yaml="$WORKSPACE_YAML"
|
|
160
|
-
_orig_local_yaml="$WORKSPACE_LOCAL_YAML"
|
|
161
160
|
NEXUS_DIR="$_init_dir"
|
|
162
161
|
WORKSPACE_YAML="$_target_yaml"
|
|
163
162
|
WORKSPACE_LOCAL_YAML="$_init_dir/$RNEX_LOCAL_CONFIG_FILE"
|
|
@@ -166,11 +165,9 @@ YAML_EOF
|
|
|
166
165
|
if ! has_active_provider_instructions "$_init_dir"; then
|
|
167
166
|
merge_rnex_instructions "$_init_dir/AGENTS.md"
|
|
168
167
|
fi
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
[ -f "$_init_dir/.windsurfrules" ] && merge_rnex_instructions "$_init_dir/.windsurfrules"
|
|
173
|
-
[ -f "$_init_dir/.github/copilot-instructions.md" ] && merge_rnex_instructions "$_init_dir/.github/copilot-instructions.md"
|
|
168
|
+
for _if in CLAUDE.md GEMINI.md .cursorrules .windsurfrules .github/copilot-instructions.md; do
|
|
169
|
+
[ -f "$_init_dir/$_if" ] && merge_rnex_instructions "$_init_dir/$_if"
|
|
170
|
+
done
|
|
174
171
|
|
|
175
172
|
# ---- 3. Create repos directory with .gitkeep -----------------------------
|
|
176
173
|
_repos_dir="$_init_dir/repos"
|
|
@@ -183,50 +180,21 @@ YAML_EOF
|
|
|
183
180
|
sync_plugins
|
|
184
181
|
build_ai_instructions "$_init_dir"
|
|
185
182
|
sync_skills
|
|
186
|
-
WORKSPACE_LOCAL_YAML="$_orig_local_yaml"
|
|
187
|
-
WORKSPACE_YAML="$_orig_yaml"
|
|
188
|
-
NEXUS_DIR="$_orig_nexus"
|
|
189
183
|
|
|
190
184
|
# ---- 5. Ensure repos/ and local configs are gitignored ---------
|
|
191
185
|
reconcile_gitignore "$_init_dir"
|
|
192
186
|
|
|
193
187
|
# ---- 6. Generate VS Code / Cursor workspace if configured ----------------
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if [ -z "$_target_cw" ] && [ -f "$_target_yaml" ]; then
|
|
199
|
-
_target_cw="$(awk '/^(code_workspace|vscode_workspace):/ { sub(/^[a-zA-Z0-9_]+:[ ]*/, ""); sub(/[ ]*#.*/, ""); val=$0 } END { if (val) print val }' "$_target_yaml")"
|
|
200
|
-
fi
|
|
201
|
-
_target_cw="$(echo "$_target_cw" | tr -d " \t\r\n'\"")"
|
|
202
|
-
case "$_target_cw" in
|
|
203
|
-
true|yes|1)
|
|
204
|
-
_cw_name="$(basename "$_init_dir").code-workspace"
|
|
205
|
-
;;
|
|
206
|
-
false|no|0|none|"")
|
|
207
|
-
_cw_name=""
|
|
208
|
-
;;
|
|
209
|
-
*)
|
|
210
|
-
case "$_target_cw" in
|
|
211
|
-
*.code-workspace) _cw_name="$_target_cw" ;;
|
|
212
|
-
*) _cw_name="$_target_cw.code-workspace" ;;
|
|
213
|
-
esac
|
|
214
|
-
;;
|
|
215
|
-
esac
|
|
216
|
-
|
|
188
|
+
_orig_repos="$REPOS_DIR"
|
|
189
|
+
_orig_cw="$CODE_WORKSPACE_FILE"
|
|
190
|
+
_load_code_workspace "$_cli_code_workspace"
|
|
191
|
+
_cw_name="$CODE_WORKSPACE_FILE"
|
|
217
192
|
if [ -n "$_cw_name" ]; then
|
|
218
|
-
|
|
219
|
-
_orig_repos="$REPOS_DIR"
|
|
220
|
-
_orig_cw="$CODE_WORKSPACE_FILE"
|
|
221
|
-
CODE_WORKSPACE_FILE="$_cw_name"
|
|
222
|
-
NEXUS_DIR="$_init_dir"
|
|
223
|
-
_repos_rel="repos"
|
|
224
|
-
REPOS_DIR="$_init_dir/$_repos_rel"
|
|
193
|
+
REPOS_DIR="$_init_dir/repos"
|
|
225
194
|
sync_code_workspace
|
|
226
|
-
NEXUS_DIR="$_orig_nexus"
|
|
227
|
-
REPOS_DIR="$_orig_repos"
|
|
228
|
-
CODE_WORKSPACE_FILE="$_orig_cw"
|
|
229
195
|
fi
|
|
196
|
+
REPOS_DIR="$_orig_repos"
|
|
197
|
+
CODE_WORKSPACE_FILE="$_orig_cw"
|
|
230
198
|
|
|
231
199
|
# ---- 7. Setup automated Git hooks if inside a Git repository ------------
|
|
232
200
|
if [ "$_is_git_ws" -eq 1 ]; then
|
|
@@ -240,10 +208,6 @@ YAML_EOF
|
|
|
240
208
|
_write_auto_sync_script "$_init_dir"
|
|
241
209
|
update_sync_stamp "$_init_dir"
|
|
242
210
|
|
|
243
|
-
NEXUS_DIR="$_init_dir"
|
|
244
|
-
WORKSPACE_YAML="$_target_yaml"
|
|
245
|
-
WORKSPACE_LOCAL_YAML="$_init_dir/$RNEX_LOCAL_CONFIG_FILE"
|
|
246
|
-
|
|
247
211
|
if [ "$_config_created" -eq 1 ]; then
|
|
248
212
|
printf '\n'
|
|
249
213
|
log_ok "Initialized Repo Nexus workspace at ${_BOLD}$_init_dir${_NC}"
|
package/lib/commands/plugin.sh
CHANGED
|
@@ -245,29 +245,16 @@ cmd_rnex_dir() {
|
|
|
245
245
|
done
|
|
246
246
|
|
|
247
247
|
case "$_action" in
|
|
248
|
-
enable)
|
|
248
|
+
enable|disable)
|
|
249
249
|
[ -n "$_name" ] || die "Usage: rnex rnex-dir <enable|disable> <name> [--local]"
|
|
250
250
|
yaml_has_repo "$_name" || die "Repo '$_name' is not registered"
|
|
251
|
-
if [ "$
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
if [ "$_action" = "enable" ]; then
|
|
252
|
+
_repo_set_config_and_log "$_name" "rnex_dir" "true" "$_is_local" "Enabled member .rnex directory for"
|
|
253
|
+
sync_repo_rnex "$_name"
|
|
254
254
|
else
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
_repo_set_config_and_log "$_name" "rnex_dir" "false" "$_is_local" "Disabled member .rnex directory for"
|
|
256
|
+
clean_repo_rnex "$_name"
|
|
257
257
|
fi
|
|
258
|
-
sync_repo_rnex "$_name"
|
|
259
|
-
;;
|
|
260
|
-
disable)
|
|
261
|
-
[ -n "$_name" ] || die "Usage: rnex rnex-dir <enable|disable> <name> [--local]"
|
|
262
|
-
yaml_has_repo "$_name" || die "Repo '$_name' is not registered"
|
|
263
|
-
if [ "$_is_local" -eq 1 ]; then
|
|
264
|
-
yaml_set_local "$_name" "rnex_dir" "false"
|
|
265
|
-
log_ok "Disabled member .rnex directory for '$_name' locally in $(basename "$WORKSPACE_LOCAL_YAML")"
|
|
266
|
-
else
|
|
267
|
-
yaml_set "$_name" "rnex_dir" "false"
|
|
268
|
-
log_ok "Disabled member .rnex directory for '$_name' in $(basename "$WORKSPACE_YAML")"
|
|
269
|
-
fi
|
|
270
|
-
clean_repo_rnex "$_name"
|
|
271
258
|
;;
|
|
272
259
|
*)
|
|
273
260
|
die "Usage: rnex rnex-dir <enable|disable> <name> [--local]"
|
package/lib/commands/repo.sh
CHANGED
|
@@ -168,10 +168,22 @@ cmd_exec() {
|
|
|
168
168
|
return 0
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
_repo_set_config_and_log() {
|
|
172
|
+
_rname="$1"; _key="$2"; _val="$3"; _local_flag="$4"; _verb="$5"
|
|
173
|
+
if [ "$_local_flag" -eq 1 ]; then
|
|
174
|
+
yaml_set_local "$_rname" "$_key" "$_val"
|
|
175
|
+
log_ok "$_verb '$_rname' locally in $(basename "$WORKSPACE_LOCAL_YAML")"
|
|
176
|
+
else
|
|
177
|
+
yaml_set "$_rname" "$_key" "$_val"
|
|
178
|
+
log_ok "$_verb '$_rname' in $(basename "$WORKSPACE_YAML")"
|
|
179
|
+
fi
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
_repo_toggle_state() {
|
|
172
183
|
require_workspace
|
|
173
|
-
|
|
174
|
-
|
|
184
|
+
_target_val="$1"; _verb="$2"
|
|
185
|
+
shift 2
|
|
186
|
+
_is_local=0; _name=""
|
|
175
187
|
while [ $# -gt 0 ]; do
|
|
176
188
|
case "$1" in
|
|
177
189
|
--local) _is_local=1 ;;
|
|
@@ -179,42 +191,22 @@ cmd_enable() {
|
|
|
179
191
|
esac
|
|
180
192
|
shift
|
|
181
193
|
done
|
|
182
|
-
|
|
194
|
+
_cmd_lbl="enable"
|
|
195
|
+
[ "$_target_val" = "false" ] && _cmd_lbl="disable"
|
|
196
|
+
[ -n "$_name" ] || die "Usage: rnex $_cmd_lbl [--local] <name>"
|
|
183
197
|
yaml_has_repo "$_name" || die "Repo '$_name' is not registered"
|
|
198
|
+
_repo_set_config_and_log "$_name" "enabled" "$_target_val" "$_is_local" "$_verb"
|
|
199
|
+
}
|
|
184
200
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
log_ok "Enabled repo '$_name' locally in $(basename "$WORKSPACE_LOCAL_YAML")"
|
|
188
|
-
else
|
|
189
|
-
yaml_set "$_name" "enabled" "true"
|
|
190
|
-
log_ok "Enabled repo '$_name' in $(basename "$WORKSPACE_YAML")"
|
|
191
|
-
fi
|
|
201
|
+
cmd_enable() {
|
|
202
|
+
_repo_toggle_state "true" "Enabled repo" "$@"
|
|
192
203
|
sync_repo_rnex "$_name"
|
|
193
204
|
sync_code_workspace
|
|
194
205
|
run_hook "after_sync" "$@"
|
|
195
206
|
}
|
|
196
207
|
|
|
197
208
|
cmd_disable() {
|
|
198
|
-
|
|
199
|
-
_is_local=0
|
|
200
|
-
_name=""
|
|
201
|
-
while [ $# -gt 0 ]; do
|
|
202
|
-
case "$1" in
|
|
203
|
-
--local) _is_local=1 ;;
|
|
204
|
-
*) _name="$1" ;;
|
|
205
|
-
esac
|
|
206
|
-
shift
|
|
207
|
-
done
|
|
208
|
-
[ -n "$_name" ] || die "Usage: rnex disable [--local] <name>"
|
|
209
|
-
yaml_has_repo "$_name" || die "Repo '$_name' is not registered"
|
|
210
|
-
|
|
211
|
-
if [ "$_is_local" -eq 1 ]; then
|
|
212
|
-
yaml_set_local "$_name" "enabled" "false"
|
|
213
|
-
log_ok "Disabled repo '$_name' locally in $(basename "$WORKSPACE_LOCAL_YAML")"
|
|
214
|
-
else
|
|
215
|
-
yaml_set "$_name" "enabled" "false"
|
|
216
|
-
log_ok "Disabled repo '$_name' in $(basename "$WORKSPACE_YAML")"
|
|
217
|
-
fi
|
|
209
|
+
_repo_toggle_state "false" "Disabled repo" "$@"
|
|
218
210
|
sync_code_workspace
|
|
219
211
|
}
|
|
220
212
|
|
package/lib/commands/status.sh
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
# lib/commands/status.sh — Workspace health and status diagnostics
|
|
5
5
|
# ============================================================================
|
|
6
6
|
|
|
7
|
+
_status_active_plugin_trigger() {
|
|
8
|
+
for _p in $(yaml_list_plugins 2>/dev/null || true); do
|
|
9
|
+
yaml_plugin_enabled "$_p" 2>/dev/null || continue
|
|
10
|
+
_trig="$(yaml_plugin_get "$_p" "lint_trigger" 2>/dev/null || true)"
|
|
11
|
+
[ -z "$_trig" ] && _trig="$(yaml_plugin_get "$_p" "trigger" 2>/dev/null || true)"
|
|
12
|
+
if [ -n "$_trig" ] && [ "$_trig" != "manual" ]; then
|
|
13
|
+
printf '%s' "$_trig"
|
|
14
|
+
return 0
|
|
15
|
+
fi
|
|
16
|
+
done
|
|
17
|
+
return 0
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_status_has_rnex_skills() {
|
|
21
|
+
[ -d "$1" ] && { ls "$1"/rnex-*.md >/dev/null 2>&1 || ls -d "$1"/rnex-* >/dev/null 2>&1; }
|
|
22
|
+
}
|
|
23
|
+
|
|
7
24
|
cmd_status() {
|
|
8
25
|
require_workspace
|
|
9
26
|
ensure_repos_dir
|
|
@@ -90,16 +107,7 @@ cmd_status() {
|
|
|
90
107
|
;;
|
|
91
108
|
true|yes|1)
|
|
92
109
|
if [ "$_gh_active" -eq 1 ]; then
|
|
93
|
-
_active_trigger=""
|
|
94
|
-
for _p in $(yaml_list_plugins 2>/dev/null || true); do
|
|
95
|
-
yaml_plugin_enabled "$_p" 2>/dev/null || continue
|
|
96
|
-
_trig="$(yaml_plugin_get "$_p" "lint_trigger" 2>/dev/null || true)"
|
|
97
|
-
[ -z "$_trig" ] && _trig="$(yaml_plugin_get "$_p" "trigger" 2>/dev/null || true)"
|
|
98
|
-
if [ -n "$_trig" ] && [ "$_trig" != "manual" ]; then
|
|
99
|
-
_active_trigger="$_trig"
|
|
100
|
-
break
|
|
101
|
-
fi
|
|
102
|
-
done
|
|
110
|
+
_active_trigger="$(_status_active_plugin_trigger)"
|
|
103
111
|
if [ -n "$_active_trigger" ]; then
|
|
104
112
|
printf ' %b✓%b Git Hooks: active (git_hooks: true, .rnex/hooks — %s)\n' "$_G" "$_NC" "$_active_trigger"
|
|
105
113
|
else
|
|
@@ -111,16 +119,7 @@ cmd_status() {
|
|
|
111
119
|
;;
|
|
112
120
|
*)
|
|
113
121
|
if [ "$_gh_active" -eq 1 ]; then
|
|
114
|
-
_active_trigger=""
|
|
115
|
-
for _p in $(yaml_list_plugins 2>/dev/null || true); do
|
|
116
|
-
yaml_plugin_enabled "$_p" 2>/dev/null || continue
|
|
117
|
-
_trig="$(yaml_plugin_get "$_p" "lint_trigger" 2>/dev/null || true)"
|
|
118
|
-
[ -z "$_trig" ] && _trig="$(yaml_plugin_get "$_p" "trigger" 2>/dev/null || true)"
|
|
119
|
-
if [ -n "$_trig" ] && [ "$_trig" != "manual" ]; then
|
|
120
|
-
_active_trigger="$_trig"
|
|
121
|
-
break
|
|
122
|
-
fi
|
|
123
|
-
done
|
|
122
|
+
_active_trigger="$(_status_active_plugin_trigger)"
|
|
124
123
|
if [ -n "$_active_trigger" ]; then
|
|
125
124
|
printf ' %b✓%b Git Hooks: active (.rnex/hooks — post-merge auto-sync, %s)\n' "$_G" "$_NC" "$_active_trigger"
|
|
126
125
|
else
|
|
@@ -145,21 +144,18 @@ cmd_status() {
|
|
|
145
144
|
elif ! has_active_provider_instructions "$NEXUS_DIR"; then
|
|
146
145
|
printf ' %b✗%b %s %b(standard instructions directive — MISSING; run "rnex sync" to create)%b\n' "$_R" "$_NC" "AGENTS.md" "$_R" "$_NC"
|
|
147
146
|
fi
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if [ -f "$NEXUS_DIR/.github/copilot-instructions.md" ]; then
|
|
161
|
-
printf ' %b✓%b %s %b(Copilot instructions)%b\n' "$_G" "$_NC" ".github/copilot-instructions.md" "$_DIM" "$_NC"
|
|
162
|
-
fi
|
|
147
|
+
for _pair in \
|
|
148
|
+
"CLAUDE.md:Claude" \
|
|
149
|
+
"GEMINI.md:Gemini" \
|
|
150
|
+
".cursorrules:Cursor" \
|
|
151
|
+
".windsurfrules:Windsurf" \
|
|
152
|
+
".github/copilot-instructions.md:Copilot"; do
|
|
153
|
+
_ifile="${_pair%%:*}"
|
|
154
|
+
_ilbl="${_pair#*:}"
|
|
155
|
+
if [ -f "$NEXUS_DIR/$_ifile" ]; then
|
|
156
|
+
printf ' %b✓%b %s %b(%s instructions)%b\n' "$_G" "$_NC" "$_ifile" "$_DIM" "$_ilbl" "$_NC"
|
|
157
|
+
fi
|
|
158
|
+
done
|
|
163
159
|
if [ -n "$CODE_WORKSPACE_FILE" ]; then
|
|
164
160
|
if [ -f "$NEXUS_DIR/$CODE_WORKSPACE_FILE" ]; then
|
|
165
161
|
printf ' %b✓%b %s %b(VS Code / Cursor workspace)%b\n' "$_G" "$_NC" "$CODE_WORKSPACE_FILE" "$_DIM" "$_NC"
|
|
@@ -178,23 +174,20 @@ cmd_status() {
|
|
|
178
174
|
if [ -d "$NEXUS_DIR/.rnex/skills" ]; then
|
|
179
175
|
printf ' %b✓%b %s %b(workspace skills)%b\n' "$_G" "$_NC" ".rnex/skills/" "$_DIM" "$_NC"
|
|
180
176
|
fi
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if [ -d "$NEXUS_DIR/.github/skills" ] && { ls "$NEXUS_DIR/.github/skills"/rnex-*.md >/dev/null 2>&1 || ls -d "$NEXUS_DIR/.github/skills"/rnex-* >/dev/null 2>&1; }; then
|
|
196
|
-
printf ' %b✓%b %s %b(Copilot user skills)%b\n' "$_G" "$_NC" ".github/skills/" "$_DIM" "$_NC"
|
|
197
|
-
fi
|
|
177
|
+
for _spair in \
|
|
178
|
+
".cursor/rules/:Cursor" \
|
|
179
|
+
".claude/skills/:Claude" \
|
|
180
|
+
".windsurf/rules/:Windsurf" \
|
|
181
|
+
".agents/skills/:Gemini" \
|
|
182
|
+
".gemini/skills/:Gemini" \
|
|
183
|
+
".github/skills/:Copilot"; do
|
|
184
|
+
_sdir="${_spair%%:*}"
|
|
185
|
+
_slbl="${_spair#*:}"
|
|
186
|
+
[ "$_sdir" = ".gemini/skills/" ] && _status_has_rnex_skills "$NEXUS_DIR/.agents/skills" && continue
|
|
187
|
+
if _status_has_rnex_skills "$NEXUS_DIR/${_sdir%/}"; then
|
|
188
|
+
printf ' %b✓%b %s %b(%s user skills)%b\n' "$_G" "$_NC" "$_sdir" "$_DIM" "$_slbl" "$_NC"
|
|
189
|
+
fi
|
|
190
|
+
done
|
|
198
191
|
printf '\n'
|
|
199
192
|
|
|
200
193
|
printf '%bActive Plugins:%b\n' "$_BOLD" "$_NC"
|
package/lib/plugins.sh
CHANGED
|
@@ -205,46 +205,26 @@ sync_plugin_bundle() {
|
|
|
205
205
|
done
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
#
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
"$NEXUS_DIR/\"{raw_dir}" \
|
|
214
|
-
"$NEXUS_DIR/{wiki_dir}" \
|
|
215
|
-
"$NEXUS_DIR/{raw_dir}"; do
|
|
216
|
-
if [ -d "$_bogus" ]; then
|
|
217
|
-
rm -rf "$_bogus"
|
|
218
|
-
log_dim "Cleaned up leaked placeholder directory: $(basename "$_bogus")"
|
|
219
|
-
fi
|
|
220
|
-
done
|
|
221
|
-
|
|
222
|
-
# Clean up obsolete leaked root ./raw and ./wiki directories if non-default paths are configured
|
|
223
|
-
_raw_cfg="$(plugin_primary_source_dir "karpathy-llm" 2>/dev/null || true)"
|
|
224
|
-
[ -z "$_raw_cfg" ] && _raw_cfg="docs"
|
|
208
|
+
# Clean up obsolete leaked root ./raw and ./wiki directories if non-default paths are configured
|
|
209
|
+
_clean_leaked_plugin_dirs() {
|
|
210
|
+
_cld_root="${1:-$NEXUS_DIR}"
|
|
211
|
+
_cld_raw="$2"
|
|
212
|
+
_cld_wiki="$3"
|
|
225
213
|
|
|
226
|
-
|
|
227
|
-
[ -z "$_wiki_cfg" ] && _wiki_cfg=".rnex/wiki"
|
|
228
|
-
_wiki_cfg="$(printf '%s' "$_wiki_cfg" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | tr -d "'\"" | sed -e 's#^\./##' -e 's#^/##' -e 's#/$##')"
|
|
229
|
-
|
|
230
|
-
if [ "$_raw_cfg" != "raw" ] && [ -d "$NEXUS_DIR/raw" ] && \
|
|
214
|
+
if [ "$_cld_raw" != "raw" ] && [ -d "$_cld_root/raw" ] && \
|
|
231
215
|
! plugin_source_dirs "karpathy-llm" 2>/dev/null | grep -qx 'raw'; then
|
|
232
|
-
if ! rmdir "$
|
|
216
|
+
if ! rmdir "$_cld_root/raw" 2>/dev/null; then
|
|
233
217
|
_can_clean=1
|
|
234
|
-
for _f in "$
|
|
218
|
+
for _f in "$_cld_root/raw"/* "$_cld_root/raw"/.[!.]* "$_cld_root/raw"/..?*; do
|
|
235
219
|
[ -e "$_f" ] || continue
|
|
236
220
|
_b="$(basename "$_f")"
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
fi
|
|
240
|
-
if [ -f "$NEXUS_DIR/$_raw_cfg/$_b" ] && cmp -s "$_f" "$NEXUS_DIR/$_raw_cfg/$_b"; then
|
|
241
|
-
continue
|
|
242
|
-
fi
|
|
221
|
+
[ "$_b" = ".gitkeep" ] && continue
|
|
222
|
+
[ -f "$_cld_root/$_cld_raw/$_b" ] && cmp -s "$_f" "$_cld_root/$_cld_raw/$_b" && continue
|
|
243
223
|
_can_clean=0
|
|
244
224
|
break
|
|
245
225
|
done
|
|
246
226
|
if [ "$_can_clean" -eq 1 ]; then
|
|
247
|
-
rm -rf "$
|
|
227
|
+
rm -rf "$_cld_root/raw" 2>/dev/null || true
|
|
248
228
|
log_dim "Cleaned up obsolete root raw/ directory"
|
|
249
229
|
fi
|
|
250
230
|
else
|
|
@@ -252,33 +232,52 @@ sync_plugins() {
|
|
|
252
232
|
fi
|
|
253
233
|
fi
|
|
254
234
|
|
|
255
|
-
if [ "$
|
|
256
|
-
if ! rmdir "$
|
|
235
|
+
if [ "$_cld_wiki" != "wiki" ] && [ -d "$_cld_root/wiki" ]; then
|
|
236
|
+
if ! rmdir "$_cld_root/wiki" 2>/dev/null; then
|
|
257
237
|
_can_clean=1
|
|
258
|
-
for _f in "$
|
|
238
|
+
for _f in "$_cld_root/wiki"/* "$_cld_root/wiki"/.[!.]* "$_cld_root/wiki"/..?*; do
|
|
259
239
|
[ -e "$_f" ] || continue
|
|
260
240
|
_b="$(basename "$_f")"
|
|
261
241
|
case "$_b" in
|
|
262
|
-
index.md|_log.md|hot.md|.gitkeep)
|
|
263
|
-
continue
|
|
264
|
-
;;
|
|
242
|
+
index.md|_log.md|hot.md|.gitkeep) continue ;;
|
|
265
243
|
*)
|
|
266
|
-
|
|
267
|
-
continue
|
|
268
|
-
fi
|
|
244
|
+
[ -f "$_cld_root/$_cld_wiki/$_b" ] && cmp -s "$_f" "$_cld_root/$_cld_wiki/$_b" && continue
|
|
269
245
|
_can_clean=0
|
|
270
246
|
break
|
|
271
247
|
;;
|
|
272
248
|
esac
|
|
273
249
|
done
|
|
274
250
|
if [ "$_can_clean" -eq 1 ]; then
|
|
275
|
-
rm -rf "$
|
|
251
|
+
rm -rf "$_cld_root/wiki" 2>/dev/null || true
|
|
276
252
|
log_dim "Cleaned up obsolete root wiki/ directory"
|
|
277
253
|
fi
|
|
278
254
|
else
|
|
279
255
|
log_dim "Removed empty obsolete root wiki/ directory"
|
|
280
256
|
fi
|
|
281
257
|
fi
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
# Sync plugins into scoped directories: .rnex/plugins/<plugin-name>/
|
|
261
|
+
sync_plugins() {
|
|
262
|
+
# Clean up any bogus placeholder directories accidentally created in workspace root
|
|
263
|
+
for _bogus in \
|
|
264
|
+
"$NEXUS_DIR/\"{wiki_dir}" \
|
|
265
|
+
"$NEXUS_DIR/\"{raw_dir}" \
|
|
266
|
+
"$NEXUS_DIR/{wiki_dir}" \
|
|
267
|
+
"$NEXUS_DIR/{raw_dir}"; do
|
|
268
|
+
if [ -d "$_bogus" ]; then
|
|
269
|
+
rm -rf "$_bogus"
|
|
270
|
+
log_dim "Cleaned up leaked placeholder directory: $(basename "$_bogus")"
|
|
271
|
+
fi
|
|
272
|
+
done
|
|
273
|
+
|
|
274
|
+
# Clean up obsolete leaked root ./raw and ./wiki directories if non-default paths are configured
|
|
275
|
+
_raw_cfg="$(plugin_primary_source_dir "karpathy-llm" 2>/dev/null || true)"
|
|
276
|
+
[ -n "$_raw_cfg" ] || _raw_cfg="docs"
|
|
277
|
+
_wiki_cfg="$(yaml_plugin_get "karpathy-llm" "wiki_dir" 2>/dev/null || true)"
|
|
278
|
+
[ -n "$_wiki_cfg" ] || _wiki_cfg=".rnex/wiki"
|
|
279
|
+
_wiki_cfg="$(normalize_rel_path "$_wiki_cfg")"
|
|
280
|
+
_clean_leaked_plugin_dirs "$NEXUS_DIR" "$_raw_cfg" "$_wiki_cfg"
|
|
282
281
|
|
|
283
282
|
# 1. Prune plugins that are disabled or no longer enabled in config
|
|
284
283
|
if [ -d "$NEXUS_DIR/.rnex/plugins" ]; then
|
package/lib/workspace.sh
CHANGED
|
@@ -156,7 +156,8 @@ _load_repos_dir() {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
_load_code_workspace() {
|
|
159
|
-
_cw="$
|
|
159
|
+
_cw="${1:-}"
|
|
160
|
+
[ -n "$_cw" ] || _cw="$(yaml_get_top_level "code_workspace|vscode_workspace")"
|
|
160
161
|
case "$_cw" in
|
|
161
162
|
true|yes|1)
|
|
162
163
|
_ws_basename="$(basename "$NEXUS_DIR")"
|
package/package.json
CHANGED
|
@@ -1,62 +1,21 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
set -e
|
|
3
3
|
_root="${RNEX_ROOT:-${NEXUS_DIR:-$PWD}}"
|
|
4
|
-
|
|
5
4
|
if ! command -v merge_rnex_instructions >/dev/null 2>&1; then
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
for _env_cand in "$_root/.rnex/bin/rnex-env.sh" "${RNEX_LIB_DIR:-}/sdk.sh" "$_root/lib/sdk.sh"; do
|
|
6
|
+
[ -n "$_env_cand" ] && [ -f "$_env_cand" ] && { . "$_env_cand"; break; }
|
|
7
|
+
done
|
|
9
8
|
fi
|
|
10
9
|
|
|
11
|
-
# Instructions management (always maintained when claude plugin is enabled)
|
|
12
10
|
merge_rnex_instructions "$_root/CLAUDE.md"
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
_sk="$(provider_option_enabled "claude" "skills" 2>/dev/null && echo "true" || echo "false")"
|
|
16
|
-
if [ "$_sk" != "true" ]; then
|
|
12
|
+
if ! provider_option_enabled "claude" "skills" 2>/dev/null; then
|
|
17
13
|
clean_provider_user_skills "$_root/.claude/skills"
|
|
18
14
|
fi
|
|
19
15
|
|
|
20
|
-
# Auto-sync hook configuration (SessionStart)
|
|
21
|
-
_settings="$_root/.claude/settings.json"
|
|
22
16
|
if provider_auto_sync_enabled "claude"; then
|
|
23
|
-
|
|
24
|
-
if [ ! -f "$_settings" ]; then
|
|
25
|
-
cat > "$_settings" <<'EOF'
|
|
26
|
-
{
|
|
27
|
-
"hooks": {
|
|
28
|
-
"SessionStart": [
|
|
29
|
-
{
|
|
30
|
-
"command": ".rnex/bin/auto-sync.sh"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
EOF
|
|
36
|
-
elif ! grep -q "auto-sync.sh" "$_settings" 2>/dev/null; then
|
|
37
|
-
if grep -q '"SessionStart"' "$_settings" 2>/dev/null; then
|
|
38
|
-
_tmp="$(mktemp)"
|
|
39
|
-
awk '
|
|
40
|
-
/"SessionStart"[ ]*:[ ]*\[/ {
|
|
41
|
-
print
|
|
42
|
-
print " { \"command\": \".rnex/bin/auto-sync.sh\" },"
|
|
43
|
-
next
|
|
44
|
-
}
|
|
45
|
-
{ print }
|
|
46
|
-
' "$_settings" > "$_tmp" && mv "$_tmp" "$_settings"
|
|
47
|
-
elif grep -q '"hooks"' "$_settings" 2>/dev/null; then
|
|
48
|
-
_tmp="$(mktemp)"
|
|
49
|
-
awk '
|
|
50
|
-
/"hooks"[ ]*:[ ]*\{/ {
|
|
51
|
-
print
|
|
52
|
-
print " \"SessionStart\": [ { \"command\": \".rnex/bin/auto-sync.sh\" } ],"
|
|
53
|
-
next
|
|
54
|
-
}
|
|
55
|
-
{ print }
|
|
56
|
-
' "$_settings" > "$_tmp" && mv "$_tmp" "$_settings"
|
|
57
|
-
fi
|
|
58
|
-
fi
|
|
17
|
+
sync_claude_auto_sync_hook "$_root/.claude/settings.json"
|
|
59
18
|
else
|
|
60
|
-
clean_claude_auto_sync_hook "$
|
|
19
|
+
clean_claude_auto_sync_hook "$_root/.claude/settings.json"
|
|
61
20
|
rmdir "$_root/.claude" 2>/dev/null || true
|
|
62
21
|
fi
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
set -e
|
|
3
3
|
_root="${RNEX_ROOT:-${NEXUS_DIR:-$PWD}}"
|
|
4
|
-
|
|
5
4
|
if ! command -v clean_rnex_instructions >/dev/null 2>&1; then
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
for _env_cand in "$_root/.rnex/bin/rnex-env.sh" "${RNEX_LIB_DIR:-}/sdk.sh" "$_root/lib/sdk.sh"; do
|
|
6
|
+
[ -n "$_env_cand" ] && [ -f "$_env_cand" ] && { . "$_env_cand"; break; }
|
|
7
|
+
done
|
|
9
8
|
fi
|
|
10
9
|
|
|
11
10
|
clean_rnex_instructions "$_root/CLAUDE.md"
|