Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go install github.com/DarkInno/scion/cmd/scion@latest
For reproducible installs, pin a release:

```bash
go install github.com/DarkInno/scion/cmd/scion@v0.1.2
go install github.com/DarkInno/scion/cmd/scion@v0.1.3
```

Make sure your Go bin directory is on `PATH`, then verify the install:
Expand All @@ -30,15 +30,17 @@ scion list
Copy a standard-library-only module into your project:

```bash
scion add cache --to internal/cache --dry-run
scion add cache --to internal/cache
scion diff cache --target internal/cache
scion add cache --dry-run
scion add cache
scion diff cache
```

When `--to` or `--target` is omitted, Scion uses the module's default target, such as `internal/cache`. You can still override it with `--to <dir>` or `--target <dir>`.

Scion copies source files and writes `.scion-module.json` metadata for later comparison. It never edits your project's `go.mod` automatically. Modules marked `stdlibOnly=false`, such as `auth`, require explicit standalone mode:

```bash
scion add auth --standalone --to internal/auth
scion add auth --standalone
```

## Binary Downloads
Expand All @@ -54,7 +56,7 @@ sha256sum -c SHA256SUMS
On Windows PowerShell:

```powershell
Get-FileHash .\scion_v0.1.2_windows_amd64.zip -Algorithm SHA256
Get-FileHash .\scion_v0.1.3_windows_amd64.zip -Algorithm SHA256
```

## Why Copy-Paste?
Expand Down Expand Up @@ -87,12 +89,14 @@ Backend modules such as auth, CRUD, file upload, and rate limiting share most of
```bash
scion list [--json]
scion info <module> [--json]
scion add <module> --to <dir> [--dry-run] [--force] [--standalone]
scion diff <module> --target <dir> [--json]
scion add <module> [--to <dir>] [--dry-run] [--force] [--standalone]
scion diff <module> [--target <dir>] [--json]
scion doctor [--strict] [--json]
scion version [--json]
```

Use `scion help <command>` for command-specific examples.

## Project Structure

```text
Expand Down Expand Up @@ -148,8 +152,8 @@ foreach ($m in $modules) { Push-Location "registry/$m/src/go"; go test ./...; Po
Releases are created from semantic version tags:

```bash
git tag -a v0.1.2 -m "v0.1.2"
git push origin v0.1.2
git tag -a v0.1.3 -m "v0.1.3"
git push origin v0.1.3
```

The release workflow verifies the CLI, rebuilds the embedded bundle check, cross-compiles binaries, generates `SHA256SUMS`, and publishes GitHub Release assets.
Expand Down
24 changes: 14 additions & 10 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go install github.com/DarkInno/scion/cmd/scion@latest
如果需要固定版本:

```bash
go install github.com/DarkInno/scion/cmd/scion@v0.1.2
go install github.com/DarkInno/scion/cmd/scion@v0.1.3
```

确认 Go bin 目录已加入 `PATH`,然后验证安装:
Expand All @@ -30,15 +30,17 @@ scion list
复制一个仅使用标准库的模块:

```bash
scion add cache --to internal/cache --dry-run
scion add cache --to internal/cache
scion diff cache --target internal/cache
scion add cache --dry-run
scion add cache
scion diff cache
```

省略 `--to` 或 `--target` 时,Scion 会使用模块的默认目标目录,例如 `internal/cache`。你仍然可以用 `--to <dir>` 或 `--target <dir>` 覆盖。

Scion CLI 会复制源码,并写入 `.scion-module.json` 供后续对比使用。它不会自动修改你的 `go.mod`。标记为 `stdlibOnly=false` 的模块,例如 `auth`,需要显式使用 standalone 模式:

```bash
scion add auth --standalone --to internal/auth
scion add auth --standalone
```

## 二进制下载
Expand All @@ -54,7 +56,7 @@ sha256sum -c SHA256SUMS
Windows PowerShell:

```powershell
Get-FileHash .\scion_v0.1.2_windows_amd64.zip -Algorithm SHA256
Get-FileHash .\scion_v0.1.3_windows_amd64.zip -Algorithm SHA256
```

## 为什么是复制粘贴?
Expand Down Expand Up @@ -87,12 +89,14 @@ Get-FileHash .\scion_v0.1.2_windows_amd64.zip -Algorithm SHA256
```bash
scion list [--json]
scion info <module> [--json]
scion add <module> --to <dir> [--dry-run] [--force] [--standalone]
scion diff <module> --target <dir> [--json]
scion add <module> [--to <dir>] [--dry-run] [--force] [--standalone]
scion diff <module> [--target <dir>] [--json]
scion doctor [--strict] [--json]
scion version [--json]
```

使用 `scion help <command>` 查看某个命令的示例和选项。

## 项目结构

```text
Expand Down Expand Up @@ -148,8 +152,8 @@ foreach ($m in $modules) { Push-Location "registry/$m/src/go"; go test ./...; Po
通过语义化版本 tag 发布:

```bash
git tag -a v0.1.2 -m "v0.1.2"
git push origin v0.1.2
git tag -a v0.1.3 -m "v0.1.3"
git push origin v0.1.3
```

Release workflow 会验证 CLI、检查内置 bundle、交叉编译二进制、生成 `SHA256SUMS`,并发布 GitHub Release 资产。
Expand Down
16 changes: 9 additions & 7 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ go install github.com/DarkInno/scion/cmd/scion@latest
For reproducible installs, pin a release:

```bash
go install github.com/DarkInno/scion/cmd/scion@v0.1.2
go install github.com/DarkInno/scion/cmd/scion@v0.1.3
```

Make sure your Go bin directory is on `PATH`, then verify the install:
Expand All @@ -37,33 +37,35 @@ Modules marked `stdlibOnly=true` can be copied directly into an existing project
Preview the files first:

```bash
scion add cache --to internal/cache --dry-run
scion add cache --dry-run
```

Copy the module:

```bash
scion add cache --to internal/cache
scion add cache
```

Scion uses the module's default target when `--to` is omitted, such as `internal/cache` for `cache`. You can override it with `--to <dir>`.

Scion writes `.scion-module.json` metadata in the target directory. This file records the copied module, registry version, source hashes, and whether standalone mode was used.

## 4. Compare Later

After you adapt the copied source, you can compare it against Scion's embedded template:

```bash
scion diff cache --target internal/cache
scion diff cache
```

`diff` only reports differences. It never merges or overwrites your local changes.
`diff` uses the module's default target when `--target` is omitted. It only reports differences and never merges or overwrites your local changes.

## Standalone Modules

The `auth` module intentionally uses mature security dependencies for JWT and bcrypt. Copy it with standalone mode:

```bash
scion add auth --standalone --to internal/auth
scion add auth --standalone
```

Scion still does not edit your project-level `go.mod`; standalone mode only copies the module's own `go.mod` and `go.sum` into the target.
Expand All @@ -81,7 +83,7 @@ sha256sum -c SHA256SUMS
Windows PowerShell:

```powershell
Get-FileHash .\scion_v0.1.2_windows_amd64.zip -Algorithm SHA256
Get-FileHash .\scion_v0.1.3_windows_amd64.zip -Algorithm SHA256
```

## Manual Copy
Expand Down
16 changes: 9 additions & 7 deletions docs/zh/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ go install github.com/DarkInno/scion/cmd/scion@latest
如果需要固定版本:

```bash
go install github.com/DarkInno/scion/cmd/scion@v0.1.2
go install github.com/DarkInno/scion/cmd/scion@v0.1.3
```

确认 Go bin 目录已加入 `PATH`,然后验证安装:
Expand All @@ -37,33 +37,35 @@ scion info cache
先预览将要复制的文件:

```bash
scion add cache --to internal/cache --dry-run
scion add cache --dry-run
```

执行复制:

```bash
scion add cache --to internal/cache
scion add cache
```

省略 `--to` 时,Scion 会使用模块默认目标目录,例如 `cache` 的默认目标是 `internal/cache`。你可以用 `--to <dir>` 覆盖。

Scion 会在目标目录写入 `.scion-module.json`。这个文件记录模块名、registry 版本、源文件 hash,以及是否使用 standalone 模式。

## 4. 后续对比

当你改造过复制进项目的源码后,可以和 Scion 内置模板对比:

```bash
scion diff cache --target internal/cache
scion diff cache
```

`diff` 只报告差异,不会自动合并,也不会覆盖你的本地改动。
省略 `--target` 时,`diff` 会使用模块默认目标目录。它只报告差异,不会自动合并,也不会覆盖你的本地改动。

## Standalone 模块

`auth` 模块为了 JWT 和 bcrypt 使用了成熟安全依赖。复制它时需要 standalone 模式:

```bash
scion add auth --standalone --to internal/auth
scion add auth --standalone
```

Scion 仍然不会修改你的项目级 `go.mod`;standalone 模式只会把该模块自己的 `go.mod` 和 `go.sum` 复制到目标目录。
Expand All @@ -81,7 +83,7 @@ sha256sum -c SHA256SUMS
Windows PowerShell:

```powershell
Get-FileHash .\scion_v0.1.2_windows_amd64.zip -Algorithm SHA256
Get-FileHash .\scion_v0.1.3_windows_amd64.zip -Algorithm SHA256
```

## 手动复制
Expand Down
Loading
Loading