@deepnote/cli 0.1.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.
- package/LICENSE +201 -0
- package/README.md +387 -0
- package/dist/bin.cjs +7 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +8 -0
- package/dist/cli-BDKrMj8W.js +5350 -0
- package/dist/cli-DwaGOOLX.cjs +5452 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +113 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +3 -0
- package/package.json +68 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_cli = require('./cli-DwaGOOLX.cjs');
|
|
2
|
+
|
|
3
|
+
exports.ExitCode = require_cli.ExitCode;
|
|
4
|
+
exports.FileResolutionError = require_cli.FileResolutionError;
|
|
5
|
+
exports.createProgram = require_cli.createProgram;
|
|
6
|
+
exports.getOutputConfig = require_cli.getOutputConfig;
|
|
7
|
+
exports.resetOutputConfig = require_cli.resetOutputConfig;
|
|
8
|
+
exports.resolvePathToDeepnoteFile = require_cli.resolvePathToDeepnoteFile;
|
|
9
|
+
exports.run = require_cli.run;
|
|
10
|
+
exports.setOutputConfig = require_cli.setOutputConfig;
|
|
11
|
+
exports.shouldDisableColor = require_cli.shouldDisableColor;
|
|
12
|
+
exports.version = require_cli.version;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
|
|
3
|
+
//#region src/cli.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Global CLI options that apply to all commands.
|
|
7
|
+
*/
|
|
8
|
+
interface GlobalOptions {
|
|
9
|
+
color: boolean;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
quiet: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates and configures the main CLI program.
|
|
15
|
+
*/
|
|
16
|
+
declare function createProgram(): Command;
|
|
17
|
+
/**
|
|
18
|
+
* Parses command line arguments and runs the CLI.
|
|
19
|
+
* This is the main entry point for the CLI.
|
|
20
|
+
*/
|
|
21
|
+
declare function run(argv?: string[]): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/exit-codes.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Standard exit codes for the Deepnote CLI.
|
|
26
|
+
*
|
|
27
|
+
* These follow common Unix conventions:
|
|
28
|
+
* - 0: Success
|
|
29
|
+
* - 1: General errors
|
|
30
|
+
* - 2: Invalid usage (bad arguments, missing files, etc.)
|
|
31
|
+
*
|
|
32
|
+
* @see https://tldp.org/LDP/abs/html/exitcodes.html
|
|
33
|
+
*/
|
|
34
|
+
declare const ExitCode: {
|
|
35
|
+
/** Command completed successfully */
|
|
36
|
+
readonly Success: 0;
|
|
37
|
+
/** General error (runtime failures, unexpected errors) */
|
|
38
|
+
readonly Error: 1;
|
|
39
|
+
/** Invalid usage (bad arguments, invalid file type, file not found) */
|
|
40
|
+
readonly InvalidUsage: 2;
|
|
41
|
+
};
|
|
42
|
+
type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/output.d.ts
|
|
45
|
+
/**
|
|
46
|
+
* Global output configuration for the CLI.
|
|
47
|
+
* Controls color output, verbosity, and quiet mode.
|
|
48
|
+
*/
|
|
49
|
+
interface OutputConfig {
|
|
50
|
+
/** Whether to use colored output */
|
|
51
|
+
color: boolean;
|
|
52
|
+
/** Whether to show debug/verbose output */
|
|
53
|
+
debug: boolean;
|
|
54
|
+
/** Whether to suppress non-essential output */
|
|
55
|
+
quiet: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the current output configuration.
|
|
59
|
+
* Returns a copy to prevent external mutations from affecting internal state.
|
|
60
|
+
*/
|
|
61
|
+
declare function getOutputConfig(): Readonly<OutputConfig>;
|
|
62
|
+
/**
|
|
63
|
+
* Update the output configuration.
|
|
64
|
+
*/
|
|
65
|
+
declare function setOutputConfig(config: Partial<OutputConfig>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Reset output configuration to defaults.
|
|
68
|
+
* Useful for testing.
|
|
69
|
+
*/
|
|
70
|
+
declare function resetOutputConfig(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Check if colors should be disabled based on environment.
|
|
73
|
+
* Respects NO_COLOR and FORCE_COLOR standards.
|
|
74
|
+
*
|
|
75
|
+
* @see https://no-color.org/
|
|
76
|
+
* @see https://force-color.org/
|
|
77
|
+
*/
|
|
78
|
+
declare function shouldDisableColor(): boolean;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/utils/file-resolver.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* Error thrown when file resolution fails (invalid path, wrong extension, etc.)
|
|
83
|
+
* This is a user input error, not a runtime error.
|
|
84
|
+
*/
|
|
85
|
+
declare class FileResolutionError extends Error {
|
|
86
|
+
constructor(message: string);
|
|
87
|
+
}
|
|
88
|
+
interface ResolvedFile {
|
|
89
|
+
absolutePath: string;
|
|
90
|
+
}
|
|
91
|
+
interface ResolveDeepnoteFileOptions {
|
|
92
|
+
/** Custom error message when no .deepnote files are found */
|
|
93
|
+
noFilesFoundMessage?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolves and validates a .deepnote file path.
|
|
97
|
+
*
|
|
98
|
+
* Smart resolution behavior:
|
|
99
|
+
* - No path: finds first .deepnote file in current directory
|
|
100
|
+
* - Directory path: finds first .deepnote file in that directory
|
|
101
|
+
* - File path: validates it's a .deepnote file
|
|
102
|
+
*
|
|
103
|
+
* @param path - Optional path to a .deepnote file or directory (relative or absolute)
|
|
104
|
+
* @param options - Optional configuration
|
|
105
|
+
* @returns The resolved absolute path
|
|
106
|
+
* @throws FileResolutionError if no .deepnote file found or file is invalid
|
|
107
|
+
*/
|
|
108
|
+
declare function resolvePathToDeepnoteFile(path: string | undefined, options?: ResolveDeepnoteFileOptions): Promise<ResolvedFile>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/version.d.ts
|
|
111
|
+
declare const version: string;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { ExitCode, type ExitCode as ExitCodeType, FileResolutionError, type GlobalOptions, type OutputConfig, createProgram, getOutputConfig, resetOutputConfig, resolvePathToDeepnoteFile, run, setOutputConfig, shouldDisableColor, version };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
|
|
4
|
+
//#region src/cli.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Global CLI options that apply to all commands.
|
|
7
|
+
*/
|
|
8
|
+
interface GlobalOptions {
|
|
9
|
+
color: boolean;
|
|
10
|
+
debug: boolean;
|
|
11
|
+
quiet: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates and configures the main CLI program.
|
|
15
|
+
*/
|
|
16
|
+
declare function createProgram(): Command;
|
|
17
|
+
/**
|
|
18
|
+
* Parses command line arguments and runs the CLI.
|
|
19
|
+
* This is the main entry point for the CLI.
|
|
20
|
+
*/
|
|
21
|
+
declare function run(argv?: string[]): void;
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/exit-codes.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Standard exit codes for the Deepnote CLI.
|
|
26
|
+
*
|
|
27
|
+
* These follow common Unix conventions:
|
|
28
|
+
* - 0: Success
|
|
29
|
+
* - 1: General errors
|
|
30
|
+
* - 2: Invalid usage (bad arguments, missing files, etc.)
|
|
31
|
+
*
|
|
32
|
+
* @see https://tldp.org/LDP/abs/html/exitcodes.html
|
|
33
|
+
*/
|
|
34
|
+
declare const ExitCode: {
|
|
35
|
+
/** Command completed successfully */
|
|
36
|
+
readonly Success: 0;
|
|
37
|
+
/** General error (runtime failures, unexpected errors) */
|
|
38
|
+
readonly Error: 1;
|
|
39
|
+
/** Invalid usage (bad arguments, invalid file type, file not found) */
|
|
40
|
+
readonly InvalidUsage: 2;
|
|
41
|
+
};
|
|
42
|
+
type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/output.d.ts
|
|
45
|
+
/**
|
|
46
|
+
* Global output configuration for the CLI.
|
|
47
|
+
* Controls color output, verbosity, and quiet mode.
|
|
48
|
+
*/
|
|
49
|
+
interface OutputConfig {
|
|
50
|
+
/** Whether to use colored output */
|
|
51
|
+
color: boolean;
|
|
52
|
+
/** Whether to show debug/verbose output */
|
|
53
|
+
debug: boolean;
|
|
54
|
+
/** Whether to suppress non-essential output */
|
|
55
|
+
quiet: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the current output configuration.
|
|
59
|
+
* Returns a copy to prevent external mutations from affecting internal state.
|
|
60
|
+
*/
|
|
61
|
+
declare function getOutputConfig(): Readonly<OutputConfig>;
|
|
62
|
+
/**
|
|
63
|
+
* Update the output configuration.
|
|
64
|
+
*/
|
|
65
|
+
declare function setOutputConfig(config: Partial<OutputConfig>): void;
|
|
66
|
+
/**
|
|
67
|
+
* Reset output configuration to defaults.
|
|
68
|
+
* Useful for testing.
|
|
69
|
+
*/
|
|
70
|
+
declare function resetOutputConfig(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Check if colors should be disabled based on environment.
|
|
73
|
+
* Respects NO_COLOR and FORCE_COLOR standards.
|
|
74
|
+
*
|
|
75
|
+
* @see https://no-color.org/
|
|
76
|
+
* @see https://force-color.org/
|
|
77
|
+
*/
|
|
78
|
+
declare function shouldDisableColor(): boolean;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/utils/file-resolver.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* Error thrown when file resolution fails (invalid path, wrong extension, etc.)
|
|
83
|
+
* This is a user input error, not a runtime error.
|
|
84
|
+
*/
|
|
85
|
+
declare class FileResolutionError extends Error {
|
|
86
|
+
constructor(message: string);
|
|
87
|
+
}
|
|
88
|
+
interface ResolvedFile {
|
|
89
|
+
absolutePath: string;
|
|
90
|
+
}
|
|
91
|
+
interface ResolveDeepnoteFileOptions {
|
|
92
|
+
/** Custom error message when no .deepnote files are found */
|
|
93
|
+
noFilesFoundMessage?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolves and validates a .deepnote file path.
|
|
97
|
+
*
|
|
98
|
+
* Smart resolution behavior:
|
|
99
|
+
* - No path: finds first .deepnote file in current directory
|
|
100
|
+
* - Directory path: finds first .deepnote file in that directory
|
|
101
|
+
* - File path: validates it's a .deepnote file
|
|
102
|
+
*
|
|
103
|
+
* @param path - Optional path to a .deepnote file or directory (relative or absolute)
|
|
104
|
+
* @param options - Optional configuration
|
|
105
|
+
* @returns The resolved absolute path
|
|
106
|
+
* @throws FileResolutionError if no .deepnote file found or file is invalid
|
|
107
|
+
*/
|
|
108
|
+
declare function resolvePathToDeepnoteFile(path: string | undefined, options?: ResolveDeepnoteFileOptions): Promise<ResolvedFile>;
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region src/version.d.ts
|
|
111
|
+
declare const version: string;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { ExitCode, type ExitCode as ExitCodeType, FileResolutionError, type GlobalOptions, type OutputConfig, createProgram, getOutputConfig, resetOutputConfig, resolvePathToDeepnoteFile, run, setOutputConfig, shouldDisableColor, version };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as resolvePathToDeepnoteFile, c as setOutputConfig, i as FileResolutionError, l as shouldDisableColor, n as run, o as getOutputConfig, r as version, s as resetOutputConfig, t as createProgram, u as ExitCode } from "./cli-BDKrMj8W.js";
|
|
2
|
+
|
|
3
|
+
export { ExitCode, FileResolutionError, createProgram, getOutputConfig, resetOutputConfig, resolvePathToDeepnoteFile, run, setOutputConfig, shouldDisableColor, version };
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepnote/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line interface for running Deepnote projects locally and on Deepnote Cloud",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"deepnote",
|
|
8
|
+
"notebook",
|
|
9
|
+
"data-science"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/deepnote/deepnote.git",
|
|
14
|
+
"directory": "packages/cli"
|
|
15
|
+
},
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.cjs",
|
|
26
|
+
"module": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"bin": {
|
|
29
|
+
"deepnote": "./dist/bin.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"package.json"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@shikijs/cli": "^3.21.0",
|
|
39
|
+
"@toon-format/toon": "^2.1.0",
|
|
40
|
+
"chalk": "^5.4.1",
|
|
41
|
+
"commander": "^14.0.2",
|
|
42
|
+
"diff": "^8.0.3",
|
|
43
|
+
"dotenv": "^17.2.3",
|
|
44
|
+
"ora": "^9.0.0",
|
|
45
|
+
"wrap-ansi": "^9.0.2",
|
|
46
|
+
"yaml": "^2.8.1",
|
|
47
|
+
"zod": "3.25.76",
|
|
48
|
+
"@deepnote/blocks": "4.0.0",
|
|
49
|
+
"@deepnote/database-integrations": "1.4.2",
|
|
50
|
+
"@deepnote/convert": "3.0.0",
|
|
51
|
+
"@deepnote/reactivity": "1.1.0",
|
|
52
|
+
"@deepnote/runtime-core": "0.1.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"tsx": "^4.20.6",
|
|
56
|
+
"zod-to-json-schema": "^3.25.1"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public",
|
|
60
|
+
"registry": "https://registry.npmjs.org"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"dev": "tsx src/bin.ts",
|
|
65
|
+
"test": "vitest",
|
|
66
|
+
"watch": "tsdown --watch"
|
|
67
|
+
}
|
|
68
|
+
}
|