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

+13 -13
View File
@@ -7,10 +7,10 @@ import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
"github.com/Tencent/WeKnora/cli/internal/output"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
"academy/cli/internal/output"
sdk "academy/client"
)
// chunksFields enumerates the fields surfaced for `--format json` discovery on
@@ -47,7 +47,7 @@ type ChunksService interface {
var _ ChunksService = (*sdk.Client)(nil)
// NewCmdChunks builds `weknora search chunks "<query>" --kb <id-or-name>`.
// NewCmdChunks builds `academy search chunks "<query>" --kb <id-or-name>`.
// Uses a positional query argument with the KB selected via flag.
//
// The `--kb` flag accepts either a KB UUID (passed through unchanged) or a
@@ -57,9 +57,9 @@ func NewCmdChunks(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: `chunks "<query>"`,
Short: "Hybrid (vector + keyword) chunk retrieval against a knowledge base",
Example: ` weknora search chunks "what is RAG?" --kb engineering
weknora search chunks "embedding model" --kb kb_abc --limit 20
weknora search chunks "retry policy" --kb engineering --no-keyword # vector-only`,
Example: ` academy search chunks "what is RAG?" --kb engineering
academy search chunks "embedding model" --kb kb_abc --limit 20
academy search chunks "retry policy" --kb engineering --no-keyword # vector-only`,
Long: `Hybrid (vector + keyword) retrieval against the knowledge base. Pass
--no-vector or --no-keyword to disable one channel; you cannot disable both.
--limit caps the returned slice client-side.`,
@@ -78,7 +78,7 @@ func NewCmdChunks(f *cmdutil.Factory) *cobra.Command {
}
fopts.ResolveDefault(iostreams.IO.IsStdoutTTY())
// Resolve KB via the shared flag→env→project-link chain (same as
// `doc list` / `chat`), so a linked directory or WEKNORA_KB_ID
// `doc list` / `chat`), so a linked directory or ACADEMY_KB_ID
// works without an explicit --kb. Resolve before building the
// client so an unresolved KB short-circuits to local.kb_id_required
// without a client round-trip.
@@ -96,9 +96,9 @@ func NewCmdChunks(f *cmdutil.Factory) *cobra.Command {
}
bindChunksFlags(cmd, opts)
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
UsedFor: "Hybrid (vector + keyword) chunk retrieval against a knowledge base. The KB comes from --kb (id or name), else WEKNORA_KB_ID, else the linked directory. Results come with meta.count; use --limit to cap (default 8, tuned for RAG context). Pass --no-vector or --no-keyword to disable one channel.",
RequiredFlags: []string{"<query> (positional)", "--kb (or WEKNORA_KB_ID / linked directory)"},
Examples: []string{`weknora search chunks "what is RAG?" --kb engineering --format json`},
UsedFor: "Hybrid (vector + keyword) chunk retrieval against a knowledge base. The KB comes from --kb (id or name), else ACADEMY_KB_ID, else the linked directory. Results come with meta.count; use --limit to cap (default 8, tuned for RAG context). Pass --no-vector or --no-keyword to disable one channel.",
RequiredFlags: []string{"<query> (positional)", "--kb (or ACADEMY_KB_ID / linked directory)"},
Examples: []string{`academy search chunks "what is RAG?" --kb engineering --format json`},
Output: "envelope.data is an array of SearchResult objects with id, content, score, knowledge_id; meta.count is the returned count; meta.has_more=true if more matched than --limit",
})
return cmd
@@ -106,7 +106,7 @@ func NewCmdChunks(f *cmdutil.Factory) *cobra.Command {
// bindChunksFlags registers the chunks flag surface in one place to keep
// the constructor readable. --kb is optional: when omitted it falls back to
// WEKNORA_KB_ID / the linked directory via Factory.ResolveKB.
// ACADEMY_KB_ID / the linked directory via Factory.ResolveKB.
func bindChunksFlags(cmd *cobra.Command, opts *ChunksOptions) {
cmd.Flags().StringVar(&opts.KB, "kb", "", "Knowledge base UUID or name (overrides env / project link)")
cmd.Flags().IntVarP(&opts.Limit, "limit", "L", 8, "Maximum results to return (default 8 - tuned for RAG context window; list commands default to 30)")
+7 -7
View File
@@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
sdk "academy/client"
)
type fakeChunksSvc struct {
@@ -151,8 +151,8 @@ func TestRunSearch_NilService(t *testing.T) {
// --kb rule; that safety guard is unrelated to this path.
func TestNewCmdChunks_NoKBUsesResolver(t *testing.T) {
iostreams.SetForTest(t)
t.Setenv("WEKNORA_KB_ID", "") // no ambient KB from env
t.Chdir(t.TempDir()) // no .weknora project link discoverable
t.Setenv("ACADEMY_KB_ID", "") // no ambient KB from env
t.Chdir(t.TempDir()) // no .academy project link discoverable
cmd := NewCmdChunks(&cmdutil.Factory{
// Resolution reaches local.kb_id_required before any client is built,
// so this must never be invoked; make it loud if it is.
@@ -170,12 +170,12 @@ func TestNewCmdChunks_NoKBUsesResolver(t *testing.T) {
}
// TestNewCmdChunks_HonorsKBEnv proves the env fallback is wired: with
// WEKNORA_KB_ID set and no --kb, KB resolution succeeds (no kb-required
// ACADEMY_KB_ID set and no --kb, KB resolution succeeds (no kb-required
// error) and the command proceeds to the client step — which here errors,
// confirming we got past resolution using the env value alone.
func TestNewCmdChunks_HonorsKBEnv(t *testing.T) {
iostreams.SetForTest(t)
t.Setenv("WEKNORA_KB_ID", "kb_from_env")
t.Setenv("ACADEMY_KB_ID", "kb_from_env")
cmd := NewCmdChunks(&cmdutil.Factory{
Client: func() (*sdk.Client, error) { return nil, errors.New("client boom") },
})
+13 -13
View File
@@ -9,11 +9,11 @@ import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
"github.com/Tencent/WeKnora/cli/internal/output"
"github.com/Tencent/WeKnora/cli/internal/text"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
"academy/cli/internal/output"
"academy/cli/internal/text"
sdk "academy/client"
)
// docsPageSize is the default --page-size on `search docs`: how many
@@ -59,7 +59,7 @@ type DocsSearchService interface {
ListKnowledgeWithFilter(ctx context.Context, kbID string, page, pageSize int, filter sdk.KnowledgeListFilter) ([]sdk.Knowledge, int64, error)
}
// NewCmdDocs builds `weknora search docs "<query>" --kb <id-or-name>`.
// NewCmdDocs builds `academy search docs "<query>" --kb <id-or-name>`.
// Pages through the KB's documents and surfaces every entry whose title
// or file_name contains the query as a server-side case-insensitive LIKE
// match. Useful for finding a specific upload to download or delete.
@@ -78,9 +78,9 @@ The query is a case-insensitive server-side LIKE filter (the server runs
By default, --all-pages=true walks every server page until --limit is
reached or the KB is exhausted. Pass --all-pages=false to stop after one page.`,
Example: ` weknora search docs "Q3 forecast" --kb finance
weknora search docs "spec" --kb engineering --limit 5
weknora search docs "spec" --kb engineering --all-pages=false`,
Example: ` academy search docs "Q3 forecast" --kb finance
academy search docs "spec" --kb engineering --limit 5
academy search docs "spec" --kb engineering --all-pages=false`,
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
opts.Query = strings.TrimSpace(args[0])
@@ -96,7 +96,7 @@ reached or the KB is exhausted. Pass --all-pages=false to stop after one page.`,
}
fopts.ResolveDefault(iostreams.IO.IsStdoutTTY())
// Resolve KB via the shared flag→env→project-link chain (same as
// `doc list` / `chat`), so a linked directory or WEKNORA_KB_ID
// `doc list` / `chat`), so a linked directory or ACADEMY_KB_ID
// works without an explicit --kb. Resolve before building the
// client so an unresolved KB short-circuits to local.kb_id_required
// without a client round-trip.
@@ -118,9 +118,9 @@ reached or the KB is exhausted. Pass --all-pages=false to stop after one page.`,
cmd.Flags().BoolVar(&opts.AllPages, "all-pages", true, "Walk every server page until exhausted or --limit hit")
cmdutil.AddFormatFlag(cmd, docsFields...)
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
UsedFor: "Find documents in a knowledge base by keyword (server-side LIKE filter on title/file_name). The KB comes from --kb (id or name), else WEKNORA_KB_ID, else the linked directory. Results come with meta.count; use --limit to cap and --all-pages=false to stop after one page.",
RequiredFlags: []string{"<query> (positional)", "--kb (or WEKNORA_KB_ID / linked directory)"},
Examples: []string{`weknora search docs "spec" --kb engineering --format json`},
UsedFor: "Find documents in a knowledge base by keyword (server-side LIKE filter on title/file_name). The KB comes from --kb (id or name), else ACADEMY_KB_ID, else the linked directory. Results come with meta.count; use --limit to cap and --all-pages=false to stop after one page.",
RequiredFlags: []string{"<query> (positional)", "--kb (or ACADEMY_KB_ID / linked directory)"},
Examples: []string{`academy search docs "spec" --kb engineering --format json`},
Output: "envelope.data is an array of Knowledge objects with id, title, file_name, parse_status; meta.count is the returned count, meta.total_count the server's full match count, meta.has_more=true if more matched than --limit",
})
return cmd
+5 -5
View File
@@ -10,9 +10,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
sdk "academy/client"
)
// fakeDocsSearchSvc scripts paginated ListKnowledgeWithFilter responses.
@@ -267,7 +267,7 @@ func TestDocsSearch_HasMore(t *testing.T) {
// to resolve it reports the typed local.kb_id_required, not a usage error.
func TestNewCmdDocs_NoKBUsesResolver(t *testing.T) {
iostreams.SetForTest(t)
t.Setenv("WEKNORA_KB_ID", "")
t.Setenv("ACADEMY_KB_ID", "")
t.Chdir(t.TempDir())
cmd := NewCmdDocs(&cmdutil.Factory{
Client: func() (*sdk.Client, error) { return nil, errors.New("client should not be built") },
@@ -286,7 +286,7 @@ func TestNewCmdDocs_NoKBUsesResolver(t *testing.T) {
// TestNewCmdDocs_HonorsKBEnv proves the env fallback is wired for search docs.
func TestNewCmdDocs_HonorsKBEnv(t *testing.T) {
iostreams.SetForTest(t)
t.Setenv("WEKNORA_KB_ID", "kb_from_env")
t.Setenv("ACADEMY_KB_ID", "kb_from_env")
cmd := NewCmdDocs(&cmdutil.Factory{
Client: func() (*sdk.Client, error) { return nil, errors.New("client boom") },
})
+10 -10
View File
@@ -9,11 +9,11 @@ import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
"github.com/Tencent/WeKnora/cli/internal/output"
"github.com/Tencent/WeKnora/cli/internal/text"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
"academy/cli/internal/output"
"academy/cli/internal/text"
sdk "academy/client"
)
// kbSearchFields enumerates the fields surfaced for `--format json` discovery on
@@ -39,7 +39,7 @@ type KBSearchService interface {
ListKnowledgeBases(ctx context.Context) ([]sdk.KnowledgeBase, error)
}
// NewCmdKB builds `weknora search kb "<query>"` - substring + case-insensitive
// NewCmdKB builds `academy search kb "<query>"` - substring + case-insensitive
// match across KB names and descriptions visible to the active profile.
// Results are sorted by name length (shortest first; usually the closest
// hit) for deterministic output.
@@ -53,9 +53,9 @@ to the active profile. Results are sorted by name length (shortest first;
usually the closest hit) for deterministic output.
This is name-discovery only - for searching *inside* a knowledge base's
content, use ` + "`weknora search chunks`" + `.`,
Example: ` weknora search kb "marketing"
weknora search kb "team" --limit 5 --format json`,
content, use ` + "`academy search chunks`" + `.`,
Example: ` academy search kb "marketing"
academy search kb "team" --limit 5 --format json`,
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
opts.Query = strings.TrimSpace(args[0])
@@ -82,7 +82,7 @@ content, use ` + "`weknora search chunks`" + `.`,
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
UsedFor: "Find knowledge bases by name or description (client-side case-insensitive substring match). Results come with meta.count; use --limit to cap. For searching content inside a KB, use 'search chunks' instead.",
RequiredFlags: []string{"<query> (positional)"},
Examples: []string{`weknora search kb "engineering" --format json`},
Examples: []string{`academy search kb "engineering" --format json`},
Output: "envelope.data is an array of KnowledgeBase objects with id, name, knowledge_count; meta.count is the returned count; meta.has_more=true if more matched than --limit",
})
return cmd
+3 -3
View File
@@ -10,9 +10,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
sdk "academy/client"
)
type fakeKBSearchSvc struct {
+9 -9
View File
@@ -1,14 +1,14 @@
// Package search implements the `weknora search` command tree:
// Package search implements the `academy search` command tree:
// chunks / kb / docs / sessions.
package search
import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"academy/cli/internal/cmdutil"
)
// NewCmdSearch builds the `weknora search` parent. Pure dispatcher to the
// NewCmdSearch builds the `academy search` parent. Pure dispatcher to the
// four subcommands - users must pick a verb (chunks / kb / docs / sessions).
func NewCmdSearch(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
@@ -20,10 +20,10 @@ func NewCmdSearch(f *cmdutil.Factory) *cobra.Command {
search kb "<q>" find KBs by name / description
search docs "<q>" --kb X find documents inside a KB
search sessions "<q>" find chat sessions by title / description`,
Example: ` weknora search chunks "what is RAG?" --kb engineering
weknora search kb "marketing"
weknora search docs "Q3 forecast" --kb finance
weknora search sessions "onboarding"`,
Example: ` academy search chunks "what is RAG?" --kb engineering
academy search kb "marketing"
academy search docs "Q3 forecast" --kb finance
academy search sessions "onboarding"`,
}
cmd.AddCommand(NewCmdChunks(f))
@@ -42,6 +42,6 @@ func emptyContentSearchHint(n int) string {
return ""
}
return "0 results: this may be no match, OR the KB has no indexed chunks. " +
"Check `weknora kb status <kb>` (chunk_count) and `weknora doc list --kb <kb>` (parse_status); " +
"documents in parse_status=draft are not indexed — run `weknora doc reparse <doc-id>`."
"Check `academy kb status <kb>` (chunk_count) and `academy doc list --kb <kb>` (parse_status); " +
"documents in parse_status=draft are not indexed — run `academy doc reparse <doc-id>`."
}
+4 -4
View File
@@ -5,11 +5,11 @@ import (
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
)
// TestSearch_NoArgs_ShowsHelp: bare `weknora search` (no subcommand)
// TestSearch_NoArgs_ShowsHelp: bare `academy search` (no subcommand)
// must run cobra's Help() without erroring.
func TestSearch_NoArgs_ShowsHelp(t *testing.T) {
_, _ = iostreams.SetForTest(t)
@@ -20,7 +20,7 @@ func TestSearch_NoArgs_ShowsHelp(t *testing.T) {
require.NoError(t, cmd.Execute())
}
// TestSearch_RejectsPositional: bare positional `weknora search "<q>" --kb X`
// TestSearch_RejectsPositional: bare positional `academy search "<q>" --kb X`
// must error - search is a pure dispatcher with no shortcut form.
func TestSearch_RejectsPositional(t *testing.T) {
_, _ = iostreams.SetForTest(t)
+10 -10
View File
@@ -10,11 +10,11 @@ import (
"github.com/spf13/cobra"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
"github.com/Tencent/WeKnora/cli/internal/output"
"github.com/Tencent/WeKnora/cli/internal/text"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
"academy/cli/internal/output"
"academy/cli/internal/text"
sdk "academy/client"
)
// sessionsPageSize is the default --page-size on `search sessions`: how many
@@ -53,7 +53,7 @@ type SessionsSearchService interface {
) ([]sdk.Session, int, error)
}
// NewCmdSessions builds `weknora search sessions "<query>"`. Finds chat
// NewCmdSessions builds `academy search sessions "<query>"`. Finds chat
// sessions whose title or description contains the query.
func NewCmdSessions(f *cmdutil.Factory) *cobra.Command {
opts := &SessionsSearchOptions{}
@@ -66,9 +66,9 @@ title or description contains the query (case-insensitive).
By default, --all-pages=true walks every server page until --limit is
reached or the tenant's sessions are exhausted. Pass --all-pages=false
to stop after one page.`,
Example: ` weknora search sessions "onboarding"
weknora search sessions "Q3 review" --limit 3 --format json
weknora search sessions "Q3 review" --all-pages=false`,
Example: ` academy search sessions "onboarding"
academy search sessions "Q3 review" --limit 3 --format json
academy search sessions "Q3 review" --all-pages=false`,
Args: cobra.ExactArgs(1),
RunE: func(c *cobra.Command, args []string) error {
opts.Query = strings.TrimSpace(args[0])
@@ -97,7 +97,7 @@ to stop after one page.`,
cmdutil.SetAgentHelp(cmd, cmdutil.AgentHelp{
UsedFor: "Find chat sessions by title or description (client-side case-insensitive substring match). Results come with meta.count; use --limit to cap and --all-pages=false to stop after one page.",
RequiredFlags: []string{"<query> (positional)"},
Examples: []string{`weknora search sessions "onboarding" --format json`},
Examples: []string{`academy search sessions "onboarding" --format json`},
Output: "envelope.data is an array of Session objects with id, title, updated_at; meta.count is the returned count; meta.has_more=true if more matched than --limit",
})
return cmd
+3 -3
View File
@@ -9,9 +9,9 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/Tencent/WeKnora/cli/internal/cmdutil"
"github.com/Tencent/WeKnora/cli/internal/iostreams"
sdk "github.com/Tencent/WeKnora/client"
"academy/cli/internal/cmdutil"
"academy/cli/internal/iostreams"
sdk "academy/client"
)
type fakeSessionsSearchSvc struct {