feat(cli): add build-web command and official wire file support#1454
Conversation
| @cli.command() | ||
| def print_sdk_setup(): | ||
| """Print Kimi Agent SDK / Wire setup instructions""" | ||
| typer.echo(sdk_setup_text()) |
There was a problem hiding this comment.
🔴 @cli.command() decorator references cli before it is defined, causing NameError on import
The @cli.command() decorator on print_sdk_setup at line 92 references the name cli, but cli = typer.Typer(...) is not defined until line 98. When this module is imported (which happens at src/kimi_cli/cli/__init__.py:14 via from .info import cli as info_cli), Python will raise a NameError: name 'cli' is not defined. This breaks the entire CLI application at startup since the top-level __init__.py cannot complete its imports.
Prompt for agents
In src/kimi_cli/cli/info.py, the @cli.command() decorator on the print_sdk_setup function (line 92) references the variable cli before it is defined on line 98. Move the cli = typer.Typer(...) definition (currently at line 98) to before the @cli.command() decorator on line 92. Specifically, the block starting with 'cli = typer.Typer(help="Show version and protocol information.")' should appear before the '@cli.command()' decorator for print_sdk_setup. The @cli.callback(invoke_without_command=True) for the info function should also remain after the cli definition.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce6e40aa56
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return text | ||
|
|
||
|
|
||
| @cli.command() |
There was a problem hiding this comment.
Define Typer app before registering info subcommand
This decorator is evaluated before cli = typer.Typer(...) is assigned, so importing kimi_cli.cli.info raises NameError at module import time (cli is undefined when evaluating @cli.command()). Since src/kimi_cli/cli/__init__.py imports from .info import cli as info_cli during CLI startup, this breaks startup for the entire kimi command, not only kimi info.
Useful? React with 👍 / 👎.
| ) | ||
|
|
||
|
|
||
| @cli.command() |
There was a problem hiding this comment.
Prevent web callback from running before build subcommand
Adding build as a subcommand under this Typer group makes the new command effectively unusable because the group callback unconditionally starts run_web_server(...) first. In Click/Typer group semantics, the group callback runs before subcommand execution (click.core.Group.invoke calls super().invoke(ctx) before sub_ctx.command.invoke(sub_ctx)), so kimi web build will launch the server and never reach build unless the callback exits early when ctx.invoked_subcommand is set.
Useful? React with 👍 / 👎.
Related Issue
Resolve #(issue_number)
Description
Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.