sdscc 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 +25 -0
- package/bin/sdscc +11 -0
- package/package.json +32 -0
- package/postinstall.js +126 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# sdscc
|
|
2
|
+
|
|
3
|
+
AI coding assistant - a Claude Code fork.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g sdscc
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use the curl installer:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
curl -fsSL https://raw.githubusercontent.com/sdsrss/sdscc/main/install.sh | bash
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
sdscc
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Links
|
|
24
|
+
|
|
25
|
+
- [GitHub](https://github.com/sdsrss/sdscc)
|
package/bin/sdscc
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sdscc",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "sdscc - AI coding assistant (Claude Code fork)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/sdsrss/sdscc.git"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"sdscc": "./bin/sdscc"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node postinstall.js"
|
|
15
|
+
},
|
|
16
|
+
"os": [
|
|
17
|
+
"linux",
|
|
18
|
+
"darwin"
|
|
19
|
+
],
|
|
20
|
+
"cpu": [
|
|
21
|
+
"x64",
|
|
22
|
+
"arm64"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=18"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/",
|
|
29
|
+
"postinstall.js",
|
|
30
|
+
"README.md"
|
|
31
|
+
]
|
|
32
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
const https = require('https')
|
|
4
|
+
const http = require('http')
|
|
5
|
+
const fs = require('fs')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const { execSync } = require('child_process')
|
|
8
|
+
|
|
9
|
+
const REPO = 'sdsrss/sdscc'
|
|
10
|
+
const PKG_VERSION = require('./package.json').version
|
|
11
|
+
|
|
12
|
+
const PLATFORM_MAP = {
|
|
13
|
+
'linux-x64': 'linux-x64',
|
|
14
|
+
'darwin-arm64': 'darwin-arm64',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getPlatformKey() {
|
|
18
|
+
const platform = process.platform
|
|
19
|
+
const arch = process.arch
|
|
20
|
+
return `${platform}-${arch}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function download(url) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const client = url.startsWith('https') ? https : http
|
|
26
|
+
client
|
|
27
|
+
.get(url, { headers: { 'User-Agent': 'sdscc-postinstall' } }, (res) => {
|
|
28
|
+
// Follow redirects (GitHub releases redirect to S3)
|
|
29
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
30
|
+
return download(res.headers.location).then(resolve, reject)
|
|
31
|
+
}
|
|
32
|
+
if (res.statusCode !== 200) {
|
|
33
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode} from ${url}`))
|
|
34
|
+
}
|
|
35
|
+
const chunks = []
|
|
36
|
+
res.on('data', (chunk) => chunks.push(chunk))
|
|
37
|
+
res.on('end', () => resolve(Buffer.concat(chunks)))
|
|
38
|
+
res.on('error', reject)
|
|
39
|
+
})
|
|
40
|
+
.on('error', reject)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function main() {
|
|
45
|
+
// Allow skipping postinstall (CI environments, custom binary path)
|
|
46
|
+
if (process.env.SDSCC_SKIP_POSTINSTALL === '1') {
|
|
47
|
+
console.log('[sdscc] Skipping binary download (SDSCC_SKIP_POSTINSTALL=1)')
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Allow using a pre-downloaded binary
|
|
52
|
+
if (process.env.SDSCC_BINARY_PATH) {
|
|
53
|
+
const src = process.env.SDSCC_BINARY_PATH
|
|
54
|
+
const dest = path.join(__dirname, 'bin', 'sdscc-binary')
|
|
55
|
+
fs.copyFileSync(src, dest)
|
|
56
|
+
fs.chmodSync(dest, 0o755)
|
|
57
|
+
console.log(`[sdscc] Using binary from ${src}`)
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const platformKey = getPlatformKey()
|
|
62
|
+
const target = PLATFORM_MAP[platformKey]
|
|
63
|
+
|
|
64
|
+
if (!target) {
|
|
65
|
+
console.warn(`[sdscc] Unsupported platform: ${platformKey}`)
|
|
66
|
+
console.warn('[sdscc] Supported: linux-x64, darwin-arm64')
|
|
67
|
+
console.warn('[sdscc] You can set SDSCC_BINARY_PATH to provide a binary manually.')
|
|
68
|
+
// Exit 0 to not break npm install
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const version = `v${PKG_VERSION}`
|
|
73
|
+
const tarName = `sdscc-${target}.tar.gz`
|
|
74
|
+
const url = `https://github.com/${REPO}/releases/download/${version}/${tarName}`
|
|
75
|
+
const binDir = path.join(__dirname, 'bin')
|
|
76
|
+
const tarPath = path.join(binDir, tarName)
|
|
77
|
+
const binaryPath = path.join(binDir, 'sdscc-binary')
|
|
78
|
+
|
|
79
|
+
console.log(`[sdscc] Downloading ${tarName} (${version})...`)
|
|
80
|
+
|
|
81
|
+
// Note about proxy support
|
|
82
|
+
const proxyUrl =
|
|
83
|
+
process.env.HTTPS_PROXY ||
|
|
84
|
+
process.env.https_proxy ||
|
|
85
|
+
process.env.HTTP_PROXY ||
|
|
86
|
+
process.env.http_proxy
|
|
87
|
+
if (proxyUrl) {
|
|
88
|
+
console.log(`[sdscc] Proxy detected (${proxyUrl}). If download fails, set SDSCC_BINARY_PATH to a pre-downloaded binary.`)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
const data = await download(url)
|
|
93
|
+
|
|
94
|
+
// Ensure bin directory exists
|
|
95
|
+
if (!fs.existsSync(binDir)) {
|
|
96
|
+
fs.mkdirSync(binDir, { recursive: true })
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Write tarball
|
|
100
|
+
fs.writeFileSync(tarPath, data)
|
|
101
|
+
|
|
102
|
+
// Extract binary from tarball
|
|
103
|
+
execSync(`tar -xzf "${tarPath}" -C "${binDir}"`, { stdio: 'pipe' })
|
|
104
|
+
|
|
105
|
+
// The tarball contains a file named 'sdscc', rename to 'sdscc-binary'
|
|
106
|
+
const extractedPath = path.join(binDir, 'sdscc')
|
|
107
|
+
if (fs.existsSync(extractedPath)) {
|
|
108
|
+
fs.renameSync(extractedPath, binaryPath)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
fs.chmodSync(binaryPath, 0o755)
|
|
112
|
+
|
|
113
|
+
// Clean up tarball
|
|
114
|
+
fs.unlinkSync(tarPath)
|
|
115
|
+
|
|
116
|
+
console.log(`[sdscc] Installed successfully (${version})`)
|
|
117
|
+
} catch (err) {
|
|
118
|
+
console.error(`[sdscc] Failed to download binary: ${err.message}`)
|
|
119
|
+
console.error('[sdscc] You can manually download from:')
|
|
120
|
+
console.error(`[sdscc] ${url}`)
|
|
121
|
+
console.error('[sdscc] Then set SDSCC_BINARY_PATH=/path/to/sdscc and reinstall.')
|
|
122
|
+
// Exit 0 to not break npm install
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
main()
|