dp-worker 0.1.23 → 0.1.25
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/bird/ops.js +44 -0
- package/dist/bird/ops.js.map +1 -1
- package/dist/bird/sidecar-entry.js +16 -2
- package/dist/bird/sidecar-entry.js.map +1 -1
- package/dist/chrome-extension/omni-flow/manifest.json +1 -1
- package/node_modules/dp-shared/dist/bird-contracts.d.ts +308 -0
- package/node_modules/dp-shared/dist/bird-contracts.d.ts.map +1 -1
- package/node_modules/dp-shared/dist/bird-contracts.js +228 -0
- package/node_modules/dp-shared/dist/bird-contracts.js.map +1 -1
- package/node_modules/dp-shared/dist/post-drafts-contracts.d.ts +3 -3
- package/package.json +2 -2
- package/vendor/bird/LICENSE +21 -0
- package/vendor/bird/README.md +58 -0
- package/vendor/bird/dist/cli/pagination.d.ts +35 -0
- package/vendor/bird/dist/cli/pagination.js +43 -0
- package/vendor/bird/dist/cli/program.d.ts +5 -0
- package/vendor/bird/dist/cli/program.js +113 -0
- package/vendor/bird/dist/cli/shared.d.ts +77 -0
- package/vendor/bird/dist/cli/shared.js +327 -0
- package/vendor/bird/dist/cli.d.ts +12 -0
- package/vendor/bird/dist/cli.js +29 -0
- package/vendor/bird/dist/commands/bookmarks.d.ts +4 -0
- package/vendor/bird/dist/commands/bookmarks.js +189 -0
- package/vendor/bird/dist/commands/check.d.ts +4 -0
- package/vendor/bird/dist/commands/check.js +43 -0
- package/vendor/bird/dist/commands/follow.d.ts +4 -0
- package/vendor/bird/dist/commands/follow.js +91 -0
- package/vendor/bird/dist/commands/help.d.ts +4 -0
- package/vendor/bird/dist/commands/help.js +19 -0
- package/vendor/bird/dist/commands/home.d.ts +4 -0
- package/vendor/bird/dist/commands/home.js +43 -0
- package/vendor/bird/dist/commands/lists.d.ts +4 -0
- package/vendor/bird/dist/commands/lists.js +125 -0
- package/vendor/bird/dist/commands/news.d.ts +4 -0
- package/vendor/bird/dist/commands/news.js +131 -0
- package/vendor/bird/dist/commands/post.d.ts +4 -0
- package/vendor/bird/dist/commands/post.js +101 -0
- package/vendor/bird/dist/commands/query-ids.d.ts +4 -0
- package/vendor/bird/dist/commands/query-ids.js +80 -0
- package/vendor/bird/dist/commands/read.d.ts +4 -0
- package/vendor/bird/dist/commands/read.js +152 -0
- package/vendor/bird/dist/commands/search.d.ts +4 -0
- package/vendor/bird/dist/commands/search.js +115 -0
- package/vendor/bird/dist/commands/unbookmark.d.ts +4 -0
- package/vendor/bird/dist/commands/unbookmark.js +36 -0
- package/vendor/bird/dist/commands/user-tweets.d.ts +4 -0
- package/vendor/bird/dist/commands/user-tweets.js +109 -0
- package/vendor/bird/dist/commands/users.d.ts +4 -0
- package/vendor/bird/dist/commands/users.js +295 -0
- package/vendor/bird/dist/index.d.ts +2 -0
- package/vendor/bird/dist/index.js +2 -0
- package/vendor/bird/dist/lib/cli-args.d.ts +7 -0
- package/vendor/bird/dist/lib/cli-args.js +25 -0
- package/vendor/bird/dist/lib/cookies.d.ts +31 -0
- package/vendor/bird/dist/lib/cookies.js +81 -0
- package/vendor/bird/dist/lib/extract-bookmark-folder-id.d.ts +2 -0
- package/vendor/bird/dist/lib/extract-bookmark-folder-id.js +20 -0
- package/vendor/bird/dist/lib/extract-list-id.d.ts +2 -0
- package/vendor/bird/dist/lib/extract-list-id.js +19 -0
- package/vendor/bird/dist/lib/extract-tweet-id.d.ts +2 -0
- package/vendor/bird/dist/lib/extract-tweet-id.js +14 -0
- package/vendor/bird/dist/lib/features.json +17 -0
- package/vendor/bird/dist/lib/index.d.ts +10 -0
- package/vendor/bird/dist/lib/index.js +4 -0
- package/vendor/bird/dist/lib/normalize-handle.d.ts +6 -0
- package/vendor/bird/dist/lib/normalize-handle.js +31 -0
- package/vendor/bird/dist/lib/output.d.ts +29 -0
- package/vendor/bird/dist/lib/output.js +88 -0
- package/vendor/bird/dist/lib/paginate-cursor.d.ts +27 -0
- package/vendor/bird/dist/lib/paginate-cursor.js +37 -0
- package/vendor/bird/dist/lib/query-ids.json +20 -0
- package/vendor/bird/dist/lib/runtime-features.d.ts +19 -0
- package/vendor/bird/dist/lib/runtime-features.js +151 -0
- package/vendor/bird/dist/lib/runtime-query-ids.d.ts +33 -0
- package/vendor/bird/dist/lib/runtime-query-ids.js +264 -0
- package/vendor/bird/dist/lib/thread-filters.d.ts +8 -0
- package/vendor/bird/dist/lib/thread-filters.js +124 -0
- package/vendor/bird/dist/lib/twitter-client-base.d.ts +38 -0
- package/vendor/bird/dist/lib/twitter-client-base.js +129 -0
- package/vendor/bird/dist/lib/twitter-client-bookmarks.d.ts +7 -0
- package/vendor/bird/dist/lib/twitter-client-bookmarks.js +61 -0
- package/vendor/bird/dist/lib/twitter-client-constants.d.ts +43 -0
- package/vendor/bird/dist/lib/twitter-client-constants.js +50 -0
- package/vendor/bird/dist/lib/twitter-client-engagement.d.ts +16 -0
- package/vendor/bird/dist/lib/twitter-client-engagement.js +81 -0
- package/vendor/bird/dist/lib/twitter-client-features.d.ts +14 -0
- package/vendor/bird/dist/lib/twitter-client-features.js +347 -0
- package/vendor/bird/dist/lib/twitter-client-follow.d.ts +8 -0
- package/vendor/bird/dist/lib/twitter-client-follow.js +178 -0
- package/vendor/bird/dist/lib/twitter-client-home.d.ts +13 -0
- package/vendor/bird/dist/lib/twitter-client-home.js +138 -0
- package/vendor/bird/dist/lib/twitter-client-lists.d.ts +11 -0
- package/vendor/bird/dist/lib/twitter-client-lists.js +321 -0
- package/vendor/bird/dist/lib/twitter-client-media.d.ts +11 -0
- package/vendor/bird/dist/lib/twitter-client-media.js +136 -0
- package/vendor/bird/dist/lib/twitter-client-news.d.ts +47 -0
- package/vendor/bird/dist/lib/twitter-client-news.js +283 -0
- package/vendor/bird/dist/lib/twitter-client-posting.d.ts +8 -0
- package/vendor/bird/dist/lib/twitter-client-posting.js +218 -0
- package/vendor/bird/dist/lib/twitter-client-search.d.ts +19 -0
- package/vendor/bird/dist/lib/twitter-client-search.js +157 -0
- package/vendor/bird/dist/lib/twitter-client-timelines.d.ts +23 -0
- package/vendor/bird/dist/lib/twitter-client-timelines.js +471 -0
- package/vendor/bird/dist/lib/twitter-client-tweet-detail.d.ts +25 -0
- package/vendor/bird/dist/lib/twitter-client-tweet-detail.js +295 -0
- package/vendor/bird/dist/lib/twitter-client-types.d.ts +407 -0
- package/vendor/bird/dist/lib/twitter-client-types.js +2 -0
- package/vendor/bird/dist/lib/twitter-client-user-lookup.d.ts +16 -0
- package/vendor/bird/dist/lib/twitter-client-user-lookup.js +224 -0
- package/vendor/bird/dist/lib/twitter-client-user-tweets.d.ts +22 -0
- package/vendor/bird/dist/lib/twitter-client-user-tweets.js +154 -0
- package/vendor/bird/dist/lib/twitter-client-users.d.ts +9 -0
- package/vendor/bird/dist/lib/twitter-client-users.js +358 -0
- package/vendor/bird/dist/lib/twitter-client-utils.d.ts +173 -0
- package/vendor/bird/dist/lib/twitter-client-utils.js +511 -0
- package/vendor/bird/dist/lib/twitter-client.d.ts +23 -0
- package/vendor/bird/dist/lib/twitter-client.js +21 -0
- package/vendor/bird/dist/lib/version.d.ts +6 -0
- package/vendor/bird/dist/lib/version.js +174 -0
- package/vendor/bird/upstream-package.json +61 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
export const FALLBACK_VERSION = 'unknown';
|
|
5
|
+
const REF_PREFIX_REGEX = /^ref:\s*/i;
|
|
6
|
+
const LINE_SPLIT_REGEX = /\r?\n/;
|
|
7
|
+
const GITDIR_REGEX = /gitdir:\s*(.+)\s*$/i;
|
|
8
|
+
function readPackageVersionFromJsonFile(candidate) {
|
|
9
|
+
try {
|
|
10
|
+
const raw = fs.readFileSync(candidate, 'utf8');
|
|
11
|
+
const json = JSON.parse(raw);
|
|
12
|
+
if (json && typeof json.version === 'string' && json.version.trim().length > 0) {
|
|
13
|
+
return json.version.trim();
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function readVersionFromTextFile(candidate) {
|
|
22
|
+
try {
|
|
23
|
+
const raw = fs.readFileSync(candidate, 'utf8').trim();
|
|
24
|
+
return raw.length > 0 ? raw : null;
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function resolveStartDir(importMetaUrl) {
|
|
31
|
+
if (typeof importMetaUrl === 'string' && importMetaUrl.trim().length > 0) {
|
|
32
|
+
try {
|
|
33
|
+
return path.dirname(fileURLToPath(importMetaUrl));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// ignore
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (typeof __dirname === 'string' && __dirname.length > 0) {
|
|
40
|
+
return __dirname;
|
|
41
|
+
}
|
|
42
|
+
return process.cwd();
|
|
43
|
+
}
|
|
44
|
+
export function resolvePackageVersion(importMetaUrl) {
|
|
45
|
+
const injected = typeof process !== 'undefined' && typeof process.env.BIRD_VERSION === 'string'
|
|
46
|
+
? process.env.BIRD_VERSION.trim()
|
|
47
|
+
: '';
|
|
48
|
+
if (injected.length > 0) {
|
|
49
|
+
return injected;
|
|
50
|
+
}
|
|
51
|
+
let dir = resolveStartDir(importMetaUrl);
|
|
52
|
+
for (let i = 0; i < 10; i += 1) {
|
|
53
|
+
const version = readPackageVersionFromJsonFile(path.join(dir, 'package.json')) ??
|
|
54
|
+
readVersionFromTextFile(path.join(dir, 'VERSION'));
|
|
55
|
+
if (version) {
|
|
56
|
+
return version;
|
|
57
|
+
}
|
|
58
|
+
const parent = path.dirname(dir);
|
|
59
|
+
if (parent === dir) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
dir = parent;
|
|
63
|
+
}
|
|
64
|
+
return FALLBACK_VERSION;
|
|
65
|
+
}
|
|
66
|
+
function truncateSha(sha, length = 8) {
|
|
67
|
+
const trimmed = sha.trim();
|
|
68
|
+
if (!trimmed) {
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
if (trimmed.length <= length) {
|
|
72
|
+
return trimmed;
|
|
73
|
+
}
|
|
74
|
+
return trimmed.slice(0, length);
|
|
75
|
+
}
|
|
76
|
+
function resolveGitShaFromGitDir(gitDir) {
|
|
77
|
+
const headPath = path.join(gitDir, 'HEAD');
|
|
78
|
+
let head = '';
|
|
79
|
+
try {
|
|
80
|
+
head = fs.readFileSync(headPath, 'utf8').trim();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (!head) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (!head.startsWith('ref:')) {
|
|
89
|
+
const sha = truncateSha(head);
|
|
90
|
+
return sha.length > 0 ? sha : null;
|
|
91
|
+
}
|
|
92
|
+
const ref = head.replace(REF_PREFIX_REGEX, '').trim();
|
|
93
|
+
if (!ref) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const refPath = path.join(gitDir, ref);
|
|
97
|
+
try {
|
|
98
|
+
const sha = truncateSha(fs.readFileSync(refPath, 'utf8'));
|
|
99
|
+
return sha.length > 0 ? sha : null;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// fall through to packed-refs
|
|
103
|
+
}
|
|
104
|
+
const packedRefsPath = path.join(gitDir, 'packed-refs');
|
|
105
|
+
try {
|
|
106
|
+
const packed = fs.readFileSync(packedRefsPath, 'utf8');
|
|
107
|
+
const lines = packed.split(LINE_SPLIT_REGEX);
|
|
108
|
+
for (const line of lines) {
|
|
109
|
+
if (!line || line.startsWith('#') || line.startsWith('^')) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const [shaRaw, refName] = line.split(' ');
|
|
113
|
+
if (refName?.trim() === ref) {
|
|
114
|
+
const sha = truncateSha(shaRaw ?? '');
|
|
115
|
+
return sha.length > 0 ? sha : null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// ignore
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
export function resolveGitSha(importMetaUrl) {
|
|
125
|
+
const injected = typeof process !== 'undefined' && typeof process.env.BIRD_GIT_SHA === 'string'
|
|
126
|
+
? process.env.BIRD_GIT_SHA.trim()
|
|
127
|
+
: '';
|
|
128
|
+
if (injected.length > 0) {
|
|
129
|
+
return truncateSha(injected);
|
|
130
|
+
}
|
|
131
|
+
let dir = resolveStartDir(importMetaUrl);
|
|
132
|
+
for (let i = 0; i < 10; i += 1) {
|
|
133
|
+
const dotGit = path.join(dir, '.git');
|
|
134
|
+
try {
|
|
135
|
+
const stat = fs.statSync(dotGit);
|
|
136
|
+
if (stat.isDirectory()) {
|
|
137
|
+
const sha = resolveGitShaFromGitDir(dotGit);
|
|
138
|
+
if (sha) {
|
|
139
|
+
return sha;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (stat.isFile()) {
|
|
143
|
+
const txt = fs.readFileSync(dotGit, 'utf8');
|
|
144
|
+
const match = GITDIR_REGEX.exec(txt);
|
|
145
|
+
const gitDir = match?.[1]?.trim();
|
|
146
|
+
if (gitDir) {
|
|
147
|
+
const resolved = path.isAbsolute(gitDir) ? gitDir : path.resolve(dir, gitDir);
|
|
148
|
+
const sha = resolveGitShaFromGitDir(resolved);
|
|
149
|
+
if (sha) {
|
|
150
|
+
return sha;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// ignore
|
|
157
|
+
}
|
|
158
|
+
const parent = path.dirname(dir);
|
|
159
|
+
if (parent === dir) {
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
dir = parent;
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
export function formatVersionLine(importMetaUrl) {
|
|
167
|
+
const version = resolvePackageVersion(importMetaUrl);
|
|
168
|
+
const sha = resolveGitSha(importMetaUrl);
|
|
169
|
+
return sha ? `${version} (${sha})` : version;
|
|
170
|
+
}
|
|
171
|
+
export function getCliVersion() {
|
|
172
|
+
return formatVersionLine(import.meta.url);
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@steipete/bird",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "CLI tool for tweeting and replying via Twitter/X GraphQL API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"bird": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "pnpm run build:dist && pnpm run build:binary",
|
|
19
|
+
"build:dist": "tsc && node scripts/copy-dist-assets.js",
|
|
20
|
+
"build:binary": "BIRD_VERSION=$(node -p \"require('./package.json').version\") BIRD_GIT_SHA=$(git rev-parse --short=8 HEAD 2>/dev/null || true) bun build --compile --minify --env=BIRD_* src/cli.ts --outfile bird",
|
|
21
|
+
"dev": "tsx src/index.ts",
|
|
22
|
+
"bird": "pnpm run build:dist && node dist/cli.js",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"test:live": "pnpm run build:dist && BIRD_LIVE=1 vitest run --no-file-parallelism tests/live/live.test.ts",
|
|
26
|
+
"test:live:all": "pnpm run build:dist && BIRD_LIVE=1 vitest run --no-file-parallelism tests/live/live-all.test.ts",
|
|
27
|
+
"lint": "pnpm run lint:biome && pnpm run lint:oxlint",
|
|
28
|
+
"lint:biome": "biome check .",
|
|
29
|
+
"lint:oxlint": "oxlint --type-aware --tsconfig tsconfig.oxlint.json --import-plugin --node-plugin --vitest-plugin --deny-warnings src tests scripts",
|
|
30
|
+
"lint:fix": "pnpm run lint:biome:fix && pnpm run lint:oxlint:fix",
|
|
31
|
+
"lint:biome:fix": "biome check --write .",
|
|
32
|
+
"lint:oxlint:fix": "oxlint --type-aware --tsconfig tsconfig.oxlint.json --import-plugin --node-plugin --vitest-plugin --deny-warnings --fix src tests scripts",
|
|
33
|
+
"format": "biome format --write .",
|
|
34
|
+
"binary": "pnpm run build:binary",
|
|
35
|
+
"graphql:update": "tsx scripts/update-query-ids.ts"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@steipete/sweet-cookie": "0.1.0",
|
|
39
|
+
"commander": "^14.0.2",
|
|
40
|
+
"json5": "^2.2.3",
|
|
41
|
+
"kleur": "^4.1.5"
|
|
42
|
+
},
|
|
43
|
+
"pnpm": {
|
|
44
|
+
"patchedDependencies": {
|
|
45
|
+
"@steipete/sweet-cookie": "patches/@steipete__sweet-cookie.patch"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@biomejs/biome": "^2.3.10",
|
|
50
|
+
"@types/node": "^25.0.3",
|
|
51
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
52
|
+
"oxlint": "^1.36.0",
|
|
53
|
+
"oxlint-tsgolint": "^0.10.0",
|
|
54
|
+
"tsx": "^4.21.0",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"vitest": "^4.0.16"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22"
|
|
60
|
+
}
|
|
61
|
+
}
|