stpr 1.0.0 → 1.0.2
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 +29 -8
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -87,6 +87,13 @@ var StepperClient = class {
|
|
|
87
87
|
}
|
|
88
88
|
return res.result;
|
|
89
89
|
}
|
|
90
|
+
async pollStatus(statusId) {
|
|
91
|
+
const res = await this.rpc("tools/poll-status", { statusId });
|
|
92
|
+
if (res.error) {
|
|
93
|
+
throw new Error(`tools/poll-status failed: ${res.error.message}`);
|
|
94
|
+
}
|
|
95
|
+
return res.result;
|
|
96
|
+
}
|
|
90
97
|
async getToolParams(toolName, args) {
|
|
91
98
|
const res = await this.rpc("tools/params", {
|
|
92
99
|
name: toolName,
|
|
@@ -243,7 +250,7 @@ async function registerClient(baseUrl, redirectUri) {
|
|
|
243
250
|
method: "POST",
|
|
244
251
|
headers: { "Content-Type": "application/json" },
|
|
245
252
|
body: JSON.stringify({
|
|
246
|
-
client_name: "
|
|
253
|
+
client_name: "stpr CLI",
|
|
247
254
|
redirect_uris: [redirectUri],
|
|
248
255
|
grant_types: ["authorization_code", "refresh_token"],
|
|
249
256
|
token_endpoint_auth_method: "none",
|
|
@@ -541,6 +548,8 @@ Commands:
|
|
|
541
548
|
use <name> Switch active skillset
|
|
542
549
|
whoami Show active skillset and server info
|
|
543
550
|
list [<service>] List available skills (optionally for a service). Use --verbose for inputSchema.
|
|
551
|
+
status <statusId> Poll the status of a component tool run
|
|
552
|
+
|
|
544
553
|
<service> List available skills for that service. Use --verbose for inputSchema.
|
|
545
554
|
|
|
546
555
|
<service> <action> (-i <json> | stdin)
|
|
@@ -576,10 +585,10 @@ Examples:
|
|
|
576
585
|
By default, requesting a skill returns the current parameters only; it does
|
|
577
586
|
not call the skill. Use --call to execute the action.
|
|
578
587
|
|
|
579
|
-
|
|
588
|
+
stpr google-sheets add_row -i '{"spreadsheet_id": "abc123"}'
|
|
580
589
|
|
|
581
590
|
Call a skill:
|
|
582
|
-
|
|
591
|
+
stpr stripe create_customer --call -i '{"email": "test@example.com"}'
|
|
583
592
|
|
|
584
593
|
Dynamic dropdown options:
|
|
585
594
|
Some actions have dynamic dropdown options, which change depending on the
|
|
@@ -661,11 +670,11 @@ async function main() {
|
|
|
661
670
|
if (subcommand === "use") {
|
|
662
671
|
const name = args[0];
|
|
663
672
|
if (!name) {
|
|
664
|
-
die("Usage:
|
|
673
|
+
die("Usage: stpr use <name>");
|
|
665
674
|
}
|
|
666
675
|
const ok = setActiveSkillset(name);
|
|
667
676
|
if (!ok) {
|
|
668
|
-
die(`Skillset "${name}" not found. Run "
|
|
677
|
+
die(`Skillset "${name}" not found. Run "stpr profiles" to list.`);
|
|
669
678
|
}
|
|
670
679
|
process.stderr.write(`Switched to skillset "${name}".
|
|
671
680
|
`);
|
|
@@ -683,7 +692,7 @@ async function main() {
|
|
|
683
692
|
die(`Skillset "${skillsetName2}" not found.`);
|
|
684
693
|
}
|
|
685
694
|
die(
|
|
686
|
-
`Skillset "${skillsetName2}" has expired or invalid token. Run "
|
|
695
|
+
`Skillset "${skillsetName2}" has expired or invalid token. Run "stpr login" to re-authenticate.`
|
|
687
696
|
);
|
|
688
697
|
}
|
|
689
698
|
const client2 = new StepperClient(stored.token, stored.baseUrl);
|
|
@@ -720,7 +729,7 @@ async function main() {
|
|
|
720
729
|
const sets = listSkillsets();
|
|
721
730
|
if (sets.length === 0) {
|
|
722
731
|
process.stderr.write(
|
|
723
|
-
'No skillset configured. Run "
|
|
732
|
+
'No skillset configured. Run "stpr login" to add one.\n'
|
|
724
733
|
);
|
|
725
734
|
return;
|
|
726
735
|
}
|
|
@@ -746,11 +755,23 @@ async function main() {
|
|
|
746
755
|
}
|
|
747
756
|
if (!token) {
|
|
748
757
|
die(
|
|
749
|
-
'No token provided. Run "
|
|
758
|
+
'No token provided. Run "stpr login" or use --token or set STEPPER_SKILL_TOKEN env var.'
|
|
750
759
|
);
|
|
751
760
|
}
|
|
752
761
|
const client = new StepperClient(token, resolvedBaseUrl);
|
|
753
762
|
await client.initialize();
|
|
763
|
+
if (subcommand === "status") {
|
|
764
|
+
const statusId = args[0];
|
|
765
|
+
if (!statusId) {
|
|
766
|
+
die("Usage: stpr status <statusId>");
|
|
767
|
+
}
|
|
768
|
+
const result2 = await client.pollStatus(statusId);
|
|
769
|
+
if (result2.isError) {
|
|
770
|
+
die(result2.content.map((c) => c.text).join("\n"));
|
|
771
|
+
}
|
|
772
|
+
console.log(result2.content.map((c) => c.text).join("\n"));
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
754
775
|
if (subcommand === "list") {
|
|
755
776
|
const service2 = args[0];
|
|
756
777
|
const tools = await client.listTools({ service: service2 ?? void 0 });
|