agent-powerups
Advanced tools
| import fs from "node:fs/promises"; | ||
| import path from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| const PLUGINS_DIR = "plugins"; | ||
| const BUNDLES_FILE = "plugin-bundles.json"; | ||
| async function findPluginRoot(startDir) { | ||
| let current = path.resolve(startDir); | ||
| while (true) { | ||
| try { | ||
| await fs.stat(path.join(current, BUNDLES_FILE)); | ||
| return current; | ||
| } | ||
| catch { | ||
| const parent = path.dirname(current); | ||
| if (parent === current) | ||
| return null; | ||
| current = parent; | ||
| } | ||
| } | ||
| } | ||
| async function resolvePluginRoot(cwd) { | ||
| // Walk up from cwd first, then from the installed package location. | ||
| const fromCwd = await findPluginRoot(cwd); | ||
| if (fromCwd) | ||
| return fromCwd; | ||
| const fromPkg = await findPluginRoot(path.dirname(fileURLToPath(import.meta.url))); | ||
| return fromPkg ?? cwd; | ||
| } | ||
| export async function getPluginBundles(cwd) { | ||
| const root = await resolvePluginRoot(cwd); | ||
| try { | ||
| const data = await fs.readFile(path.join(cwd, BUNDLES_FILE), "utf8"); | ||
| const data = await fs.readFile(path.join(root, BUNDLES_FILE), "utf8"); | ||
| const parsed = JSON.parse(data); | ||
| return Array.isArray(parsed.plugins) ? parsed.plugins : []; | ||
| } | ||
| catch (error) { | ||
| catch { | ||
| return []; | ||
@@ -16,2 +41,3 @@ } | ||
| export async function listPlugins(cwd) { | ||
| const root = await resolvePluginRoot(cwd); | ||
| const bundles = await getPluginBundles(cwd); | ||
@@ -22,3 +48,3 @@ const result = []; | ||
| continue; | ||
| const pluginPath = path.join(cwd, PLUGINS_DIR, bundle.name); | ||
| const pluginPath = path.join(root, PLUGINS_DIR, bundle.name); | ||
| try { | ||
@@ -49,2 +75,3 @@ await fs.stat(pluginPath); | ||
| const errors = []; | ||
| const root = await resolvePluginRoot(cwd); | ||
| const bundles = await getPluginBundles(cwd); | ||
@@ -55,3 +82,3 @@ const bundle = bundles.find(b => b.name === name); | ||
| } | ||
| const pluginPath = path.join(cwd, PLUGINS_DIR, name); | ||
| const pluginPath = path.join(root, PLUGINS_DIR, name); | ||
| try { | ||
@@ -58,0 +85,0 @@ await fs.stat(pluginPath); |
+6
-6
| { | ||
| "name": "agent-powerups", | ||
| "version": "0.4.3", | ||
| "version": "0.5.0", | ||
| "description": "Local-first CLI for browsing, validating, running, and explicitly writing agent powerups.", | ||
@@ -23,7 +23,7 @@ "license": "Apache-2.0", | ||
| "cli", | ||
| "gemini-cli", | ||
| "gemini", | ||
| "skill-pack", | ||
| "plugin", | ||
| "gemini-cli-extension" | ||
| "gemini-cli", | ||
| "gemini", | ||
| "skill-pack", | ||
| "plugin", | ||
| "gemini-cli-extension" | ||
| ], | ||
@@ -30,0 +30,0 @@ "bin": { |
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 4 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 4 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1923410
0.05%15693
0.17%