@picahq/cli 0.1.0 → 0.3.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/README.md +61 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1441 -0
- package/package.json +7 -3
- package/.claude/settings.local.json +0 -11
- package/.github/workflows/publish.yml +0 -29
- package/SKILL.md +0 -199
- package/src/commands/actions.ts +0 -385
- package/src/commands/connection.ts +0 -196
- package/src/commands/init.ts +0 -548
- package/src/commands/platforms.ts +0 -92
- package/src/index.ts +0 -140
- package/src/lib/actions.ts +0 -59
- package/src/lib/agents.ts +0 -191
- package/src/lib/api.ts +0 -191
- package/src/lib/browser.ts +0 -20
- package/src/lib/config.ts +0 -47
- package/src/lib/platforms.ts +0 -73
- package/src/lib/table.ts +0 -60
- package/src/lib/types.ts +0 -89
- package/test/all-emails.json +0 -3479
- package/test/fetch-emails.ts +0 -82
- package/tsconfig.json +0 -16
- package/tsup.config.ts +0 -10
package/test/fetch-emails.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { PicaApi } from '../src/lib/api.js';
|
|
2
|
-
import { writeFileSync } from 'node:fs';
|
|
3
|
-
import { join, dirname } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
|
|
6
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
-
|
|
8
|
-
const API_KEY = 'sk_test_BC52hUz0mFXuiGLeE_Z9hRlYX7nQyE_qGmIFGFS9j-Y';
|
|
9
|
-
const ACTION_ID = 'conn_mod_def::GGSNOTZxFUU::ZWXBuJboTpS3Q_U06pF8gA';
|
|
10
|
-
const CONNECTION_KEY = 'test::gmail::default::3b4dc96903394a3e8faa41ae5df8a223|user_moe';
|
|
11
|
-
const TARGET = 700;
|
|
12
|
-
const BATCH_SIZE = 100;
|
|
13
|
-
|
|
14
|
-
interface Email {
|
|
15
|
-
sender: string;
|
|
16
|
-
receiver: string;
|
|
17
|
-
time: string;
|
|
18
|
-
subject: string;
|
|
19
|
-
body: string;
|
|
20
|
-
messageId: string;
|
|
21
|
-
threadId: string;
|
|
22
|
-
labelIds: string[];
|
|
23
|
-
snippet: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface GetEmailsResponse {
|
|
27
|
-
emails: Email[];
|
|
28
|
-
totalFound: number;
|
|
29
|
-
nextPageToken?: string;
|
|
30
|
-
message: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function main() {
|
|
34
|
-
const api = new PicaApi(API_KEY);
|
|
35
|
-
const allEmails: Email[] = [];
|
|
36
|
-
let pageToken: string | undefined;
|
|
37
|
-
let batch = 1;
|
|
38
|
-
|
|
39
|
-
console.log(`Fetching ${TARGET} emails from Gmail...\n`);
|
|
40
|
-
|
|
41
|
-
while (allEmails.length < TARGET) {
|
|
42
|
-
const remaining = TARGET - allEmails.length;
|
|
43
|
-
const count = Math.min(remaining, BATCH_SIZE);
|
|
44
|
-
|
|
45
|
-
const data: Record<string, unknown> = {
|
|
46
|
-
connectionKey: CONNECTION_KEY,
|
|
47
|
-
numberOfEmails: count,
|
|
48
|
-
};
|
|
49
|
-
if (pageToken) data.pageToken = pageToken;
|
|
50
|
-
|
|
51
|
-
console.log(`Batch ${batch}: fetching ${count} emails (total so far: ${allEmails.length})...`);
|
|
52
|
-
|
|
53
|
-
const result = await api.executeAction({
|
|
54
|
-
method: 'POST',
|
|
55
|
-
path: '/gmail/get-emails',
|
|
56
|
-
actionId: ACTION_ID,
|
|
57
|
-
connectionKey: CONNECTION_KEY,
|
|
58
|
-
data,
|
|
59
|
-
}) as GetEmailsResponse;
|
|
60
|
-
|
|
61
|
-
const emails = result.emails || [];
|
|
62
|
-
allEmails.push(...emails);
|
|
63
|
-
console.log(` Got ${emails.length} emails. Total: ${allEmails.length}`);
|
|
64
|
-
|
|
65
|
-
pageToken = result.nextPageToken;
|
|
66
|
-
if (!pageToken) {
|
|
67
|
-
console.log('No more pages available.');
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
batch++;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const outPath = join(__dirname, 'all-emails.json');
|
|
75
|
-
writeFileSync(outPath, JSON.stringify({ emails: allEmails, total: allEmails.length }, null, 2));
|
|
76
|
-
console.log(`\nDone. ${allEmails.length} emails saved to test/all-emails.json`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
main().catch(err => {
|
|
80
|
-
console.error('Failed:', err.message);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"rootDir": "src",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"resolveJsonModule": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src/**/*"],
|
|
15
|
-
"exclude": ["node_modules", "dist"]
|
|
16
|
-
}
|