@constructive-io/cli 0.0.3 → 5.1.1

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 (130) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +346 -153
  3. package/commands/{analyze.d.ts → codegen.d.ts} +2 -2
  4. package/commands/codegen.js +131 -0
  5. package/commands/explorer.js +94 -0
  6. package/commands/get-graphql-schema.js +73 -0
  7. package/commands/server.js +187 -0
  8. package/commands.d.ts +0 -1
  9. package/commands.js +42 -61
  10. package/esm/commands/codegen.js +126 -0
  11. package/esm/commands/explorer.js +92 -0
  12. package/esm/commands/get-graphql-schema.js +71 -0
  13. package/esm/commands/server.js +185 -0
  14. package/esm/commands.js +41 -59
  15. package/esm/index.js +16 -36
  16. package/esm/utils/display.js +26 -23
  17. package/esm/utils/index.js +3 -6
  18. package/index.d.ts +0 -22
  19. package/index.js +16 -72
  20. package/package.json +50 -25
  21. package/utils/display.d.ts +1 -1
  22. package/utils/display.js +26 -23
  23. package/utils/index.d.ts +3 -6
  24. package/utils/index.js +7 -20
  25. package/commands/add.d.ts +0 -7
  26. package/commands/add.js +0 -86
  27. package/commands/admin-users/add.d.ts +0 -4
  28. package/commands/admin-users/add.js +0 -89
  29. package/commands/admin-users/bootstrap.d.ts +0 -4
  30. package/commands/admin-users/bootstrap.js +0 -50
  31. package/commands/admin-users/remove.d.ts +0 -4
  32. package/commands/admin-users/remove.js +0 -82
  33. package/commands/admin-users.d.ts +0 -4
  34. package/commands/admin-users.js +0 -68
  35. package/commands/analyze.js +0 -21
  36. package/commands/clear.d.ts +0 -3
  37. package/commands/clear.js +0 -59
  38. package/commands/deploy.d.ts +0 -4
  39. package/commands/deploy.js +0 -146
  40. package/commands/docker.d.ts +0 -3
  41. package/commands/docker.js +0 -194
  42. package/commands/env.d.ts +0 -4
  43. package/commands/env.js +0 -124
  44. package/commands/export.js +0 -129
  45. package/commands/extension.js +0 -48
  46. package/commands/init/index.d.ts +0 -7
  47. package/commands/init/index.js +0 -47
  48. package/commands/init/module.d.ts +0 -4
  49. package/commands/init/module.js +0 -71
  50. package/commands/init/workspace.d.ts +0 -4
  51. package/commands/init/workspace.js +0 -52
  52. package/commands/install.d.ts +0 -4
  53. package/commands/install.js +0 -37
  54. package/commands/kill.js +0 -107
  55. package/commands/migrate/deps.d.ts +0 -4
  56. package/commands/migrate/deps.js +0 -186
  57. package/commands/migrate/init.d.ts +0 -4
  58. package/commands/migrate/init.js +0 -65
  59. package/commands/migrate/list.d.ts +0 -4
  60. package/commands/migrate/list.js +0 -85
  61. package/commands/migrate/status.d.ts +0 -4
  62. package/commands/migrate/status.js +0 -94
  63. package/commands/migrate.d.ts +0 -4
  64. package/commands/migrate.js +0 -69
  65. package/commands/package.d.ts +0 -3
  66. package/commands/package.js +0 -65
  67. package/commands/plan.d.ts +0 -3
  68. package/commands/plan.js +0 -62
  69. package/commands/remove.d.ts +0 -3
  70. package/commands/remove.js +0 -42
  71. package/commands/rename.d.ts +0 -4
  72. package/commands/rename.js +0 -35
  73. package/commands/revert.d.ts +0 -3
  74. package/commands/revert.js +0 -107
  75. package/commands/tag.d.ts +0 -6
  76. package/commands/tag.js +0 -168
  77. package/commands/verify.d.ts +0 -3
  78. package/commands/verify.js +0 -85
  79. package/dist/README.md +0 -412
  80. package/dist/package.json +0 -64
  81. package/esm/commands/add.js +0 -51
  82. package/esm/commands/admin-users/add.js +0 -87
  83. package/esm/commands/admin-users/bootstrap.js +0 -48
  84. package/esm/commands/admin-users/remove.js +0 -80
  85. package/esm/commands/admin-users.js +0 -63
  86. package/esm/commands/analyze.js +0 -16
  87. package/esm/commands/clear.js +0 -54
  88. package/esm/commands/deploy.js +0 -144
  89. package/esm/commands/docker.js +0 -192
  90. package/esm/commands/env.js +0 -122
  91. package/esm/commands/export.js +0 -127
  92. package/esm/commands/extension.js +0 -46
  93. package/esm/commands/init/index.js +0 -42
  94. package/esm/commands/init/module.js +0 -68
  95. package/esm/commands/init/workspace.js +0 -46
  96. package/esm/commands/install.js +0 -35
  97. package/esm/commands/kill.js +0 -105
  98. package/esm/commands/migrate/deps.js +0 -184
  99. package/esm/commands/migrate/init.js +0 -63
  100. package/esm/commands/migrate/list.js +0 -83
  101. package/esm/commands/migrate/status.js +0 -92
  102. package/esm/commands/migrate.js +0 -64
  103. package/esm/commands/package.js +0 -63
  104. package/esm/commands/plan.js +0 -60
  105. package/esm/commands/remove.js +0 -40
  106. package/esm/commands/rename.js +0 -30
  107. package/esm/commands/revert.js +0 -105
  108. package/esm/commands/tag.js +0 -133
  109. package/esm/commands/verify.js +0 -83
  110. package/esm/package.js +0 -26
  111. package/esm/utils/argv.js +0 -92
  112. package/esm/utils/cli-error.js +0 -48
  113. package/esm/utils/database.js +0 -78
  114. package/esm/utils/deployed-changes.js +0 -68
  115. package/esm/utils/module-utils.js +0 -51
  116. package/package.d.ts +0 -1
  117. package/package.js +0 -29
  118. package/utils/argv.d.ts +0 -46
  119. package/utils/argv.js +0 -100
  120. package/utils/cli-error.d.ts +0 -8
  121. package/utils/cli-error.js +0 -52
  122. package/utils/database.d.ts +0 -21
  123. package/utils/database.js +0 -83
  124. package/utils/deployed-changes.d.ts +0 -4
  125. package/utils/deployed-changes.js +0 -72
  126. package/utils/module-utils.d.ts +0 -8
  127. package/utils/module-utils.js +0 -54
  128. /package/commands/{export.d.ts → explorer.d.ts} +0 -0
  129. /package/commands/{extension.d.ts → get-graphql-schema.d.ts} +0 -0
  130. /package/commands/{kill.d.ts → server.d.ts} +0 -0
@@ -1,57 +1,60 @@
1
- import chalk from 'chalk';
2
- import { readAndParsePackageJson } from '../package';
1
+ import { findAndRequirePackageJson } from 'find-and-require-package-json';
2
+ import yanse from 'yanse';
3
3
  // Function to display the version information
4
4
  export function displayVersion() {
5
- const pkg = readAndParsePackageJson();
6
- console.log(chalk.green(`Name: ${pkg.name}`));
7
- console.log(chalk.blue(`Version: ${pkg.version}`));
5
+ const pkg = findAndRequirePackageJson(__dirname);
6
+ console.log(yanse.green(`Name: ${pkg.name}`));
7
+ console.log(yanse.blue(`Version: ${pkg.version}`));
8
8
  }
9
9
  export const usageText = `
10
- Usage: constructive <command> [options]
11
-
10
+ Usage: cnc <command> [options]
11
+ constructive <command> [options]
12
+
12
13
  Core Database Operations:
13
14
  add Add database changes to plans and create SQL files
14
15
  deploy Deploy database changes and migrations
15
16
  verify Verify database state and migrations
16
17
  revert Revert database changes and migrations
17
-
18
+
18
19
  Project Management:
19
- init Initialize workspace or module
20
+ init Initialize pgpm workspace or module
20
21
  extension Manage module dependencies
21
22
  plan Generate module deployment plans
22
23
  package Package module for distribution
24
+ update Update CLI/pgpm (installs pgpm by default)
25
+ cache Manage cached templates (clean)
26
+
27
+ Development Tools:
28
+ server Start a GraphQL server
29
+ explorer Launch GraphiQL explorer interface
30
+ docker Manage PostgreSQL Docker containers (start/stop)
23
31
  export Export database migrations from existing databases
24
-
32
+
25
33
  Database Administration:
26
34
  kill Terminate database connections and optionally drop databases
27
- install Install database modules
35
+ install Install pgpm modules
28
36
  tag Add tags to changes for versioning
29
- clear Clear database state
30
- remove Remove database changes
31
- analyze Analyze database structure
32
- rename Rename database changes
33
- admin-users Manage admin users
34
-
37
+
35
38
  Migration Tools:
36
39
  migrate Migration management subcommands
37
40
  init Initialize migration tracking
38
41
  status Show migration status
39
42
  list List all changes
40
43
  deps Show change dependencies
41
-
44
+
42
45
  Global Options:
43
46
  -h, --help Display this help information
44
47
  -v, --version Display version information
45
48
  --cwd <directory> Working directory (default: current directory)
46
-
49
+
47
50
  Individual Command Help:
48
51
  constructive <command> --help Display detailed help for specific command
49
52
  constructive <command> -h Display detailed help for specific command
50
-
53
+
51
54
  Examples:
52
- constructive deploy --help Show deploy command options
53
- constructive init --workspace Initialize new workspace
54
- constructive install @pgpm/base32 Install a database module
55
+ cnc deploy --help Show deploy command options
56
+ cnc server --port 8080 Start server on port 8080
57
+ cnc init workspace Initialize new workspace
55
58
  `;
56
59
  export function displayUsage() {
57
60
  console.log(usageText);
@@ -1,6 +1,3 @@
1
- export * from './argv';
2
- export * from './database';
3
- export * from './display';
4
- export * from './cli-error';
5
- export * from './deployed-changes';
6
- export * from './module-utils';
1
+ export { extractFirst } from 'pgpm';
2
+ export { cliExitWithError } from 'pgpm';
3
+ export { usageText } from './display';
package/index.d.ts CHANGED
@@ -1,25 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { CLIOptions } from 'inquirerer';
3
- import { createConstructiveCommandMap } from './commands';
4
- export { createConstructiveCommandMap };
5
- export { default as add } from './commands/add';
6
- export { default as adminUsers } from './commands/admin-users';
7
- export { default as analyze } from './commands/analyze';
8
- export { default as clear } from './commands/clear';
9
- export { default as deploy } from './commands/deploy';
10
- export { default as docker } from './commands/docker';
11
- export { default as env } from './commands/env';
12
- export { default as _export } from './commands/export';
13
- export { default as extension } from './commands/extension';
14
- export { default as install } from './commands/install';
15
- export { default as kill } from './commands/kill';
16
- export { default as migrate } from './commands/migrate';
17
- export { default as _package } from './commands/package';
18
- export { default as plan } from './commands/plan';
19
- export { default as remove } from './commands/remove';
20
- export { default as renameCmd } from './commands/rename';
21
- export { default as revert } from './commands/revert';
22
- export { default as tag } from './commands/tag';
23
- export { default as verify } from './commands/verify';
24
- export * from './utils';
25
3
  export declare const options: Partial<CLIOptions>;
package/index.js CHANGED
@@ -1,68 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
- };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
3
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.options = exports.verify = exports.tag = exports.revert = exports.renameCmd = exports.remove = exports.plan = exports._package = exports.migrate = exports.kill = exports.install = exports.extension = exports._export = exports.env = exports.docker = exports.deploy = exports.clear = exports.analyze = exports.adminUsers = exports.add = exports.createConstructiveCommandMap = void 0;
4
+ exports.options = void 0;
22
5
  const fs_1 = require("fs");
23
6
  const inquirerer_1 = require("inquirerer");
24
7
  const path_1 = require("path");
25
8
  const commands_1 = require("./commands");
26
- Object.defineProperty(exports, "createConstructiveCommandMap", { enumerable: true, get: function () { return commands_1.createConstructiveCommandMap; } });
27
- var add_1 = require("./commands/add");
28
- Object.defineProperty(exports, "add", { enumerable: true, get: function () { return __importDefault(add_1).default; } });
29
- var admin_users_1 = require("./commands/admin-users");
30
- Object.defineProperty(exports, "adminUsers", { enumerable: true, get: function () { return __importDefault(admin_users_1).default; } });
31
- var analyze_1 = require("./commands/analyze");
32
- Object.defineProperty(exports, "analyze", { enumerable: true, get: function () { return __importDefault(analyze_1).default; } });
33
- var clear_1 = require("./commands/clear");
34
- Object.defineProperty(exports, "clear", { enumerable: true, get: function () { return __importDefault(clear_1).default; } });
35
- var deploy_1 = require("./commands/deploy");
36
- Object.defineProperty(exports, "deploy", { enumerable: true, get: function () { return __importDefault(deploy_1).default; } });
37
- var docker_1 = require("./commands/docker");
38
- Object.defineProperty(exports, "docker", { enumerable: true, get: function () { return __importDefault(docker_1).default; } });
39
- var env_1 = require("./commands/env");
40
- Object.defineProperty(exports, "env", { enumerable: true, get: function () { return __importDefault(env_1).default; } });
41
- var export_1 = require("./commands/export");
42
- Object.defineProperty(exports, "_export", { enumerable: true, get: function () { return __importDefault(export_1).default; } });
43
- var extension_1 = require("./commands/extension");
44
- Object.defineProperty(exports, "extension", { enumerable: true, get: function () { return __importDefault(extension_1).default; } });
45
- var install_1 = require("./commands/install");
46
- Object.defineProperty(exports, "install", { enumerable: true, get: function () { return __importDefault(install_1).default; } });
47
- var kill_1 = require("./commands/kill");
48
- Object.defineProperty(exports, "kill", { enumerable: true, get: function () { return __importDefault(kill_1).default; } });
49
- var migrate_1 = require("./commands/migrate");
50
- Object.defineProperty(exports, "migrate", { enumerable: true, get: function () { return __importDefault(migrate_1).default; } });
51
- var package_1 = require("./commands/package");
52
- Object.defineProperty(exports, "_package", { enumerable: true, get: function () { return __importDefault(package_1).default; } });
53
- var plan_1 = require("./commands/plan");
54
- Object.defineProperty(exports, "plan", { enumerable: true, get: function () { return __importDefault(plan_1).default; } });
55
- var remove_1 = require("./commands/remove");
56
- Object.defineProperty(exports, "remove", { enumerable: true, get: function () { return __importDefault(remove_1).default; } });
57
- var rename_1 = require("./commands/rename");
58
- Object.defineProperty(exports, "renameCmd", { enumerable: true, get: function () { return __importDefault(rename_1).default; } });
59
- var revert_1 = require("./commands/revert");
60
- Object.defineProperty(exports, "revert", { enumerable: true, get: function () { return __importDefault(revert_1).default; } });
61
- var tag_1 = require("./commands/tag");
62
- Object.defineProperty(exports, "tag", { enumerable: true, get: function () { return __importDefault(tag_1).default; } });
63
- var verify_1 = require("./commands/verify");
64
- Object.defineProperty(exports, "verify", { enumerable: true, get: function () { return __importDefault(verify_1).default; } });
65
- __exportStar(require("./utils"), exports);
9
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
10
+ const pkgPath = (0, path_1.join)(__dirname, 'package.json');
11
+ const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
12
+ console.log(pkg.version);
13
+ process.exit(0);
14
+ }
66
15
  exports.options = {
67
16
  minimistOpts: {
68
17
  alias: {
@@ -71,17 +20,12 @@ exports.options = {
71
20
  }
72
21
  }
73
22
  };
74
- if (require.main === module) {
75
- if (process.argv.includes('--version') || process.argv.includes('-v')) {
76
- const pkgPath = (0, path_1.join)(__dirname, 'package.json');
77
- const pkg = JSON.parse((0, fs_1.readFileSync)(pkgPath, 'utf8'));
78
- console.log(pkg.version);
79
- process.exit(0);
80
- }
81
- const app = new inquirerer_1.CLI(commands_1.commands, exports.options);
82
- app.run().then(() => {
83
- }).catch(error => {
84
- console.error('Unexpected error:', error);
85
- process.exit(1);
86
- });
87
- }
23
+ const app = new inquirerer_1.CLI(commands_1.commands, exports.options);
24
+ app.run().then(() => {
25
+ // all done!
26
+ }).catch(error => {
27
+ // Should not reach here with the new CLI error handling pattern
28
+ // But keep as fallback for unexpected errors
29
+ console.error('Unexpected error:', error);
30
+ process.exit(1);
31
+ });
package/package.json CHANGED
@@ -1,54 +1,79 @@
1
1
  {
2
2
  "name": "@constructive-io/cli",
3
- "version": "0.0.3",
4
- "description": "Platform for schemas, APIs, and application programming",
3
+ "version": "5.1.1",
4
+ "author": "Constructive <developers@constructive.io>",
5
+ "description": "Constructive CLI",
5
6
  "main": "index.js",
6
7
  "module": "esm/index.js",
7
8
  "types": "index.d.ts",
8
- "license": "SEE LICENSE IN LICENSE",
9
+ "homepage": "https://github.com/constructive-io/constructive",
10
+ "license": "MIT",
9
11
  "publishConfig": {
10
12
  "access": "public",
11
13
  "directory": "dist"
12
14
  },
13
15
  "bin": {
16
+ "cnc": "index.js",
14
17
  "constructive": "index.js"
15
18
  },
16
-
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/constructive-io/constructive"
22
+ },
23
+ "bugs": {
24
+ "url": "https://github.com/constructive-io/constructive/issues"
25
+ },
26
+ "scripts": {
27
+ "clean": "makage clean",
28
+ "prepack": "npm run build",
29
+ "build": "makage build",
30
+ "build:dev": "makage build --dev",
31
+ "dev": "ts-node ./src/index.ts",
32
+ "lint": "eslint . --fix",
33
+ "test": "jest --passWithNoTests",
34
+ "test:watch": "jest --watch"
35
+ },
17
36
  "devDependencies": {
18
- "@types/glob": "^8.1.0",
19
37
  "@types/js-yaml": "^4.0.9",
20
38
  "@types/minimist": "^1.2.5",
21
39
  "@types/node": "^20.12.7",
22
- "@types/pg": "^8.15.2",
40
+ "@types/pg": "^8.16.0",
23
41
  "@types/shelljs": "^0.8.16",
24
- "glob": "^11.0.2",
25
- "pg": "^8.16.0",
42
+ "clean-ansi": "0.1.5",
43
+ "glob": "^13.0.0",
44
+ "makage": "^0.1.9",
45
+ "pg": "^8.16.3",
26
46
  "ts-node": "^10.9.2"
27
47
  },
28
48
  "dependencies": {
29
- "@launchql/core": "2.15.4",
30
- "@launchql/env": "2.5.1",
31
- "@launchql/logger": "1.1.6",
32
- "@launchql/templatizer": "2.5.1",
33
- "@launchql/types": "2.8.1",
34
- "chalk": "^4.1.0",
35
- "inquirerer": "^2.0.8",
49
+ "@constructive-io/graphql-codegen": "^2.17.12",
50
+ "@constructive-io/graphql-env": "^2.8.5",
51
+ "@constructive-io/graphql-explorer": "^2.10.6",
52
+ "@constructive-io/graphql-server": "^2.10.6",
53
+ "@pgpmjs/core": "^3.0.7",
54
+ "@pgpmjs/logger": "^1.3.5",
55
+ "@pgpmjs/server-utils": "^2.8.7",
56
+ "@pgpmjs/types": "^2.12.5",
57
+ "find-and-require-package-json": "^0.8.2",
58
+ "inquirerer": "^2.1.14",
36
59
  "js-yaml": "^4.1.0",
37
60
  "minimist": "^1.2.8",
38
- "pg-cache": "1.4.2",
39
- "pg-env": "1.1.3",
40
- "shelljs": "^0.9.2"
61
+ "pg-cache": "^1.6.7",
62
+ "pg-env": "^1.2.4",
63
+ "pgpm": "^1.0.5",
64
+ "shelljs": "^0.10.0",
65
+ "yanse": "^0.1.8"
41
66
  },
42
67
  "keywords": [
43
68
  "cli",
44
69
  "command-line",
45
70
  "tool",
46
- "postgres",
47
- "postgresql",
48
- "migration",
49
- "package-manager",
50
- "database",
71
+ "constructive",
72
+ "utilities",
51
73
  "pg",
52
- "pgsql"
53
- ]
74
+ "pgsql",
75
+ "postgres",
76
+ "graphile"
77
+ ],
78
+ "gitHead": "e45ec95404e48d0c0542da882a3baea0cd6de1c7"
54
79
  }
@@ -1,3 +1,3 @@
1
1
  export declare function displayVersion(): void;
2
- export declare const usageText = "\n Usage: constructive <command> [options]\n\n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n\n Project Management:\n init Initialize workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n export Export database migrations from existing databases\n\n Database Administration:\n kill Terminate database connections and optionally drop databases\n install Install database modules\n tag Add tags to changes for versioning\n clear Clear database state\n remove Remove database changes\n analyze Analyze database structure\n rename Rename database changes\n admin-users Manage admin users\n\n Migration Tools:\n migrate Migration management subcommands\n init Initialize migration tracking\n status Show migration status\n list List all changes\n deps Show change dependencies\n\n Global Options:\n -h, --help Display this help information\n -v, --version Display version information\n --cwd <directory> Working directory (default: current directory)\n\n Individual Command Help:\n constructive <command> --help Display detailed help for specific command\n constructive <command> -h Display detailed help for specific command\n\n Examples:\n constructive deploy --help Show deploy command options\n constructive init --workspace Initialize new workspace\n constructive install @pgpm/base32 Install a database module\n ";
2
+ export declare const usageText = "\n Usage: cnc <command> [options]\n constructive <command> [options]\n \n Core Database Operations:\n add Add database changes to plans and create SQL files\n deploy Deploy database changes and migrations\n verify Verify database state and migrations\n revert Revert database changes and migrations\n \n Project Management:\n init Initialize pgpm workspace or module\n extension Manage module dependencies\n plan Generate module deployment plans\n package Package module for distribution\n update Update CLI/pgpm (installs pgpm by default)\n cache Manage cached templates (clean)\n \n Development Tools:\n server Start a GraphQL server\n explorer Launch GraphiQL explorer interface\n docker Manage PostgreSQL Docker containers (start/stop)\n export Export database migrations from existing databases\n \n Database Administration:\n kill Terminate database connections and optionally drop databases\n install Install pgpm modules\n tag Add tags to changes for versioning\n \n Migration Tools:\n migrate Migration management subcommands\n init Initialize migration tracking\n status Show migration status\n list List all changes\n deps Show change dependencies\n \n Global Options:\n -h, --help Display this help information\n -v, --version Display version information\n --cwd <directory> Working directory (default: current directory)\n \n Individual Command Help:\n constructive <command> --help Display detailed help for specific command\n constructive <command> -h Display detailed help for specific command\n \n Examples:\n cnc deploy --help Show deploy command options\n cnc server --port 8080 Start server on port 8080\n cnc init workspace Initialize new workspace\n ";
3
3
  export declare function displayUsage(): void;
package/utils/display.js CHANGED
@@ -6,60 +6,63 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.usageText = void 0;
7
7
  exports.displayVersion = displayVersion;
8
8
  exports.displayUsage = displayUsage;
9
- const chalk_1 = __importDefault(require("chalk"));
10
- const package_1 = require("../package");
9
+ const find_and_require_package_json_1 = require("find-and-require-package-json");
10
+ const yanse_1 = __importDefault(require("yanse"));
11
11
  // Function to display the version information
12
12
  function displayVersion() {
13
- const pkg = (0, package_1.readAndParsePackageJson)();
14
- console.log(chalk_1.default.green(`Name: ${pkg.name}`));
15
- console.log(chalk_1.default.blue(`Version: ${pkg.version}`));
13
+ const pkg = (0, find_and_require_package_json_1.findAndRequirePackageJson)(__dirname);
14
+ console.log(yanse_1.default.green(`Name: ${pkg.name}`));
15
+ console.log(yanse_1.default.blue(`Version: ${pkg.version}`));
16
16
  }
17
17
  exports.usageText = `
18
- Usage: constructive <command> [options]
19
-
18
+ Usage: cnc <command> [options]
19
+ constructive <command> [options]
20
+
20
21
  Core Database Operations:
21
22
  add Add database changes to plans and create SQL files
22
23
  deploy Deploy database changes and migrations
23
24
  verify Verify database state and migrations
24
25
  revert Revert database changes and migrations
25
-
26
+
26
27
  Project Management:
27
- init Initialize workspace or module
28
+ init Initialize pgpm workspace or module
28
29
  extension Manage module dependencies
29
30
  plan Generate module deployment plans
30
31
  package Package module for distribution
32
+ update Update CLI/pgpm (installs pgpm by default)
33
+ cache Manage cached templates (clean)
34
+
35
+ Development Tools:
36
+ server Start a GraphQL server
37
+ explorer Launch GraphiQL explorer interface
38
+ docker Manage PostgreSQL Docker containers (start/stop)
31
39
  export Export database migrations from existing databases
32
-
40
+
33
41
  Database Administration:
34
42
  kill Terminate database connections and optionally drop databases
35
- install Install database modules
43
+ install Install pgpm modules
36
44
  tag Add tags to changes for versioning
37
- clear Clear database state
38
- remove Remove database changes
39
- analyze Analyze database structure
40
- rename Rename database changes
41
- admin-users Manage admin users
42
-
45
+
43
46
  Migration Tools:
44
47
  migrate Migration management subcommands
45
48
  init Initialize migration tracking
46
49
  status Show migration status
47
50
  list List all changes
48
51
  deps Show change dependencies
49
-
52
+
50
53
  Global Options:
51
54
  -h, --help Display this help information
52
55
  -v, --version Display version information
53
56
  --cwd <directory> Working directory (default: current directory)
54
-
57
+
55
58
  Individual Command Help:
56
59
  constructive <command> --help Display detailed help for specific command
57
60
  constructive <command> -h Display detailed help for specific command
58
-
61
+
59
62
  Examples:
60
- constructive deploy --help Show deploy command options
61
- constructive init --workspace Initialize new workspace
62
- constructive install @pgpm/base32 Install a database module
63
+ cnc deploy --help Show deploy command options
64
+ cnc server --port 8080 Start server on port 8080
65
+ cnc init workspace Initialize new workspace
63
66
  `;
64
67
  function displayUsage() {
65
68
  console.log(exports.usageText);
package/utils/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- export * from './argv';
2
- export * from './database';
3
- export * from './display';
4
- export * from './cli-error';
5
- export * from './deployed-changes';
6
- export * from './module-utils';
1
+ export { extractFirst } from 'pgpm';
2
+ export { cliExitWithError } from 'pgpm';
3
+ export { usageText } from './display';
package/utils/index.js CHANGED
@@ -1,22 +1,9 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./argv"), exports);
18
- __exportStar(require("./database"), exports);
19
- __exportStar(require("./display"), exports);
20
- __exportStar(require("./cli-error"), exports);
21
- __exportStar(require("./deployed-changes"), exports);
22
- __exportStar(require("./module-utils"), exports);
3
+ exports.usageText = exports.cliExitWithError = exports.extractFirst = void 0;
4
+ var pgpm_1 = require("pgpm");
5
+ Object.defineProperty(exports, "extractFirst", { enumerable: true, get: function () { return pgpm_1.extractFirst; } });
6
+ var pgpm_2 = require("pgpm");
7
+ Object.defineProperty(exports, "cliExitWithError", { enumerable: true, get: function () { return pgpm_2.cliExitWithError; } });
8
+ var display_1 = require("./display");
9
+ Object.defineProperty(exports, "usageText", { enumerable: true, get: function () { return display_1.usageText; } });
package/commands/add.d.ts DELETED
@@ -1,7 +0,0 @@
1
- import { CLIOptions, Inquirerer } from 'inquirerer';
2
- import { ParsedArgs } from 'minimist';
3
- declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<{
4
- _: string[];
5
- "--"?: string[] | undefined;
6
- }>;
7
- export default _default;
package/commands/add.js DELETED
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- const core_1 = require("@launchql/core");
37
- const path = __importStar(require("path"));
38
- const argv_1 = require("../utils/argv");
39
- const addUsageText = `
40
- Add Command:
41
-
42
- constructive add [change] [OPTIONS]
43
-
44
- Add a database change to plans and create deploy/revert/verify SQL files.
45
-
46
- Arguments:
47
- change Name of the change to create
48
-
49
- Options:
50
- --help, -h Show this help message
51
- --requires <dependency> Required change (can be used multiple times)
52
- --note <text> Brief note describing the purpose of the change
53
- --cwd <directory> Working directory (default: current directory)
54
-
55
- Examples:
56
- constructive add organizations Add change named 'organizations'
57
- constructive add brands --note "Adds the brands table" Add change with note
58
- constructive add contacts --requires users --note "Adds contacts table" Add with dependency
59
- constructive add be/a/path/like/this Add change with nested path
60
- `;
61
- exports.default = async (argv, prompter, _options) => {
62
- // Show usage if explicitly requested
63
- if (argv.help || argv.h) {
64
- console.log(addUsageText);
65
- process.exit(0);
66
- }
67
- const cwd = argv.cwd || process.cwd();
68
- const { first: change, newArgv } = (0, argv_1.extractFirst)(argv);
69
- let finalChange = change;
70
- if (!change) {
71
- const answers = await prompter.prompt(newArgv, [{
72
- type: 'text',
73
- name: 'change',
74
- message: 'Change name',
75
- required: true
76
- }]);
77
- finalChange = answers.change;
78
- }
79
- let dependencies = [];
80
- if (argv.requires) {
81
- dependencies = Array.isArray(argv.requires) ? argv.requires : [argv.requires];
82
- }
83
- const pkg = new core_1.LaunchQLPackage(path.resolve(cwd));
84
- pkg.addChange(finalChange, dependencies.length > 0 ? dependencies : undefined, argv.note);
85
- return newArgv;
86
- };
@@ -1,4 +0,0 @@
1
- import { CLIOptions, Inquirerer } from 'inquirerer';
2
- import { ParsedArgs } from 'minimist';
3
- declare const _default: (argv: Partial<ParsedArgs>, prompter: Inquirerer, _options: CLIOptions) => Promise<Partial<ParsedArgs>>;
4
- export default _default;