@myapihq/cli 1.0.2 → 1.0.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/commands/setup.js +26 -5
- package/dist/index.js +19 -12
- package/package.json +1 -1
- package/src/commands/setup.ts +33 -7
- package/src/index.ts +15 -23
package/dist/commands/setup.js
CHANGED
|
@@ -112,9 +112,13 @@ async function setup() {
|
|
|
112
112
|
}
|
|
113
113
|
// Step 2: which agents
|
|
114
114
|
(0, output_js_1.info)('\nWhich AI agents do you use?');
|
|
115
|
-
const useClaude = yn(await ask(rl, ' Claude Code?
|
|
116
|
-
const useGemini = yn(await ask(rl, ' Gemini CLI?
|
|
117
|
-
const useCursor = yn(await ask(rl, ' Cursor
|
|
115
|
+
const useClaude = yn(await ask(rl, ' Claude Code? [Y/n]: '), true);
|
|
116
|
+
const useGemini = yn(await ask(rl, ' Gemini CLI? [Y/n]: '), true);
|
|
117
|
+
const useCursor = yn(await ask(rl, ' Cursor? [y/N]: '), false);
|
|
118
|
+
const useWindsurf = yn(await ask(rl, ' Windsurf? [y/N]: '), false);
|
|
119
|
+
const useKiro = yn(await ask(rl, ' Kiro? [y/N]: '), false);
|
|
120
|
+
const useCopilot = yn(await ask(rl, ' GitHub Copilot? [y/N]: '), false);
|
|
121
|
+
const useOther = yn(await ask(rl, ' Other / Codex? [y/N]: '), false);
|
|
118
122
|
// Step 3: Claude — MCP or Skills or both
|
|
119
123
|
let claudeMcp = false;
|
|
120
124
|
let claudeSkills = false;
|
|
@@ -135,9 +139,26 @@ async function setup() {
|
|
|
135
139
|
(0, output_js_1.info)(' /plugin marketplace add myapihq/claude-skills');
|
|
136
140
|
(0, output_js_1.info)(' /plugin install my-api-hq@myapi-skills');
|
|
137
141
|
}
|
|
142
|
+
const skillsUrl = 'https://github.com/myapihq/agent-skills/blob/main/skills/my-api-hq/SKILL.md';
|
|
138
143
|
if (useCursor) {
|
|
139
|
-
(0, output_js_1.info)('\
|
|
140
|
-
(0, output_js_1.info)(
|
|
144
|
+
(0, output_js_1.info)('\nCursor — copy the skill into .cursor/rules/:');
|
|
145
|
+
(0, output_js_1.info)(` ${skillsUrl}`);
|
|
146
|
+
}
|
|
147
|
+
if (useWindsurf) {
|
|
148
|
+
(0, output_js_1.info)('\nWindsurf — add the skill to your rules configuration:');
|
|
149
|
+
(0, output_js_1.info)(` ${skillsUrl}`);
|
|
150
|
+
}
|
|
151
|
+
if (useKiro) {
|
|
152
|
+
(0, output_js_1.info)('\nKiro — copy the skill into .kiro/skills/:');
|
|
153
|
+
(0, output_js_1.info)(` ${skillsUrl}`);
|
|
154
|
+
}
|
|
155
|
+
if (useCopilot) {
|
|
156
|
+
(0, output_js_1.info)('\nGitHub Copilot — paste the skill into .github/copilot-instructions.md:');
|
|
157
|
+
(0, output_js_1.info)(` ${skillsUrl}`);
|
|
158
|
+
}
|
|
159
|
+
if (useOther) {
|
|
160
|
+
(0, output_js_1.info)('\nOther agents — copy the skill markdown as a system prompt or instruction file:');
|
|
161
|
+
(0, output_js_1.info)(` ${skillsUrl}`);
|
|
141
162
|
}
|
|
142
163
|
(0, output_js_1.info)('');
|
|
143
164
|
(0, output_js_1.success)('Setup complete! Try: myapi billing balance');
|
package/dist/index.js
CHANGED
|
@@ -34,11 +34,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
37
38
|
const utils_js_1 = require("./utils.js");
|
|
38
39
|
const output_js_1 = require("./output.js");
|
|
39
40
|
const sdk_1 = require("@myapihq/sdk");
|
|
40
41
|
const accountCmd = __importStar(require("./commands/account.js"));
|
|
41
42
|
const billingCmd = __importStar(require("./commands/billing.js"));
|
|
43
|
+
const orgCmd = __importStar(require("./commands/org.js"));
|
|
42
44
|
const setupCmd = __importStar(require("./commands/setup.js"));
|
|
43
45
|
async function main() {
|
|
44
46
|
const { args, flags } = (0, utils_js_1.parseArgs)(process.argv.slice(2));
|
|
@@ -64,6 +66,14 @@ async function main() {
|
|
|
64
66
|
else
|
|
65
67
|
printHelp();
|
|
66
68
|
break;
|
|
69
|
+
case 'org':
|
|
70
|
+
if (subcommand === 'list')
|
|
71
|
+
await orgCmd.list(flags);
|
|
72
|
+
else if (subcommand === 'create')
|
|
73
|
+
await orgCmd.create(flags);
|
|
74
|
+
else
|
|
75
|
+
printHelp();
|
|
76
|
+
break;
|
|
67
77
|
case 'billing':
|
|
68
78
|
if (subcommand === 'balance')
|
|
69
79
|
await billingCmd.balance(flags);
|
|
@@ -83,12 +93,10 @@ async function main() {
|
|
|
83
93
|
}
|
|
84
94
|
catch (err) {
|
|
85
95
|
if (err instanceof sdk_1.MyApiError) {
|
|
86
|
-
if (err.status === 402)
|
|
87
|
-
(0, output_js_1.error)(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
(0, output_js_1.error)("Invalid API key. Run: myapi account create");
|
|
91
|
-
}
|
|
96
|
+
if (err.status === 402)
|
|
97
|
+
(0, output_js_1.error)('Insufficient balance. Run: myapi billing topup <amount>');
|
|
98
|
+
else if (err.status === 401)
|
|
99
|
+
(0, output_js_1.error)('Invalid API key. Run: myapi setup');
|
|
92
100
|
}
|
|
93
101
|
(0, output_js_1.error)(err.message || String(err));
|
|
94
102
|
}
|
|
@@ -99,12 +107,11 @@ function printHelp() {
|
|
|
99
107
|
Usage: myapi <command> [subcommand] [args]
|
|
100
108
|
|
|
101
109
|
Commands:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
account
|
|
111
|
+
billing
|
|
112
|
+
org
|
|
113
|
+
setup
|
|
105
114
|
|
|
106
115
|
Run "myapi <command>" for subcommand help.`);
|
|
107
116
|
}
|
|
108
|
-
main().catch(err => {
|
|
109
|
-
(0, output_js_1.error)(err.message || String(err));
|
|
110
|
-
});
|
|
117
|
+
main().catch(err => { (0, output_js_1.error)(err.message || String(err)); });
|
package/package.json
CHANGED
package/src/commands/setup.ts
CHANGED
|
@@ -82,9 +82,13 @@ export async function setup() {
|
|
|
82
82
|
|
|
83
83
|
// Step 2: which agents
|
|
84
84
|
info('\nWhich AI agents do you use?');
|
|
85
|
-
const useClaude
|
|
86
|
-
const useGemini
|
|
87
|
-
const useCursor
|
|
85
|
+
const useClaude = yn(await ask(rl, ' Claude Code? [Y/n]: '), true);
|
|
86
|
+
const useGemini = yn(await ask(rl, ' Gemini CLI? [Y/n]: '), true);
|
|
87
|
+
const useCursor = yn(await ask(rl, ' Cursor? [y/N]: '), false);
|
|
88
|
+
const useWindsurf = yn(await ask(rl, ' Windsurf? [y/N]: '), false);
|
|
89
|
+
const useKiro = yn(await ask(rl, ' Kiro? [y/N]: '), false);
|
|
90
|
+
const useCopilot = yn(await ask(rl, ' GitHub Copilot? [y/N]: '), false);
|
|
91
|
+
const useOther = yn(await ask(rl, ' Other / Codex? [y/N]: '), false);
|
|
88
92
|
|
|
89
93
|
// Step 3: Claude — MCP or Skills or both
|
|
90
94
|
let claudeMcp = false;
|
|
@@ -100,8 +104,8 @@ export async function setup() {
|
|
|
100
104
|
// Step 4: apply
|
|
101
105
|
info('\nApplying configuration...\n');
|
|
102
106
|
|
|
103
|
-
if (claudeMcp)
|
|
104
|
-
if (useGemini)
|
|
107
|
+
if (claudeMcp) registerClaudeMcp();
|
|
108
|
+
if (useGemini) registerGeminiMcp();
|
|
105
109
|
|
|
106
110
|
if (claudeSkills) {
|
|
107
111
|
info('To install the MyAPI skill inside Claude Code, run:');
|
|
@@ -109,9 +113,31 @@ export async function setup() {
|
|
|
109
113
|
info(' /plugin install my-api-hq@myapi-skills');
|
|
110
114
|
}
|
|
111
115
|
|
|
116
|
+
const skillsUrl = 'https://github.com/myapihq/agent-skills/blob/main/skills/my-api-hq/SKILL.md';
|
|
117
|
+
|
|
112
118
|
if (useCursor) {
|
|
113
|
-
info('\
|
|
114
|
-
info(
|
|
119
|
+
info('\nCursor — copy the skill into .cursor/rules/:');
|
|
120
|
+
info(` ${skillsUrl}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (useWindsurf) {
|
|
124
|
+
info('\nWindsurf — add the skill to your rules configuration:');
|
|
125
|
+
info(` ${skillsUrl}`);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (useKiro) {
|
|
129
|
+
info('\nKiro — copy the skill into .kiro/skills/:');
|
|
130
|
+
info(` ${skillsUrl}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (useCopilot) {
|
|
134
|
+
info('\nGitHub Copilot — paste the skill into .github/copilot-instructions.md:');
|
|
135
|
+
info(` ${skillsUrl}`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (useOther) {
|
|
139
|
+
info('\nOther agents — copy the skill markdown as a system prompt or instruction file:');
|
|
140
|
+
info(` ${skillsUrl}`);
|
|
115
141
|
}
|
|
116
142
|
|
|
117
143
|
info('');
|
package/src/index.ts
CHANGED
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
// AUTO-GENERATED by scripts/generate-indexes.js — do not edit manually
|
|
3
3
|
import { parseArgs } from './utils.js';
|
|
4
4
|
import { error, info } from './output.js';
|
|
5
5
|
import { MyApiError } from '@myapihq/sdk';
|
|
6
|
-
|
|
7
6
|
import * as accountCmd from './commands/account.js';
|
|
8
7
|
import * as billingCmd from './commands/billing.js';
|
|
8
|
+
import * as orgCmd from './commands/org.js';
|
|
9
9
|
import * as setupCmd from './commands/setup.js';
|
|
10
10
|
|
|
11
11
|
async function main() {
|
|
12
12
|
const { args, flags } = parseArgs(process.argv.slice(2));
|
|
13
|
-
|
|
14
|
-
if (args.length === 0) {
|
|
15
|
-
printHelp();
|
|
16
|
-
process.exit(0);
|
|
17
|
-
}
|
|
18
|
-
|
|
13
|
+
if (args.length === 0) { printHelp(); process.exit(0); }
|
|
19
14
|
const [command, subcommand, ...restArgs] = args;
|
|
20
|
-
|
|
21
15
|
try {
|
|
22
16
|
switch (command) {
|
|
23
17
|
case 'setup':
|
|
24
18
|
await setupCmd.setup();
|
|
25
19
|
break;
|
|
26
|
-
|
|
27
20
|
case 'account':
|
|
28
21
|
if (subcommand === 'create') await accountCmd.create();
|
|
29
22
|
else if (subcommand === 'token') await accountCmd.token(flags);
|
|
@@ -31,7 +24,11 @@ async function main() {
|
|
|
31
24
|
else if (subcommand === 'revoke') await accountCmd.revokeKey(restArgs[0], flags);
|
|
32
25
|
else printHelp();
|
|
33
26
|
break;
|
|
34
|
-
|
|
27
|
+
case 'org':
|
|
28
|
+
if (subcommand === 'list') await orgCmd.list(flags);
|
|
29
|
+
else if (subcommand === 'create') await orgCmd.create(flags);
|
|
30
|
+
else printHelp();
|
|
31
|
+
break;
|
|
35
32
|
case 'billing':
|
|
36
33
|
if (subcommand === 'balance') await billingCmd.balance(flags);
|
|
37
34
|
else if (subcommand === 'history') await billingCmd.history(flags);
|
|
@@ -39,18 +36,14 @@ async function main() {
|
|
|
39
36
|
else if (subcommand === 'setup') await billingCmd.setup(flags);
|
|
40
37
|
else printHelp();
|
|
41
38
|
break;
|
|
42
|
-
|
|
43
39
|
default:
|
|
44
40
|
printHelp();
|
|
45
41
|
process.exit(0);
|
|
46
42
|
}
|
|
47
43
|
} catch (err: any) {
|
|
48
44
|
if (err instanceof MyApiError) {
|
|
49
|
-
if (err.status === 402)
|
|
50
|
-
|
|
51
|
-
} else if (err.status === 401) {
|
|
52
|
-
error("Invalid API key. Run: myapi account create");
|
|
53
|
-
}
|
|
45
|
+
if (err.status === 402) error('Insufficient balance. Run: myapi billing topup <amount>');
|
|
46
|
+
else if (err.status === 401) error('Invalid API key. Run: myapi setup');
|
|
54
47
|
}
|
|
55
48
|
error(err.message || String(err));
|
|
56
49
|
}
|
|
@@ -62,13 +55,12 @@ function printHelp() {
|
|
|
62
55
|
Usage: myapi <command> [subcommand] [args]
|
|
63
56
|
|
|
64
57
|
Commands:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
account
|
|
59
|
+
billing
|
|
60
|
+
org
|
|
61
|
+
setup
|
|
68
62
|
|
|
69
63
|
Run "myapi <command>" for subcommand help.`);
|
|
70
64
|
}
|
|
71
65
|
|
|
72
|
-
main().catch(err => {
|
|
73
|
-
error(err.message || String(err));
|
|
74
|
-
});
|
|
66
|
+
main().catch(err => { error(err.message || String(err)); });
|