larkit 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larkit",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "飞书全栈真相引擎与一站式 Agent 开发工具包(MCP Server + CLI)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -63,5 +63,13 @@
63
63
  "reverse-engineering",
64
64
  "openapi"
65
65
  ],
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/ztxtxwd/larkit.git"
69
+ },
70
+ "homepage": "https://github.com/ztxtxwd/larkit#readme",
71
+ "bugs": {
72
+ "url": "https://github.com/ztxtxwd/larkit/issues"
73
+ },
66
74
  "license": "UNLICENSED"
67
75
  }
@@ -1,49 +0,0 @@
1
- // Temporary helper: start npm's browser-2FA flow for publishing (no TTY needed),
2
- // then publish once the user approves in the browser.
3
- import fs from 'node:fs';
4
- import { execFile } from 'node:child_process';
5
-
6
- const npmrc = fs.readFileSync(`${process.env.HOME}/.npmrc`, 'utf8');
7
- const token = npmrc.match(/_authToken=(.+)/)?.[1]?.trim();
8
- const H = {
9
- authorization: `Bearer ${token}`,
10
- 'content-type': 'application/json',
11
- 'npm-command': 'publish',
12
- 'npm-auth-type': 'web',
13
- 'user-agent': 'npm/11.11.0 node/v24.14.1 linux x64 workspaces/false',
14
- accept: '*/*',
15
- };
16
- const STATE = '/tmp/npm-webauth.json';
17
- const log = (...a) => console.log(`[${new Date().toISOString()}]`, ...a);
18
-
19
- // Ask the registry for a browser approval pair.
20
- const start = await fetch('https://registry.npmjs.org/larkit', { method: 'PUT', headers: H, body: '{}' });
21
- const body = await start.json().catch(() => ({}));
22
- if (!body.authUrl || !body.doneUrl) {
23
- log('FAILED to start web auth', start.status, JSON.stringify(body));
24
- process.exit(1);
25
- }
26
- fs.writeFileSync(STATE, JSON.stringify({ authUrl: body.authUrl, doneUrl: body.doneUrl, startedAt: Date.now() }, null, 2));
27
- log('AUTHURL', body.authUrl);
28
- log('waiting for browser approval...');
29
-
30
- const deadline = Date.now() + 20 * 60 * 1000;
31
- let otp = null;
32
- while (Date.now() < deadline) {
33
- const r = await fetch(body.doneUrl, { headers: H });
34
- if (r.status === 200) {
35
- const c = await r.json().catch(() => ({}));
36
- if (c.token) { otp = c.token; break; }
37
- log('200 but no token'); break;
38
- }
39
- if (r.status !== 202) { log('done-poll unexpected status', r.status); break; }
40
- await new Promise((res) => setTimeout(res, 3000));
41
- }
42
- if (!otp) { log('no OTP obtained (timeout/error)'); process.exit(2); }
43
- log('approved, publishing with otp');
44
-
45
- execFile('npm', ['publish', '--access', 'public', `--otp=${otp}`], { cwd: '/root/code/larkit' }, (err, stdout, stderr) => {
46
- fs.writeFileSync('/tmp/npm-publish.log', `EXIT=${err ? err.code ?? 1 : 0}\n--- stdout ---\n${stdout}\n--- stderr ---\n${stderr}\n`);
47
- log(err ? 'PUBLISH FAILED' : 'PUBLISH SUCCEEDED');
48
- process.exit(err ? 1 : 0);
49
- });