poe-code 2.0.8 → 2.0.9
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 +10 -10
- package/dist/cli/commands/query.d.ts +6 -0
- package/dist/cli/commands/query.js +73 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# poe-code
|
|
2
2
|
|
|
3
|
-
> Configure
|
|
3
|
+
> Configure coding agents to use the Poe API.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -16,31 +16,31 @@ npx poe-code@latest configure claude-code
|
|
|
16
16
|
npx poe-code@latest login
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Configure Coding CLIs
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Claude Code
|
|
23
|
-
npx poe-code@latest
|
|
23
|
+
npx poe-code@latest configure claude-code
|
|
24
24
|
|
|
25
25
|
# Codex
|
|
26
|
-
npx poe-code@latest
|
|
26
|
+
npx poe-code@latest configure codex
|
|
27
27
|
|
|
28
28
|
# OpenCode
|
|
29
|
-
npx poe-code@latest
|
|
29
|
+
npx poe-code@latest configure opencode
|
|
30
|
+
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
###
|
|
33
|
+
### Install Coding CLIs
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
36
|
# Claude Code
|
|
36
|
-
npx poe-code@latest
|
|
37
|
+
npx poe-code@latest install claude-code
|
|
37
38
|
|
|
38
39
|
# Codex
|
|
39
|
-
npx poe-code@latest
|
|
40
|
+
npx poe-code@latest install codex
|
|
40
41
|
|
|
41
42
|
# OpenCode
|
|
42
|
-
npx poe-code@latest
|
|
43
|
-
|
|
43
|
+
npx poe-code@latest install opencode
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### Uninstall Configuration
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { CliContainer } from "../container.js";
|
|
3
|
+
export interface RegisterQueryCommandOptions {
|
|
4
|
+
defaultModel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerQueryCommand(program: Command, container: CliContainer, options?: RegisterQueryCommandOptions): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DEFAULT_FRONTIER_MODEL } from "../constants.js";
|
|
2
|
+
import { createExecutionResources, resolveCommandFlags } from "./shared.js";
|
|
3
|
+
import { loadCredentials } from "../../services/credentials.js";
|
|
4
|
+
export function registerQueryCommand(program, container, options = {}) {
|
|
5
|
+
program
|
|
6
|
+
.command("query")
|
|
7
|
+
.description("Query an LLM via Poe API directly")
|
|
8
|
+
.option("--model <model>", "Model identifier", options.defaultModel ?? DEFAULT_FRONTIER_MODEL)
|
|
9
|
+
.option("--system <prompt>", "System prompt")
|
|
10
|
+
.argument("[prompt]", "User prompt (if not provided, reads from stdin)")
|
|
11
|
+
.action(async function (promptArg) {
|
|
12
|
+
const flags = resolveCommandFlags(program);
|
|
13
|
+
const resources = createExecutionResources(container, flags, "query");
|
|
14
|
+
const commandOptions = this.opts();
|
|
15
|
+
const model = commandOptions.model ?? options.defaultModel ?? DEFAULT_FRONTIER_MODEL;
|
|
16
|
+
const systemPrompt = commandOptions.system;
|
|
17
|
+
// Get prompt from argument or stdin
|
|
18
|
+
let prompt = promptArg;
|
|
19
|
+
if (!prompt) {
|
|
20
|
+
// Check if stdin is being piped (not a TTY)
|
|
21
|
+
if (!process.stdin.isTTY) {
|
|
22
|
+
// Read from stdin
|
|
23
|
+
const chunks = [];
|
|
24
|
+
for await (const chunk of process.stdin) {
|
|
25
|
+
chunks.push(chunk);
|
|
26
|
+
}
|
|
27
|
+
prompt = Buffer.concat(chunks).toString("utf8").trim();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!prompt) {
|
|
31
|
+
throw new Error("No prompt provided via argument or stdin");
|
|
32
|
+
}
|
|
33
|
+
if (flags.dryRun) {
|
|
34
|
+
resources.logger.dryRun(`Dry run: would query model ${model} with prompt (${prompt.length} chars)`);
|
|
35
|
+
if (systemPrompt) {
|
|
36
|
+
resources.logger.dryRun(`System prompt: ${systemPrompt}`);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const apiKey = await loadCredentials({
|
|
41
|
+
fs: container.fs,
|
|
42
|
+
filePath: container.env.credentialsPath
|
|
43
|
+
});
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
throw new Error("Poe API key not found. Run 'poe-code login' first.");
|
|
46
|
+
}
|
|
47
|
+
// Dynamic import of openai to avoid top-level import issues
|
|
48
|
+
const { default: OpenAI } = await import("openai");
|
|
49
|
+
const client = new OpenAI({
|
|
50
|
+
apiKey,
|
|
51
|
+
baseURL: "https://api.poe.com/v1"
|
|
52
|
+
});
|
|
53
|
+
const messages = [];
|
|
54
|
+
if (systemPrompt) {
|
|
55
|
+
messages.push({ role: "system", content: systemPrompt });
|
|
56
|
+
}
|
|
57
|
+
messages.push({ role: "user", content: prompt });
|
|
58
|
+
const chat = await client.chat.completions.create({
|
|
59
|
+
model,
|
|
60
|
+
messages
|
|
61
|
+
});
|
|
62
|
+
const response = chat.choices[0]?.message?.content;
|
|
63
|
+
if (!response) {
|
|
64
|
+
throw new Error("No response from LLM");
|
|
65
|
+
}
|
|
66
|
+
// Output to stdout (no logger prefix)
|
|
67
|
+
process.stdout.write(response);
|
|
68
|
+
if (!response.endsWith("\n")) {
|
|
69
|
+
process.stdout.write("\n");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB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,CAAC,WAAW,CAAC,MAAM,CAAC;YAChD,KAAK;YACL,QAAQ;SACT,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;QACnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/cli/program.js
CHANGED
|
@@ -7,6 +7,7 @@ import { registerInstallCommand } from "./commands/install.js";
|
|
|
7
7
|
import { registerRemoveCommand } from "./commands/remove.js";
|
|
8
8
|
import { registerDoctorCommand } from "./commands/doctor.js";
|
|
9
9
|
import { registerTestCommand } from "./commands/test.js";
|
|
10
|
+
import { registerQueryCommand } from "./commands/query.js";
|
|
10
11
|
export function createProgram(dependencies) {
|
|
11
12
|
const container = createCliContainer(dependencies);
|
|
12
13
|
const program = bootstrapProgram(container);
|
|
@@ -28,6 +29,7 @@ function bootstrapProgram(container) {
|
|
|
28
29
|
registerInstallCommand(program, container);
|
|
29
30
|
registerConfigureCommand(program, container);
|
|
30
31
|
registerSpawnCommand(program, container);
|
|
32
|
+
registerQueryCommand(program, container);
|
|
31
33
|
registerTestCommand(program, container);
|
|
32
34
|
registerRemoveCommand(program, container);
|
|
33
35
|
registerDoctorCommand(program, container);
|
package/dist/cli/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAA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;IACzC,OAAO,CAAC,YAAY,EAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,OAAgB;IAC/C,OAAO,CAAC,eAAe,CAAC;QACtB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB,CAAC,CAAC;IACH,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-code",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"description": "CLI tool to configure Poe API for developer workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"commander": "^11.1.0",
|
|
34
34
|
"diff": "^5.2.0",
|
|
35
35
|
"handlebars": "^4.7.8",
|
|
36
|
+
"openai": "^6.9.1",
|
|
36
37
|
"prompts": "^2.4.2",
|
|
37
38
|
"semver": "^7.7.3"
|
|
38
39
|
},
|