@snowdreamtech/unistack 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present SnowdreamTech Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # UniStack
2
+
3
+ [![CI Pipeline](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/ci.yml?branch=main&label=CI%20Pipeline)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
4
+ [![CD Pipeline](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/cd.yml?branch=main&label=CD%20Pipeline)](https://github.com/snowdreamtech/UniStack/actions/workflows/cd.yml)
5
+ [![GitHub Pages](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/pages.yml?branch=main&label=Docs&logo=github)](https://github.com/snowdreamtech/UniStack/actions/workflows/pages.yml)
6
+ [![CodeQL](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/codeql.yml?branch=main&label=CodeQL&logo=github)](https://github.com/snowdreamtech/UniStack/actions/workflows/codeql.yml)
7
+ [![Multi-OS Verified](https://img.shields.io/badge/Verified-Linux%20%7C%20macOS%20%7C%20Windows-blue)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
8
+ [![Security Audit](https://img.shields.io/badge/Security-Zizmor%20%7C%20Trivy%20%7C%20Gitleaks-brightgreen)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
9
+ [![SBOM Available](https://img.shields.io/badge/SBOM-Available-success)](https://github.com/snowdreamtech/UniStack/releases/latest)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/MIT)
11
+ [![Release](https://img.shields.io/github/v/release/snowdreamtech/UniStack?logo=github&sort=semver)](https://github.com/snowdreamtech/UniStack/releases/latest)
12
+ [![Dependabot Enabled](https://img.shields.io/badge/Dependabot-Enabled-brightgreen?logo=dependabot)](https://github.com/snowdreamtech/UniStack/blob/main/.github/dependabot.yml)
13
+ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
14
+ [![GitHub Stars](https://img.shields.io/github/stars/snowdreamtech/UniStack?style=social)](https://github.com/snowdreamtech/UniStack)
15
+ [![GitHub Issues](https://img.shields.io/github/issues/snowdreamtech/UniStack)](https://github.com/snowdreamtech/UniStack/issues)
16
+ [![Code Size](https://img.shields.io/github/languages/code-size/snowdreamtech/UniStack)](https://github.com/snowdreamtech/UniStack)
17
+
18
+ [English](README.md) | [įŽ€äŊ“中文](README_zh-CN.md)
19
+
20
+ UniStack is a fast, flexible, and enterprise-grade Golang CLI template inspired by UniRTM and helloworld. It provides a robust foundation for building modern command-line applications in Go, featuring beautiful terminal output, structured logging, built-in caching, and a comprehensive CI/CD pipeline.
21
+
22
+ ## 🌟 Features
23
+
24
+ - **Modern CLI Architecture**: Built with Go 1.24+ and Cobra, providing a structured and extensible command-line application framework.
25
+ - **Beautiful Output**: Utilizes `pterm` for rich, colorful, and interactive terminal output.
26
+ - **Structured Logging**: Built-in support for Go's standard `slog` package for high-performance structured logging.
27
+ - **Robust Tooling**: Includes built-in commands like `doctor`, `self-update`, `cache`, `config`, and `license`.
28
+ - **Triple Guarantee Quality**: 100% code purity enforced through IDE checks, Pre-commit hooks, and GitHub Actions integrated quality gates.
29
+ - **Cross-Platform Ready**: Runs seamlessly on macOS, Linux, and Windows.
30
+
31
+ ## đŸ—ī¸ Architecture & Design
32
+
33
+ ### Overview
34
+
35
+ UniStack is engineered to solve the boilerplate problem when starting new Go CLI projects. It standardizes the development environment, architectural patterns, and automation pipelines out of the box.
36
+
37
+ ### Core Components
38
+
39
+ - **CLI Framework**: Utilizes `spf13/cobra` and `spf13/viper` for powerful command parsing and configuration management.
40
+ - **UI & Logging**: Integrated `pterm` for UI components and `slog` for structured event logging.
41
+ - **Database & Caching**: SQLite-backed (via `modernc.org/sqlite`) local caching and transactional data storage.
42
+ - **Task Orchestration**: Configured with `UniRTM` for managing local development workflows (lint, test, verify).
43
+
44
+ ## 📖 Usage Guide
45
+
46
+ ### Prerequisites
47
+
48
+ - **Runtime**: Go (>= 1.24).
49
+ - **Git**: Global git installation required.
50
+ - **UniRTM**: Required for task execution and orchestration.
51
+
52
+ ### Quick Start
53
+
54
+ 1. **Install UniRTM**: Ensure `unirtm` is installed on your system.
55
+ 2. **Initialize**: `unirtm run setup` (bootstraps core dependencies and hooks).
56
+ 3. **Install**: `unirtm run install` (installs project dependencies).
57
+ 4. **Verify**: `unirtm run verify` (ensures everything is green).
58
+ 5. **Build**: `go build -o unistack main.go`
59
+
60
+ ### Available Commands
61
+
62
+ - `unistack version`: Print the version number
63
+ - `unistack doctor`: Check system health and diagnose issues
64
+ - `unistack self-update`: Update to the latest version
65
+ - `unistack cache`: Manage local cache
66
+ - `unistack config`: Manage configuration
67
+ - `unistack license`: Manage copyright license headers
68
+
69
+ ## đŸ› ī¸ Operations Guide
70
+
71
+ ### Pre-deployment Checklist
72
+
73
+ 1. Run `unirtm run verify` to ensure all quality gates are green (runs formatters, linters, tests, and security audits).
74
+ 2. Ensure `CHANGELOG.md` is updated.
75
+
76
+ ### Troubleshooting
77
+
78
+ - **Problem**: `unirtm run verify` fails with test errors.
79
+ - **Solution**: Ensure your code passes all Go unit tests. UniStack enforces strict coverage and race condition checks.
80
+ - **Problem**: Pre-commit hooks fail.
81
+ - **Solution**: The hooks often auto-fix issues (like formatting). Stage the modified files and commit again.
82
+
83
+ ## 🔒 Security Considerations
84
+
85
+ ### Security Model
86
+
87
+ - **Audit Logging**: All critical operations and security scans are executed during the `verify` task using tools like `trivy`, `gitleaks`, and `govulncheck`.
88
+ - **Dependency Management**: Powered by Dependabot to ensure all dependencies are kept up-to-date and secure.
89
+
90
+ ## 🧑‍đŸ’ģ Development Guide
91
+
92
+ ### Local Development Setup
93
+
94
+ ```bash
95
+ git clone https://github.com/snowdreamtech/UniStack.git
96
+ cd UniStack
97
+ unirtm run setup
98
+ unirtm run install
99
+ ```
100
+
101
+ ### 🚀 Proxy Usage Scenarios
102
+
103
+ The `GITHUB_PROXY` (default: `https://gh-proxy.sn0wdr1am.com/`) is optimized for specific network acceleration scenarios. Misusing it for unsupported protocols (like Git) will result in errors.
104
+
105
+ | Scenario | Supported? | Example / Note |
106
+ | :-------------------- | :--------- | :----------------------------------------------------- |
107
+ | **Release Files** | ✅ Yes | `.../releases/download/v1.0/tool.zip` |
108
+ | **Source Archives** | ✅ Yes | `.../archive/master.zip` or `.tar.gz` |
109
+ | **Direct File Links** | ✅ Yes | `.../blob/master/filename` |
110
+ | **Git Clone** | ❌ **No** | Do **not** use for `git clone` or `insteadOf` configs. |
111
+ | **Project Folders** | ❌ **No** | Browsing/cloning via proxy is not supported. |
112
+
113
+ > [!IMPORTANT]
114
+ > To prevent breaking toolchains (like `unirtm`), this template explicitly disables Git redirection via this proxy. Use it only for direct HTTP downloads in scripts.
115
+
116
+ ## 📄 License
117
+
118
+ This project is licensed under the **MIT License**.
119
+ Copyright (c) 2026-present [SnowdreamTech Inc.](https://github.com/snowdreamtech)
120
+ See the [LICENSE](./LICENSE) file for the full license text.
121
+
122
+ ## Star History
123
+
124
+ [![Star History Chart](https://api.star-history.com/image?repos=snowdreamtech/UniStack&type=date&legend=top-left)](https://www.star-history.com/?repos=snowdreamtech%2FUniStack&type=date&legend=top-left)
@@ -0,0 +1,124 @@
1
+ # UniStack
2
+
3
+ [![CI æĩæ°´įēŋ](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/ci.yml?branch=main&label=CI%20Pipeline)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
4
+ [![CD č‡Ē动化发布](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/cd.yml?branch=main&label=CD%20Pipeline)](https://github.com/snowdreamtech/UniStack/actions/workflows/cd.yml)
5
+ [![æ–‡æĄŖįĢ™į‚š](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/pages.yml?branch=main&label=%E6%96%87%E6%A1%A3&logo=github)](https://github.com/snowdreamtech/UniStack/actions/workflows/pages.yml)
6
+ [![CodeQL åŽĄčŽĄ](https://img.shields.io/github/actions/workflow/status/snowdreamtech/UniStack/codeql.yml?branch=main&label=CodeQL&logo=github)](https://github.com/snowdreamtech/UniStack/actions/workflows/codeql.yml)
7
+ [![čˇ¨åšŗå°énj蝁](https://img.shields.io/badge/Verified-Linux%20%7C%20macOS%20%7C%20Windows-blue)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
8
+ [![åŽ‰å…¨åŽĄčŽĄ](https://img.shields.io/badge/Security-Zizmor%20%7C%20Trivy%20%7C%20Gitleaks-brightgreen)](https://github.com/snowdreamtech/UniStack/actions/workflows/ci.yml)
9
+ [![SBOM 背äšĻ](https://img.shields.io/badge/SBOM-Available-success)](https://github.com/snowdreamtech/UniStack/releases/latest)
10
+ [![čŽ¸å¯č¯: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/MIT)
11
+ [![最新发布](https://img.shields.io/github/v/release/snowdreamtech/UniStack?logo=github&sort=semver)](https://github.com/snowdreamtech/UniStack/releases/latest)
12
+ [![Dependabot 厞吝ᔍ](https://img.shields.io/badge/Dependabot-Enabled-brightgreen?logo=dependabot)](https://github.com/snowdreamtech/UniStack/blob/main/.github/dependabot.yml)
13
+ [![pre-commit 厞吝ᔍ](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
14
+ [![GitHub Stars](https://img.shields.io/github/stars/snowdreamtech/UniStack?style=social)](https://github.com/snowdreamtech/UniStack)
15
+ [![GitHub Issues](https://img.shields.io/github/issues/snowdreamtech/UniStack)](https://github.com/snowdreamtech/UniStack/issues)
16
+ [![äģŖį č§„æ¨Ą](https://img.shields.io/github/languages/code-size/snowdreamtech/UniStack)](https://github.com/snowdreamtech/UniStack)
17
+
18
+ [English](README.md) | [įŽ€äŊ“中文](README_zh-CN.md)
19
+
20
+ UniStack 是一ä¸ĒåŋĢ速、įĩæ´ģ且äŧä¸šįē§įš„ Golang CLI æ¨ĄæŋīŧŒæˇąå— UniRTM 和 helloworld įš„å¯å‘ã€‚åŽƒä¸ē构åģēįŽ°äģŖ Go å‘Ŋäģ¤čĄŒåē”ᔍፋåēæäž›äē†ä¸€ä¸ĒåšåŽžįš„åŸēįĄ€īŧŒå†…įŊŽäē†į˛žįžŽįš„įģˆįĢ¯čž“å‡ē、į쓿ž„化æ—Ĩåŋ—、įŧ“å­˜įŽĄį†æœēåˆļäģĨ及全åĨ—įš„ CI/CD æĩæ°´įēŋ。
21
+
22
+ ## 🌟 į‰šæ€§
23
+
24
+ - **įŽ°äģŖ CLI æžļ构**īŧšåŸēäēŽ Go 1.24+ 和 Cobra 构åģēīŧŒæäž›į쓿ž„化且易äēŽæ‰Šåą•įš„å‘Ŋäģ¤čĄŒæĄ†æžļ。
25
+ - **į˛žįžŽčž“å‡ē**īŧšäŊŋᔍ `pterm` åŽžįŽ°ä¸°å¯Œã€å¤šåŊŠä¸”äē¤äē’友åĨŊįš„įģˆįĢ¯čž“å‡ē效果。
26
+ - **į쓿ž„化æ—Ĩåŋ—**īŧšå†…įŊŽå¯š Go 标准åē“ `slog` įš„æ”¯æŒīŧŒæäž›éĢ˜æ€§čƒŊįš„į쓿ž„化æ—Ĩåŋ—čްåŊ•。
27
+ - **ä¸°å¯Œįš„å†…įŊŽåˇĨå…ˇ**īŧšč‡Ēå¸Ļ `doctor`、`self-update`、`cache`、`config` 和 `license` į­‰åŽžį”¨å‘Ŋäģ¤ã€‚
28
+ - **三重äŋč¯č´¨é‡**īŧšé€ščŋ‡ IDE 厞æ—ļæŖ€æŸĨ、Pre-commit æœŦ地æ‹ĻæˆĒ和 GitHub Actions čŋœįĢ¯å…¨é‡åŽĄčŽĄīŧŒæž„åģē 100% äģŖį įē¯å‡€åēĻ防įēŋ。
29
+ - **čˇ¨åšŗå°å°ąįģĒ**īŧšåœ¨ macOS、Linux 和 Windows 上均可无įŧčŋčĄŒã€‚
30
+
31
+ ## đŸ—ī¸ æžļæž„ä¸ŽčŽžčŽĄ
32
+
33
+ ### æĻ‚č§ˆ
34
+
35
+ UniStack æ—¨åœ¨č§Ŗå†ŗæ¯æŦĄå¯åŠ¨æ–°įš„ Go CLI éĄšį›Žæ—ļé‡åˆ°įš„æ¨Ąæŋ化和重复配įŊŽé—Žéĸ˜ã€‚厃提䞛äē†åŧ€įŽąåŗį”¨įš„æ ‡å‡†åŧ€å‘įŽ¯åĸƒã€æžļæž„æ¨Ąåŧå’Œč‡Ē动化æĩæ°´įēŋ。
36
+
37
+ ### æ ¸åŋƒįģ„äģļ
38
+
39
+ - **CLI æĄ†æžļ**īŧšäŊŋᔍ `spf13/cobra` 和 `spf13/viper` čŋ›čĄŒåŧēå¤§įš„å‘Ŋäģ¤č§Ŗæžå’Œé…įŊŽįŽĄį†ã€‚
40
+ - **UI 与 æ—Ĩåŋ—**īŧšé›†æˆäē† `pterm` äŊœä¸ē UI įģ„äģļīŧŒåšļäŊŋᔍ `slog` čŋ›čĄŒį쓿ž„åŒ–įš„äē‹äģļ莰åŊ•。
41
+ - **数捎åē“与įŧ“å­˜**īŧšį”ą SQLite éŠąåŠ¨ (通čŋ‡ `modernc.org/sqlite`)īŧŒæ”¯æŒæœŦ地įŧ“存和äē‹åŠĄæ€§æ•°æŽå­˜å‚¨ã€‚
42
+ - **äģģåŠĄįŧ–排**īŧšå†…įŊŽäē† `UniRTM` 配įŊŽīŧŒį”¨äēŽįŽĄį†æœŦ地åŧ€å‘åˇĨäŊœæĩīŧˆlint、test、verifyīŧ‰ã€‚
43
+
44
+ ## 📖 äŊŋį”¨æŒ‡å—
45
+
46
+ ### 前įŊŽæĄäģļ
47
+
48
+ - **čŋčĄŒæ—ļ**: Go (>= 1.24)。
49
+ - **Git**: 需čĻå…¨åą€åŽ‰čŖ… git。
50
+ - **UniRTM**: åŋ…éĄģåŽ‰čŖ…äģĨæ‰§čĄŒäģģåŠĄįŧ–排。
51
+
52
+ ### åŋĢ速åŧ€å§‹
53
+
54
+ 1. **åŽ‰čŖ… UniRTM**īŧšč¯ˇįĄŽäŋįŗģįģŸåˇ˛åމ誅 `unirtm`。
55
+ 2. **初始化**īŧš`unirtm run setup`īŧˆåŧ•å¯ŧåŽ‰čŖ…æ ¸åŋƒåˇĨå…ˇä¸Žé’Šå­īŧ‰ã€‚
56
+ 3. **åŽ‰čŖ…äžčĩ–**īŧš`unirtm run install`īŧˆåŽ‰čŖ…éĄšį›Žäžčĩ–īŧ‰ã€‚
57
+ 4. **énj蝁**īŧš`unirtm run verify`īŧˆįĄŽäŋæ‰€æœ‰äģŖį æŖ€æŸĨ通čŋ‡īŧ‰ã€‚
58
+ 5. **构åģē**īŧš`go build -o unistack main.go`
59
+
60
+ ### å¯į”¨å‘Ŋäģ¤
61
+
62
+ - `unistack version`: æ‰“å°į‰ˆæœŦåˇ
63
+ - `unistack doctor`: æŖ€æŸĨįŗģįģŸåĨåēˇįŠļå†ĩåšļč¯Šæ–­é—Žéĸ˜
64
+ - `unistack self-update`: æ›´æ–°åˆ°æœ€æ–°į‰ˆæœŦ
65
+ - `unistack cache`: įŽĄį†æœŦ地įŧ“å­˜
66
+ - `unistack config`: įŽĄį†é…įŊŽ
67
+ - `unistack license`: įŽĄį†æēäģŖį æ–‡äģļä¸­įš„į‰ˆæƒčŽ¸å¯å¤´
68
+
69
+ ## đŸ› ī¸ čŋįģ´æŒ‡å—
70
+
71
+ ### 部įŊ˛å‰æŖ€æŸĨ清单
72
+
73
+ 1. čŋčĄŒ `unirtm run verify` įĄŽäŋæ‰€æœ‰č´¨é‡é—¨įĻå‡ä¸ēįģŋ色īŧˆæ‰§čĄŒæ ŧåŧåŒ–、Lint、æĩ‹č¯•åŠåŽ‰å…¨åŽĄčŽĄīŧ‰ã€‚
74
+ 2. įĄŽäŋ `CHANGELOG.md` åˇ˛æ›´æ–°ã€‚
75
+
76
+ ### 故障排除
77
+
78
+ - **问éĸ˜**: `unirtm run verify` æŠĨæĩ‹č¯•å¤ąč´Ĩ。
79
+ - **č§Ŗå†ŗæ–šæĄˆ**: įĄŽäŋäģŖį é€ščŋ‡æ‰€æœ‰ Go 单元æĩ‹č¯•。UniStack äŧšæ‰§čĄŒä¸Ĩæ ŧįš„äģŖį čĻ†į›–įŽ‡å’ŒįĢžæ€æĄäģļ (race) æŖ€æŸĨ。
80
+ - **问éĸ˜**: Pre-commit 钊子æŠĨ错。
81
+ - **č§Ŗå†ŗæ–šæĄˆ**: čŽ¸å¤šé’Šå­īŧˆåĻ‚äģŖį æ ŧåŧåŒ–īŧ‰äŧšč‡Ē动äŋŽå¤é—Žéĸ˜ã€‚å°†äŋŽæ”šåŽįš„æ–‡äģļ重新 `git add` åšļ再æŦĄæäē¤åŗå¯ã€‚
82
+
83
+ ## 🔒 åŽ‰å…¨æŗ¨æ„äē‹éĄš
84
+
85
+ ### åŽ‰å…¨æ¨Ąåž‹
86
+
87
+ - **åŽĄčŽĄæ—Ĩåŋ—**: æ‰€æœ‰įš„å…ŗé”Žæ“äŊœä¸Žåމ免æ‰Ģ描īŧŒå‡åœ¨äŊŋᔍ `unirtm run verify` æ—ļīŧŒį”ą `trivy`、`gitleaks` 和 `govulncheck` į­‰åˇĨå…ˇč‡ĒåŠ¨æ‰§čĄŒã€‚
88
+ - **䞝čĩ–įŽĄį†**: į”ą Dependabot 支持īŧŒäģĨįĄŽäŋæ‰€æœ‰éĄšį›Žäžčĩ–éĄšå§‹įģˆäŋæŒæœ€æ–°ä¸”åŽ‰å…¨įš„įŠļ态。
89
+
90
+ ## 🧑‍đŸ’ģ åŧ€å‘č€…æŒ‡å—
91
+
92
+ ### æœŦ地åŧ€å‘莞įŊŽ
93
+
94
+ ```bash
95
+ git clone https://github.com/snowdreamtech/UniStack.git
96
+ cd UniStack
97
+ unirtm run setup
98
+ unirtm run install
99
+ ```
100
+
101
+ ### 🚀 äģŖį†äŊŋᔍåœē景
102
+
103
+ `GITHUB_PROXY` (éģ˜čޤ: `https://gh-proxy.sn0wdr1am.com/`) é’ˆå¯šį‰šåŽšįš„įŊ‘įģœåŠ é€Ÿåœē景čŋ›čĄŒäē†äŧ˜åŒ–ã€‚åœ¨ä¸æ”¯æŒįš„åčŽŽīŧˆåĻ‚ Gitīŧ‰ä¸Šč¯¯į”¨åރäŧšå¯ŧč‡´é”™č¯¯ã€‚
104
+
105
+ | åœē景 | 是åĻ支持 | į¤ē例 / č¯´æ˜Ž |
106
+ | :--------------------- | :------------ | :--------------------------------------------- |
107
+ | **Release 文äģļ** | ✅ 支持 | `.../releases/download/v1.0/tool.zip` |
108
+ | **æēį åŊ’æĄŖ (Archive)** | ✅ 支持 | `.../archive/master.zip` 或 `.tar.gz` |
109
+ | **文äģļį›´æŽĨ链æŽĨ** | ✅ 支持 | `.../blob/master/filename` |
110
+ | **Git Clone** | ❌ **不支持** | **蝎å‹ŋ**ᔍäēŽ `git clone` 或 `insteadOf` 配įŊŽã€‚ |
111
+ | **éĄšį›Žæ–‡äģļ多** | ❌ **不支持** | 不支持通čŋ‡äģŖį†čŋ›čĄŒéĄšį›Žæ–‡äģļå¤šįš„æĩč§ˆæˆ–克隆。 |
112
+
113
+ > [!IMPORTANT]
114
+ > ä¸ēäē†é˜˛æ­ĸį ´ååˇĨå…ˇé“žīŧˆåĻ‚ `unirtm`īŧ‰īŧŒæœŦæ¨Ąæŋ昞åŧįρᔍäē†é€ščŋ‡æ­¤äģŖį†čŋ›čĄŒįš„ Git é‡åŽšå‘ã€‚č¯ˇäģ…åœ¨č„šæœŦ中čŋ›čĄŒį›´æŽĨ HTTP 下čŊŊæ—ļäŊŋį”¨åŽƒã€‚
115
+
116
+ ## 📄 čŽ¸å¯č¯
117
+
118
+ æœŦéĄšį›Žé‡‡į”¨ **MIT čŽ¸å¯č¯** 授权。
119
+ į‰ˆæƒæ‰€æœ‰ (c) 2026-įŽ°åœ¨ [SnowdreamTech Inc.](https://github.com/snowdreamtech)
120
+ č¯Ļ见 [LICENSE](./LICENSE) 文äģļ。
121
+
122
+ ## Star History
123
+
124
+ [![Star History Chart](https://api.star-history.com/image?repos=snowdreamtech/UniStack&type=date&legend=top-left)](https://www.star-history.com/?repos=snowdreamtech%2FUniStack&type=date&legend=top-left)
package/install.js ADDED
@@ -0,0 +1,160 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Copyright (c) 2026 SnowdreamTech. All rights reserved.
4
+ * Licensed under the MIT License. See LICENSE file in the project root for full license information.
5
+ */
6
+
7
+ // install.js - Root package entry point for @snowdreamtech/unistack
8
+ //
9
+ // This script is both the `bin` entry and the `postinstall` hook.
10
+ // It locates the correct platform-specific binary and either:
11
+ // - Runs it (when invoked as CLI)
12
+ // - Validates the installation (when invoked via postinstall)
13
+
14
+ "use strict";
15
+
16
+ const { execFileSync, spawnSync } = require("child_process");
17
+ const path = require("path");
18
+ const fs = require("fs");
19
+ const os = require("os");
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Platform detection
23
+ // ---------------------------------------------------------------------------
24
+
25
+ /**
26
+ * Map Node.js process.platform + process.arch to npm package suffix.
27
+ * @returns {string} package suffix e.g. "linux-x64"
28
+ */
29
+ function getPlatformPackageSuffix() {
30
+ const platform = process.platform; // 'darwin' | 'linux' | 'win32'
31
+ const arch = process.arch; // 'x64' | 'arm64' | 'arm' | 'ia32'
32
+
33
+ if (platform === "darwin") {
34
+ if (arch === "arm64") return "darwin-arm64";
35
+ if (arch === "x64") return "darwin-x64";
36
+ }
37
+
38
+ if (platform === "linux") {
39
+ if (arch === "x64") return "linux-x64";
40
+ if (arch === "arm64") return "linux-arm64";
41
+ if (arch === "ia32") return "linux-ia32";
42
+ if (arch === "arm") {
43
+ return "linux-arm"; // armv7
44
+ }
45
+ if (arch === "loong64") return "linux-loong64";
46
+ if (arch === "ppc64") return "linux-ppc64le";
47
+ if (arch === "riscv64") return "linux-riscv64";
48
+ if (arch === "s390x") return "linux-s390x";
49
+ }
50
+
51
+ if (platform === "win32") {
52
+ if (arch === "x64") return "windows-x64";
53
+ if (arch === "arm64") return "windows-arm64";
54
+ if (arch === "ia32") return "windows-ia32";
55
+ }
56
+
57
+ if (platform === "freebsd") {
58
+ if (arch === "x64") return "freebsd-x64";
59
+ if (arch === "arm64") return "freebsd-arm64";
60
+ if (arch === "ia32") return "freebsd-ia32";
61
+ if (arch === "arm") return "freebsd-arm";
62
+ }
63
+
64
+ if (platform === "openbsd") {
65
+ if (arch === "x64") return "openbsd-x64";
66
+ if (arch === "arm64") return "openbsd-arm64";
67
+ }
68
+
69
+ if (platform === "netbsd") {
70
+ if (arch === "x64") return "netbsd-x64";
71
+ }
72
+
73
+ throw new Error(
74
+ `Unsupported platform: ${platform}-${arch}\n` +
75
+ "Please open an issue at https://github.com/snowdreamtech/unistack/issues"
76
+ );
77
+ }
78
+
79
+ // ---------------------------------------------------------------------------
80
+ // Binary resolution
81
+ // ---------------------------------------------------------------------------
82
+
83
+ /**
84
+ * Locate the platform binary from the optional dependency package.
85
+ * @param {string} suffix e.g. "linux-x64"
86
+ * @returns {string} absolute path to the binary
87
+ */
88
+ function resolveBinary(suffix) {
89
+ const pkgName = `@snowdreamtech/unistack-${suffix}`;
90
+ const binaryName = process.platform === "win32" ? "unistack.exe" : "unistack";
91
+
92
+ // Strategy 1: resolve via require.resolve (works when package is installed)
93
+ try {
94
+ const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
95
+ const pkgDir = path.dirname(pkgJsonPath);
96
+ const binPath = path.join(pkgDir, "bin", binaryName);
97
+ if (fs.existsSync(binPath)) {
98
+ return binPath;
99
+ }
100
+ } catch (_) {
101
+ // package not found via require.resolve, try manual search
102
+ }
103
+
104
+ // Strategy 2: walk up node_modules hierarchy
105
+ let dir = __dirname;
106
+ for (let i = 0; i < 10; i++) {
107
+ const candidate = path.join(dir, "node_modules", pkgName, "bin", binaryName);
108
+ if (fs.existsSync(candidate)) {
109
+ return candidate;
110
+ }
111
+ const parent = path.dirname(dir);
112
+ if (parent === dir) break;
113
+ dir = parent;
114
+ }
115
+
116
+ throw new Error(
117
+ `Could not find binary for ${pkgName}.\n` +
118
+ "Try reinstalling @snowdreamtech/unistack:\n" +
119
+ " npm install @snowdreamtech/unistack\n\n" +
120
+ `Platform: ${process.platform}-${process.arch}`
121
+ );
122
+ }
123
+
124
+ // ---------------------------------------------------------------------------
125
+ // Entry point
126
+ // ---------------------------------------------------------------------------
127
+
128
+ const isPostInstall = process.env.npm_lifecycle_event === "postinstall";
129
+
130
+ if (isPostInstall) {
131
+ // Postinstall: just validate that the binary can be found
132
+ try {
133
+ const suffix = getPlatformPackageSuffix();
134
+ const binPath = resolveBinary(suffix);
135
+ const result = spawnSync(binPath, ["--version"], { encoding: "utf8" });
136
+ if (result.status === 0) {
137
+ process.stdout.write(`✅ unistack installed successfully (${binPath})\n`);
138
+ }
139
+ } catch (err) {
140
+ // Non-fatal: postinstall failure should not break npm install
141
+ process.stderr.write(`âš ī¸ unistack: ${err.message}\n`);
142
+ }
143
+ } else {
144
+ // CLI invocation: forward all arguments to the native binary
145
+ try {
146
+ const suffix = getPlatformPackageSuffix();
147
+ const binPath = resolveBinary(suffix);
148
+ const args = process.argv.slice(2);
149
+
150
+ const result = spawnSync(binPath, args, {
151
+ stdio: "inherit",
152
+ windowsHide: false,
153
+ });
154
+
155
+ process.exit(result.status !== null ? result.status : 1);
156
+ } catch (err) {
157
+ process.stderr.write(`Error: ${err.message}\n`);
158
+ process.exit(1);
159
+ }
160
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@snowdreamtech/unistack",
3
+ "version": "0.0.1",
4
+ "description": "UniStack - Universal Runtime Manager: enterprise-grade foundational toolchain for multi-AI IDE collaboration",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/snowdreamtech/unistack",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/snowdreamtech/unistack.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/snowdreamtech/unistack/issues"
13
+ },
14
+ "keywords": [
15
+ "unistack",
16
+ "runtime",
17
+ "manager",
18
+ "toolchain",
19
+ "ai",
20
+ "ide"
21
+ ],
22
+ "bin": {
23
+ "unistack": "install.js"
24
+ },
25
+ "scripts": {
26
+ "postinstall": "node install.js"
27
+ },
28
+ "files": [
29
+ "install.js",
30
+ "LICENSE",
31
+ "README.md",
32
+ "README_zh-CN.md"
33
+ ],
34
+ "optionalDependencies": {
35
+ "@snowdreamtech/unistack-darwin-arm64": "0.0.1",
36
+ "@snowdreamtech/unistack-darwin-x64": "0.0.1",
37
+ "@snowdreamtech/unistack-linux-x64": "0.0.1",
38
+ "@snowdreamtech/unistack-linux-arm64": "0.0.1",
39
+ "@snowdreamtech/unistack-linux-ia32": "0.0.1",
40
+ "@snowdreamtech/unistack-linux-arm": "0.0.1",
41
+ "@snowdreamtech/unistack-linux-loong64": "0.0.1",
42
+ "@snowdreamtech/unistack-linux-ppc64le": "0.0.1",
43
+ "@snowdreamtech/unistack-linux-riscv64": "0.0.1",
44
+ "@snowdreamtech/unistack-linux-s390x": "0.0.1",
45
+ "@snowdreamtech/unistack-windows-x64": "0.0.1",
46
+ "@snowdreamtech/unistack-windows-arm64": "0.0.1",
47
+ "@snowdreamtech/unistack-windows-ia32": "0.0.1",
48
+ "@snowdreamtech/unistack-freebsd-x64": "0.0.1",
49
+ "@snowdreamtech/unistack-freebsd-arm64": "0.0.1",
50
+ "@snowdreamtech/unistack-freebsd-ia32": "0.0.1",
51
+ "@snowdreamtech/unistack-freebsd-arm": "0.0.1",
52
+ "@snowdreamtech/unistack-openbsd-x64": "0.0.1",
53
+ "@snowdreamtech/unistack-openbsd-arm64": "0.0.1",
54
+ "@snowdreamtech/unistack-netbsd-x64": "0.0.1"
55
+ },
56
+ "engines": {
57
+ "node": ">=18"
58
+ }
59
+ }