Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ codenib doctor --require core --require wiki
codenib index /path/to/repository
```

Export that indexed commit as a serverless Wiki when a live Ask backend is not
needed:

```bash
codenib export /path/to/repository --output /tmp/repository-wiki
```

The export contains a versioned provenance manifest, precomputed Wiki pages,
source citations, and available page-level dependency data. It contains no
provider credential; interactive Ask and runtime graph exploration remain on
the local or MCP serving path.

See the
[Quickstart](https://docs.codenib.ai/quickstart/)
for ports, advanced indexing, and troubleshooting.
Expand Down
50 changes: 50 additions & 0 deletions codenib/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,35 @@ def _run_mcp(args: argparse.Namespace) -> int:
return 0


def _run_export(args: argparse.Namespace) -> int:
repo_path = resolve_repo_path(args.repo)
manifest_path = resolve_manifest_path(str(repo_path))
output_dir = (
Path(args.output).expanduser().resolve()
if args.output
else manifest_path.parent / "static-wiki"
)

from .web.static_export import export_static_wiki

try:
result = export_static_wiki(
repo_path,
manifest_path,
output_dir,
frontend_dir=args.frontend_dir,
base_path=args.base_path,
)
except (OSError, RuntimeError, ValueError) as exc:
raise CLIError(str(exc)) from exc

print(f"Static Wiki: {result.output_dir}")
print(f"Repository: {result.repo_id}")
print(f"Pages: {result.page_count}")
print(f"Manifest: {result.manifest_path}")
return 0


def _model_options_for_args(
args: argparse.Namespace,
*,
Expand Down Expand Up @@ -976,6 +1005,27 @@ def build_parser() -> argparse.ArgumentParser:
)
wiki_parser.set_defaults(handler=_run_wiki)

export_parser = subparsers.add_parser(
"export",
help="export an indexed repository Wiki for static hosting",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
)
export_parser.add_argument("repo", nargs="?", default=".")
export_parser.add_argument(
"--output",
help="output directory; defaults beside the repository manifest",
)
export_parser.add_argument(
"--base-path",
default="/",
help="URL path where the static site will be mounted",
)
export_parser.add_argument(
"--frontend-dir",
help="path to a prebuilt CodeNib frontend or web source checkout",
)
export_parser.set_defaults(handler=_run_export)

mcp_parser = subparsers.add_parser(
"mcp",
help="serve an indexed repository over MCP stdio",
Expand Down
Loading
Loading