Skip to content

Commit e54a398

Browse files
whyuan-ccclaude
andcommitted
docs: add comprehensive JSDoc for installPlugins function
Added detailed JSDoc documentation including: - Full function description with behavior details - Parameter documentation with examples - Return value description - Throws documentation for all error cases - Usage examples showing common scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1ab70ff commit e54a398

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

base-action/src/install-plugins.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,40 @@ async function installPlugin(
6666
}
6767

6868
/**
69-
* Installs Claude Code plugins from a comma-separated list
69+
* Installs Claude Code plugins from a comma-separated list.
70+
*
71+
* Parses the plugin list, validates each plugin name for security (checking for
72+
* command injection attempts and invalid characters), and sequentially installs
73+
* each plugin using the `claude plugin install` command. Installation stops on
74+
* the first error encountered.
75+
*
76+
* @param pluginsInput - Comma-separated list of plugin names to install (e.g., "plugin1,plugin2,plugin3").
77+
* Can include whitespace which will be trimmed. Empty entries are ignored.
78+
* If undefined, empty, or whitespace-only, no plugins are installed.
79+
* @param claudeExecutable - Path to the Claude Code executable. Defaults to "claude".
80+
* Use a custom path if Claude Code is installed in a non-standard location.
81+
*
82+
* @returns A promise that resolves when all plugins are successfully installed.
83+
*
84+
* @throws {Error} If a plugin name contains invalid characters (must match `/^[@a-zA-Z0-9_\-\/\.]+$/`)
85+
* @throws {Error} If a plugin name exceeds 256 characters
86+
* @throws {Error} If plugin installation fails (non-zero exit code or spawn error)
87+
*
88+
* @example
89+
* ```typescript
90+
* // Install multiple plugins with default executable
91+
* await installPlugins("plugin1,plugin2,plugin3");
92+
*
93+
* // Install plugins with custom Claude Code path
94+
* await installPlugins("@scope/plugin,org/plugin-name", "/usr/local/bin/claude");
95+
*
96+
* // Handle errors
97+
* try {
98+
* await installPlugins("plugin1,plugin2");
99+
* } catch (error) {
100+
* console.error("Plugin installation failed:", error);
101+
* }
102+
* ```
70103
*/
71104
export async function installPlugins(
72105
pluginsInput: string | undefined,

0 commit comments

Comments
 (0)