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

- 全量替换代码/配置/文档中的项目名(保留上游 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:
runny committed 2026-11-13 20:52:51 +08:00
1 parent 9097ee699d
commit 9058149576
3136 files changed
+18018 -18004

No files matched your search

+37 -37
View File
@@ -14,11 +14,11 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/config"
"github.com/Tencent/WeKnora/cli/internal/projectlink"
"github.com/Tencent/WeKnora/cli/internal/prompt"
"github.com/Tencent/WeKnora/cli/internal/secrets"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/config"
"academy/cli/internal/projectlink"
"academy/cli/internal/prompt"
"academy/cli/internal/secrets"
sdk "academy/client"
)
// TestFactory_Lazy ensures none of the closures execute work at construction
@@ -55,7 +55,7 @@ func TestFactory_Lazy(t *testing.T) {
// TestNew_FoundationDefaults verifies the production New() returns a usable
// Factory and that Client surfaces auth.unauthenticated when no current
// profile is configured (the precondition for `weknora auth login`).
// profile is configured (the precondition for `academy auth login`).
func TestNew_FoundationDefaults(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", t.TempDir()) // empty config → no current profile
f := New()
@@ -80,8 +80,8 @@ func TestFactory_ProfileOverride(t *testing.T) {
t.Setenv("XDG_CONFIG_HOME", dir)
// Seed config with two profiles; CurrentProfile = "default"
cfgPath := dir + "/weknora/config.yaml"
require.NoError(t, os.MkdirAll(dir+"/weknora", 0o700))
cfgPath := dir + "/academy/config.yaml"
require.NoError(t, os.MkdirAll(dir+"/academy", 0o700))
require.NoError(t, os.WriteFile(cfgPath, []byte(`
current_profile: default
profiles:
@@ -178,7 +178,7 @@ func TestBuildClient_NoCurrentProfile(t *testing.T) {
// fails with no profile → an agent execing retry_argv would loop); it must
// point at profile creation instead.
detail := ErrorToDetail(err)
assert.NotEqual(t, []string{"weknora", "auth", "login"}, detail.RetryArgv,
assert.NotEqual(t, []string{"academy", "auth", "login"}, detail.RetryArgv,
"zero-state retry_argv must not loop back to auth login")
assert.Contains(t, detail.RetryArgv, "profile", "zero-state retry_argv should point at profile setup")
}
@@ -309,10 +309,10 @@ func fakeKBServer(t *testing.T, kbs []sdk.KnowledgeBase) *httptest.Server {
return srv
}
// TestFactory_ActiveProfile_EnvVarFallback verifies WEKNORA_PROFILE is honoured
// TestFactory_ActiveProfile_EnvVarFallback verifies ACADEMY_PROFILE is honoured
// when no override or config is present.
func TestFactory_ActiveProfile_EnvVarFallback(t *testing.T) {
t.Setenv("WEKNORA_PROFILE", "staging")
t.Setenv("ACADEMY_PROFILE", "staging")
f := &Factory{} // no override, no config
if got := f.ActiveProfile(); got != "staging" {
t.Errorf("expected env fallback to staging; got %q", got)
@@ -320,9 +320,9 @@ func TestFactory_ActiveProfile_EnvVarFallback(t *testing.T) {
}
// TestFactory_ActiveProfile_OverrideWinsEnv verifies ProfileOverride takes
// priority over the WEKNORA_PROFILE env var.
// priority over the ACADEMY_PROFILE env var.
func TestFactory_ActiveProfile_OverrideWinsEnv(t *testing.T) {
t.Setenv("WEKNORA_PROFILE", "staging")
t.Setenv("ACADEMY_PROFILE", "staging")
f := &Factory{ProfileOverride: "prod"}
if got := f.ActiveProfile(); got != "prod" {
t.Errorf("override should win over env; got %q", got)
@@ -334,11 +334,11 @@ func TestFactory_ActiveProfile_OverrideWinsEnv(t *testing.T) {
func TestResolveKB_Chain(t *testing.T) {
t.Run("flag_kb_id_wins", func(t *testing.T) {
// UUID form on --kb → pass-through; no SDK call, no env, no disk.
t.Setenv("WEKNORA_KB_ID", "kb_env_should_lose")
t.Setenv("ACADEMY_KB_ID", "kb_env_should_lose")
dir := t.TempDir()
resolveKBChdir(t, dir)
// Drop a project link too - must be ignored.
require.NoError(t, projectlink.Save(filepath.Join(dir, ".weknora", "project.yaml"), &projectlink.Project{KBID: "kb_disk_should_lose"}))
require.NoError(t, projectlink.Save(filepath.Join(dir, ".academy", "project.yaml"), &projectlink.Project{KBID: "kb_disk_should_lose"}))
clientCalls := 0
f := &Factory{
@@ -354,7 +354,7 @@ func TestResolveKB_Chain(t *testing.T) {
})
t.Run("flag_kb_name_resolves", func(t *testing.T) {
t.Setenv("WEKNORA_KB_ID", "")
t.Setenv("ACADEMY_KB_ID", "")
srv := fakeKBServer(t, []sdk.KnowledgeBase{
{ID: "kb_a", Name: "foo"},
{ID: "kb_b", Name: "bar"},
@@ -368,7 +368,7 @@ func TestResolveKB_Chain(t *testing.T) {
})
t.Run("flag_kb_name_not_found", func(t *testing.T) {
t.Setenv("WEKNORA_KB_ID", "")
t.Setenv("ACADEMY_KB_ID", "")
srv := fakeKBServer(t, []sdk.KnowledgeBase{{ID: "kb_a", Name: "foo"}})
f := &Factory{
Client: func() (*sdk.Client, error) { return sdk.NewClient(srv.URL), nil },
@@ -382,10 +382,10 @@ func TestResolveKB_Chain(t *testing.T) {
t.Run("env_var", func(t *testing.T) {
// No flag, env wins over disk.
t.Setenv("WEKNORA_KB_ID", "kb_env")
t.Setenv("ACADEMY_KB_ID", "kb_env")
dir := t.TempDir()
resolveKBChdir(t, dir)
require.NoError(t, projectlink.Save(filepath.Join(dir, ".weknora", "project.yaml"), &projectlink.Project{KBID: "kb_disk_should_lose"}))
require.NoError(t, projectlink.Save(filepath.Join(dir, ".academy", "project.yaml"), &projectlink.Project{KBID: "kb_disk_should_lose"}))
f := &Factory{}
got, err := f.ResolveKB(makeResolveKBCmd(t, ""))
@@ -394,9 +394,9 @@ func TestResolveKB_Chain(t *testing.T) {
})
t.Run("project_link_walk_up", func(t *testing.T) {
t.Setenv("WEKNORA_KB_ID", "")
t.Setenv("ACADEMY_KB_ID", "")
root := t.TempDir()
require.NoError(t, projectlink.Save(filepath.Join(root, ".weknora", "project.yaml"), &projectlink.Project{KBID: "kb_proj"}))
require.NoError(t, projectlink.Save(filepath.Join(root, ".academy", "project.yaml"), &projectlink.Project{KBID: "kb_proj"}))
// Run from a deep child to exercise walk-up.
deep := filepath.Join(root, "a", "b", "c")
require.NoError(t, os.MkdirAll(deep, 0o755))
@@ -410,7 +410,7 @@ func TestResolveKB_Chain(t *testing.T) {
t.Run("none", func(t *testing.T) {
// No flag, no env, no project link → CodeKBIDRequired.
t.Setenv("WEKNORA_KB_ID", "")
t.Setenv("ACADEMY_KB_ID", "")
dir := t.TempDir()
resolveKBChdir(t, dir)
@@ -423,24 +423,24 @@ func TestResolveKB_Chain(t *testing.T) {
})
}
// TestBuildClientFromEnv covers the stateless env-credential path: WEKNORA_TOKEN
// / WEKNORA_API_KEY build an ephemeral client with no config/keyring access.
// TestBuildClientFromEnv covers the stateless env-credential path: ACADEMY_TOKEN
// / ACADEMY_API_KEY build an ephemeral client with no config/keyring access.
func TestBuildClientFromEnv(t *testing.T) {
emptyCfg := &Factory{Config: func() (*config.Config, error) { return &config.Config{}, nil }}
t.Run("no env vars falls through to profile path", func(t *testing.T) {
t.Setenv("WEKNORA_TOKEN", "")
t.Setenv("WEKNORA_API_KEY", "")
t.Setenv("ACADEMY_TOKEN", "")
t.Setenv("ACADEMY_API_KEY", "")
c, handled, err := buildClientFromEnv(emptyCfg)
assert.False(t, handled, "no env creds must fall through")
assert.Nil(t, c)
assert.NoError(t, err)
})
t.Run("api key + WEKNORA_HOST builds a client", func(t *testing.T) {
t.Setenv("WEKNORA_TOKEN", "")
t.Setenv("WEKNORA_API_KEY", "sk-test")
t.Setenv("WEKNORA_HOST", "https://kb.example.com")
t.Run("api key + ACADEMY_HOST builds a client", func(t *testing.T) {
t.Setenv("ACADEMY_TOKEN", "")
t.Setenv("ACADEMY_API_KEY", "sk-test")
t.Setenv("ACADEMY_HOST", "https://kb.example.com")
c, handled, err := buildClientFromEnv(emptyCfg)
assert.True(t, handled)
require.NoError(t, err)
@@ -448,9 +448,9 @@ func TestBuildClientFromEnv(t *testing.T) {
})
t.Run("token set but no host is a typed input error", func(t *testing.T) {
t.Setenv("WEKNORA_API_KEY", "")
t.Setenv("WEKNORA_TOKEN", "jwt-token")
t.Setenv("WEKNORA_HOST", "")
t.Setenv("ACADEMY_API_KEY", "")
t.Setenv("ACADEMY_TOKEN", "jwt-token")
t.Setenv("ACADEMY_HOST", "")
c, handled, err := buildClientFromEnv(emptyCfg)
assert.True(t, handled, "env creds set → handled even on host error")
assert.Nil(t, c)
@@ -459,10 +459,10 @@ func TestBuildClientFromEnv(t *testing.T) {
assert.Equal(t, CodeInputInvalidArgument, ce.Code)
})
t.Run("host falls back to the active profile when WEKNORA_HOST unset", func(t *testing.T) {
t.Setenv("WEKNORA_API_KEY", "")
t.Setenv("WEKNORA_TOKEN", "jwt-token")
t.Setenv("WEKNORA_HOST", "")
t.Run("host falls back to the active profile when ACADEMY_HOST unset", func(t *testing.T) {
t.Setenv("ACADEMY_API_KEY", "")
t.Setenv("ACADEMY_TOKEN", "jwt-token")
t.Setenv("ACADEMY_HOST", "")
f := &Factory{Config: func() (*config.Config, error) {
return &config.Config{
CurrentProfile: "p",