repo-nexus 0.6.13 → 0.6.15
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/CHANGELOG.md +7 -0
- package/docs/cli/index.md +3 -3
- package/docs/cli/tooling.md +1 -1
- package/docs/cli/workspace.md +14 -11
- package/docs/examples/local-overrides.md +2 -2
- package/docs/guide/architecture.md +1 -1
- package/docs/guide/configuration.md +4 -4
- package/docs/guide/workflows.md +1 -1
- package/docs/plugins/authoring.md +2 -2
- package/docs/plugins/index.md +1 -1
- package/lib/ai.sh +4 -4
- package/lib/commands/completion.sh +4 -3
- package/lib/commands/fix.sh +2 -123
- package/lib/commands/init.sh +1 -1
- package/lib/commands/plugin.sh +4 -4
- package/lib/commands/status.sh +5 -5
- package/lib/commands/sync.sh +341 -0
- package/lib/commands/system.sh +6 -4
- package/lib/commands.sh +1 -1
- package/lib/hooks.sh +1 -1
- package/package.json +1 -1
- package/rnex +2 -1
- package/templates/rnex.example.yaml +2 -2
- package/toolkit/plugins/karpathy-llm/README.md +2 -2
- package/toolkit/prompts/rnex-workspace-audit.md +1 -1
- package/toolkit/skills/rnex-workspace-audit/SKILL.md +1 -1
- package/toolkit/workflows/rnex-workspace-audit.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
- **Replaced `rnex fix` with `rnex sync` (with optional `--fix` flag)**:
|
|
12
|
+
- `rnex sync` without `--fix` performs a dry-run audit, checking workspace configuration, `.gitignore`, `.ignore`, AI routing instructions (`AGENTS.md`, provider files), active/disabled plugin assets, member repository scaffolding, and multi-root workspace definitions, logging any inconsistencies without mutating files.
|
|
13
|
+
- `rnex sync --fix` (or `-f`) executes full workspace reconciliation, schema upgrades, prompt/workflow synchronization, and asset repairs.
|
|
14
|
+
- `rnex fix` is maintained as a deprecated backward-compatible alias for `rnex sync --fix`, displaying a deprecation notice directing users to `rnex sync --fix`.
|
|
15
|
+
- All workspace documentation, guides, prompt templates, and AI routing instructions updated to reference `rnex sync` and `rnex sync --fix`.
|
|
16
|
+
|
|
10
17
|
### Added
|
|
11
18
|
- **Modular Test Suite Architecture**:
|
|
12
19
|
- Decomposed monolithic `tests/test_cli.sh` (996 lines, 36 tests) into modular, single-responsibility test suites under `tests/suites/`:
|
package/docs/cli/index.md
CHANGED
|
@@ -13,8 +13,8 @@ description: Fast reference cheatsheet for rnex commands, global options, enviro
|
|
|
13
13
|
|:---|:---|:---|
|
|
14
14
|
| [`rnex init`](workspace.md#rnex-init) | Workspace | Initialize a new Repo Nexus workspace. |
|
|
15
15
|
| [`rnex status`](workspace.md#rnex-status) | Workspace | Inspect workspace health, clones, and AI instructions. |
|
|
16
|
-
| [`rnex
|
|
17
|
-
| [`rnex update` / `upgrade`](workspace.md#rnex-update-alias-upgrade) | Workspace | Part of fix: verify version, upgrade schema, and reconcile workspace. |
|
|
16
|
+
| [`rnex sync`](workspace.md#rnex-sync) | Workspace | Check workspace consistency, or reconcile with `--fix`. |
|
|
17
|
+
| [`rnex update` / `upgrade`](workspace.md#rnex-update-alias-upgrade) | Workspace | Part of sync --fix: verify version, upgrade schema, and reconcile workspace. |
|
|
18
18
|
| [`rnex install`](workspace.md#rnex-install) | Workspace | Symlink `rnex` to `~/.local/bin`. |
|
|
19
19
|
| [`rnex completion`](workspace.md#rnex-completion) | Workspace | Generate shell auto-completion for Zsh, Bash, or Fish. |
|
|
20
20
|
| [`rnex version`](workspace.md#rnex-version) | Workspace | Display current installed CLI version. |
|
|
@@ -49,7 +49,7 @@ rnex [global-options] <command> [command-options] [arguments]
|
|
|
49
49
|
|
|
50
50
|
## Standardized Prompts Catalog
|
|
51
51
|
|
|
52
|
-
Repo Nexus provides a standardized suite of operational prompt templates in `toolkit/prompts/` that sync to `.rnex/prompts/` during `rnex fix` or `rnex init`.
|
|
52
|
+
Repo Nexus provides a standardized suite of operational prompt templates in `toolkit/prompts/` that sync to `.rnex/prompts/` during `rnex sync --fix` or `rnex init`.
|
|
53
53
|
|
|
54
54
|
AI assistants navigate workflows via the catalog index at `.rnex/prompts/index.md`:
|
|
55
55
|
|
package/docs/cli/tooling.md
CHANGED
|
@@ -21,7 +21,7 @@ rnex hooks install [--local]
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
#### Installed Hooks:
|
|
24
|
-
* **`post-merge`**: Runs `rnex fix -y --quiet` automatically whenever `git pull` or upstream merges occur, ensuring newly added repositories and plugin updates sync instantly.
|
|
24
|
+
* **`post-merge`**: Runs `rnex sync --fix -y --quiet` automatically whenever `git pull` or upstream merges occur, ensuring newly added repositories and plugin updates sync instantly.
|
|
25
25
|
* **`post-commit`**: Alerts the user if documentation or wiki files were committed without running maintenance linters.
|
|
26
26
|
* **`pre-commit`**: Runs pre-commit validation triggers declared by active plugins.
|
|
27
27
|
* **`pre-push`**: Runs pre-push validation triggers before pushing to remote.
|
package/docs/cli/workspace.md
CHANGED
|
@@ -70,26 +70,29 @@ rnex status
|
|
|
70
70
|
|
|
71
71
|
---
|
|
72
72
|
|
|
73
|
-
## `rnex
|
|
73
|
+
## `rnex sync`
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Synchronizes workspace assets, validates configuration, and audits or reconciles AI routing instructions, skills, workflows, active plugins, and member clones.
|
|
76
|
+
|
|
77
|
+
- **Audit Mode (Default)**: When run without `--fix`, inspects workspace configuration, Git ignores, routing blocks, plugin assets, and member repositories, logging any issues or inconsistencies without mutating files.
|
|
78
|
+
- **Reconcile Mode (`--fix`)**: Reconciles configuration schema, updates instruction files, synchronizes skills/workflows, mirrors operational prompts, and fixes inconsistencies.
|
|
76
79
|
|
|
77
80
|
### Syntax
|
|
78
81
|
```sh
|
|
79
|
-
rnex fix [options]
|
|
80
82
|
rnex sync [options]
|
|
81
83
|
```
|
|
82
84
|
|
|
83
85
|
### Options
|
|
84
86
|
| Option | Shorthand | Type | Default | Description |
|
|
85
87
|
|:---|:---|:---|:---|:---|
|
|
86
|
-
| `--
|
|
88
|
+
| `--fix` | `-f` | boolean | `false` | Apply reconciliation fixes across workspace, routing, plugins, and repos. |
|
|
89
|
+
| `--yes` | `-y` | boolean | `false` | Automatically confirm schema upgrades if prompted (used with `--fix`). |
|
|
87
90
|
| `--quiet` | `-q` | boolean | `false` | Quiet mode; suppresses non-error informational messages (ideal for hooks). |
|
|
88
|
-
| `--upgrade` | | boolean | `false` | Explicitly trigger version upgrade reconciliation. |
|
|
91
|
+
| `--upgrade` | | boolean | `false` | Explicitly trigger version upgrade reconciliation (implies `--fix`). |
|
|
89
92
|
|
|
90
|
-
### Reconciliation Actions
|
|
93
|
+
### Reconciliation Actions (with `--fix`)
|
|
91
94
|
1. Upgrades configuration schema non-destructively if an older version is detected.
|
|
92
|
-
2. Re-verifies `.gitignore` rules for `repos/` and local configs
|
|
95
|
+
2. Re-verifies `.gitignore` rules for `repos/` and local configs, and ensures `.ignore` contains `!repos/*`.
|
|
93
96
|
3. Inserts or updates delimited routing blocks in universal `AGENTS.md` and active provider instruction files (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`, `.windsurfrules`).
|
|
94
97
|
4. Syncs base workflows to `.rnex/workflows/` and base skills to `.rnex/skills/`, purging any legacy `.rnex/prompts/`.
|
|
95
98
|
5. Mirrors operational prompts to enabled AI providers (`.github/prompts/`, `.claude/commands/`, etc.).
|
|
@@ -102,7 +105,7 @@ rnex sync [options]
|
|
|
102
105
|
|
|
103
106
|
## `rnex update` (alias: `upgrade`)
|
|
104
107
|
|
|
105
|
-
Runs version verification and invokes the unified `rnex fix` reconciliation engine to upgrade workspace configuration and routing instructions to match the installed CLI version.
|
|
108
|
+
Runs version verification and invokes the unified `rnex sync --fix` reconciliation engine to upgrade workspace configuration and routing instructions to match the installed CLI version.
|
|
106
109
|
|
|
107
110
|
### Syntax
|
|
108
111
|
```sh
|
|
@@ -116,10 +119,10 @@ rnex upgrade [options]
|
|
|
116
119
|
| `--yes` | `-y` | boolean | `false` | Automatically confirm schema upgrades if prompted. |
|
|
117
120
|
| `--quiet` | `-q` | boolean | `false` | Suppress non-error informational messages. |
|
|
118
121
|
|
|
119
|
-
### Relationship with `rnex
|
|
120
|
-
`rnex update` is part of the `rnex
|
|
122
|
+
### Relationship with `rnex sync`
|
|
123
|
+
`rnex update` is part of the `rnex sync` command family:
|
|
121
124
|
* **Upfront Version Diagnostics**: Compares `version:` in `rnex.yaml` against the installed CLI version. If already matching, it reports that the workspace is up to date.
|
|
122
|
-
* **Unified Reconciliation**: Delegates directly to `rnex fix`, ensuring configuration schema upgrades, instruction updates (`AGENTS.md`, provider files), skills/workflows sync, and plugin reconciliation occur in a single, idempotent pass.
|
|
125
|
+
* **Unified Reconciliation**: Delegates directly to `rnex sync --fix`, ensuring configuration schema upgrades, instruction updates (`AGENTS.md`, provider files), skills/workflows sync, and plugin reconciliation occur in a single, idempotent pass.
|
|
123
126
|
* **Non-Destructive Migration**: Upgrades schema keys while preserving comments, indentation, and custom configurations.
|
|
124
127
|
|
|
125
128
|
---
|
|
@@ -79,7 +79,7 @@ This workspace operates as a Repo Nexus Virtual Meta-Repo uniting independent re
|
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
::: tip Preserving Custom Instructions
|
|
82
|
-
Any custom guidelines, rules, or documentation authored outside the `<!-- REPO-NEXUS:START -->` and `<!-- REPO-NEXUS:END -->` markers are strictly preserved during `rnex fix` or plugin synchronization.
|
|
82
|
+
Any custom guidelines, rules, or documentation authored outside the `<!-- REPO-NEXUS:START -->` and `<!-- REPO-NEXUS:END -->` markers are strictly preserved during `rnex sync --fix` or plugin synchronization.
|
|
83
83
|
:::
|
|
84
84
|
|
|
85
85
|
### 5. Multi-Root IDE Workspaces
|
|
@@ -90,7 +90,7 @@ plugins:
|
|
|
90
90
|
| `version` | string | Current CLI version | Schema version compatibility check. |
|
|
91
91
|
| `repos_dir` | string | `./repos` | Relative or absolute path where member repos are cloned. |
|
|
92
92
|
| `code_workspace` | boolean \| string | `false` | Enables `.code-workspace` generation. Pass a string for custom filename. |
|
|
93
|
-
| `git_hooks` | boolean | `true` | Configures `.rnex/hooks` as `core.hooksPath` during `rnex fix`. |
|
|
93
|
+
| `git_hooks` | boolean | `true` | Configures `.rnex/hooks` as `core.hooksPath` during `rnex sync --fix`. |
|
|
94
94
|
| `repos` | map | `{}` | Map of member repository specifications keyed by name. |
|
|
95
95
|
| `plugins` | map | `{}` | Map of enabled plugins and their configuration options. |
|
|
96
96
|
|
|
@@ -124,9 +124,9 @@ plugins:
|
|
|
124
124
|
After modifying configuration files directly, reconcile the workspace state:
|
|
125
125
|
|
|
126
126
|
```bash
|
|
127
|
-
rnex fix
|
|
127
|
+
rnex sync --fix
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
::: tip
|
|
131
|
-
`rnex sync`
|
|
130
|
+
::: tip Audit vs. Reconcile
|
|
131
|
+
Running `rnex sync` without `--fix` audits the workspace and logs any detected configuration inconsistencies without modifying files. Adding `--fix` applies the reconciliation.
|
|
132
132
|
:::
|
package/docs/guide/workflows.md
CHANGED
|
@@ -66,7 +66,7 @@ If a command fails in any repository, `rnex exec` exits immediately with that co
|
|
|
66
66
|
Repo Nexus includes an automated hook runner configured via `core.hooksPath = .rnex/hooks`.
|
|
67
67
|
|
|
68
68
|
### Core Automated Hooks
|
|
69
|
-
1. **`post-merge`**: When you pull updates to the meta-repo (`git pull`), the hook automatically executes `rnex fix` to:
|
|
69
|
+
1. **`post-merge`**: When you pull updates to the meta-repo (`git pull`), the hook automatically executes `rnex sync --fix` to:
|
|
70
70
|
* Clone newly declared member repositories.
|
|
71
71
|
* Update AI routing instructions (`AGENTS.md`, etc.).
|
|
72
72
|
* Sync plugin changes.
|
|
@@ -46,7 +46,7 @@ A plugin can contain any of the following standard directories:
|
|
|
46
46
|
| `agents/` | Autonomous subagent declarations (`*.agent.md`). | Scoped to `.rnex/plugins/<plugin>/agents/`. Ingested by agents via `AGENTS.md` subagent routing. |
|
|
47
47
|
| `instructions/` | Markdown guidelines and domain principles. | Scoped to `.rnex/plugins/<plugin>/instructions/`. |
|
|
48
48
|
| `rules/` | Coding rules and architectural constraints. | Scoped to `.rnex/plugins/<plugin>/rules/`. |
|
|
49
|
-
| `templates/` | Starter configuration files copied during `rnex fix`. | Copied to mapped paths specified in `templates:`. |
|
|
49
|
+
| `templates/` | Starter configuration files copied during `rnex sync --fix`. | Copied to mapped paths specified in `templates:`. |
|
|
50
50
|
|
|
51
51
|
> [!NOTE]
|
|
52
52
|
> All AI assistants share `AGENTS.md` at workspace root. Tools, skills, workflows, and subagents stay inside `.rnex/` and are not mirrored externally. Prompts are exclusively for user invocation through IDE prompt pickers (e.g. `.github/prompts/`, `.claude/commands/`).
|
|
@@ -64,6 +64,6 @@ A plugin can contain any of the following standard directories:
|
|
|
64
64
|
```
|
|
65
65
|
4. Reconcile workspace state:
|
|
66
66
|
```bash
|
|
67
|
-
rnex fix
|
|
67
|
+
rnex sync --fix
|
|
68
68
|
```
|
|
69
69
|
5. Verify that assets were correctly scoped into `.rnex/plugins/my-plugin/`.
|
package/docs/plugins/index.md
CHANGED
package/lib/ai.sh
CHANGED
|
@@ -129,8 +129,8 @@ Each member repository is an autonomous Git repository. For repository-specific
|
|
|
129
129
|
|
|
130
130
|
## Workspace Maintenance
|
|
131
131
|
When workspace configuration, routing blocks, plugin assets, or member repository structures require reconciliation or schema upgrades:
|
|
132
|
-
- Run \`rnex fix\` (or
|
|
133
|
-
- Use \`rnex fix -y\` to non-destructively apply configuration version upgrades automatically.
|
|
132
|
+
- Run \`rnex sync --fix\` (or \`rnex sync\` to check for inconsistencies).
|
|
133
|
+
- Use \`rnex sync --fix -y\` to non-destructively apply configuration version upgrades automatically.
|
|
134
134
|
|
|
135
135
|
## Git Operations
|
|
136
136
|
Commit and push changes directly within the respective member repository root (\`repos/<name>/\`).
|
|
@@ -177,8 +177,8 @@ Each member repository is an autonomous Git repository. For repository-specific
|
|
|
177
177
|
|
|
178
178
|
## Workspace Maintenance
|
|
179
179
|
When workspace configuration, routing blocks, plugin assets, or member repository structures require reconciliation or schema upgrades:
|
|
180
|
-
- Run \`rnex fix\` (or
|
|
181
|
-
- Use \`rnex fix -y\` to non-destructively apply configuration version upgrades automatically.
|
|
180
|
+
- Run \`rnex sync --fix\` (or \`rnex sync\` to check for inconsistencies).
|
|
181
|
+
- Use \`rnex sync --fix -y\` to non-destructively apply configuration version upgrades automatically.
|
|
182
182
|
|
|
183
183
|
## Git Operations
|
|
184
184
|
Commit and push changes directly within the respective member repository root (\`repos/<name>/\`).
|
|
@@ -63,8 +63,8 @@ _rnex() {
|
|
|
63
63
|
'list:List member repositories'
|
|
64
64
|
'status:Inspect workspace health and status'
|
|
65
65
|
'rnex-dir:Toggle .rnex directory integration for a repo'
|
|
66
|
-
'
|
|
67
|
-
'
|
|
66
|
+
'sync:Check workspace consistency (use --fix to reconcile)'
|
|
67
|
+
'fix:(Deprecated: use sync --fix) Reconcile workspace and plugins'
|
|
68
68
|
'update:Upgrade workspace configuration and routing instructions'
|
|
69
69
|
'upgrade:Alias for update'
|
|
70
70
|
'hooks:Manage automated Git hooks'
|
|
@@ -127,7 +127,8 @@ complete -c rnex -n "__fish_use_subcommand" -a enable -d "Enable a repository"
|
|
|
127
127
|
complete -c rnex -n "__fish_use_subcommand" -a disable -d "Disable a repository"
|
|
128
128
|
complete -c rnex -n "__fish_use_subcommand" -a list -d "List repositories"
|
|
129
129
|
complete -c rnex -n "__fish_use_subcommand" -a status -d "Inspect workspace status"
|
|
130
|
-
complete -c rnex -n "__fish_use_subcommand" -a
|
|
130
|
+
complete -c rnex -n "__fish_use_subcommand" -a sync -d "Check workspace consistency (use --fix to reconcile)"
|
|
131
|
+
complete -c rnex -n "__fish_use_subcommand" -a fix -d "(Deprecated) Reconcile workspace"
|
|
131
132
|
complete -c rnex -n "__fish_use_subcommand" -a update -d "Upgrade workspace configuration"
|
|
132
133
|
complete -c rnex -n "__fish_use_subcommand" -a upgrade -d "Upgrade workspace configuration"
|
|
133
134
|
complete -c rnex -n "__fish_use_subcommand" -a hooks -d "Manage Git hooks"
|
package/lib/commands/fix.sh
CHANGED
|
@@ -1,128 +1,7 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# shellcheck shell=sh
|
|
3
3
|
# ============================================================================
|
|
4
|
-
# lib/commands/fix.sh —
|
|
4
|
+
# lib/commands/fix.sh — Backward compatibility forwarder for sync.sh
|
|
5
5
|
# ============================================================================
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
require_workspace
|
|
9
|
-
ensure_repos_dir
|
|
10
|
-
|
|
11
|
-
_fix_auto_yes=0
|
|
12
|
-
_fix_quiet=0
|
|
13
|
-
_fix_upgrade_explicit=0
|
|
14
|
-
|
|
15
|
-
while [ $# -gt 0 ]; do
|
|
16
|
-
case "$1" in
|
|
17
|
-
-y|--yes) _fix_auto_yes=1 ;;
|
|
18
|
-
-q|--quiet) _fix_quiet=1 ;;
|
|
19
|
-
--upgrade) _fix_upgrade_explicit=1; _fix_auto_yes=1 ;;
|
|
20
|
-
*) ;;
|
|
21
|
-
esac
|
|
22
|
-
shift
|
|
23
|
-
done
|
|
24
|
-
|
|
25
|
-
[ "$_fix_quiet" -eq 0 ] && log_info "Reconciling Repo Nexus workspace at $NEXUS_DIR..."
|
|
26
|
-
|
|
27
|
-
# Version detection & non-destructive upgrade (integrated as single process)
|
|
28
|
-
_vc_res=0
|
|
29
|
-
version_cmp "$WORKSPACE_CONFIG_VERSION" "$RNEX_VERSION" || _vc_res=$?
|
|
30
|
-
if [ "$_vc_res" -eq 2 ]; then
|
|
31
|
-
upgrade_workspace_config "$WORKSPACE_YAML" "$RNEX_VERSION"
|
|
32
|
-
_load_workspace_version
|
|
33
|
-
_load_repos_dir
|
|
34
|
-
_load_code_workspace
|
|
35
|
-
_load_git_hooks
|
|
36
|
-
_load_copilot
|
|
37
|
-
[ "$_fix_quiet" -eq 0 ] && log_ok "Upgraded workspace configuration and routing instructions to v$RNEX_VERSION"
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
# 1. Ensure .gitignore ignores repos/, .rnex/, and local configs, and strips legacy counters
|
|
41
|
-
reconcile_gitignore "$NEXUS_DIR"
|
|
42
|
-
|
|
43
|
-
# 2. Reconcile plugins (scopes, asset pruning for disabled plugins)
|
|
44
|
-
sync_plugins
|
|
45
|
-
|
|
46
|
-
# 3. Reconcile universal workspace instructions in AGENTS.md
|
|
47
|
-
merge_rnex_instructions "$NEXUS_DIR/AGENTS.md"
|
|
48
|
-
|
|
49
|
-
# 4. Sync standard skills, workflows, and provider prompts
|
|
50
|
-
sync_prompts
|
|
51
|
-
|
|
52
|
-
# 5. Reconcile Git hooks according to configuration
|
|
53
|
-
case "$GIT_HOOKS_CONFIG" in
|
|
54
|
-
false|no|0)
|
|
55
|
-
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
56
|
-
if [ "$_cur_hp" = ".rnex/hooks" ] || [ "$_cur_hp" = "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
57
|
-
cmd_hooks_uninstall_dir "$NEXUS_DIR"
|
|
58
|
-
fi
|
|
59
|
-
;;
|
|
60
|
-
true|yes|1)
|
|
61
|
-
if git -C "$NEXUS_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
62
|
-
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
63
|
-
if [ "$_cur_hp" != ".rnex/hooks" ] && [ "$_cur_hp" != "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
64
|
-
cmd_hooks_install_dir "$NEXUS_DIR"
|
|
65
|
-
elif [ "${_RNEX_INSIDE_HOOK:-0}" -ne 1 ]; then
|
|
66
|
-
_hooks_dir="$NEXUS_DIR/.rnex/hooks"
|
|
67
|
-
_create_hook_script "$_hooks_dir/post-merge" "post-merge"
|
|
68
|
-
_create_hook_script "$_hooks_dir/post-commit" "post-commit"
|
|
69
|
-
_create_hook_script "$_hooks_dir/pre-commit" "pre-commit"
|
|
70
|
-
_create_hook_script "$_hooks_dir/pre-push" "pre-push"
|
|
71
|
-
fi
|
|
72
|
-
fi
|
|
73
|
-
;;
|
|
74
|
-
*)
|
|
75
|
-
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
76
|
-
if [ "$_cur_hp" = ".rnex/hooks" ] || [ "$_cur_hp" = "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
77
|
-
if [ "${_RNEX_INSIDE_HOOK:-0}" -ne 1 ]; then
|
|
78
|
-
_hooks_dir="$NEXUS_DIR/.rnex/hooks"
|
|
79
|
-
_create_hook_script "$_hooks_dir/post-merge" "post-merge"
|
|
80
|
-
_create_hook_script "$_hooks_dir/post-commit" "post-commit"
|
|
81
|
-
_create_hook_script "$_hooks_dir/pre-commit" "pre-commit"
|
|
82
|
-
_create_hook_script "$_hooks_dir/pre-push" "pre-push"
|
|
83
|
-
fi
|
|
84
|
-
fi
|
|
85
|
-
;;
|
|
86
|
-
esac
|
|
87
|
-
|
|
88
|
-
# 6. Reconcile member repos
|
|
89
|
-
yaml_list_repos | while read -r _name; do
|
|
90
|
-
[ -n "$_name" ] || continue
|
|
91
|
-
if yaml_repo_enabled "$_name"; then
|
|
92
|
-
_rdir="$(resolve_repo_path "$_name")"
|
|
93
|
-
if [ -d "$_rdir" ]; then
|
|
94
|
-
sync_repo_rnex "$_name"
|
|
95
|
-
else
|
|
96
|
-
log_warn "Member repo '$_name' is missing on disk. Run: rnex clone"
|
|
97
|
-
fi
|
|
98
|
-
fi
|
|
99
|
-
done
|
|
100
|
-
|
|
101
|
-
# 7. Reconcile VS Code / Cursor multi-root workspace if configured
|
|
102
|
-
sync_code_workspace
|
|
103
|
-
|
|
104
|
-
if [ "$_fix_quiet" -eq 0 ]; then
|
|
105
|
-
log_ok "Fix complete — workspace, plugins, prompts, and member .rnex directories reconciled"
|
|
106
|
-
fi
|
|
107
|
-
return 0
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
cmd_sync() {
|
|
111
|
-
cmd_fix "$@"
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
cmd_update() {
|
|
115
|
-
require_workspace
|
|
116
|
-
_cmp=0
|
|
117
|
-
version_cmp "$WORKSPACE_CONFIG_VERSION" "$RNEX_VERSION" || _cmp=$?
|
|
118
|
-
if [ "$_cmp" -eq 0 ]; then
|
|
119
|
-
log_ok "Workspace configuration and routing instructions are already up to date (v$RNEX_VERSION)"
|
|
120
|
-
elif [ "$_cmp" -eq 1 ]; then
|
|
121
|
-
log_info "Workspace configuration version (v$WORKSPACE_CONFIG_VERSION) is newer than current CLI (v$RNEX_VERSION)"
|
|
122
|
-
fi
|
|
123
|
-
cmd_fix "$@"
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
cmd_upgrade() {
|
|
127
|
-
cmd_update "$@"
|
|
128
|
-
}
|
|
7
|
+
. "$RNEX_LIB_DIR/commands/sync.sh"
|
package/lib/commands/init.sh
CHANGED
|
@@ -98,7 +98,7 @@ cmd_init() {
|
|
|
98
98
|
if [ -f "$_target_yaml" ]; then
|
|
99
99
|
log_warn "Workspace configuration already exists at $_init_dir ($RNEX_CONFIG_FILE exists)"
|
|
100
100
|
log_dim "To reconcile repos and plugins, run:"
|
|
101
|
-
log_dim " rnex fix"
|
|
101
|
+
log_dim " rnex sync --fix"
|
|
102
102
|
else
|
|
103
103
|
_init_plugins=""
|
|
104
104
|
if [ "$_cli_copilot" = "true" ]; then
|
package/lib/commands/plugin.sh
CHANGED
|
@@ -145,7 +145,7 @@ cmd_plugin_enable() {
|
|
|
145
145
|
fi
|
|
146
146
|
|
|
147
147
|
sync_plugins
|
|
148
|
-
|
|
148
|
+
cmd_sync --fix
|
|
149
149
|
log_ok "Plugin '$_name' active in workspace (.rnex/plugins/$_name)"
|
|
150
150
|
}
|
|
151
151
|
|
|
@@ -183,7 +183,7 @@ cmd_plugin_disable() {
|
|
|
183
183
|
fi
|
|
184
184
|
|
|
185
185
|
sync_plugins
|
|
186
|
-
|
|
186
|
+
cmd_sync --fix -q
|
|
187
187
|
log_ok "Plugin '$_name' disabled from workspace"
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -222,12 +222,12 @@ cmd_plugin_update() {
|
|
|
222
222
|
[ -n "$_pdir" ] || die "Plugin '$_pname' not found."
|
|
223
223
|
log_info "Updating plugin '$_pname'..."
|
|
224
224
|
sync_plugins
|
|
225
|
-
|
|
225
|
+
cmd_sync --fix
|
|
226
226
|
log_ok "Plugin '$_pname' updated"
|
|
227
227
|
else
|
|
228
228
|
log_info "Updating all enabled plugins..."
|
|
229
229
|
sync_plugins
|
|
230
|
-
|
|
230
|
+
cmd_sync --fix
|
|
231
231
|
log_ok "All plugins updated"
|
|
232
232
|
fi
|
|
233
233
|
}
|
package/lib/commands/status.sh
CHANGED
|
@@ -44,7 +44,7 @@ cmd_status() {
|
|
|
44
44
|
if [ "$_gi_repos" -eq 1 ] && [ "$_gi_local" -eq 1 ] && [ "$_gi_has_counter" -eq 0 ] && [ "$_gi_has_rnex" -eq 0 ]; then
|
|
45
45
|
printf ' %b✓%b Git Ignore: repos/ and %s ignored in .gitignore\n' "$_G" "$_NC" "$RNEX_LOCAL_CONFIG_FILE"
|
|
46
46
|
else
|
|
47
|
-
printf ' %b!%b Git Ignore: recommend running "rnex fix" to update .gitignore (repos/, local configs)\n' "$_Y" "$_NC"
|
|
47
|
+
printf ' %b!%b Git Ignore: recommend running "rnex sync --fix" to update .gitignore (repos/, local configs)\n' "$_Y" "$_NC"
|
|
48
48
|
fi
|
|
49
49
|
|
|
50
50
|
_hooks_path="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
@@ -56,7 +56,7 @@ cmd_status() {
|
|
|
56
56
|
case "$GIT_HOOKS_CONFIG" in
|
|
57
57
|
false|no|0)
|
|
58
58
|
if [ "$_gh_active" -eq 1 ]; then
|
|
59
|
-
printf ' %b!%b Git Hooks: active in Git, but disabled in config (git_hooks: false; run "rnex fix" to reconcile)\n' "$_Y" "$_NC"
|
|
59
|
+
printf ' %b!%b Git Hooks: active in Git, but disabled in config (git_hooks: false; run "rnex sync --fix" to reconcile)\n' "$_Y" "$_NC"
|
|
60
60
|
else
|
|
61
61
|
printf ' %b○%b Git Hooks: disabled in configuration (git_hooks: false)\n' "$_DIM" "$_NC"
|
|
62
62
|
fi
|
|
@@ -73,7 +73,7 @@ cmd_status() {
|
|
|
73
73
|
printf ' %b✓%b Git Hooks: active (git_hooks: true, .rnex/hooks — post-merge auto-sync)\n' "$_G" "$_NC"
|
|
74
74
|
fi
|
|
75
75
|
else
|
|
76
|
-
printf ' %b!%b Git Hooks: enabled in config (git_hooks: true), but not active in Git (run "rnex fix")\n' "$_Y" "$_NC"
|
|
76
|
+
printf ' %b!%b Git Hooks: enabled in config (git_hooks: true), but not active in Git (run "rnex sync --fix")\n' "$_Y" "$_NC"
|
|
77
77
|
fi
|
|
78
78
|
;;
|
|
79
79
|
*)
|
|
@@ -99,7 +99,7 @@ cmd_status() {
|
|
|
99
99
|
if [ -f "$NEXUS_DIR/AGENTS.md" ]; then
|
|
100
100
|
printf ' %b✓%b %s %b(standard instructions)%b\n' "$_G" "$_NC" "AGENTS.md" "$_DIM" "$_NC"
|
|
101
101
|
else
|
|
102
|
-
printf ' %b✗%b %s %b(standard instructions — MISSING; run "rnex fix" to create)%b\n' "$_R" "$_NC" "AGENTS.md" "$_R" "$_NC"
|
|
102
|
+
printf ' %b✗%b %s %b(standard instructions — MISSING; run "rnex sync --fix" to create)%b\n' "$_R" "$_NC" "AGENTS.md" "$_R" "$_NC"
|
|
103
103
|
fi
|
|
104
104
|
if [ -f "$NEXUS_DIR/CLAUDE.md" ]; then
|
|
105
105
|
printf ' %b✓%b %s %b(Claude instructions)%b\n' "$_G" "$_NC" "CLAUDE.md" "$_DIM" "$_NC"
|
|
@@ -117,7 +117,7 @@ cmd_status() {
|
|
|
117
117
|
if [ -f "$NEXUS_DIR/$CODE_WORKSPACE_FILE" ]; then
|
|
118
118
|
printf ' %b✓%b %s %b(VS Code / Cursor workspace)%b\n' "$_G" "$_NC" "$CODE_WORKSPACE_FILE" "$_DIM" "$_NC"
|
|
119
119
|
else
|
|
120
|
-
printf ' %b✗%b %s %b(VS Code / Cursor workspace — MISSING; run "rnex fix" to create)%b\n' "$_R" "$_NC" "$CODE_WORKSPACE_FILE" "$_R" "$_NC"
|
|
120
|
+
printf ' %b✗%b %s %b(VS Code / Cursor workspace — MISSING; run "rnex sync --fix" to create)%b\n' "$_R" "$_NC" "$CODE_WORKSPACE_FILE" "$_R" "$_NC"
|
|
121
121
|
fi
|
|
122
122
|
fi
|
|
123
123
|
for _found_cw in "$NEXUS_DIR"/*.code-workspace; do
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# shellcheck shell=sh
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# lib/commands/sync.sh — Workspace synchronization, audit, and repair
|
|
5
|
+
# ============================================================================
|
|
6
|
+
|
|
7
|
+
cmd_sync() {
|
|
8
|
+
require_workspace
|
|
9
|
+
ensure_repos_dir
|
|
10
|
+
|
|
11
|
+
_sync_fix=0
|
|
12
|
+
_sync_auto_yes=0
|
|
13
|
+
_sync_quiet=0
|
|
14
|
+
_sync_upgrade_explicit=0
|
|
15
|
+
|
|
16
|
+
while [ $# -gt 0 ]; do
|
|
17
|
+
case "$1" in
|
|
18
|
+
-f|--fix) _sync_fix=1 ;;
|
|
19
|
+
-y|--yes) _sync_auto_yes=1 ;;
|
|
20
|
+
-q|--quiet) _sync_quiet=1 ;;
|
|
21
|
+
--upgrade) _sync_upgrade_explicit=1; _sync_auto_yes=1; _sync_fix=1 ;;
|
|
22
|
+
*) ;;
|
|
23
|
+
esac
|
|
24
|
+
shift
|
|
25
|
+
done
|
|
26
|
+
|
|
27
|
+
# --------------------------------------------------------------------------
|
|
28
|
+
# Reconciliation / fix mode (--fix)
|
|
29
|
+
# --------------------------------------------------------------------------
|
|
30
|
+
if [ "$_sync_fix" -eq 1 ]; then
|
|
31
|
+
[ "$_sync_quiet" -eq 0 ] && log_info "Reconciling Repo Nexus workspace at $NEXUS_DIR..."
|
|
32
|
+
|
|
33
|
+
# Version detection & non-destructive upgrade (integrated as single process)
|
|
34
|
+
_vc_res=0
|
|
35
|
+
version_cmp "$WORKSPACE_CONFIG_VERSION" "$RNEX_VERSION" || _vc_res=$?
|
|
36
|
+
if [ "$_vc_res" -eq 2 ]; then
|
|
37
|
+
upgrade_workspace_config "$WORKSPACE_YAML" "$RNEX_VERSION"
|
|
38
|
+
_load_workspace_version
|
|
39
|
+
_load_repos_dir
|
|
40
|
+
_load_code_workspace
|
|
41
|
+
_load_git_hooks
|
|
42
|
+
_load_copilot
|
|
43
|
+
[ "$_sync_quiet" -eq 0 ] && log_ok "Upgraded workspace configuration and routing instructions to v$RNEX_VERSION"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# 1. Ensure .gitignore ignores repos/, .rnex/, and local configs, and strips legacy counters; ensure .ignore has !repos/*
|
|
47
|
+
reconcile_gitignore "$NEXUS_DIR"
|
|
48
|
+
|
|
49
|
+
# 2. Reconcile plugins (scopes, asset pruning for disabled plugins)
|
|
50
|
+
sync_plugins
|
|
51
|
+
|
|
52
|
+
# 3. Reconcile universal workspace instructions in AGENTS.md
|
|
53
|
+
merge_rnex_instructions "$NEXUS_DIR/AGENTS.md"
|
|
54
|
+
|
|
55
|
+
# 4. Sync standard skills, workflows, and provider prompts
|
|
56
|
+
sync_prompts
|
|
57
|
+
|
|
58
|
+
# 5. Reconcile Git hooks according to configuration
|
|
59
|
+
case "$GIT_HOOKS_CONFIG" in
|
|
60
|
+
false|no|0)
|
|
61
|
+
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
62
|
+
if [ "$_cur_hp" = ".rnex/hooks" ] || [ "$_cur_hp" = "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
63
|
+
cmd_hooks_uninstall_dir "$NEXUS_DIR"
|
|
64
|
+
fi
|
|
65
|
+
;;
|
|
66
|
+
true|yes|1)
|
|
67
|
+
if git -C "$NEXUS_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
68
|
+
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
69
|
+
if [ "$_cur_hp" != ".rnex/hooks" ] && [ "$_cur_hp" != "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
70
|
+
cmd_hooks_install_dir "$NEXUS_DIR"
|
|
71
|
+
elif [ "${_RNEX_INSIDE_HOOK:-0}" -ne 1 ]; then
|
|
72
|
+
_hooks_dir="$NEXUS_DIR/.rnex/hooks"
|
|
73
|
+
_create_hook_script "$_hooks_dir/post-merge" "post-merge"
|
|
74
|
+
_create_hook_script "$_hooks_dir/post-commit" "post-commit"
|
|
75
|
+
_create_hook_script "$_hooks_dir/pre-commit" "pre-commit"
|
|
76
|
+
_create_hook_script "$_hooks_dir/pre-push" "pre-push"
|
|
77
|
+
fi
|
|
78
|
+
fi
|
|
79
|
+
;;
|
|
80
|
+
*)
|
|
81
|
+
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
82
|
+
if [ "$_cur_hp" = ".rnex/hooks" ] || [ "$_cur_hp" = "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
83
|
+
if [ "${_RNEX_INSIDE_HOOK:-0}" -ne 1 ]; then
|
|
84
|
+
_hooks_dir="$NEXUS_DIR/.rnex/hooks"
|
|
85
|
+
_create_hook_script "$_hooks_dir/post-merge" "post-merge"
|
|
86
|
+
_create_hook_script "$_hooks_dir/post-commit" "post-commit"
|
|
87
|
+
_create_hook_script "$_hooks_dir/pre-commit" "pre-commit"
|
|
88
|
+
_create_hook_script "$_hooks_dir/pre-push" "pre-push"
|
|
89
|
+
fi
|
|
90
|
+
fi
|
|
91
|
+
;;
|
|
92
|
+
esac
|
|
93
|
+
|
|
94
|
+
# 6. Reconcile member repos
|
|
95
|
+
yaml_list_repos | while read -r _name; do
|
|
96
|
+
[ -n "$_name" ] || continue
|
|
97
|
+
if yaml_repo_enabled "$_name"; then
|
|
98
|
+
_rdir="$(resolve_repo_path "$_name")"
|
|
99
|
+
if [ -d "$_rdir" ]; then
|
|
100
|
+
sync_repo_rnex "$_name"
|
|
101
|
+
else
|
|
102
|
+
log_warn "Member repo '$_name' is missing on disk. Run: rnex clone"
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
# 7. Reconcile VS Code / Cursor multi-root workspace if configured
|
|
108
|
+
sync_code_workspace
|
|
109
|
+
|
|
110
|
+
if [ "$_sync_quiet" -eq 0 ]; then
|
|
111
|
+
log_ok "Sync complete — workspace, plugins, prompts, and member .rnex directories reconciled"
|
|
112
|
+
fi
|
|
113
|
+
return 0
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# --------------------------------------------------------------------------
|
|
117
|
+
# Dry-run audit mode (without --fix) — log issues or inconsistencies only
|
|
118
|
+
# --------------------------------------------------------------------------
|
|
119
|
+
[ "$_sync_quiet" -eq 0 ] && log_info "Checking workspace synchronization at $NEXUS_DIR..."
|
|
120
|
+
|
|
121
|
+
_issues=0
|
|
122
|
+
|
|
123
|
+
# 1. Configuration version check
|
|
124
|
+
_vc_res=0
|
|
125
|
+
version_cmp "$WORKSPACE_CONFIG_VERSION" "$RNEX_VERSION" || _vc_res=$?
|
|
126
|
+
if [ "$_vc_res" -eq 2 ]; then
|
|
127
|
+
log_warn "Workspace configuration version (v$WORKSPACE_CONFIG_VERSION) is older than CLI (v$RNEX_VERSION)"
|
|
128
|
+
_issues=$((_issues + 1))
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
# 2. Git ignore and search ignore checks
|
|
132
|
+
_gi="$NEXUS_DIR/.gitignore"
|
|
133
|
+
if [ ! -f "$_gi" ]; then
|
|
134
|
+
log_warn "Missing .gitignore in workspace root"
|
|
135
|
+
_issues=$((_issues + 1))
|
|
136
|
+
else
|
|
137
|
+
if ! grep -q '^\s*repos/\*' "$_gi" 2>/dev/null && ! grep -q '^repos' "$_gi" 2>/dev/null; then
|
|
138
|
+
log_warn ".gitignore missing 'repos/*'"
|
|
139
|
+
_issues=$((_issues + 1))
|
|
140
|
+
fi
|
|
141
|
+
if ! grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null; then
|
|
142
|
+
log_warn ".gitignore missing '$RNEX_LOCAL_CONFIG_FILE'"
|
|
143
|
+
_issues=$((_issues + 1))
|
|
144
|
+
fi
|
|
145
|
+
if grep -q '^\.rnex/' "$_gi" 2>/dev/null || grep -q '^\.rnex$' "$_gi" 2>/dev/null; then
|
|
146
|
+
log_warn ".gitignore contains '.rnex/' (workspace assets should be tracked in Git)"
|
|
147
|
+
_issues=$((_issues + 1))
|
|
148
|
+
fi
|
|
149
|
+
if grep -q "lint_trigger_counter" "$_gi" 2>/dev/null; then
|
|
150
|
+
log_warn ".gitignore contains legacy 'lint_trigger_counter'"
|
|
151
|
+
_issues=$((_issues + 1))
|
|
152
|
+
fi
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
_ign="$NEXUS_DIR/.ignore"
|
|
156
|
+
if [ ! -f "$_ign" ] || ! grep -q '!repos/\*' "$_ign" 2>/dev/null; then
|
|
157
|
+
log_warn ".ignore missing or missing '!repos/*' pattern (needed for code search & indexing)"
|
|
158
|
+
_issues=$((_issues + 1))
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
# 3. Universal routing instructions check
|
|
162
|
+
if [ ! -f "$NEXUS_DIR/AGENTS.md" ]; then
|
|
163
|
+
log_warn "Missing AGENTS.md routing instructions"
|
|
164
|
+
_issues=$((_issues + 1))
|
|
165
|
+
else
|
|
166
|
+
if ! grep -q "<!-- REPO-NEXUS:START -->" "$NEXUS_DIR/AGENTS.md" 2>/dev/null || \
|
|
167
|
+
! grep -q "<!-- REPO-NEXUS:END -->" "$NEXUS_DIR/AGENTS.md" 2>/dev/null; then
|
|
168
|
+
log_warn "AGENTS.md missing Repo Nexus delimited routing block"
|
|
169
|
+
_issues=$((_issues + 1))
|
|
170
|
+
fi
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# 4. Plugins check
|
|
174
|
+
for _p in $(yaml_list_plugins 2>/dev/null || true); do
|
|
175
|
+
[ -n "$_p" ] || continue
|
|
176
|
+
if yaml_plugin_enabled "$_p"; then
|
|
177
|
+
if [ ! -d "$NEXUS_DIR/.rnex/plugins/$_p" ]; then
|
|
178
|
+
log_warn "Active plugin '$_p' missing scoped directory at .rnex/plugins/$_p"
|
|
179
|
+
_issues=$((_issues + 1))
|
|
180
|
+
fi
|
|
181
|
+
else
|
|
182
|
+
if [ -d "$NEXUS_DIR/.rnex/plugins/$_p" ]; then
|
|
183
|
+
log_warn "Disabled plugin '$_p' still present at .rnex/plugins/$_p"
|
|
184
|
+
_issues=$((_issues + 1))
|
|
185
|
+
fi
|
|
186
|
+
fi
|
|
187
|
+
done
|
|
188
|
+
|
|
189
|
+
# Provider specific checks
|
|
190
|
+
if gemini_plugin_enabled; then
|
|
191
|
+
if [ ! -f "$NEXUS_DIR/GEMINI.md" ] || ! grep -q "<!-- REPO-NEXUS:START -->" "$NEXUS_DIR/GEMINI.md" 2>/dev/null; then
|
|
192
|
+
log_warn "GEMINI.md missing or not reconciled"
|
|
193
|
+
_issues=$((_issues + 1))
|
|
194
|
+
fi
|
|
195
|
+
if [ ! -f "$NEXUS_DIR/.geminiignore" ] || ! grep -q '!repos/\*' "$NEXUS_DIR/.geminiignore" 2>/dev/null; then
|
|
196
|
+
log_warn ".geminiignore missing or missing '!repos/*'"
|
|
197
|
+
_issues=$((_issues + 1))
|
|
198
|
+
fi
|
|
199
|
+
else
|
|
200
|
+
if [ -f "$NEXUS_DIR/.geminiignore" ] && grep -q '!repos/\*' "$NEXUS_DIR/.geminiignore" 2>/dev/null; then
|
|
201
|
+
log_warn ".geminiignore contains '!repos/*' but gemini plugin is disabled"
|
|
202
|
+
_issues=$((_issues + 1))
|
|
203
|
+
fi
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
if cursor_plugin_enabled; then
|
|
207
|
+
if [ ! -f "$NEXUS_DIR/.cursorrules" ] || ! grep -q "<!-- REPO-NEXUS:START -->" "$NEXUS_DIR/.cursorrules" 2>/dev/null; then
|
|
208
|
+
log_warn ".cursorrules missing or not reconciled"
|
|
209
|
+
_issues=$((_issues + 1))
|
|
210
|
+
fi
|
|
211
|
+
if [ ! -f "$NEXUS_DIR/.cursorignore" ] || ! grep -q '!repos/\*' "$NEXUS_DIR/.cursorignore" 2>/dev/null; then
|
|
212
|
+
log_warn ".cursorignore missing or missing '!repos/*'"
|
|
213
|
+
_issues=$((_issues + 1))
|
|
214
|
+
fi
|
|
215
|
+
if [ ! -f "$NEXUS_DIR/.cursor/rules/rnex-context.mdc" ]; then
|
|
216
|
+
log_warn ".cursor/rules/rnex-context.mdc missing"
|
|
217
|
+
_issues=$((_issues + 1))
|
|
218
|
+
fi
|
|
219
|
+
else
|
|
220
|
+
if [ -f "$NEXUS_DIR/.cursorignore" ] && grep -q '!repos/\*' "$NEXUS_DIR/.cursorignore" 2>/dev/null; then
|
|
221
|
+
log_warn ".cursorignore contains '!repos/*' but cursor plugin is disabled"
|
|
222
|
+
_issues=$((_issues + 1))
|
|
223
|
+
fi
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
if claude_plugin_enabled; then
|
|
227
|
+
if [ ! -f "$NEXUS_DIR/CLAUDE.md" ] || ! grep -q "<!-- REPO-NEXUS:START -->" "$NEXUS_DIR/CLAUDE.md" 2>/dev/null; then
|
|
228
|
+
log_warn "CLAUDE.md missing or not reconciled"
|
|
229
|
+
_issues=$((_issues + 1))
|
|
230
|
+
fi
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
if windsurf_plugin_enabled; then
|
|
234
|
+
if [ ! -f "$NEXUS_DIR/.windsurfrules" ] || ! grep -q "<!-- REPO-NEXUS:START -->" "$NEXUS_DIR/.windsurfrules" 2>/dev/null; then
|
|
235
|
+
log_warn ".windsurfrules missing or not reconciled"
|
|
236
|
+
_issues=$((_issues + 1))
|
|
237
|
+
fi
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
# Provider skills check (should NOT exist in provider dirs)
|
|
241
|
+
for _psk in "$NEXUS_DIR/.github/skills" "$NEXUS_DIR/.claude/skills" "$NEXUS_DIR/.gemini/skills" "$NEXUS_DIR/.cursor/skills" "$NEXUS_DIR/.windsurf/skills"; do
|
|
242
|
+
if [ -d "$_psk" ]; then
|
|
243
|
+
for _sub in "$_psk"/*; do
|
|
244
|
+
if [ -d "$_sub" ]; then
|
|
245
|
+
_aname="$(basename "$_sub")"
|
|
246
|
+
if [ "$_aname" = "rnex-cross-repo-feature" ] || [ "$_aname" = "rnex-workspace-audit" ] || [ "$_aname" = "rnex-wiki-lint" ] || [ "$_aname" = "rnex-wiki-ingest" ] || [ "$_aname" = "wiki-curator" ]; then
|
|
247
|
+
log_warn "Found obsolete provider skill directory: $_sub (skills should reside in .rnex/skills)"
|
|
248
|
+
_issues=$((_issues + 1))
|
|
249
|
+
fi
|
|
250
|
+
fi
|
|
251
|
+
done
|
|
252
|
+
fi
|
|
253
|
+
done
|
|
254
|
+
|
|
255
|
+
# 5. Skills and workflows in .rnex
|
|
256
|
+
if [ ! -d "$NEXUS_DIR/.rnex/skills" ]; then
|
|
257
|
+
log_warn "Standard workspace skills directory missing (.rnex/skills)"
|
|
258
|
+
_issues=$((_issues + 1))
|
|
259
|
+
fi
|
|
260
|
+
if [ ! -d "$NEXUS_DIR/.rnex/workflows" ]; then
|
|
261
|
+
log_warn "Standard workspace workflows directory missing (.rnex/workflows)"
|
|
262
|
+
_issues=$((_issues + 1))
|
|
263
|
+
fi
|
|
264
|
+
|
|
265
|
+
# 6. Git hooks
|
|
266
|
+
_cur_hp="$(git -C "$NEXUS_DIR" config --get core.hooksPath 2>/dev/null || true)"
|
|
267
|
+
case "$GIT_HOOKS_CONFIG" in
|
|
268
|
+
false|no|0)
|
|
269
|
+
if [ "$_cur_hp" = ".rnex/hooks" ] || [ "$_cur_hp" = "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
270
|
+
log_warn "Git hooks active in Git, but disabled in configuration (git_hooks: false)"
|
|
271
|
+
_issues=$((_issues + 1))
|
|
272
|
+
fi
|
|
273
|
+
;;
|
|
274
|
+
true|yes|1)
|
|
275
|
+
if git -C "$NEXUS_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
276
|
+
if [ "$_cur_hp" != ".rnex/hooks" ] && [ "$_cur_hp" != "$NEXUS_DIR/.rnex/hooks" ]; then
|
|
277
|
+
log_warn "Git hooks enabled in configuration (git_hooks: true), but not active in Git"
|
|
278
|
+
_issues=$((_issues + 1))
|
|
279
|
+
fi
|
|
280
|
+
fi
|
|
281
|
+
;;
|
|
282
|
+
esac
|
|
283
|
+
|
|
284
|
+
# 7. Member repositories
|
|
285
|
+
for _name in $(yaml_list_repos 2>/dev/null || true); do
|
|
286
|
+
[ -n "$_name" ] || continue
|
|
287
|
+
if yaml_repo_enabled "$_name"; then
|
|
288
|
+
_rdir="$(resolve_repo_path "$_name")"
|
|
289
|
+
if [ ! -d "$_rdir" ]; then
|
|
290
|
+
log_warn "Member repo '$_name' is missing on disk (run: rnex clone)"
|
|
291
|
+
_issues=$((_issues + 1))
|
|
292
|
+
elif [ ! -d "$_rdir/.rnex" ]; then
|
|
293
|
+
log_warn "Member repo '$_name' missing .rnex directory"
|
|
294
|
+
_issues=$((_issues + 1))
|
|
295
|
+
fi
|
|
296
|
+
fi
|
|
297
|
+
done
|
|
298
|
+
|
|
299
|
+
# 8. Multi-root workspace file
|
|
300
|
+
if [ -n "$CODE_WORKSPACE_FILE" ]; then
|
|
301
|
+
if [ ! -f "$NEXUS_DIR/$CODE_WORKSPACE_FILE" ]; then
|
|
302
|
+
log_warn "Multi-root workspace file missing ($CODE_WORKSPACE_FILE)"
|
|
303
|
+
_issues=$((_issues + 1))
|
|
304
|
+
fi
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
if [ "$_issues" -eq 0 ]; then
|
|
308
|
+
[ "$_sync_quiet" -eq 0 ] && log_ok "Workspace is synchronized — no issues or inconsistencies found."
|
|
309
|
+
return 0
|
|
310
|
+
else
|
|
311
|
+
[ "$_sync_quiet" -eq 0 ] && log_warn "Found $_issues inconsistency(ies). Run 'rnex sync --fix' to reconcile."
|
|
312
|
+
return 1
|
|
313
|
+
fi
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
cmd_fix() {
|
|
317
|
+
_fix_is_quiet=0
|
|
318
|
+
for _arg in "$@"; do
|
|
319
|
+
case "$_arg" in
|
|
320
|
+
-q|--quiet) _fix_is_quiet=1 ;;
|
|
321
|
+
esac
|
|
322
|
+
done
|
|
323
|
+
[ "$_fix_is_quiet" -eq 0 ] && log_warn "Command 'rnex fix' is deprecated and will be removed in a future release. Use 'rnex sync --fix' instead."
|
|
324
|
+
cmd_sync --fix "$@"
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
cmd_update() {
|
|
328
|
+
require_workspace
|
|
329
|
+
_cmp=0
|
|
330
|
+
version_cmp "$WORKSPACE_CONFIG_VERSION" "$RNEX_VERSION" || _cmp=$?
|
|
331
|
+
if [ "$_cmp" -eq 0 ]; then
|
|
332
|
+
log_ok "Workspace configuration and routing instructions are already up to date (v$RNEX_VERSION)"
|
|
333
|
+
elif [ "$_cmp" -eq 1 ]; then
|
|
334
|
+
log_info "Workspace configuration version (v$WORKSPACE_CONFIG_VERSION) is newer than current CLI (v$RNEX_VERSION)"
|
|
335
|
+
fi
|
|
336
|
+
cmd_sync --fix "$@"
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
cmd_upgrade() {
|
|
340
|
+
cmd_update "$@"
|
|
341
|
+
}
|
package/lib/commands/system.sh
CHANGED
|
@@ -50,8 +50,9 @@ cmd_help() {
|
|
|
50
50
|
init [-y] [--code-workspace [file]] [--hooks|--no-hooks] [--copilot] [--claude] [--gemini] [--cursor] [--windsurf] [dir]
|
|
51
51
|
Initialize a new Repo Nexus workspace (default: AGENTS.md)
|
|
52
52
|
install [dir] Install rnex & repo-nexus globally into ~/.local/bin (or custom dir)
|
|
53
|
-
fix [-y] [--quiet]
|
|
54
|
-
|
|
53
|
+
sync [--fix] [-y] [--quiet] Check workspace for inconsistencies (use --fix to reconcile workspace, upgrade configuration & routing, sync plugins & repos)
|
|
54
|
+
fix [-y] [--quiet] (Deprecated: use 'rnex sync --fix') Reconcile workspace, upgrade configuration & routing, sync plugins & repos
|
|
55
|
+
update [-y] Part of sync --fix: check version, upgrade schema, and reconcile workspace (alias: upgrade)
|
|
55
56
|
upgrade [-y] Alias for update
|
|
56
57
|
hooks <install|uninstall|status> [--local]
|
|
57
58
|
Manage automated Git hooks (--local writes to .local.rnex.yaml)
|
|
@@ -87,8 +88,9 @@ cmd_help() {
|
|
|
87
88
|
rnex enable analytics # Re-enable analytics repo
|
|
88
89
|
rnex list # List all member repos and active branches
|
|
89
90
|
rnex status # Inspect workspace configuration and health
|
|
90
|
-
rnex
|
|
91
|
-
rnex
|
|
91
|
+
rnex sync # Check workspace for inconsistencies
|
|
92
|
+
rnex sync --fix # Reconcile all repos, plugins, and .rnex directories
|
|
93
|
+
rnex update # Upgrade workspace configuration to newest version (part of sync --fix)
|
|
92
94
|
rnex hooks install # Enable automated workspace Git hooks
|
|
93
95
|
rnex completion zsh # Generate Zsh completion script
|
|
94
96
|
|
package/lib/commands.sh
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
. "$RNEX_LIB_DIR/commands/init.sh"
|
|
8
8
|
. "$RNEX_LIB_DIR/commands/repo.sh"
|
|
9
9
|
. "$RNEX_LIB_DIR/commands/status.sh"
|
|
10
|
-
. "$RNEX_LIB_DIR/commands/
|
|
10
|
+
. "$RNEX_LIB_DIR/commands/sync.sh"
|
|
11
11
|
. "$RNEX_LIB_DIR/commands/plugin.sh"
|
|
12
12
|
. "$RNEX_LIB_DIR/commands/completion.sh"
|
|
13
13
|
. "$RNEX_LIB_DIR/commands/system.sh"
|
package/lib/hooks.sh
CHANGED
|
@@ -157,7 +157,7 @@ cmd_hooks() {
|
|
|
157
157
|
require_workspace
|
|
158
158
|
case "$_hook_name" in
|
|
159
159
|
post-merge)
|
|
160
|
-
|
|
160
|
+
cmd_sync --fix -y --quiet || true
|
|
161
161
|
if yaml_plugin_enabled "karpathy-llm"; then
|
|
162
162
|
_trigger="$(yaml_plugin_get "karpathy-llm" "lint_trigger")"
|
|
163
163
|
if [ "$_trigger" = "git-post-merge" ] || [ "$_trigger" = "post-merge" ]; then
|
package/package.json
CHANGED
package/rnex
CHANGED
|
@@ -101,7 +101,8 @@ case "${1:-help}" in
|
|
|
101
101
|
hooks) shift; cmd_hooks "$@" ;;
|
|
102
102
|
update|upgrade) shift; cmd_update "$@" ;;
|
|
103
103
|
rnex-dir) shift; cmd_rnex_dir "$@" ;;
|
|
104
|
-
|
|
104
|
+
sync) shift; cmd_sync "$@" ;;
|
|
105
|
+
fix) shift; cmd_fix "$@" ;;
|
|
105
106
|
plugin) shift; cmd_plugin "$@" ;;
|
|
106
107
|
completion) shift; cmd_completion "$@" ;;
|
|
107
108
|
version|-v|--version) cmd_version ;;
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
# 2. Local Config (.local.rnex.yaml): Machine-specific (gitignored, highest priority),
|
|
9
9
|
# overrides enable/disable states, URLs, or local developer settings.
|
|
10
10
|
#
|
|
11
|
-
# Place it in your workspace root directory and run `rnex fix` to apply.
|
|
11
|
+
# Place it in your workspace root directory and run `rnex sync --fix` to apply.
|
|
12
12
|
#
|
|
13
13
|
# For more information: https://github.com/unoxen/repo-nexus
|
|
14
14
|
|
|
15
15
|
# ------------------------------------------------------------------------------
|
|
16
16
|
# version — Workspace configuration schema version
|
|
17
17
|
# ------------------------------------------------------------------------------
|
|
18
|
-
# Used by `rnex fix` and `rnex update` to safely detect and reconcile configuration
|
|
18
|
+
# Used by `rnex sync --fix` and `rnex update` to safely detect and reconcile configuration
|
|
19
19
|
# and routing instructions across CLI releases.
|
|
20
20
|
#
|
|
21
21
|
version: 0.5.0
|
|
@@ -93,7 +93,7 @@ This command:
|
|
|
93
93
|
1. Adds `karpathy-llm` to `plugins:` in `rnex.yaml`.
|
|
94
94
|
2. Copies initial templates (`wiki/index.md`, `wiki/_log.md`, `wiki/hot.md`, `raw/.gitkeep`, `.rnex/templates/wiki-page.template.md`, `.rnex/templates/LLM_WIKI.sample.md`).
|
|
95
95
|
3. Scopes `rules/`, `instructions/`, and `workflows/` into `.rnex/plugins/karpathy-llm/`.
|
|
96
|
-
4. Syncs scope links and AI context files across all registered member repositories via `rnex fix`.
|
|
96
|
+
4. Syncs scope links and AI context files across all registered member repositories via `rnex sync --fix`.
|
|
97
97
|
|
|
98
98
|
### Option 2: Declarative in `rnex.yaml`
|
|
99
99
|
|
|
@@ -107,7 +107,7 @@ plugins:
|
|
|
107
107
|
Then reconcile and fix:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
rnex fix
|
|
110
|
+
rnex sync --fix
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
---
|
|
@@ -26,7 +26,7 @@ Use this prompt to audit workspace configuration integrity, member repository gi
|
|
|
26
26
|
## 3. Reconciliation & Remediation
|
|
27
27
|
1. If any configuration issues, missing directories, or unlinked plugin assets are detected, run:
|
|
28
28
|
```sh
|
|
29
|
-
rnex fix
|
|
29
|
+
rnex sync --fix
|
|
30
30
|
```
|
|
31
31
|
2. If member repositories declared in `rnex.yaml` are missing on disk, run:
|
|
32
32
|
```sh
|
|
@@ -10,4 +10,4 @@ Use this skill when auditing workspace health, validating multi-repository git s
|
|
|
10
10
|
## Key Rules
|
|
11
11
|
1. **Health Audit**: Run `rnex status` to inspect configuration, AGENTS.md, code-workspace, gitignore, hooks, and active plugins.
|
|
12
12
|
2. **Git Status Audit**: Check working tree cleanliness across member repos (`rnex exec git status -s`) and branch tracking (`rnex exec git status -uno`).
|
|
13
|
-
3. **Reconciliation**: Run `rnex fix` for configuration and asset reconciliation; run `rnex clone` for missing member repository clones.
|
|
13
|
+
3. **Reconciliation**: Run `rnex sync --fix` for configuration and asset reconciliation (or `rnex sync` to audit inconsistencies); run `rnex clone` for missing member repository clones.
|
|
@@ -26,7 +26,7 @@ Use this workflow to audit workspace configuration integrity, member repository
|
|
|
26
26
|
## 3. Reconciliation & Remediation
|
|
27
27
|
1. If any configuration issues, missing directories, or unlinked plugin assets are detected, run:
|
|
28
28
|
```sh
|
|
29
|
-
rnex fix
|
|
29
|
+
rnex sync --fix
|
|
30
30
|
```
|
|
31
31
|
2. If member repositories declared in `rnex.yaml` are missing on disk, run:
|
|
32
32
|
```sh
|