@ricsam/r5dctl 0.0.10 → 0.0.12
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 +1 -3
- package/dist/cjs/cli.cjs +12 -47
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/cli.mjs +10 -47
- package/dist/mjs/package.json +1 -1
- package/dist/types/cli.d.ts +4 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,9 +55,7 @@ r5dctl describe session <session-id>
|
|
|
55
55
|
r5dctl -s <session-id> update session --name "Renamed session"
|
|
56
56
|
r5dctl -s <session-id> delete session
|
|
57
57
|
|
|
58
|
-
r5dctl -s <session-id> conversation #
|
|
59
|
-
r5dctl -s <session-id> conversation --full # same transcript without truncation
|
|
60
|
-
r5dctl -s <session-id> conversation --compact # compact grouped timeline
|
|
58
|
+
r5dctl -s <session-id> conversation # exact agent request transcript
|
|
61
59
|
r5dctl -s <session-id> prompt --mode plan --model max "..."
|
|
62
60
|
r5dctl -s <session-id> answer-questions -a1 "Recipe Collection" -a2 "Both Manual & AI"
|
|
63
61
|
r5dctl -s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value
|
package/dist/cjs/cli.cjs
CHANGED
|
@@ -31,9 +31,11 @@ __export(cli_exports, {
|
|
|
31
31
|
getCliHelpText: () => getCliHelpText,
|
|
32
32
|
main: () => main,
|
|
33
33
|
parseAnswerFlags: () => parseAnswerFlags,
|
|
34
|
+
parseConversationRenderArgs: () => parseConversationRenderArgs,
|
|
34
35
|
parseEnvFlags: () => parseEnvFlags,
|
|
35
36
|
parseGlobalArgs: () => parseGlobalArgs,
|
|
36
37
|
parsePromptArgs: () => parsePromptArgs,
|
|
38
|
+
renderConversationResponse: () => renderConversationResponse,
|
|
37
39
|
resolveCommandExecution: () => resolveCommandExecution,
|
|
38
40
|
runR5dctlCli: () => runR5dctlCli
|
|
39
41
|
});
|
|
@@ -99,7 +101,7 @@ const SHARED_HELP_ENTRIES = [
|
|
|
99
101
|
{ section: "sessions", usage: "describe session <session-id>", description: "Show session details." },
|
|
100
102
|
{ section: "sessions", usage: "-s <session-id> update session --name <name>", description: "Rename a session or clear its name." },
|
|
101
103
|
{ section: "sessions", usage: "-s <session-id> delete session", description: "Delete a session." },
|
|
102
|
-
{ section: "sessions", usage: "-s <session-id> conversation
|
|
104
|
+
{ section: "sessions", usage: "-s <session-id> conversation", description: "Read the exact agent request transcript." },
|
|
103
105
|
{ section: "sessions", usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"', description: "Send a prompt to a session." },
|
|
104
106
|
{ section: "sessions", usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...', description: "Answer pending questions in order." },
|
|
105
107
|
{ section: "sessions", usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value", description: "Apply required backend or frontend env values." },
|
|
@@ -317,7 +319,7 @@ function parseConfig(configPath) {
|
|
|
317
319
|
apiKey: typeof value.apiKey === "string" ? value.apiKey : void 0
|
|
318
320
|
};
|
|
319
321
|
}
|
|
320
|
-
function
|
|
322
|
+
function serializeConfig(config) {
|
|
321
323
|
const output = {};
|
|
322
324
|
if (config.baseUrl) {
|
|
323
325
|
output.baseUrl = config.baseUrl;
|
|
@@ -333,8 +335,8 @@ function compactConfig(config) {
|
|
|
333
335
|
function writeConfig(configPath, config) {
|
|
334
336
|
const dir = import_node_path.default.dirname(configPath);
|
|
335
337
|
import_node_fs.default.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
336
|
-
const
|
|
337
|
-
import_node_fs.default.writeFileSync(configPath, `${JSON.stringify(
|
|
338
|
+
const serialized = serializeConfig(config);
|
|
339
|
+
import_node_fs.default.writeFileSync(configPath, `${JSON.stringify(serialized, null, 2)}
|
|
338
340
|
`, {
|
|
339
341
|
mode: 384
|
|
340
342
|
});
|
|
@@ -750,55 +752,16 @@ function parseSessionUpdateArgs(args) {
|
|
|
750
752
|
return input;
|
|
751
753
|
}
|
|
752
754
|
function parseConversationRenderArgs(args) {
|
|
753
|
-
const options = {
|
|
755
|
+
const options = {};
|
|
754
756
|
for (let index = 0; index < args.length; index += 1) {
|
|
755
757
|
const arg = args[index];
|
|
756
|
-
if (arg === "--full" || arg === "--verbose") {
|
|
757
|
-
options.full = true;
|
|
758
|
-
continue;
|
|
759
|
-
}
|
|
760
|
-
if (arg === "--compact") {
|
|
761
|
-
options.compact = true;
|
|
762
|
-
continue;
|
|
763
|
-
}
|
|
764
|
-
if (arg === "--tail") {
|
|
765
|
-
const value = Number(requireValue(args[index + 1], "Missing value for --tail"));
|
|
766
|
-
if (!Number.isInteger(value) || value <= 0) throw new Error("--tail must be a positive integer");
|
|
767
|
-
options.tail = value;
|
|
768
|
-
index += 1;
|
|
769
|
-
continue;
|
|
770
|
-
}
|
|
771
|
-
const inlineTail = arg ? parseLongOptionWithEquals(arg, "--tail") : void 0;
|
|
772
|
-
if (inlineTail !== void 0) {
|
|
773
|
-
const value = Number(inlineTail);
|
|
774
|
-
if (!Number.isInteger(value) || value <= 0) throw new Error("--tail must be a positive integer");
|
|
775
|
-
options.tail = value;
|
|
776
|
-
continue;
|
|
777
|
-
}
|
|
778
758
|
throw new Error(`Unknown conversation argument: ${arg}`);
|
|
779
759
|
}
|
|
780
|
-
if (options.full && options.compact) {
|
|
781
|
-
throw new Error("Use either --full or --compact, not both");
|
|
782
|
-
}
|
|
783
760
|
return options;
|
|
784
761
|
}
|
|
785
|
-
function renderConversationResponse(read, options = {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectPath}`, `Branch: ${read.session.branchName}`, ""];
|
|
789
|
-
lines.push(`Conversation nodes: ${visibleThread.length}${options.tail ? ` of ${thread.length}` : ""}`);
|
|
790
|
-
if (!options.compact) {
|
|
791
|
-
lines.push(JSON.stringify(visibleThread, null, options.full ? 2 : 0));
|
|
792
|
-
}
|
|
793
|
-
if (read.pendingQuestions.length > 0) {
|
|
794
|
-
lines.push("", "Pending questions:");
|
|
795
|
-
read.pendingQuestions.forEach((question, index) => lines.push(`${index + 1}. ${question.question}`));
|
|
796
|
-
}
|
|
797
|
-
if (read.requiredEnvs.length > 0) {
|
|
798
|
-
lines.push("", "Required envs:");
|
|
799
|
-
read.requiredEnvs.forEach((env) => lines.push(`- ${env.target}/${env.name}${env.optional ? "?" : ""}${env.description ? `: ${env.description}` : ""}`));
|
|
800
|
-
}
|
|
801
|
-
return `${lines.join("\n")}
|
|
762
|
+
function renderConversationResponse(read, options = {}) {
|
|
763
|
+
void options;
|
|
764
|
+
return read.agentText.endsWith("\n") ? read.agentText : `${read.agentText}
|
|
802
765
|
`;
|
|
803
766
|
}
|
|
804
767
|
async function executeR5dctlCommand(client, json, args) {
|
|
@@ -1397,9 +1360,11 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
1397
1360
|
getCliHelpText,
|
|
1398
1361
|
main,
|
|
1399
1362
|
parseAnswerFlags,
|
|
1363
|
+
parseConversationRenderArgs,
|
|
1400
1364
|
parseEnvFlags,
|
|
1401
1365
|
parseGlobalArgs,
|
|
1402
1366
|
parsePromptArgs,
|
|
1367
|
+
renderConversationResponse,
|
|
1403
1368
|
resolveCommandExecution,
|
|
1404
1369
|
runR5dctlCli
|
|
1405
1370
|
});
|
package/dist/cjs/package.json
CHANGED
package/dist/mjs/cli.mjs
CHANGED
|
@@ -62,7 +62,7 @@ const SHARED_HELP_ENTRIES = [
|
|
|
62
62
|
{ section: "sessions", usage: "describe session <session-id>", description: "Show session details." },
|
|
63
63
|
{ section: "sessions", usage: "-s <session-id> update session --name <name>", description: "Rename a session or clear its name." },
|
|
64
64
|
{ section: "sessions", usage: "-s <session-id> delete session", description: "Delete a session." },
|
|
65
|
-
{ section: "sessions", usage: "-s <session-id> conversation
|
|
65
|
+
{ section: "sessions", usage: "-s <session-id> conversation", description: "Read the exact agent request transcript." },
|
|
66
66
|
{ section: "sessions", usage: '-s <session-id> prompt --mode <mode> --model <tier> "<message>"', description: "Send a prompt to a session." },
|
|
67
67
|
{ section: "sessions", usage: '-s <session-id> answer-questions -a1 "<answer>" -a2 "<answer>" ...', description: "Answer pending questions in order." },
|
|
68
68
|
{ section: "sessions", usage: "-s <session-id> apply-required-envs -e backend/KEY=value -e frontend/KEY=value", description: "Apply required backend or frontend env values." },
|
|
@@ -280,7 +280,7 @@ function parseConfig(configPath) {
|
|
|
280
280
|
apiKey: typeof value.apiKey === "string" ? value.apiKey : void 0
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function serializeConfig(config) {
|
|
284
284
|
const output = {};
|
|
285
285
|
if (config.baseUrl) {
|
|
286
286
|
output.baseUrl = config.baseUrl;
|
|
@@ -296,8 +296,8 @@ function compactConfig(config) {
|
|
|
296
296
|
function writeConfig(configPath, config) {
|
|
297
297
|
const dir = path.dirname(configPath);
|
|
298
298
|
fs.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
299
|
-
const
|
|
300
|
-
fs.writeFileSync(configPath, `${JSON.stringify(
|
|
299
|
+
const serialized = serializeConfig(config);
|
|
300
|
+
fs.writeFileSync(configPath, `${JSON.stringify(serialized, null, 2)}
|
|
301
301
|
`, {
|
|
302
302
|
mode: 384
|
|
303
303
|
});
|
|
@@ -713,55 +713,16 @@ function parseSessionUpdateArgs(args) {
|
|
|
713
713
|
return input;
|
|
714
714
|
}
|
|
715
715
|
function parseConversationRenderArgs(args) {
|
|
716
|
-
const options = {
|
|
716
|
+
const options = {};
|
|
717
717
|
for (let index = 0; index < args.length; index += 1) {
|
|
718
718
|
const arg = args[index];
|
|
719
|
-
if (arg === "--full" || arg === "--verbose") {
|
|
720
|
-
options.full = true;
|
|
721
|
-
continue;
|
|
722
|
-
}
|
|
723
|
-
if (arg === "--compact") {
|
|
724
|
-
options.compact = true;
|
|
725
|
-
continue;
|
|
726
|
-
}
|
|
727
|
-
if (arg === "--tail") {
|
|
728
|
-
const value = Number(requireValue(args[index + 1], "Missing value for --tail"));
|
|
729
|
-
if (!Number.isInteger(value) || value <= 0) throw new Error("--tail must be a positive integer");
|
|
730
|
-
options.tail = value;
|
|
731
|
-
index += 1;
|
|
732
|
-
continue;
|
|
733
|
-
}
|
|
734
|
-
const inlineTail = arg ? parseLongOptionWithEquals(arg, "--tail") : void 0;
|
|
735
|
-
if (inlineTail !== void 0) {
|
|
736
|
-
const value = Number(inlineTail);
|
|
737
|
-
if (!Number.isInteger(value) || value <= 0) throw new Error("--tail must be a positive integer");
|
|
738
|
-
options.tail = value;
|
|
739
|
-
continue;
|
|
740
|
-
}
|
|
741
719
|
throw new Error(`Unknown conversation argument: ${arg}`);
|
|
742
720
|
}
|
|
743
|
-
if (options.full && options.compact) {
|
|
744
|
-
throw new Error("Use either --full or --compact, not both");
|
|
745
|
-
}
|
|
746
721
|
return options;
|
|
747
722
|
}
|
|
748
|
-
function renderConversationResponse(read, options = {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
const lines = [`Session: ${read.session.id}`, `Project: ${read.session.projectPath}`, `Branch: ${read.session.branchName}`, ""];
|
|
752
|
-
lines.push(`Conversation nodes: ${visibleThread.length}${options.tail ? ` of ${thread.length}` : ""}`);
|
|
753
|
-
if (!options.compact) {
|
|
754
|
-
lines.push(JSON.stringify(visibleThread, null, options.full ? 2 : 0));
|
|
755
|
-
}
|
|
756
|
-
if (read.pendingQuestions.length > 0) {
|
|
757
|
-
lines.push("", "Pending questions:");
|
|
758
|
-
read.pendingQuestions.forEach((question, index) => lines.push(`${index + 1}. ${question.question}`));
|
|
759
|
-
}
|
|
760
|
-
if (read.requiredEnvs.length > 0) {
|
|
761
|
-
lines.push("", "Required envs:");
|
|
762
|
-
read.requiredEnvs.forEach((env) => lines.push(`- ${env.target}/${env.name}${env.optional ? "?" : ""}${env.description ? `: ${env.description}` : ""}`));
|
|
763
|
-
}
|
|
764
|
-
return `${lines.join("\n")}
|
|
723
|
+
function renderConversationResponse(read, options = {}) {
|
|
724
|
+
void options;
|
|
725
|
+
return read.agentText.endsWith("\n") ? read.agentText : `${read.agentText}
|
|
765
726
|
`;
|
|
766
727
|
}
|
|
767
728
|
async function executeR5dctlCommand(client, json, args) {
|
|
@@ -1359,9 +1320,11 @@ export {
|
|
|
1359
1320
|
getCliHelpText,
|
|
1360
1321
|
main,
|
|
1361
1322
|
parseAnswerFlags,
|
|
1323
|
+
parseConversationRenderArgs,
|
|
1362
1324
|
parseEnvFlags,
|
|
1363
1325
|
parseGlobalArgs,
|
|
1364
1326
|
parsePromptArgs,
|
|
1327
|
+
renderConversationResponse,
|
|
1365
1328
|
resolveCommandExecution,
|
|
1366
1329
|
runR5dctlCli
|
|
1367
1330
|
};
|
package/dist/mjs/package.json
CHANGED
package/dist/types/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ChatMode, type ModelTier } from "@ricsam/r5d-api";
|
|
1
|
+
import { type R5dctlConversationResponse, type ChatMode, type ModelTier } from "@ricsam/r5d-api";
|
|
2
2
|
export type GlobalOptions = {
|
|
3
3
|
baseUrl?: string;
|
|
4
4
|
json: boolean;
|
|
@@ -29,6 +29,7 @@ type CommandExecutionPlan = {
|
|
|
29
29
|
kind: "cli-help";
|
|
30
30
|
text: string;
|
|
31
31
|
};
|
|
32
|
+
type ConversationRenderOptions = {};
|
|
32
33
|
export declare function getCliHelpText(): string;
|
|
33
34
|
export declare function parseGlobalArgs(argv: string[]): {
|
|
34
35
|
options: GlobalOptions;
|
|
@@ -41,6 +42,8 @@ export declare function parsePromptArgs(args: string[]): {
|
|
|
41
42
|
model: ModelTier;
|
|
42
43
|
message: string;
|
|
43
44
|
};
|
|
45
|
+
export declare function parseConversationRenderArgs(args: string[]): ConversationRenderOptions;
|
|
46
|
+
export declare function renderConversationResponse(read: R5dctlConversationResponse, options?: ConversationRenderOptions): string;
|
|
44
47
|
export declare function resolveCommandExecution(options: GlobalOptions, rest: string[]): CommandExecutionPlan;
|
|
45
48
|
export declare function runR5dctlCli(argv: string[]): Promise<number>;
|
|
46
49
|
export declare function main(argv?: string[]): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/r5dctl",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/cjs/cli.cjs",
|
|
6
6
|
"module": "./dist/mjs/cli.mjs",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"r5dctl": "dist/cjs/main.cjs"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ricsam/r5d-api": "^0.0.
|
|
29
|
+
"@ricsam/r5d-api": "^0.0.12"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|