Skip to content

Add a script to install superpowers on Codex#623

Open
VinyLimaZ wants to merge 1 commit intoobra:mainfrom
VinyLimaZ:add-install-script-for-codex
Open

Add a script to install superpowers on Codex#623
VinyLimaZ wants to merge 1 commit intoobra:mainfrom
VinyLimaZ:add-install-script-for-codex

Conversation

@VinyLimaZ
Copy link

That PR add a script to install superpowers on Codex;
Add information about the script inside docs/README.codex.md and .codex/INSTALL.md

Motivation and Context

Testing the Superpowers I created that bash/powershell script to install it on Codex;

How Has This Been Tested?

I did a manual test of all options, it's a simple script.
The powershell part was tested on a Mac using the pwsh app.

Breaking Changes

Nothing will break because of this file;

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

A new Bash installation management script is introduced to handle Codex installation, updates, migration, and removal with platform detection. Documentation and README files are updated to reflect the new scripted installation workflow.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md, docs/README.codex.md
Reformatted installation instructions and added documentation for the new codex/install.sh script, detailing its commands and platform-specific behavior.
Installation Script
codex/install.sh
New comprehensive Bash CLI for managing Codex installation, updates, migration, and removal. Includes platform detection (POSIX/Windows PowerShell), prerequisite validation, health checks, repository management, symlink handling, and command-line interface with install/update/migrate/remove/doctor operations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 A script to install, update, and care,
With symlinks and checks everywhere,
No more manual fuss and delay,
Just run the script and have your way! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add a script to install superpowers on Codex' directly summarizes the main change: introducing a new installation script for Codex.
Description check ✅ Passed The description explains the script's purpose, testing approach, and documentation updates, all of which align with the changeset's core changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@codex/install.sh`:
- Around line 83-96: The remove command is routed through health_check which
calls ensure_git and ensure_skills_link_dir and thus can block or mutate state
during cleanup; change remove to bypass those install-time checks by either (a)
adding a new minimal function (e.g., health_check_no_side_effects) that only
validates $HOME_DIR existence/permissions and the PowerShell check, or (b) add a
flag to health_check to skip ensure_git and ensure_skills_link_dir when invoked
from remove; update the remove invocation to use the new minimal check so remove
does not call ensure_git or ensure_skills_link_dir and therefore does not create
~/.agents/skills or require git.
- Around line 98-156: The doctor function currently skips verifying that
SKILLS_LINK_DIR exists and actually points to REPO_SKILLS_DIR; add a check after
the existing SKILLS_LINK_DIR branch to validate the link target: if
SKILLS_LINK_DIR exists and is a symlink (test -L), resolve its target (readlink
-f or realpath) and compare to REPO_SKILLS_DIR, using check_condition to report
success/failure (or mark failures=1) when the link is missing, not a symlink, or
points elsewhere; reference the doctor function, SKILLS_LINK_DIR,
REPO_SKILLS_DIR and check_condition to locate where to insert this validation.
- Around line 195-200: Windows link creation using New-Item -ItemType
SymbolicLink can fail without admin/DevMode; update the IS_WINDOWS branch to try
the symbolic link via run_powershell first and if that command fails fall back
to creating a directory junction (since REPO_SKILLS_DIR is always a directory).
Use ps_escape on REPO_SKILLS_DIR and LINK_PATH as already done, run
run_powershell "New-Item -ItemType SymbolicLink ..." and check its exit/status,
and on non-zero failure invoke run_powershell or cmd to create a Junction
(New-Item -ItemType Junction or mklink /J) and log/info about the fallback;
ensure the logic references IS_WINDOWS, REPO_SKILLS_DIR, LINK_PATH and
run_powershell so the fallback is applied only for directory links on Windows.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c9b62019-e24a-4e0e-bf62-c256ba5440d3

📥 Commits

Reviewing files that changed from the base of the PR and between e4a2375 and 2304d66.

📒 Files selected for processing (3)
  • README.md
  • codex/install.sh
  • docs/README.codex.md

Comment on lines +83 to +96
health_check() {
if [ ! -d "$HOME_DIR" ]; then
fatal "home directory $HOME_DIR does not exist."
fi
if [ ! -w "$HOME_DIR" ]; then
fatal "no write permission for $HOME_DIR."
fi
ensure_git
ensure_skills_link_dir
if [ $IS_WINDOWS -eq 1 ] && [ ${#PWSH_BIN[@]} -eq 0 ]; then
fatal "PowerShell is required on Windows."
fi
info "Health check passed."
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

remove is gated by install-time checks and has side effects.

Line 292 routes remove through health_check, which currently requires git (Line 90) and creates ~/.agents/skills (Line 91). That can block or mutate a cleanup-only command.

Suggested fix
+health_check_install_like() {
+  if [ ! -d "$HOME_DIR" ]; then
+    fatal "home directory $HOME_DIR does not exist."
+  fi
+  if [ ! -w "$HOME_DIR" ]; then
+    fatal "no write permission for $HOME_DIR."
+  fi
+  ensure_git
+  ensure_skills_link_dir
+  if [ $IS_WINDOWS -eq 1 ] && [ ${`#PWSH_BIN`[@]} -eq 0 ]; then
+    fatal "PowerShell is required on Windows."
+  fi
+}
+
+health_check_remove() {
+  if [ ! -d "$HOME_DIR" ]; then
+    fatal "home directory $HOME_DIR does not exist."
+  fi
+  if [ ! -w "$HOME_DIR" ]; then
+    fatal "no write permission for $HOME_DIR."
+  fi
+}
+
 health_check() {
-  if [ ! -d "$HOME_DIR" ]; then
-    fatal "home directory $HOME_DIR does not exist."
-  fi
-  if [ ! -w "$HOME_DIR" ]; then
-    fatal "no write permission for $HOME_DIR."
-  fi
-  ensure_git
-  ensure_skills_link_dir
-  if [ $IS_WINDOWS -eq 1 ] && [ ${`#PWSH_BIN`[@]} -eq 0 ]; then
-    fatal "PowerShell is required on Windows."
-  fi
+  health_check_install_like
   info "Health check passed."
 }
@@
     remove)
-      health_check
+      health_check_remove
       run_remove
       ;;

Also applies to: 291-294

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@codex/install.sh` around lines 83 - 96, The remove command is routed through
health_check which calls ensure_git and ensure_skills_link_dir and thus can
block or mutate state during cleanup; change remove to bypass those install-time
checks by either (a) adding a new minimal function (e.g.,
health_check_no_side_effects) that only validates $HOME_DIR
existence/permissions and the PowerShell check, or (b) add a flag to
health_check to skip ensure_git and ensure_skills_link_dir when invoked from
remove; update the remove invocation to use the new minimal check so remove does
not call ensure_git or ensure_skills_link_dir and therefore does not create
~/.agents/skills or require git.

Comment on lines +98 to +156
doctor() {
info "Doctor mode: verifying prerequisites for install/update/migrate/remove."
local failures=0
check_condition "Home directory $HOME_DIR exists (required by all commands)" test -d "$HOME_DIR" || failures=1
check_condition "Home directory writable (needed to clone/pull and create links)" test -w "$HOME_DIR" || failures=1
check_condition "Git command available (install/update/migrate)" command_exists git || failures=1
local parent_dir
parent_dir=$(dirname "$SKILLS_LINK_DIR")
if [ -d "$SKILLS_LINK_DIR" ]; then
check_condition "Skills directory $SKILLS_LINK_DIR writable (link target)" test -w "$SKILLS_LINK_DIR" || failures=1
else
if [ -d "$parent_dir" ]; then
check_condition "Skills parent directory $parent_dir writable (needed to create link dir)" test -w "$parent_dir" || failures=1
else
local grandparent
grandparent=$(dirname "$parent_dir")
if [ -w "$grandparent" ]; then
printf " [INFO] Directory $parent_dir missing; grandparent $grandparent is writable and can host it.\n"
else
printf " [FAIL] Cannot create $SKILLS_LINK_DIR; grandparent $grandparent is not writable.\n"
failures=1
fi
fi
fi
if [ $IS_WINDOWS -eq 1 ]; then
if command_exists pwsh; then
check_condition "pwsh available (Windows linking)" command_exists pwsh || failures=1
elif command_exists powershell; then
check_condition "powershell available (Windows linking)" command_exists powershell || failures=1
else
printf " [FAIL] PowerShell (pwsh/powershell) missing; Windows linking cannot work.\n"
failures=1
fi
fi

if [ -d "$REPO_DIR/.git" ]; then
check_condition "Superpowers repo clone exists at $REPO_DIR" test -d "$REPO_DIR/.git" || failures=1
else
printf " [INFO] Superpowers repo not cloned yet; install will create $REPO_DIR.\n"
fi

local agents_file="$HOME_DIR/.codex/AGENTS.md"
if [ -f "$agents_file" ]; then
if grep -q "superpowers-codex bootstrap" "$agents_file"; then
printf " [FAIL] %s still references the legacy bootstrap block; remove it.\n" "$agents_file"
failures=1
else
printf " [OK] %s contains no legacy bootstrap block.\n" "$agents_file"
fi
else
printf " [INFO] %s not present; no legacy bootstrap block to remove.\n" "$agents_file"
fi

if [ $failures -ne 0 ]; then
error "Doctor found missing prerequisites. Fix the failures above before rerunning."
exit 1
fi
info "Doctor check passed."
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

doctor does not verify the actual skills link state.

doctor reports environment readiness, but it never checks whether ~/.agents/skills/superpowers exists and points to $REPO_SKILLS_DIR. A broken/misdirected link currently passes.

Suggested fix
   if [ -d "$REPO_DIR/.git" ]; then
     check_condition "Superpowers repo clone exists at $REPO_DIR" test -d "$REPO_DIR/.git" || failures=1
   else
     printf "  [INFO] Superpowers repo not cloned yet; install will create $REPO_DIR.\n"
   fi
+
+  if [ -L "$LINK_PATH" ]; then
+    if [ $IS_WINDOWS -eq 1 ]; then
+      local link_path_ps
+      local target_ps
+      link_path_ps=$(ps_escape "$LINK_PATH")
+      target_ps=$(ps_escape "$REPO_SKILLS_DIR")
+      if run_powershell "\$i=Get-Item -LiteralPath '$link_path_ps' -ErrorAction SilentlyContinue; if (\$null -eq \$i) { exit 1 }; if (\$i.Target -eq '$target_ps') { exit 0 } else { exit 1 }"; then
+        printf "  [OK] Skills link exists and points to %s.\n" "$REPO_SKILLS_DIR"
+      else
+        printf "  [FAIL] Skills link exists but does not point to %s.\n" "$REPO_SKILLS_DIR"
+        failures=1
+      fi
+    else
+      if [ "$(readlink "$LINK_PATH")" = "$REPO_SKILLS_DIR" ]; then
+        printf "  [OK] Skills link exists and points to %s.\n" "$REPO_SKILLS_DIR"
+      else
+        printf "  [FAIL] Skills link exists but does not point to %s.\n" "$REPO_SKILLS_DIR"
+        failures=1
+      fi
+    fi
+  else
+    printf "  [INFO] Skills link %s is not present yet; install will create it.\n" "$LINK_PATH"
+  fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
doctor() {
info "Doctor mode: verifying prerequisites for install/update/migrate/remove."
local failures=0
check_condition "Home directory $HOME_DIR exists (required by all commands)" test -d "$HOME_DIR" || failures=1
check_condition "Home directory writable (needed to clone/pull and create links)" test -w "$HOME_DIR" || failures=1
check_condition "Git command available (install/update/migrate)" command_exists git || failures=1
local parent_dir
parent_dir=$(dirname "$SKILLS_LINK_DIR")
if [ -d "$SKILLS_LINK_DIR" ]; then
check_condition "Skills directory $SKILLS_LINK_DIR writable (link target)" test -w "$SKILLS_LINK_DIR" || failures=1
else
if [ -d "$parent_dir" ]; then
check_condition "Skills parent directory $parent_dir writable (needed to create link dir)" test -w "$parent_dir" || failures=1
else
local grandparent
grandparent=$(dirname "$parent_dir")
if [ -w "$grandparent" ]; then
printf " [INFO] Directory $parent_dir missing; grandparent $grandparent is writable and can host it.\n"
else
printf " [FAIL] Cannot create $SKILLS_LINK_DIR; grandparent $grandparent is not writable.\n"
failures=1
fi
fi
fi
if [ $IS_WINDOWS -eq 1 ]; then
if command_exists pwsh; then
check_condition "pwsh available (Windows linking)" command_exists pwsh || failures=1
elif command_exists powershell; then
check_condition "powershell available (Windows linking)" command_exists powershell || failures=1
else
printf " [FAIL] PowerShell (pwsh/powershell) missing; Windows linking cannot work.\n"
failures=1
fi
fi
if [ -d "$REPO_DIR/.git" ]; then
check_condition "Superpowers repo clone exists at $REPO_DIR" test -d "$REPO_DIR/.git" || failures=1
else
printf " [INFO] Superpowers repo not cloned yet; install will create $REPO_DIR.\n"
fi
local agents_file="$HOME_DIR/.codex/AGENTS.md"
if [ -f "$agents_file" ]; then
if grep -q "superpowers-codex bootstrap" "$agents_file"; then
printf " [FAIL] %s still references the legacy bootstrap block; remove it.\n" "$agents_file"
failures=1
else
printf " [OK] %s contains no legacy bootstrap block.\n" "$agents_file"
fi
else
printf " [INFO] %s not present; no legacy bootstrap block to remove.\n" "$agents_file"
fi
if [ $failures -ne 0 ]; then
error "Doctor found missing prerequisites. Fix the failures above before rerunning."
exit 1
fi
info "Doctor check passed."
}
doctor() {
info "Doctor mode: verifying prerequisites for install/update/migrate/remove."
local failures=0
check_condition "Home directory $HOME_DIR exists (required by all commands)" test -d "$HOME_DIR" || failures=1
check_condition "Home directory writable (needed to clone/pull and create links)" test -w "$HOME_DIR" || failures=1
check_condition "Git command available (install/update/migrate)" command_exists git || failures=1
local parent_dir
parent_dir=$(dirname "$SKILLS_LINK_DIR")
if [ -d "$SKILLS_LINK_DIR" ]; then
check_condition "Skills directory $SKILLS_LINK_DIR writable (link target)" test -w "$SKILLS_LINK_DIR" || failures=1
else
if [ -d "$parent_dir" ]; then
check_condition "Skills parent directory $parent_dir writable (needed to create link dir)" test -w "$parent_dir" || failures=1
else
local grandparent
grandparent=$(dirname "$parent_dir")
if [ -w "$grandparent" ]; then
printf " [INFO] Directory $parent_dir missing; grandparent $grandparent is writable and can host it.\n"
else
printf " [FAIL] Cannot create $SKILLS_LINK_DIR; grandparent $grandparent is not writable.\n"
failures=1
fi
fi
fi
if [ $IS_WINDOWS -eq 1 ]; then
if command_exists pwsh; then
check_condition "pwsh available (Windows linking)" command_exists pwsh || failures=1
elif command_exists powershell; then
check_condition "powershell available (Windows linking)" command_exists powershell || failures=1
else
printf " [FAIL] PowerShell (pwsh/powershell) missing; Windows linking cannot work.\n"
failures=1
fi
fi
if [ -d "$REPO_DIR/.git" ]; then
check_condition "Superpowers repo clone exists at $REPO_DIR" test -d "$REPO_DIR/.git" || failures=1
else
printf " [INFO] Superpowers repo not cloned yet; install will create $REPO_DIR.\n"
fi
if [ -L "$LINK_PATH" ]; then
if [ $IS_WINDOWS -eq 1 ]; then
local link_path_ps
local target_ps
link_path_ps=$(ps_escape "$LINK_PATH")
target_ps=$(ps_escape "$REPO_SKILLS_DIR")
if run_powershell "\$i=Get-Item -LiteralPath '$link_path_ps' -ErrorAction SilentlyContinue; if (\$null -eq \$i) { exit 1 }; if (\$i.Target -eq '$target_ps') { exit 0 } else { exit 1 }"; then
printf " [OK] Skills link exists and points to %s.\n" "$REPO_SKILLS_DIR"
else
printf " [FAIL] Skills link exists but does not point to %s.\n" "$REPO_SKILLS_DIR"
failures=1
fi
else
if [ "$(readlink "$LINK_PATH")" = "$REPO_SKILLS_DIR" ]; then
printf " [OK] Skills link exists and points to %s.\n" "$REPO_SKILLS_DIR"
else
printf " [FAIL] Skills link exists but does not point to %s.\n" "$REPO_SKILLS_DIR"
failures=1
fi
fi
else
printf " [INFO] Skills link %s is not present yet; install will create it.\n" "$LINK_PATH"
fi
local agents_file="$HOME_DIR/.codex/AGENTS.md"
if [ -f "$agents_file" ]; then
if grep -q "superpowers-codex bootstrap" "$agents_file"; then
printf " [FAIL] %s still references the legacy bootstrap block; remove it.\n" "$agents_file"
failures=1
else
printf " [OK] %s contains no legacy bootstrap block.\n" "$agents_file"
fi
else
printf " [INFO] %s not present; no legacy bootstrap block to remove.\n" "$agents_file"
fi
if [ $failures -ne 0 ]; then
error "Doctor found missing prerequisites. Fix the failures above before rerunning."
exit 1
fi
info "Doctor check passed."
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@codex/install.sh` around lines 98 - 156, The doctor function currently skips
verifying that SKILLS_LINK_DIR exists and actually points to REPO_SKILLS_DIR;
add a check after the existing SKILLS_LINK_DIR branch to validate the link
target: if SKILLS_LINK_DIR exists and is a symlink (test -L), resolve its target
(readlink -f or realpath) and compare to REPO_SKILLS_DIR, using check_condition
to report success/failure (or mark failures=1) when the link is missing, not a
symlink, or points elsewhere; reference the doctor function, SKILLS_LINK_DIR,
REPO_SKILLS_DIR and check_condition to locate where to insert this validation.

Comment on lines +195 to +200
if [ $IS_WINDOWS -eq 1 ]; then
local target="$(ps_escape "$REPO_SKILLS_DIR")"
local link_path="$(ps_escape "$LINK_PATH")"
info "Creating PowerShell symbolic link from $LINK_PATH to $REPO_SKILLS_DIR..."
run_powershell "New-Item -ItemType SymbolicLink -Path '$link_path' -Target '$target' -Force | Out-Null"
else
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "install.sh" -type f | head -20

Repository: obra/superpowers

Length of output: 78


🏁 Script executed:

git ls-files | grep -E "(install\.sh|codex)" | head -20

Repository: obra/superpowers

Length of output: 115


🌐 Web query:

PowerShell New-Item SymbolicLink vs Junction Windows 10 11 admin privileges requirements

💡 Result:

PowerShell New-Item: SymbolicLink vs Junction — admin / privilege requirements (Windows 10/11)

SymbolicLink (New-Item -ItemType SymbolicLink)

  • Requires elevation (Run as Administrator) by default on Windows. [1] (learn.microsoft.com)
  • Does not require elevation if Windows Developer Mode is enabled (Windows 10 build 14972+). [1] (learn.microsoft.com)
  • Under the hood this is governed by the “Create symbolic links” user right (SeCreateSymbolicLinkPrivilege), which by default is granted to Administrators. [2] (learn.microsoft.com)

Junction (New-Item -ItemType Junction)

  • Does not require SeCreateSymbolicLinkPrivilege / Developer Mode; it generally only requires normal NTFS permissions to create the entry in the parent directory (and it’s directories-only, local paths). [3] (geeksforgeeks.org)

Practical rule of thumb

  • If you need a link that can target files, UNC/network paths, or use relative paths reliably, choose SymbolicLink (and ensure elevation or Developer Mode). [1] (learn.microsoft.com)
  • If you just need a directory-to-directory redirect on local drives and want to avoid admin/Developer Mode hassles, choose Junction. [3] (geeksforgeeks.org)

Sources

  • [1] Microsoft Learn — New-Item (-ItemType SymbolicLink elevation + Developer Mode/build 14972 note) (learn.microsoft.com)
  • [2] Microsoft Learn — Create symbolic links security policy (SeCreateSymbolicLinkPrivilege; default = Administrators) (learn.microsoft.com)
  • [3] GeeksforGeeks — junction points overview (notes junction creation doesn’t require admin vs symlinks) (geeksforgeeks.org)

Citations:


🏁 Script executed:

sed -n '190,210p' ./codex/install.sh

Repository: obra/superpowers

Length of output: 877


Add junction fallback for Windows link creation to improve reliability.

On Windows, New-Item -ItemType SymbolicLink requires either administrator privileges or Developer Mode (Windows 10 build 14972+). Since REPO_SKILLS_DIR is always a directory (validated on line 192), using a Junction as a fallback is more reliable for users without elevated privileges. Junctions work for directory-to-directory scenarios without requiring special permissions.

Suggested fix
   if [ $IS_WINDOWS -eq 1 ]; then
     local target="$(ps_escape "$REPO_SKILLS_DIR")"
     local link_path="$(ps_escape "$LINK_PATH")"
-    info "Creating PowerShell symbolic link from $LINK_PATH to $REPO_SKILLS_DIR..."
-    run_powershell "New-Item -ItemType SymbolicLink -Path '$link_path' -Target '$target' -Force | Out-Null"
+    info "Creating Windows link from $LINK_PATH to $REPO_SKILLS_DIR..."
+    run_powershell "try {
+      New-Item -ItemType SymbolicLink -Path '$link_path' -Target '$target' -Force -ErrorAction Stop | Out-Null
+    } catch {
+      New-Item -ItemType Junction -Path '$link_path' -Target '$target' -Force -ErrorAction Stop | Out-Null
+    }"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ $IS_WINDOWS -eq 1 ]; then
local target="$(ps_escape "$REPO_SKILLS_DIR")"
local link_path="$(ps_escape "$LINK_PATH")"
info "Creating PowerShell symbolic link from $LINK_PATH to $REPO_SKILLS_DIR..."
run_powershell "New-Item -ItemType SymbolicLink -Path '$link_path' -Target '$target' -Force | Out-Null"
else
if [ $IS_WINDOWS -eq 1 ]; then
local target="$(ps_escape "$REPO_SKILLS_DIR")"
local link_path="$(ps_escape "$LINK_PATH")"
info "Creating Windows link from $LINK_PATH to $REPO_SKILLS_DIR..."
run_powershell "try {
New-Item -ItemType SymbolicLink -Path '$link_path' -Target '$target' -Force -ErrorAction Stop | Out-Null
} catch {
New-Item -ItemType Junction -Path '$link_path' -Target '$target' -Force -ErrorAction Stop | Out-Null
}"
else
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 196-196: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 197-197: Declare and assign separately to avoid masking return values.

(SC2155)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@codex/install.sh` around lines 195 - 200, Windows link creation using
New-Item -ItemType SymbolicLink can fail without admin/DevMode; update the
IS_WINDOWS branch to try the symbolic link via run_powershell first and if that
command fails fall back to creating a directory junction (since REPO_SKILLS_DIR
is always a directory). Use ps_escape on REPO_SKILLS_DIR and LINK_PATH as
already done, run run_powershell "New-Item -ItemType SymbolicLink ..." and check
its exit/status, and on non-zero failure invoke run_powershell or cmd to create
a Junction (New-Item -ItemType Junction or mklink /J) and log/info about the
fallback; ensure the logic references IS_WINDOWS, REPO_SKILLS_DIR, LINK_PATH and
run_powershell so the fallback is applied only for directory links on Windows.

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