airgen-cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { output, isJsonMode } from "../output.js";
|
|
3
3
|
export function registerImportExportCommands(program, client) {
|
|
4
4
|
const imp = program.command("import").description("Import requirements");
|
|
@@ -63,4 +63,20 @@ export function registerImportExportCommands(program, client) {
|
|
|
63
63
|
output(data);
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
+
exp
|
|
67
|
+
.command("documents")
|
|
68
|
+
.description("Export complete document set as ReqIF or Excel (includes sections, requirements, trace links, linksets)")
|
|
69
|
+
.argument("<tenant>", "Tenant slug")
|
|
70
|
+
.argument("<project>", "Project slug")
|
|
71
|
+
.option("--format <fmt>", "Format: reqif, excel", "reqif")
|
|
72
|
+
.option("-o, --output <file>", "Output file path")
|
|
73
|
+
.action(async (tenant, project, opts) => {
|
|
74
|
+
const format = opts.format === "excel" ? "excel" : "reqif";
|
|
75
|
+
const ext = format === "excel" ? "xlsx" : "reqif";
|
|
76
|
+
const outPath = opts.output ?? `${project}.${ext}`;
|
|
77
|
+
console.error(`Exporting documents as ${format}...`);
|
|
78
|
+
const { data } = await client.fetchBinary(`/documents-export/${tenant}/${project}?format=${format}`);
|
|
79
|
+
writeFileSync(outPath, data);
|
|
80
|
+
console.log(`Exported to ${outPath} (${(data.length / 1024).toFixed(1)} KB)`);
|
|
81
|
+
});
|
|
66
82
|
}
|