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
@@ -1,4 +1,4 @@
|
||||
// Package configcmd holds the `weknora config` command tree.
|
||||
// Package configcmd holds the `academy config` command tree.
|
||||
//
|
||||
// Currently a single read-only `view` subcommand that prints the resolved
|
||||
// CLI configuration and its resolution chain. No mutation, no network.
|
||||
@@ -11,10 +11,10 @@ package configcmd
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"academy/cli/internal/cmdutil"
|
||||
)
|
||||
|
||||
// NewCmd builds the `weknora config` parent command.
|
||||
// NewCmd builds the `academy config` parent command.
|
||||
func NewCmd(f *cmdutil.Factory) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "config",
|
||||
|
||||
+24
-24
@@ -8,13 +8,13 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/format"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
"github.com/Tencent/WeKnora/cli/internal/projectlink"
|
||||
"github.com/Tencent/WeKnora/cli/internal/secrets"
|
||||
"github.com/Tencent/WeKnora/cli/internal/xdg"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/format"
|
||||
"academy/cli/internal/iostreams"
|
||||
"academy/cli/internal/projectlink"
|
||||
"academy/cli/internal/secrets"
|
||||
"academy/cli/internal/xdg"
|
||||
)
|
||||
|
||||
// viewFields enumerates the fields surfaced for `--format json` discovery on
|
||||
@@ -46,7 +46,7 @@ type viewData struct {
|
||||
ProjectLink string `json:"project_link"`
|
||||
}
|
||||
|
||||
// NewCmdView builds `weknora config view`. Read-only inspection of the
|
||||
// NewCmdView builds `academy config view`. Read-only inspection of the
|
||||
// resolved config and resolution chain. Never builds the SDK client and
|
||||
// never issues a network request: KB resolution uses ResolveKBLocal, secrets
|
||||
// storage is detected from the store type, and everything else is read from
|
||||
@@ -77,11 +77,11 @@ even when no profile or KB is configured (sources report "(none)" /
|
||||
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
|
||||
UsedFor: "inspect the resolved CLI config and resolution chain (active profile, host, kb, log level, default format, file paths) without mutating or hitting the network",
|
||||
Examples: []string{
|
||||
"weknora config view",
|
||||
"weknora config view --format json",
|
||||
"weknora config view --jq '.data.active_profile'",
|
||||
"academy config view",
|
||||
"academy config view --format json",
|
||||
"academy config view --jq '.data.active_profile'",
|
||||
},
|
||||
Output: "envelope.data is {active_profile, profile_source, auth_source, host, kb_id, kb_source, log_level, log_level_source, format_default, config_file, cache_dir, secrets, project_link}. auth_source reports whether the active credential is the profile+keyring or a stateless WEKNORA_TOKEN/WEKNORA_API_KEY env override.",
|
||||
Output: "envelope.data is {active_profile, profile_source, auth_source, host, kb_id, kb_source, log_level, log_level_source, format_default, config_file, cache_dir, secrets, project_link}. auth_source reports whether the active credential is the profile+keyring or a stateless ACADEMY_TOKEN/ACADEMY_API_KEY env override.",
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
@@ -129,14 +129,14 @@ func resolveView(cmd *cobra.Command, f *cmdutil.Factory) viewData {
|
||||
}
|
||||
}
|
||||
|
||||
// Auth source: stateless env credentials (WEKNORA_TOKEN/WEKNORA_API_KEY)
|
||||
// Auth source: stateless env credentials (ACADEMY_TOKEN/ACADEMY_API_KEY)
|
||||
// override the profile + keyring for the actual client, so report that —
|
||||
// otherwise host/profile above would silently describe a profile the env
|
||||
// credential bypassed. WEKNORA_HOST (when set) is the host that env cred
|
||||
// credential bypassed. ACADEMY_HOST (when set) is the host that env cred
|
||||
// authenticates against.
|
||||
if active, kind := cmdutil.EnvCredential(); active {
|
||||
d.AuthSource = kind + " env (stateless; bypasses profile + keyring)"
|
||||
if h := strings.TrimSpace(os.Getenv("WEKNORA_HOST")); h != "" {
|
||||
if h := strings.TrimSpace(os.Getenv("ACADEMY_HOST")); h != "" {
|
||||
d.Host = h
|
||||
}
|
||||
} else if d.ActiveProfile != "" {
|
||||
@@ -173,8 +173,8 @@ func resolveProfile(f *cmdutil.Factory) (name, source string) {
|
||||
if f.ProfileOverride != "" {
|
||||
return f.ProfileOverride, "--profile flag"
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_PROFILE"); v != "" {
|
||||
return v, "WEKNORA_PROFILE env"
|
||||
if v := os.Getenv("ACADEMY_PROFILE"); v != "" {
|
||||
return v, "ACADEMY_PROFILE env"
|
||||
}
|
||||
if f.Config != nil {
|
||||
if cfg, err := f.Config(); err == nil && cfg != nil && cfg.CurrentProfile != "" {
|
||||
@@ -196,8 +196,8 @@ func resolveKB(cmd *cobra.Command, f *cmdutil.Factory) (id, source string) {
|
||||
if v, _ := cmd.Flags().GetString("kb"); v != "" {
|
||||
return id, "--kb flag"
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_KB_ID"); v != "" {
|
||||
return id, "WEKNORA_KB_ID env"
|
||||
if v := os.Getenv("ACADEMY_KB_ID"); v != "" {
|
||||
return id, "ACADEMY_KB_ID env"
|
||||
}
|
||||
if cwd, werr := os.Getwd(); werr == nil {
|
||||
if path, found, derr := projectlink.Discover(cwd); derr == nil && found {
|
||||
@@ -216,14 +216,14 @@ func resolveLogLevel(cmd *cobra.Command) (level, source string) {
|
||||
return level, "--log-level flag"
|
||||
}
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_LOG_LEVEL"); v != "" && cmdutil.IsValidLogLevel(v) {
|
||||
return level, "WEKNORA_LOG_LEVEL env"
|
||||
if v := os.Getenv("ACADEMY_LOG_LEVEL"); v != "" && cmdutil.IsValidLogLevel(v) {
|
||||
return level, "ACADEMY_LOG_LEVEL env"
|
||||
}
|
||||
return level, "default"
|
||||
}
|
||||
|
||||
// resolveFormatDefault reports the configured default output format: the
|
||||
// config.yaml defaults.format value, else WEKNORA_FORMAT, else the hard
|
||||
// config.yaml defaults.format value, else ACADEMY_FORMAT, else the hard
|
||||
// default. This is the *default* used when --format is unset — not the
|
||||
// per-invocation --format flag value.
|
||||
func resolveFormatDefault() string {
|
||||
@@ -231,7 +231,7 @@ func resolveFormatDefault() string {
|
||||
if err == nil && cfg != nil && cfg.Defaults.Format != "" {
|
||||
return cfg.Defaults.Format
|
||||
}
|
||||
if v := os.Getenv("WEKNORA_FORMAT"); v == "text" || v == "json" || v == "ndjson" {
|
||||
if v := os.Getenv("ACADEMY_FORMAT"); v == "text" || v == "json" || v == "ndjson" {
|
||||
return v
|
||||
}
|
||||
return string(cmdutil.DefaultFormatMode)
|
||||
@@ -261,7 +261,7 @@ func resolveSecrets(f *cmdutil.Factory) string {
|
||||
return "file"
|
||||
}
|
||||
|
||||
// resolveProjectLink reports the discovered .weknora/project.yaml path or
|
||||
// resolveProjectLink reports the discovered .academy/project.yaml path or
|
||||
// "(none)". Walks up from cwd like ResolveKBLocal does.
|
||||
func resolveProjectLink() string {
|
||||
cwd, err := os.Getwd()
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
|
||||
"github.com/Tencent/WeKnora/cli/internal/config"
|
||||
"github.com/Tencent/WeKnora/cli/internal/iostreams"
|
||||
sdk "github.com/Tencent/WeKnora/client"
|
||||
"academy/cli/internal/cmdutil"
|
||||
"academy/cli/internal/config"
|
||||
"academy/cli/internal/iostreams"
|
||||
sdk "academy/client"
|
||||
)
|
||||
|
||||
type viewEnvelope struct {
|
||||
@@ -101,7 +101,7 @@ func networkFreeFactory(t *testing.T) *cmdutil.Factory {
|
||||
return f
|
||||
}
|
||||
|
||||
// TestConfigView_EnvCredentialSurfaced: when WEKNORA_API_KEY + WEKNORA_HOST are
|
||||
// TestConfigView_EnvCredentialSurfaced: when ACADEMY_API_KEY + ACADEMY_HOST are
|
||||
// set, config view reports the env override (auth_source + the env host), not
|
||||
// the bypassed config profile's host.
|
||||
func TestConfigView_EnvCredentialSurfaced(t *testing.T) {
|
||||
@@ -111,10 +111,10 @@ func TestConfigView_EnvCredentialSurfaced(t *testing.T) {
|
||||
Profiles: map[string]config.Profile{"prod": {Host: "https://configured.example.com"}},
|
||||
}
|
||||
require.NoError(t, config.Save(cfg))
|
||||
t.Setenv("WEKNORA_API_KEY", "sk-test")
|
||||
t.Setenv("WEKNORA_HOST", "https://env-override.example.com")
|
||||
t.Setenv("ACADEMY_API_KEY", "sk-test")
|
||||
t.Setenv("ACADEMY_HOST", "https://env-override.example.com")
|
||||
|
||||
env := runViewJSON(t, networkFreeFactory(t))
|
||||
assert.Contains(t, env.Data.AuthSource, "WEKNORA_API_KEY env")
|
||||
assert.Contains(t, env.Data.AuthSource, "ACADEMY_API_KEY env")
|
||||
assert.Equal(t, "https://env-override.example.com", env.Data.Host, "host must be the env override, not the profile host")
|
||||
}
|
||||
Reference in new issue
Block a user