@dataparade/cli 0.0.4 → 0.0.5

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",
package/dist/src/cli.js CHANGED
@@ -371,11 +371,14 @@ function createProgram() {
371
371
  }
372
372
  if (diagramGraph) {
373
373
  const dataflowOutputPath = path_1.default.resolve(process.cwd(), options.output ?? "dataflow.json");
374
+ const resolvedProjectName = config.projectName?.trim() ||
375
+ path_1.default.basename(scanEntry.scanRootDir);
374
376
  try {
375
377
  (0, json_1.writeDataflowJson)({
376
378
  scanResult,
377
379
  graph: diagramGraph,
378
380
  outputPath: dataflowOutputPath,
381
+ projectName: resolvedProjectName,
379
382
  });
380
383
  // Always print a short message so non-interactive callers and
381
384
  // tests can rely on it.
@@ -392,11 +395,11 @@ function createProgram() {
392
395
  else {
393
396
  try {
394
397
  const { runDataflowUpload } = await Promise.resolve().then(() => __importStar(require("./upload/run-upload")));
395
- const dataflowWrapper = (0, json_1.buildDataflowWrapper)(scanResult, diagramGraph);
398
+ const dataflowWrapper = (0, json_1.buildDataflowWrapper)(scanResult, diagramGraph, { projectName: resolvedProjectName });
396
399
  await runDataflowUpload({
397
400
  apiKey: uploadApiKey,
398
401
  dataflow: dataflowWrapper,
399
- projectName: config.projectName,
402
+ projectName: resolvedProjectName,
400
403
  scanJobId: cliQuotaJobId,
401
404
  logPrefix: "[scan]",
402
405
  });
@@ -10,6 +10,8 @@ export interface BuildDataflowWrapperOptions {
10
10
  * dataflow.json schema version.
11
11
  */
12
12
  schemaVersion?: string;
13
+ /** Assessment / project name shown in the dashboard import preview. */
14
+ projectName?: string;
13
15
  }
14
16
  /**
15
17
  * Assemble the top-level `dataflow.json` wrapper object from a scan result and graph.
@@ -35,6 +37,8 @@ export interface WriteDataflowJsonOptions {
35
37
  * Optional schema version to pass through to `buildDataflowWrapper`.
36
38
  */
37
39
  schemaVersion?: string;
40
+ /** Assessment / project name stored in wrapper metadata for upload and preview. */
41
+ projectName?: string;
38
42
  }
39
43
  /**
40
44
  * Validate and write a `dataflow.json` wrapper to disk.
@@ -15,11 +15,13 @@ const dataflow_wrapper_schema_1 = require("../core/schema/dataflow-wrapper.schem
15
15
  */
16
16
  function buildDataflowWrapper(scanResult, graph, options = {}) {
17
17
  const schemaVersion = options.schemaVersion ?? "1.0";
18
+ const projectName = options.projectName?.trim();
18
19
  const metadata = {
19
20
  componentsCount: scanResult.components.length,
20
21
  dataFlowsCount: scanResult.dataFlows.length,
21
22
  filesScanned: scanResult.filesScanned,
22
23
  scanDurationMs: scanResult.scanDurationMs,
24
+ ...(projectName ? { projectName } : {}),
23
25
  };
24
26
  if (scanResult.aiInferenceSummary) {
25
27
  metadata.aiInference =
@@ -47,8 +49,11 @@ function buildDataflowWrapper(scanResult, graph, options = {}) {
47
49
  * can emit a non-zero exit code.
48
50
  */
49
51
  function writeDataflowJson(options) {
50
- const { scanResult, graph, outputPath, schemaVersion } = options;
51
- const wrapper = buildDataflowWrapper(scanResult, graph, { schemaVersion });
52
+ const { scanResult, graph, outputPath, schemaVersion, projectName } = options;
53
+ const wrapper = buildDataflowWrapper(scanResult, graph, {
54
+ schemaVersion,
55
+ projectName,
56
+ });
52
57
  const validation = (0, dataflow_wrapper_schema_1.validateDataflowJson)(wrapper);
53
58
  if (!validation.ok) {
54
59
  const messages = validation.errors.join("; ");
@@ -16,7 +16,9 @@ describe("output/json - DP-P0-CLI-403", () => {
16
16
  const config = (0, orchestrator_1.createDefaultScanConfiguration)();
17
17
  const { scanResult } = await (0, orchestrator_1.scan)(fixturesRoot, config);
18
18
  const graph = (0, graph_mapping_1.buildDiagramGraphFromScanResult)(scanResult);
19
- const wrapper = (0, json_1.buildDataflowWrapper)(scanResult, graph);
19
+ const wrapper = (0, json_1.buildDataflowWrapper)(scanResult, graph, {
20
+ projectName: "typescript-basic",
21
+ });
20
22
  const validation = (0, dataflow_wrapper_schema_1.validateDataflowJson)(wrapper);
21
23
  expect(validation.ok).toBe(true);
22
24
  if (!validation.ok) {
@@ -26,6 +28,7 @@ describe("output/json - DP-P0-CLI-403", () => {
26
28
  expect(validation.value.metadata?.dataFlowsCount).toBe(scanResult.dataFlows.length);
27
29
  expect(validation.value.metadata?.filesScanned).toBe(scanResult.filesScanned);
28
30
  expect(validation.value.metadata?.scanDurationMs).toBe(scanResult.scanDurationMs);
31
+ expect(validation.value.metadata?.projectName).toBe("typescript-basic");
29
32
  const outputPath = path_1.default.join(os_1.default.tmpdir(), `dataparade-dataflow-${Date.now()}.json`);
30
33
  (0, json_1.writeDataflowJson)({
31
34
  scanResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataparade/cli",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "dataPARADE CLI — scan codebases for privacy and security data flows",
5
5
  "publishConfig": {
6
6
  "access": "public",