sionscode 0.0.0-stage → 0.1.4
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 +21 -0
- package/README.md +75 -2
- package/bin/sions.cjs +137 -0
- package/package.json +34 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 opencode
|
|
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
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# sions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
sions는 [OpenCode](https://github.com/anomalyco/opencode)의 `dev`에서 출발한 독립 포크입니다. 터미널(TUI)과 웹에서 사용하는 오픈 소스 AI 코딩 에이전트를 개발합니다.
|
|
4
|
+
|
|
5
|
+
## 설치와 실행
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install -g sionscode
|
|
9
|
+
sions --version
|
|
10
|
+
sions
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
브라우저에서 사용하려면 `sions serve --port 4096`을 실행하고 터미널에 출력된 로컬 주소를 엽니다. 백그라운드 서비스에서 진행 중인 세션을 브라우저에서 열려면 `sions pair`를 실행합니다.
|
|
14
|
+
|
|
15
|
+
Linux·macOS·Windows의 Git Bash에서 셸 설치 스크립트도 사용할 수 있습니다.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
curl -fsSL https://raw.githubusercontent.com/mrsions/sionscode/main/install | bash
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
설치한 CLI는 `sions upgrade`로 업데이트할 수 있습니다. npm 설치를 제거하려면 `npm uninstall -g sionscode`를 실행합니다. 배포판은 사용자별 데이터·설정·캐시에 `sions` 디렉터리를 사용합니다. 프로젝트의 `opencode.json` 설정 형식과 기존 플러그인 API를 지원합니다.
|
|
22
|
+
|
|
23
|
+
## 개발 범위
|
|
24
|
+
|
|
25
|
+
- **TUI** — 터미널 인터페이스는 `packages/tui`에서, 실행 진입점은 `packages/cli`에서 관리합니다.
|
|
26
|
+
- **웹** — `packages/app`과 `packages/gui-plugins`를 중심으로 다양한 화면 구성, 작업 방식, 애드온을 구현하는 것이 목표입니다.
|
|
27
|
+
- **데스크톱** — Electron 앱은 sions 서비스 및 배포 대상에서 제외합니다. 원본에서 가져온 데스크톱 소스는 웹 기능을 이식할 때 참고할 수 있습니다.
|
|
28
|
+
|
|
29
|
+
## 로컬 실행
|
|
30
|
+
|
|
31
|
+
저장소 루트에서 [package.json](package.json)의 `packageManager`에 지정된 Bun 버전으로 의존성을 설치합니다.
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
bun install --frozen-lockfile
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
TUI를 시작하려면 다음 명령을 실행합니다. 설치한 sions의 세션을 개발 중인 TUI에서 열려면 `sions service start`로 서비스를 시작하고 `bun run dev:live`를 실행합니다.
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
bun run dev
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
웹 개발 시에는 두 터미널을 엽니다. 첫 번째 터미널에서 서버를 시작합니다.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
bun run dev serve --port 4096
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
두 번째 터미널에서 웹 앱을 시작하고, 출력된 로컬 주소를 브라우저에서 엽니다.
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
bun run dev:web
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 에이전트
|
|
56
|
+
|
|
57
|
+
TUI에서 `Tab` 키로 기본 에이전트를 전환할 수 있습니다. **build**는 코드 작성과 수정에, **plan**은 읽기 전용 분석과 코드 탐색에 사용합니다. 복잡한 검색에는 `@general` 서브 에이전트를 호출할 수 있습니다. [OpenCode 에이전트 문서](https://opencode.ai/docs/agents)
|
|
58
|
+
|
|
59
|
+
## 브랜치와 변경 기록
|
|
60
|
+
|
|
61
|
+
개발은 `main`에서 진행합니다. GitHub Actions가 **매시 정각**에 원본 `anomalyco/opencode:dev`를 포크 `base`로 동기화한 뒤 `main`에 반영합니다. 이미 최신이면 종료합니다. 기존 커밋과 포크 문서를 보존할 수 있으면 fast-forward하고, 이력이 갈라졌거나 포크 문서를 따로 보존해야 하면 병합 커밋을 만듭니다. 매시 10분에 Codex가 해당 정각 실행의 결과를 확인합니다. 성공하면 로컬 작업 폴더가 `main`에 있고 미커밋 변경과 미추적 파일이 없을 때만 `origin/main`까지 fast-forward합니다. 예약 실행은 GitHub 실행 대기열에 따라 늦어질 수 있습니다. 코드 충돌이 발생하면 실행 기록에서 파일을 확인하고 `main`에서 해결합니다. [동기화 워크플로](.github/workflows/sync-fork.yml)
|
|
62
|
+
|
|
63
|
+
| 파일 | 기록 대상 |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| [CHANGELOG.md](CHANGELOG.md) | 원본 OpenCode 릴리스 |
|
|
66
|
+
| [changes.md](changes.md) | sions `main`의 변경 사항 |
|
|
67
|
+
|
|
68
|
+
## npm 자동 배포
|
|
69
|
+
|
|
70
|
+
GitHub Actions가 10분마다 `main`을 확인합니다. 마지막 브랜치 갱신 후 10분이 지났고 해당 커밋에 npm 배포 시도 기록이 없으면 TUI와 웹이 포함된 CLI를 빌드합니다. 빌드 전에 커밋 상태 `sions/npm`을 기록하므로 빌드나 발행에 실패해도 같은 커밋을 자동으로 재시도하지 않습니다. 원인을 수정한 다음 커밋이 새 배포 대상이 됩니다.
|
|
71
|
+
|
|
72
|
+
버전은 `0.1.<워크플로 실행 번호>`입니다. Linux·macOS·Windows용 `sions-*` 바이너리 12개를 먼저 발행하고, 모든 버전이 레지스트리에 보이면 `sionscode`를 `latest`로 발행합니다.
|
|
73
|
+
|
|
74
|
+
첫 발행에는 저장소의 Actions secret `NPM_TOKEN`에 해당 이름들을 발행할 수 있는 npm 자격 증명을 설정합니다. 각 패키지에 npm Trusted Publisher를 구성한 후에는 GitHub 저장소 `mrsions/sionscode`, 워크플로 파일명 `sions-npm.yml`, 저장소 Actions 변수 `NPM_TRUSTED_PUBLISHING=true`로 토큰 없이 운영할 수 있습니다. Actions에서 수동 실행 시 기본값인 `dry_run`은 빌드·패키징·설치 검증만 수행합니다. [배포 워크플로](.github/workflows/sions-npm.yml)
|
|
75
|
+
|
|
76
|
+
[MIT 라이선스](LICENSE)
|
package/bin/sions.cjs
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const childProcess = require("child_process")
|
|
4
|
+
const fs = require("fs")
|
|
5
|
+
const path = require("path")
|
|
6
|
+
const os = require("os")
|
|
7
|
+
|
|
8
|
+
const forwardedSignals =
|
|
9
|
+
process.platform === "win32" ? ["SIGINT", "SIGTERM", "SIGHUP"] : ["SIGINT", "SIGTERM", "SIGHUP", "SIGUSR1"]
|
|
10
|
+
|
|
11
|
+
function run(target) {
|
|
12
|
+
const child = childProcess.spawn(target, process.argv.slice(2), { stdio: "inherit" })
|
|
13
|
+
child.on("error", (error) => {
|
|
14
|
+
console.error(error.message)
|
|
15
|
+
process.exit(1)
|
|
16
|
+
})
|
|
17
|
+
const forwarders = {}
|
|
18
|
+
for (const signal of forwardedSignals) {
|
|
19
|
+
forwarders[signal] = () => {
|
|
20
|
+
try {
|
|
21
|
+
child.kill(signal)
|
|
22
|
+
} catch {}
|
|
23
|
+
}
|
|
24
|
+
process.on(signal, forwarders[signal])
|
|
25
|
+
}
|
|
26
|
+
child.on("exit", (code, signal) => {
|
|
27
|
+
for (const forwardedSignal of forwardedSignals) process.removeListener(forwardedSignal, forwarders[forwardedSignal])
|
|
28
|
+
if (signal) return process.kill(process.pid, signal)
|
|
29
|
+
process.exit(typeof code === "number" ? code : 0)
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const scriptDir = path.dirname(fs.realpathSync(__filename))
|
|
34
|
+
const fork = path.basename(require.main?.filename ?? __filename) === "sions.cjs"
|
|
35
|
+
const command = fork ? "sions" : path.basename(__filename).replace(/\.cjs$/, "")
|
|
36
|
+
const envPath = fork ? process.env.SIONS_BIN_PATH : process.env.OPENCODE_BIN_PATH
|
|
37
|
+
const nodeBuild = command === "opencode-node"
|
|
38
|
+
const sourceCommand = fork ? command : nodeBuild ? "opencode2-node" : "opencode"
|
|
39
|
+
const cached = path.join(scriptDir, `.${command}`)
|
|
40
|
+
const platform = { darwin: "darwin", linux: "linux", win32: "windows" }[os.platform()] || os.platform()
|
|
41
|
+
const arch = { x64: "x64", arm64: "arm64", arm: "arm" }[os.arch()] || os.arch()
|
|
42
|
+
const packagePrefix = fork ? command : `@opencode/cli${nodeBuild ? "-node" : ""}`
|
|
43
|
+
const base = packagePrefix + "-" + platform + "-" + arch
|
|
44
|
+
const binary = platform === "windows" ? `${sourceCommand}.exe` : sourceCommand
|
|
45
|
+
|
|
46
|
+
function supportsAvx2() {
|
|
47
|
+
if (arch !== "x64") return false
|
|
48
|
+
if (platform === "linux") {
|
|
49
|
+
try {
|
|
50
|
+
return /(^|\s)avx2(\s|$)/i.test(fs.readFileSync("/proc/cpuinfo", "utf8"))
|
|
51
|
+
} catch {
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (platform === "darwin") {
|
|
56
|
+
try {
|
|
57
|
+
const result = childProcess.spawnSync("sysctl", ["-n", "hw.optional.avx2_0"], { encoding: "utf8", timeout: 1500 })
|
|
58
|
+
return result.status === 0 && (result.stdout || "").trim() === "1"
|
|
59
|
+
} catch {
|
|
60
|
+
return false
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (platform === "windows") {
|
|
64
|
+
const command =
|
|
65
|
+
'(Add-Type -MemberDefinition "[DllImport(""kernel32.dll"")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);" -Name Kernel32 -Namespace Win32 -PassThru)::IsProcessorFeaturePresent(40)'
|
|
66
|
+
for (const executable of ["powershell.exe", "pwsh.exe", "pwsh", "powershell"]) {
|
|
67
|
+
try {
|
|
68
|
+
const result = childProcess.spawnSync(executable, ["-NoProfile", "-NonInteractive", "-Command", command], {
|
|
69
|
+
encoding: "utf8",
|
|
70
|
+
timeout: 3000,
|
|
71
|
+
windowsHide: true,
|
|
72
|
+
})
|
|
73
|
+
if (result.status !== 0) continue
|
|
74
|
+
const output = (result.stdout || "").trim().toLowerCase()
|
|
75
|
+
if (output === "true" || output === "1") return true
|
|
76
|
+
if (output === "false" || output === "0") return false
|
|
77
|
+
} catch {
|
|
78
|
+
continue
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return false
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const names = (() => {
|
|
86
|
+
if (nodeBuild) return [base]
|
|
87
|
+
const baseline = arch === "x64" && !supportsAvx2()
|
|
88
|
+
if (platform === "linux") {
|
|
89
|
+
const musl = (() => {
|
|
90
|
+
try {
|
|
91
|
+
if (fs.existsSync("/etc/alpine-release")) return true
|
|
92
|
+
const result = childProcess.spawnSync("ldd", ["--version"], { encoding: "utf8" })
|
|
93
|
+
return ((result.stdout || "") + (result.stderr || "")).toLowerCase().includes("musl")
|
|
94
|
+
} catch {
|
|
95
|
+
return false
|
|
96
|
+
}
|
|
97
|
+
})()
|
|
98
|
+
if (musl)
|
|
99
|
+
return arch === "x64"
|
|
100
|
+
? baseline
|
|
101
|
+
? [`${base}-baseline-musl`, `${base}-musl`, `${base}-baseline`, base]
|
|
102
|
+
: [`${base}-musl`, `${base}-baseline-musl`, base, `${base}-baseline`]
|
|
103
|
+
: [`${base}-musl`, base]
|
|
104
|
+
return arch === "x64"
|
|
105
|
+
? baseline
|
|
106
|
+
? [`${base}-baseline`, base, `${base}-baseline-musl`, `${base}-musl`]
|
|
107
|
+
: [base, `${base}-baseline`, `${base}-musl`, `${base}-baseline-musl`]
|
|
108
|
+
: [base, `${base}-musl`]
|
|
109
|
+
}
|
|
110
|
+
return arch === "x64" ? (baseline ? [`${base}-baseline`, base] : [base, `${base}-baseline`]) : [base]
|
|
111
|
+
})()
|
|
112
|
+
|
|
113
|
+
function findBinary(startDir) {
|
|
114
|
+
let current = startDir
|
|
115
|
+
for (;;) {
|
|
116
|
+
const modules = path.join(current, "node_modules")
|
|
117
|
+
if (fs.existsSync(modules))
|
|
118
|
+
for (const name of names) {
|
|
119
|
+
const candidate = path.join(modules, name, "bin", binary)
|
|
120
|
+
if (fs.existsSync(candidate)) return candidate
|
|
121
|
+
}
|
|
122
|
+
const parent = path.dirname(current)
|
|
123
|
+
if (parent === current) return
|
|
124
|
+
current = parent
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const resolved = envPath || (fs.existsSync(cached) ? cached : findBinary(scriptDir))
|
|
129
|
+
if (!resolved) {
|
|
130
|
+
console.error(
|
|
131
|
+
`It seems that your package manager failed to install the right ${command} CLI package. Try manually installing ` +
|
|
132
|
+
names.map((name) => `"${name}"`).join(" or ") +
|
|
133
|
+
" package",
|
|
134
|
+
)
|
|
135
|
+
process.exit(1)
|
|
136
|
+
}
|
|
137
|
+
run(resolved)
|
package/package.json
CHANGED
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sionscode",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "sions TUI and web CLI",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/mrsions/sionscode.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"sions": "bin/sions.cjs"
|
|
12
|
+
},
|
|
13
|
+
"os": [
|
|
14
|
+
"linux",
|
|
15
|
+
"darwin",
|
|
16
|
+
"win32"
|
|
17
|
+
],
|
|
18
|
+
"cpu": [
|
|
19
|
+
"x64",
|
|
20
|
+
"arm64"
|
|
21
|
+
],
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"sions-linux-arm64": "0.1.4",
|
|
24
|
+
"sions-linux-x64": "0.1.4",
|
|
25
|
+
"sions-linux-x64-baseline": "0.1.4",
|
|
26
|
+
"sions-linux-arm64-musl": "0.1.4",
|
|
27
|
+
"sions-linux-x64-musl": "0.1.4",
|
|
28
|
+
"sions-linux-x64-baseline-musl": "0.1.4",
|
|
29
|
+
"sions-darwin-arm64": "0.1.4",
|
|
30
|
+
"sions-darwin-x64": "0.1.4",
|
|
31
|
+
"sions-darwin-x64-baseline": "0.1.4",
|
|
32
|
+
"sions-windows-arm64": "0.1.4",
|
|
33
|
+
"sions-windows-x64": "0.1.4",
|
|
34
|
+
"sions-windows-x64-baseline": "0.1.4"
|
|
35
|
+
}
|
|
36
|
+
}
|