-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix plugins installing during init and plugins add #3451
Open
HashWarlock
wants to merge
3
commits into
v2-develop
Choose a base branch
from
hash/fix-plugins-install
base: v2-develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+65
−19
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# No configuration needed for SQLite | ||
# No configuration needed for SQLite | ||
ELIZA_BRANCH=v2-develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { execa } from "execa"; | ||
import path from "node:path"; | ||
import { logger } from "@/src/utils/logger"; | ||
import { runBunCommand } from "@/src/utils/run-bun"; | ||
import { promises as fs } from "fs"; | ||
|
||
export async function installPlugin( | ||
pluginName: string, | ||
cwd: string, | ||
): Promise<void> { | ||
// Remove 'github:' or leading '@' prefix if present | ||
const cleanedName = pluginName.replace(/^github:|^@/, ""); | ||
let installed = false; | ||
try { | ||
//logger.info(`Attempting to install ${pluginName} using bun add...`); | ||
//await runBunCommand(["add", `${pluginName}`], cwd); | ||
//logger.success(`Successfully installed ${pluginName} via bun add.`); | ||
//installed = true; | ||
// Set the directory to clone into the packages folder (each plugin gets its own subfolder) | ||
const cloneDir = path.join(cwd, "packages", cleanedName.replace(/\S+\//, "")); | ||
logger.info(`Cloning ${pluginName} from https://github.com/${cleanedName}.git to ${cloneDir}`); | ||
await execa("git",["clone", `https://github.com/${cleanedName}.git`, cloneDir],{ cwd, stdio: "inherit" }); | ||
logger.success(`Successfully cloned repository for ${cleanedName}.`); | ||
installed = true; | ||
} catch (error: any) { | ||
logger.warn( | ||
`failed to install packages for ${cleanedName}, falling back: ${error.message}` | ||
); | ||
} | ||
|
||
if (installed) { | ||
// Try to read the package.json file from the cloned plugin repo | ||
let pkgName = cleanedName; | ||
const pkgPath = path.join(cwd, "packages", cleanedName.replace(/\S+\//, ""), "package.json"); | ||
try { | ||
const pkgContent = await fs.readFile(pkgPath, "utf-8"); | ||
const pkg = JSON.parse(pkgContent); | ||
if (pkg.name) { | ||
pkgName = pkg.name; | ||
logger.info(`Found package.json name: ${pkgName}`); | ||
} | ||
} catch (err: any) { | ||
logger.warn(`Could not read package.json from ${pkgPath}: ${err.message}`); | ||
} | ||
|
||
logger.info(`Adding ${pkgName} to workspace's agent package (packages/agent/package.json)...`); | ||
await runBunCommand( | ||
["add", `${pkgName}@workspace:*`, "--filter", "./packages/agent"], | ||
cwd | ||
); | ||
logger.success(`Successfully added ${pkgName} to agent workspace.`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { execa } from "execa"; | ||
|
||
export async function runBunCommand(args: string[], cwd: string): Promise<void> { | ||
await execa("bun", args, { cwd, stdio: "inherit" }); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
console.log
statement appears to be a debugging artifact and should be removed before merging.Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.