@tianacloud/cli 0.2.2-beta.8 → 0.3.0-bootstrap.3

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,17 +1,25 @@
1
1
  # Tiana CLI
2
2
 
3
- 使用 `npm install -g @tianacloud/cli` 安装。需要 Node.js 20 或更高版本;安装时从 [Gitee 发布仓库](https://gitee.com/tianacloud/cli-releases/releases) 下载当前平台的原生程序并验证校验和,无需 Go 或 Rust。
3
+ Install Node.js 20+ and run:
4
4
 
5
- 支持 macOS amd64/arm64、Linux amd64/arm64/riscv64、Windows amd64/arm64。Windows 安装由 Node.js 在进程内解压 ZIP;macOS/Linux 需要 tar。运行 `tiana version` 核验安装。Git 功能需要另外安装 Git,`connect -- turso ...` 需要另外安装 Turso。
5
+ ```sh
6
+ npm install -g @tianacloud/cli@latest --include=optional
7
+ tiana version
8
+ tiana login
9
+ ```
6
10
 
7
- 本地审核 tarball 也可用 `npm install -g /path/to/tiana-cli-VERSION.tgz` 安装,仍需访问 Gitee 下载该版本二进制。如果安装时禁用了脚本,执行 `npm rebuild -g @tianacloud/cli --ignore-scripts=false` 补装。
11
+ npm installs the native package for your operating system and CPU. The `tiana`
12
+ and `git-remote-tiana` launchers run that binary with your arguments, input and
13
+ exit status. Native binaries are included in npm packages.
8
14
 
9
- 管理端地址由启动 Agent 或 Shell 时设置的 `TIANA_API_ORIGIN` 提供,技能继承环境,不按命令注入或覆盖;私有 CA 使用 `TIANA_CA_FILE` 或 `--ca-file`。包不内置部署地址或 CA,默认验证 TLS。
15
+ ```sh
16
+ tiana web list-template --json
17
+ tiana web init-template ledger --dir ./my-ledger --json
18
+ ```
10
19
 
11
- 对话中运行 `tiana login --start --no-open --json` 并向用户展示 `data.verification_uri`。授权后执行 `tiana login --resume --json`,成功再执行 `tiana status`。普通终端可用 `tiana login`。
20
+ Read the generated metadata.json and README.md, fill the declared variables,
21
+ initialize your SQLite instance, then build and publish your application.
12
22
 
13
- 数据库:`tiana sqlite create NAME --wait`、`tiana sqlite shell INSTANCE -e 'SELECT 1'`。源码:`tiana git create NAME --wait`,使用返回的远程地址进行普通 Git 推送。连接读取已有账号登录态,不保存本地实例 Token;过期时重新登录。
14
-
15
- 应用:`tiana web serve --dir DIST`、`tiana web create NAME`、`tiana web upload ID --version VERSION --dir DIST --json`。遵循配套 Tiana Skill 的模板、哈希路由和清单。
16
-
17
- 应用列表:`tiana web list [--json]`。删除:`tiana web delete ID_OR_NAME`,非交互需 `--force`,可用 `--wait --json` 等待源站文件清理;关联 SQLite、Git 保留。
23
+ Supports macOS x64/arm64, Linux x64/arm64/riscv64 and Windows x64/arm64.
24
+ If the native dependency is missing, rerun the installation with
25
+ `--include=optional`. Installation with `--ignore-scripts` works as well.
package/bin/launcher.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { constants } from 'node:os';
3
- import { fileURLToPath } from 'node:url';
4
- import { platformDirectory, binaryName } from './platforms.mjs';
3
+ import { createRequire } from 'node:module';
4
+ import path from 'node:path';
5
+ import { platformDirectory, platformPackage, binaryName } from './platforms.mjs';
5
6
  export { platformDirectory } from './platforms.mjs';
6
7
 
7
8
  export function run(args = process.argv.slice(2)) {
@@ -11,7 +12,16 @@ export function run(args = process.argv.slice(2)) {
11
12
  process.exitCode = 1;
12
13
  return;
13
14
  }
14
- const executable = fileURLToPath(new URL(`../native/${binaryName(platform)}`, import.meta.url));
15
+ const name = platformPackage(process.platform, process.arch);
16
+ let executable;
17
+ try {
18
+ const manifest = createRequire(import.meta.url).resolve(`${name}/package.json`);
19
+ executable = path.join(path.dirname(manifest), 'bin', binaryName(platform));
20
+ } catch {
21
+ console.error(`Missing ${name}. Reinstall with npm install -g @tianacloud/cli@latest --include=optional`);
22
+ process.exitCode = 1;
23
+ return;
24
+ }
15
25
  const child = spawn(executable, args, { stdio: 'inherit' });
16
26
  // Windows delivers Ctrl+C to both processes attached to this console.
17
27
  const onInterrupt = () => { if (process.platform !== 'win32') child.kill('SIGINT'); };
@@ -19,7 +29,7 @@ export function run(args = process.argv.slice(2)) {
19
29
  process.on('SIGINT', onInterrupt);
20
30
  process.on('SIGTERM', onTerminate);
21
31
  child.on('error', () => {
22
- console.error('Cannot start the packaged Tiana CLI. Reinstall the complete package for this platform.');
32
+ console.error(`Cannot start ${name}. Reinstall with npm install -g @tianacloud/cli@latest --include=optional`);
23
33
  process.exitCode = 1;
24
34
  });
25
35
  child.on('close', (code, signal) => {
package/bin/platforms.mjs CHANGED
@@ -13,6 +13,6 @@ export function binaryName(target) {
13
13
  return target.startsWith('windows-') ? 'tiana.exe' : 'tiana';
14
14
  }
15
15
 
16
- export function archiveName(version, target) {
17
- return `tiana-cli-${version}-${target}.${target.startsWith('windows-') ? 'zip' : 'tar.gz'}`;
16
+ export function platformPackage(platform, arch) {
17
+ return platformDirectory(platform, arch) ? `@tianacloud/cli-${platform}-${arch}` : undefined;
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tianacloud/cli",
3
- "version": "0.2.2-beta.8",
3
+ "version": "0.3.0-bootstrap.3",
4
4
  "description": "Tiana CLI for account login, SQLite, Git and application publication",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,12 +21,8 @@
21
21
  },
22
22
  "files": [
23
23
  "bin",
24
- "release.json",
25
24
  "README.md"
26
25
  ],
27
- "scripts": {
28
- "postinstall": "node bin/install.mjs"
29
- },
30
26
  "os": [
31
27
  "darwin",
32
28
  "linux",
@@ -37,7 +33,13 @@
37
33
  "arm64",
38
34
  "riscv64"
39
35
  ],
40
- "dependencies": {
41
- "fflate": "0.8.3"
36
+ "optionalDependencies": {
37
+ "@tianacloud/cli-darwin-x64": "0.3.0-bootstrap.3",
38
+ "@tianacloud/cli-darwin-arm64": "0.3.0-bootstrap.3",
39
+ "@tianacloud/cli-linux-x64": "0.3.0-bootstrap.3",
40
+ "@tianacloud/cli-linux-arm64": "0.3.0-bootstrap.3",
41
+ "@tianacloud/cli-linux-riscv64": "0.3.0-bootstrap.3",
42
+ "@tianacloud/cli-win32-x64": "0.3.0-bootstrap.3",
43
+ "@tianacloud/cli-win32-arm64": "0.3.0-bootstrap.3"
42
44
  }
43
45
  }
@@ -1,10 +0,0 @@
1
- import { unzipSync } from 'fflate';
2
- import { writeFileSync } from 'node:fs';
3
- import path from 'node:path';
4
-
5
- export function extractWindowsBinary(archive, directory) {
6
- const files = unzipSync(archive, { filter: entry => entry.name === 'tiana.exe' });
7
- const binary = files['tiana.exe'];
8
- if (!binary) throw new Error('Binary archive is missing tiana.exe.');
9
- writeFileSync(path.join(directory, 'tiana.exe'), binary);
10
- }
package/bin/install.mjs DELETED
@@ -1,43 +0,0 @@
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
- import { extractWindowsBinary } from './extract-zip.mjs';
9
-
10
- const root = fileURLToPath(new URL('..', import.meta.url));
11
- async function install() {
12
- const target = platformDirectory(process.platform, process.arch);
13
- if (!target) throw new Error(`Tiana CLI does not support ${process.platform}/${process.arch}`);
14
- const pkg = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'));
15
- const release = JSON.parse(readFileSync(path.join(root, 'release.json'), 'utf8'));
16
- if (release.version !== pkg.version) throw new Error('The binary manifest does not match the npm package version.');
17
- const asset = release.assets[target];
18
- const temporary = mkdtempSync(path.join(root, '.install-'));
19
- try {
20
- console.log(`Downloading Tiana CLI ${pkg.version} (${target}) from Gitee...`);
21
- const response = await fetch(asset.url);
22
- if (!response.ok) throw new Error(`Binary download failed: HTTP ${response.status}`);
23
- const contents = Buffer.from(await response.arrayBuffer());
24
- if (createHash('sha256').update(contents).digest('hex') !== asset.sha256) throw new Error('Binary archive checksum mismatch.');
25
- const archive = path.join(temporary, target.startsWith('windows-') ? 'cli.zip' : 'cli.tar.gz');
26
- const extracted = path.join(temporary, 'unpacked');
27
- mkdirSync(extracted);
28
- if (process.platform === 'win32') {
29
- extractWindowsBinary(contents, extracted);
30
- } else {
31
- writeFileSync(archive, contents);
32
- execFileSync('tar', ['-xzf', archive, '-C', extracted], { stdio: 'pipe' });
33
- }
34
- const name = binaryName(target);
35
- chmodSync(path.join(extracted, name), 0o755);
36
- mkdirSync(path.join(root, 'native'), { recursive: true });
37
- renameSync(path.join(extracted, name), path.join(root, 'native', name));
38
- console.log(`Tiana CLI ${pkg.version} installed.`);
39
- } finally {
40
- rmSync(temporary, { recursive: true, force: true });
41
- }
42
- }
43
- install().catch(error => { console.error(`Tiana CLI installation failed: ${error.message}`); process.exitCode = 1; });
package/release.json DELETED
@@ -1,40 +0,0 @@
1
- {
2
- "version": "0.2.2-beta.8",
3
- "assets": {
4
- "darwin-amd64": {
5
- "filename": "tiana-cli-0.2.2-beta.8-darwin-amd64.tar.gz",
6
- "sha256": "f667a61f9c44e8ac44396df94b4545c64f9011f89e3660b098f642a9fa2303f4",
7
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-darwin-amd64.tar.gz"
8
- },
9
- "darwin-arm64": {
10
- "filename": "tiana-cli-0.2.2-beta.8-darwin-arm64.tar.gz",
11
- "sha256": "c20b5017208db4735b12252156818b4d10bce42b0bff68f300ec32934f5de683",
12
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-darwin-arm64.tar.gz"
13
- },
14
- "linux-amd64": {
15
- "filename": "tiana-cli-0.2.2-beta.8-linux-amd64.tar.gz",
16
- "sha256": "dd6bae6668ed4fdbcacae0efc083a40c18062f4a51f332792111f7c0a40a7cf0",
17
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-linux-amd64.tar.gz"
18
- },
19
- "linux-arm64": {
20
- "filename": "tiana-cli-0.2.2-beta.8-linux-arm64.tar.gz",
21
- "sha256": "70e0ae203a505f5462d79044fb42ede78673b0805b54d7bfcbf50b2c52656b6a",
22
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-linux-arm64.tar.gz"
23
- },
24
- "linux-riscv64": {
25
- "filename": "tiana-cli-0.2.2-beta.8-linux-riscv64.tar.gz",
26
- "sha256": "9656336468c89adaaeeeaf228fa653c5225d099a3026d7e75af26eff0f4828bb",
27
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-linux-riscv64.tar.gz"
28
- },
29
- "windows-amd64": {
30
- "filename": "tiana-cli-0.2.2-beta.8-windows-amd64.zip",
31
- "sha256": "dcab061d81c0793076d587b9fa2ee424bcb97a171458f478b86f32d7498b9c17",
32
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-windows-amd64.zip"
33
- },
34
- "windows-arm64": {
35
- "filename": "tiana-cli-0.2.2-beta.8-windows-arm64.zip",
36
- "sha256": "fc13efaaf9e716a4cf67ce2e0ea7f4e285fae55647f416261fd07d1939f3dfdf",
37
- "url": "https://gitee.com/tianacloud/cli-releases/releases/download/v0.2.2-beta.8/tiana-cli-0.2.2-beta.8-windows-arm64.zip"
38
- }
39
- }
40
- }