@skyreve/reve 1.0.0

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
File without changes
package/Makefile ADDED
@@ -0,0 +1,83 @@
1
+ # 변수 설정
2
+ BINARY_NAME=reve
3
+ BUILD_DIR=bin
4
+ VERSION=$(shell git describe --tags --always)
5
+ GOOS=$(shell go env GOOS)
6
+ GOARCH=$(shell go env GOARCH)
7
+ LDFLAGS=-ldflags "-X main.Version=$(VERSION)"
8
+
9
+ # 환경별 ldflags (BaseURL 추가)
10
+ LDFLAGS_DEV=-ldflags "-X main.Version=$(VERSION) "
11
+ LDFLAGS_STAG=-ldflags "-X main.Version=$(VERSION) -X reve-cli/internal/constants.BaseURL=https://api.hellreve.world"
12
+ LDFLAGS_PROD=-ldflags "-X main.Version=$(VERSION) -X reve-cli/internal/constants.BaseURL=https://api.skyreve.cloud -X reve-cli/internal/constants.GitHubClientID=Iv23liCYhwlznxTEETKo"
13
+
14
+ # 기본 빌드 (현재 OS에서 dev, stag, prod 각각 빌드)
15
+ .PHONY: build build-dev build-stag build-prod
16
+
17
+ build: build-dev build-stag build-prod
18
+
19
+ build-dev:
20
+ @echo "🔨 Building $(BINARY_NAME) for $(GOOS)/$(GOARCH)..."
21
+ @mkdir -p $(BUILD_DIR)
22
+ @go build $(LDFLAGS_DEV) -o $(BUILD_DIR)/debug/$(BINARY_NAME)
23
+
24
+ build-stag:
25
+ @echo "🔨 Building $(BINARY_NAME) for $(GOOS)/$(GOARCH)..."
26
+ @mkdir -p $(BUILD_DIR)
27
+ @go build $(LDFLAGS_STAG) -o $(BUILD_DIR)/staging/$(BINARY_NAME)
28
+
29
+ build-prod:
30
+ @echo "🔨 Building $(BINARY_NAME) for $(GOOS)/$(GOARCH)..."
31
+ @mkdir -p $(BUILD_DIR)
32
+ @go build $(LDFLAGS_PROD) -o $(BUILD_DIR)/release/$(BINARY_NAME)
33
+
34
+ # 실행 (예: dev 버전 실행)
35
+ .PHONY: run
36
+ run:
37
+ @echo "🚀 Running $(BINARY_NAME) ..."
38
+ @./$(BUILD_DIR)/debug/$(BINARY_NAME)
39
+
40
+ # 테스트 실행
41
+ .PHONY: test
42
+ test:
43
+ @echo "🧪 Running tests..."
44
+ @go test ./... -cover -v
45
+
46
+ # 린트 실행
47
+ .PHONY: lint
48
+ lint:
49
+ @echo "🔍 Running linter..."
50
+ @go install golang.org/x/lint/golint@latest
51
+ @golint ./...
52
+
53
+ # 여러 플랫폼 빌드 (각 환경별, loop 없이 직접 나열)
54
+ .PHONY: build-all build-all-dev build-all-stg build-all-release
55
+
56
+ build-all: build-all-dev build-all-stg build-all-release
57
+
58
+ build-all-dev:
59
+ @echo "🔨 Building debug binaries for multiple platforms ..."
60
+ @GOOS=linux GOARCH=amd64 go build $(LDFLAGS_DEV) -o $(BUILD_DIR)/debug/linux/$(BINARY_NAME)
61
+ @GOOS=darwin GOARCH=arm64 go build $(LDFLAGS_DEV) -o $(BUILD_DIR)/debug/darwin/$(BINARY_NAME)
62
+ @GOOS=windows GOARCH=amd64 go build $(LDFLAGS_DEV) -o $(BUILD_DIR)/debug/windows/$(BINARY_NAME).exe
63
+
64
+ build-all-stg:
65
+ @echo "🔨 Building staging binaries for multiple platforms ..."
66
+ @GOOS=linux GOARCH=amd64 go build $(LDFLAGS_STAG) -o $(BUILD_DIR)/staging/linux/$(BINARY_NAME)
67
+ @GOOS=darwin GOARCH=arm64 go build $(LDFLAGS_STAG) -o $(BUILD_DIR)/staging/darwin/$(BINARY_NAME)
68
+ @GOOS=windows GOARCH=amd64 go build $(LDFLAGS_STAG) -o $(BUILD_DIR)/staging/windows/$(BINARY_NAME).exe
69
+
70
+ build-all-release:
71
+ @echo "🔨 Building release binaries for multiple platforms ..."
72
+ @GOOS=linux GOARCH=amd64 go build $(LDFLAGS_PROD) -o $(BUILD_DIR)/release/linux/$(BINARY_NAME)
73
+ @GOOS=darwin GOARCH=arm64 go build $(LDFLAGS_PROD) -o $(BUILD_DIR)/release/darwin/$(BINARY_NAME)
74
+ @GOOS=windows GOARCH=amd64 go build $(LDFLAGS_PROD) -o $(BUILD_DIR)/release/windows/$(BINARY_NAME).exe
75
+
76
+ # 정리 (빌드 결과 삭제)
77
+ .PHONY: clean
78
+ clean:
79
+ @echo "🧹 Cleaning up..."
80
+ @rm -rf $(BUILD_DIR)
81
+
82
+ # 기본 목표 (build 실행 시 dev, stag, prod 3개 빌드)
83
+ .DEFAULT_GOAL := build
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # Reve CLI - Command Line Interface
2
+
3
+ Reve CLI는 Reve 프로젝트를 위한 커맨드라인 도구입니다.
4
+ 이 문서는 Reve CLI를 설치하고 사용하는 방법을 설명합니다.
5
+
6
+ ---
7
+
8
+ ## **1. 설치 방법 (Installation)**
9
+
10
+ ### **1.1 npm을 통한 설치 (권장)**
11
+ 다른 npm 프로젝트에서 Reve CLI를 사용하려면:
12
+ ```bash
13
+ npm install @skyreve/reve
14
+ ```
15
+
16
+ 설치 후 `npx reve` 명령어로 실행할 수 있습니다:
17
+ ```bash
18
+ npx reve --help
19
+ npx reve status
20
+ npx reve init
21
+ ```
22
+
23
+ ### **1.2 글로벌 설치**
24
+ 전역적으로 설치하려면:
25
+ ```bash
26
+ npm install -g @skyreve/reve
27
+ ```
28
+
29
+ 설치 후 `reve` 명령어로 직접 실행할 수 있습니다:
30
+ ```bash
31
+ reve --help
32
+ reve status
33
+ reve init
34
+ ```
35
+
36
+ ---
37
+
38
+ ## **2. 개발 환경 설정 (Development Setup)**
39
+
40
+ ### **1.1 Go 설치**
41
+ Reve CLI는 **Go**를 필요로 합니다. Go가 설치되지 않았다면 아래 명령어로 설치하세요:
42
+ ```bash
43
+ brew install go
44
+ ```
45
+
46
+ ### **1.2 프로젝트 초기화**
47
+ 프로젝트를 클론하고 의존성을 설치합니다:
48
+ ```bash
49
+ git clone git@github.com:SkyReve/reve-cli.git
50
+ cd reve-cli
51
+ go mod tidy
52
+ ```
53
+
54
+ ---
55
+
56
+ ## **2. 빌드 (Build)**
57
+
58
+ ### **2.1 npm 스크립트를 통한 빌드 (권장)**
59
+ npm을 통해 다양한 환경별로 빌드할 수 있습니다:
60
+
61
+ #### **개발 환경 빌드**
62
+ ```bash
63
+ npm run build-dev
64
+ ```
65
+
66
+ #### **스테이징 환경 빌드**
67
+ ```bash
68
+ npm run build-staging
69
+ ```
70
+
71
+ #### **운영 환경 빌드**
72
+ ```bash
73
+ npm run build
74
+ ```
75
+
76
+ #### **정리**
77
+ ```bash
78
+ npm run clean
79
+ ```
80
+
81
+ ### **2.2 Makefile을 통한 빌드**
82
+
83
+ #### **현재 OS에서 환경별 바이너리 빌드**
84
+ 현재 OS에서 **개발(debug), 스테이징(staging), 운영(release)** 환경별로 바이너리를 생성하려면:
85
+ ```bash
86
+ make
87
+ ```
88
+ 또는 개별 환경별로:
89
+ ```bash
90
+ make build-dev # 개발 환경
91
+ make build-stag # 스테이징 환경
92
+ make build-prod # 운영 환경
93
+ ```
94
+
95
+ 빌드가 완료되면, `bin/` 디렉토리에 아래 구조로 파일들이 생성됩니다:
96
+ ```bash
97
+ bin/
98
+ ├── debug/reve
99
+ ├── staging/reve
100
+ └── release/reve
101
+ ```
102
+
103
+ #### **모든 OS(Linux, macOS, Windows)용 바이너리 빌드**
104
+ ```bash
105
+ make build-all
106
+ ```
107
+ 또는 개별 환경별로:
108
+ ```bash
109
+ make build-all-dev # 개발 환경 (모든 OS)
110
+ make build-all-stg # 스테이징 환경 (모든 OS)
111
+ make build-all-release # 운영 환경 (모든 OS)
112
+ ```
113
+
114
+ 모든 OS에 대한 바이너리를 빌드하면 아래와 같은 구조로 파일이 생성됩니다:
115
+ ```bash
116
+ bin/
117
+ ├── debug/
118
+ │ ├── linux/reve
119
+ │ ├── darwin/reve
120
+ │ └── windows/reve.exe
121
+ ├── staging/
122
+ │ ├── linux/reve
123
+ │ ├── darwin/reve
124
+ │ └── windows/reve.exe
125
+ └── release/
126
+ ├── linux/reve
127
+ ├── darwin/reve
128
+ └── windows/reve.exe
129
+ ```
130
+
131
+ ### **2.3 빌드된 바이너리 확인**
132
+ 빌드된 바이너리는 `bin/` 디렉토리에 저장됩니다. 확인하려면:
133
+ ```bash
134
+ ls -la bin/
135
+ # 또는
136
+ tree bin/
137
+ ```
138
+
139
+ ---
140
+
141
+ ## **3. 환경별 바이너리 설명**
142
+ Reve CLI는 환경별로 다른 API 서버를 사용하도록 빌드됩니다.
143
+
144
+ ### **🔹 debug 환경 (개발)**
145
+ - **바이너리 경로:** `bin/debug/reve` (단일 OS) 또는 `bin/debug/{os}/reve` (모든 OS)
146
+ - **BaseURL:** `http://127.0.0.1:8000` (기본값)
147
+ - **설명:** 개발 환경용 바이너리입니다. 새로운 기능을 테스트하고 디버깅할 때 사용합니다.
148
+
149
+ ### **🔹 staging 환경 (스테이징)**
150
+ - **바이너리 경로:** `bin/staging/reve` (단일 OS) 또는 `bin/staging/{os}/reve` (모든 OS)
151
+ - **BaseURL:** `https://api.hellreve.world`
152
+ - **설명:** 스테이징 환경용 바이너리입니다. 운영 환경과 유사한 조건에서 최종 QA 및 검증에 사용됩니다.
153
+
154
+ ### **🔹 release 환경 (운영)**
155
+ - **바이너리 경로:** `bin/release/reve` (단일 OS) 또는 `bin/release/{os}/reve` (모든 OS)
156
+ - **BaseURL:** `https://api.skyreve.cloud`
157
+ - **GitHub Client ID:** `Iv23liCYhwlznxTEETKo`
158
+ - **설명:** 운영(프로덕션) 환경용 바이너리입니다. 실제 사용자에게 제공되는 서비스 환경에서 사용됩니다.
159
+
160
+ ---
161
+
162
+ ## **4. Reve CLI 사용법 (Using `reve`)**
163
+
164
+ ### **4.1 npm을 통한 실행 (권장)**
165
+ npm으로 설치한 경우:
166
+ ```bash
167
+ npx reve [COMMAND] [OPTIONS]
168
+ # 또는 글로벌 설치한 경우
169
+ reve [COMMAND] [OPTIONS]
170
+ ```
171
+
172
+ ### **4.2 바이너리 직접 실행**
173
+ 빌드된 바이너리를 직접 실행하는 경우:
174
+ ```bash
175
+ # 개발 환경
176
+ ./bin/debug/reve [COMMAND] [OPTIONS]
177
+
178
+ # 스테이징 환경
179
+ ./bin/staging/reve [COMMAND] [OPTIONS]
180
+
181
+ # 운영 환경
182
+ ./bin/release/reve [COMMAND] [OPTIONS]
183
+ ```
184
+
185
+ ### **4.3 도움말 확인**
186
+ ```bash
187
+ reve --help
188
+ # 또는
189
+ npx reve --help
190
+ ```
191
+
192
+ ### **4.4 주요 명령어**
193
+ | 명령어 | 설명 |
194
+ |--------|------|
195
+ | `reve init` | SkyReve 프로젝트 초기화 |
196
+ | `reve sync` | 원격 데이터와 동기화 |
197
+ | `reve status` | 프로젝트 상태 확인 |
198
+ | `reve deploy` | 프로젝트 배포 |
199
+ | `reve switch` | 프로젝트 및 브랜치 전환 |
200
+ | `reve github-init` | GitHub 연동 초기화 |
201
+ | `reve github-link` | GitHub 저장소 연결 |
202
+ | `reve github-unlink` | GitHub 저장소 연결 해제 |
203
+
204
+ ---
205
+
206
+ ## **5. 기타 (Additional Information)**
207
+
208
+ ### **5.1 실행 방법**
209
+ 빌드된 바이너리를 실행하려면:
210
+ ```bash
211
+ # 개발 환경
212
+ ./bin/debug/reve --help
213
+
214
+ # 스테이징 환경
215
+ ./bin/staging/reve --help
216
+
217
+ # 운영 환경
218
+ ./bin/release/reve --help
219
+ ```
220
+
221
+ ### **5.2 정리 (Clean)**
222
+ 불필요한 빌드 파일을 정리하려면:
223
+ ```bash
224
+ # npm 스크립트 사용
225
+ npm run clean
226
+
227
+ # 또는 Makefile 사용
228
+ make clean
229
+ ```
230
+
231
+ ### **5.3 테스트 및 린트**
232
+ ```bash
233
+ # 테스트 실행
234
+ make test
235
+
236
+ # 린트 실행
237
+ make lint
238
+ ```
239
+
240
+ ### **5.4 개발 모드 실행**
241
+ 개발 중 빠른 테스트를 위해:
242
+ ```bash
243
+ make run
244
+ ```
245
+
246
+ ---
247
+
248
+ ### **🛠 이제 SkyReve CLI를 사용할 준비가 완료되었습니다! 🚀**
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@skyreve/reve",
3
+ "version": "1.0.0",
4
+ "description": "Reve CLI - A command line tool for Reve platform",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "reve": "node scripts/reve.js",
8
+ "build": "make build-all-release",
9
+ "build-dev": "make build-all-dev",
10
+ "build-staging": "make build-all-stg",
11
+ "clean": "make clean"
12
+ },
13
+ "bin": {
14
+ "reve": "./scripts/reve.js"
15
+ },
16
+ "os": [
17
+ "darwin",
18
+ "linux",
19
+ "win32"
20
+ ],
21
+ "cpu": [
22
+ "x64",
23
+ "arm64"
24
+ ],
25
+ "engines": {
26
+ "node": ">=14.0.0"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/skyreve/reve-cli.git"
31
+ },
32
+ "keywords": [
33
+ "cli",
34
+ "reve",
35
+ "command-line",
36
+ "tool"
37
+ ],
38
+ "author": "SkyReve",
39
+ "license": "MIT",
40
+ "files": [
41
+ "bin/",
42
+ "scripts/",
43
+ "README.md",
44
+ "LICENSE",
45
+ "Makefile"
46
+ ],
47
+ "preferGlobal": true
48
+ }
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+ const os = require('os');
7
+
8
+ // OS별 바이너리 경로 결정
9
+ const getBinaryPath = () => {
10
+ const platform = os.platform();
11
+ const arch = os.arch();
12
+
13
+ // 플랫폼별 디렉토리 매핑
14
+ const platformMap = {
15
+ 'darwin': 'darwin',
16
+ 'linux': 'linux',
17
+ 'win32': 'windows'
18
+ };
19
+
20
+ const platformDir = platformMap[platform] || 'linux';
21
+ const binDir = path.join(__dirname, '..', 'bin', 'release', platformDir);
22
+
23
+ // Windows의 경우 .exe 확장자 추가
24
+ const binaryName = platform === 'win32' ? 'reve.exe' : 'reve';
25
+ const binaryPath = path.join(binDir, binaryName);
26
+
27
+ return binaryPath;
28
+ };
29
+
30
+ // 바이너리 존재 확인
31
+ const checkBinaryExists = (binaryPath) => {
32
+ try {
33
+ return fs.existsSync(binaryPath);
34
+ } catch (error) {
35
+ return false;
36
+ }
37
+ };
38
+
39
+ // 바이너리 실행
40
+ const runBinary = (binaryPath, args) => {
41
+ const options = {
42
+ stdio: 'inherit',
43
+ cwd: process.cwd()
44
+ };
45
+
46
+ const child = spawn(binaryPath, args, options);
47
+
48
+ child.on('error', (error) => {
49
+ console.error(`❌ Reve binary execution error: ${error.message}`);
50
+ process.exit(1);
51
+ });
52
+
53
+ child.on('exit', (code) => {
54
+ process.exit(code);
55
+ });
56
+ };
57
+
58
+ // 메인 실행 함수
59
+ const main = () => {
60
+ const binaryPath = getBinaryPath();
61
+
62
+ // 바이너리 존재 확인
63
+ if (!checkBinaryExists(binaryPath)) {
64
+ console.error(`❌ Reve binary not found: ${binaryPath}`);
65
+ console.error('Please run build first: npm run build');
66
+ process.exit(1);
67
+ }
68
+
69
+ // 명령행 인수 전달 (node와 스크립트 이름 제외)
70
+ const args = process.argv.slice(2);
71
+
72
+ // 바이너리 실행
73
+ runBinary(binaryPath, args);
74
+ };
75
+
76
+ // 스크립트가 직접 실행된 경우에만 실행
77
+ if (require.main === module) {
78
+ main();
79
+ }
80
+
81
+ module.exports = { getBinaryPath, checkBinaryExists, runBinary };