refactor: 项目更名 WeKnora → Academy
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名) - 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块) - docreader proto 描述符采用等长替换,保持序列化字节布局有效 - Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像 - 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
This commit is contained in:
1 parent
9097ee699d
commit
9058149576
3136 files changed
+18018
-18004
No files matched your search
+25
-25
@@ -1,4 +1,4 @@
|
||||
// Package doctor implements `weknora doctor` - 4-item self-check.
|
||||
// Package doctor implements `academy doctor` - 4-item self-check.
|
||||
//
|
||||
// Status semantics (4-tier):
|
||||
//
|
||||
@@ -29,13 +29,13 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/build"
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/compat"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/build"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/compat"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// doctorFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -94,7 +94,7 @@ type Services interface {
|
||||
GetSystemInfo(ctx context.Context) (*sdk.SystemInfo, error)
|
||||
}
|
||||
|
||||
// NewCmd builds `weknora doctor`.
|
||||
// NewCmd builds `academy doctor`.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
opts := &Options{}
|
||||
cmd := &cobra.Command{
|
||||
@@ -124,15 +124,15 @@ func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolVar(&opts.NoCache, "no-cache", false, "Bypass server-info cache (located at $XDG_CACHE_HOME/weknora/server-info.yaml); force re-probe")
|
||||
cmd.Flags().BoolVar(&opts.NoCache, "no-cache", false, "Bypass server-info cache (located at $XDG_CACHE_HOME/academy/server-info.yaml); force re-probe")
|
||||
cmd.Flags().BoolVar(&opts.Offline, "offline", false, "Skip network checks; only verify local keyring/file storage (credential_storage check still runs)")
|
||||
cmdutil.AddFormatFlag(cmd, doctorFields...)
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "run self-checks: base-url reachability, auth credential, server version, credential storage",
|
||||
Examples: []string{
|
||||
"weknora doctor",
|
||||
"weknora doctor --offline",
|
||||
"weknora doctor --no-cache --format json",
|
||||
"academy doctor",
|
||||
"academy doctor --offline",
|
||||
"academy doctor --no-cache --format json",
|
||||
},
|
||||
Output: "envelope.data is {summary:{all_passed,passed,warned,failed,skipped}, checks:[{name,status,details,hint?}]}",
|
||||
})
|
||||
@@ -175,7 +175,7 @@ func runChecks(ctx context.Context, opts *Options, svc Services, cliVer string)
|
||||
t0 := time.Now()
|
||||
if err := svc.PingBaseURL(ctx); err != nil {
|
||||
checks[0].Status = StatusFail
|
||||
checks[0].Hint = "verify the host configured for the active profile (run `weknora profile list` / `weknora profile add <n> --host=...`) and network reachability"
|
||||
checks[0].Hint = "verify the host configured for the active profile (run `academy profile list` / `academy profile add <n> --host=...`) and network reachability"
|
||||
checks[0].Details = err.Error()
|
||||
} else {
|
||||
checks[0].Status = StatusOK
|
||||
@@ -187,7 +187,7 @@ func runChecks(ctx context.Context, opts *Options, svc Services, cliVer string)
|
||||
if !cascade(&checks[1], opts.Offline, &checks[0]) {
|
||||
if _, err := svc.GetCurrentUser(ctx); err != nil {
|
||||
checks[1].Status = StatusFail
|
||||
checks[1].Hint = "run `weknora auth login`"
|
||||
checks[1].Hint = "run `academy auth login`"
|
||||
checks[1].Details = err.Error()
|
||||
} else {
|
||||
checks[1].Status = StatusOK
|
||||
@@ -297,7 +297,7 @@ func fillCredentialStorageCheck(c *Check) {
|
||||
if _, isFile := store.(*secrets.FileStore); isFile {
|
||||
c.Status = StatusWarn
|
||||
c.Details = "falling back to file store: keychain unavailable"
|
||||
c.Hint = "secrets persist at 0600 under $XDG_CONFIG_HOME/weknora/secrets/; install / unlock keyring for OS-backed storage"
|
||||
c.Hint = "secrets persist at 0600 under $XDG_CONFIG_HOME/academy/secrets/; install / unlock keyring for OS-backed storage"
|
||||
return
|
||||
}
|
||||
c.Status = StatusOK
|
||||
@@ -389,7 +389,7 @@ func marker(s Status) string {
|
||||
//
|
||||
// Critically: this does NOT pre-resolve f.Client(). doctor's package promise
|
||||
// (top comment) is that credential_storage runs even when no auth is set up -
|
||||
// e.g. first-time `weknora doctor` to diagnose setup. Pre-resolving Client
|
||||
// e.g. first-time `academy doctor` to diagnose setup. Pre-resolving Client
|
||||
// here would early-exit with auth.unauthenticated before any check runs,
|
||||
// contradicting the docs. Instead, GetCurrentUser / GetSystemInfo lazily
|
||||
// resolve and surface their own failure as a per-check StatusFail.
|
||||
@@ -405,12 +405,12 @@ func buildServices(f *cmdutil.Factory) (Services, error) {
|
||||
// mirror the client builder (buildClientFromEnv) so doctor probes the host the
|
||||
// real commands actually connect to; tier 1 is a doctor-local test/dev knob:
|
||||
//
|
||||
// 1. WEKNORA_BASE_URL — doctor-only probe override (used by tests); NOT read
|
||||
// 1. ACADEMY_BASE_URL — doctor-only probe override (used by tests); NOT read
|
||||
// by the client builder, so setting it points doctor at a host no real
|
||||
// command uses. Kept for test/dev harnesses; leave unset in normal use.
|
||||
// 2. WEKNORA_HOST — when stateless env credentials (WEKNORA_TOKEN /
|
||||
// WEKNORA_API_KEY) are in effect, i.e. the headless agent path. Without
|
||||
// this, `WEKNORA_API_KEY=… WEKNORA_HOST=… weknora doctor` falsely reported
|
||||
// 2. ACADEMY_HOST — when stateless env credentials (ACADEMY_TOKEN /
|
||||
// ACADEMY_API_KEY) are in effect, i.e. the headless agent path. Without
|
||||
// this, `ACADEMY_API_KEY=… ACADEMY_HOST=… academy doctor` falsely reported
|
||||
// "no host configured" and exited 1 while every other command worked.
|
||||
// 3. active profile host — the configured default.
|
||||
func resolveDoctorHost(cfg *config.Config) string {
|
||||
@@ -418,15 +418,15 @@ func resolveDoctorHost(cfg *config.Config) string {
|
||||
if ctx, ok := cfg.Profiles[cfg.CurrentProfile]; ok {
|
||||
host = ctx.Host
|
||||
}
|
||||
// Env credentials authenticate via WEKNORA_HOST, bypassing the profile.
|
||||
// Env credentials authenticate via ACADEMY_HOST, bypassing the profile.
|
||||
// Honor it only when such creds are actually set, matching the client
|
||||
// builder (a bare WEKNORA_HOST without creds is ignored there too).
|
||||
// builder (a bare ACADEMY_HOST without creds is ignored there too).
|
||||
if envActive, _ := cmdutil.EnvCredential(); envActive {
|
||||
if v := strings.TrimSpace(os.Getenv("WEKNORA_HOST")); v != "" {
|
||||
if v := strings.TrimSpace(os.Getenv("ACADEMY_HOST")); v != "" {
|
||||
host = v
|
||||
}
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_BASE_URL"); v != "" {
|
||||
if v := os.Getenv("ACADEMY_BASE_URL"); v != "" {
|
||||
host = v
|
||||
}
|
||||
return host
|
||||
|
||||
@@ -8,12 +8,12 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/compat"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/compat"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/secrets"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
// withCredStoreFactory swaps the package-level credStoreFactory hook for the
|
||||
@@ -173,7 +173,7 @@ func TestDoctor_CacheHit_SkipsProbe(t *testing.T) {
|
||||
// TestDoctor_NoConfig_StillRunsCredentialStorage guards the package-doc
|
||||
// promise that credential_storage runs even with zero configuration. Round-4
|
||||
// reviewer surfaced that buildServices used to abort on f.Client() failure,
|
||||
// silently violating the doc for any first-time user running `weknora doctor`
|
||||
// silently violating the doc for any first-time user running `academy doctor`
|
||||
// to diagnose setup. The lazy-resolve fix means missing auth surfaces as
|
||||
// auth_credential=fail, not a top-level command exit.
|
||||
func TestDoctor_NoConfig_StillRunsCredentialStorage(t *testing.T) {
|
||||
@@ -510,10 +510,10 @@ func TestDoctor_RunE_WarnReturnsNil(t *testing.T) {
|
||||
}
|
||||
|
||||
// TestResolveDoctorHost_EnvCredentials - doctor's base_url probe must honor
|
||||
// WEKNORA_HOST when stateless env credentials are in effect (the headless
|
||||
// ACADEMY_HOST when stateless env credentials are in effect (the headless
|
||||
// agent path), mirroring buildClientFromEnv. Regression: doctor previously
|
||||
// read only the active profile host, so `WEKNORA_API_KEY=... WEKNORA_HOST=...
|
||||
// weknora doctor` reported "no host configured" and exited 1 while every
|
||||
// read only the active profile host, so `ACADEMY_API_KEY=... ACADEMY_HOST=...
|
||||
// academy doctor` reported "no host configured" and exited 1 while every
|
||||
// other command worked.
|
||||
func TestResolveDoctorHost_EnvCredentials(t *testing.T) {
|
||||
cfg := &config.Config{
|
||||
@@ -521,39 +521,39 @@ func TestResolveDoctorHost_EnvCredentials(t *testing.T) {
|
||||
Profiles: map[string]config.Profile{"prod": {Host: "https://profile-host"}},
|
||||
}
|
||||
|
||||
t.Run("env creds + WEKNORA_HOST wins over profile", func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_TOKEN", "")
|
||||
t.Setenv("WEKNORA_API_KEY", "sk-test")
|
||||
t.Setenv("WEKNORA_HOST", "https://env-host:8080")
|
||||
t.Setenv("WEKNORA_BASE_URL", "")
|
||||
t.Run("env creds + ACADEMY_HOST wins over profile", func(t *testing.T) {
|
||||
t.Setenv("ACADEMY_TOKEN", "")
|
||||
t.Setenv("ACADEMY_API_KEY", "sk-test")
|
||||
t.Setenv("ACADEMY_HOST", "https://env-host:8080")
|
||||
t.Setenv("ACADEMY_BASE_URL", "")
|
||||
if got := resolveDoctorHost(cfg); got != "https://env-host:8080" {
|
||||
t.Errorf("want env host, got %q", got)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("env creds without WEKNORA_HOST falls back to profile", func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_API_KEY", "sk-test")
|
||||
t.Setenv("WEKNORA_HOST", "")
|
||||
t.Setenv("WEKNORA_BASE_URL", "")
|
||||
t.Run("env creds without ACADEMY_HOST falls back to profile", func(t *testing.T) {
|
||||
t.Setenv("ACADEMY_API_KEY", "sk-test")
|
||||
t.Setenv("ACADEMY_HOST", "")
|
||||
t.Setenv("ACADEMY_BASE_URL", "")
|
||||
if got := resolveDoctorHost(cfg); got != "https://profile-host" {
|
||||
t.Errorf("want profile host, got %q", got)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("no env creds ignores WEKNORA_HOST (matches client builder)", func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_TOKEN", "")
|
||||
t.Setenv("WEKNORA_API_KEY", "")
|
||||
t.Setenv("WEKNORA_HOST", "https://should-be-ignored")
|
||||
t.Setenv("WEKNORA_BASE_URL", "")
|
||||
t.Run("no env creds ignores ACADEMY_HOST (matches client builder)", func(t *testing.T) {
|
||||
t.Setenv("ACADEMY_TOKEN", "")
|
||||
t.Setenv("ACADEMY_API_KEY", "")
|
||||
t.Setenv("ACADEMY_HOST", "https://should-be-ignored")
|
||||
t.Setenv("ACADEMY_BASE_URL", "")
|
||||
if got := resolveDoctorHost(cfg); got != "https://profile-host" {
|
||||
t.Errorf("want profile host, got %q", got)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("WEKNORA_BASE_URL test override always wins", func(t *testing.T) {
|
||||
t.Setenv("WEKNORA_API_KEY", "sk-test")
|
||||
t.Setenv("WEKNORA_HOST", "https://env-host")
|
||||
t.Setenv("WEKNORA_BASE_URL", "https://base-url-override")
|
||||
t.Run("ACADEMY_BASE_URL test override always wins", func(t *testing.T) {
|
||||
t.Setenv("ACADEMY_API_KEY", "sk-test")
|
||||
t.Setenv("ACADEMY_HOST", "https://env-host")
|
||||
t.Setenv("ACADEMY_BASE_URL", "https://base-url-override")
|
||||
if got := resolveDoctorHost(cfg); got != "https://base-url-override" {
|
||||
t.Errorf("want base-url override, got %q", got)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user