neozip-cli 0.70.0-alpha
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/CHANGELOG.md +72 -0
- package/DOCUMENTATION.md +194 -0
- package/LICENSE +22 -0
- package/README.md +504 -0
- package/WHY_NEOZIP.md +212 -0
- package/bin/neolist +16 -0
- package/bin/neounzip +16 -0
- package/bin/neozip +15 -0
- package/dist/neozipkit-bundles/blockchain.js +13091 -0
- package/dist/neozipkit-bundles/browser.js +5733 -0
- package/dist/neozipkit-bundles/core.js +3766 -0
- package/dist/neozipkit-bundles/server.js +14996 -0
- package/dist/neozipkit-wrappers/blockchain/core/contracts.js +16 -0
- package/dist/neozipkit-wrappers/blockchain/index.js +2 -0
- package/dist/neozipkit-wrappers/core/ZipDecompress.js +2 -0
- package/dist/neozipkit-wrappers/core/components/HashCalculator.js +2 -0
- package/dist/neozipkit-wrappers/core/components/Logger.js +2 -0
- package/dist/neozipkit-wrappers/core/constants/Errors.js +2 -0
- package/dist/neozipkit-wrappers/core/constants/Headers.js +2 -0
- package/dist/neozipkit-wrappers/core/encryption/ZipCrypto.js +7 -0
- package/dist/neozipkit-wrappers/core/index.js +3 -0
- package/dist/neozipkit-wrappers/index.js +13 -0
- package/dist/neozipkit-wrappers/server/index.js +2 -0
- package/dist/src/config/ConfigSetup.js +455 -0
- package/dist/src/config/ConfigStore.js +373 -0
- package/dist/src/config/ConfigWizard.js +453 -0
- package/dist/src/config/WalletConfig.js +372 -0
- package/dist/src/exit-codes.js +210 -0
- package/dist/src/index.js +141 -0
- package/dist/src/neolist.js +1194 -0
- package/dist/src/neounzip.js +2177 -0
- package/dist/src/neozip/CommentManager.js +240 -0
- package/dist/src/neozip/blockchain.js +383 -0
- package/dist/src/neozip/createZip.js +2273 -0
- package/dist/src/neozip/file-operations.js +920 -0
- package/dist/src/neozip/types.js +6 -0
- package/dist/src/neozip/user-interaction.js +256 -0
- package/dist/src/neozip/utils.js +96 -0
- package/dist/src/neozip.js +785 -0
- package/dist/src/server/CommentManager.js +240 -0
- package/dist/src/version.js +59 -0
- package/env.example +101 -0
- package/package.json +175 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* NeoZip CLI - Main Entry Point
|
|
5
|
+
* Routes to the appropriate command based on how the CLI is invoked
|
|
6
|
+
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
/**
|
|
14
|
+
* Determine which command to run based on:
|
|
15
|
+
* 1. The executable name (neozip, neounzip, neolist)
|
|
16
|
+
* 2. The first argument passed
|
|
17
|
+
*/
|
|
18
|
+
function determineCommand() {
|
|
19
|
+
// Get the executable name from the process
|
|
20
|
+
const execName = path_1.default.basename(process.argv[1]);
|
|
21
|
+
// Check if invoked directly as a specific command
|
|
22
|
+
if (execName === 'neounzip') {
|
|
23
|
+
return 'neounzip';
|
|
24
|
+
}
|
|
25
|
+
else if (execName === 'neolist') {
|
|
26
|
+
return 'neolist';
|
|
27
|
+
}
|
|
28
|
+
else if (execName === 'neozip') {
|
|
29
|
+
return 'neozip';
|
|
30
|
+
}
|
|
31
|
+
// Check the first argument for command specification
|
|
32
|
+
const firstArg = process.argv[2];
|
|
33
|
+
if (!firstArg || firstArg === '--help' || firstArg === '-h') {
|
|
34
|
+
return 'help';
|
|
35
|
+
}
|
|
36
|
+
if (firstArg === '--version' || firstArg === '-v') {
|
|
37
|
+
return 'version';
|
|
38
|
+
}
|
|
39
|
+
// Check if first argument is a command name
|
|
40
|
+
if (firstArg === 'neounzip' || firstArg === 'unzip' || firstArg === 'extract') {
|
|
41
|
+
// Remove the command from argv and run neounzip
|
|
42
|
+
process.argv.splice(2, 1);
|
|
43
|
+
return 'neounzip';
|
|
44
|
+
}
|
|
45
|
+
if (firstArg === 'neolist' || firstArg === 'list' || firstArg === 'ls') {
|
|
46
|
+
// Remove the command from argv and run neolist
|
|
47
|
+
process.argv.splice(2, 1);
|
|
48
|
+
return 'neolist';
|
|
49
|
+
}
|
|
50
|
+
if (firstArg === 'neozip' || firstArg === 'zip' || firstArg === 'compress') {
|
|
51
|
+
// Remove the command from argv and run neozip
|
|
52
|
+
process.argv.splice(2, 1);
|
|
53
|
+
return 'neozip';
|
|
54
|
+
}
|
|
55
|
+
// Default to neozip (compression)
|
|
56
|
+
return 'neozip';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Display help information
|
|
60
|
+
*/
|
|
61
|
+
function showHelp() {
|
|
62
|
+
console.log(chalk_1.default.cyan.bold('\n╔════════════════════════════════════════════════════════════════╗'));
|
|
63
|
+
console.log(chalk_1.default.cyan.bold('║ NeoZip CLI ║'));
|
|
64
|
+
console.log(chalk_1.default.cyan.bold('╚════════════════════════════════════════════════════════════════╝\n'));
|
|
65
|
+
console.log(chalk_1.default.white.bold('Full-featured ZIP application with blockchain integration\n'));
|
|
66
|
+
console.log(chalk_1.default.yellow.bold('Usage:'));
|
|
67
|
+
console.log(' neozip [options] <archive> [files...] Compress files');
|
|
68
|
+
console.log(' neounzip [options] <archive> [output] Extract files');
|
|
69
|
+
console.log(' neolist [options] <archive> List contents\n');
|
|
70
|
+
console.log(chalk_1.default.yellow.bold('Commands:'));
|
|
71
|
+
console.log(chalk_1.default.green(' neozip') + ' Compress files into an archive');
|
|
72
|
+
console.log(chalk_1.default.green(' neounzip') + ' Extract files from an archive');
|
|
73
|
+
console.log(chalk_1.default.green(' neolist') + ' List the contents of an archive\n');
|
|
74
|
+
console.log(chalk_1.default.yellow.bold('Options:'));
|
|
75
|
+
console.log(' -h, --help Display help information');
|
|
76
|
+
console.log(' -v, --version Display version information\n');
|
|
77
|
+
console.log(chalk_1.default.yellow.bold('Examples:'));
|
|
78
|
+
console.log(chalk_1.default.gray(' # Compress files'));
|
|
79
|
+
console.log(' neozip output.nzip file1.txt file2.txt folder/\n');
|
|
80
|
+
console.log(chalk_1.default.gray(' # Extract files'));
|
|
81
|
+
console.log(' neounzip output.nzip extracted/\n');
|
|
82
|
+
console.log(chalk_1.default.gray(' # List archive contents'));
|
|
83
|
+
console.log(' neolist output.nzip\n');
|
|
84
|
+
console.log(chalk_1.default.yellow.bold('For detailed help on each command:'));
|
|
85
|
+
console.log(' neozip --help');
|
|
86
|
+
console.log(' neounzip --help');
|
|
87
|
+
console.log(' neolist --help\n');
|
|
88
|
+
console.log(chalk_1.default.blue('Documentation: ') + 'https://neozip.io');
|
|
89
|
+
console.log(chalk_1.default.blue('Issues: ') + 'https://github.com/NeoWareInc/neozip-support/issues');
|
|
90
|
+
console.log(chalk_1.default.blue('Support: ') + 'support@neozip.io\n');
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Display version information
|
|
94
|
+
*/
|
|
95
|
+
function showVersion() {
|
|
96
|
+
// Use version module which handles path resolution correctly
|
|
97
|
+
const { APP_VERSION } = require('./version');
|
|
98
|
+
console.log(chalk_1.default.cyan.bold('NeoZip CLI') + ' version ' + chalk_1.default.yellow(APP_VERSION));
|
|
99
|
+
console.log(chalk_1.default.gray('Node: ') + process.version);
|
|
100
|
+
console.log(chalk_1.default.gray('Platform: ') + process.platform + ' ' + process.arch);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Main entry point
|
|
104
|
+
*/
|
|
105
|
+
async function main() {
|
|
106
|
+
try {
|
|
107
|
+
const command = determineCommand();
|
|
108
|
+
switch (command) {
|
|
109
|
+
case 'help':
|
|
110
|
+
showHelp();
|
|
111
|
+
process.exit(0);
|
|
112
|
+
break;
|
|
113
|
+
case 'version':
|
|
114
|
+
showVersion();
|
|
115
|
+
process.exit(0);
|
|
116
|
+
break;
|
|
117
|
+
case 'neounzip':
|
|
118
|
+
// Import and run neounzip
|
|
119
|
+
await import('./neounzip.js');
|
|
120
|
+
break;
|
|
121
|
+
case 'neolist':
|
|
122
|
+
// Import and run neolist
|
|
123
|
+
await import('./neolist.js');
|
|
124
|
+
break;
|
|
125
|
+
case 'neozip':
|
|
126
|
+
default:
|
|
127
|
+
// Import and run neozip
|
|
128
|
+
await import('./neozip.js');
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
console.error(chalk_1.default.red.bold('\n✗ Error:'), error instanceof Error ? error.message : String(error));
|
|
134
|
+
// Use generic error code for main entry point (application-specific codes handled in sub-apps)
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Export main function for bin files to call
|
|
139
|
+
// Don't auto-run - let the bin files call main() explicitly so they can await it
|
|
140
|
+
exports.default = main;
|
|
141
|
+
//# sourceMappingURL=index.js.map
|