@elizaos/cli 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -11
- package/dist/assets/{index-TLtd8ntA.js → index-BMJNV7A7.js} +2564 -1976
- package/dist/assets/{index-TLtd8ntA.js.map → index-BMJNV7A7.js.map} +1 -1
- package/dist/assets/index-DyA-lndn.css +1 -0
- package/dist/assets/index-DyA-lndn.css.br +0 -0
- package/dist/assets/{index-BlgsVC9v.js → index-zeG6Jws8.js} +2 -2
- package/dist/assets/index-zeG6Jws8.js.br +0 -0
- package/dist/assets/{index-BlgsVC9v.js.map → index-zeG6Jws8.js.map} +1 -1
- package/dist/chunk-2RXF3FKA.js +17 -0
- package/dist/chunk-3EAACNH2.js +478 -0
- package/dist/{chunk-YMKISDXM.js → chunk-4OL6NNBI.js} +34 -17
- package/dist/{chunk-MAGJ4VCL.js → chunk-CEMRVVKO.js} +8 -7
- package/dist/{chunk-O64SGQGU.js → chunk-IYVGVCIB.js} +270 -162
- package/dist/{chunk-LXYNBPDV.js → chunk-JOHBW4FN.js} +15 -9
- package/dist/{chunk-VWWF4TGX.js → chunk-JROMRXES.js} +39 -12
- package/dist/{chunk-4QRJ6FQC.js → chunk-SCN6ZP4J.js} +35 -15
- package/dist/{chunk-L64NPCT6.js → chunk-V2MPQGYW.js} +77 -68
- package/dist/{chunk-PHLX32YJ.js → chunk-WIPEH5RX.js} +39 -30
- package/dist/{chunk-RGI5263U.js → chunk-YMXO6XZ5.js} +902 -718
- package/dist/commands/agent.js +1 -1
- package/dist/commands/create.d.ts +1 -8
- package/dist/commands/create.js +2 -2
- package/dist/commands/dev.js +3 -2
- package/dist/commands/env.js +2 -2
- package/dist/commands/monorepo.d.ts +5 -0
- package/dist/commands/{setup-monorepo.js → monorepo.js} +4 -4
- package/dist/commands/plugins.js +2 -2
- package/dist/commands/publish.js +3 -3
- package/dist/commands/start.js +4 -3
- package/dist/commands/test.js +5 -4
- package/dist/commands/update.js +2 -2
- package/dist/index.html +2 -2
- package/dist/index.js +14 -13
- package/dist/{registry-A4UYBEET.js → registry-AV3SDTPW.js} +1 -1
- package/package.json +5 -5
- package/templates/plugin-starter/README.md +26 -9
- package/templates/plugin-starter/package.json +5 -1
- package/templates/plugin-starter/tsconfig.build.json +1 -3
- package/templates/plugin-starter/tsconfig.json +1 -2
- package/templates/plugin-starter/tsup.config.ts +1 -1
- package/templates/project-starter/README.md +15 -16
- package/templates/project-starter/package.json +5 -5
- package/templates/project-tee-starter/package.json +4 -4
- package/dist/assets/index-BlgsVC9v.js.br +0 -0
- package/dist/assets/index-fZleA996.css +0 -1
- package/dist/assets/index-fZleA996.css.br +0 -0
- package/dist/chunk-CR5NR6A6.js +0 -458
- package/dist/commands/setup-monorepo.d.ts +0 -5
|
@@ -5,12 +5,11 @@ const require = createRequire(import.meta.url);
|
|
|
5
5
|
import {
|
|
6
6
|
detectDirectoryType,
|
|
7
7
|
fetchPluginRegistry,
|
|
8
|
-
getDirectoryTypeDescription,
|
|
9
8
|
handleError,
|
|
10
9
|
installPlugin,
|
|
11
10
|
logHeader,
|
|
12
11
|
normalizePluginName
|
|
13
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YMXO6XZ5.js";
|
|
14
13
|
import {
|
|
15
14
|
Command
|
|
16
15
|
} from "./chunk-5J7S2CSH.js";
|
|
@@ -201,7 +200,7 @@ var getDependenciesFromDirectory = (cwd) => {
|
|
|
201
200
|
var plugins = new Command().name("plugins").description("Manage ElizaOS plugins").action(function() {
|
|
202
201
|
this.help({ showGlobals: false });
|
|
203
202
|
});
|
|
204
|
-
var pluginsCommand = plugins.command("list").aliases(["l", "ls"]).description("List available plugins to install into the project").option("--all", "List all plugins from the registry with detailed version info").option("--v0", "List only v0.x compatible plugins").action(async (opts) => {
|
|
203
|
+
var pluginsCommand = plugins.command("list").aliases(["l", "ls"]).description("List available plugins to install into the project (shows v1.x plugins by default)").option("--all", "List all plugins from the registry with detailed version info").option("--v0", "List only v0.x compatible plugins").action(async (opts) => {
|
|
205
204
|
try {
|
|
206
205
|
const cachedRegistry = await fetchPluginRegistry();
|
|
207
206
|
if (!cachedRegistry || !cachedRegistry.registry || Object.keys(cachedRegistry.registry).length === 0) {
|
|
@@ -257,11 +256,18 @@ Plugin: ${name}`);
|
|
|
257
256
|
}
|
|
258
257
|
});
|
|
259
258
|
plugins.command("add").alias("install").description("Add a plugin to the project").argument("<plugin>", 'plugins name (e.g., "abc", "plugin-abc", "elizaos/plugin-abc")').option("-s, --skip-env-prompt", "Skip prompting for environment variables").option("-b, --branch <branchName>", "Branch to install from when using monorepo source", "main").option("-T, --tag <tagname>", "Specify a tag to install (e.g., beta)").action(async (pluginArg, opts) => {
|
|
259
|
+
if (!pluginArg || !pluginArg.trim()) {
|
|
260
|
+
logger.error("Plugin name cannot be empty or whitespace-only.");
|
|
261
|
+
logger.info(
|
|
262
|
+
'Please provide a valid plugin name (e.g., "openai", "plugin-anthropic", "@elizaos/plugin-sql")'
|
|
263
|
+
);
|
|
264
|
+
process.exit(1);
|
|
265
|
+
}
|
|
260
266
|
const cwd = process.cwd();
|
|
261
267
|
const directoryInfo = detectDirectoryType(cwd);
|
|
262
|
-
if (!directoryInfo.hasPackageJson) {
|
|
268
|
+
if (!directoryInfo || !directoryInfo.hasPackageJson) {
|
|
263
269
|
logger.error(
|
|
264
|
-
`Command must be run inside an ElizaOS project directory. This directory is: ${
|
|
270
|
+
`Command must be run inside an ElizaOS project directory. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
|
|
265
271
|
);
|
|
266
272
|
process.exit(1);
|
|
267
273
|
}
|
|
@@ -360,9 +366,9 @@ plugins.command("installed-plugins").description("List plugins found in the proj
|
|
|
360
366
|
try {
|
|
361
367
|
const cwd = process.cwd();
|
|
362
368
|
const directoryInfo = detectDirectoryType(cwd);
|
|
363
|
-
if (!directoryInfo.hasPackageJson) {
|
|
369
|
+
if (!directoryInfo || !directoryInfo.hasPackageJson) {
|
|
364
370
|
console.error(
|
|
365
|
-
`Could not read or parse package.json. This directory is: ${
|
|
371
|
+
`Could not read or parse package.json. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
|
|
366
372
|
);
|
|
367
373
|
console.info("Please run this command from the root of an ElizaOS project.");
|
|
368
374
|
process.exit(1);
|
|
@@ -397,9 +403,9 @@ plugins.command("remove").aliases(["delete", "del", "rm"]).description("Remove a
|
|
|
397
403
|
try {
|
|
398
404
|
const cwd = process.cwd();
|
|
399
405
|
const directoryInfo = detectDirectoryType(cwd);
|
|
400
|
-
if (!directoryInfo.hasPackageJson) {
|
|
406
|
+
if (!directoryInfo || !directoryInfo.hasPackageJson) {
|
|
401
407
|
console.error(
|
|
402
|
-
`Could not read or parse package.json. This directory is: ${
|
|
408
|
+
`Could not read or parse package.json. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
|
|
403
409
|
);
|
|
404
410
|
process.exit(1);
|
|
405
411
|
}
|
|
@@ -8,20 +8,22 @@ import {
|
|
|
8
8
|
loadCharacterTryPath,
|
|
9
9
|
startAgent,
|
|
10
10
|
v4_default
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IYVGVCIB.js";
|
|
12
12
|
import {
|
|
13
13
|
character,
|
|
14
14
|
getElizaCharacter
|
|
15
15
|
} from "./chunk-335PGADS.js";
|
|
16
|
+
import {
|
|
17
|
+
validatePort
|
|
18
|
+
} from "./chunk-2RXF3FKA.js";
|
|
16
19
|
import {
|
|
17
20
|
TestRunner,
|
|
18
21
|
UserEnvironment,
|
|
19
22
|
buildProject,
|
|
20
23
|
detectDirectoryType,
|
|
21
24
|
promptForEnvVars,
|
|
22
|
-
require_main
|
|
23
|
-
|
|
24
|
-
} from "./chunk-RGI5263U.js";
|
|
25
|
+
require_main
|
|
26
|
+
} from "./chunk-YMXO6XZ5.js";
|
|
25
27
|
import {
|
|
26
28
|
Command,
|
|
27
29
|
Option
|
|
@@ -272,20 +274,31 @@ var runE2eTests = async (options, projectInfo) => {
|
|
|
272
274
|
const runtimes = [];
|
|
273
275
|
const projectAgents = [];
|
|
274
276
|
const elizaDir = path2.join(process.cwd(), ".eliza");
|
|
275
|
-
const
|
|
277
|
+
const packageName = path2.basename(process.cwd());
|
|
278
|
+
const timestamp = Date.now();
|
|
279
|
+
const uniqueDbDir = path2.join(process.cwd(), ".elizadb-test", `${packageName}-${timestamp}`);
|
|
280
|
+
const elizaDbDir = uniqueDbDir;
|
|
276
281
|
const envInfo = await UserEnvironment.getInstanceInfo();
|
|
277
282
|
const envFilePath = envInfo.paths.envFilePath;
|
|
278
283
|
console.info("Setting up environment...");
|
|
279
284
|
console.info(`Eliza directory: ${elizaDir}`);
|
|
280
285
|
console.info(`Database directory: ${elizaDbDir}`);
|
|
281
286
|
console.info(`Environment file: ${envFilePath}`);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
287
|
+
console.info(`Package name: ${packageName}, Timestamp: ${timestamp}`);
|
|
288
|
+
if (fs2.existsSync(elizaDbDir)) {
|
|
289
|
+
console.info(`Cleaning up existing database directory: ${elizaDbDir}`);
|
|
290
|
+
try {
|
|
291
|
+
fs2.rmSync(elizaDbDir, { recursive: true, force: true });
|
|
292
|
+
console.info(`Successfully cleaned up existing database directory`);
|
|
293
|
+
} catch (error) {
|
|
294
|
+
console.warn(`Failed to clean up existing database directory: ${error}`);
|
|
295
|
+
}
|
|
286
296
|
}
|
|
297
|
+
console.info(`Creating fresh database directory: ${elizaDbDir}`);
|
|
298
|
+
fs2.mkdirSync(elizaDbDir, { recursive: true });
|
|
299
|
+
console.info(`Created database directory: ${elizaDbDir}`);
|
|
287
300
|
process.env.PGLITE_DATA_DIR = elizaDbDir;
|
|
288
|
-
console.info(`
|
|
301
|
+
console.info(`Set PGLITE_DATA_DIR to: ${elizaDbDir}`);
|
|
289
302
|
if (fs2.existsSync(envFilePath)) {
|
|
290
303
|
console.info(`Loading environment variables from: ${envFilePath}`);
|
|
291
304
|
dotenv.config({ path: envFilePath });
|
|
@@ -578,6 +591,20 @@ var runE2eTests = async (options, projectInfo) => {
|
|
|
578
591
|
}
|
|
579
592
|
}
|
|
580
593
|
return { failed: true };
|
|
594
|
+
} finally {
|
|
595
|
+
try {
|
|
596
|
+
if (fs2.existsSync(elizaDbDir)) {
|
|
597
|
+
console.info(`Cleaning up test database directory: ${elizaDbDir}`);
|
|
598
|
+
fs2.rmSync(elizaDbDir, { recursive: true, force: true });
|
|
599
|
+
console.info(`Successfully cleaned up test database directory`);
|
|
600
|
+
}
|
|
601
|
+
const testDir = path2.dirname(elizaDbDir);
|
|
602
|
+
if (fs2.existsSync(testDir) && fs2.readdirSync(testDir).length === 0) {
|
|
603
|
+
fs2.rmSync(testDir, { recursive: true, force: true });
|
|
604
|
+
}
|
|
605
|
+
} catch (cleanupError) {
|
|
606
|
+
console.warn(`Failed to clean up test database directory: ${cleanupError}`);
|
|
607
|
+
}
|
|
581
608
|
}
|
|
582
609
|
} catch (error) {
|
|
583
610
|
console.error("Error in runE2eTests:", error);
|
|
@@ -670,8 +697,8 @@ test.command("all", { isDefault: true }).description("Run both component and e2e
|
|
|
670
697
|
}
|
|
671
698
|
});
|
|
672
699
|
test.addOption(
|
|
673
|
-
new Option("-p, --port <port>", "Server port for e2e tests").argParser(
|
|
674
|
-
|
|
700
|
+
new Option("-p, --port <port>", "Server port for e2e tests (default: 3000)").argParser(
|
|
701
|
+
validatePort
|
|
675
702
|
)
|
|
676
703
|
).option("-n, --name <n>", "Filter tests by name (matches file names or test suite names)").option("--skip-build", "Skip building before running tests");
|
|
677
704
|
function registerCommand(cli) {
|
|
@@ -8,13 +8,14 @@ import {
|
|
|
8
8
|
detectDirectoryType,
|
|
9
9
|
displayBanner,
|
|
10
10
|
executeInstallation,
|
|
11
|
-
getDirectoryTypeDescription,
|
|
12
11
|
getPackageManager,
|
|
13
12
|
handleError,
|
|
13
|
+
isCliInstalledViaNpm,
|
|
14
14
|
isRunningViaBunx,
|
|
15
15
|
isRunningViaNpx,
|
|
16
|
-
isValidForUpdates
|
|
17
|
-
|
|
16
|
+
isValidForUpdates,
|
|
17
|
+
migrateCliToBun
|
|
18
|
+
} from "./chunk-YMXO6XZ5.js";
|
|
18
19
|
import {
|
|
19
20
|
Command
|
|
20
21
|
} from "./chunk-5J7S2CSH.js";
|
|
@@ -190,8 +191,27 @@ async function performCliUpdate() {
|
|
|
190
191
|
return true;
|
|
191
192
|
}
|
|
192
193
|
console.log(`Updating CLI from ${currentVersion} to ${latestVersion}...`);
|
|
193
|
-
const
|
|
194
|
-
|
|
194
|
+
const npmInstallation = await isCliInstalledViaNpm();
|
|
195
|
+
if (npmInstallation) {
|
|
196
|
+
logger.info("Detected npm installation, migrating to bun...");
|
|
197
|
+
try {
|
|
198
|
+
await migrateCliToBun(latestVersion);
|
|
199
|
+
} catch (migrationError) {
|
|
200
|
+
logger.warn("Migration to bun failed, falling back to npm update...");
|
|
201
|
+
logger.debug("Migration error:", migrationError.message);
|
|
202
|
+
try {
|
|
203
|
+
await execa("npm", ["install", "-g", `@elizaos/cli@${latestVersion}`], {
|
|
204
|
+
stdio: "inherit"
|
|
205
|
+
});
|
|
206
|
+
} catch (npmError) {
|
|
207
|
+
throw new Error(
|
|
208
|
+
`Both bun migration and npm fallback failed. Bun: ${migrationError.message}, npm: ${npmError.message}`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
} else {
|
|
213
|
+
await executeInstallation("@elizaos/cli", latestVersion, process.cwd());
|
|
214
|
+
}
|
|
195
215
|
console.log(`CLI updated successfully to version ${latestVersion} [\u2713]`);
|
|
196
216
|
return true;
|
|
197
217
|
} catch (error) {
|
|
@@ -201,16 +221,10 @@ async function performCliUpdate() {
|
|
|
201
221
|
}
|
|
202
222
|
function handleInvalidDirectory(directoryInfo) {
|
|
203
223
|
const messages = {
|
|
204
|
-
|
|
205
|
-
"This
|
|
206
|
-
"To create a new ElizaOS project or plugin, use:",
|
|
207
|
-
" elizaos create <project-name> # Create a new project",
|
|
208
|
-
" elizaos create -t plugin <plugin-name> # Create a new plugin"
|
|
209
|
-
],
|
|
210
|
-
"non-elizaos-project": [
|
|
211
|
-
"This directory contains a project, but it doesn't appear to be an ElizaOS project.",
|
|
224
|
+
"non-elizaos-dir": [
|
|
225
|
+
"This directory doesn't appear to be an ElizaOS project.",
|
|
212
226
|
directoryInfo.packageName && `Found package: ${directoryInfo.packageName}`,
|
|
213
|
-
"ElizaOS update only works in ElizaOS projects and
|
|
227
|
+
"ElizaOS update only works in ElizaOS projects, plugins, the ElizaOS monorepo, and ElizaOS infrastructure packages (e.g. client, cli).",
|
|
214
228
|
"To create a new ElizaOS project, use: elizaos create <project-name>"
|
|
215
229
|
].filter(Boolean),
|
|
216
230
|
invalid: [
|
|
@@ -257,7 +271,13 @@ var update = new Command().name("update").description("Update ElizaOS CLI and pr
|
|
|
257
271
|
if (updatePackages) {
|
|
258
272
|
const cwd = process.cwd();
|
|
259
273
|
const directoryInfo = detectDirectoryType(cwd);
|
|
260
|
-
|
|
274
|
+
if (!directoryInfo) {
|
|
275
|
+
console.error("Cannot update packages in this directory.");
|
|
276
|
+
console.info("This directory is not accessible or does not exist.");
|
|
277
|
+
console.info("To create a new ElizaOS project, use: elizaos create <project-name>");
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
logger.debug(`Detected ${directoryInfo.type}`);
|
|
261
281
|
if (!isValidForUpdates(directoryInfo)) {
|
|
262
282
|
handleInvalidDirectory(directoryInfo);
|
|
263
283
|
return;
|
|
@@ -4,12 +4,11 @@ const require = createRequire(import.meta.url);
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
performCliUpdate
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SCN6ZP4J.js";
|
|
8
8
|
import {
|
|
9
9
|
REGISTRY_GITHUB_URL,
|
|
10
10
|
detectDirectoryType,
|
|
11
11
|
displayBanner,
|
|
12
|
-
getDirectoryTypeDescription,
|
|
13
12
|
getGitHubCredentials,
|
|
14
13
|
getRegistrySettings,
|
|
15
14
|
handleError,
|
|
@@ -19,7 +18,7 @@ import {
|
|
|
19
18
|
testPublishToGitHub,
|
|
20
19
|
testPublishToNpm,
|
|
21
20
|
validateDataDir
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-YMXO6XZ5.js";
|
|
23
22
|
import {
|
|
24
23
|
Command
|
|
25
24
|
} from "./chunk-5J7S2CSH.js";
|
|
@@ -241,6 +240,31 @@ async function getNpmUsername() {
|
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
}
|
|
243
|
+
function displayRegistryPublicationMessage(opts, userIsMaintainer, registryPrUrl) {
|
|
244
|
+
if (opts.skipRegistry) {
|
|
245
|
+
console.info("Registry publication skipped as requested with --skip-registry flag");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (opts.npm) {
|
|
249
|
+
console.warn("NPM publishing currently does not update the registry.");
|
|
250
|
+
console.info("To include this package in the registry:");
|
|
251
|
+
console.info(`1. Fork the registry repository at ${REGISTRY_GITHUB_URL}`);
|
|
252
|
+
console.info("2. Add your package metadata");
|
|
253
|
+
console.info("3. Submit a pull request to the main repository");
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (userIsMaintainer) {
|
|
257
|
+
if (!registryPrUrl) {
|
|
258
|
+
console.info("Registry publication completed during GitHub publishing process.");
|
|
259
|
+
}
|
|
260
|
+
} else {
|
|
261
|
+
console.info("Package published, but you're not a maintainer of this package.");
|
|
262
|
+
console.info("To include this package in the registry, please:");
|
|
263
|
+
console.info(`1. Fork the registry repository at ${REGISTRY_GITHUB_URL}`);
|
|
264
|
+
console.info("2. Add your package metadata");
|
|
265
|
+
console.info("3. Submit a pull request to the main repository");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
244
268
|
async function validatePluginRequirements(cwd, packageJson) {
|
|
245
269
|
const errors = [];
|
|
246
270
|
const warnings = [];
|
|
@@ -292,15 +316,15 @@ async function validatePluginRequirements(cwd, packageJson) {
|
|
|
292
316
|
}
|
|
293
317
|
}
|
|
294
318
|
}
|
|
295
|
-
var publish = new Command().name("publish").description("Publish a plugin to npm, GitHub, and the registry").option("
|
|
319
|
+
var publish = new Command().name("publish").description("Publish a plugin to npm, GitHub, and the registry").option("--npm", "publish to npm only (skip GitHub and registry)", false).option("-t, --test", "test publish process without making changes", false).option("-d, --dry-run", "generate registry files locally without publishing", false).option("-sr, --skip-registry", "skip publishing to the registry", false).hook("preAction", async () => {
|
|
296
320
|
await displayBanner();
|
|
297
321
|
}).action(async (opts) => {
|
|
298
322
|
try {
|
|
299
323
|
const cwd = process.cwd();
|
|
300
324
|
const directoryInfo = detectDirectoryType(cwd);
|
|
301
|
-
if (!directoryInfo.hasPackageJson) {
|
|
325
|
+
if (!directoryInfo || !directoryInfo.hasPackageJson) {
|
|
302
326
|
console.error(
|
|
303
|
-
`No package.json found in current directory. This directory is: ${
|
|
327
|
+
`No package.json found in current directory. This directory is: ${directoryInfo?.type || "invalid or inaccessible"}`
|
|
304
328
|
);
|
|
305
329
|
process.exit(1);
|
|
306
330
|
}
|
|
@@ -310,23 +334,25 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
310
334
|
console.error("This command must be run from a plugin directory (plugin-*)");
|
|
311
335
|
process.exit(1);
|
|
312
336
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
337
|
+
if (!opts.npm) {
|
|
338
|
+
const isValid = await validateDataDir();
|
|
339
|
+
if (!isValid) {
|
|
340
|
+
console.info("\nGitHub credentials required for publishing.");
|
|
341
|
+
console.info("You'll need a GitHub Personal Access Token with these scopes:");
|
|
342
|
+
console.info(" * repo (for repository access)");
|
|
343
|
+
console.info(" * read:org (for organization access)");
|
|
344
|
+
console.info(" * workflow (for workflow access)\n");
|
|
345
|
+
await initializeDataDir();
|
|
346
|
+
const credentials2 = await getGitHubCredentials();
|
|
347
|
+
if (!credentials2) {
|
|
348
|
+
console.error("GitHub credentials setup cancelled.");
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
const revalidated = await validateDataDir();
|
|
352
|
+
if (!revalidated) {
|
|
353
|
+
console.error("Failed to validate credentials after saving.");
|
|
354
|
+
process.exit(1);
|
|
355
|
+
}
|
|
330
356
|
}
|
|
331
357
|
}
|
|
332
358
|
const packageJsonPath = path.join(cwd, "package.json");
|
|
@@ -358,9 +384,7 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
358
384
|
detectedType = "project";
|
|
359
385
|
console.info("Detected project from package.json packageType field");
|
|
360
386
|
} else {
|
|
361
|
-
console.info(
|
|
362
|
-
`Defaulting to plugin type. Directory detected as: ${getDirectoryTypeDescription(directoryInfo)}`
|
|
363
|
-
);
|
|
387
|
+
console.info(`Defaulting to plugin type. Directory detected as: ${directoryInfo.type}`);
|
|
364
388
|
}
|
|
365
389
|
}
|
|
366
390
|
packageJson.packageType = detectedType;
|
|
@@ -387,15 +411,13 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
387
411
|
process.exit(0);
|
|
388
412
|
}
|
|
389
413
|
}
|
|
390
|
-
let credentials =
|
|
391
|
-
if (!
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
if (!newCredentials) {
|
|
414
|
+
let credentials = null;
|
|
415
|
+
if (!opts.npm) {
|
|
416
|
+
credentials = await getGitHubCredentials();
|
|
417
|
+
if (!credentials) {
|
|
418
|
+
console.error("GitHub credentials required for publishing.");
|
|
396
419
|
process.exit(1);
|
|
397
420
|
}
|
|
398
|
-
credentials = newCredentials;
|
|
399
421
|
}
|
|
400
422
|
const npmUsername = await getNpmUsername();
|
|
401
423
|
console.info(`Using NPM username: ${npmUsername}`);
|
|
@@ -425,9 +447,9 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
425
447
|
console.info(`Set description: ${packageJson.description}`);
|
|
426
448
|
}
|
|
427
449
|
},
|
|
428
|
-
// Repository URL placeholder
|
|
450
|
+
// Repository URL placeholder (only for GitHub publishing)
|
|
429
451
|
"${REPO_URL}": {
|
|
430
|
-
check: () => packageJson.repository && (packageJson.repository.url === "${REPO_URL}" || packageJson.repository.url === ""),
|
|
452
|
+
check: () => !opts.npm && credentials && packageJson.repository && (packageJson.repository.url === "${REPO_URL}" || packageJson.repository.url === ""),
|
|
431
453
|
replace: () => {
|
|
432
454
|
if (!packageJson.repository) {
|
|
433
455
|
packageJson.repository = { type: "git", url: "" };
|
|
@@ -436,17 +458,17 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
436
458
|
console.info(`Set repository: ${packageJson.repository.url}`);
|
|
437
459
|
}
|
|
438
460
|
},
|
|
439
|
-
// Author placeholder
|
|
461
|
+
// Author placeholder (only for GitHub publishing)
|
|
440
462
|
"${GITHUB_USERNAME}": {
|
|
441
|
-
check: () => packageJson.author === "${GITHUB_USERNAME}",
|
|
463
|
+
check: () => !opts.npm && credentials && packageJson.author === "${GITHUB_USERNAME}",
|
|
442
464
|
replace: () => {
|
|
443
465
|
packageJson.author = credentials.username;
|
|
444
466
|
console.info(`Set author: ${packageJson.author}`);
|
|
445
467
|
}
|
|
446
468
|
},
|
|
447
|
-
// Bugs URL placeholder
|
|
469
|
+
// Bugs URL placeholder (only for GitHub publishing)
|
|
448
470
|
"bugs-placeholder": {
|
|
449
|
-
check: () => packageJson.bugs && packageJson.bugs.url && packageJson.bugs.url.includes("${GITHUB_USERNAME}"),
|
|
471
|
+
check: () => !opts.npm && credentials && packageJson.bugs && packageJson.bugs.url && packageJson.bugs.url.includes("${GITHUB_USERNAME}"),
|
|
450
472
|
replace: () => {
|
|
451
473
|
packageJson.bugs.url = packageJson.bugs.url.replace("${GITHUB_USERNAME}", credentials.username).replace("${PLUGINNAME}", pluginDirName);
|
|
452
474
|
console.info(`Set bugs URL: ${packageJson.bugs.url}`);
|
|
@@ -462,9 +484,10 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
462
484
|
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2), "utf-8");
|
|
463
485
|
await validatePluginRequirements(cwd, packageJson);
|
|
464
486
|
const settings = await getRegistrySettings();
|
|
487
|
+
const publishUsername = credentials ? credentials.username : npmUsername;
|
|
465
488
|
settings.publishConfig = {
|
|
466
489
|
registry: settings.defaultRegistry,
|
|
467
|
-
username:
|
|
490
|
+
username: publishUsername,
|
|
468
491
|
useNpm: opts.npm,
|
|
469
492
|
platform: packageJson.platform
|
|
470
493
|
};
|
|
@@ -472,12 +495,12 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
472
495
|
const packageMetadata = await generatePackageMetadata(
|
|
473
496
|
packageJson,
|
|
474
497
|
cliVersion,
|
|
475
|
-
|
|
498
|
+
publishUsername
|
|
476
499
|
);
|
|
477
500
|
console.debug("Generated package metadata:", packageMetadata);
|
|
478
|
-
const userIsMaintainer = isMaintainer(packageJson,
|
|
501
|
+
const userIsMaintainer = isMaintainer(packageJson, publishUsername);
|
|
479
502
|
console.info(
|
|
480
|
-
`User ${
|
|
503
|
+
`User ${publishUsername} is ${userIsMaintainer ? "a maintainer" : "not a maintainer"} of this package`
|
|
481
504
|
);
|
|
482
505
|
if (opts.dryRun) {
|
|
483
506
|
console.info(`Running dry run for plugin registry publication...`);
|
|
@@ -525,6 +548,7 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
525
548
|
return;
|
|
526
549
|
}
|
|
527
550
|
let publishResult = false;
|
|
551
|
+
let publishedToGitHub = false;
|
|
528
552
|
let registryPrUrl = null;
|
|
529
553
|
console.info(`Publishing plugin to npm...`);
|
|
530
554
|
if (!packageJson.npmPackage || packageJson.npmPackage === "${NPM_PACKAGE}") {
|
|
@@ -552,46 +576,31 @@ var publish = new Command().name("publish").description("Publish a plugin to npm
|
|
|
552
576
|
if (!publishResult) {
|
|
553
577
|
process.exit(1);
|
|
554
578
|
}
|
|
579
|
+
publishedToGitHub = true;
|
|
555
580
|
console.log(
|
|
556
581
|
`[\u221A] Successfully published plugin ${packageJson.name}@${packageJson.version} to GitHub`
|
|
557
582
|
);
|
|
558
583
|
packageMetadata.githubRepo = `${credentials.username}/${finalPluginName}`;
|
|
559
|
-
if (typeof publishResult === "object" && publishResult.prUrl) {
|
|
584
|
+
if (typeof publishResult === "object" && publishResult.prUrl && !opts.skipRegistry) {
|
|
560
585
|
registryPrUrl = publishResult.prUrl;
|
|
561
586
|
console.log(`[\u221A] Registry pull request created: ${registryPrUrl}`);
|
|
562
587
|
}
|
|
563
588
|
}
|
|
564
|
-
|
|
565
|
-
console.info("Publishing to registry...");
|
|
566
|
-
if (userIsMaintainer) {
|
|
567
|
-
if (!opts.npm) {
|
|
568
|
-
console.info("Registry PR was created during GitHub publishing process.");
|
|
569
|
-
} else {
|
|
570
|
-
console.warn("NPM publishing currently does not update the registry.");
|
|
571
|
-
console.info("To include this package in the registry:");
|
|
572
|
-
console.info(`1. Fork the registry repository at ${REGISTRY_GITHUB_URL}`);
|
|
573
|
-
console.info("2. Add your package metadata");
|
|
574
|
-
console.info("3. Submit a pull request to the main repository");
|
|
575
|
-
}
|
|
576
|
-
} else {
|
|
577
|
-
console.info("Package published, but you're not a maintainer of this package.");
|
|
578
|
-
console.info("To include this package in the registry, please:");
|
|
579
|
-
console.info(`1. Fork the registry repository at ${REGISTRY_GITHUB_URL}`);
|
|
580
|
-
console.info("2. Add your package metadata");
|
|
581
|
-
console.info("3. Submit a pull request to the main repository");
|
|
582
|
-
}
|
|
583
|
-
} else {
|
|
584
|
-
console.info("Skipping registry publication as requested with --skip-registry flag");
|
|
585
|
-
}
|
|
589
|
+
displayRegistryPublicationMessage(opts, userIsMaintainer, registryPrUrl);
|
|
586
590
|
console.log(`Successfully published plugin ${packageJson.name}@${packageJson.version}`);
|
|
587
591
|
console.log("\nYour plugin is now available at:");
|
|
588
|
-
console.log(`https://
|
|
592
|
+
console.log(`NPM: https://www.npmjs.com/package/${packageJson.name}`);
|
|
593
|
+
if (publishedToGitHub && credentials) {
|
|
594
|
+
console.log(`GitHub: https://github.com/${credentials.username}/${finalPluginName}`);
|
|
595
|
+
}
|
|
589
596
|
console.log("\n[\u{1F4DD}] Important: For future updates to your plugin:");
|
|
590
597
|
console.log(" Use standard npm and git workflows, not the ElizaOS CLI:");
|
|
591
598
|
console.log(" 1. Make your changes and test locally");
|
|
592
599
|
console.log(" 2. Update version: npm version patch|minor|major");
|
|
593
600
|
console.log(" 3. Publish to npm: npm publish");
|
|
594
|
-
|
|
601
|
+
if (publishedToGitHub) {
|
|
602
|
+
console.log(" 4. Push to GitHub: git push origin main && git push --tags");
|
|
603
|
+
}
|
|
595
604
|
console.log("\n The ElizaOS registry will automatically sync with npm updates.");
|
|
596
605
|
console.log(' Only use "elizaos publish" for initial publishing of new plugins.');
|
|
597
606
|
} catch (error) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
handleError,
|
|
9
9
|
require_main,
|
|
10
10
|
resolvePgliteDir
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YMXO6XZ5.js";
|
|
12
12
|
import {
|
|
13
13
|
Command
|
|
14
14
|
} from "./chunk-5J7S2CSH.js";
|
|
@@ -7504,19 +7504,27 @@ async function editEnvVars(scope, fromMainMenu = false, yes = false) {
|
|
|
7504
7504
|
Current ${scope} environment variables:`));
|
|
7505
7505
|
if (Object.keys(envVars).length === 0) {
|
|
7506
7506
|
console.info(` No ${scope} environment variables set`);
|
|
7507
|
-
|
|
7508
|
-
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7507
|
+
let addNew = true;
|
|
7508
|
+
if (!yes) {
|
|
7509
|
+
const resp = await (0, import_prompts.default)({
|
|
7510
|
+
type: "confirm",
|
|
7511
|
+
name: "addNew",
|
|
7512
|
+
message: "Would you like to add a new environment variable?",
|
|
7513
|
+
initial: true
|
|
7514
|
+
});
|
|
7515
|
+
addNew = resp.addNew;
|
|
7516
|
+
}
|
|
7513
7517
|
if (addNew) {
|
|
7514
|
-
await addNewVariable(envPath, envVars);
|
|
7518
|
+
await addNewVariable(envPath, envVars, yes);
|
|
7515
7519
|
}
|
|
7516
7520
|
return fromMainMenu;
|
|
7517
7521
|
}
|
|
7518
7522
|
let exit = false;
|
|
7519
7523
|
let returnToMain = false;
|
|
7524
|
+
if (yes) {
|
|
7525
|
+
console.log("\u2705 Environment variables displayed. Use interactive mode without -y to edit.");
|
|
7526
|
+
return fromMainMenu;
|
|
7527
|
+
}
|
|
7520
7528
|
while (!exit) {
|
|
7521
7529
|
const entries = Object.entries(envVars);
|
|
7522
7530
|
const choices = [
|
|
@@ -7542,7 +7550,7 @@ Current ${scope} environment variables:`));
|
|
|
7542
7550
|
continue;
|
|
7543
7551
|
}
|
|
7544
7552
|
if (selection === "add_new") {
|
|
7545
|
-
await addNewVariable(envPath, envVars);
|
|
7553
|
+
await addNewVariable(envPath, envVars, yes);
|
|
7546
7554
|
continue;
|
|
7547
7555
|
}
|
|
7548
7556
|
const { action } = await (0, import_prompts.default)({
|
|
@@ -7590,7 +7598,13 @@ Current ${scope} environment variables:`));
|
|
|
7590
7598
|
}
|
|
7591
7599
|
return returnToMain && fromMainMenu;
|
|
7592
7600
|
}
|
|
7593
|
-
async function addNewVariable(envPath, envVars) {
|
|
7601
|
+
async function addNewVariable(envPath, envVars, yes = false) {
|
|
7602
|
+
if (yes) {
|
|
7603
|
+
console.log(
|
|
7604
|
+
"Auto-confirmation mode enabled - skipping variable addition in edit-local -y mode"
|
|
7605
|
+
);
|
|
7606
|
+
return;
|
|
7607
|
+
}
|
|
7594
7608
|
const { key } = await (0, import_prompts.default)({
|
|
7595
7609
|
type: "text",
|
|
7596
7610
|
name: "key",
|
|
@@ -7786,13 +7800,13 @@ env.command("list").description("List all environment variables").option("--syst
|
|
|
7786
7800
|
` Package Manager: ${base_exports.cyan(envInfo.packageManager.name)}${envInfo.packageManager.version ? ` v${envInfo.packageManager.version}` : ""}`
|
|
7787
7801
|
);
|
|
7788
7802
|
} else if (options.local) {
|
|
7803
|
+
console.info(base_exports.bold("\nLocal Environment Variables:"));
|
|
7789
7804
|
const localEnvPath = await getLocalEnvPath();
|
|
7790
|
-
if (!localEnvPath) {
|
|
7791
|
-
console.
|
|
7805
|
+
if (!localEnvPath || !existsSync(localEnvPath)) {
|
|
7806
|
+
console.info(" No local .env file found in the current directory");
|
|
7792
7807
|
return;
|
|
7793
7808
|
}
|
|
7794
7809
|
const localEnvVars = await parseEnvFile(localEnvPath);
|
|
7795
|
-
console.info(base_exports.bold("\nLocal environment variables (.env):"));
|
|
7796
7810
|
if (Object.keys(localEnvVars).length === 0) {
|
|
7797
7811
|
console.info(" No local environment variables set");
|
|
7798
7812
|
} else {
|
|
@@ -7845,23 +7859,18 @@ env.action(() => {
|
|
|
7845
7859
|
async function showMainMenu(yes = false) {
|
|
7846
7860
|
let exit = false;
|
|
7847
7861
|
while (!exit) {
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7854
|
-
|
|
7855
|
-
|
|
7856
|
-
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
{ title: "Exit", value: "exit" }
|
|
7861
|
-
]
|
|
7862
|
-
});
|
|
7863
|
-
action = resp.action;
|
|
7864
|
-
}
|
|
7862
|
+
const resp = await (0, import_prompts.default)({
|
|
7863
|
+
type: "select",
|
|
7864
|
+
name: "action",
|
|
7865
|
+
message: "Select an action:",
|
|
7866
|
+
choices: [
|
|
7867
|
+
{ title: "List environment variables", value: "list" },
|
|
7868
|
+
{ title: "Edit local environment variables", value: "edit_local" },
|
|
7869
|
+
{ title: "Reset environment variables", value: "reset" },
|
|
7870
|
+
{ title: "Exit", value: "exit" }
|
|
7871
|
+
]
|
|
7872
|
+
});
|
|
7873
|
+
const action = resp.action;
|
|
7865
7874
|
if (!action || action === "exit") {
|
|
7866
7875
|
exit = true;
|
|
7867
7876
|
continue;
|