@starlink-awaken/agentmesh 1.4.0 → 1.4.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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ export declare function runRelease(level?: string): Promise<string>;
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env bun
2
+ // agentmesh release — 一键发版:check → test → build → bump → commit → push → publish
3
+ import { readFileSync, writeFileSync } from 'node:fs';
4
+ import { join, dirname } from 'node:path';
5
+ // logger 由 cli 入口统一初始化,此模块不需要
6
+ const PROJECT_ROOT = dirname(dirname(import.meta.dir || import.meta.dirname || '.'));
7
+ class ReleaseError extends Error {
8
+ }
9
+ async function sh(cmd, cwd) {
10
+ const proc = Bun.spawn(cmd, { cwd: cwd || PROJECT_ROOT, stdout: 'pipe', stderr: 'pipe' });
11
+ const out = await new Response(proc.stdout).text();
12
+ await proc.exited;
13
+ if (proc.exitCode !== 0) {
14
+ const err = await new Response(proc.stderr).text();
15
+ throw new ReleaseError(`${cmd.join(' ')} failed (exit ${proc.exitCode}): ${err || out}`);
16
+ }
17
+ return out.trim();
18
+ }
19
+ function bumpVersion(current, level) {
20
+ const parts = current.split('.').map(Number);
21
+ if (parts.length !== 3)
22
+ throw new ReleaseError(`Invalid version: ${current}`);
23
+ switch (level) {
24
+ case 'major':
25
+ parts[0]++;
26
+ parts[1] = 0;
27
+ parts[2] = 0;
28
+ break;
29
+ case 'minor':
30
+ parts[1]++;
31
+ parts[2] = 0;
32
+ break;
33
+ case 'patch':
34
+ parts[2]++;
35
+ break;
36
+ default: throw new ReleaseError(`Unknown bump level: ${level}`);
37
+ }
38
+ return parts.join('.');
39
+ }
40
+ function updateVersionFiles(newVer) {
41
+ const pkgPath = join(PROJECT_ROOT, 'package.json');
42
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
43
+ pkg.version = newVer;
44
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
45
+ const cliPath = join(PROJECT_ROOT, 'src', 'cli.ts');
46
+ let cli = readFileSync(cliPath, 'utf-8');
47
+ cli = cli.replace(/const VERSION = '[^']+'/, `const VERSION = '${newVer}'`);
48
+ writeFileSync(cliPath, cli);
49
+ }
50
+ export async function runRelease(level = 'patch') {
51
+ const pkg = JSON.parse(readFileSync(join(PROJECT_ROOT, 'package.json'), 'utf-8'));
52
+ const oldVer = pkg.version;
53
+ const newVer = bumpVersion(oldVer, level);
54
+ console.log(`\n 🚀 Release: ${oldVer} → ${newVer} (${level})\n`);
55
+ // 1. Typecheck
56
+ console.log(' [1/6] Typecheck...');
57
+ await sh(['bun', 'run', 'typecheck']);
58
+ console.log(' ✅ Typecheck passed');
59
+ // 2. Test
60
+ console.log(' [2/6] Test...');
61
+ await sh(['bun', 'test']);
62
+ console.log(' ✅ Tests passed');
63
+ // 3. Build
64
+ console.log(' [3/6] Build...');
65
+ await sh(['bun', 'run', 'build']);
66
+ console.log(' ✅ Build done');
67
+ // 4. Bump version
68
+ console.log(` [4/6] Bump version: ${oldVer} → ${newVer}`);
69
+ updateVersionFiles(newVer);
70
+ console.log(' ✅ Version updated');
71
+ // 5. Commit + Push
72
+ console.log(' [5/6] Commit + Push...');
73
+ await sh(['git', 'add', '-A']);
74
+ await sh(['git', 'commit', '-m', `Release v${newVer}`]);
75
+ await sh(['git', 'push', 'origin', 'main']);
76
+ console.log(' ✅ Pushed to GitHub');
77
+ // 6. Publish to npm
78
+ console.log(' [6/6] Publish to npm...');
79
+ const pubOut = await sh(['npm', 'publish']);
80
+ console.log(` ✅ Published: ${pubOut}`);
81
+ console.log(`\n 🎉 v${newVer} released successfully!\n`);
82
+ return newVer;
83
+ }
84
+ if (import.meta.main) {
85
+ const level = Bun.argv[2] || 'patch';
86
+ runRelease(level).catch(err => {
87
+ console.error(`\n ❌ Release failed: ${err.message}\n`);
88
+ process.exit(1);
89
+ });
90
+ }
package/dist/src/cli.js CHANGED
@@ -7,7 +7,7 @@ import { existsSync, readFileSync } from 'node:fs';
7
7
  import { resolve, dirname, join } from 'node:path';
8
8
  import { initLogger } from './core/logger.js';
9
9
  const PROJECT_ROOT = resolve(dirname(import.meta.dir), '..');
10
- const VERSION = '1.4.0';
10
+ const VERSION = '1.4.1';
11
11
  const BANNER = `
12
12
  █████╗ ██████╗ ███████╗███╗ ██╗████████╗
13
13
  ██╔══██╗██╔════╝ ██╔════╝████╗ ██║╚══██╔══╝
@@ -434,6 +434,10 @@ async function main() {
434
434
  }
435
435
  break;
436
436
  }
437
+ case 'release':
438
+ const { runRelease } = await import('./cli/release.js');
439
+ await runRelease(rest[0] || 'patch');
440
+ break;
437
441
  case 'doctor':
438
442
  case 'check':
439
443
  await cmdDoctor();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starlink-awaken/agentmesh",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Unified Agent Gateway - Multi-Agent Scheduler and Router",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",