Files
Claude-Code-Monitor/scripts/generate-openapi-yaml.js
T
nntrivi2001 57dc91585d feat: Claude Code Monitor — lanes, pipelines and a merged workspace
Internal SmartGift build of a Claude Code monitoring dashboard.

Lanes: a durable unit of parallel agent work, one per working directory,
tracked across session restarts. Managed lanes are git worktrees the
dashboard provisions and can reset or remove behind a three-check destroy
guard and a counted preflight; adopted lanes are directories you already
own and are never destroyable.

Pipelines: a lane moves through pipeline stages. A stage the agent declares
with evidence renders green; a stage inferred from the tool-event stream
renders dashed amber and never counts as done. Detection is forward-only
within a 30-minute window, and never writes the declared stage.

Workspace: one page at /run with a lane grid, the selected lane's pipeline,
and a full Claude console behind a disclosure.
2026-07-30 14:39:03 +07:00

35 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
/**
* @file Regenerates the repo-root `openapi.yaml` from the single source of
* truth — `createOpenApiSpec()` in `server/openapi.js`. The JSON spec served at
* `/api/openapi.json` and this committed YAML mirror are therefore always in
* sync: run `npm run openapi:yaml` after any spec change. Never hand-edit
* `openapi.yaml`.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
const fs = require("fs");
const path = require("path");
const yaml = require("js-yaml");
const { createOpenApiSpec } = require("../server/openapi");
const OUT = path.join(__dirname, "..", "openapi.yaml");
function main() {
const spec = createOpenApiSpec();
const body = yaml.dump(spec, {
lineWidth: -1, // don't wrap long strings (keeps descriptions/examples intact)
noRefs: true, // inline any shared object references for a portable document
sortKeys: false, // preserve authored key order
});
const header =
"# DO NOT EDIT BY HAND. Generated from server/openapi.js via `npm run openapi:yaml`.\n" +
"# This YAML mirrors the live spec served at GET /api/openapi.json.\n";
fs.writeFileSync(OUT, header + body, "utf8");
const stat = fs.statSync(OUT);
const pathCount = Object.keys(spec.paths || {}).length;
console.log(`Wrote ${OUT} (${pathCount} paths, ${stat.size} bytes).`);
}
main();