Skip to content

Commit 4c530c0

Browse files
committed
housekeep:Backing up local updates to cloud via GitHub for development to continue from another machine
1 parent ac3f1de commit 4c530c0

7 files changed

Lines changed: 888 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,17 @@ Show statistics about the knowledge store.
140140
knowcode stats [--store <path>]
141141
```
142142

143+
### `doctor`
144+
Check whether the local KnowCode setup is ready for daily use.
145+
146+
```bash
147+
knowcode doctor [--store <path>] [--index <path>] [--config <path>] [--mcp] [--json]
148+
```
149+
150+
Checks include strict config loading, required model API keys, knowledge store
151+
schema, semantic index schema/embedding dimensions, artifact disk footprint,
152+
and optionally an MCP stdio handshake.
153+
143154
### `index`
144155
Build a semantic search index for your codebase.
145156

docs/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ Show statistics about the knowledge store.
126126
knowcode stats [--store <path>]
127127
```
128128

129+
### `doctor`
130+
Check whether the local KnowCode setup is ready for daily use.
131+
132+
```bash
133+
knowcode doctor [--store <path>] [--index <path>] [--config <path>] [--mcp] [--json]
134+
```
135+
136+
Checks include strict config loading, required model API keys, knowledge store
137+
schema, semantic index schema/embedding dimensions, artifact disk footprint,
138+
and optionally an MCP stdio handshake.
139+
129140
### `index`
130141
Build a semantic search index for your codebase.
131142

src/knowcode/cli/cli.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,74 @@ def stats(store: str) -> None:
373373
click.echo(f" {kind}: {count}")
374374

375375

376+
@cli.command()
377+
@click.option(
378+
"--store", "-s",
379+
type=click.Path(),
380+
default=".",
381+
help="Path to knowledge store file or directory",
382+
)
383+
@click.option(
384+
"--index", "-i",
385+
"index_path",
386+
type=click.Path(),
387+
help="Path to semantic index directory (default: beside the store)",
388+
)
389+
@click.option(
390+
"--config", "-c",
391+
type=click.Path(),
392+
help="Path to configuration file (aimodels.yaml)",
393+
)
394+
@click.option(
395+
"--max-disk-mb",
396+
type=float,
397+
default=500.0,
398+
show_default=True,
399+
help="Warn if KnowCode artifacts exceed this size.",
400+
)
401+
@click.option(
402+
"--mcp/--no-mcp",
403+
default=False,
404+
help="Spawn the MCP server and verify list_tools plus one tool call.",
405+
)
406+
@click.option(
407+
"--json", "as_json",
408+
is_flag=True,
409+
help="Output the doctor report as JSON.",
410+
)
411+
def doctor(
412+
store: str,
413+
index_path: Optional[str],
414+
config: Optional[str],
415+
max_disk_mb: float,
416+
mcp: bool,
417+
as_json: bool,
418+
) -> None:
419+
"""Check whether the local KnowCode setup is ready."""
420+
from knowcode.doctor import run_doctor
421+
422+
report = run_doctor(
423+
store_path=store,
424+
index_path=index_path,
425+
config_path=config,
426+
max_disk_mb=max_disk_mb,
427+
include_mcp=mcp,
428+
)
429+
430+
if as_json:
431+
click.echo(json.dumps(report.to_dict(), indent=2))
432+
else:
433+
click.echo("KnowCode Doctor")
434+
click.echo("-" * 30)
435+
for check in report.checks:
436+
click.echo(f"[{check.status.upper()}] {check.name}: {check.message}")
437+
if check.hint:
438+
click.echo(f" Hint: {check.hint}")
439+
440+
if not report.ok:
441+
sys.exit(1)
442+
443+
376444
@cli.command()
377445
@click.option(
378446
"--store", "-s",

src/knowcode/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class AppConfig:
3030
"natural_language_models",
3131
"embedding_models",
3232
"reranking_models",
33+
"eval_models",
3334
"config",
3435
}
3536
KNOWN_CONFIG_KEYS = {"sufficiency_threshold"}

0 commit comments

Comments
 (0)