@hunterzhu/pulse-cli 0.1.2 → 0.1.4
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/bin.js +3 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +6 -3
- package/package.json +2 -2
package/dist/bin.js
CHANGED
|
@@ -129,8 +129,10 @@ async function consume(run, format, approvalInput) { let streamedText = false; l
|
|
|
129
129
|
}
|
|
130
130
|
const outcome = await run.outcome();
|
|
131
131
|
if (format === 'jsonl') {
|
|
132
|
-
process.stdout.write(`${JSON.stringify({ schemaVersion: 1, type: 'result', runId: run.id, status: outcome.status, text: outcome.text ?? null })}\n`);
|
|
132
|
+
process.stdout.write(`${JSON.stringify({ schemaVersion: 1, type: 'result', runId: run.id, status: outcome.status, text: outcome.text ?? null, error: outcome.error ?? null })}\n`);
|
|
133
133
|
}
|
|
134
|
+
else if (outcome.status === 'failed' && outcome.error)
|
|
135
|
+
process.stderr.write(`\n[错误] ${outcome.error.code}: ${outcome.error.message}\n`);
|
|
134
136
|
else if (!streamedText && outcome.text)
|
|
135
137
|
process.stdout.write(`${outcome.text}\n`);
|
|
136
138
|
else
|
package/dist/config.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface PulseCliConfig {
|
|
|
12
12
|
}
|
|
13
13
|
export declare const defaultPulseConfig: PulseCliConfig;
|
|
14
14
|
export declare function defaultPulseConfigPath(): string;
|
|
15
|
+
export declare function defaultPulseHomePath(): string;
|
|
15
16
|
/** Create the user config on first run without replacing an existing file. */
|
|
16
17
|
export declare function ensurePulseUserConfig(path?: string): Promise<void>;
|
|
17
18
|
export declare function expandHome(path: string | undefined): string | undefined;
|
package/dist/config.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { access, chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
|
-
import { dirname, join } from 'node:path';
|
|
3
|
+
import { dirname, join, resolve } from 'node:path';
|
|
4
4
|
export const defaultPulseConfig = {
|
|
5
5
|
provider: { provider: 'mock', model: 'mock', apiKeyEnv: 'OPENAI_API_KEY' },
|
|
6
6
|
approvalMode: 'ask',
|
|
7
7
|
allowNetwork: false,
|
|
8
8
|
};
|
|
9
9
|
export function defaultPulseConfigPath() {
|
|
10
|
-
return join(
|
|
10
|
+
return join(defaultPulseHomePath(), 'config.json');
|
|
11
|
+
}
|
|
12
|
+
export function defaultPulseHomePath() {
|
|
13
|
+
return resolve(process.env.PULSE_HOME ?? join(homedir(), '.pulse'));
|
|
11
14
|
}
|
|
12
15
|
/** Create the user config on first run without replacing an existing file. */
|
|
13
16
|
export async function ensurePulseUserConfig(path = defaultPulseConfigPath()) {
|
|
@@ -66,7 +69,7 @@ export function mergePulseConfigs(layers) {
|
|
|
66
69
|
}
|
|
67
70
|
export async function loadPulseConfig(cwd, explicitPath, trustWorkspace = false) {
|
|
68
71
|
const workspacePath = join(cwd, '.pulse', 'config.json');
|
|
69
|
-
const homePath =
|
|
72
|
+
const homePath = defaultPulseConfigPath();
|
|
70
73
|
const envPath = expandHome(process.env.PULSE_CONFIG);
|
|
71
74
|
const layers = [];
|
|
72
75
|
for (const [path, trust] of [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hunterzhu/pulse-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/zhuhengtan/Pulse"
|
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
"build": "tsc -p tsconfig.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@hunterzhu/pulse-server": "0.1.
|
|
22
|
+
"@hunterzhu/pulse-server": "0.1.4"
|
|
23
23
|
}
|
|
24
24
|
}
|