Skip to content

feat(hooks): anchor devin-plugin hook commands to DEVIN_PLUGIN_ROOT - #3982

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-3413-devin-plugin-root
Nov 26, 2026
Merged

dyoshikawa merged 2 commits into
mainfrom
resolve-issue-3413-devin-plugin-root

Conversation

@dyoshikawa

Copy link
Copy Markdown
Owner

Summary

Follow-up to #3413 (Gap 4): hook commands in a devin-plugin bundle's hooks.json were written verbatim, so a ./scripts/x.sh command resolved against the consumer's workspace instead of the plugin install directory. Devin now documents a plugin-root variable, so ./-relative commands are anchored to it.

Primary sources (https://docs.devin.ai/cli/changelog/stable):

Changes

  • DevinHooks gets a protected static getConverterConfig() hook; DevinPluginHooks overrides it with DEVIN_PLUGIN_CONVERTER_CONFIG (projectDirVar: "$DEVIN_PLUGIN_ROOT", prefixDotRelativeCommandsOnly: true, import aliases $PLUGIN_ROOT / $CLAUDE_PLUGIN_ROOT), mirroring augmentcode-plugin-hooks.ts.
  • Generate: ./scripts/check.sh -> "$DEVIN_PLUGIN_ROOT"/scripts/check.sh; later ./ script words are anchored too; bare commands (npx prettier --write ./src) stay as written. The devin target is unchanged.
  • Import: "$DEVIN_PLUGIN_ROOT"/, $DEVIN_PLUGIN_ROOT/, ${DEVIN_PLUGIN_ROOT}/, and the same forms of PLUGIN_ROOT / CLAUDE_PLUGIN_ROOT convert back to ./.
  • Docs: plugin packaging guide (Devin hooks bullet) and the anchoring-targets list in file-formats.md; regenerated docs-content.ts.
  • Tests: unit tests for generate, inline anchoring, import of every variable form, and a generate/import round-trip with a quoted path containing a space; e2e expectations in e2e-hooks.spec.ts and e2e-plugins.spec.ts updated.

Design decisions

  • DEVIN_PLUGIN_ROOT over PLUGIN_ROOT: it is the Devin-native name and has existed since v3000.5.20, so it works on more CLI versions than PLUGIN_ROOT (v3000.11.92).
  • Quoted shell form ("$DEVIN_PLUGIN_ROOT"/...), same as the AugmentCode plugin, so plugin paths containing spaces are not word-split. Devin hooks have no exec form (args), so no braced placeholder variant is needed.
  • CLAUDE_PLUGIN_ROOT is accepted on import because Devin also sets it for hooks (v3000.5.20 changelog), so hand-written plugins using it round-trip to ./.
  • Only dot-relative commands are prefixed (prefixDotRelativeCommandsOnly), matching the other plugin targets.

Skipped

  • Gap 6 (list-form matcher import): the hooks overview / lifecycle docs still describe matcher as a regex string; only changelog v3000.11.205 mentions a list, with an ambiguous shape. Waiting for docs.
  • ContextInput hook event: only in changelog v3000.12.17, not in the documented event list yet.

Local pnpm cicheck: all green except timing-dependent tests under heavy machine load (load avg ~70); shell-command-categories, orphan-sweep, glob pass when rerun alone. opencode-hooks.test.ts "evicts sessionStart contexts in completion order" (real Bun runtime, unrelated code) still timed out locally under load.

Refs #3413

🤖 Generated with Claude Code

https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4

dyoshikawa and others added 2 commits November 26, 2026 16:40
Devin CLI v3000.5.20+ sets DEVIN_PLUGIN_ROOT for hooks contributed by a
plugin, so ./-relative commands in a plugin hooks.json are now written as
"$DEVIN_PLUGIN_ROOT"/... and resolve against the plugin install directory
instead of the consumer's workspace. Import converts DEVIN_PLUGIN_ROOT,
PLUGIN_ROOT and CLAUDE_PLUGIN_ROOT back to ./.

Refs #3413

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdNNKCxxrKAMDANMGDEGP4
…vin-plugin-root

# Conflicts:
#	src/generated/docs-content.ts
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