@delta-infra/cli 1.0.0 → 1.0.2

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
@@ -29,6 +29,12 @@ npm install -g @delta-infra/cli
29
29
 
30
30
  安装时会自动从 GitHub Release 下载当前平台的二进制文件并解压到本地。
31
31
 
32
+ ### 方式三:Go Install
33
+
34
+ ```bash
35
+ go install github.com/delta-infra/delta-infra-cli/cmd/delta-cli@latest
36
+ ```
37
+
32
38
  ## 快速开始
33
39
 
34
40
  ### 1. 初始化配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delta-infra/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Delta Sandbox CLI",
5
5
  "bin": {
6
6
  "delta-cli": "scripts/run.js"
@@ -12,13 +12,19 @@
12
12
  "scripts/",
13
13
  "skills/"
14
14
  ],
15
- "keywords": ["delta", "sandbox", "cli", "gpu", "compute"],
15
+ "keywords": [
16
+ "delta",
17
+ "sandbox",
18
+ "cli",
19
+ "gpu",
20
+ "compute"
21
+ ],
16
22
  "license": "MIT",
17
23
  "engines": {
18
24
  "node": ">=18.0.0"
19
25
  },
20
26
  "repository": {
21
27
  "type": "git",
22
- "url": "https://github.com/yzailab/delta-infra-cli.git"
28
+ "url": "git+https://github.com/yzailab/delta-infra-cli.git"
23
29
  }
24
30
  }
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ cd /usr/src/myapp
5
+ mkdir -p bin
6
+
7
+ VERSION=$(git describe --tags --always --dirty 2>/dev/null || echo "dev")
8
+ COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
9
+ DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
10
+
11
+ LDFLAGS="-X github.com/delta-infra/delta-infra-cli/internal/build.Version=${VERSION} -X github.com/delta-infra/delta-infra-cli/internal/build.Commit=${COMMIT} -X github.com/delta-infra/delta-infra-cli/internal/build.Date=${DATE}"
12
+
13
+ echo "Building delta-cli-linux-amd64 ..."
14
+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags "${LDFLAGS}" -o bin/delta-cli-linux-amd64 ./cmd/delta-cli
15
+
16
+ echo "Building delta-cli-windows-amd64.exe ..."
17
+ CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -buildvcs=false -ldflags "${LDFLAGS}" -o bin/delta-cli-windows-amd64.exe ./cmd/delta-cli
18
+
19
+ echo "Done."
20
+ ls -la bin/
@@ -9,6 +9,14 @@ const BINARY_NAME = 'delta-cli';
9
9
  const VERSION = require('../package.json').version;
10
10
  const RELEASE_BASE_URL = 'https://github.com/yzailab/delta-infra-cli/releases/download';
11
11
 
12
+ function releaseAssetUrl(version, assetName) {
13
+ const mirror = process.env.DELTA_CLI_MIRROR || '';
14
+ if (mirror) {
15
+ return `${mirror.replace(/\/$/, '')}/yzailab/delta-infra-cli/releases/download/v${version}/${assetName}`;
16
+ }
17
+ return `${RELEASE_BASE_URL}/v${version}/${assetName}`;
18
+ }
19
+
12
20
  const platformMap = {
13
21
  darwin: 'darwin',
14
22
  linux: 'linux',
@@ -38,7 +46,7 @@ function download(url, dest) {
38
46
  try { fs.unlinkSync(dest); } catch {}
39
47
  };
40
48
 
41
- https.get(url, (response) => {
49
+ https.get(url, { timeout: 60000 }, (response) => {
42
50
  if (response.statusCode >= 301 && response.statusCode <= 308 && response.headers.location) {
43
51
  file.destroy();
44
52
  cleanup();
@@ -90,14 +98,18 @@ async function main() {
90
98
 
91
99
  fs.mkdirSync(binDir, { recursive: true });
92
100
 
93
- const url = `${RELEASE_BASE_URL}/v${VERSION}/${assetName}`;
94
- console.log(`Downloading ${assetName} from GitHub...`);
101
+ const url = releaseAssetUrl(VERSION, assetName);
102
+ console.log(`Downloading ${assetName} from ${process.env.DELTA_CLI_MIRROR ? 'mirror' : 'GitHub'}...`);
95
103
 
96
104
  try {
97
105
  const checksum = await download(url, archivePath);
98
106
  console.log(`Downloaded archive, SHA256: ${checksum}`);
99
107
  console.log(`Extracting to ${binDir}...`);
100
108
  extract(archivePath, binDir, platform);
109
+ const extractedBinary = path.join(binDir, `${BINARY_NAME}-${platform}-${arch}${binaryExt}`);
110
+ if (fs.existsSync(extractedBinary) && extractedBinary !== binaryPath) {
111
+ fs.renameSync(extractedBinary, binaryPath);
112
+ }
101
113
  fs.chmodSync(binaryPath, 0o755);
102
114
  fs.unlinkSync(archivePath);
103
115
  console.log(`Installed to ${binaryPath}`);
@@ -0,0 +1,39 @@
1
+ # skills/ — AI Agent Skill Packages
2
+
3
+ **Generated:** 2026-06-16 (Deep Refresh)
4
+ **Parent:** `../AGENTS.md`
5
+
6
+ ## OVERVIEW
7
+
8
+ Markdown-based skill definitions for AI agents interacting with delta-cli. Two packages: `delta-sandbox` (sandbox lifecycle operations) and `delta-shared` (auth, config, error handling conventions).
9
+
10
+ ## STRUCTURE
11
+
12
+ ```
13
+ skills/
14
+ ├── delta-sandbox/
15
+ │ ├── SKILL.md # YAML frontmatter + Markdown operation guide
16
+ │ └── references/ # (empty or planned)
17
+ └── delta-shared/
18
+ └── SKILL.md # Shared auth/config rules
19
+ ```
20
+
21
+ ## WHERE TO LOOK
22
+
23
+ | Path | Content |
24
+ |------|---------|
25
+ | `delta-sandbox/SKILL.md` | Sandbox create/run/read/write/kill workflow for AI agents |
26
+ | `delta-shared/SKILL.md` | Shared auth commands, config management, error interpretation |
27
+
28
+ ## CONVENTIONS
29
+
30
+ - YAML frontmatter with `name`, `description`, `metadata.requires.bins`, `metadata.cliHelp`
31
+ - Markdown body with tables for commands and examples; sections for preconditions
32
+ - Skills are included in npm package `files` array and shipped with the CLI distribution
33
+ - References directory for supplementary docs (lifecycle guides, command cheatsheets)
34
+
35
+ ## ANTI-PATTERNS
36
+
37
+ - Do not embed realistic credentials, API keys, or tokens in skill examples
38
+ - Do not break relative links between skills or references
39
+ - Do not reference internal Go package paths in skill docs — use CLI command names