@piewf/cli 5.8.0 → 5.9.0
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/src/cli.js +31 -2
- package/package.json +2 -2
package/dist/src/cli.js
CHANGED
|
@@ -11,7 +11,8 @@ import { doctorCleanup, doctorCleanupExitCode, formatDoctorCleanupReport } from
|
|
|
11
11
|
import workflowExtension, { errorText, formatWorkflowProgress, isNodeError, jsonValue, loadAgentDefinitions, registeredWorkflowFunctions, truncateWorkflowProgress, workflowCatalog, workflowSettingsPath } from "pi-extensible-workflows";
|
|
12
12
|
import { portableEngineVersion, portablePiVersion, writePortableWorkflowBundle } from "./bundles.js";
|
|
13
13
|
import { runSessionInspector, transcriptFileLines } from "./session-inspector.js";
|
|
14
|
-
import { isPersistedRun } from "pi-extensible-workflows/persistence";
|
|
14
|
+
import { isPersistedRun, listPersistedSessionIds, listRunIds } from "pi-extensible-workflows/persistence";
|
|
15
|
+
import { shareTrajectoryRun } from "pi-extensible-workflows/trajectory";
|
|
15
16
|
function object(value) { return typeof value === "object" && value !== null && !Array.isArray(value); }
|
|
16
17
|
function has(value, key) { return Object.prototype.hasOwnProperty.call(value, key); }
|
|
17
18
|
function requiredArg(args, index) {
|
|
@@ -801,6 +802,34 @@ export async function runCli(args, options = {}, write = (text) => { process.std
|
|
|
801
802
|
return 1;
|
|
802
803
|
}
|
|
803
804
|
}
|
|
805
|
+
if (args[0] === "share") {
|
|
806
|
+
if (args.length !== 2 || args[1] === "--help" || args[1] === "-h") {
|
|
807
|
+
write("Usage: piewf share <run-id>\n\nExports the run as a static Trajectory report and uploads it as a secret GitHub gist via the gh CLI.\nSecret gists are unlisted, not private: anyone with the link can read the full report.\n");
|
|
808
|
+
return args.some((arg) => arg === "--help" || arg === "-h") ? 0 : 1;
|
|
809
|
+
}
|
|
810
|
+
try {
|
|
811
|
+
const runId = requiredArg(args, 1);
|
|
812
|
+
const cwd = options.cwd ?? process.cwd();
|
|
813
|
+
let sessionId;
|
|
814
|
+
for (const candidate of await listPersistedSessionIds(cwd)) {
|
|
815
|
+
if ((await listRunIds(cwd, candidate, homedir(), false)).includes(runId)) {
|
|
816
|
+
sessionId = candidate;
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
if (!sessionId) {
|
|
821
|
+
stderr(`Error: workflow run ${runId} was not found under ${cwd}\n`);
|
|
822
|
+
return 1;
|
|
823
|
+
}
|
|
824
|
+
const result = await shareTrajectoryRun({ cwd, sessionId, runId });
|
|
825
|
+
write(`Share URL: ${result.shareUrl}\nGist: ${result.gistUrl}\nSecret gist: anyone with the link can read the full report.\n`);
|
|
826
|
+
return 0;
|
|
827
|
+
}
|
|
828
|
+
catch (error) {
|
|
829
|
+
stderr(`Error: ${errorText(error)}\n`);
|
|
830
|
+
return 1;
|
|
831
|
+
}
|
|
832
|
+
}
|
|
804
833
|
if (args[0] === "bundle" || args[0] === "run" || args[0] === "export") {
|
|
805
834
|
try {
|
|
806
835
|
const workflowOptions = { write, stderr, ...(options.cwd !== undefined ? { cwd: options.cwd } : {}), ...(options.agentDir !== undefined ? { agentDir: options.agentDir } : {}), ...(options.signal ? { signal: options.signal } : {}), ...(options.trustOverride !== undefined ? { trustOverride: options.trustOverride } : {}), ...(options.isTTY !== undefined ? { isTTY: options.isTTY } : {}), ...(options.skillPaths?.length ? { skillPaths: [...options.skillPaths] } : {}) };
|
|
@@ -813,7 +842,7 @@ export async function runCli(args, options = {}, write = (text) => { process.std
|
|
|
813
842
|
return 1;
|
|
814
843
|
}
|
|
815
844
|
}
|
|
816
|
-
write("Usage: piewf doctor [role] [--role <role>] [--prompt <text>] [--json] | inspect [session-id] [--json|--summary] [--failed] | transcript <session-file> | bundle <workflow-name> [--name <command>] [--output <path>] [--force] | run <workflow-name> [workflow arguments] | export <workflow-name> [--name <command>] [--output <path>] [--force] [--bundle]\n");
|
|
845
|
+
write("Usage: piewf doctor [role] [--role <role>] [--prompt <text>] [--json] | inspect [session-id] [--json|--summary] [--failed] | transcript <session-file> | share <run-id> | bundle <workflow-name> [--name <command>] [--output <path>] [--force] | run <workflow-name> [workflow arguments] | export <workflow-name> [--name <command>] [--output <path>] [--force] [--bundle]\n");
|
|
817
846
|
return 1;
|
|
818
847
|
}
|
|
819
848
|
if (process.argv[1] && import.meta.url === pathToFileURL(realpathSync(process.argv[1])).href) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piewf/cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "CLI for pi-extensible-workflows",
|
|
5
5
|
"homepage": "https://vekexasia.github.io/pi-extensible-workflows/",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"pi-extensible-workflows": "5.
|
|
49
|
+
"pi-extensible-workflows": "5.9.0"
|
|
50
50
|
},
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|