poe-code 3.0.19 → 3.0.20
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/dist/cli/command-not-found.d.ts +8 -0
- package/dist/cli/command-not-found.js +34 -0
- package/dist/cli/command-not-found.js.map +1 -0
- package/dist/cli/commands/generate.js +3 -4
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/mcp.js +11 -1
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/skill.js +11 -1
- package/dist/cli/commands/skill.js.map +1 -1
- package/dist/cli/logger.js +6 -3
- package/dist/cli/logger.js.map +1 -1
- package/dist/cli/program.js +106 -51
- package/dist/cli/program.js.map +1 -1
- package/dist/index.js +309 -162
- package/dist/index.js.map +4 -4
- package/dist/utils/execution-context.d.ts +8 -0
- package/dist/utils/execution-context.js +23 -0
- package/dist/utils/execution-context.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13758,13 +13758,6 @@ var require_dist = __commonJS({
|
|
|
13758
13758
|
}
|
|
13759
13759
|
});
|
|
13760
13760
|
|
|
13761
|
-
// packages/agent-skill-config/src/templates/poe-generate.md
|
|
13762
|
-
var require_poe_generate = __commonJS({
|
|
13763
|
-
"packages/agent-skill-config/src/templates/poe-generate.md"(exports, module) {
|
|
13764
|
-
module.exports = '---\nname: poe-generate\ndescription: \'Poe code generation skill\'\n---\n\n# poe-code generate\n\nUse `poe-code generate` to create text, images, audio, or video via the Poe API.\n\n## Text generation\n\n```bash\npoe-code generate "Write a short function that parses a JSON string safely."\n```\n\nSpecify the model/bot:\n\n```bash\n# CLI option\npoe-code generate --model "gpt-4.1" "Summarize this codebase change."\n\n# Some agent runtimes call the model selector `--bot`\npoe-code generate --bot "gpt-4.1" "Summarize this codebase change."\n```\n\n## Media generation\n\nThe CLI supports media generation as subcommands:\n\n```bash\npoe-code generate image "A 3D render of a rubber duck wearing sunglasses" --model "gpt-image-1" -o duck.png\npoe-code generate video "A cinematic timelapse of a city at night" --model "veo" -o city.mp4\npoe-code generate audio "A calm 10 second lo-fi beat" --model "audio-model" -o beat.wav\n```\n\nSome agent runtimes expose the same media types as flags. If available, these are equivalent:\n\n```bash\npoe-code generate --image "A 3D render of a rubber duck wearing sunglasses" --bot "gpt-image-1" -o duck.png\npoe-code generate --video "A cinematic timelapse of a city at night" --bot "veo" -o city.mp4\npoe-code generate --audio "A calm 10 second lo-fi beat" --bot "audio-model" -o beat.wav\n```\n\n## Tips\n\n- Use `--param key=value` to pass provider/model parameters (repeatable).\n- Use `--output <path>` (or `-o`) for media outputs.\n';
|
|
13765
|
-
}
|
|
13766
|
-
});
|
|
13767
|
-
|
|
13768
13761
|
// src/cli/program.ts
|
|
13769
13762
|
import { Command } from "commander";
|
|
13770
13763
|
|
|
@@ -15074,6 +15067,26 @@ function createLogger(emitter) {
|
|
|
15074
15067
|
}
|
|
15075
15068
|
var logger = createLogger();
|
|
15076
15069
|
|
|
15070
|
+
// packages/design-system/src/components/command-errors.ts
|
|
15071
|
+
function formatCommandNotFound(input) {
|
|
15072
|
+
const unknown2 = input.unknownCommand.length > 0 ? input.unknownCommand : "<command>";
|
|
15073
|
+
return {
|
|
15074
|
+
label: `${typography.bold("Unknown command:")} ${text.command(unknown2)}`,
|
|
15075
|
+
hint: `${text.muted("Run")} ${text.usageCommand(input.helpCommand)} ${text.muted("for available commands.")}`
|
|
15076
|
+
};
|
|
15077
|
+
}
|
|
15078
|
+
function formatCommandNotFoundPanel(input) {
|
|
15079
|
+
const message = formatCommandNotFound({
|
|
15080
|
+
unknownCommand: input.unknownCommand,
|
|
15081
|
+
helpCommand: input.helpCommand
|
|
15082
|
+
});
|
|
15083
|
+
return {
|
|
15084
|
+
title: input.title ?? "command not found",
|
|
15085
|
+
label: message.label,
|
|
15086
|
+
footer: message.hint
|
|
15087
|
+
};
|
|
15088
|
+
}
|
|
15089
|
+
|
|
15077
15090
|
// packages/design-system/src/acp/index.ts
|
|
15078
15091
|
var acp_exports = {};
|
|
15079
15092
|
__export(acp_exports, {
|
|
@@ -15148,6 +15161,9 @@ function renderError(message) {
|
|
|
15148
15161
|
function intro(title) {
|
|
15149
15162
|
Ie(text.intro(title));
|
|
15150
15163
|
}
|
|
15164
|
+
function introPlain(title) {
|
|
15165
|
+
Ie(title);
|
|
15166
|
+
}
|
|
15151
15167
|
function outro(message) {
|
|
15152
15168
|
Se(message);
|
|
15153
15169
|
}
|
|
@@ -15293,8 +15309,11 @@ function createLoggerFactory(emitter, theme) {
|
|
|
15293
15309
|
emitter(title);
|
|
15294
15310
|
return;
|
|
15295
15311
|
}
|
|
15296
|
-
|
|
15297
|
-
|
|
15312
|
+
if (theme?.intro) {
|
|
15313
|
+
introPlain(theme.intro(title));
|
|
15314
|
+
return;
|
|
15315
|
+
}
|
|
15316
|
+
intro(title);
|
|
15298
15317
|
},
|
|
15299
15318
|
resolved(label, value) {
|
|
15300
15319
|
if (emitter) {
|
|
@@ -19807,7 +19826,7 @@ function registerGenerateCommand(program, container) {
|
|
|
19807
19826
|
);
|
|
19808
19827
|
return;
|
|
19809
19828
|
}
|
|
19810
|
-
intro(
|
|
19829
|
+
intro("generate");
|
|
19811
19830
|
const client = await resolveClient(container);
|
|
19812
19831
|
const response = await withSpinner({
|
|
19813
19832
|
message: `Generating with ${model}...`,
|
|
@@ -19838,7 +19857,7 @@ function registerGenerateCommand(program, container) {
|
|
|
19838
19857
|
);
|
|
19839
19858
|
return;
|
|
19840
19859
|
}
|
|
19841
|
-
intro(
|
|
19860
|
+
intro("generate text");
|
|
19842
19861
|
const client = await resolveClient(container);
|
|
19843
19862
|
const response = await withSpinner({
|
|
19844
19863
|
message: `Generating with ${model}...`,
|
|
@@ -19875,7 +19894,7 @@ function registerMediaSubcommand(generate2, program, container, type) {
|
|
|
19875
19894
|
);
|
|
19876
19895
|
return;
|
|
19877
19896
|
}
|
|
19878
|
-
intro(
|
|
19897
|
+
intro(`generate ${type}`);
|
|
19879
19898
|
const client = await resolveClient(container);
|
|
19880
19899
|
const saved = await withSpinner({
|
|
19881
19900
|
message: `Generating ${type} with ${model}...`,
|
|
@@ -33171,6 +33190,155 @@ function parseMcpOutputFormatPreferences(value) {
|
|
|
33171
33190
|
return preferences;
|
|
33172
33191
|
}
|
|
33173
33192
|
|
|
33193
|
+
// src/utils/execution-context.ts
|
|
33194
|
+
import { dirname } from "node:path";
|
|
33195
|
+
import { fileURLToPath } from "node:url";
|
|
33196
|
+
function detectExecutionContext(input) {
|
|
33197
|
+
const { argv, env, moduleUrl } = input;
|
|
33198
|
+
if (isDevelopmentMode(argv, env)) {
|
|
33199
|
+
return createDevelopmentContext(moduleUrl);
|
|
33200
|
+
}
|
|
33201
|
+
if (isNpxExecution(env)) {
|
|
33202
|
+
const version2 = detectNpxVersion(env);
|
|
33203
|
+
return createNpxContext(version2);
|
|
33204
|
+
}
|
|
33205
|
+
return {
|
|
33206
|
+
mode: "global",
|
|
33207
|
+
command: {
|
|
33208
|
+
command: "poe-code",
|
|
33209
|
+
args: []
|
|
33210
|
+
}
|
|
33211
|
+
};
|
|
33212
|
+
}
|
|
33213
|
+
function isDevelopmentMode(argv, env) {
|
|
33214
|
+
const scriptPath = argv[1] ?? "";
|
|
33215
|
+
if (scriptPath.endsWith(".ts") || scriptPath.includes("/src/")) {
|
|
33216
|
+
return true;
|
|
33217
|
+
}
|
|
33218
|
+
if (env.npm_lifecycle_event === "dev") {
|
|
33219
|
+
return true;
|
|
33220
|
+
}
|
|
33221
|
+
const nodeOptions = env.NODE_OPTIONS ?? "";
|
|
33222
|
+
if (nodeOptions.includes("tsx") || nodeOptions.includes("ts-node")) {
|
|
33223
|
+
return true;
|
|
33224
|
+
}
|
|
33225
|
+
return false;
|
|
33226
|
+
}
|
|
33227
|
+
function isNpxExecution(env) {
|
|
33228
|
+
const execPath = env.npm_execpath ?? "";
|
|
33229
|
+
if (execPath.includes("npx") || execPath.includes("npm")) {
|
|
33230
|
+
const packagePath = env.npm_package_json ?? "";
|
|
33231
|
+
if (packagePath.includes("_npx") || packagePath.includes(".npm/_cacache")) {
|
|
33232
|
+
return true;
|
|
33233
|
+
}
|
|
33234
|
+
}
|
|
33235
|
+
if (env.npm_command === "exec") {
|
|
33236
|
+
return true;
|
|
33237
|
+
}
|
|
33238
|
+
return false;
|
|
33239
|
+
}
|
|
33240
|
+
function detectNpxVersion(env) {
|
|
33241
|
+
const packageJson = env.npm_package_json ?? "";
|
|
33242
|
+
const packageVersion = env.npm_package_version ?? "";
|
|
33243
|
+
if (packageJson.includes("@beta") || packageVersion.includes("beta")) {
|
|
33244
|
+
return "beta";
|
|
33245
|
+
}
|
|
33246
|
+
if (packageJson.includes("@latest")) {
|
|
33247
|
+
return "latest";
|
|
33248
|
+
}
|
|
33249
|
+
return "default";
|
|
33250
|
+
}
|
|
33251
|
+
function createDevelopmentContext(moduleUrl) {
|
|
33252
|
+
const modulePath = fileURLToPath(moduleUrl);
|
|
33253
|
+
const srcIndex = modulePath.lastIndexOf("/src/");
|
|
33254
|
+
const projectRoot = srcIndex !== -1 ? modulePath.substring(0, srcIndex) : dirname(dirname(modulePath));
|
|
33255
|
+
return {
|
|
33256
|
+
mode: "development",
|
|
33257
|
+
command: {
|
|
33258
|
+
command: "npm",
|
|
33259
|
+
args: ["--silent", "--prefix", projectRoot, "run", "dev", "--"]
|
|
33260
|
+
}
|
|
33261
|
+
};
|
|
33262
|
+
}
|
|
33263
|
+
function createNpxContext(version2) {
|
|
33264
|
+
const packageSpec = version2 === "default" ? "poe-code" : `poe-code@${version2}`;
|
|
33265
|
+
return {
|
|
33266
|
+
mode: version2 === "default" ? "npx" : `npx-${version2}`,
|
|
33267
|
+
command: {
|
|
33268
|
+
command: "npx",
|
|
33269
|
+
args: ["--yes", packageSpec]
|
|
33270
|
+
}
|
|
33271
|
+
};
|
|
33272
|
+
}
|
|
33273
|
+
function toMcpServerCommand(execCommand, subcommand) {
|
|
33274
|
+
return {
|
|
33275
|
+
command: execCommand.command,
|
|
33276
|
+
args: [...execCommand.args, subcommand]
|
|
33277
|
+
};
|
|
33278
|
+
}
|
|
33279
|
+
function formatCliHelpCommand(context, args) {
|
|
33280
|
+
const base = formatCliUsageCommand(context);
|
|
33281
|
+
const trailing = args.join(" ");
|
|
33282
|
+
if (trailing.length === 0) {
|
|
33283
|
+
return base;
|
|
33284
|
+
}
|
|
33285
|
+
return `${base} ${trailing}`;
|
|
33286
|
+
}
|
|
33287
|
+
function formatCliUsageCommand(context) {
|
|
33288
|
+
switch (context.mode) {
|
|
33289
|
+
case "development":
|
|
33290
|
+
return "npm run dev --";
|
|
33291
|
+
case "npx":
|
|
33292
|
+
return "npx poe-code";
|
|
33293
|
+
case "npx-latest":
|
|
33294
|
+
return "npx poe-code@latest";
|
|
33295
|
+
case "npx-beta":
|
|
33296
|
+
return "npx poe-code@beta";
|
|
33297
|
+
case "global":
|
|
33298
|
+
default:
|
|
33299
|
+
return "poe-code";
|
|
33300
|
+
}
|
|
33301
|
+
}
|
|
33302
|
+
function getCurrentExecutionContext(moduleUrl) {
|
|
33303
|
+
return detectExecutionContext({
|
|
33304
|
+
argv: process.argv,
|
|
33305
|
+
env: process.env,
|
|
33306
|
+
moduleUrl
|
|
33307
|
+
});
|
|
33308
|
+
}
|
|
33309
|
+
|
|
33310
|
+
// src/cli/command-not-found.ts
|
|
33311
|
+
function throwCommandNotFound(input) {
|
|
33312
|
+
const { container, scope, unknownCommand, helpArgs, moduleUrl } = input;
|
|
33313
|
+
const context = detectExecutionContext({
|
|
33314
|
+
argv: process.argv,
|
|
33315
|
+
env: container.env.variables,
|
|
33316
|
+
moduleUrl
|
|
33317
|
+
});
|
|
33318
|
+
const helpCommand = formatCliHelpCommand(context, helpArgs);
|
|
33319
|
+
const panel = formatCommandNotFoundPanel({
|
|
33320
|
+
title: scope === "cli" ? "command not found" : `${scope} command not found`,
|
|
33321
|
+
unknownCommand,
|
|
33322
|
+
helpCommand
|
|
33323
|
+
});
|
|
33324
|
+
const logger2 = container.loggerFactory.create({
|
|
33325
|
+
dryRun: false,
|
|
33326
|
+
verbose: false,
|
|
33327
|
+
scope
|
|
33328
|
+
});
|
|
33329
|
+
const shouldRenderIntroOutro = container.dependencies.logger == null;
|
|
33330
|
+
if (shouldRenderIntroOutro) {
|
|
33331
|
+
logger2.intro(panel.title);
|
|
33332
|
+
M2.message(panel.label, { symbol: symbols.errorResolved });
|
|
33333
|
+
outro(panel.footer);
|
|
33334
|
+
} else {
|
|
33335
|
+
logger2.error(`${panel.label}
|
|
33336
|
+
${panel.footer}`);
|
|
33337
|
+
}
|
|
33338
|
+
process.exitCode = 1;
|
|
33339
|
+
throw new SilentError();
|
|
33340
|
+
}
|
|
33341
|
+
|
|
33174
33342
|
// packages/agent-mcp-config/src/configs.ts
|
|
33175
33343
|
var agentMcpConfigs = {
|
|
33176
33344
|
"claude-code": {
|
|
@@ -33386,100 +33554,6 @@ async function unconfigure(agentId, serverName, options) {
|
|
|
33386
33554
|
);
|
|
33387
33555
|
}
|
|
33388
33556
|
|
|
33389
|
-
// src/utils/execution-context.ts
|
|
33390
|
-
import { dirname } from "node:path";
|
|
33391
|
-
import { fileURLToPath } from "node:url";
|
|
33392
|
-
function detectExecutionContext(input) {
|
|
33393
|
-
const { argv, env, moduleUrl } = input;
|
|
33394
|
-
if (isDevelopmentMode(argv, env)) {
|
|
33395
|
-
return createDevelopmentContext(moduleUrl);
|
|
33396
|
-
}
|
|
33397
|
-
if (isNpxExecution(env)) {
|
|
33398
|
-
const version2 = detectNpxVersion(env);
|
|
33399
|
-
return createNpxContext(version2);
|
|
33400
|
-
}
|
|
33401
|
-
return {
|
|
33402
|
-
mode: "global",
|
|
33403
|
-
command: {
|
|
33404
|
-
command: "poe-code",
|
|
33405
|
-
args: []
|
|
33406
|
-
}
|
|
33407
|
-
};
|
|
33408
|
-
}
|
|
33409
|
-
function isDevelopmentMode(argv, env) {
|
|
33410
|
-
const scriptPath = argv[1] ?? "";
|
|
33411
|
-
if (scriptPath.endsWith(".ts") || scriptPath.includes("/src/")) {
|
|
33412
|
-
return true;
|
|
33413
|
-
}
|
|
33414
|
-
if (env.npm_lifecycle_event === "dev") {
|
|
33415
|
-
return true;
|
|
33416
|
-
}
|
|
33417
|
-
const nodeOptions = env.NODE_OPTIONS ?? "";
|
|
33418
|
-
if (nodeOptions.includes("tsx") || nodeOptions.includes("ts-node")) {
|
|
33419
|
-
return true;
|
|
33420
|
-
}
|
|
33421
|
-
return false;
|
|
33422
|
-
}
|
|
33423
|
-
function isNpxExecution(env) {
|
|
33424
|
-
const execPath = env.npm_execpath ?? "";
|
|
33425
|
-
if (execPath.includes("npx") || execPath.includes("npm")) {
|
|
33426
|
-
const packagePath = env.npm_package_json ?? "";
|
|
33427
|
-
if (packagePath.includes("_npx") || packagePath.includes(".npm/_cacache")) {
|
|
33428
|
-
return true;
|
|
33429
|
-
}
|
|
33430
|
-
}
|
|
33431
|
-
if (env.npm_command === "exec") {
|
|
33432
|
-
return true;
|
|
33433
|
-
}
|
|
33434
|
-
return false;
|
|
33435
|
-
}
|
|
33436
|
-
function detectNpxVersion(env) {
|
|
33437
|
-
const packageJson = env.npm_package_json ?? "";
|
|
33438
|
-
const packageVersion = env.npm_package_version ?? "";
|
|
33439
|
-
if (packageJson.includes("@beta") || packageVersion.includes("beta")) {
|
|
33440
|
-
return "beta";
|
|
33441
|
-
}
|
|
33442
|
-
if (packageJson.includes("@latest")) {
|
|
33443
|
-
return "latest";
|
|
33444
|
-
}
|
|
33445
|
-
return "default";
|
|
33446
|
-
}
|
|
33447
|
-
function createDevelopmentContext(moduleUrl) {
|
|
33448
|
-
const modulePath = fileURLToPath(moduleUrl);
|
|
33449
|
-
const srcIndex = modulePath.lastIndexOf("/src/");
|
|
33450
|
-
const projectRoot = srcIndex !== -1 ? modulePath.substring(0, srcIndex) : dirname(dirname(modulePath));
|
|
33451
|
-
return {
|
|
33452
|
-
mode: "development",
|
|
33453
|
-
command: {
|
|
33454
|
-
command: "npm",
|
|
33455
|
-
args: ["--silent", "--prefix", projectRoot, "run", "dev", "--"]
|
|
33456
|
-
}
|
|
33457
|
-
};
|
|
33458
|
-
}
|
|
33459
|
-
function createNpxContext(version2) {
|
|
33460
|
-
const packageSpec = version2 === "default" ? "poe-code" : `poe-code@${version2}`;
|
|
33461
|
-
return {
|
|
33462
|
-
mode: version2 === "default" ? "npx" : `npx-${version2}`,
|
|
33463
|
-
command: {
|
|
33464
|
-
command: "npx",
|
|
33465
|
-
args: ["--yes", packageSpec]
|
|
33466
|
-
}
|
|
33467
|
-
};
|
|
33468
|
-
}
|
|
33469
|
-
function toMcpServerCommand(execCommand, subcommand) {
|
|
33470
|
-
return {
|
|
33471
|
-
command: execCommand.command,
|
|
33472
|
-
args: [...execCommand.args, subcommand]
|
|
33473
|
-
};
|
|
33474
|
-
}
|
|
33475
|
-
function getCurrentExecutionContext(moduleUrl) {
|
|
33476
|
-
return detectExecutionContext({
|
|
33477
|
-
argv: process.argv,
|
|
33478
|
-
env: process.env,
|
|
33479
|
-
moduleUrl
|
|
33480
|
-
});
|
|
33481
|
-
}
|
|
33482
|
-
|
|
33483
33557
|
// src/cli/commands/mcp.ts
|
|
33484
33558
|
var DEFAULT_MCP_AGENT = "claude-code";
|
|
33485
33559
|
function createMcpServerEntry() {
|
|
@@ -33506,7 +33580,16 @@ function buildHelpText() {
|
|
|
33506
33580
|
return lines.join("\n");
|
|
33507
33581
|
}
|
|
33508
33582
|
function registerMcpCommand(program, container) {
|
|
33509
|
-
const mcp = program.command("mcp").description("MCP server commands").addHelpText("after", buildHelpText()).action(
|
|
33583
|
+
const mcp = program.command("mcp").description("MCP server commands").addHelpText("after", buildHelpText()).action(function() {
|
|
33584
|
+
if (this.args.length > 0) {
|
|
33585
|
+
throwCommandNotFound({
|
|
33586
|
+
container,
|
|
33587
|
+
scope: "mcp",
|
|
33588
|
+
unknownCommand: this.args.at(0) ?? "",
|
|
33589
|
+
helpArgs: ["mcp", "--help"],
|
|
33590
|
+
moduleUrl: import.meta.url
|
|
33591
|
+
});
|
|
33592
|
+
}
|
|
33510
33593
|
this.help();
|
|
33511
33594
|
});
|
|
33512
33595
|
mcp.command("serve").description("Run MCP server on stdin/stdout").option(
|
|
@@ -33660,14 +33743,17 @@ function resolveAgentSupport2(input, registry2 = agentSkillConfigs) {
|
|
|
33660
33743
|
}
|
|
33661
33744
|
|
|
33662
33745
|
// packages/agent-skill-config/src/templates.ts
|
|
33746
|
+
import { readFile as readFile3 } from "node:fs/promises";
|
|
33663
33747
|
var templatesCache2 = null;
|
|
33664
33748
|
async function getTemplates2() {
|
|
33665
33749
|
if (templatesCache2) {
|
|
33666
33750
|
return templatesCache2;
|
|
33667
33751
|
}
|
|
33668
|
-
const
|
|
33669
|
-
|
|
33752
|
+
const poeGenerateTemplateUrl = new URL(
|
|
33753
|
+
"./templates/poe-generate.md",
|
|
33754
|
+
import.meta.url
|
|
33670
33755
|
);
|
|
33756
|
+
const poeGenerateTemplate = await readFile3(poeGenerateTemplateUrl, "utf8");
|
|
33671
33757
|
templatesCache2 = {
|
|
33672
33758
|
"poe-generate.md": poeGenerateTemplate
|
|
33673
33759
|
};
|
|
@@ -33770,7 +33856,16 @@ function buildHelpText2() {
|
|
|
33770
33856
|
].join("\n");
|
|
33771
33857
|
}
|
|
33772
33858
|
function registerSkillCommand(program, container) {
|
|
33773
|
-
const skill = program.command("skill").description("Skill directory commands").addHelpText("after", buildHelpText2()).action(
|
|
33859
|
+
const skill = program.command("skill").description("Skill directory commands").addHelpText("after", buildHelpText2()).action(function() {
|
|
33860
|
+
if (this.args.length > 0) {
|
|
33861
|
+
throwCommandNotFound({
|
|
33862
|
+
container,
|
|
33863
|
+
scope: "skill",
|
|
33864
|
+
unknownCommand: this.args.at(0) ?? "",
|
|
33865
|
+
helpArgs: ["skill", "--help"],
|
|
33866
|
+
moduleUrl: import.meta.url
|
|
33867
|
+
});
|
|
33868
|
+
}
|
|
33774
33869
|
this.help();
|
|
33775
33870
|
});
|
|
33776
33871
|
skill.command("configure [agent]").description("Install skill directories for an agent").option("--agent <name>", "Agent to configure skills for").option("--local", "Use local scope (in the current project)").option("--global", "Use global scope (in the user home directory)").action(async (agentArg, options) => {
|
|
@@ -34131,60 +34226,92 @@ var package_default = {
|
|
|
34131
34226
|
};
|
|
34132
34227
|
|
|
34133
34228
|
// src/cli/program.ts
|
|
34134
|
-
function
|
|
34135
|
-
const
|
|
34136
|
-
|
|
34137
|
-
|
|
34138
|
-
const
|
|
34139
|
-
|
|
34229
|
+
function formatCommandHeader(cmd) {
|
|
34230
|
+
const parts = [];
|
|
34231
|
+
let current = cmd;
|
|
34232
|
+
while (current) {
|
|
34233
|
+
const name = current.name();
|
|
34234
|
+
if (name === "poe-code") {
|
|
34235
|
+
break;
|
|
34236
|
+
}
|
|
34237
|
+
if (name.length > 0) {
|
|
34238
|
+
parts.push(name);
|
|
34239
|
+
}
|
|
34240
|
+
current = current.parent ?? null;
|
|
34241
|
+
}
|
|
34242
|
+
return `Poe - ${parts.reverse().join(" ")}`;
|
|
34243
|
+
}
|
|
34244
|
+
function formatHelpText(input) {
|
|
34245
|
+
const commandRows = [
|
|
34246
|
+
{
|
|
34247
|
+
name: "configure",
|
|
34248
|
+
args: "[agent]",
|
|
34249
|
+
description: "Configure a coding agent (claude-code, codex, opencode)"
|
|
34250
|
+
},
|
|
34251
|
+
{
|
|
34252
|
+
name: "unconfigure",
|
|
34253
|
+
args: "<agent>",
|
|
34254
|
+
description: "Remove a previously applied configuration"
|
|
34255
|
+
},
|
|
34256
|
+
{
|
|
34257
|
+
name: "spawn",
|
|
34258
|
+
args: "<agent> [prompt]",
|
|
34259
|
+
description: "Launch a coding agent"
|
|
34260
|
+
},
|
|
34261
|
+
{
|
|
34262
|
+
name: "generate",
|
|
34263
|
+
args: "[type]",
|
|
34264
|
+
description: "Call Poe models via CLI (text/image/video/audio)"
|
|
34265
|
+
},
|
|
34266
|
+
{
|
|
34267
|
+
name: "mcp configure",
|
|
34268
|
+
args: "[agent]",
|
|
34269
|
+
description: "Configure Poe MCP for your coding agent"
|
|
34270
|
+
},
|
|
34271
|
+
{
|
|
34272
|
+
name: "mcp unconfigure",
|
|
34273
|
+
args: "<agent>",
|
|
34274
|
+
description: "Remove Poe MCP configuration from your agent"
|
|
34275
|
+
},
|
|
34276
|
+
{
|
|
34277
|
+
name: "mcp serve",
|
|
34278
|
+
args: "",
|
|
34279
|
+
description: "Run the Poe MCP server on stdin/stdout"
|
|
34280
|
+
},
|
|
34281
|
+
{
|
|
34282
|
+
name: "skill configure",
|
|
34283
|
+
args: "[agent]",
|
|
34284
|
+
description: "Configure agent skills to call Poe models"
|
|
34285
|
+
},
|
|
34286
|
+
{
|
|
34287
|
+
name: "skill unconfigure",
|
|
34288
|
+
args: "[agent]",
|
|
34289
|
+
description: "Remove agent skills configuration"
|
|
34290
|
+
}
|
|
34291
|
+
];
|
|
34292
|
+
const nameWidth = Math.max(0, ...commandRows.map((row) => row.name.length));
|
|
34293
|
+
const argsWidth = Math.max(
|
|
34294
|
+
0,
|
|
34295
|
+
...commandRows.map((row) => row.args.length)
|
|
34296
|
+
);
|
|
34297
|
+
const cmd = (row) => {
|
|
34298
|
+
const name = text.command(row.name.padEnd(nameWidth));
|
|
34299
|
+
const args = row.args.length > 0 ? text.argument(row.args.padEnd(argsWidth)) : " ".repeat(argsWidth);
|
|
34300
|
+
return ` ${name} ${args} ${row.description}`;
|
|
34140
34301
|
};
|
|
34141
|
-
const example = (value) => ` ${text.example(value)}`;
|
|
34142
|
-
const opt = (flag, desc) => ` ${text.option(flag.padEnd(27))}${desc}`;
|
|
34143
34302
|
return [
|
|
34144
|
-
text.heading("
|
|
34303
|
+
text.heading("Poe - poe-code"),
|
|
34145
34304
|
"",
|
|
34146
|
-
|
|
34305
|
+
"Configure coding agents to use the Poe API.",
|
|
34147
34306
|
"",
|
|
34148
|
-
text.section("
|
|
34149
|
-
cmd("configure", "[agent]") + " Configure developer tooling for Poe API",
|
|
34150
|
-
example("poe-code configure claude-code"),
|
|
34307
|
+
`${text.section("Usage:")} ${text.usageCommand(input.usageCommand)} ${text.argument("<command> [...args]")}`,
|
|
34151
34308
|
"",
|
|
34152
|
-
|
|
34153
|
-
|
|
34154
|
-
"",
|
|
34155
|
-
cmd("install", "[agent]") + " Install tooling for a configured agent",
|
|
34156
|
-
example("poe-code install opencode"),
|
|
34157
|
-
"",
|
|
34158
|
-
cmd("spawn", "<agent> [prompt]") + " Run a single prompt through a configured agent CLI",
|
|
34159
|
-
example('poe-code spawn codex "Say hello"'),
|
|
34160
|
-
"",
|
|
34161
|
-
cmd("wrap", "<agent>") + " Run an agent CLI with Poe isolated configuration",
|
|
34162
|
-
example("poe-code wrap claude-code --help"),
|
|
34163
|
-
"",
|
|
34164
|
-
cmd("test", "[agent]") + " Run agent health checks",
|
|
34165
|
-
example("poe-code test codex"),
|
|
34166
|
-
"",
|
|
34167
|
-
cmd("generate", "[type]") + " Generate text or media via Poe API",
|
|
34168
|
-
example('poe-code generate "What is 2+2?"'),
|
|
34169
|
-
"",
|
|
34170
|
-
cmd("login", "") + " Store a Poe API key for reuse across commands",
|
|
34171
|
-
"",
|
|
34172
|
-
cmd("mcp", "[subcommand]") + " MCP server commands",
|
|
34173
|
-
example("poe-code mcp configure claude-code"),
|
|
34174
|
-
"",
|
|
34175
|
-
cmd("skill", "[subcommand]") + " Skill directory commands",
|
|
34176
|
-
example("poe-code skill configure claude-code"),
|
|
34177
|
-
"",
|
|
34178
|
-
text.section("Options:"),
|
|
34179
|
-
opt("-y, --yes", "Accept defaults without prompting"),
|
|
34180
|
-
opt("--dry-run", "Simulate commands without writing changes"),
|
|
34181
|
-
opt("--verbose", "Show verbose logs"),
|
|
34182
|
-
opt("-V, --version", "Output the version number"),
|
|
34183
|
-
opt("-h, --help", "Display help for command"),
|
|
34309
|
+
text.section("Commands:"),
|
|
34310
|
+
...commandRows.map(cmd),
|
|
34184
34311
|
"",
|
|
34185
|
-
|
|
34312
|
+
`${text.muted("Run")} ${text.usageCommand(input.helpCommand)} ${text.muted("for command options.")}`,
|
|
34186
34313
|
"",
|
|
34187
|
-
`${text.muted("Learn more about Poe:")} ${text.link("https://poe.com")}`,
|
|
34314
|
+
`${text.muted("Learn more about Poe:")} ${text.link("https://poe.com/api")}`,
|
|
34188
34315
|
`${text.muted("GitHub:")} ${text.link("https://github.com/poe-platform/poe-code")}`
|
|
34189
34316
|
].join("\n");
|
|
34190
34317
|
}
|
|
@@ -34205,7 +34332,7 @@ function formatSubcommandHelp(cmd, helper) {
|
|
|
34205
34332
|
const indentBlock = (value) => value.split("\n").map((line) => `${indent}${line}`).join("\n");
|
|
34206
34333
|
const formatList = (items) => items.map(indentBlock).join("\n");
|
|
34207
34334
|
const output = [];
|
|
34208
|
-
output.push(text.heading(
|
|
34335
|
+
output.push(text.heading(formatCommandHeader(cmd)), "");
|
|
34209
34336
|
output.push(
|
|
34210
34337
|
`${text.section("Usage:")} ${text.usageCommand(helper.commandUsage(cmd))}`,
|
|
34211
34338
|
""
|
|
@@ -34275,10 +34402,20 @@ function createProgram(dependencies) {
|
|
|
34275
34402
|
}
|
|
34276
34403
|
function bootstrapProgram(container) {
|
|
34277
34404
|
const program = new Command();
|
|
34278
|
-
|
|
34405
|
+
const executionContext = detectExecutionContext({
|
|
34406
|
+
argv: process.argv,
|
|
34407
|
+
env: container.env.variables,
|
|
34408
|
+
moduleUrl: import.meta.url
|
|
34409
|
+
});
|
|
34410
|
+
const usageCommand = formatCliUsageCommand(executionContext);
|
|
34411
|
+
const helpCommand = formatCliHelpCommand(executionContext, [
|
|
34412
|
+
"<command>",
|
|
34413
|
+
"--help"
|
|
34414
|
+
]);
|
|
34415
|
+
program.name("poe-code").description("Configure Poe API integrations for local developer tooling.").option("-y, --yes", "Accept defaults without prompting.").option("--dry-run", "Simulate commands without writing changes.").option("--verbose", "Show verbose logs.").helpOption("-h, --help", "Display help for command").showHelpAfterError(false).showSuggestionAfterError(true).configureHelp({
|
|
34279
34416
|
formatHelp: (cmd, helper) => {
|
|
34280
34417
|
if (cmd.name() === "poe-code") {
|
|
34281
|
-
return formatHelpText();
|
|
34418
|
+
return formatHelpText({ usageCommand, helpCommand });
|
|
34282
34419
|
}
|
|
34283
34420
|
return formatSubcommandHelp(cmd, helper);
|
|
34284
34421
|
}
|
|
@@ -34294,8 +34431,18 @@ function bootstrapProgram(container) {
|
|
|
34294
34431
|
registerLoginCommand(program, container);
|
|
34295
34432
|
registerMcpCommand(program, container);
|
|
34296
34433
|
registerSkillCommand(program, container);
|
|
34297
|
-
program.action(()
|
|
34298
|
-
|
|
34434
|
+
program.action(function() {
|
|
34435
|
+
const args = this.args;
|
|
34436
|
+
if (args.length > 0) {
|
|
34437
|
+
throwCommandNotFound({
|
|
34438
|
+
container,
|
|
34439
|
+
scope: "cli",
|
|
34440
|
+
unknownCommand: args.at(0) ?? "",
|
|
34441
|
+
helpArgs: ["--help"],
|
|
34442
|
+
moduleUrl: import.meta.url
|
|
34443
|
+
});
|
|
34444
|
+
}
|
|
34445
|
+
this.outputHelp();
|
|
34299
34446
|
});
|
|
34300
34447
|
return program;
|
|
34301
34448
|
}
|