Skip to content

Apply the module prefix rule to the link-skills modules - #37

Open
chapati23 wants to merge 1 commit into
chore/split-06-install-hooks-finalfrom
chore/split-07-rename
Open

chapati23 wants to merge 1 commit into
chore/split-06-install-hooks-finalfrom
chore/split-07-rename

Conversation

@chapati23

@chapati23 chapati23 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

tl;dr

Every helper inside the skill installer now carries the name of the file it
lives in, so a reader can tell at a glance where a function comes from, and a
private helper is marked as private. What the installer does is unchanged.
Nothing changes for you.

The Problem

  • The modules split out of the installer in the earlier layers kept their old
    flat names, so a call gave no hint which file defined it.
  • The repository rule says a module's public functions carry the module name as
    a prefix and its private helpers start with _. The modules did not follow it.
  • Some names misled: output_has lived in the manifest module and
    runtime_link was private to the runtime module.

The Solution

  • Rename 116 functions to <module>_<name> when they are called from another
    file and _<module>_<name> when they are called only inside their own file.
  • 18 names already satisfied the rule and keep their spelling. The entry point
    keeps main, its helpers and boot_fail.
  • Update the module headers and test comments that name a renamed function, and
    rewrap comment lines that a longer name pushed past 80 columns.
  • No function body, local declaration, control flow or indentation changed.
  • Stacked on chore/split-06-install-hooks-final. Merge only the bottom layer
    of the stack.

Validation

Head 61fcd0a. Gates: scripts/test-link-skills.sh 152 passed / 0 failed / 0
skipped ✓, the same harness under /bin/bash 3.2 152 ✓, shellcheck over every
tracked .sh ✓, pnpm check:shell against the base branch ✓, trunk fmt on
the 23 changed files ✓.
This layer was rebased onto the parent's new head 5ef74f3, with the conflicts
in scripts/lib/link-skills/unlink.sh and scripts/link-skills.sh resolved in
favour of the parent's logic under this layer's names, and every gate above
re-run at the new head.
Review: full diff read against the base, plus a scan for every retired name in
command position across scripts/ → 0 stale calls, 0 findings.
Security: not run. The change renames functions in a local script and adds no
input, network or privilege surface.
Not run: browser verification. There is no UI.

Deferrals

None. scripts/tests/link-skills/link-install.sh line 4 names four functions
that no longer exist anywhere. That comment was already stale before this layer
and fixing it here would widen a rename-only diff.

🤖 Generated with Claude Code

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9bc1cf92-71c0-46fa-ad72-268bc93ecfdc

📥 Commits

Reviewing files that changed from the base of the PR and between 907975c and d2e37ff.

📒 Files selected for processing (23)
  • scripts/lib/link-skills/candidates.sh
  • scripts/lib/link-skills/check.sh
  • scripts/lib/link-skills/config.sh
  • scripts/lib/link-skills/git.sh
  • scripts/lib/link-skills/hook.sh
  • scripts/lib/link-skills/install-hooks.sh
  • scripts/lib/link-skills/link.sh
  • scripts/lib/link-skills/lock.sh
  • scripts/lib/link-skills/manifest.sh
  • scripts/lib/link-skills/names.sh
  • scripts/lib/link-skills/output.sh
  • scripts/lib/link-skills/paths.sh
  • scripts/lib/link-skills/runtime.sh
  • scripts/lib/link-skills/sources.sh
  • scripts/lib/link-skills/unlink.sh
  • scripts/link-skills.sh
  • scripts/tests/link-skills/check.sh
  • scripts/tests/link-skills/hook-notice.sh
  • scripts/tests/link-skills/install-hooks-settings.sh
  • scripts/tests/link-skills/link-install.sh
  • scripts/tests/link-skills/paths.sh
  • scripts/tests/link-skills/sources-entries.sh
  • scripts/tests/link-skills/sources-file.sh

Included review availability: 3 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: auto-review
  • GitHub Check: Validate and test skills (macos-latest)
🧰 Additional context used
🪛 ast-grep (0.45.3)
scripts/tests/link-skills/install-hooks-settings.sh

[error] 191-191: eval is invoked on a variable, parameter expansion, or command-substitution result, which re-parses the value as shell code. If any part of that value is attacker-controlled (arguments, environment, file contents, network output), it allows arbitrary command execution. Do not eval dynamic data: invoke the command directly with proper quoting (e.g. "$cmd" "$arg"), use arrays for argument lists (cmd=(prog --flag "$value"); "${cmd[@]}"), or restrict input to a validated allowlist before running it.
Context: eval "$text"
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(eval-on-variable-bash)

🔇 Additional comments (12)
scripts/lib/link-skills/names.sh (1)

8-10: LGTM!

Also applies to: 14-14, 25-25, 32-32, 39-39, 68-68

scripts/lib/link-skills/output.sh (1)

7-9: LGTM!

Also applies to: 11-12, 14-14, 20-20, 26-26, 35-35, 37-37, 44-44, 51-54, 57-57, 86-86, 110-110

scripts/lib/link-skills/paths.sh (1)

9-9: LGTM!

Also applies to: 12-13, 17-17, 35-35, 37-37, 39-39, 42-42, 47-47, 59-59, 85-87, 120-120, 144-144, 170-170, 209-210, 222-222, 233-233, 236-239, 266-266, 279-281, 315-315, 322-322, 325-325, 335-335, 351-351, 358-358, 362-362, 369-369

scripts/lib/link-skills/candidates.sh (1)

16-17: LGTM!

Also applies to: 25-25, 40-40, 54-54, 70-70, 75-76, 82-82, 107-108, 117-117, 121-121, 128-128, 134-134, 145-145, 159-160, 178-180, 196-196, 210-211, 219-219, 237-237, 258-258, 266-266, 289-289, 307-307, 318-318, 323-323, 331-331, 340-340, 343-343, 350-350, 360-360, 363-363

scripts/lib/link-skills/sources.sh (1)

8-10: LGTM!

Also applies to: 12-13, 16-16, 40-40, 62-62, 73-73, 85-85, 99-99, 105-105, 109-109, 116-116, 124-124, 131-131, 135-135, 140-140, 150-150, 160-160, 168-168, 175-175, 183-183, 211-211, 216-216

scripts/lib/link-skills/manifest.sh (1)

17-20: LGTM!

Also applies to: 26-26, 52-53, 95-95, 105-105, 109-109, 118-118, 122-122, 135-135, 141-141, 152-152, 157-157, 166-166, 176-176, 184-184, 194-194, 204-204, 215-215, 218-218, 223-223, 231-231, 242-242, 245-246, 250-250, 257-257, 266-266, 278-278, 282-282, 289-289, 294-294

scripts/lib/link-skills/link.sh (1)

5-5: LGTM!

Also applies to: 13-16, 23-23, 25-25, 40-45, 47-47, 81-81, 85-85, 93-94, 97-97, 112-113, 116-117, 120-121, 124-125, 139-141, 154-154, 159-159, 161-161, 177-179, 184-184, 193-195, 197-197, 200-202, 211-211, 215-215, 218-221, 227-227, 235-235, 242-242, 245-245, 250-250, 253-254, 258-258, 265-265, 270-272, 277-278, 282-283, 291-291, 296-299, 301-302, 305-305, 310-310, 312-313, 317-317, 319-320, 327-327

scripts/lib/link-skills/runtime.sh (1)

13-18: LGTM!

Also applies to: 20-20, 26-26, 31-32, 35-35, 39-40, 42-42, 46-46, 49-49, 52-52, 56-56, 60-60, 63-63, 66-68, 71-71, 77-77, 89-89, 106-106, 112-112, 121-121, 124-124, 126-126, 136-137, 139-139, 142-142, 145-145, 148-151, 163-163, 167-168, 171-171, 177-177, 180-180, 182-182, 186-186, 193-195, 201-201, 205-206, 209-209, 214-214, 220-223, 232-234

scripts/lib/link-skills/config.sh (1)

16-17: LGTM!

Also applies to: 25-26, 39-41, 43-43, 46-47, 50-50, 60-61, 69-71, 74-75, 78-78, 84-85, 102-102, 105-105, 114-118, 120-120, 123-125, 129-129

scripts/lib/link-skills/check.sh (1)

10-11: LGTM!

Also applies to: 13-16, 18-18, 22-22, 27-29, 32-32, 36-36, 39-39, 42-42, 46-46, 53-53, 56-57, 60-60, 62-65, 67-74, 83-83, 90-90, 96-97, 106-106, 118-120, 131-131, 133-133, 137-139, 144-146, 158-158, 161-161, 172-174, 182-182, 185-186, 191-191, 198-198, 201-201, 207-207, 215-215, 222-223, 230-230, 232-232, 238-240, 256-256, 260-260, 264-265

scripts/tests/link-skills/sources-entries.sh (1)

5-7: LGTM!

scripts/tests/link-skills/sources-file.sh (1)

5-7: LGTM!


📝 Walkthrough

Walkthrough

The pull request renames link-skills helpers into domain-specific namespaces. It updates command dispatch, diagnostics, path calls, manifest handling, locking, linking, hooks, installation, unlinking, and test references. Reported behavior remains unchanged.

Changes

Link-skills namespace migration

Layer / File(s) Summary
Shared helper namespaces
scripts/lib/link-skills/names.sh, scripts/lib/link-skills/output.sh, scripts/lib/link-skills/paths.sh, scripts/lib/link-skills/lock.sh
Helpers now use names_*, output_*, paths_*, and internal _lock_* identifiers.
Source, candidate, manifest, and runtime flows
scripts/lib/link-skills/candidates.sh, scripts/lib/link-skills/sources.sh, scripts/lib/link-skills/manifest.sh, scripts/lib/link-skills/link.sh, scripts/lib/link-skills/runtime.sh
Internal functions and cross-module calls use the renamed APIs. Existing validation, linking, rollback, preservation, and reporting behavior remains unchanged.
Commands and integrations
scripts/lib/link-skills/check.sh, scripts/lib/link-skills/config.sh, scripts/lib/link-skills/git.sh, scripts/lib/link-skills/hook.sh, scripts/lib/link-skills/install-hooks.sh, scripts/lib/link-skills/unlink.sh
Command helpers and integration paths use the renamed namespaces and output functions.
Entrypoint and test references
scripts/link-skills.sh, scripts/tests/link-skills/*
Command dispatch and lock handling use renamed entry points. Test descriptions and helper lookups reference the current identifiers.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to d2e37

The installer’s namespace migration has no identified behavior regression and is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 81.70% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 153 functions across 23 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: applying module-prefix naming to the link-skills modules.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown

Claude finished @chapati23's task in 2m 23s —— View job


Review in progress

  • Gather context (diff against origin/chore/split-06-install-hooks-final)
  • Review renamed functions for consistency with AGENTS.md module-prefix rule
  • Check for stale/missed call sites of renamed functions
  • Check bash 3.2 compatibility / shellcheck implications (local shellcheck/test run not permitted in this sandbox — relying on CI)
  • Post inline findings
  • Post final summary

@chapati23
chapati23 added this pull request to stack #38 September 18, 2026 17:48
@chapati23

Copy link
Copy Markdown
Contributor Author

@claude review

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown

Claude finished @chapati23's task in 4m 22s —— View job


Review complete

  • Gather context (diff against origin/chore/split-06-install-hooks-final)
  • Review renamed functions for consistency with AGENTS.md module-prefix rule
  • Check for stale/missed call sites of renamed functions
  • Check bash 3.2 compatibility / shellcheck implications (local shellcheck/test run not permitted in this sandbox — relying on CI)
  • Post inline findings
  • Post final summary

Verdict: LGTM

This is a clean, mechanical rename with no behavior changes. Method used: extracted every function definition from both the base (907975c) and head (d2e37ff) trees (156 functions each, same count on both sides — nothing added or removed), paired them by file/position, and grepped the whole scripts/ tree for every leading-underscore (private) name to confirm none of them is referenced outside its defining file. Also read the full diff top to bottom.

Findings roll-up:

  1. No correctness issues found. Every private (_module_name) function is called only within its own file; every public (module_name) function I spot-checked is genuinely called cross-file. The hook/check/link/unlink/install-hooks dispatch table in scripts/link-skills.sh:358-385 (runtime_cmd_link, check_cmd, hook_run_bounded, install_hooks_cmd, unlink_cmd) all resolve correctly to the renamed public entry points, and each command's now-private internal helper (e.g. _hook_cmd, _runtime_run_link) is called only from within its own module — consistent with the stated rule that a name gets _ only when it's called solely inside its own file.
  2. scripts/tests/link-skills/install-hooks-settings.sh:188/192 still evals a function body sourced from the real source file (_install_hooks_backup_path, renamed from backup_path). CodeRabbit's ast-grep flagged this as CWE-78, but diffing against the base branch shows the eval itself predates this PR — this layer only renamed the identifier inside it. Not a new issue and out of scope for a rename-only diff.
  3. The PR body's disclosed deferral checks out: scripts/tests/link-skills/link-install.sh:3-5 still names four functions (link_one, link_all, ensure_assembly, adopt_runtime) that don't exist anywhere in the tree. Confirmed pre-existing (already stale before 907975c), not introduced by this layer.
  4. Comment rewraps (git.sh, runtime.sh, unlink.sh, sources-entries.sh — the four files with a +1 net line count) are wrapping-only; no logic changed. One unrelated pre-existing line over 80 cols in candidates.sh:68 predates this PR (from 907975c) and contains no renamed identifier, so out of scope here.

No inline comments filed — nothing rose to an actionable finding. I could not run shellcheck or scripts/test-link-skills.sh in this sandbox (tool execution is restricted here); the PR description reports both green, and CI will confirm.

AGENTS.md asks a module's public functions to carry the module name as a
prefix, and its private helpers to start with an underscore. The link-skills
modules kept the names the single-file script gave them, so a call site said
nothing about which module owns the work.

Rename every function defined under scripts/lib/link-skills/. A function that
another module or the entry point calls becomes <module>_<name>: take_lock to
lock_take, release_lock to lock_release, cmd_check to check_cmd, err to
output_err, canonical_path to paths_canonical, remove_link to link_remove,
cmd_unlink to unlink_cmd, cmd_install_hooks to install_hooks_cmd. A function
only its own module calls becomes _<module>_<name>: cmd_hook to _hook_cmd,
run_link to _runtime_run_link, stamp_file to _git_stamp_file, backup_path to
_install_hooks_backup_path. A name that already satisfied the rule keeps it:
git_root, git_branch, git_is_dirty, git_default_branch, git_pull_command,
git_behind_count, names_equal, manifest_src_of, manifest_target_of,
manifest_path_usable, link_candidates, runtime_link_path, sources_path_usable,
sources_is_control_path and the four config_ functions. The entry point's own
functions are not module functions and keep their names: main, main_*,
boot_fail, script_abs_path and resolve_symlink_path.

Nothing moves between files and no body changes apart from the names. Module
headers, the comments that name a function, and the harness comments follow
the new names. Long header lines are rewrapped where a longer name pushed
them past the column the file already used.

The install-hooks settings case reads the backup function out of the module by
name, so its sed and its messages name _install_hooks_backup_path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant