refactor(cli): drop aiclient package; align AGENTS.md with mainstream
Survey of 10 mainstream CLIs (gh, lark, stripe, vercel, supabase, aws, azure, gcloud, openai/codex, github-copilot-cli) showed env-gated per-command --help blurbs are a Stripe-only pattern; gh uses env detect for telemetry only, and lark relies on installed agent Skills + MCP. Our cmd/mcp/serve already covers the dominant 2025/26 path, so internal/aiclient/ (136 LOC + 38 callsites) is net maintenance burden without precedent. - Drop internal/aiclient/ entirely (annotations + detect + tests) - Remove 38 SetAgentHelp callsites + agentAwareHelpFunc / SetHelpFunc wiring in cmd/root.go - Migrate 4 command-level rules to standard Long help (visible to all, not env-gated): doc upload mode mutex, kb edit at-least-one, kb pin idempotent, search chunks channel mutex - Rewrite AGENTS.md as a developer guide (gh-style 6 H2 / 167 lines): audience preamble + Build / Architecture / Command Structure / Testing / Code Style / Error Handling. Drops sections absent in surveyed projects (Commit & PR Conventions, Who Uses This CLI) - Clean 14 internal doc refs (ADR-N, spec §X, v0.X) in source comments and docs that pointed at docs/superpowers/ — that directory is local-only / uncommitted, so refs are dead for outside readers - Drop forward-looking "once v0.2 ships" from README
This commit is contained in:
@@ -3,7 +3,7 @@ package text
|
||||
// KnowledgeDisplayName picks the most informative human label for a
|
||||
// knowledge entry. File-uploads use FileName; URL / text entries fall
|
||||
// back to Title; the ID is the last-resort placeholder so a table cell
|
||||
// is never empty. Single source for the ordering — `weknora doc list`
|
||||
// is never empty. Single source for the ordering - `weknora doc list`
|
||||
// and `weknora search docs` both call this so a Knowledge renders
|
||||
// identically in either command.
|
||||
//
|
||||
|
||||
@@ -5,8 +5,7 @@ package text
|
||||
import "fmt"
|
||||
|
||||
// Pluralize returns "<n> <thing>" or "<n> <thing>s". Simple suffix "s" only;
|
||||
// irregular forms (person/people) are not supported (add PluralizeIrregular
|
||||
// when needed, per spec §2.1).
|
||||
// irregular forms (person/people) are not supported.
|
||||
func Pluralize(n int, thing string) string {
|
||||
if n == 1 {
|
||||
return fmt.Sprintf("%d %s", n, thing)
|
||||
|
||||
@@ -4,14 +4,14 @@ import "github.com/mattn/go-runewidth"
|
||||
|
||||
const ellipsis = "…"
|
||||
|
||||
// Truncate cuts s to at most maxWidth display columns (CJK / emoji 占 2 列;
|
||||
// ASCII 占 1 列), appending "…" if truncated. Display width, not rune count.
|
||||
// Truncate cuts s to at most maxWidth display columns (CJK / emoji occupy
|
||||
// 2 columns; ASCII 1), appending "…" if truncated. Display width, not rune count.
|
||||
//
|
||||
// Edge cases:
|
||||
//
|
||||
// maxWidth ≤ 0 → ""
|
||||
// s 已 ≤ maxWidth → s 原样返回
|
||||
// ellipsis 占 1 列, 所以 truncate 时 budget = maxWidth - 1
|
||||
// maxWidth <= 0 -> ""
|
||||
// s already fits -> s returned unchanged
|
||||
// ellipsis is 1 column, so truncate budget = maxWidth - 1
|
||||
func Truncate(maxWidth int, s string) string {
|
||||
if maxWidth <= 0 {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user