@aisa-one/cli 0.2.4 → 0.5.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/CHANGELOG.md +172 -1
- package/LICENSE +21 -0
- package/README.md +163 -169
- package/dist/api.d.ts +10 -0
- package/dist/api.js +14 -3
- package/dist/catalog.d.ts +1 -18
- package/dist/catalog.js +1 -24
- package/dist/cli-error.d.ts +17 -0
- package/dist/cli-error.js +25 -0
- package/dist/cli-guidance.d.ts +14 -0
- package/dist/cli-guidance.js +55 -0
- package/dist/commands/account.d.ts +17 -0
- package/dist/commands/account.js +45 -1
- package/dist/commands/api.d.ts +0 -11
- package/dist/commands/api.js +6 -175
- package/dist/commands/auth.d.ts +2 -1
- package/dist/commands/auth.js +43 -9
- package/dist/commands/brand-logos.d.ts +6 -0
- package/dist/commands/brand-logos.js +21 -0
- package/dist/commands/configCmd.js +8 -3
- package/dist/commands/connect-shared.d.ts +136 -0
- package/dist/commands/connect-shared.js +143 -0
- package/dist/commands/connect-t2.d.ts +18 -0
- package/dist/commands/connect-t2.js +1599 -0
- package/dist/commands/connect-terminal.d.ts +65 -0
- package/dist/commands/connect-terminal.js +822 -0
- package/dist/commands/connect.d.ts +31 -0
- package/dist/commands/connect.js +3181 -0
- package/dist/commands/flow.d.ts +685 -0
- package/dist/commands/flow.js +697 -0
- package/dist/commands/install.d.ts +91 -0
- package/dist/commands/install.js +258 -0
- package/dist/commands/llm-config.d.ts +103 -0
- package/dist/commands/llm-config.js +452 -0
- package/dist/commands/manifest.d.ts +68 -0
- package/dist/commands/manifest.js +90 -0
- package/dist/commands/mcp.d.ts +79 -2
- package/dist/commands/mcp.js +262 -48
- package/dist/commands/oauth-login.d.ts +33 -0
- package/dist/commands/oauth-login.js +333 -0
- package/dist/commands/prompt.d.ts +96 -0
- package/dist/commands/prompt.js +397 -0
- package/dist/commands/serve-results.d.ts +61 -0
- package/dist/commands/serve-results.js +245 -0
- package/dist/commands/serve-signin.d.ts +28 -0
- package/dist/commands/serve-signin.js +90 -0
- package/dist/commands/signin-page.d.ts +49 -0
- package/dist/commands/signin-page.js +250 -0
- package/dist/commands/skills.js +87 -50
- package/dist/commands/tool-help.d.ts +69 -0
- package/dist/commands/tool-help.js +189 -0
- package/dist/commands/tool-input.d.ts +22 -0
- package/dist/commands/tool-input.js +220 -0
- package/dist/commands/tools.d.ts +12 -0
- package/dist/commands/tools.js +307 -0
- package/dist/commands/update.d.ts +11 -0
- package/dist/commands/update.js +92 -0
- package/dist/commands/vscode.d.ts +65 -0
- package/dist/commands/vscode.js +173 -0
- package/dist/commands/wrappers.d.ts +23 -0
- package/dist/commands/wrappers.js +102 -0
- package/dist/completion.js +3 -80
- package/dist/config.js +76 -2
- package/dist/constants.d.ts +78 -38
- package/dist/constants.js +80 -102
- package/dist/index.js +155 -357
- package/dist/json-text.d.ts +12 -0
- package/dist/json-text.js +60 -0
- package/dist/router.d.ts +39 -0
- package/dist/router.js +59 -0
- package/dist/skills-registry.js +12 -3
- package/dist/utils/banner.d.ts +9 -0
- package/dist/utils/banner.js +41 -0
- package/dist/utils/browser.d.ts +19 -0
- package/dist/utils/browser.js +31 -0
- package/dist/utils/exec.d.ts +43 -0
- package/dist/utils/exec.js +61 -0
- package/dist/utils/http.d.ts +53 -0
- package/dist/utils/http.js +124 -0
- package/dist/utils/install-method.d.ts +36 -0
- package/dist/utils/install-method.js +48 -0
- package/dist/utils/journal.d.ts +57 -0
- package/dist/utils/journal.js +188 -0
- package/dist/utils/key-check.d.ts +20 -0
- package/dist/utils/key-check.js +24 -0
- package/dist/utils/update-check.d.ts +23 -0
- package/dist/utils/update-check.js +116 -0
- package/dist/utils/width.d.ts +32 -0
- package/dist/utils/width.js +73 -0
- package/package.json +8 -4
- package/vscode-extension/README.md +6 -0
- package/vscode-extension/aisa-vscode.vsix +0 -0
- package/dist/commands/finance.d.ts +0 -17
- package/dist/commands/finance.js +0 -342
- package/dist/commands/run.d.ts +0 -28
- package/dist/commands/run.js +0 -182
- package/dist/commands/search.d.ts +0 -9
- package/dist/commands/search.js +0 -81
- package/dist/commands/twitter.d.ts +0 -138
- package/dist/commands/twitter.js +0 -374
- package/dist/commands/video.d.ts +0 -49
- package/dist/commands/video.js +0 -311
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
export declare function twitterUserAction(username: string, options: {
|
|
2
|
-
raw?: boolean;
|
|
3
|
-
}): Promise<void>;
|
|
4
|
-
export declare function twitterUserAboutAction(username: string, options: {
|
|
5
|
-
raw?: boolean;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
export declare function twitterBatchUsersAction(ids: string, options: {
|
|
8
|
-
raw?: boolean;
|
|
9
|
-
}): Promise<void>;
|
|
10
|
-
export declare function twitterUserTweetsAction(username: string, options: {
|
|
11
|
-
raw?: boolean;
|
|
12
|
-
cursor?: string;
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
export declare function twitterMentionsAction(username: string, options: {
|
|
15
|
-
raw?: boolean;
|
|
16
|
-
cursor?: string;
|
|
17
|
-
}): Promise<void>;
|
|
18
|
-
export declare function twitterFollowersAction(username: string, options: {
|
|
19
|
-
raw?: boolean;
|
|
20
|
-
cursor?: string;
|
|
21
|
-
}): Promise<void>;
|
|
22
|
-
export declare function twitterFollowingAction(username: string, options: {
|
|
23
|
-
raw?: boolean;
|
|
24
|
-
cursor?: string;
|
|
25
|
-
}): Promise<void>;
|
|
26
|
-
export declare function twitterVerifiedFollowersAction(userId: string, options: {
|
|
27
|
-
raw?: boolean;
|
|
28
|
-
cursor?: string;
|
|
29
|
-
}): Promise<void>;
|
|
30
|
-
export declare function twitterCheckFollowAction(source: string, target: string, options: {
|
|
31
|
-
raw?: boolean;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
export declare function twitterUserSearchAction(query: string, options: {
|
|
34
|
-
raw?: boolean;
|
|
35
|
-
cursor?: string;
|
|
36
|
-
}): Promise<void>;
|
|
37
|
-
export declare function twitterSearchAction(query: string, options: {
|
|
38
|
-
limit?: string;
|
|
39
|
-
type?: string;
|
|
40
|
-
raw?: boolean;
|
|
41
|
-
cursor?: string;
|
|
42
|
-
}): Promise<void>;
|
|
43
|
-
export declare function twitterDetailAction(ids: string, options: {
|
|
44
|
-
raw?: boolean;
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
export declare function twitterRepliesAction(tweetId: string, options: {
|
|
47
|
-
raw?: boolean;
|
|
48
|
-
cursor?: string;
|
|
49
|
-
}): Promise<void>;
|
|
50
|
-
export declare function twitterQuotesAction(tweetId: string, options: {
|
|
51
|
-
raw?: boolean;
|
|
52
|
-
cursor?: string;
|
|
53
|
-
}): Promise<void>;
|
|
54
|
-
export declare function twitterRetweetersAction(tweetId: string, options: {
|
|
55
|
-
raw?: boolean;
|
|
56
|
-
cursor?: string;
|
|
57
|
-
}): Promise<void>;
|
|
58
|
-
export declare function twitterThreadAction(tweetId: string, options: {
|
|
59
|
-
raw?: boolean;
|
|
60
|
-
cursor?: string;
|
|
61
|
-
}): Promise<void>;
|
|
62
|
-
export declare function twitterArticleAction(tweetId: string, options: {
|
|
63
|
-
raw?: boolean;
|
|
64
|
-
}): Promise<void>;
|
|
65
|
-
export declare function twitterTrendsAction(options: {
|
|
66
|
-
woeid?: string;
|
|
67
|
-
count?: string;
|
|
68
|
-
raw?: boolean;
|
|
69
|
-
}): Promise<void>;
|
|
70
|
-
export declare function twitterListMembersAction(listId: string, options: {
|
|
71
|
-
raw?: boolean;
|
|
72
|
-
cursor?: string;
|
|
73
|
-
}): Promise<void>;
|
|
74
|
-
export declare function twitterListFollowersAction(listId: string, options: {
|
|
75
|
-
raw?: boolean;
|
|
76
|
-
cursor?: string;
|
|
77
|
-
}): Promise<void>;
|
|
78
|
-
export declare function twitterCommunityInfoAction(communityId: string, options: {
|
|
79
|
-
raw?: boolean;
|
|
80
|
-
}): Promise<void>;
|
|
81
|
-
export declare function twitterCommunityMembersAction(communityId: string, options: {
|
|
82
|
-
raw?: boolean;
|
|
83
|
-
cursor?: string;
|
|
84
|
-
}): Promise<void>;
|
|
85
|
-
export declare function twitterCommunityModsAction(communityId: string, options: {
|
|
86
|
-
raw?: boolean;
|
|
87
|
-
cursor?: string;
|
|
88
|
-
}): Promise<void>;
|
|
89
|
-
export declare function twitterCommunityTweetsAction(communityId: string, options: {
|
|
90
|
-
raw?: boolean;
|
|
91
|
-
cursor?: string;
|
|
92
|
-
}): Promise<void>;
|
|
93
|
-
export declare function twitterCommunitySearchAction(query: string, options: {
|
|
94
|
-
raw?: boolean;
|
|
95
|
-
cursor?: string;
|
|
96
|
-
}): Promise<void>;
|
|
97
|
-
export declare function twitterSpaceAction(spaceId: string, options: {
|
|
98
|
-
raw?: boolean;
|
|
99
|
-
}): Promise<void>;
|
|
100
|
-
export declare function twitterLoginAction(options: {
|
|
101
|
-
username?: string;
|
|
102
|
-
email?: string;
|
|
103
|
-
password?: string;
|
|
104
|
-
proxy?: string;
|
|
105
|
-
totp?: string;
|
|
106
|
-
cookies?: string;
|
|
107
|
-
raw?: boolean;
|
|
108
|
-
}): Promise<void>;
|
|
109
|
-
export declare function twitterLogoutAction(): void;
|
|
110
|
-
export declare function tweetAction(text: string, options: {
|
|
111
|
-
replyTo?: string;
|
|
112
|
-
mediaIds?: string;
|
|
113
|
-
raw?: boolean;
|
|
114
|
-
}): Promise<void>;
|
|
115
|
-
export declare function twitterLikeAction(tweetId: string, options: {
|
|
116
|
-
raw?: boolean;
|
|
117
|
-
}): Promise<void>;
|
|
118
|
-
export declare function twitterUnlikeAction(tweetId: string, options: {
|
|
119
|
-
raw?: boolean;
|
|
120
|
-
}): Promise<void>;
|
|
121
|
-
export declare function twitterRetweetAction(tweetId: string, options: {
|
|
122
|
-
raw?: boolean;
|
|
123
|
-
}): Promise<void>;
|
|
124
|
-
export declare function twitterDeleteAction(tweetId: string, options: {
|
|
125
|
-
raw?: boolean;
|
|
126
|
-
}): Promise<void>;
|
|
127
|
-
export declare function twitterFollowAction(userId: string, options: {
|
|
128
|
-
raw?: boolean;
|
|
129
|
-
}): Promise<void>;
|
|
130
|
-
export declare function twitterUnfollowAction(userId: string, options: {
|
|
131
|
-
raw?: boolean;
|
|
132
|
-
}): Promise<void>;
|
|
133
|
-
export declare function twitterUploadMediaAction(filePath: string, options: {
|
|
134
|
-
raw?: boolean;
|
|
135
|
-
}): Promise<void>;
|
|
136
|
-
export declare function twitterDmAction(userId: string, text: string, options: {
|
|
137
|
-
raw?: boolean;
|
|
138
|
-
}): Promise<void>;
|
package/dist/commands/twitter.js
DELETED
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
import ora from "ora";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import { requireApiKey, getConfig, setConfig } from "../config.js";
|
|
4
|
-
import { apiRequest, resolveBases } from "../api.js";
|
|
5
|
-
import { error, success, formatJson } from "../utils/display.js";
|
|
6
|
-
function requireCookies() {
|
|
7
|
-
const cookies = getConfig("twitterCookies");
|
|
8
|
-
const proxy = getConfig("twitterProxy");
|
|
9
|
-
if (!cookies) {
|
|
10
|
-
error('No Twitter cookies configured. Run "aisa twitter login" or "aisa config set twitterCookies <value>".');
|
|
11
|
-
process.exit(1);
|
|
12
|
-
}
|
|
13
|
-
if (!proxy) {
|
|
14
|
-
error('No Twitter proxy configured. Run "aisa config set twitterProxy <value>".');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
return { login_cookies: cookies, proxy };
|
|
18
|
-
}
|
|
19
|
-
/** Simple GET against a twitter read endpoint. */
|
|
20
|
-
async function twitterGet(endpoint, query, label, options) {
|
|
21
|
-
const key = requireApiKey();
|
|
22
|
-
const spinner = ora(label).start();
|
|
23
|
-
const res = await apiRequest(key, endpoint, {
|
|
24
|
-
query,
|
|
25
|
-
domain: true,
|
|
26
|
-
});
|
|
27
|
-
if (!res.success) {
|
|
28
|
-
spinner.fail(label.replace(/\.{3}$/, " failed"));
|
|
29
|
-
error(res.error || "Unknown error");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
spinner.stop();
|
|
33
|
-
if (options.raw) {
|
|
34
|
-
console.log(JSON.stringify(res.data));
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
console.log(formatJson(res.data));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** POST against a twitter write endpoint (auto-injects cookies/proxy). */
|
|
41
|
-
async function twitterWrite(endpoint, body, label, options) {
|
|
42
|
-
const key = requireApiKey();
|
|
43
|
-
const auth = requireCookies();
|
|
44
|
-
const spinner = ora(label).start();
|
|
45
|
-
const res = await apiRequest(key, endpoint, {
|
|
46
|
-
method: "POST",
|
|
47
|
-
body: { ...auth, ...body },
|
|
48
|
-
domain: true,
|
|
49
|
-
});
|
|
50
|
-
if (!res.success) {
|
|
51
|
-
spinner.fail(label.replace(/\.{3}$/, " failed"));
|
|
52
|
-
error(res.error || "Unknown error");
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
spinner.stop();
|
|
56
|
-
if (options.raw) {
|
|
57
|
-
console.log(JSON.stringify(res.data));
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
console.log(formatJson(res.data));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// ── Read: User Endpoints ─────────────────────────────────────────────────────
|
|
64
|
-
export async function twitterUserAction(username, options) {
|
|
65
|
-
const key = requireApiKey();
|
|
66
|
-
const spinner = ora(`Fetching @${username}...`).start();
|
|
67
|
-
const res = await apiRequest(key, "twitter/user/info", {
|
|
68
|
-
query: { userName: username },
|
|
69
|
-
domain: true,
|
|
70
|
-
});
|
|
71
|
-
if (!res.success) {
|
|
72
|
-
spinner.fail("Failed to fetch user");
|
|
73
|
-
error(res.error || "Unknown error");
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
spinner.stop();
|
|
77
|
-
if (options.raw) {
|
|
78
|
-
console.log(JSON.stringify(res.data));
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const data = res.data;
|
|
82
|
-
const user = data?.data;
|
|
83
|
-
if (user) {
|
|
84
|
-
console.log(`\n ${chalk.cyan.bold(user.name)} ${chalk.gray(`@${user.userName}`)}`);
|
|
85
|
-
if (user.description)
|
|
86
|
-
console.log(` ${user.description}`);
|
|
87
|
-
console.log(` ${chalk.white(String(user.followers))} followers · ${chalk.white(String(user.following))} following`);
|
|
88
|
-
if (user.isBlueVerified)
|
|
89
|
-
console.log(` ${chalk.blue("✓ Verified")}`);
|
|
90
|
-
if (user.location)
|
|
91
|
-
console.log(` ${chalk.gray(user.location)}`);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
console.log(formatJson(res.data));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
export async function twitterUserAboutAction(username, options) {
|
|
99
|
-
return twitterGet("twitter/user_about", { userName: username }, `Fetching about @${username}...`, options);
|
|
100
|
-
}
|
|
101
|
-
export async function twitterBatchUsersAction(ids, options) {
|
|
102
|
-
return twitterGet("twitter/user/batch_info_by_ids", { userIds: ids }, "Fetching users...", options);
|
|
103
|
-
}
|
|
104
|
-
export async function twitterUserTweetsAction(username, options) {
|
|
105
|
-
const q = { userName: username };
|
|
106
|
-
if (options.cursor)
|
|
107
|
-
q.cursor = options.cursor;
|
|
108
|
-
return twitterGet("twitter/user/last_tweets", q, `Fetching tweets by @${username}...`, options);
|
|
109
|
-
}
|
|
110
|
-
export async function twitterMentionsAction(username, options) {
|
|
111
|
-
const q = { userName: username };
|
|
112
|
-
if (options.cursor)
|
|
113
|
-
q.cursor = options.cursor;
|
|
114
|
-
return twitterGet("twitter/user/mentions", q, `Fetching mentions of @${username}...`, options);
|
|
115
|
-
}
|
|
116
|
-
export async function twitterFollowersAction(username, options) {
|
|
117
|
-
const q = { userName: username };
|
|
118
|
-
if (options.cursor)
|
|
119
|
-
q.cursor = options.cursor;
|
|
120
|
-
return twitterGet("twitter/user/followers", q, `Fetching followers of @${username}...`, options);
|
|
121
|
-
}
|
|
122
|
-
export async function twitterFollowingAction(username, options) {
|
|
123
|
-
const q = { userName: username };
|
|
124
|
-
if (options.cursor)
|
|
125
|
-
q.cursor = options.cursor;
|
|
126
|
-
return twitterGet("twitter/user/followings", q, `Fetching following of @${username}...`, options);
|
|
127
|
-
}
|
|
128
|
-
export async function twitterVerifiedFollowersAction(userId, options) {
|
|
129
|
-
const q = { user_id: userId };
|
|
130
|
-
if (options.cursor)
|
|
131
|
-
q.cursor = options.cursor;
|
|
132
|
-
return twitterGet("twitter/user/verifiedFollowers", q, "Fetching verified followers...", options);
|
|
133
|
-
}
|
|
134
|
-
export async function twitterCheckFollowAction(source, target, options) {
|
|
135
|
-
return twitterGet("twitter/user/check_follow_relationship", { source_user_name: source, target_user_name: target }, `Checking follow relationship @${source} → @${target}...`, options);
|
|
136
|
-
}
|
|
137
|
-
export async function twitterUserSearchAction(query, options) {
|
|
138
|
-
const q = { query };
|
|
139
|
-
if (options.cursor)
|
|
140
|
-
q.cursor = options.cursor;
|
|
141
|
-
return twitterGet("twitter/user/search", q, `Searching users: "${query}"...`, options);
|
|
142
|
-
}
|
|
143
|
-
// ── Read: Tweet Endpoints ────────────────────────────────────────────────────
|
|
144
|
-
export async function twitterSearchAction(query, options) {
|
|
145
|
-
const q = {
|
|
146
|
-
query,
|
|
147
|
-
queryType: options.type === "top" ? "Top" : "Latest",
|
|
148
|
-
};
|
|
149
|
-
if (options.cursor)
|
|
150
|
-
q.cursor = options.cursor;
|
|
151
|
-
if (options.limit)
|
|
152
|
-
q.count = options.limit;
|
|
153
|
-
return twitterGet("twitter/tweet/advanced_search", q, `Searching tweets: "${query}"...`, options);
|
|
154
|
-
}
|
|
155
|
-
export async function twitterDetailAction(ids, options) {
|
|
156
|
-
return twitterGet("twitter/tweets", { tweet_ids: ids }, "Fetching tweet details...", options);
|
|
157
|
-
}
|
|
158
|
-
export async function twitterRepliesAction(tweetId, options) {
|
|
159
|
-
const q = { tweetId };
|
|
160
|
-
if (options.cursor)
|
|
161
|
-
q.cursor = options.cursor;
|
|
162
|
-
return twitterGet("twitter/tweet/replies", q, "Fetching replies...", options);
|
|
163
|
-
}
|
|
164
|
-
export async function twitterQuotesAction(tweetId, options) {
|
|
165
|
-
const q = { tweetId };
|
|
166
|
-
if (options.cursor)
|
|
167
|
-
q.cursor = options.cursor;
|
|
168
|
-
return twitterGet("twitter/tweet/quotes", q, "Fetching quotes...", options);
|
|
169
|
-
}
|
|
170
|
-
export async function twitterRetweetersAction(tweetId, options) {
|
|
171
|
-
const q = { tweetId };
|
|
172
|
-
if (options.cursor)
|
|
173
|
-
q.cursor = options.cursor;
|
|
174
|
-
return twitterGet("twitter/tweet/retweeters", q, "Fetching retweeters...", options);
|
|
175
|
-
}
|
|
176
|
-
export async function twitterThreadAction(tweetId, options) {
|
|
177
|
-
const q = { tweetId };
|
|
178
|
-
if (options.cursor)
|
|
179
|
-
q.cursor = options.cursor;
|
|
180
|
-
return twitterGet("twitter/tweet/thread_context", q, "Fetching thread...", options);
|
|
181
|
-
}
|
|
182
|
-
export async function twitterArticleAction(tweetId, options) {
|
|
183
|
-
return twitterGet("twitter/article", { tweet_id: tweetId }, "Fetching article...", options);
|
|
184
|
-
}
|
|
185
|
-
// ── Read: Trends ─────────────────────────────────────────────────────────────
|
|
186
|
-
export async function twitterTrendsAction(options) {
|
|
187
|
-
const q = {
|
|
188
|
-
woeid: options.woeid || "1",
|
|
189
|
-
count: options.count || "30",
|
|
190
|
-
};
|
|
191
|
-
return twitterGet("twitter/trends", q, "Fetching trends...", options);
|
|
192
|
-
}
|
|
193
|
-
// ── Read: Lists ──────────────────────────────────────────────────────────────
|
|
194
|
-
export async function twitterListMembersAction(listId, options) {
|
|
195
|
-
const q = { list_id: listId };
|
|
196
|
-
if (options.cursor)
|
|
197
|
-
q.cursor = options.cursor;
|
|
198
|
-
return twitterGet("twitter/list/members", q, "Fetching list members...", options);
|
|
199
|
-
}
|
|
200
|
-
export async function twitterListFollowersAction(listId, options) {
|
|
201
|
-
const q = { list_id: listId };
|
|
202
|
-
if (options.cursor)
|
|
203
|
-
q.cursor = options.cursor;
|
|
204
|
-
return twitterGet("twitter/list/followers", q, "Fetching list followers...", options);
|
|
205
|
-
}
|
|
206
|
-
// ── Read: Communities ────────────────────────────────────────────────────────
|
|
207
|
-
export async function twitterCommunityInfoAction(communityId, options) {
|
|
208
|
-
return twitterGet("twitter/community/info", { community_id: communityId }, "Fetching community info...", options);
|
|
209
|
-
}
|
|
210
|
-
export async function twitterCommunityMembersAction(communityId, options) {
|
|
211
|
-
const q = { community_id: communityId };
|
|
212
|
-
if (options.cursor)
|
|
213
|
-
q.cursor = options.cursor;
|
|
214
|
-
return twitterGet("twitter/community/members", q, "Fetching community members...", options);
|
|
215
|
-
}
|
|
216
|
-
export async function twitterCommunityModsAction(communityId, options) {
|
|
217
|
-
const q = { community_id: communityId };
|
|
218
|
-
if (options.cursor)
|
|
219
|
-
q.cursor = options.cursor;
|
|
220
|
-
return twitterGet("twitter/community/moderators", q, "Fetching community moderators...", options);
|
|
221
|
-
}
|
|
222
|
-
export async function twitterCommunityTweetsAction(communityId, options) {
|
|
223
|
-
const q = { community_id: communityId };
|
|
224
|
-
if (options.cursor)
|
|
225
|
-
q.cursor = options.cursor;
|
|
226
|
-
return twitterGet("twitter/community/tweets", q, "Fetching community tweets...", options);
|
|
227
|
-
}
|
|
228
|
-
export async function twitterCommunitySearchAction(query, options) {
|
|
229
|
-
const q = { query };
|
|
230
|
-
if (options.cursor)
|
|
231
|
-
q.cursor = options.cursor;
|
|
232
|
-
return twitterGet("twitter/community/get_tweets_from_all_community", q, `Searching community tweets: "${query}"...`, options);
|
|
233
|
-
}
|
|
234
|
-
// ── Read: Spaces ─────────────────────────────────────────────────────────────
|
|
235
|
-
export async function twitterSpaceAction(spaceId, options) {
|
|
236
|
-
return twitterGet("twitter/spaces/detail", { space_id: spaceId }, "Fetching space details...", options);
|
|
237
|
-
}
|
|
238
|
-
// ── Write: Login / Logout ────────────────────────────────────────────────────
|
|
239
|
-
export async function twitterLoginAction(options) {
|
|
240
|
-
// Direct cookie import mode
|
|
241
|
-
if (options.cookies) {
|
|
242
|
-
if (!options.proxy) {
|
|
243
|
-
error("--proxy is required when setting cookies directly.");
|
|
244
|
-
process.exit(1);
|
|
245
|
-
}
|
|
246
|
-
setConfig("twitterCookies", options.cookies);
|
|
247
|
-
setConfig("twitterProxy", options.proxy);
|
|
248
|
-
success("Twitter cookies and proxy saved.");
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
// Login via API
|
|
252
|
-
if (!options.username || !options.password || !options.proxy) {
|
|
253
|
-
error("Required: --username, --password, --proxy (and optionally --email, --totp)");
|
|
254
|
-
process.exit(1);
|
|
255
|
-
}
|
|
256
|
-
const key = requireApiKey();
|
|
257
|
-
const spinner = ora("Logging in to Twitter...").start();
|
|
258
|
-
const body = {
|
|
259
|
-
user_name: options.username,
|
|
260
|
-
password: options.password,
|
|
261
|
-
proxy: options.proxy,
|
|
262
|
-
};
|
|
263
|
-
if (options.email)
|
|
264
|
-
body.email = options.email;
|
|
265
|
-
if (options.totp)
|
|
266
|
-
body.totp_secret = options.totp;
|
|
267
|
-
const res = await apiRequest(key, "twitter/user_login_v2", { method: "POST", body, domain: true });
|
|
268
|
-
if (!res.success) {
|
|
269
|
-
spinner.fail("Twitter login failed");
|
|
270
|
-
error(res.error || "Unknown error");
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
spinner.stop();
|
|
274
|
-
// Extract and store cookies
|
|
275
|
-
const data = res.data;
|
|
276
|
-
const cookies = data?.login_cookies ||
|
|
277
|
-
data?.data?.login_cookies;
|
|
278
|
-
if (cookies) {
|
|
279
|
-
setConfig("twitterCookies", cookies);
|
|
280
|
-
setConfig("twitterProxy", options.proxy);
|
|
281
|
-
success("Logged in! Cookies and proxy saved.");
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
console.log(chalk.yellow("Login response did not contain login_cookies. Raw response:"));
|
|
285
|
-
console.log(formatJson(res.data));
|
|
286
|
-
}
|
|
287
|
-
if (options.raw) {
|
|
288
|
-
console.log(JSON.stringify(res.data));
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
export function twitterLogoutAction() {
|
|
292
|
-
setConfig("twitterCookies", "");
|
|
293
|
-
setConfig("twitterProxy", "");
|
|
294
|
-
success("Twitter cookies and proxy cleared.");
|
|
295
|
-
}
|
|
296
|
-
// ── Write: Tweet ─────────────────────────────────────────────────────────────
|
|
297
|
-
export async function tweetAction(text, options) {
|
|
298
|
-
const body = { tweet_text: text };
|
|
299
|
-
if (options.replyTo)
|
|
300
|
-
body.reply_to_tweet_id = options.replyTo;
|
|
301
|
-
if (options.mediaIds)
|
|
302
|
-
body.media_ids = options.mediaIds.split(",");
|
|
303
|
-
return twitterWrite("twitter/create_tweet_v2", body, "Posting tweet...", options);
|
|
304
|
-
}
|
|
305
|
-
// ── Write: Like / Unlike ─────────────────────────────────────────────────────
|
|
306
|
-
export async function twitterLikeAction(tweetId, options) {
|
|
307
|
-
return twitterWrite("twitter/like_tweet_v2", { tweet_id: tweetId }, "Liking tweet...", options);
|
|
308
|
-
}
|
|
309
|
-
export async function twitterUnlikeAction(tweetId, options) {
|
|
310
|
-
return twitterWrite("twitter/unlike_tweet_v2", { tweet_id: tweetId }, "Unliking tweet...", options);
|
|
311
|
-
}
|
|
312
|
-
// ── Write: Retweet ───────────────────────────────────────────────────────────
|
|
313
|
-
export async function twitterRetweetAction(tweetId, options) {
|
|
314
|
-
return twitterWrite("twitter/retweet_tweet_v2", { tweet_id: tweetId }, "Retweeting...", options);
|
|
315
|
-
}
|
|
316
|
-
// ── Write: Delete ────────────────────────────────────────────────────────────
|
|
317
|
-
export async function twitterDeleteAction(tweetId, options) {
|
|
318
|
-
return twitterWrite("twitter/delete_tweet_v2", { tweet_id: tweetId }, "Deleting tweet...", options);
|
|
319
|
-
}
|
|
320
|
-
// ── Write: Follow / Unfollow ─────────────────────────────────────────────────
|
|
321
|
-
export async function twitterFollowAction(userId, options) {
|
|
322
|
-
return twitterWrite("twitter/follow_user_v2", { user_id: userId }, "Following user...", options);
|
|
323
|
-
}
|
|
324
|
-
export async function twitterUnfollowAction(userId, options) {
|
|
325
|
-
return twitterWrite("twitter/unfollow_user_v2", { user_id: userId }, "Unfollowing user...", options);
|
|
326
|
-
}
|
|
327
|
-
// ── Write: Upload Media ──────────────────────────────────────────────────────
|
|
328
|
-
export async function twitterUploadMediaAction(filePath, options) {
|
|
329
|
-
const key = requireApiKey();
|
|
330
|
-
const auth = requireCookies();
|
|
331
|
-
const spinner = ora("Uploading media...").start();
|
|
332
|
-
let formData;
|
|
333
|
-
try {
|
|
334
|
-
const { readFileSync } = await import("node:fs");
|
|
335
|
-
const { basename } = await import("node:path");
|
|
336
|
-
formData = new FormData();
|
|
337
|
-
formData.append("file", new Blob([readFileSync(filePath)]), basename(filePath));
|
|
338
|
-
}
|
|
339
|
-
catch {
|
|
340
|
-
spinner.fail("Failed to read file");
|
|
341
|
-
error(`Could not read file: ${filePath}`);
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
formData.append("login_cookies", auth.login_cookies);
|
|
345
|
-
formData.append("proxy", auth.proxy);
|
|
346
|
-
const url = `${resolveBases().domain}/twitter/upload_media_v2`;
|
|
347
|
-
const res = await fetch(url, {
|
|
348
|
-
method: "POST",
|
|
349
|
-
headers: {
|
|
350
|
-
Authorization: `Bearer ${key}`,
|
|
351
|
-
"x-aisa-source": "cli",
|
|
352
|
-
},
|
|
353
|
-
body: formData,
|
|
354
|
-
});
|
|
355
|
-
if (!res.ok) {
|
|
356
|
-
spinner.fail("Upload failed");
|
|
357
|
-
const text = await res.text();
|
|
358
|
-
error(`${res.status}: ${text}`);
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
const data = await res.json();
|
|
362
|
-
spinner.stop();
|
|
363
|
-
if (options.raw) {
|
|
364
|
-
console.log(JSON.stringify(data));
|
|
365
|
-
}
|
|
366
|
-
else {
|
|
367
|
-
success("Media uploaded!");
|
|
368
|
-
console.log(formatJson(data));
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
// ── Write: Direct Message ────────────────────────────────────────────────────
|
|
372
|
-
export async function twitterDmAction(userId, text, options) {
|
|
373
|
-
return twitterWrite("twitter/send_dm_to_user", { user_id: userId, text }, "Sending DM...", options);
|
|
374
|
-
}
|
package/dist/commands/video.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { type MediaType } from "../constants.js";
|
|
2
|
-
/**
|
|
3
|
-
* Each upstream nests the finished video somewhere different (DashScope puts it
|
|
4
|
-
* at result.output.video_url, Seedance under result.data[].content[].url), so
|
|
5
|
-
* search rather than hardcode a path.
|
|
6
|
-
*
|
|
7
|
-
* Every pass covers the whole tree before the next one starts, and each is
|
|
8
|
-
* narrower than a plain "ends in url" match would be. Responses ship thumbnails
|
|
9
|
-
* and cover images beside the clip, and `thumbnail_url` both ends in "url" and
|
|
10
|
-
* tends to sit closer to the root than the video does — matching it would make
|
|
11
|
-
* `--output` download a still image.
|
|
12
|
-
*/
|
|
13
|
-
export declare function findVideoUrl(value: unknown): string | undefined;
|
|
14
|
-
export interface MediaInput {
|
|
15
|
-
type: MediaType;
|
|
16
|
-
url: string;
|
|
17
|
-
}
|
|
18
|
-
/** Parse `--media first_frame=https://…`, and bare URLs from `--image`. */
|
|
19
|
-
export declare function parseMedia(specs?: string[], images?: string[]): MediaInput[];
|
|
20
|
-
/**
|
|
21
|
-
* Build the request body for a model's vendor. The gateway rewrites only the
|
|
22
|
-
* top-level `model` and forwards the rest verbatim, so a Bailian body sent to a
|
|
23
|
-
* Seedance model is rejected with a 400.
|
|
24
|
-
*/
|
|
25
|
-
export declare function buildVideoBody(model: string, prompt: string, media: MediaInput[], options: {
|
|
26
|
-
resolution?: string;
|
|
27
|
-
duration?: string;
|
|
28
|
-
}): Record<string, unknown>;
|
|
29
|
-
/**
|
|
30
|
-
* Parse a `--body` payload. The option means "send this verbatim", so the model
|
|
31
|
-
* it names wins over the CLI's default — only an explicit `--model` overrides
|
|
32
|
-
* it. Anything else would silently redirect a valid request to another model.
|
|
33
|
-
*/
|
|
34
|
-
export declare function parseBodyOverride(raw: string, explicitModel?: string): Record<string, unknown>;
|
|
35
|
-
export declare function videoCreateAction(prompt: string, options: {
|
|
36
|
-
model?: string;
|
|
37
|
-
wait?: boolean;
|
|
38
|
-
output?: string;
|
|
39
|
-
raw?: boolean;
|
|
40
|
-
resolution?: string;
|
|
41
|
-
duration?: string;
|
|
42
|
-
image?: string[];
|
|
43
|
-
media?: string[];
|
|
44
|
-
body?: string;
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
export declare function videoStatusAction(taskId: string, options: {
|
|
47
|
-
raw?: boolean;
|
|
48
|
-
output?: string;
|
|
49
|
-
}): Promise<void>;
|