liminal-docgen
v0.1.0
Published
CLI and library for repository-level documentation generation with analysis, validation, update, and publish flows.
Downloads
92
Maintainers
Readme
Liminal DocGen
Liminal DocGen is a TypeScript rewrite of repository-level documentation generation tooling. It analyzes a codebase, plans documentation modules, generates structured docs through explicit inference providers, validates the output, tracks metadata, supports incremental updates, and can publish results through Git workflows.
This repository is a TypeScript rewrite and port of CodeWiki. It keeps that rewrite relationship explicit while making independent implementation choices in the analysis pipeline, inference-provider system, validation flow, CLI surface, and packaging model.
What Liminal DocGen Does
Liminal DocGen currently supports:
- Native TypeScript structural analysis for JavaScript and TypeScript repositories
- Python-backed fallback analysis when Python is in scope
- Explicit inference-provider selection for generation and review
- Full generation, incremental update, validation, status, and publish flows
- Metadata tracking through
.doc-meta.jsonand.module-plan.json - Provider-backed live tests for:
claude-sdkclaude-cli
Current limitations:
- Provider selection is explicit; there is no automatic provider fallback
- Inference is one-shot and non-streaming
- Usage and cost values are only surfaced when a provider reports them
- Claude-backed OAuth support depends on local Claude CLI authentication state
openrouter-httpis currently unstable in generation flows and should not be relied on for consistent output
Installation and Local Setup
Liminal DocGen requires Node.js 24 or newer.
Install and run it from npm without cloning this repository:
npx liminal-docgen --helpnpm install -g liminal-docgenLiminal DocGen ships as both a CLI and a small programmatic library surface through the package exports. Provider credentials and auth state stay local to your machine or runtime environment; the package does not bundle API keys, OAuth state, or provider secrets.
For local development in this repository, install dependencies:
npm installRun the CLI locally:
npm run dev -- --helpBuild the package:
npm run buildQuick Start
- Create or inspect your config file:
.liminal-docgen.jsonLiminal DocGen still accepts the legacy .docengine.json filename as a fallback, but .liminal-docgen.json is the default moving forward.
- Validate the local environment and provider setup:
npm run dev -- check \
--repo-path /path/to/repo \
--provider claude-cli \
--auth-mode oauth- Generate documentation:
npm run dev -- generate \
--repo-path /path/to/repo \
--provider claude-cli \
--auth-mode oauth- Validate the generated output:
npm run dev -- validate \
--output-path /path/to/repo/docs/wiki- Inspect generation status:
npm run dev -- status \
--repo-path /path/to/repoCLI Commands
Top-level commands:
check— check repository, provider, and auth readinessanalyze— analyze repository structuregenerate— generate documentation with an explicit inference providerupdate— incrementally update documentation with an explicit inference providervalidate— validate generated documentation artifacts and linksstatus— inspect generation status from metadata and current Git statepublish— publish generated documentation to a branch and optional pull request
Get help for any command:
npm run dev -- <command> --helpExamples:
npm run dev -- analyze --repo-path /path/to/reponpm run dev -- check \
--repo-path /path/to/repo \
--provider openrouter-http \
--auth-mode env \
--api-key-env OPENROUTER_API_KEYnpm run dev -- generate \
--repo-path /path/to/repo \
--provider claude-sdk \
--auth-mode env \
--api-key-env ANTHROPIC_API_KEYnpm run dev -- update \
--repo-path /path/to/repo \
--provider claude-cli \
--auth-mode oauthnpm run dev -- status --repo-path /path/to/reponpm run dev -- publish \
--repo-path /path/to/repo \
--create-pr \
--branch-name docs/liminal-updateProvider System and Auth Modes
Supported inference providers:
claude-sdkclaude-cliopenrouter-http
Supported auth modes:
oauthenvapi-key
Provider/auth compatibility:
| Provider | Supported auth modes | Notes |
|---|---|---|
| claude-sdk | oauth, env, api-key | Uses the optional Claude Agent SDK package. OAuth depends on local Claude auth availability. |
| claude-cli | oauth, env, api-key | Uses the claude CLI. OAuth depends on claude auth login. |
| openrouter-http | env, api-key | Stateless HTTP provider. OAuth is not supported. Currently unstable in end-to-end generation and not recommended for production use. |
Recommended local practice:
- Use
claude-cliwithoauthfor the most natural local operator workflow - Use
claude-sdkwhen you specifically want SDK-backed integration behavior - Use
oauthfor Claude-backed providers when you already use the Claude CLI locally - Use
envfor API-key-backed flows - Do not store raw API keys in
.liminal-docgen.json - Avoid
openrouter-httpfor reliable end-to-end generation until it stabilizes
Usage and cost behavior:
usageandcostUsdare provider-reported only- When a provider does not expose one of those values, Liminal DocGen returns
null - Liminal DocGen does not estimate missing cost values
Configuration File Reference
Default config filename:
.liminal-docgen.jsonLegacy fallback:
.docengine.jsonComplete example:
{
"outputPath": "docs/wiki",
"includePatterns": ["src/**"],
"excludePatterns": ["**/dist/**", "**/*.snap"],
"focusDirs": ["src/core", "src/api"],
"inference": {
"provider": "claude-cli",
"auth": {
"mode": "env",
"apiKeyEnvVar": "ANTHROPIC_API_KEY"
},
"model": "claude-sonnet-4-6"
}
}Field reference:
outputPath- Relative or absolute output directory for generated docs
- Defaults to
docs/wiki
includePatterns- Optional glob patterns to include in structural analysis
excludePatterns- Optional glob patterns to exclude from structural analysis
focusDirs- Optional directories to scope analysis more tightly
inference.provider- Required for generation/update flows
- One of
claude-sdk,claude-cli,openrouter-http
inference.auth.modeoauth,env- Config-file auth intentionally omits raw API key persistence
inference.auth.apiKeyEnvVar- Optional env var name override for env-based API key flows
inference.model- Optional provider model override
- When omitted, providers use their normal default selection behavior
- For
claude-sdkandclaude-cli, this value is a Claude provider-specific model selector such asdefault,sonnet, oropus - For
openrouter-http, this value is an OpenRouter model slug such asopenai/gpt-4o-mini
Notes:
- Raw API keys are not intended to be stored in the project config file
- CLI flags and programmatic usage can still provide provider/auth/runtime inputs directly
- Programmatic/library callers may pass explicit API-key values at runtime where supported
Common Workflows
Check provider and repository readiness
npm run dev -- check \
--repo-path /path/to/repo \
--provider claude-sdk \
--auth-mode oauthAnalyze a repository without generating docs
npm run dev -- analyze \
--repo-path /path/to/repo \
--include src/** \
--exclude '**/*.test.ts'Generate docs with OpenRouter
npm run dev -- generate \
--repo-path /path/to/repo \
--provider openrouter-http \
--auth-mode env \
--api-key-env OPENROUTER_API_KEY \
--model openai/gpt-4o-miniIncrementally update docs
npm run dev -- update \
--repo-path /path/to/repo \
--provider claude-cli \
--auth-mode oauthValidate generated docs
npm run dev -- validate \
--output-path /path/to/repo/docs/wikiInspect metadata-backed status
npm run dev -- status \
--repo-path /path/to/repoPublish docs to a branch and PR
npm run dev -- publish \
--repo-path /path/to/repo \
--branch-name docs/liminal-update \
--create-pr \
--pr-title "docs: update generated documentation"Output Structure
By default, Liminal DocGen writes output to:
docs/wikiGenerated artifacts include:
overview.md- top-level repository overview
module-tree.json- tree of generated module pages
- one markdown page per planned module
- for example
core.md,api-layer.md,utilities.md
- for example
.doc-meta.json- generation metadata such as commit hash, generation time, and generated files
.module-plan.json- persisted module plan used for update mode
Testing and Verification
Deterministic verification:
npm run typecheck
npm test
npm run test:integrationLive provider-backed verification:
- Fill in
.env.local - Load it into your shell:
set -a
source .env.local
set +a- Run:
npm run test:liveWhat the live tests cover:
claude-sdkwith OAuth-backed local authclaude-sdkwith API-key-backed authclaude-cliwith OAuth-backed local authclaude-cliwith API-key-backed auth- explicit CLI shell generation with
claude-cli - live publish flow
openrouter-http remains available in the codebase and CLI surface, but it is currently unstable in end-to-end generation. It is not part of the live smoke gate and is not recommended for reliable use right now.
Publishing Workflow
publish expects generated documentation to already exist in the target output directory.
The publish flow:
- validates output and metadata presence
- creates a temporary worktree
- creates or checks out a publish branch
- stages generated docs
- commits the docs
- pushes the branch
- optionally creates a pull request with
gh
Typical example:
npm run dev -- publish \
--repo-path /path/to/repo \
--branch-name docs/liminal-update \
--base-branch main \
--create-pr \
--pr-title "docs: update generated documentation"Rewrite Attribution and License
Liminal DocGen is a TypeScript rewrite and port of CodeWiki.
This repository acknowledges the upstream CodeWiki project as the basis for the rewrite and keeps that relationship explicit in:
README.mdNOTICELICENSE
License:
