stpr 1.0.3 → 1.0.5
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.js +18 -18
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -324,9 +324,14 @@ async function runLoginFlow(baseUrl) {
|
|
|
324
324
|
const returnedState = url.searchParams.get("state");
|
|
325
325
|
const error = url.searchParams.get("error");
|
|
326
326
|
if (error) {
|
|
327
|
+
const escapeHtml = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
328
|
+
const safeError = escapeHtml(error);
|
|
329
|
+
const safeDesc = escapeHtml(
|
|
330
|
+
url.searchParams.get("error_description") ?? "Unknown error"
|
|
331
|
+
);
|
|
327
332
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
328
333
|
res.end(
|
|
329
|
-
`<html><body><h1>Login failed</h1><p>${
|
|
334
|
+
`<html><body><h1>Login failed</h1><p>${safeError}: ${safeDesc}</p><p>You can close this tab.</p></body></html>`
|
|
330
335
|
);
|
|
331
336
|
server.close();
|
|
332
337
|
reject(new Error(`OAuth error: ${error}`));
|
|
@@ -549,9 +554,7 @@ Commands:
|
|
|
549
554
|
whoami Show active skillset and server info
|
|
550
555
|
list [<service>] List available skills (optionally for a service). Use --verbose for inputSchema.
|
|
551
556
|
status <statusId> Poll the status of a component tool run
|
|
552
|
-
|
|
553
557
|
<service> List available skills for that service. Use --verbose for inputSchema.
|
|
554
|
-
|
|
555
558
|
<service> <action> (-i <json> | stdin)
|
|
556
559
|
Get the current parameters for a skill (default, for dynamic parameters)
|
|
557
560
|
<service> <action> --call (-i <json> | stdin)
|
|
@@ -576,20 +579,12 @@ Examples:
|
|
|
576
579
|
Auth (optional, can use STEPPER_SKILL_TOKEN env var, or --token <token> from https://app.stepper.io/flow/skill-sets):
|
|
577
580
|
stpr login
|
|
578
581
|
|
|
579
|
-
List available skills:
|
|
580
|
-
stpr list
|
|
581
|
-
stpr stripe
|
|
582
|
-
|
|
583
|
-
|
|
584
582
|
Load parameters:
|
|
585
583
|
By default, requesting a skill returns the current parameters only; it does
|
|
586
584
|
not call the skill. Use --call to execute the action.
|
|
587
585
|
|
|
588
586
|
stpr google-sheets add_row -i '{"spreadsheet_id": "abc123"}'
|
|
589
587
|
|
|
590
|
-
Call a skill:
|
|
591
|
-
stpr stripe create_customer --call -i '{"email": "test@example.com"}'
|
|
592
|
-
|
|
593
588
|
Dynamic dropdown options:
|
|
594
589
|
Some actions have dynamic dropdown options, which change depending on the
|
|
595
590
|
value of other parameters. You can request the current dropdown options for
|
|
@@ -597,12 +592,12 @@ Examples:
|
|
|
597
592
|
options only, it will not call the skill. Dynamic dropdowns are also often
|
|
598
593
|
searchable and paginated via a cursor.
|
|
599
594
|
|
|
600
|
-
stpr google-sheets
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
595
|
+
stpr google-sheets add_row --options worksheet_id -i '{"spreadsheet_id": "abc123"}' --search "Sheet" --cursor "next_page"
|
|
596
|
+
|
|
597
|
+
Call a skill:
|
|
598
|
+
stpr google-sheets create_sheet --call -i '{"name": "My Sheet", "columns": "Name, Email, Phone"}'
|
|
599
|
+
|
|
600
|
+
`);
|
|
606
601
|
}
|
|
607
602
|
function die(message) {
|
|
608
603
|
process.stderr.write(`\x1B[31m[Error] ${message} \x1B[0m
|
|
@@ -776,7 +771,7 @@ async function main() {
|
|
|
776
771
|
const service2 = args[0];
|
|
777
772
|
const tools = await client.listTools({ service: service2 ?? void 0 });
|
|
778
773
|
const formatted = formatToolsForList(tools, verboseFlag);
|
|
779
|
-
if (!
|
|
774
|
+
if (!tools.length) {
|
|
780
775
|
die(
|
|
781
776
|
service2 ? `No skills found for service "${service2}".` : "No skills found."
|
|
782
777
|
);
|
|
@@ -793,6 +788,11 @@ async function main() {
|
|
|
793
788
|
}
|
|
794
789
|
if (!action) {
|
|
795
790
|
const tools = await client.listTools({ service });
|
|
791
|
+
if (!tools.length) {
|
|
792
|
+
die(
|
|
793
|
+
service ? `No skills found for service "${service}".` : "No skills found."
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
796
|
const formatted = verboseFlag ? formatToolsForList(tools, verboseFlag) : tools.map(({ action: action2 }) => action2);
|
|
797
797
|
console.log(JSON.stringify(formatted, null, 2));
|
|
798
798
|
return;
|