@tianacloud/cli 0.2.1-beta.3 → 0.2.2-beta.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/README.md CHANGED
@@ -1,8 +1,10 @@
1
1
  # Tiana CLI
2
2
 
3
- 此预发布包包含 macOS arm64、Linux amd64 的原生 Go CLI 和 Git 启动器。安装时无需下载额外可执行文件,也不编译 Rust。使用 `npm install -g @tianacloud/cli@0.2.1-beta.3` 安装;此版本使用 `next` 标签。
3
+ 使用 `npm install -g @tianacloud/cli@0.2.2-beta.1` 安装。需要 Node.js 20 或更高版本;安装时从 [Gitee 发布仓库](https://gitee.com/tianacloud/cli-releases/releases) 下载当前平台的原生程序并验证校验和,无需 Go 或 Rust。
4
4
 
5
- 本地审核 tarball 也可用 `npm install -g /path/to/tiana-cli-VERSION.tgz` 安装。用 `tiana --version`、`tiana login --help`、`tiana app --help` 核验功能。
5
+ 支持 macOS amd64/arm64、Linux amd64/arm64/riscv64、Windows amd64/arm64。Windows 安装需要系统 PowerShell;macOS/Linux 需要 tar。运行 `tiana --version` 核验安装。Git 功能需要另外安装 Git,`connect -- turso ...` 需要另外安装 Turso。
6
+
7
+ 本地审核 tarball 也可用 `npm install -g /path/to/tiana-cli-VERSION.tgz` 安装,仍需访问 Gitee 下载该版本二进制。如果安装时禁用了脚本,执行 `npm rebuild -g @tianacloud/cli --ignore-scripts=false` 补装。
6
8
 
7
9
  管理端地址由启动 Agent 或 Shell 时设置的 `TIANA_API_ORIGIN` 提供,技能继承环境,不按命令注入或覆盖;私有 CA 使用 `TIANA_CA_FILE` 或 `--ca-file`。包不内置部署地址或 CA,默认验证 TLS。
8
10
 
@@ -12,6 +14,4 @@
12
14
 
13
15
  应用:`tiana app serve --dir DIST`、`tiana app create NAME`、`tiana app upload ID --version VERSION --dir DIST --json`。遵循配套 Tiana Skill 的模板、哈希路由和清单。
14
16
 
15
- 构建:分别执行 `node scripts/build-platform.mjs darwin-arm64 ASSETS` 与 `node scripts/build-platform.mjs linux-amd64 ASSETS`,然后 `node scripts/package-cli.mjs ASSETS OUTPUT`。输出 tarball 和校验和,不上传或发布。
16
-
17
17
  应用列表:`tiana app list [--json]`。删除:`tiana app delete ID_OR_NAME`,非交互需 `--force`,可用 `--wait --json` 等待源站文件清理;关联 SQLite、Git 保留。
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { execFileSync } from 'node:child_process';
3
+ import { createHash } from 'node:crypto';
4
+ import { chmodSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { binaryName, platformDirectory } from './platforms.mjs';
8
+
9
+ const root = fileURLToPath(new URL('..', import.meta.url));
10
+ async function install() {
11
+ const target = platformDirectory(process.platform, process.arch);
12
+ if (!target) throw new Error(`Tiana CLI does not support ${process.platform}/${process.arch}`);
13
+ const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
14
+ const release = JSON.parse(readFileSync(path.join(root, 'release.json'), 'utf8'));
15
+ if (release.version !== pkg.version) throw new Error('The binary manifest does not match the npm package version.');
16
+ const asset = release.assets[target];
17
+ const temporary = mkdtempSync(path.join(root, '.install-'));
18
+ try {
19
+ console.log(`Downloading Tiana CLI ${pkg.version} (${target}) from Gitee...`);
20
+ const response = await fetch(asset.url);
21
+ if (!response.ok) throw new Error(`Binary download failed: HTTP ${response.status}`);
22
+ const contents = Buffer.from(await response.arrayBuffer());
23
+ if (createHash('sha256').update(contents).digest('hex') !== asset.sha256) throw new Error('Binary archive checksum mismatch.');
24
+ const archive = path.join(temporary, target.startsWith('windows-') ? 'cli.zip' : 'cli.tar.gz');
25
+ writeFileSync(archive, contents);
26
+ const extracted = path.join(temporary, 'unpacked');
27
+ mkdirSync(extracted);
28
+ if (process.platform === 'win32') {
29
+ execFileSync('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', "$ErrorActionPreference='Stop'; Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($env:TIANA_ARCHIVE,$env:TIANA_DEST)"], {
30
+ env: { ...process.env, TIANA_ARCHIVE: archive, TIANA_DEST: extracted }, stdio: 'pipe',
31
+ });
32
+ } else {
33
+ execFileSync('tar', ['-xzf', archive, '-C', extracted], { stdio: 'pipe' });
34
+ }
35
+ const name = binaryName(target);
36
+ chmodSync(path.join(extracted, name), 0o755);
37
+ mkdirSync(path.join(root, 'native'), { recursive: true });
38
+ renameSync(path.join(extracted, name), path.join(root, 'native', name));
39
+ console.log(`Tiana CLI ${pkg.version} installed.`);
40
+ } finally {
41
+ rmSync(temporary, { recursive: true, force: true });
42
+ }
43
+ }
44
+ install().catch(error => { console.error(`Tiana CLI installation failed: ${error.message}`); process.exitCode = 1; });
package/bin/launcher.mjs CHANGED
@@ -1,13 +1,8 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { constants } from 'node:os';
3
3
  import { fileURLToPath } from 'node:url';
4
-
5
- export function platformDirectory(platform, arch) {
6
- return {
7
- 'darwin:arm64': 'darwin-arm64',
8
- 'linux:x64': 'linux-amd64',
9
- }[`${platform}:${arch}`];
10
- }
4
+ import { platformDirectory, binaryName } from './platforms.mjs';
5
+ export { platformDirectory } from './platforms.mjs';
11
6
 
12
7
  export function run(args = process.argv.slice(2)) {
13
8
  const platform = platformDirectory(process.platform, process.arch);
@@ -16,9 +11,10 @@ export function run(args = process.argv.slice(2)) {
16
11
  process.exitCode = 1;
17
12
  return;
18
13
  }
19
- const executable = fileURLToPath(new URL(`../platforms/${platform}/tiana`, import.meta.url));
14
+ const executable = fileURLToPath(new URL(`../native/${binaryName(platform)}`, import.meta.url));
20
15
  const child = spawn(executable, args, { stdio: 'inherit' });
21
- const onInterrupt = () => child.kill('SIGINT');
16
+ // Windows delivers Ctrl+C to both processes attached to this console.
17
+ const onInterrupt = () => { if (process.platform !== 'win32') child.kill('SIGINT'); };
22
18
  const onTerminate = () => child.kill('SIGTERM');
23
19
  process.on('SIGINT', onInterrupt);
24
20
  process.on('SIGTERM', onTerminate);
@@ -0,0 +1,18 @@
1
+ export const targets = [
2
+ 'darwin-amd64', 'darwin-arm64',
3
+ 'linux-amd64', 'linux-arm64', 'linux-riscv64',
4
+ 'windows-amd64', 'windows-arm64',
5
+ ];
6
+
7
+ export function platformDirectory(platform, arch) {
8
+ const target = `${platform === 'win32' ? 'windows' : platform}-${arch === 'x64' ? 'amd64' : arch}`;
9
+ return targets.includes(target) ? target : undefined;
10
+ }
11
+
12
+ export function binaryName(target) {
13
+ return target.startsWith('windows-') ? 'tiana.exe' : 'tiana';
14
+ }
15
+
16
+ export function archiveName(version, target) {
17
+ return `tiana-cli-${version}-${target}.${target.startsWith('windows-') ? 'zip' : 'tar.gz'}`;
18
+ }
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@tianacloud/cli",
3
- "version": "0.2.1-beta.3",
3
+ "version": "0.2.2-beta.1",
4
4
  "description": "Tiana CLI for account login, SQLite, Git and application publication",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/tianacloud/cli.git"
8
+ },
5
9
  "type": "module",
6
10
  "engines": {
7
11
  "node": ">=20"
@@ -17,7 +21,20 @@
17
21
  },
18
22
  "files": [
19
23
  "bin",
20
- "platforms",
24
+ "release.json",
21
25
  "README.md"
26
+ ],
27
+ "scripts": {
28
+ "postinstall": "node bin/install.mjs"
29
+ },
30
+ "os": [
31
+ "darwin",
32
+ "linux",
33
+ "win32"
34
+ ],
35
+ "cpu": [
36
+ "x64",
37
+ "arm64",
38
+ "riscv64"
22
39
  ]
23
40
  }
package/release.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "version": "0.2.2-beta.1",
3
+ "assets": {
4
+ "darwin-amd64": {
5
+ "filename": "tiana-cli-0.2.2-beta.1-darwin-amd64.tar.gz",
6
+ "sha256": "7cae3d91ae3648728b849232caeb5eef31643fec3d38e676199935459268df95",
7
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-darwin-amd64.tar.gz"
8
+ },
9
+ "darwin-arm64": {
10
+ "filename": "tiana-cli-0.2.2-beta.1-darwin-arm64.tar.gz",
11
+ "sha256": "a5bc532709f4e042ca9fc2753b9369a12b78192a1d6d074da593a93e727c435b",
12
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-darwin-arm64.tar.gz"
13
+ },
14
+ "linux-amd64": {
15
+ "filename": "tiana-cli-0.2.2-beta.1-linux-amd64.tar.gz",
16
+ "sha256": "06a65063b30582c7a833d30d841dec63dec21585565694f4810adc343c2b08b5",
17
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-linux-amd64.tar.gz"
18
+ },
19
+ "linux-arm64": {
20
+ "filename": "tiana-cli-0.2.2-beta.1-linux-arm64.tar.gz",
21
+ "sha256": "09603c652ec015d3fe888fe26982fbd885265ce4c11ecc26fc37833a86216aa3",
22
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-linux-arm64.tar.gz"
23
+ },
24
+ "linux-riscv64": {
25
+ "filename": "tiana-cli-0.2.2-beta.1-linux-riscv64.tar.gz",
26
+ "sha256": "b0d1bdf9035facb784f3a66b5193c9c6c92ab5826ba0eba951ae1d163c59e158",
27
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-linux-riscv64.tar.gz"
28
+ },
29
+ "windows-amd64": {
30
+ "filename": "tiana-cli-0.2.2-beta.1-windows-amd64.zip",
31
+ "sha256": "27a69abca41da32175600e684d835fed7237a9fd849e131e4f86d51b622c0267",
32
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-windows-amd64.zip"
33
+ },
34
+ "windows-arm64": {
35
+ "filename": "tiana-cli-0.2.2-beta.1-windows-arm64.zip",
36
+ "sha256": "5955c8271ad3199750b1890578e8510580e935fd039a5d150a54d15c27a0180b",
37
+ "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.1/tiana-cli-0.2.2-beta.1-windows-arm64.zip"
38
+ }
39
+ }
40
+ }
@@ -1,2 +0,0 @@
1
- 279e014f86741334f1db7ae7db56cd1fe5e973c30391faaae9d9ded34d0ee185 tiana
2
- c0ae5f5c3387c24980b271f63cb5adba25d6317b3a4bcb38b2322e59b872da7d git-remote-tiana
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
- set -eu
3
- # Resolve only this launcher's directory; never search PATH for tiana.
4
- case "$0" in
5
- */*) launcher=$0 ;;
6
- *) launcher=$(command -v "$0") ;;
7
- esac
8
- launcher_dir=$(CDPATH='' cd -P -- "$(dirname -- "$launcher")" && pwd)
9
- exec "$launcher_dir/tiana" git remote-helper "$@"
@@ -1,15 +0,0 @@
1
- {
2
- "version": "0.2.1-beta.3",
3
- "platform": "darwin",
4
- "arch": "arm64",
5
- "cli": {
6
- "revision": "de410d13710957f223a00b01abe9f67ce42197c0",
7
- "dirty": false
8
- },
9
- "runtime": "native-go",
10
- "insecure_tls": false,
11
- "files": {
12
- "tiana": "279e014f86741334f1db7ae7db56cd1fe5e973c30391faaae9d9ded34d0ee185",
13
- "git-remote-tiana": "c0ae5f5c3387c24980b271f63cb5adba25d6317b3a4bcb38b2322e59b872da7d"
14
- }
15
- }
Binary file
@@ -1,2 +0,0 @@
1
- 6d4cd1783fbf63c26ebb07223559ca4d0cb7fdcb15734c425e69b0e2e0006745 tiana
2
- c0ae5f5c3387c24980b271f63cb5adba25d6317b3a4bcb38b2322e59b872da7d git-remote-tiana
@@ -1,9 +0,0 @@
1
- #!/bin/sh
2
- set -eu
3
- # Resolve only this launcher's directory; never search PATH for tiana.
4
- case "$0" in
5
- */*) launcher=$0 ;;
6
- *) launcher=$(command -v "$0") ;;
7
- esac
8
- launcher_dir=$(CDPATH='' cd -P -- "$(dirname -- "$launcher")" && pwd)
9
- exec "$launcher_dir/tiana" git remote-helper "$@"
@@ -1,15 +0,0 @@
1
- {
2
- "version": "0.2.1-beta.3",
3
- "platform": "linux",
4
- "arch": "amd64",
5
- "cli": {
6
- "revision": "de410d13710957f223a00b01abe9f67ce42197c0",
7
- "dirty": false
8
- },
9
- "runtime": "native-go",
10
- "insecure_tls": false,
11
- "files": {
12
- "tiana": "6d4cd1783fbf63c26ebb07223559ca4d0cb7fdcb15734c425e69b0e2e0006745",
13
- "git-remote-tiana": "c0ae5f5c3387c24980b271f63cb5adba25d6317b3a4bcb38b2322e59b872da7d"
14
- }
15
- }
Binary file