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

+40 -40
View File
@@ -10,26 +10,26 @@ import (
"github.com/spf13/cobra"
agentcmd "github.com/Tencent/WeKnora/cli/cmd/agent"
apicmd "github.com/Tencent/WeKnora/cli/cmd/api"
"github.com/Tencent/WeKnora/cli/cmd/auth"
chatcmd "github.com/Tencent/WeKnora/cli/cmd/chat"
chunkcmd "github.com/Tencent/WeKnora/cli/cmd/chunk"
configcmd "github.com/Tencent/WeKnora/cli/cmd/config"
"github.com/Tencent/WeKnora/cli/cmd/doc"
"github.com/Tencent/WeKnora/cli/cmd/doctor"
"github.com/Tencent/WeKnora/cli/cmd/kb"
linkcmd "github.com/Tencent/WeKnora/cli/cmd/link"
messagecmd "github.com/Tencent/WeKnora/cli/cmd/message"
mcpcmd "github.com/Tencent/WeKnora/cli/cmd/mcp"
modelcmd "github.com/Tencent/WeKnora/cli/cmd/model"
profilecmd "github.com/Tencent/WeKnora/cli/cmd/profile"
"github.com/Tencent/WeKnora/cli/cmd/search"
sessioncmd "github.com/Tencent/WeKnora/cli/cmd/session"
skillscmd "github.com/Tencent/WeKnora/cli/cmd/skills"
"github.com/Tencent/WeKnora/cli/internal/build"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
agentcmd "academy/cli/cmd/agent"
apicmd "academy/cli/cmd/api"
"academy/cli/cmd/auth"
chatcmd "academy/cli/cmd/chat"
chunkcmd "academy/cli/cmd/chunk"
configcmd "academy/cli/cmd/config"
"academy/cli/cmd/doc"
"academy/cli/cmd/doctor"
"academy/cli/cmd/kb"
linkcmd "academy/cli/cmd/link"
messagecmd "academy/cli/cmd/message"
mcpcmd "academy/cli/cmd/mcp"
modelcmd "academy/cli/cmd/model"
profilecmd "academy/cli/cmd/profile"
"academy/cli/cmd/search"
sessioncmd "academy/cli/cmd/session"
skillscmd "academy/cli/cmd/skills"
"academy/cli/internal/build"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
)
// resolveFormatEarly scans raw argv for --format before cobra's command
@@ -52,7 +52,7 @@ func resolveFormatEarly(args []string) {
}
}
if mode == "" {
if v := os.Getenv("WEKNORA_FORMAT"); v != "" {
if v := os.Getenv("ACADEMY_FORMAT"); v != "" {
mode = strings.ToLower(v)
}
}
@@ -134,16 +134,16 @@ var cobraFlagErrorPrefixes = []string{
func NewRootCmd(f *cmdutil.Factory) *cobra.Command {
v, commit, date := build.Info()
cmd := &cobra.Command{
Use: "weknora",
Short: "WeKnora CLI",
Long: `Command-line client for the WeKnora RAG server. Manage knowledge bases
Use: "academy",
Short: "Academy CLI",
Long: `Command-line client for the Academy RAG server. Manage knowledge bases
and documents, run hybrid search, chat with grounded answers, or expose
a curated read-only MCP tool surface for AI agents.`,
Example: ` weknora profile add prod --host=https://kb.example.com --use
weknora auth login
weknora kb list
weknora chat "summarise the design doc"
weknora doctor --format json`,
Example: ` academy profile add prod --host=https://kb.example.com --use
academy auth login
academy kb list
academy chat "summarise the design doc"
academy doctor --format json`,
SilenceUsage: true,
SilenceErrors: true,
// Version makes cobra auto-register a `--version` global flag that
@@ -160,12 +160,12 @@ a curated read-only MCP tool surface for AI agents.`,
if err := cmdutil.CheckSafeArgs(args, c.Flags()); err != nil {
return err
}
// Propagate the global --profile flag (or WEKNORA_PROFILE env) into
// Propagate the global --profile flag (or ACADEMY_PROFILE env) into
// the Factory for this invocation only - single-shot override, no disk write.
// Flag takes precedence over env; env takes precedence over config file.
if v, _ := c.Flags().GetString("profile"); v != "" {
f.ProfileOverride = v
} else if v := os.Getenv("WEKNORA_PROFILE"); v != "" {
} else if v := os.Getenv("ACADEMY_PROFILE"); v != "" {
f.ProfileOverride = v
}
// Pin --format mode for cmdutil.PrintError envelope vs prose decision.
@@ -178,15 +178,15 @@ a curated read-only MCP tool surface for AI agents.`,
}
// Record the resolved profile for envelope.profile and NDJSON init.profile.
cmdutil.SetProfile(f.ActiveProfile())
// Resolve --log-level / WEKNORA_LOG_LEVEL and apply to the SDK
// Resolve --log-level / ACADEMY_LOG_LEVEL and apply to the SDK
// debug logger before any SDK call is made. Returns a typed error
// when --log-level was passed explicitly with an invalid value
// (matches --format validation strictness).
return f.ApplyLogLevel(c, iostreams.IO.Err)
},
}
// Match `weknora version` line format so both forms output the same.
cmd.SetVersionTemplate("weknora {{.Version}}\n")
// Match `academy version` line format so both forms output the same.
cmd.SetVersionTemplate("academy {{.Version}}\n")
addGlobalFlags(cmd)
// Wrap cobra's flag-parsing errors as FlagError so cmdutil.ExitCode maps
// them to exit 2. "unknown command" errors are detected by message prefix
@@ -234,11 +234,11 @@ func addGlobalFlags(cmd *cobra.Command) {
// --log-level applies uniformly to all SDK calls.
cmdutil.AddLogLevelFlag(cmd)
// --format and --jq are persistent globals so unknown-subcommand paths
// (e.g. `weknora fooo --format json`) reach the typed-envelope guard
// (e.g. `academy fooo --format json`) reach the typed-envelope guard
// instead of being rejected as "unknown flag" exit 2 by cobra. Commands
// that don't produce JSON output (e.g. `completion bash`) ignore the flag
// rather than error — the unified agent contract is worth the trade.
pf.String("format", "", "Output format: text | json | ndjson (default: json; env: WEKNORA_FORMAT)")
pf.String("format", "", "Output format: text | json | ndjson (default: json; env: ACADEMY_FORMAT)")
pf.StringP("jq", "q", "", "Filter JSON output using a jq `expression` (requires --format json|ndjson)")
}
@@ -267,14 +267,14 @@ func newVersionCmd(f *cmdutil.Factory) *cobra.Command {
"date": date,
}, nil)
}
fmt.Fprintf(c.OutOrStdout(), "weknora %s (commit %s, built %s)\n", v, commit, date)
fmt.Fprintf(c.OutOrStdout(), "academy %s (commit %s, built %s)\n", v, commit, date)
return nil
},
}
cmdutil.AddFormatFlag(cmd, versionFields...)
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
UsedFor: "show CLI build metadata (version, commit, build date)",
Examples: []string{"weknora version --format json"},
Examples: []string{"academy version --format json"},
Output: "envelope.data is {version, commit, date}",
})
return cmd
@@ -282,7 +282,7 @@ func newVersionCmd(f *cmdutil.Factory) *cobra.Command {
// installUnknownSubcommandGuard recursively attaches a RunE that emits a typed
// envelope error when a parent command is invoked with no matching subcommand
// (e.g. `weknora kb bogus`). Without this, cobra falls back to a free-form
// (e.g. `academy kb bogus`). Without this, cobra falls back to a free-form
// "unknown command" string error via legacyArgs validation.
//
// cobra's legacyArgs (args.go) fires at Find() time when Args == nil:
@@ -300,7 +300,7 @@ func installUnknownSubcommandGuard(cmd *cobra.Command) {
}
func unknownSubcommandRunE(cmd *cobra.Command, args []string) error {
// Group command invoked with no subcommand (e.g. `weknora kb`):
// Group command invoked with no subcommand (e.g. `academy kb`):
// show help rather than emit a confusing `unknown ""` error.
if len(args) == 0 {
return cmd.Help()