@myapihq/cli 1.0.2 → 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/src/commands/account.d.ts +4 -0
- package/dist/cli/src/commands/account.js +91 -0
- package/dist/cli/src/commands/billing.d.ts +4 -0
- package/dist/cli/src/commands/billing.js +34 -0
- package/dist/cli/src/commands/domain.d.ts +5 -0
- package/dist/cli/src/commands/domain.js +56 -0
- package/dist/cli/src/commands/email.d.ts +8 -0
- package/dist/cli/src/commands/email.js +95 -0
- package/dist/cli/src/commands/funnel.d.ts +3 -0
- package/dist/cli/src/commands/funnel.js +37 -0
- package/dist/cli/src/commands/image.d.ts +2 -0
- package/dist/cli/src/commands/image.js +47 -0
- package/dist/cli/src/commands/org.d.ts +5 -0
- package/dist/cli/src/commands/org.js +67 -0
- package/dist/cli/src/commands/setup.d.ts +1 -0
- package/dist/cli/src/commands/setup.js +165 -0
- package/dist/cli/src/commands/storage.d.ts +3 -0
- package/dist/cli/src/commands/storage.js +36 -0
- package/dist/cli/src/commands/webhook.d.ts +3 -0
- package/dist/cli/src/commands/webhook.js +28 -0
- package/dist/cli/src/commands/workflow.d.ts +5 -0
- package/dist/cli/src/commands/workflow.js +57 -0
- package/dist/cli/src/config.d.ts +8 -0
- package/dist/cli/src/config.js +69 -0
- package/dist/cli/src/index.d.ts +2 -0
- package/dist/cli/src/index.js +117 -0
- package/dist/cli/src/output.d.ts +5 -0
- package/dist/cli/src/output.js +42 -0
- package/dist/cli/src/utils.d.ts +5 -0
- package/dist/cli/src/utils.js +34 -0
- package/dist/commands/setup.js +26 -5
- package/dist/commands/storage.js +12 -3
- package/dist/index.js +19 -12
- package/dist/sdk/src/client.d.ts +6 -0
- package/dist/sdk/src/client.js +51 -0
- package/dist/sdk/src/domain.d.ts +32 -0
- package/dist/sdk/src/domain.js +36 -0
- package/dist/sdk/src/email.d.ts +144 -0
- package/dist/sdk/src/email.js +116 -0
- package/dist/sdk/src/funnel.d.ts +31 -0
- package/dist/sdk/src/funnel.js +28 -0
- package/dist/sdk/src/hq.d.ts +84 -0
- package/dist/sdk/src/hq.js +80 -0
- package/dist/sdk/src/image.d.ts +21 -0
- package/dist/sdk/src/image.js +16 -0
- package/dist/sdk/src/index.d.ts +11 -0
- package/dist/sdk/src/index.js +51 -0
- package/dist/sdk/src/pixel.d.ts +65 -0
- package/dist/sdk/src/pixel.js +44 -0
- package/dist/sdk/src/storage.d.ts +10 -0
- package/dist/sdk/src/storage.js +48 -0
- package/dist/sdk/src/types.d.ts +17 -0
- package/dist/sdk/src/types.js +2 -0
- package/dist/sdk/src/webhook.d.ts +20 -0
- package/dist/sdk/src/webhook.js +20 -0
- package/dist/sdk/src/workflow.d.ts +56 -0
- package/dist/sdk/src/workflow.js +40 -0
- package/package.json +1 -1
- package/src/commands/setup.ts +33 -7
- package/src/commands/storage.ts +12 -3
- package/src/index.ts +15 -23
- package/tsconfig.json +5 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface InteractionsResponse {
|
|
2
|
+
interactions: (Visit | PixelEvent)[];
|
|
3
|
+
total_visits: number;
|
|
4
|
+
total_events: number;
|
|
5
|
+
limit: number;
|
|
6
|
+
offset: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Visit {
|
|
9
|
+
type: 'visit';
|
|
10
|
+
pixel_id: string;
|
|
11
|
+
from_url: string;
|
|
12
|
+
to_url: string;
|
|
13
|
+
ts: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PixelEvent {
|
|
16
|
+
type: 'event';
|
|
17
|
+
pixel_id: string;
|
|
18
|
+
event_type: 'sent' | 'open' | 'click' | 'page_visit';
|
|
19
|
+
url?: string;
|
|
20
|
+
campaign_id?: string;
|
|
21
|
+
ts: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function getInteractions(apiKey: string, params: {
|
|
24
|
+
website?: string;
|
|
25
|
+
domain?: string;
|
|
26
|
+
campaign_id?: string;
|
|
27
|
+
from?: string;
|
|
28
|
+
to?: string;
|
|
29
|
+
limit?: number;
|
|
30
|
+
offset?: number;
|
|
31
|
+
}): Promise<InteractionsResponse>;
|
|
32
|
+
export declare function getVisits(apiKey: string, params: {
|
|
33
|
+
website: string;
|
|
34
|
+
from?: string;
|
|
35
|
+
to?: string;
|
|
36
|
+
limit?: number;
|
|
37
|
+
offset?: number;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
visits: Visit[];
|
|
40
|
+
total: number;
|
|
41
|
+
limit: number;
|
|
42
|
+
offset: number;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function getEvents(apiKey: string, params: {
|
|
45
|
+
campaign_id?: string;
|
|
46
|
+
domain?: string;
|
|
47
|
+
from?: string;
|
|
48
|
+
to?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
}): Promise<{
|
|
52
|
+
events: PixelEvent[];
|
|
53
|
+
total: number;
|
|
54
|
+
limit: number;
|
|
55
|
+
offset: number;
|
|
56
|
+
}>;
|
|
57
|
+
export declare function getIdentity(apiKey: string, pixelId: string): Promise<{
|
|
58
|
+
uuid: string;
|
|
59
|
+
is_resolved: boolean;
|
|
60
|
+
nodes: Record<string, {
|
|
61
|
+
type: string;
|
|
62
|
+
probability: number;
|
|
63
|
+
}>;
|
|
64
|
+
latency_ms: number;
|
|
65
|
+
}>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInteractions = getInteractions;
|
|
4
|
+
exports.getVisits = getVisits;
|
|
5
|
+
exports.getEvents = getEvents;
|
|
6
|
+
exports.getIdentity = getIdentity;
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
const BASE_URL = 'https://api.mypixelapi.com';
|
|
9
|
+
async function getInteractions(apiKey, params) {
|
|
10
|
+
const qs = new URLSearchParams();
|
|
11
|
+
for (const [key, val] of Object.entries(params)) {
|
|
12
|
+
if (val !== undefined && val !== null) {
|
|
13
|
+
qs.set(key, String(val));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const queryString = qs.toString();
|
|
17
|
+
const url = `${BASE_URL}/pixel/interactions${queryString ? `?${queryString}` : ''}`;
|
|
18
|
+
return (0, client_1.request)('GET', url, apiKey);
|
|
19
|
+
}
|
|
20
|
+
async function getVisits(apiKey, params) {
|
|
21
|
+
const qs = new URLSearchParams();
|
|
22
|
+
for (const [key, val] of Object.entries(params)) {
|
|
23
|
+
if (val !== undefined && val !== null) {
|
|
24
|
+
qs.set(key, String(val));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const queryString = qs.toString();
|
|
28
|
+
const url = `${BASE_URL}/pixel/visits${queryString ? `?${queryString}` : ''}`;
|
|
29
|
+
return (0, client_1.request)('GET', url, apiKey);
|
|
30
|
+
}
|
|
31
|
+
async function getEvents(apiKey, params) {
|
|
32
|
+
const qs = new URLSearchParams();
|
|
33
|
+
for (const [key, val] of Object.entries(params)) {
|
|
34
|
+
if (val !== undefined && val !== null) {
|
|
35
|
+
qs.set(key, String(val));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const queryString = qs.toString();
|
|
39
|
+
const url = `${BASE_URL}/pixel/events${queryString ? `?${queryString}` : ''}`;
|
|
40
|
+
return (0, client_1.request)('GET', url, apiKey);
|
|
41
|
+
}
|
|
42
|
+
async function getIdentity(apiKey, pixelId) {
|
|
43
|
+
return (0, client_1.request)('GET', `${BASE_URL}/pixel/identity/${encodeURIComponent(pixelId)}`, apiKey);
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Asset {
|
|
2
|
+
asset_id: string;
|
|
3
|
+
url: string;
|
|
4
|
+
name: string;
|
|
5
|
+
created_at: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ingestAsset(apiKey: string, orgId: string, url: string, name?: string): Promise<Asset>;
|
|
8
|
+
export declare function uploadAsset(apiKey: string, orgId: string, file: Blob | Buffer, contentType: 'image/jpeg' | 'image/png', name?: string): Promise<Asset>;
|
|
9
|
+
export declare function listAssets(apiKey: string, orgId: string): Promise<Asset[]>;
|
|
10
|
+
export declare function deleteAsset(apiKey: string, orgId: string, assetId: string): Promise<void>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ingestAsset = ingestAsset;
|
|
4
|
+
exports.uploadAsset = uploadAsset;
|
|
5
|
+
exports.listAssets = listAssets;
|
|
6
|
+
exports.deleteAsset = deleteAsset;
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
const BASE_URL = 'https://api.mystorageapi.com';
|
|
9
|
+
async function ingestAsset(apiKey, orgId, url, name) {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/ingest`, apiKey, { url, name });
|
|
11
|
+
}
|
|
12
|
+
async function uploadAsset(apiKey, orgId, file, contentType, name) {
|
|
13
|
+
const headers = {
|
|
14
|
+
'Authorization': `Bearer ${apiKey}`
|
|
15
|
+
};
|
|
16
|
+
const formData = new FormData();
|
|
17
|
+
formData.append('file', new Blob([file], { type: contentType }));
|
|
18
|
+
if (name) {
|
|
19
|
+
formData.append('name', name);
|
|
20
|
+
}
|
|
21
|
+
const response = await fetch(`${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/upload`, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers,
|
|
24
|
+
body: formData
|
|
25
|
+
});
|
|
26
|
+
let result;
|
|
27
|
+
try {
|
|
28
|
+
result = await response.json();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
throw new client_1.MyApiError('invalid_json_response', response.status);
|
|
32
|
+
}
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
const code = result?.error || 'unknown_error';
|
|
35
|
+
throw new client_1.MyApiError(code, response.status);
|
|
36
|
+
}
|
|
37
|
+
const apiResponse = result;
|
|
38
|
+
if (!apiResponse.success) {
|
|
39
|
+
throw new client_1.MyApiError(apiResponse.error || 'unknown_error', response.status);
|
|
40
|
+
}
|
|
41
|
+
return apiResponse.data;
|
|
42
|
+
}
|
|
43
|
+
async function listAssets(apiKey, orgId) {
|
|
44
|
+
return (0, client_1.request)('GET', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets`, apiKey);
|
|
45
|
+
}
|
|
46
|
+
async function deleteAsset(apiKey, orgId, assetId) {
|
|
47
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/storage/orgs/${encodeURIComponent(orgId)}/assets/${encodeURIComponent(assetId)}`, apiKey);
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ApiResponse<T> {
|
|
2
|
+
success: boolean;
|
|
3
|
+
data: T | null;
|
|
4
|
+
error: string | null;
|
|
5
|
+
meta: {
|
|
6
|
+
request_id: string;
|
|
7
|
+
latency_ms: number;
|
|
8
|
+
service: string;
|
|
9
|
+
version: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export interface PaginatedResponse<T> {
|
|
13
|
+
data: T[];
|
|
14
|
+
total: number;
|
|
15
|
+
limit: number;
|
|
16
|
+
offset: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface WebhookEndpoint {
|
|
2
|
+
id: string;
|
|
3
|
+
org_id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
inbound_url: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Delivery {
|
|
10
|
+
id: string;
|
|
11
|
+
endpoint_id: string;
|
|
12
|
+
payload: unknown;
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
status: string;
|
|
15
|
+
created_at: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function createEndpoint(apiKey: string, orgId: string, name: string, description?: string): Promise<WebhookEndpoint>;
|
|
18
|
+
export declare function listEndpoints(apiKey: string): Promise<WebhookEndpoint[]>;
|
|
19
|
+
export declare function deleteEndpoint(apiKey: string, endpointId: string): Promise<void>;
|
|
20
|
+
export declare function getDelivery(apiKey: string, deliveryId: string): Promise<Delivery>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEndpoint = createEndpoint;
|
|
4
|
+
exports.listEndpoints = listEndpoints;
|
|
5
|
+
exports.deleteEndpoint = deleteEndpoint;
|
|
6
|
+
exports.getDelivery = getDelivery;
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
const BASE_URL = 'https://api.mywebhookapi.com';
|
|
9
|
+
async function createEndpoint(apiKey, orgId, name, description) {
|
|
10
|
+
return (0, client_1.request)('POST', `${BASE_URL}/webhook/endpoints`, apiKey, { org_id: orgId, name, description });
|
|
11
|
+
}
|
|
12
|
+
async function listEndpoints(apiKey) {
|
|
13
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/endpoints`, apiKey);
|
|
14
|
+
}
|
|
15
|
+
async function deleteEndpoint(apiKey, endpointId) {
|
|
16
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/webhook/endpoints/${encodeURIComponent(endpointId)}`, apiKey);
|
|
17
|
+
}
|
|
18
|
+
async function getDelivery(apiKey, deliveryId) {
|
|
19
|
+
return (0, client_1.request)('GET', `${BASE_URL}/webhook/deliveries/${encodeURIComponent(deliveryId)}`, apiKey);
|
|
20
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type WorkflowStep = {
|
|
2
|
+
type: 'send_email';
|
|
3
|
+
from: string;
|
|
4
|
+
to: string;
|
|
5
|
+
subject: string;
|
|
6
|
+
template_id?: string;
|
|
7
|
+
html?: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'slack_message';
|
|
10
|
+
webhook_url: string;
|
|
11
|
+
text: string;
|
|
12
|
+
};
|
|
13
|
+
export interface Workflow {
|
|
14
|
+
id: string;
|
|
15
|
+
org_id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
status: 'enabled' | 'disabled';
|
|
18
|
+
trigger_config: {
|
|
19
|
+
endpoint_id: string;
|
|
20
|
+
};
|
|
21
|
+
steps: WorkflowStep[];
|
|
22
|
+
created_at: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WorkflowRun {
|
|
25
|
+
id: string;
|
|
26
|
+
workflow_id: string;
|
|
27
|
+
trigger_payload: unknown;
|
|
28
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
29
|
+
error?: string;
|
|
30
|
+
attempt: number;
|
|
31
|
+
started_at: string;
|
|
32
|
+
finished_at?: string;
|
|
33
|
+
created_at: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function createWorkflow(apiKey: string, payload: {
|
|
36
|
+
org_id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
trigger_config: {
|
|
39
|
+
endpoint_id: string;
|
|
40
|
+
};
|
|
41
|
+
steps: WorkflowStep[];
|
|
42
|
+
}): Promise<Workflow>;
|
|
43
|
+
export declare function listWorkflows(apiKey: string): Promise<Workflow[]>;
|
|
44
|
+
export declare function getWorkflow(apiKey: string, workflowId: string): Promise<Workflow>;
|
|
45
|
+
export declare function updateWorkflow(apiKey: string, workflowId: string, payload: {
|
|
46
|
+
name?: string;
|
|
47
|
+
trigger_config?: {
|
|
48
|
+
endpoint_id: string;
|
|
49
|
+
};
|
|
50
|
+
steps?: WorkflowStep[];
|
|
51
|
+
}): Promise<Workflow>;
|
|
52
|
+
export declare function enableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
53
|
+
export declare function disableWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
54
|
+
export declare function deleteWorkflow(apiKey: string, workflowId: string): Promise<void>;
|
|
55
|
+
export declare function listWorkflowRuns(apiKey: string, workflowId: string): Promise<WorkflowRun[]>;
|
|
56
|
+
export declare function getWorkflowRun(apiKey: string, runId: string): Promise<WorkflowRun>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createWorkflow = createWorkflow;
|
|
4
|
+
exports.listWorkflows = listWorkflows;
|
|
5
|
+
exports.getWorkflow = getWorkflow;
|
|
6
|
+
exports.updateWorkflow = updateWorkflow;
|
|
7
|
+
exports.enableWorkflow = enableWorkflow;
|
|
8
|
+
exports.disableWorkflow = disableWorkflow;
|
|
9
|
+
exports.deleteWorkflow = deleteWorkflow;
|
|
10
|
+
exports.listWorkflowRuns = listWorkflowRuns;
|
|
11
|
+
exports.getWorkflowRun = getWorkflowRun;
|
|
12
|
+
const client_1 = require("./client");
|
|
13
|
+
const BASE_URL = 'https://api.myworkflowapi.com';
|
|
14
|
+
async function createWorkflow(apiKey, payload) {
|
|
15
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows`, apiKey, payload);
|
|
16
|
+
}
|
|
17
|
+
async function listWorkflows(apiKey) {
|
|
18
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows`, apiKey);
|
|
19
|
+
}
|
|
20
|
+
async function getWorkflow(apiKey, workflowId) {
|
|
21
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
22
|
+
}
|
|
23
|
+
async function updateWorkflow(apiKey, workflowId, payload) {
|
|
24
|
+
return (0, client_1.request)('PATCH', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey, payload);
|
|
25
|
+
}
|
|
26
|
+
async function enableWorkflow(apiKey, workflowId) {
|
|
27
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/enable`, apiKey);
|
|
28
|
+
}
|
|
29
|
+
async function disableWorkflow(apiKey, workflowId) {
|
|
30
|
+
return (0, client_1.request)('POST', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/disable`, apiKey);
|
|
31
|
+
}
|
|
32
|
+
async function deleteWorkflow(apiKey, workflowId) {
|
|
33
|
+
return (0, client_1.request)('DELETE', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}`, apiKey);
|
|
34
|
+
}
|
|
35
|
+
async function listWorkflowRuns(apiKey, workflowId) {
|
|
36
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/workflows/${encodeURIComponent(workflowId)}/runs`, apiKey);
|
|
37
|
+
}
|
|
38
|
+
async function getWorkflowRun(apiKey, runId) {
|
|
39
|
+
return (0, client_1.request)('GET', `${BASE_URL}/workflow/runs/${encodeURIComponent(runId)}`, apiKey);
|
|
40
|
+
}
|
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/commands/storage.ts
CHANGED
|
@@ -2,22 +2,31 @@ import { storage as sdkStorage } from '@myapihq/sdk';
|
|
|
2
2
|
import { requireConfig } from '../config.js';
|
|
3
3
|
import { success, error, printTable } from '../output.js';
|
|
4
4
|
|
|
5
|
+
function getOrgId(flags: Record<string, string | boolean>, config: any): string {
|
|
6
|
+
const orgId = flags.org || config.org_id;
|
|
7
|
+
if (!orgId) error("Missing org-id. Pass --org or set it in config.");
|
|
8
|
+
return orgId as string;
|
|
9
|
+
}
|
|
10
|
+
|
|
5
11
|
export async function list(flags: Record<string, string | boolean>) {
|
|
6
12
|
const config = requireConfig();
|
|
7
|
-
const
|
|
13
|
+
const orgId = getOrgId(flags, config);
|
|
14
|
+
const assets = await sdkStorage.listAssets(config.api_key, orgId);
|
|
8
15
|
printTable(assets as unknown as Record<string, unknown>[]);
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
export async function ingest(url: string, flags: Record<string, string | boolean>) {
|
|
12
19
|
if (!url) error("Missing url");
|
|
13
20
|
const config = requireConfig();
|
|
14
|
-
const
|
|
21
|
+
const orgId = getOrgId(flags, config);
|
|
22
|
+
const res = await sdkStorage.ingestAsset(config.api_key, orgId, url, flags.name as string);
|
|
15
23
|
success(`Asset ingested! ID: ${res.asset_id}\nHosted URL: ${res.url}`);
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export async function del(id: string, flags: Record<string, string | boolean>) {
|
|
19
27
|
if (!id) error("Missing id");
|
|
20
28
|
const config = requireConfig();
|
|
21
|
-
|
|
29
|
+
const orgId = getOrgId(flags, config);
|
|
30
|
+
await sdkStorage.deleteAsset(config.api_key, orgId, id);
|
|
22
31
|
success(`Asset ${id} deleted`);
|
|
23
32
|
}
|
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)); });
|
package/tsconfig.json
CHANGED
|
@@ -8,7 +8,11 @@
|
|
|
8
8
|
"strict": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"paths": {
|
|
13
|
+
"@myapihq/sdk": ["../sdk/src/index.ts"],
|
|
14
|
+
"@myapihq/sdk/*": ["../sdk/src/*"]
|
|
15
|
+
}
|
|
12
16
|
},
|
|
13
17
|
"include": ["src/**/*"]
|
|
14
18
|
}
|