From a7df83dcf98b7e439067271e58b27570ec57ba6d Mon Sep 17 00:00:00 2001 From: Avi Fenesh Date: Sun, 16 Aug 2026 23:38:31 +0300 Subject: [PATCH 1/3] fix(adapters): make the installer scripts executable and stop documenting them as the install path `adapters/codex/install.sh` and `adapters/opencode/install.sh` were tracked as 100644, so the invocation every adapter README gave - `./adapters/codex/install.sh` - failed with "Permission denied" on any fresh clone. Both carry a bash shebang and are meant to be run directly, so the executable bit is what they should have had; they are the only shell scripts in the repo without it. The documented path was wrong in a second way: both scripts have been marked [DEPRECATED] in their own header since v5, because they install pre-rename plugin names, while `agentsys --tool codex` and `agentsys --tool opencode` are the supported installers. The three adapter READMEs led with the deprecated script in Quick Install, Updating, and Path errors alike. Those now show the CLI, with one note per adapter that the script still exists but is deprecated. --- adapters/README.md | 35 +++++++++++++++++------------------ adapters/codex/README.md | 15 ++++++++------- adapters/codex/install.sh | 0 adapters/opencode/README.md | 15 ++++++++------- adapters/opencode/install.sh | 0 5 files changed, 33 insertions(+), 32 deletions(-) mode change 100644 => 100755 adapters/codex/install.sh mode change 100644 => 100755 adapters/opencode/install.sh diff --git a/adapters/README.md b/adapters/README.md index 8c662f66..96ead659 100644 --- a/adapters/README.md +++ b/adapters/README.md @@ -22,11 +22,13 @@ OpenAI's Codex command-line interface. **Installation:** ```bash -git clone https://github.com/agent-sh/agentsys.git -cd agentsys -./adapters/codex/install.sh +npm install -g agentsys +agentsys --tool codex ``` +The `adapters/codex/install.sh` script still works from a clone, but it is +deprecated: it installs pre-rename plugin names. + **Usage:** ```bash codex @@ -44,11 +46,13 @@ Open-source AI coding assistant. **Installation:** ```bash -git clone https://github.com/agent-sh/agentsys.git -cd agentsys -./adapters/opencode/install.sh +npm install -g agentsys +agentsys --tool opencode ``` +The `adapters/opencode/install.sh` script still works from a clone, but it is +deprecated: it installs pre-rename plugin names. + **Usage:** ```bash opencode @@ -145,32 +149,28 @@ claude plugin install next-task@agentsys ### Codex CLI ```bash -# Via installer script -./adapters/codex/install.sh +agentsys --tool codex ``` **Pros:** - One-command installation - All commands at once -- Easy updates (re-run installer) +- Easy updates (re-run the CLI) **Cons:** -- Requires git clone first - Manual updates ### OpenCode ```bash -# Via installer script -./adapters/opencode/install.sh +agentsys --tool opencode ``` **Pros:** - One-command installation - OpenCode-specific features (@, !) -- Easy updates (re-run installer) +- Easy updates (re-run the CLI) **Cons:** -- Requires git clone first - Manual updates --- @@ -195,9 +195,8 @@ Automatic via marketplace updates. ### Codex CLI & OpenCode ```bash -cd /path/to/agentsys -git pull origin main -./adapters/codex/install.sh # Or ./adapters/opencode/install.sh +npm install -g agentsys@latest +agentsys --tool codex # Or: agentsys --tool opencode ``` --- @@ -216,7 +215,7 @@ git pull origin main ### Path errors in commands Re-run the installer to fix path substitutions: ```bash -./adapters/[tool]/install.sh +agentsys --tool [tool] ``` ### Node.js errors diff --git a/adapters/codex/README.md b/adapters/codex/README.md index f376e70c..67f7dac8 100644 --- a/adapters/codex/README.md +++ b/adapters/codex/README.md @@ -5,11 +5,13 @@ Professional-grade slash commands adapted for OpenAI's Codex CLI. ## Quick Install ```bash -git clone https://github.com/agent-sh/agentsys.git -cd agentsys -./adapters/codex/install.sh +npm install -g agentsys +agentsys --tool codex ``` +The `adapters/codex/install.sh` script still works from a clone, but it is +deprecated: it installs pre-rename plugin names. + ## Prerequisites - **Codex CLI** - Install from [developers.openai.com/codex/cli](https://developers.openai.com/codex/cli) @@ -219,9 +221,8 @@ Node.js · Python · Rust · Go · Java To update commands: ```bash -cd /path/to/agentsys -git pull origin main -./adapters/codex/install.sh +npm install -g agentsys@latest +agentsys --tool codex ``` --- @@ -236,7 +237,7 @@ git pull origin main ### Path errors Re-run installer to fix path substitutions: ```bash -./adapters/codex/install.sh +agentsys --tool codex ``` ### Node.js not found diff --git a/adapters/codex/install.sh b/adapters/codex/install.sh old mode 100644 new mode 100755 diff --git a/adapters/opencode/README.md b/adapters/opencode/README.md index 40dab1bf..c2818d5a 100644 --- a/adapters/opencode/README.md +++ b/adapters/opencode/README.md @@ -5,11 +5,13 @@ Professional-grade slash commands adapted for OpenCode. ## Quick Install ```bash -git clone https://github.com/agent-sh/agentsys.git -cd agentsys -./adapters/opencode/install.sh +npm install -g agentsys +agentsys --tool opencode ``` +The `adapters/opencode/install.sh` script still works from a clone, but it is +deprecated: it installs pre-rename plugin names. + ## Prerequisites - **OpenCode** - Install from [opencode.ai](https://opencode.ai) @@ -232,9 +234,8 @@ Node.js · Python · Rust · Go · Java To update commands: ```bash -cd /path/to/agentsys -git pull origin main -./adapters/opencode/install.sh +npm install -g agentsys@latest +agentsys --tool opencode ``` --- @@ -253,7 +254,7 @@ Currently, OpenCode slash commands are only available in the TUI (Terminal User ### Path errors Re-run installer to fix path substitutions: ```bash -./adapters/opencode/install.sh +agentsys --tool opencode ``` ### Node.js not found diff --git a/adapters/opencode/install.sh b/adapters/opencode/install.sh old mode 100644 new mode 100755 From 5791eee8bdb40682f1d3f6baf36cf6928e62d692 Mon Sep 17 00:00:00 2001 From: Avi Fenesh Date: Mon, 17 Aug 2026 00:43:26 +0300 Subject: [PATCH 2/3] fix(adapters): delete the two install.sh scripts instead of documenting them The previous commit made these executable and labeled them a deprecated fallback that "still works from a clone". It does not work, and lowering the barrier to running it is the wrong direction. Both scripts source every command and skill from $REPO_ROOT/plugins/, a tree that was removed when the plugins moved to standalone repos. Every mapping therefore misses its source file and takes the [WARN] Skipped branch; set -e catches nothing, and the script closes with "[OK] Installation complete!" followed by a list of seven skills it never wrote. Worse, it is not a no-op: before copying it rm -rf's five skill directories and ~/.codex/prompts, so running it deletes a working install and reports success. bin/cli.js (agentsys --tool codex|opencode) is the only install path, so the scripts go, along with the notes pointing at them. The 'Install script validation' block in the OpenCode compatibility suite asserted only on the dead script's contents - the XDG_CONFIG_HOME semantics it covered are exercised against the live resolver in dev-install.test.js. Also drops install.sh from gen-adapters' orphan exclusion set, which only ever tests .md and .json names. --- CHANGELOG.md | 4 + __tests__/opencode-compatibility.test.js | 80 +---- adapters/README.md | 8 +- adapters/codex/README.md | 3 - adapters/codex/install.sh | 260 --------------- adapters/opencode/README.md | 3 - adapters/opencode/install.sh | 322 ------------------- checklists/update-opencode-plugin.md | 3 +- meta/skills/maintain-cross-platform/SKILL.md | 4 +- scripts/gen-adapters.js | 2 +- 10 files changed, 13 insertions(+), 676 deletions(-) delete mode 100755 adapters/codex/install.sh delete mode 100755 adapters/opencode/install.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index d1a7d548..c95f3944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Removed + +- Deleted `adapters/codex/install.sh` and `adapters/opencode/install.sh` (#395). Both sourced every command and skill from `plugins/`, a tree removed when plugins moved to standalone repos, so each mapping took the "skipped" branch and the scripts installed nothing while still printing `[OK] Installation complete!` and listing skills they had not written. They were not inert: before copying, they `rm -rf`'d five skill directories and `~/.codex/prompts`, so running one deleted a working install and reported success. `agentsys --tool codex` / `agentsys --tool opencode` (`bin/cli.js`) is the only install path, and the adapter READMEs, the OpenCode plugin checklist, and the `maintain-cross-platform` skill no longer point at the scripts. + ### Security - Claude plugin marketplace/install/update/uninstall in `bin/cli.js` now spawn via `execFileSync` with an argv array, so no plugin ID reaches a shell (#388). diff --git a/__tests__/opencode-compatibility.test.js b/__tests__/opencode-compatibility.test.js index 0a4ae332..02fe0828 100644 --- a/__tests__/opencode-compatibility.test.js +++ b/__tests__/opencode-compatibility.test.js @@ -252,80 +252,8 @@ describe('OpenCode Compatibility', () => { }); }); - describe('Install script validation', () => { - it('should have OpenCode install script', () => { - const installPath = path.join(__dirname, '../adapters/opencode/install.sh'); - expect(fs.existsSync(installPath)).toBe(true); - }); - - it('should install lib files to OpenCode commands directory', () => { - const installScript = fs.readFileSync( - path.join(__dirname, '../adapters/opencode/install.sh'), - 'utf-8' - ); - - // Should copy lib files (cp -r or similar) - expect(installScript).toMatch(/cp\s+-r|cp.*\$.*lib/); - - // Should define OPENCODE_CONFIG_DIR using XDG path (not ~/.opencode/) - expect(installScript).toMatch(/OPENCODE_CONFIG_DIR/); - // Should reference both XDG_CONFIG_HOME and .config/opencode - expect(installScript).toContain('XDG_CONFIG_HOME'); - expect(installScript).toContain('.config/opencode'); - }); - - it('should handle empty/whitespace XDG_CONFIG_HOME like JavaScript', () => { - const installScript = fs.readFileSync( - path.join(__dirname, '../adapters/opencode/install.sh'), - 'utf-8' - ); - - // Should check for non-empty AND non-whitespace (matching JS behavior) - // The bash pattern [^[:space:]] ensures whitespace-only values are rejected - expect(installScript).toContain('-n "${XDG_CONFIG_HOME}"'); - expect(installScript).toContain('[^[:space:]]'); - }); - - it('should clean up legacy ~/.opencode/ paths', () => { - const installScript = fs.readFileSync( - path.join(__dirname, '../adapters/opencode/install.sh'), - 'utf-8' - ); - - // Should have legacy cleanup - expect(installScript).toMatch(/LEGACY_OPENCODE_DIR/); - expect(installScript).toMatch(/legacy/i); - }); - - it('should have complete agent list matching dev-install.js', () => { - const installScript = fs.readFileSync( - path.join(__dirname, '../adapters/opencode/install.sh'), - 'utf-8' - ); - - // Critical agents that must be in both lists - const criticalAgents = [ - 'exploration-agent.md', - 'implementation-agent.md', - 'planning-agent.md', - 'perf-orchestrator.md', - 'enhancement-orchestrator.md', - 'worktree-manager.md' - ]; - - for (const agent of criticalAgents) { - expect(installScript).toContain(agent); - } - }); - - it('should handle path substitutions for OpenCode', () => { - const installScript = fs.readFileSync( - path.join(__dirname, '../adapters/opencode/install.sh'), - 'utf-8' - ); - - // Should transform CLAUDE_PLUGIN_ROOT to PLUGIN_ROOT - expect(installScript).toMatch(/CLAUDE_PLUGIN_ROOT.*PLUGIN_ROOT|sed.*PLUGIN_ROOT/); - }); - }); + // The former 'Install script validation' block asserted on + // adapters/opencode/install.sh, which was removed: it sourced files from the + // deleted plugins/ tree and so installed nothing. bin/cli.js is the only + // installer; its XDG_CONFIG_HOME handling is covered in dev-install.test.js. }); diff --git a/adapters/README.md b/adapters/README.md index 96ead659..a9d0cc1f 100644 --- a/adapters/README.md +++ b/adapters/README.md @@ -26,9 +26,6 @@ npm install -g agentsys agentsys --tool codex ``` -The `adapters/codex/install.sh` script still works from a clone, but it is -deprecated: it installs pre-rename plugin names. - **Usage:** ```bash codex @@ -50,9 +47,6 @@ npm install -g agentsys agentsys --tool opencode ``` -The `adapters/opencode/install.sh` script still works from a clone, but it is -deprecated: it installs pre-rename plugin names. - **Usage:** ```bash opencode @@ -239,7 +233,7 @@ Found a bug or want to add support for another tool? 1. Open an issue: https://github.com/agent-sh/agentsys/issues 2. Submit a PR with: - New adapter directory: `adapters/[tool-name]/` - - Installation script: `install.sh` + - Install support in `bin/cli.js` (the only installer) - Documentation: `README.md` - Update this file diff --git a/adapters/codex/README.md b/adapters/codex/README.md index 67f7dac8..15bdea8b 100644 --- a/adapters/codex/README.md +++ b/adapters/codex/README.md @@ -9,9 +9,6 @@ npm install -g agentsys agentsys --tool codex ``` -The `adapters/codex/install.sh` script still works from a clone, but it is -deprecated: it installs pre-rename plugin names. - ## Prerequisites - **Codex CLI** - Install from [developers.openai.com/codex/cli](https://developers.openai.com/codex/cli) diff --git a/adapters/codex/install.sh b/adapters/codex/install.sh deleted file mode 100755 index 0ec10bbc..00000000 --- a/adapters/codex/install.sh +++ /dev/null @@ -1,260 +0,0 @@ -#!/usr/bin/env bash -set -e - -# [DEPRECATED] This script is outdated and uses old plugin names. -# Use instead: agentsys --tool codex -# Or: node scripts/dev-install.js codex - -# Codex CLI Installer for agentsys commands -# This script installs all 5 slash commands for use with OpenAI Codex CLI - -echo "[INSTALL] Installing agentsys commands for Codex CLI..." -echo - -# Configuration -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" -CODEX_CONFIG_DIR="${HOME}/.codex" -CODEX_SKILLS_DIR="${CODEX_CONFIG_DIR}/skills" -CODEX_LIB_DIR="${CODEX_CONFIG_DIR}/agentsys/lib" - -# Detect OS and normalize paths -if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then - IS_WINDOWS=true - # Convert Windows path to Unix-style for bash compatibility - CODEX_CONFIG_DIR="${USERPROFILE}/.codex" - # Replace backslashes with forward slashes - CODEX_CONFIG_DIR="${CODEX_CONFIG_DIR//\\//}" - CODEX_SKILLS_DIR="${CODEX_CONFIG_DIR}/skills" - CODEX_LIB_DIR="${CODEX_CONFIG_DIR}/agentsys/lib" -else - IS_WINDOWS=false -fi - -echo "[CONFIG] Configuration:" -echo " Repository: $REPO_ROOT" -echo " Skills to: $CODEX_SKILLS_DIR" -echo " Libraries to: $CODEX_LIB_DIR" -echo - -# Check prerequisites -echo "[CHECK] Checking prerequisites..." - -# Check Node.js -if ! command -v node &> /dev/null; then - echo "[ERROR] Node.js not found. Install from: https://nodejs.org" - exit 1 -fi -NODE_VERSION=$(node --version) -echo " [OK] Node.js $NODE_VERSION" - -# Check Git -if ! command -v git &> /dev/null; then - echo "[ERROR] Git not found. Install from: https://git-scm.com" - exit 1 -fi -GIT_VERSION=$(git --version | cut -d' ' -f3) -echo " [OK] Git $GIT_VERSION" - -# Check Codex CLI (optional - user may not have it installed yet) -if command -v codex &> /dev/null; then - CODEX_VERSION=$(codex --version 2>&1 | head -n1 || echo "unknown") - echo " [OK] Codex CLI $CODEX_VERSION" -else - echo " [WARN] Codex CLI not found (install from: https://developers.openai.com/codex/cli)" - echo " You can still install commands and use Codex CLI later" -fi - -echo - -# Create directories -echo "[DIR] Creating directories..." -mkdir -p "$CODEX_SKILLS_DIR" -mkdir -p "$CODEX_LIB_DIR"/{platform,patterns,utils} -echo " [OK] Created $CODEX_SKILLS_DIR" -echo " [OK] Created $CODEX_LIB_DIR" -echo - -# Copy library files from shared root lib directory -echo "[LIB] Installing shared libraries..." -# Use explicit iteration to handle paths with spaces safely -for item in "${REPO_ROOT}/lib"/*; do - cp -r "$item" "${CODEX_LIB_DIR}/" -done -echo " [OK] Copied platform detection" -echo " [OK] Copied pattern libraries" -echo " [OK] Copied utility functions" -echo - -# Install skills with proper SKILL.md format -echo "[SETUP] Installing skills..." - -# Skill mappings: skill_name:plugin:source_file:description -# Codex skills require SKILL.md with name and description in YAML frontmatter -SKILL_MAPPINGS=( - "next-task:next-task:next-task:Master workflow orchestrator with autonomous task-to-production automation" - "ship:ship:ship:Complete PR workflow from commit to production with validation" - "deslop-around:deslop-around:deslop-around:AI slop cleanup with minimal diffs and behavior preservation" - "project-review:project-review:project-review:Multi-agent iterative code review until zero issues remain" - "reality-check-scan:reality-check:scan:Deep repository analysis to detect plan drift and code reality gaps" - "delivery-approval:next-task:delivery-approval:Validate task completion and approve for shipping" - "sync-docs:sync-docs:sync-docs:Sync documentation with actual code state" -) - -for mapping in "${SKILL_MAPPINGS[@]}"; do - IFS=':' read -r SKILL_NAME PLUGIN SOURCE_NAME DESCRIPTION <<< "$mapping" - SOURCE_FILE="$REPO_ROOT/plugins/$PLUGIN/commands/$SOURCE_NAME.md" - SKILL_DIR="$CODEX_SKILLS_DIR/$SKILL_NAME" - TARGET_FILE="$SKILL_DIR/SKILL.md" - - if [ -f "$SOURCE_FILE" ]; then - # Create skill directory - mkdir -p "$SKILL_DIR" - - # Create SKILL.md with proper frontmatter - # Remove existing frontmatter and add Codex-compatible format - { - echo "---" - echo "name: $SKILL_NAME" - echo "description: $DESCRIPTION" - echo "---" - echo "" - # Skip original frontmatter if present and include rest of content - sed '1{/^---$/!b};1,/^---$/d' "$SOURCE_FILE" - } > "$TARGET_FILE" - - echo " [OK] Installed skill: \$${SKILL_NAME}" - else - echo " [WARN] Skipped \$${SKILL_NAME} (source not found: $SOURCE_FILE)" - fi -done - -# Install native skills (already have SKILL.md format) -echo -echo "[LIB] Installing native skills..." - -# Native skill mappings: skill_name:plugin:skill_name_in_source -NATIVE_SKILL_MAPPINGS=( - "orchestrate-review:next-task:orchestrate-review" -) - -for mapping in "${NATIVE_SKILL_MAPPINGS[@]}"; do - IFS=':' read -r SKILL_NAME PLUGIN SOURCE_SKILL <<< "$mapping" - SOURCE_SKILL_DIR="$REPO_ROOT/plugins/$PLUGIN/skills/$SOURCE_SKILL" - TARGET_SKILL_DIR="$CODEX_SKILLS_DIR/$SKILL_NAME" - - if [ -d "$SOURCE_SKILL_DIR" ]; then - # Create skill directory - mkdir -p "$TARGET_SKILL_DIR" - - # Copy SKILL.md - if [ -f "$SOURCE_SKILL_DIR/SKILL.md" ]; then - cp "$SOURCE_SKILL_DIR/SKILL.md" "$TARGET_SKILL_DIR/SKILL.md" - echo " [OK] Installed native skill: \$${SKILL_NAME}" - else - echo " [WARN] Skipped \$${SKILL_NAME} (SKILL.md not found)" - continue - fi - - # Copy optional subdirectories (references/, scripts/, assets/) - for subdir in references scripts assets; do - if [ -d "$SOURCE_SKILL_DIR/$subdir" ]; then - cp -r "$SOURCE_SKILL_DIR/$subdir" "$TARGET_SKILL_DIR/" - echo " [OK] Copied $subdir/ directory" - fi - done - else - echo " [WARN] Skipped \$${SKILL_NAME} (source not found: $SOURCE_SKILL_DIR)" - fi -done - -# Remove old/deprecated skills and prompts -OLD_SKILLS=("deslop" "review" "reality-check-set" "pr-merge" "review-orchestrator") -for old_skill in "${OLD_SKILLS[@]}"; do - if [ -d "$CODEX_SKILLS_DIR/$old_skill" ]; then - rm -rf "$CODEX_SKILLS_DIR/$old_skill" - echo " [DEL] Removed deprecated skill: $old_skill" - fi -done - -# Clean up old prompts directory if it exists -OLD_PROMPTS_DIR="$CODEX_CONFIG_DIR/prompts" -if [ -d "$OLD_PROMPTS_DIR" ]; then - rm -rf "$OLD_PROMPTS_DIR" - echo " [DEL] Removed old prompts directory" -fi - -echo - -# Create README -cat > "$CODEX_CONFIG_DIR/AGENTSYS_README.md" << 'EOF' -# agentsys for Codex CLI - -Skills installed for OpenAI Codex CLI. - -## Available Skills - -Access via $ prefix: -- `$next-task` - Master workflow orchestrator -- `$ship` - PR workflow from commit to production -- `$deslop-around` - AI slop cleanup -- `$project-review` - Multi-agent code review -- `$reality-check-scan` - Plan drift detection -- `$delivery-approval` - Validate task completion -- `$sync-docs` - Sync documentation - -## Usage - -In Codex CLI: -```bash -codex -> $next-task -> $ship -> $deslop-around -``` - -Or type `$` to see available skills. - -## Libraries - -Shared libraries at: ~/.codex/agentsys/lib/ - -## Updates - -```bash -cd /path/to/agentsys -./adapters/codex/install.sh -``` - -## Support - -- Repository: https://github.com/agent-sh/agentsys -- Issues: https://github.com/agent-sh/agentsys/issues -EOF - -echo " [OK] Created README" -echo - -# Success message -echo "[OK] Installation complete!" -echo -echo "[LIST] Installed Skills (access via \$ prefix):" -echo " • \$next-task" -echo " • \$ship" -echo " • \$deslop-around" -echo " • \$project-review" -echo " • \$reality-check-scan" -echo " • \$delivery-approval" -echo " • \$sync-docs" -echo -echo "[NEXT] Next Steps:" -echo " 1. Start Codex CLI: codex" -echo " 2. Type: \$ (shows available skills)" -echo " 3. Select a skill or type: \$next-task" -echo " 4. See help: cat $CODEX_CONFIG_DIR/AGENTSYS_README.md" -echo -echo "[TIP] Pro Tip: Type \$ to see all available skills" -echo -echo "[UPDATE] To update skills, re-run this installer:" -echo " ./adapters/codex/install.sh" -echo -echo "Happy coding!" diff --git a/adapters/opencode/README.md b/adapters/opencode/README.md index c2818d5a..deb5ca84 100644 --- a/adapters/opencode/README.md +++ b/adapters/opencode/README.md @@ -9,9 +9,6 @@ npm install -g agentsys agentsys --tool opencode ``` -The `adapters/opencode/install.sh` script still works from a clone, but it is -deprecated: it installs pre-rename plugin names. - ## Prerequisites - **OpenCode** - Install from [opencode.ai](https://opencode.ai) diff --git a/adapters/opencode/install.sh b/adapters/opencode/install.sh deleted file mode 100755 index b8295c18..00000000 --- a/adapters/opencode/install.sh +++ /dev/null @@ -1,322 +0,0 @@ -#!/usr/bin/env bash -set -e - -# [DEPRECATED] This script is outdated and uses old plugin names. -# Use instead: agentsys --tool opencode -# Or: node scripts/dev-install.js opencode - -# OpenCode Installer for agentsys commands -# This script installs all 5 slash commands for use with OpenCode - -echo "[INSTALL] Installing agentsys commands for OpenCode..." -echo - -# Configuration -REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" - -# Use $HOME which works correctly on all platforms including Git Bash on Windows -# (Git Bash sets HOME to Unix-style path like /c/Users/username) -# OpenCode global config follows XDG Base Directory Specification: -# - Default: ~/.config/opencode/ -# - Override: $XDG_CONFIG_HOME/opencode/ (if XDG_CONFIG_HOME is set and not empty/whitespace) -# Note: Must match logic in scripts/dev-install.js getOpenCodeConfigDir() -if [[ -n "${XDG_CONFIG_HOME}" && "${XDG_CONFIG_HOME}" =~ [^[:space:]] ]]; then - OPENCODE_CONFIG_DIR="${XDG_CONFIG_HOME}/opencode" -else - OPENCODE_CONFIG_DIR="${HOME}/.config/opencode" -fi -# OpenCode expects commands directly in commands/, not a subdirectory -OPENCODE_COMMANDS_DIR="${OPENCODE_CONFIG_DIR}/commands" -LIB_DIR="${OPENCODE_COMMANDS_DIR}/lib" - -# Legacy path for cleanup (incorrect, pre-XDG location) -LEGACY_OPENCODE_DIR="${HOME}/.opencode" - -# Detect OS for platform-specific notes -if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" || "$OSTYPE" == "cygwin" ]]; then - IS_WINDOWS=true -else - IS_WINDOWS=false -fi - -echo "[CONFIG] Configuration:" -echo " Repository: $REPO_ROOT" -echo " Install to: $OPENCODE_COMMANDS_DIR" -echo - -# Check prerequisites -echo "[CHECK] Checking prerequisites..." - -# Check Node.js -if ! command -v node &> /dev/null; then - echo "[ERROR] Node.js not found. Install from: https://nodejs.org" - exit 1 -fi -NODE_VERSION=$(node --version) -echo " [OK] Node.js $NODE_VERSION" - -# Check Git -if ! command -v git &> /dev/null; then - echo "[ERROR] Git not found. Install from: https://git-scm.com" - exit 1 -fi -GIT_VERSION=$(git --version | cut -d' ' -f3) -echo " [OK] Git $GIT_VERSION" - -# Check OpenCode (optional - user may not have it installed yet) -if command -v opencode &> /dev/null; then - OPENCODE_VERSION=$(opencode --version 2>&1 | head -n1 || echo "unknown") - echo " [OK] OpenCode $OPENCODE_VERSION" -else - echo " [WARN] OpenCode not found (install from: https://opencode.ai)" - echo " You can still install commands and use OpenCode later" -fi - -echo - -# Create directories -echo "[DIR] Creating directories..." -mkdir -p "$OPENCODE_COMMANDS_DIR" -mkdir -p "$LIB_DIR"/{platform,patterns,utils} -echo " [OK] Created $OPENCODE_COMMANDS_DIR" -echo " [OK] Created $LIB_DIR" -echo - -# Copy library files from shared root lib directory -echo "[LIB] Installing shared libraries..." -# Use explicit iteration to handle paths with spaces safely -for item in "${REPO_ROOT}/lib"/*; do - cp -r "$item" "${LIB_DIR}/" -done -echo " [OK] Copied platform detection" -echo " [OK] Copied pattern libraries" -echo " [OK] Copied utility functions" -echo - -# Install commands with path adjustments -echo "[SETUP] Installing commands..." - -# Command mappings: target_name:plugin:source_file -# Format allows commands from different plugins -COMMAND_MAPPINGS=( - "deslop-around:deslop-around:deslop-around" - "next-task:next-task:next-task" - "delivery-approval:next-task:delivery-approval" - "sync-docs:sync-docs:sync-docs" - "project-review:project-review:project-review" - "ship:ship:ship" - "reality-check-scan:reality-check:scan" -) - -for mapping in "${COMMAND_MAPPINGS[@]}"; do - IFS=':' read -r TARGET_NAME PLUGIN SOURCE_NAME <<< "$mapping" - SOURCE_FILE="$REPO_ROOT/plugins/$PLUGIN/commands/$SOURCE_NAME.md" - TARGET_FILE="$OPENCODE_COMMANDS_DIR/$TARGET_NAME.md" - - if [ -f "$SOURCE_FILE" ]; then - # Copy and transform CLAUDE_PLUGIN_ROOT -> PLUGIN_ROOT for OpenCode - sed 's/\${CLAUDE_PLUGIN_ROOT}/${PLUGIN_ROOT}/g; s/\$CLAUDE_PLUGIN_ROOT/$PLUGIN_ROOT/g' \ - "$SOURCE_FILE" > "$TARGET_FILE" - echo " [OK] Installed /$TARGET_NAME" - else - echo " [WARN] Skipped /$TARGET_NAME (source not found: $SOURCE_FILE)" - fi -done - -# Remove old/legacy commands that no longer exist -OLD_COMMANDS=("pr-merge") -for old_cmd in "${OLD_COMMANDS[@]}"; do - if [ -f "$OPENCODE_COMMANDS_DIR/$old_cmd.md" ]; then - rm "$OPENCODE_COMMANDS_DIR/$old_cmd.md" - echo " [DEL] Removed legacy /$old_cmd" - fi -done - -echo - -# Create environment setup script -echo "[ENV] Creating environment setup..." -cat > "$OPENCODE_COMMANDS_DIR/env.sh" << 'EOF' -#!/usr/bin/env bash -# Environment variables for agentsys commands in OpenCode - -# Set the root directory for commands to find libraries -export OPENCODE_COMMANDS_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Add lib directory to NODE_PATH if needed -export NODE_PATH="${OPENCODE_COMMANDS_ROOT}/lib:${NODE_PATH}" - -# Platform detection helpers -export AGENTSYS_PLATFORM_SCRIPT="${OPENCODE_COMMANDS_ROOT}/lib/platform/detect-platform.js" -export AGENTSYS_TOOLS_SCRIPT="${OPENCODE_COMMANDS_ROOT}/lib/platform/verify-tools.js" -EOF - -chmod +x "$OPENCODE_COMMANDS_DIR/env.sh" -echo " [OK] Created environment setup script" -echo - -# Install native OpenCode plugin (auto-thinking, workflow enforcement, compaction) -echo "[PLUGIN] Installing native plugin..." -PLUGIN_DIR="${OPENCODE_CONFIG_DIR}/plugins" -PLUGIN_DEST="${PLUGIN_DIR}/agentsys.ts" -PLUGIN_SRC="${REPO_ROOT}/adapters/opencode-plugin" - -if [ -d "$PLUGIN_SRC" ]; then - mkdir -p "$PLUGIN_DIR" - cp "$PLUGIN_SRC/index.ts" "$PLUGIN_DEST" 2>/dev/null || true - echo " [OK] Installed native plugin to $PLUGIN_DEST" - echo " Features: Auto-thinking selection, workflow enforcement, session compaction" -else - echo " [WARN] Native plugin source not found at $PLUGIN_SRC" -fi -echo - -# Create README -cat > "$OPENCODE_COMMANDS_DIR/README.md" << 'EOF' -# agentsys for OpenCode - -This directory contains the agentsys commands adapted for OpenCode. - -## Available Commands - -- `/deslop-around` - AI slop cleanup with minimal diffs -- `/next-task` - Intelligent task prioritization -- `/project-review` - Multi-agent code review -- `/ship` - Complete PR workflow -- `/pr-merge` - Intelligent PR merge - -## Usage - -In OpenCode TUI, invoke commands directly: - -```bash -/deslop-around -/next-task -/project-review -/ship -/pr-merge -``` - -You can also pass arguments: -```bash -/deslop-around apply -/next-task bug -/ship --strategy rebase -``` - -## OpenCode-Specific Features - -OpenCode supports additional features you can use with these commands: - -- **@filename** - Include file contents in prompt -- **!command** - Include bash command output in prompt - -Example: -```bash -/project-review @src/main.py -/deslop-around apply !git diff --name-only -``` - -## Environment - -Commands use the shared library at: -``` -~/.config/opencode/commands/lib/ -``` - -## Updates - -To update commands, re-run the installer: -```bash -cd /path/to/agentsys -./adapters/opencode/install.sh -``` - -## Support - -- Repository: https://github.com/agent-sh/agentsys -- Issues: https://github.com/agent-sh/agentsys/issues -EOF - -echo " [OK] Created README" -echo - -# Run migration tool to set up native OpenCode agents -echo "[MIGRATE] Setting up native OpenCode agents..." -if [ -f "$REPO_ROOT/scripts/migrate-opencode.js" ]; then - node "$REPO_ROOT/scripts/migrate-opencode.js" --target "$(pwd)" 2>/dev/null || true - echo " [OK] Native agents configured" -else - echo " [SKIP] Migration script not found" -fi -echo - -# Clean up legacy paths (~/.opencode/ - incorrect, pre-XDG location) -echo "[CLEANUP] Checking for legacy installations..." -LEGACY_COMMANDS_DIR="${LEGACY_OPENCODE_DIR}/commands/agentsys" -LEGACY_PLUGINS_DIR="${LEGACY_OPENCODE_DIR}/plugins/agentsys" -LEGACY_AGENTS_DIR="${LEGACY_OPENCODE_DIR}/agents" - -cleaned_legacy=false -if [ -d "$LEGACY_COMMANDS_DIR" ]; then - rm -rf "$LEGACY_COMMANDS_DIR" - echo " [DEL] Removed legacy ~/.opencode/commands/agentsys" - cleaned_legacy=true -fi -if [ -d "$LEGACY_PLUGINS_DIR" ]; then - rm -rf "$LEGACY_PLUGINS_DIR" - echo " [DEL] Removed legacy ~/.opencode/plugins/agentsys" - cleaned_legacy=true -fi -if [ -d "$LEGACY_AGENTS_DIR" ]; then - # Only remove known agent files, not the whole directory - # Must match list in scripts/dev-install.js knownAgents array - # Generated from: ls plugins/*/agents/*.md | xargs basename | sort -u - known_agents=( - 'agent-enhancer.md' 'ci-fixer.md' 'ci-monitor.md' 'claudemd-enhancer.md' - 'delivery-validator.md' 'deslop-agent.md' 'docs-enhancer.md' 'enhancement-orchestrator.md' - 'exploration-agent.md' 'hooks-enhancer.md' 'implementation-agent.md' 'learn-agent.md' - 'map-validator.md' 'perf-analyzer.md' 'perf-code-paths.md' 'perf-investigation-logger.md' - 'perf-orchestrator.md' 'perf-theory-gatherer.md' 'perf-theory-tester.md' 'plan-synthesizer.md' - 'planning-agent.md' 'plugin-enhancer.md' 'prompt-enhancer.md' 'simple-fixer.md' - 'skills-enhancer.md' 'sync-docs-agent.md' 'task-discoverer.md' 'test-coverage-checker.md' - 'worktree-manager.md' - ) - for agent in "${known_agents[@]}"; do - if [ -f "$LEGACY_AGENTS_DIR/$agent" ]; then - rm "$LEGACY_AGENTS_DIR/$agent" - cleaned_legacy=true - fi - done - if [ "$cleaned_legacy" = true ]; then - echo " [DEL] Removed legacy agent files from ~/.opencode/agents" - fi -fi -if [ "$cleaned_legacy" = false ]; then - echo " [OK] No legacy installations found" -fi -echo - -# Success message -echo "[OK] Installation complete!" -echo -echo "[LIST] Installed Commands:" -for mapping in "${COMMAND_MAPPINGS[@]}"; do - IFS=':' read -r cmd _ _ <<< "$mapping" - echo " • /$cmd" -done -echo -echo "[NEXT] Next Steps:" -echo " 1. Start OpenCode TUI: opencode" -echo " 2. Use commands: /next-task, /ship, etc." -echo " 3. See help: cat $OPENCODE_COMMANDS_DIR/README.md" -echo -echo "[TIP] OpenCode Pro Tips:" -echo " • Use @filename to include file contents" -echo " • Use !command to include bash output" -echo " • Example: /project-review @src/main.py" -echo -echo "[UPDATE] To update commands, re-run this installer:" -echo " ./adapters/opencode/install.sh" -echo -echo "Happy coding!" diff --git a/checklists/update-opencode-plugin.md b/checklists/update-opencode-plugin.md index b24e737e..f9297b3d 100644 --- a/checklists/update-opencode-plugin.md +++ b/checklists/update-opencode-plugin.md @@ -17,7 +17,6 @@ The native OpenCode plugin provides deep integration: | `adapters/opencode-plugin/index.ts` | Plugin implementation | | `adapters/opencode-plugin/package.json` | Dependencies | | `bin/cli.js` | npm installer (copies plugin) | -| `adapters/opencode/install.sh` | Shell installer (copies plugin) | | `agent-docs/OPENCODE-REFERENCE.md` | Knowledge base | ## 1. Update Plugin Implementation @@ -115,7 +114,7 @@ output.options.thinkingConfig = { ## Common Pitfalls -- **Don't forget to update both installers** - `bin/cli.js` AND `adapters/opencode/install.sh` +- **`bin/cli.js` is the only installer** - plugin changes land nowhere until it copies them - **Match agent names exactly** - Case-sensitive matching against `input.agent` - **Test all providers** - Each has different thinking APIs - **Keep flow.json format stable** - Other parts of the system read it diff --git a/meta/skills/maintain-cross-platform/SKILL.md b/meta/skills/maintain-cross-platform/SKILL.md index e2e9ceff..0cf06a67 100644 --- a/meta/skills/maintain-cross-platform/SKILL.md +++ b/meta/skills/maintain-cross-platform/SKILL.md @@ -126,8 +126,8 @@ permission: | `bin/cli.js` | Main installer (811 lines) - handles all 3 platforms | | `scripts/setup-hooks.js` | Git hooks installer (pre-commit, pre-push) | | `adapters/opencode-plugin/` | Native OpenCode TypeScript plugin | -| `adapters/opencode/` | OpenCode install script (legacy) | -| `adapters/codex/` | Codex install script (legacy) | +| `adapters/opencode/` | Generated OpenCode commands, agents, skills | +| `adapters/codex/` | Generated Codex skills | | `mcp-server/index.js` | Cross-platform MCP server | ### Validation Scripts (All in CI + Pre-Push) diff --git a/scripts/gen-adapters.js b/scripts/gen-adapters.js index 43726708..2a143984 100644 --- a/scripts/gen-adapters.js +++ b/scripts/gen-adapters.js @@ -214,7 +214,7 @@ function computeAdapters() { function findOrphanedAdapters(generatedFiles) { const orphans = []; // Hand-maintained files that should not be treated as orphans - const EXCLUDED_FILES = new Set(['README.md', 'install.sh']); + const EXCLUDED_FILES = new Set(['README.md']); function scanDirectory(dir, relativeBase) { if (!fs.existsSync(dir)) return; From 162ed961a72f5c88a7c4da923f532d239d86e9b6 Mon Sep 17 00:00:00 2001 From: Avi Fenesh Date: Mon, 17 Aug 2026 02:19:34 +0300 Subject: [PATCH 3/3] docs: correct the "only installer" claim - dev-install.js copies the plugin too Review finding on this PR: replacing the deprecated-install.sh notes with "bin/cli.js is the only installer" overstated it. scripts/dev-install.js:399-412 copies adapters/opencode-plugin/index.ts to /plugins/agentsys.ts with its own copy of the same logic, including the legacy awesome-slash.ts cleanup bin/cli.js:1528-1531 does, and it is reachable via `agentsys-dev dev-install opencode`. So the original pitfall - two copy paths that drift if only one is updated - still holds; only the second path's identity changed. The checklist's "Files to Update" table gets its second row back pointing at scripts/dev-install.js, and the pitfall, the adapters contributing checklist, the replaced test block's comment, and the changelog entry now name both paths. --- CHANGELOG.md | 2 +- __tests__/opencode-compatibility.test.js | 5 +++-- adapters/README.md | 2 +- checklists/update-opencode-plugin.md | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c95f3944..7c861d63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -- Deleted `adapters/codex/install.sh` and `adapters/opencode/install.sh` (#395). Both sourced every command and skill from `plugins/`, a tree removed when plugins moved to standalone repos, so each mapping took the "skipped" branch and the scripts installed nothing while still printing `[OK] Installation complete!` and listing skills they had not written. They were not inert: before copying, they `rm -rf`'d five skill directories and `~/.codex/prompts`, so running one deleted a working install and reported success. `agentsys --tool codex` / `agentsys --tool opencode` (`bin/cli.js`) is the only install path, and the adapter READMEs, the OpenCode plugin checklist, and the `maintain-cross-platform` skill no longer point at the scripts. +- Deleted `adapters/codex/install.sh` and `adapters/opencode/install.sh` (#395). Both sourced every command and skill from `plugins/`, a tree removed when plugins moved to standalone repos, so each mapping took the "skipped" branch and the scripts installed nothing while still printing `[OK] Installation complete!` and listing skills they had not written. They were not inert: before copying, they `rm -rf`'d five skill directories and `~/.codex/prompts`, so running one deleted a working install and reported success. `agentsys --tool codex` / `agentsys --tool opencode` (`bin/cli.js`) is the supported install path, with `scripts/dev-install.js` covering dev installs, and the adapter READMEs, the OpenCode plugin checklist, and the `maintain-cross-platform` skill no longer point at the scripts. ### Security diff --git a/__tests__/opencode-compatibility.test.js b/__tests__/opencode-compatibility.test.js index 02fe0828..d6dc18a8 100644 --- a/__tests__/opencode-compatibility.test.js +++ b/__tests__/opencode-compatibility.test.js @@ -254,6 +254,7 @@ describe('OpenCode Compatibility', () => { // The former 'Install script validation' block asserted on // adapters/opencode/install.sh, which was removed: it sourced files from the - // deleted plugins/ tree and so installed nothing. bin/cli.js is the only - // installer; its XDG_CONFIG_HOME handling is covered in dev-install.test.js. + // deleted plugins/ tree and so installed nothing. Installs now go through + // bin/cli.js (npm) or scripts/dev-install.js (dev); the XDG_CONFIG_HOME + // handling those share is covered in dev-install.test.js. }); diff --git a/adapters/README.md b/adapters/README.md index a9d0cc1f..01daf898 100644 --- a/adapters/README.md +++ b/adapters/README.md @@ -233,7 +233,7 @@ Found a bug or want to add support for another tool? 1. Open an issue: https://github.com/agent-sh/agentsys/issues 2. Submit a PR with: - New adapter directory: `adapters/[tool-name]/` - - Install support in `bin/cli.js` (the only installer) + - Install support in `bin/cli.js` (npm installs) and `scripts/dev-install.js` (dev installs) - Documentation: `README.md` - Update this file diff --git a/checklists/update-opencode-plugin.md b/checklists/update-opencode-plugin.md index f9297b3d..d51808b8 100644 --- a/checklists/update-opencode-plugin.md +++ b/checklists/update-opencode-plugin.md @@ -17,6 +17,7 @@ The native OpenCode plugin provides deep integration: | `adapters/opencode-plugin/index.ts` | Plugin implementation | | `adapters/opencode-plugin/package.json` | Dependencies | | `bin/cli.js` | npm installer (copies plugin) | +| `scripts/dev-install.js` | Dev installer (`agentsys-dev dev-install opencode`) - its own copy of the same logic | | `agent-docs/OPENCODE-REFERENCE.md` | Knowledge base | ## 1. Update Plugin Implementation @@ -114,7 +115,7 @@ output.options.thinkingConfig = { ## Common Pitfalls -- **`bin/cli.js` is the only installer** - plugin changes land nowhere until it copies them +- **Two paths copy the plugin** - `bin/cli.js` (npm installs) and `scripts/dev-install.js` (dev installs); plugin changes land nowhere until both copy them, and they drift if only one is updated - **Match agent names exactly** - Case-sensitive matching against `input.agent` - **Test all providers** - Each has different thinking APIs - **Keep flow.json format stable** - Other parts of the system read it