@ciphrix/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.
Files changed (63) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +201 -0
  3. package/dist/actions.d.ts +19 -0
  4. package/dist/actions.js +30 -0
  5. package/dist/api.d.ts +27 -0
  6. package/dist/api.js +180 -0
  7. package/dist/banner.d.ts +2 -0
  8. package/dist/banner.js +12 -0
  9. package/dist/browser.d.ts +2 -0
  10. package/dist/browser.js +44 -0
  11. package/dist/cli.d.ts +14 -0
  12. package/dist/cli.js +1579 -0
  13. package/dist/commands/asset.d.ts +59 -0
  14. package/dist/commands/asset.js +237 -0
  15. package/dist/commands/check.d.ts +30 -0
  16. package/dist/commands/check.js +182 -0
  17. package/dist/commands/context.d.ts +23 -0
  18. package/dist/commands/context.js +102 -0
  19. package/dist/commands/control.d.ts +44 -0
  20. package/dist/commands/control.js +189 -0
  21. package/dist/commands/framework.d.ts +40 -0
  22. package/dist/commands/framework.js +181 -0
  23. package/dist/commands/job.d.ts +16 -0
  24. package/dist/commands/job.js +30 -0
  25. package/dist/commands/login.d.ts +12 -0
  26. package/dist/commands/login.js +54 -0
  27. package/dist/commands/logout.d.ts +9 -0
  28. package/dist/commands/logout.js +56 -0
  29. package/dist/commands/policy.d.ts +23 -0
  30. package/dist/commands/policy.js +112 -0
  31. package/dist/commands/policyActions.d.ts +37 -0
  32. package/dist/commands/policyActions.js +177 -0
  33. package/dist/commands/risk.d.ts +51 -0
  34. package/dist/commands/risk.js +289 -0
  35. package/dist/commands/test.d.ts +54 -0
  36. package/dist/commands/test.js +331 -0
  37. package/dist/commands/vendor.d.ts +45 -0
  38. package/dist/commands/vendor.js +218 -0
  39. package/dist/config.d.ts +12 -0
  40. package/dist/config.js +56 -0
  41. package/dist/constants.d.ts +7 -0
  42. package/dist/constants.js +7 -0
  43. package/dist/credentials.d.ts +19 -0
  44. package/dist/credentials.js +182 -0
  45. package/dist/deviceFlow.d.ts +32 -0
  46. package/dist/deviceFlow.js +115 -0
  47. package/dist/deviceInfo.d.ts +11 -0
  48. package/dist/deviceInfo.js +25 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.js +4 -0
  51. package/dist/io.d.ts +46 -0
  52. package/dist/io.js +99 -0
  53. package/dist/output.d.ts +14 -0
  54. package/dist/output.js +37 -0
  55. package/dist/theme.d.ts +25 -0
  56. package/dist/theme.js +39 -0
  57. package/dist/toolSurface.d.ts +20 -0
  58. package/dist/toolSurface.js +49 -0
  59. package/dist/upload.d.ts +18 -0
  60. package/dist/upload.js +115 -0
  61. package/package.json +71 -0
  62. package/skills/ciphrix/SKILL.md +169 -0
  63. package/skills/ciphrix/references/commands.md +1592 -0
package/dist/banner.js ADDED
@@ -0,0 +1,12 @@
1
+ import { CLI_VERSION } from './constants.js';
2
+ // Shown only for a bare `ciphrix` invocation, never for a command.
3
+ const BANNER_ART = [
4
+ ' ██████╗██╗██████╗ ██╗ ██╗██████╗ ██╗██╗ ██╗',
5
+ ' ██╔════╝██║██╔══██╗██║ ██║██╔══██╗██║╚██╗██╔╝',
6
+ ' ██║ ██║██████╔╝███████║██████╔╝██║ ╚███╔╝ ',
7
+ ' ██║ ██║██╔═══╝ ██╔══██║██╔══██╗██║ ██╔██╗ ',
8
+ ' ╚██████╗██║██║ ██║ ██║██║ ██║██║██╔╝ ██╗',
9
+ ' ╚═════╝╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝',
10
+ ].join('\n');
11
+ const TAGLINE = 'C i p h r i x c o m p l i a n c e C L I';
12
+ export const formatBanner = (theme) => [theme.cyan(theme.bold(BANNER_ART)), theme.dim(`${TAGLINE} v${CLI_VERSION}`)].join('\n');
@@ -0,0 +1,2 @@
1
+ /** Opens an HTTP(S) URL in the user's default browser without invoking a shell. */
2
+ export declare const openInBrowser: (value: string, platform?: NodeJS.Platform) => Promise<boolean>;
@@ -0,0 +1,44 @@
1
+ import { spawn } from 'node:child_process';
2
+ /** Opens an HTTP(S) URL in the user's default browser without invoking a shell. */
3
+ export const openInBrowser = (value, platform = process.platform) => {
4
+ let url;
5
+ try {
6
+ url = new URL(value);
7
+ }
8
+ catch {
9
+ return Promise.resolve(false);
10
+ }
11
+ const isLoopback = url.hostname === 'localhost' ||
12
+ url.hostname === '[::1]' ||
13
+ /^127(?:\.\d{1,3}){3}$/.test(url.hostname);
14
+ if ((url.protocol !== 'https:' && !(url.protocol === 'http:' && isLoopback)) ||
15
+ url.username ||
16
+ url.password) {
17
+ return Promise.resolve(false);
18
+ }
19
+ const commands = {
20
+ darwin: ['open', [url.href]],
21
+ linux: ['xdg-open', [url.href]],
22
+ win32: ['rundll32.exe', ['url.dll,FileProtocolHandler', url.href]],
23
+ };
24
+ const command = commands[platform];
25
+ if (!command)
26
+ return Promise.resolve(false);
27
+ return new Promise((resolve) => {
28
+ try {
29
+ const child = spawn(command[0], command[1], {
30
+ detached: true,
31
+ stdio: 'ignore',
32
+ windowsHide: true,
33
+ });
34
+ child.once('error', () => resolve(false));
35
+ child.once('spawn', () => {
36
+ child.unref();
37
+ resolve(true);
38
+ });
39
+ }
40
+ catch {
41
+ resolve(false);
42
+ }
43
+ });
44
+ };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { Command } from 'commander';
2
+ import { type CliIO } from './io.js';
3
+ export type { CliIO } from './io.js';
4
+ export declare const CONFIGURATION_HELP = "\nConfiguration:\n --api-url <url> override the API base URL for one command\n CIPHRIX_API_URL default API base URL for this process\n CIPHRIX_CREDENTIAL_STORE=file use plaintext file credentials for local/headless testing\n CIPHRIX_ALLOW_INSECURE_HTTP=true\n permit HTTP for intentional local testing\n\nProduction and the OS keychain are used by default. No general config file is read.\nSee the README Configuration section for precedence and security details.\n";
5
+ /**
6
+ * Builds the command tree. Kept separate from `main` so tests can construct a
7
+ * program with captured output and no process exits.
8
+ */
9
+ export declare const createProgram: (io?: CliIO) => Command;
10
+ /**
11
+ * Runs the CLI and resolves to a process exit code. `--help`/`--version` and
12
+ * usage errors are handled by commander and mapped to their exit codes.
13
+ */
14
+ export declare const main: (argv?: readonly string[], io?: CliIO) => Promise<number>;