MCPcopy Index your code
hub / github.com/deepnote/deepnote / buildInspectResult

Function buildInspectResult

packages/cli/src/commands/inspect.ts:59–87  ·  view source on GitHub ↗

* Build inspect result data structure for machine-readable output.

(absolutePath: string, deepnoteFile: ReturnType<typeof deserializeDeepnoteFile>)

Source from the content-addressed store, hash-verified

57 * Build inspect result data structure for machine-readable output.
58 */
59function buildInspectResult(absolutePath: string, deepnoteFile: ReturnType<typeof deserializeDeepnoteFile>) {
60 const { project, metadata, version: fileVersion } = deepnoteFile
61 const notebooks = project.notebooks
62 const totalBlocks = notebooks.reduce((sum, notebook) => sum + notebook.blocks.length, 0)
63
64 return {
65 success: true,
66 path: absolutePath,
67 project: {
68 name: project.name,
69 id: project.id,
70 },
71 version: fileVersion,
72 metadata: {
73 createdAt: metadata.createdAt,
74 modifiedAt: metadata.modifiedAt ?? null,
75 exportedAt: metadata.exportedAt ?? null,
76 },
77 statistics: {
78 notebookCount: notebooks.length,
79 totalBlocks,
80 },
81 notebooks: notebooks.map(notebook => ({
82 name: notebook.name,
83 blockCount: notebook.blocks.length,
84 isModule: notebook.isModule ?? false,
85 })),
86 }
87}
88
89/**
90 * Output inspect results as JSON for scripting.

Callers 2

outputInspectJsonFunction · 0.85
outputInspectToonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected