首次提交

This commit is contained in:
zeronline
2026-06-25 08:39:47 +08:00
parent 20a93c703a
commit c5cccd346b
169 changed files with 24720 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
# 寸进后端打包部署脚本
# 用法: .\scripts\build-backend.ps1 [platform]
# platform: windows (默认) | linux | all
param([string]$Platform = "windows")
$root = Split-Path -Parent $PSScriptRoot
$serverDir = Join-Path $root "server"
$outputDir = Join-Path $root "build"
$version = "1.0.0"
$commit = git -C $root rev-parse --short HEAD 2>$null
if (-not $commit) { $commit = "dev" }
$ldflags = "-s -w -X main.version=$version -X main.commit=$commit"
function Build-Platform {
param([string]$GOOS, [string]$GOARCH, [string]$suffix)
$outName = "inchstep-api$suffix"
$outPath = Join-Path $outputDir $outName
Write-Host "Building for $GOOS/$GOARCH ..." -ForegroundColor Cyan
$env:GOOS = $GOOS
$env:GOARCH = $GOARCH
$env:CGO_ENABLED = 0
Push-Location $serverDir
$result = & go build -buildvcs=false -ldflags $ldflags -o $outPath ./cmd/api 2>&1
Pop-Location
if ($LASTEXITCODE -eq 0) {
$size = (Get-Item $outPath).Length / 1KB
Write-Host " OK: $outPath ($([math]::Round($size, 1)) KB)" -ForegroundColor Green
} else {
Write-Host " FAIL: $result" -ForegroundColor Red
}
}
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
switch ($Platform) {
"windows" { Build-Platform "windows" "amd64" ".exe" }
"linux" { Build-Platform "linux" "amd64" "" }
"all" {
Build-Platform "windows" "amd64" ".exe"
Build-Platform "linux" "amd64" ""
Build-Platform "linux" "arm64" "-arm64"
}
default { Build-Platform "windows" "amd64" ".exe" }
}
Write-Host "Build complete. Output directory: $outputDir" -ForegroundColor Green
+26
View File
@@ -0,0 +1,26 @@
$root = Split-Path -Parent $PSScriptRoot
$webDir = Join-Path $root "web"
$outputDir = Join-Path $root "build"
$deployDir = Join-Path $root "deploy"
Write-Host "Building Web frontend..." -ForegroundColor Cyan
Push-Location $webDir
& "pnpm" build 2>&1 | Select-String -NotMatch "pnpm"
$buildOk = $LASTEXITCODE
Pop-Location
if ($buildOk -ne 0) { exit 1 }
Write-Host "Packaging..." -ForegroundColor Cyan
Remove-Item -Recurse -Force "$deployDir\.next" -ErrorAction SilentlyContinue
Copy-Item -Recurse "$webDir\.next\*" "$deployDir\.next\" -Exclude "cache"
Copy-Item -Recurse "$webDir\public\*" "$deployDir\public\" -ErrorAction SilentlyContinue
Copy-Item "$webDir\package.json" "$deployDir\"
Copy-Item "$webDir\next.config.ts" "$deployDir\"
Copy-Item "$webDir\pnpm-lock.yaml" "$deployDir\"
$zipPath = "$outputDir\inchstep-web-deploy.zip"
Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
Compress-Archive -Path "$deployDir\*" -DestinationPath $zipPath
$size = (Get-Item $zipPath).Length / 1MB
Write-Host "OK: build/inchstep-web-deploy.zip ($([math]::Round($size,1)) MB)" -ForegroundColor Green
+38
View File
@@ -0,0 +1,38 @@
# 寸进(InchStep)项目技能注册脚本
# 将 project/skills/ 下的技能注册到 Codex 可识别的路径
# 用法: powershell -ExecutionPolicy Bypass .\scripts\setup-skills.ps1
$CODEX_SKILLS = "$env:USERPROFILE\.codex\skills"
$PROJECT_SKILLS = "$PSScriptRoot\..\skills"
if (-not (Test-Path $CODEX_SKILLS)) {
New-Item -Path $CODEX_SKILLS -ItemType Directory -Force | Out-Null
}
Get-ChildItem $PROJECT_SKILLS -Directory | ForEach-Object {
$skillName = $_.Name
$globalPath = Join-Path $CODEX_SKILLS $skillName
$projectPath = $_.FullName
if (Test-Path $globalPath) {
# 检查是否已经是 junctions
if ((Get-Item $globalPath).LinkType -eq 'Junction') {
Write-Host "[SKIP] $skillName - 已是 junction 链接"
return
}
# 备份后删除
$backup = "$globalPath.bak"
if (-not (Test-Path $backup)) {
Rename-Item $globalPath $backup
Write-Host "[BACKUP] $skillName -> $backup"
}
Remove-Item $globalPath -Recurse -Force -ErrorAction SilentlyContinue
}
# 创建 junction(目录符号链接)
New-Item -Path $globalPath -ItemType Junction -Target $projectPath -Force | Out-Null
Write-Host "[LINK] $skillName -> $projectPath"
}
Write-Host "`n技能注册完成。重启 Codex 后生效。"
Write-Host "提示: 编辑 project/skills/ 下的文件会同步反映到 Codex。"