@invinite-org/chartlang-cli
v1.3.0
Published
chartlang CLI — compile + scaffold-adapter
Readme
@invinite-org/chartlang-cli
experimental
chartlang CLI — compiles .chart.ts sources via
@invinite-org/chartlang-compiler and scaffolds starter adapter
packages outside the OSS repo.
Install
pnpm add @invinite-org/chartlang-cliOnce installed and built, the chartlang binary is available on
PATH inside the package's bin dir. From the workspace root, use the
pnpm chartlang … script alias defined in the root package.json.
Public surface
Subcommands:
chartlang compile <file...> [--sourcemap[=mode]] [--minify] [--out <dir>]— compiles each.chart.tsfile into the.chart.js+.chart.manifest.json+.chart.d.tstriple. Default writes siblings of each source;--out <dir>redirects them under a single directory.--sourcemap=externaladds a.chart.js.mapsibling. Phase 2+ addslint,bench,docs.chartlang scaffold-adapter <name> [--target <dir>]— generates a starter adapter package outside this repo.namemust be kebab-case (^[a-z][a-z0-9-]*$). Default target is./<name>. Refuses to overwrite a non-empty target.chartlang docs [--ta-source <dir>] [--ta-out <dir>] [--draw-source <dir>] [--draw-out <dir>]— auto-generatesdocs/primitives/ta/<id>.mdperta.*primitive anddocs/primitives/draw/<kebab-kind>.mdperdraw.*kind from the runtime's JSDoc. The Phase-2--source/--outflags retain theirta.*meaning as aliases for--ta-source/--ta-out. CI gate:pnpm docs:gatebyte-diffs the regenerated pages against the committed tree.chartlang pine-convert <input.pine> [--out <path>] [--strict] [--diagnostics-json] [--report] [--bar-interval <ms>] [--bar-index-origin <ms>]— converts a Pine Script v6 file to a chartlang.chart.tsvia@invinite-org/chartlang-pine-converter. Without--outthe source streams to stdout; diagnostics go to stderr (human report) or stdout (--diagnostics-json). Exit codes:0ok,1error diagnostics,2I/O failure,3invalid args.chartlang --help/-h— prints the usage block.
Programmatic surface (re-exported from ./index):
runCli(argv)— async dispatcher used by thebin.tsentryrunCompile(args),runScaffoldAdapter(args),runDocsCommand(args),runHelp(),printHelp(stream?)— individual command runnersrunGenDocs,generateDocsPage,parsePrimitiveSource,GenDocsError,AUTO_GENERATED_HEADER,findRepoRoot— the docs-generator primitives (ta.*)runGenDrawingDocs,generateDrawingDocsPage,parseDrawingSource,DrawingDocInput— the docs-generator primitives (draw.*, Phase 3)
Minimum-viable API call
import { runCli } from "@invinite-org/chartlang-cli";
// Equivalent to: chartlang compile ./demo.chart.ts --sourcemap=external
await runCli(["compile", "./demo.chart.ts", "--sourcemap=external"]);Docs
See docs/reference/.
License
MIT
