pgpm 0.0.1 → 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 (70) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +111 -116
  3. package/commands/add.js +7 -7
  4. package/commands/admin-users/add.js +8 -8
  5. package/commands/admin-users/bootstrap.js +7 -7
  6. package/commands/admin-users/remove.js +7 -7
  7. package/commands/admin-users.js +5 -5
  8. package/commands/analyze.js +1 -1
  9. package/commands/clear.js +3 -3
  10. package/commands/deploy.js +7 -7
  11. package/commands/export.js +4 -4
  12. package/commands/extension.js +3 -3
  13. package/commands/init/index.js +8 -8
  14. package/commands/install.js +6 -6
  15. package/commands/kill.js +6 -6
  16. package/commands/migrate/init.js +1 -1
  17. package/commands/migrate.js +1 -1
  18. package/commands/package.js +4 -4
  19. package/commands/plan.js +5 -5
  20. package/commands/remove.js +2 -2
  21. package/commands/rename.js +1 -1
  22. package/commands/revert.js +7 -7
  23. package/commands/tag.js +6 -6
  24. package/commands/verify.js +7 -7
  25. package/commands.d.ts +1 -0
  26. package/commands.js +7 -16
  27. package/esm/commands/add.js +7 -7
  28. package/esm/commands/admin-users/add.js +8 -8
  29. package/esm/commands/admin-users/bootstrap.js +7 -7
  30. package/esm/commands/admin-users/remove.js +7 -7
  31. package/esm/commands/admin-users.js +5 -5
  32. package/esm/commands/analyze.js +1 -1
  33. package/esm/commands/clear.js +3 -3
  34. package/esm/commands/deploy.js +7 -7
  35. package/esm/commands/export.js +4 -4
  36. package/esm/commands/extension.js +3 -3
  37. package/esm/commands/init/index.js +8 -8
  38. package/esm/commands/init/workspace.js +1 -1
  39. package/esm/commands/install.js +6 -6
  40. package/esm/commands/kill.js +6 -6
  41. package/esm/commands/migrate/init.js +1 -1
  42. package/esm/commands/migrate.js +1 -1
  43. package/esm/commands/package.js +4 -4
  44. package/esm/commands/plan.js +5 -5
  45. package/esm/commands/remove.js +2 -2
  46. package/esm/commands/rename.js +1 -1
  47. package/esm/commands/revert.js +7 -7
  48. package/esm/commands/tag.js +6 -6
  49. package/esm/commands/verify.js +7 -7
  50. package/esm/commands.js +5 -15
  51. package/esm/index.js +36 -10
  52. package/esm/utils/cli-error.js +1 -1
  53. package/esm/utils/display.js +13 -13
  54. package/esm/utils/index.js +3 -0
  55. package/index.d.ts +20 -0
  56. package/index.js +70 -10
  57. package/package.json +15 -18
  58. package/utils/cli-error.js +1 -1
  59. package/utils/display.d.ts +1 -1
  60. package/utils/display.js +13 -13
  61. package/utils/index.d.ts +3 -0
  62. package/utils/index.js +3 -0
  63. package/commands/explorer.d.ts +0 -3
  64. package/commands/explorer.js +0 -94
  65. package/commands/server.d.ts +0 -3
  66. package/commands/server.js +0 -187
  67. package/dist/README.md +0 -416
  68. package/dist/package.json +0 -77
  69. package/esm/commands/explorer.js +0 -92
  70. package/esm/commands/server.js +0 -185
@@ -8,11 +8,11 @@ const subcommandMap = {
8
8
  remove
9
9
  };
10
10
  const adminUsersUsageText = `
11
- LaunchQL Admin Users Commands:
11
+ Admin Users Commands:
12
12
 
13
- lql admin-users bootstrap Initialize LaunchQL roles and permissions (must be run first)
14
- lql admin-users add Add database users with roles
15
- lql admin-users remove Remove database users and revoke roles
13
+ pgpm admin-users bootstrap Initialize postgres roles and permissions (must be run first)
14
+ pgpm admin-users add Add database users with roles
15
+ pgpm admin-users remove Remove database users and revoke roles
16
16
 
17
17
  Options:
18
18
  --help, -h Show this help message
@@ -55,7 +55,7 @@ export default async (argv, prompter, options) => {
55
55
  };
56
56
  function getSubcommandDescription(cmd) {
57
57
  const descriptions = {
58
- bootstrap: 'Initialize LaunchQL roles and permissions (must be run first)',
58
+ bootstrap: 'Initialize postgres roles and permissions (must be run first)',
59
59
  add: 'Add database users with roles',
60
60
  remove: 'Remove database users and revoke roles'
61
61
  };
@@ -1,5 +1,5 @@
1
- import path from 'path';
2
1
  import { LaunchQLPackage } from '@launchql/core';
2
+ import path from 'path';
3
3
  export default async (argv, _prompter) => {
4
4
  const cwd = argv.cwd || process.cwd();
5
5
  const proj = new LaunchQLPackage(path.resolve(cwd));
@@ -1,10 +1,10 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
- import { Logger } from '@launchql/logger';
3
- import { getEnvOptions } from '@launchql/env';
4
- import { getPgEnvOptions } from 'pg-env';
5
2
  import { parsePlanFile } from '@launchql/core';
3
+ import { getEnvOptions } from '@launchql/env';
4
+ import { Logger } from '@launchql/logger';
6
5
  import { errors } from '@launchql/types';
7
6
  import path from 'path';
7
+ import { getPgEnvOptions } from 'pg-env';
8
8
  import { getTargetDatabase } from '../utils';
9
9
  const log = new Logger('clear');
10
10
  export default async (argv, prompter, _options) => {
@@ -1,14 +1,14 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
- import { Logger } from '@launchql/logger';
3
2
  import { getEnvOptions } from '@launchql/env';
3
+ import { Logger } from '@launchql/logger';
4
4
  import { execSync } from 'child_process';
5
5
  import { getPgEnvOptions, getSpawnEnvWithPg, } from 'pg-env';
6
6
  import { getTargetDatabase } from '../utils';
7
7
  import { selectPackage } from '../utils/module-utils';
8
8
  const deployUsageText = `
9
- LaunchQL Deploy Command:
9
+ Deploy Command:
10
10
 
11
- lql deploy [OPTIONS]
11
+ pgpm deploy [OPTIONS]
12
12
 
13
13
  Deploy database changes and migrations to target database.
14
14
 
@@ -26,10 +26,10 @@ Options:
26
26
  --cwd <directory> Working directory (default: current directory)
27
27
 
28
28
  Examples:
29
- lql deploy Deploy to selected database
30
- lql deploy --createdb Deploy with database creation
31
- lql deploy --package mypackage --to @v1.0.0 Deploy specific package to tag
32
- lql deploy --fast --no-tx Fast deployment without transactions
29
+ pgpm deploy Deploy to selected database
30
+ pgpm deploy --createdb Deploy with database creation
31
+ pgpm deploy --package mypackage --to @v1.0.0 Deploy specific package to tag
32
+ pgpm deploy --fast --no-tx Fast deployment without transactions
33
33
  `;
34
34
  export default async (argv, prompter, _options) => {
35
35
  // Show usage if explicitly requested
@@ -1,12 +1,12 @@
1
1
  import { exportMigrations, LaunchQLPackage } from '@launchql/core';
2
- import { getGitConfigInfo } from '@launchql/types';
3
2
  import { getEnvOptions } from '@launchql/env';
3
+ import { getGitConfigInfo } from '@launchql/types';
4
4
  import { resolve } from 'path';
5
5
  import { getPgPool } from 'pg-cache';
6
6
  const exportUsageText = `
7
- LaunchQL Export Command:
7
+ Export Command:
8
8
 
9
- lql export [OPTIONS]
9
+ pgpm export [OPTIONS]
10
10
 
11
11
  Export database migrations from existing databases.
12
12
 
@@ -18,7 +18,7 @@ Options:
18
18
  --cwd <directory> Working directory (default: current directory)
19
19
 
20
20
  Examples:
21
- lql export Export migrations from selected database
21
+ pgpm export Export migrations from selected database
22
22
  `;
23
23
  export default async (argv, prompter, _options) => {
24
24
  // Show usage if explicitly requested
@@ -1,8 +1,8 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
2
  const extensionUsageText = `
3
- LaunchQL Extension Command:
3
+ Extension Command:
4
4
 
5
- lql extension [OPTIONS]
5
+ pgpm extension [OPTIONS]
6
6
 
7
7
  Manage module dependencies.
8
8
 
@@ -11,7 +11,7 @@ Options:
11
11
  --cwd <directory> Working directory (default: current directory)
12
12
 
13
13
  Examples:
14
- lql extension Manage dependencies for current module
14
+ pgpm extension Manage dependencies for current module
15
15
  `;
16
16
  export default async (argv, prompter, _options) => {
17
17
  // Show usage if explicitly requested
@@ -1,11 +1,11 @@
1
1
  import runModuleSetup from './module';
2
2
  import runWorkspaceSetup from './workspace';
3
3
  const initUsageText = `
4
- LaunchQL Init Command:
4
+ Init Command:
5
5
 
6
- lql init [OPTIONS]
6
+ pgpm init [OPTIONS]
7
7
 
8
- Initialize LaunchQL workspace or module.
8
+ Initialize pgpm workspace or module.
9
9
 
10
10
  Options:
11
11
  --help, -h Show this help message
@@ -16,11 +16,11 @@ Options:
16
16
  --from-branch <branch> Specify branch when using --repo (default: main)
17
17
 
18
18
  Examples:
19
- lql init Initialize new module in existing workspace
20
- lql init --workspace Initialize new workspace
21
- lql init --repo owner/repo Use templates from GitHub repository
22
- lql init --template-path ./custom-templates Use templates from local path
23
- lql init --repo owner/repo --from-branch develop Use specific branch
19
+ pgpm init Initialize new module in existing workspace
20
+ pgpm init --workspace Initialize new workspace
21
+ pgpm init --repo owner/repo Use templates from GitHub repository
22
+ pgpm init --template-path ./custom-templates Use templates from local path
23
+ pgpm init --repo owner/repo --from-branch develop Use specific branch
24
24
  `;
25
25
  export default async (argv, prompter, _options) => {
26
26
  // Show usage if explicitly requested
@@ -1,7 +1,7 @@
1
1
  import { sluggify } from '@launchql/core';
2
2
  import { Logger } from '@launchql/logger';
3
3
  // @ts-ignore - TypeScript module resolution issue with @launchql/templatizer
4
- import { workspaceTemplate, writeRenderedTemplates, loadTemplates } from '@launchql/templatizer';
4
+ import { loadTemplates, workspaceTemplate, writeRenderedTemplates } from '@launchql/templatizer';
5
5
  import { mkdirSync } from 'fs';
6
6
  import path from 'path';
7
7
  const log = new Logger('workspace-init');
@@ -1,10 +1,10 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
2
  const installUsageText = `
3
- LaunchQL Install Command:
3
+ Install Command:
4
4
 
5
- lql install <package>...
5
+ pgpm install <package>...
6
6
 
7
- Install LaunchQL modules into current module.
7
+ Install pgpm modules into current module.
8
8
 
9
9
  Arguments:
10
10
  package One or more package names to install
@@ -14,8 +14,8 @@ Options:
14
14
  --cwd <directory> Working directory (default: current directory)
15
15
 
16
16
  Examples:
17
- lql install @launchql/base32 Install single package
18
- lql install @launchql/base32 @launchql/utils Install multiple packages
17
+ pgpm install @pgpm/base32 Install single package
18
+ pgpm install @pgpm/base32 @pgpm/utils Install multiple packages
19
19
  `;
20
20
  export default async (argv, prompter, _options) => {
21
21
  // Show usage if explicitly requested
@@ -29,7 +29,7 @@ export default async (argv, prompter, _options) => {
29
29
  throw new Error('You must run this command inside a LaunchQL module.');
30
30
  }
31
31
  if (argv._.length === 0) {
32
- throw new Error('You must provide a package name to install, e.g. `@launchql/base32`');
32
+ throw new Error('You must provide a package name to install, e.g. `@pgpm/base32`');
33
33
  }
34
34
  await project.installModules(...argv._);
35
35
  };
@@ -2,9 +2,9 @@ import { Logger } from '@launchql/logger';
2
2
  import { getPgPool } from 'pg-cache';
3
3
  const log = new Logger('db-kill');
4
4
  const killUsageText = `
5
- LaunchQL Kill Command:
5
+ Kill Command:
6
6
 
7
- lql kill [OPTIONS]
7
+ pgpm kill [OPTIONS]
8
8
 
9
9
  Terminate database connections and optionally drop databases.
10
10
 
@@ -16,10 +16,10 @@ Options:
16
16
  --cwd <directory> Working directory (default: current directory)
17
17
 
18
18
  Examples:
19
- lql kill Kill connections and drop selected databases (interactive)
20
- lql kill --no-drop Only kill connections, preserve databases (interactive)
21
- lql kill --pattern test_% Kill connections to databases matching 'test_%' pattern
22
- lql kill --pattern %dev --no-drop Kill connections to databases ending with 'dev' but don't drop
19
+ pgpm kill Kill connections and drop selected databases (interactive)
20
+ pgpm kill --no-drop Only kill connections, preserve databases (interactive)
21
+ pgpm kill --pattern test_% Kill connections to databases matching 'test_%' pattern
22
+ pgpm kill --pattern %dev --no-drop Kill connections to databases ending with 'dev' but don't drop
23
23
  `;
24
24
  export default async (argv, prompter, _options) => {
25
25
  // Show usage if explicitly requested
@@ -13,7 +13,7 @@ export default async (argv, prompter, _options) => {
13
13
  {
14
14
  name: 'yes',
15
15
  type: 'confirm',
16
- message: `Initialize LaunchQL migration schema in database "${database}"?`,
16
+ message: `Initialize pgpm migration schema in database "${database}"?`,
17
17
  required: true
18
18
  }
19
19
  ];
@@ -11,7 +11,7 @@ const subcommandMap = {
11
11
  deps
12
12
  };
13
13
  const migrateUsageText = `
14
- LaunchQL Migrate Commands:
14
+ Migrate Commands:
15
15
 
16
16
  launchql migrate init Initialize migration tracking in database
17
17
  launchql migrate status Show current migration status
@@ -1,8 +1,8 @@
1
1
  import { LaunchQLPackage, writePackage } from '@launchql/core';
2
2
  const packageUsageText = `
3
- LaunchQL Package Command:
3
+ Package Command:
4
4
 
5
- lql package [OPTIONS]
5
+ pgpm package [OPTIONS]
6
6
 
7
7
  Package module for distribution.
8
8
 
@@ -14,8 +14,8 @@ Options:
14
14
  --cwd <directory> Working directory (default: current directory)
15
15
 
16
16
  Examples:
17
- lql package Package with defaults
18
- lql package --no-plan Package without plan
17
+ pgpm package Package with defaults
18
+ pgpm package --no-plan Package without plan
19
19
  `;
20
20
  export default async (argv, prompter, _options) => {
21
21
  // Show usage if explicitly requested
@@ -2,9 +2,9 @@ import { LaunchQLPackage } from '@launchql/core';
2
2
  import { Logger } from '@launchql/logger';
3
3
  const log = new Logger('plan');
4
4
  const planUsageText = `
5
- LaunchQL Plan Command:
5
+ Plan Command:
6
6
 
7
- lql plan [OPTIONS]
7
+ pgpm plan [OPTIONS]
8
8
 
9
9
  Generate module deployment plans.
10
10
 
@@ -15,9 +15,9 @@ Options:
15
15
  --cwd <directory> Working directory (default: current directory)
16
16
 
17
17
  Examples:
18
- lql plan Generate deployment plan for current module with defaults
19
- lql plan --includePackages false Disable including external packages
20
- lql plan --includeTags false Do not prefer tags for external packages
18
+ pgpm plan Generate deployment plan for current module with defaults
19
+ pgpm plan --includePackages false Disable including external packages
20
+ pgpm plan --includeTags false Do not prefer tags for external packages
21
21
  `;
22
22
  export default async (argv, prompter, _options) => {
23
23
  // Show usage if explicitly requested
@@ -1,13 +1,13 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
- import { Logger } from '@launchql/logger';
3
2
  import { getEnvOptions } from '@launchql/env';
3
+ import { Logger } from '@launchql/logger';
4
4
  import { getPgEnvOptions } from 'pg-env';
5
5
  import { getTargetDatabase } from '../utils';
6
6
  import { cliExitWithError } from '../utils/cli-error';
7
7
  const log = new Logger('remove');
8
8
  export default async (argv, prompter, _options) => {
9
9
  if (!argv.to) {
10
- await cliExitWithError('No change specified. Usage: lql remove --to <change>');
10
+ await cliExitWithError('No change specified. Usage: pgpm remove --to <change>');
11
11
  }
12
12
  const database = await getTargetDatabase(argv, prompter, {
13
13
  message: 'Select database'
@@ -1,5 +1,5 @@
1
- import path from 'path';
2
1
  import { LaunchQLPackage } from '@launchql/core';
2
+ import path from 'path';
3
3
  import { cliExitWithError } from '../utils/cli-error';
4
4
  export default async (argv, _prompter) => {
5
5
  const cwd = argv.cwd || process.cwd();
@@ -1,15 +1,15 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
- import { Logger } from '@launchql/logger';
3
2
  import { getEnvOptions } from '@launchql/env';
3
+ import { Logger } from '@launchql/logger';
4
4
  import { getPgEnvOptions } from 'pg-env';
5
5
  import { getTargetDatabase } from '../utils';
6
- import { selectDeployedChange, selectDeployedPackage } from '../utils/deployed-changes';
7
6
  import { cliExitWithError } from '../utils/cli-error';
7
+ import { selectDeployedChange, selectDeployedPackage } from '../utils/deployed-changes';
8
8
  const log = new Logger('revert');
9
9
  const revertUsageText = `
10
- LaunchQL Revert Command:
10
+ Revert Command:
11
11
 
12
- lql revert [OPTIONS]
12
+ pgpm revert [OPTIONS]
13
13
 
14
14
  Revert database changes and migrations.
15
15
 
@@ -23,9 +23,9 @@ Options:
23
23
  --cwd <directory> Working directory (default: current directory)
24
24
 
25
25
  Examples:
26
- lql revert Revert latest changes
27
- lql revert --to @v1.0.0 Revert to specific tag
28
- lql revert --to Interactive selection from deployed changes
26
+ pgpm revert Revert latest changes
27
+ pgpm revert --to @v1.0.0 Revert to specific tag
28
+ pgpm revert --to Interactive selection from deployed changes
29
29
  `;
30
30
  export default async (argv, prompter, _options) => {
31
31
  // Show usage if explicitly requested
@@ -1,14 +1,14 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
2
  import { Logger } from '@launchql/logger';
3
3
  import { errors } from '@launchql/types';
4
+ import * as path from 'path';
4
5
  import { extractFirst } from '../utils/argv';
5
6
  import { selectPackage } from '../utils/module-utils';
6
- import * as path from 'path';
7
7
  const log = new Logger('tag');
8
8
  const tagUsageText = `
9
- LaunchQL Tag Command:
9
+ Tag Command:
10
10
 
11
- lql tag [tag_name] [OPTIONS]
11
+ pgpm tag [tag_name] [OPTIONS]
12
12
 
13
13
  Add tags to changes for versioning.
14
14
 
@@ -23,9 +23,9 @@ Options:
23
23
  --cwd <directory> Working directory (default: current directory)
24
24
 
25
25
  Examples:
26
- lql tag v1.0.0 Add tag to latest change
27
- lql tag v1.0.0 --comment "Initial release" Add tag with comment
28
- lql tag v1.1.0 --package mypackage --changeName my-change Tag specific change in package
26
+ pgpm tag v1.0.0 Add tag to latest change
27
+ pgpm tag v1.0.0 --comment "Initial release" Add tag with comment
28
+ pgpm tag v1.1.0 --package mypackage --changeName my-change Tag specific change in package
29
29
  `;
30
30
  export default async (argv, prompter, _options) => {
31
31
  // Show usage if explicitly requested
@@ -1,15 +1,15 @@
1
1
  import { LaunchQLPackage } from '@launchql/core';
2
- import { Logger } from '@launchql/logger';
3
2
  import { getEnvOptions } from '@launchql/env';
3
+ import { Logger } from '@launchql/logger';
4
4
  import { getPgEnvOptions } from 'pg-env';
5
5
  import { getTargetDatabase } from '../utils';
6
- import { selectDeployedChange, selectDeployedPackage } from '../utils/deployed-changes';
7
6
  import { cliExitWithError } from '../utils/cli-error';
7
+ import { selectDeployedChange, selectDeployedPackage } from '../utils/deployed-changes';
8
8
  const log = new Logger('verify');
9
9
  const verifyUsageText = `
10
- LaunchQL Verify Command:
10
+ Verify Command:
11
11
 
12
- lql verify [OPTIONS]
12
+ pgpm verify [OPTIONS]
13
13
 
14
14
  Verify database state matches expected migrations.
15
15
 
@@ -22,9 +22,9 @@ Options:
22
22
  --cwd <directory> Working directory (default: current directory)
23
23
 
24
24
  Examples:
25
- lql verify Verify current database state
26
- lql verify --package mypackage Verify specific package
27
- lql verify --to Interactive selection from deployed changes
25
+ pgpm verify Verify current database state
26
+ pgpm verify --package mypackage Verify specific package
27
+ pgpm verify --to Interactive selection from deployed changes
28
28
  `;
29
29
  export default async (argv, prompter, _options) => {
30
30
  // Show usage if explicitly requested
package/esm/commands.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { teardownPgPools } from 'pg-cache';
2
- // Commands
3
2
  import add from './commands/add';
4
3
  import adminUsers from './commands/admin-users';
4
+ import analyze from './commands/analyze';
5
5
  import clear from './commands/clear';
6
6
  import deploy from './commands/deploy';
7
- import explorer from './commands/explorer';
8
7
  import _export from './commands/export';
9
8
  import extension from './commands/extension';
10
9
  import init from './commands/init';
@@ -14,12 +13,10 @@ import migrate from './commands/migrate';
14
13
  import _package from './commands/package';
15
14
  import plan from './commands/plan';
16
15
  import remove from './commands/remove';
16
+ import renameCmd from './commands/rename';
17
17
  import revert from './commands/revert';
18
- import server from './commands/server';
19
18
  import tag from './commands/tag';
20
19
  import verify from './commands/verify';
21
- import analyze from './commands/analyze';
22
- import renameCmd from './commands/rename';
23
20
  import { readAndParsePackageJson } from './package';
24
21
  import { extractFirst, usageText } from './utils';
25
22
  import { cliExitWithError } from './utils/cli-error';
@@ -33,7 +30,7 @@ const withPgTeardown = (fn, skipTeardown = false) => async (...args) => {
33
30
  }
34
31
  }
35
32
  };
36
- const createCommandMap = (skipPgTeardown = false) => {
33
+ export const createPgpmCommandMap = (skipPgTeardown = false) => {
37
34
  const pgt = (fn) => withPgTeardown(fn, skipPgTeardown);
38
35
  return {
39
36
  add,
@@ -53,10 +50,7 @@ const createCommandMap = (skipPgTeardown = false) => {
53
50
  install: pgt(install),
54
51
  migrate: pgt(migrate),
55
52
  analyze: pgt(analyze),
56
- rename: pgt(renameCmd),
57
- // These manage their own connection lifecycles
58
- server,
59
- explorer
53
+ rename: pgt(renameCmd)
60
54
  };
61
55
  };
62
56
  export const commands = async (argv, prompter, options) => {
@@ -66,18 +60,15 @@ export const commands = async (argv, prompter, options) => {
66
60
  process.exit(0);
67
61
  }
68
62
  let { first: command, newArgv } = extractFirst(argv);
69
- // Show usage if explicitly requested but no command specified
70
63
  if ((argv.help || argv.h || command === 'help') && !command) {
71
64
  console.log(usageText);
72
65
  process.exit(0);
73
66
  }
74
- // Show usage for help command specifically
75
67
  if (command === 'help') {
76
68
  console.log(usageText);
77
69
  process.exit(0);
78
70
  }
79
- const commandMap = createCommandMap(options?.skipPgTeardown);
80
- // Prompt if no command provided
71
+ const commandMap = createPgpmCommandMap(options?.skipPgTeardown);
81
72
  if (!command) {
82
73
  const answer = await prompter.prompt(argv, [
83
74
  {
@@ -89,7 +80,6 @@ export const commands = async (argv, prompter, options) => {
89
80
  ]);
90
81
  command = answer.command;
91
82
  }
92
- // Prompt for working directory
93
83
  newArgv = await prompter.prompt(newArgv, [
94
84
  {
95
85
  type: 'text',
package/esm/index.js CHANGED
@@ -1,6 +1,27 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync } from 'fs';
2
3
  import { CLI } from 'inquirerer';
3
- import { commands } from './commands';
4
+ import { join } from 'path';
5
+ import { commands, createPgpmCommandMap } from './commands';
6
+ export { createPgpmCommandMap };
7
+ export { default as add } from './commands/add';
8
+ export { default as adminUsers } from './commands/admin-users';
9
+ export { default as analyze } from './commands/analyze';
10
+ export { default as clear } from './commands/clear';
11
+ export { default as deploy } from './commands/deploy';
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';
4
25
  export const options = {
5
26
  minimistOpts: {
6
27
  alias: {
@@ -9,12 +30,17 @@ export const options = {
9
30
  }
10
31
  }
11
32
  };
12
- const app = new CLI(commands, options);
13
- app.run().then(() => {
14
- // all done!
15
- }).catch(error => {
16
- // Should not reach here with the new CLI error handling pattern
17
- // But keep as fallback for unexpected errors
18
- console.error('Unexpected error:', error);
19
- process.exit(1);
20
- });
33
+ if (require.main === module) {
34
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
35
+ const pkgPath = join(__dirname, 'package.json');
36
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
37
+ console.log(pkg.version);
38
+ process.exit(0);
39
+ }
40
+ const app = new CLI(commands, options);
41
+ app.run().then(() => {
42
+ }).catch(error => {
43
+ console.error('Unexpected error:', error);
44
+ process.exit(1);
45
+ });
46
+ }
@@ -1,5 +1,5 @@
1
- import { LaunchQLError } from '@launchql/types';
2
1
  import { Logger } from '@launchql/logger';
2
+ import { LaunchQLError } from '@launchql/types';
3
3
  import { teardownPgPools } from 'pg-cache';
4
4
  const log = new Logger('cli');
5
5
  /**
@@ -7,8 +7,7 @@ export function displayVersion() {
7
7
  console.log(chalk.blue(`Version: ${pkg.version}`));
8
8
  }
9
9
  export const usageText = `
10
- Usage: lql <command> [options]
11
- launchql <command> [options]
10
+ Usage: pgpm <command> [options]
12
11
 
13
12
  Core Database Operations:
14
13
  add Add database changes to plans and create SQL files
@@ -17,20 +16,21 @@ export const usageText = `
17
16
  revert Revert database changes and migrations
18
17
 
19
18
  Project Management:
20
- init Initialize LaunchQL workspace or module
19
+ init Initialize workspace or module
21
20
  extension Manage module dependencies
22
21
  plan Generate module deployment plans
23
22
  package Package module for distribution
24
-
25
- Development Tools:
26
- server Start LaunchQL GraphQL server
27
- explorer Launch GraphiQL explorer interface
28
23
  export Export database migrations from existing databases
29
24
 
30
25
  Database Administration:
31
26
  kill Terminate database connections and optionally drop databases
32
- install Install LaunchQL modules
27
+ install Install database modules
33
28
  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
34
 
35
35
  Migration Tools:
36
36
  migrate Migration management subcommands
@@ -45,13 +45,13 @@ export const usageText = `
45
45
  --cwd <directory> Working directory (default: current directory)
46
46
 
47
47
  Individual Command Help:
48
- lql <command> --help Display detailed help for specific command
49
- lql <command> -h Display detailed help for specific command
48
+ pgpm <command> --help Display detailed help for specific command
49
+ pgpm <command> -h Display detailed help for specific command
50
50
 
51
51
  Examples:
52
- lql deploy --help Show deploy command options
53
- lql server --port 8080 Start server on port 8080
54
- lql init --workspace Initialize new workspace
52
+ pgpm deploy --help Show deploy command options
53
+ pgpm init --workspace Initialize new workspace
54
+ pgpm install @pgpm/base32 Install a database module
55
55
  `;
56
56
  export function displayUsage() {
57
57
  console.log(usageText);
@@ -1,3 +1,6 @@
1
1
  export * from './argv';
2
2
  export * from './database';
3
3
  export * from './display';
4
+ export * from './cli-error';
5
+ export * from './deployed-changes';
6
+ export * from './module-utils';
package/index.d.ts CHANGED
@@ -1,3 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  import { CLIOptions } from 'inquirerer';
3
+ import { createPgpmCommandMap } from './commands';
4
+ export { createPgpmCommandMap };
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 _export } from './commands/export';
11
+ export { default as extension } from './commands/extension';
12
+ export { default as install } from './commands/install';
13
+ export { default as kill } from './commands/kill';
14
+ export { default as migrate } from './commands/migrate';
15
+ export { default as _package } from './commands/package';
16
+ export { default as plan } from './commands/plan';
17
+ export { default as remove } from './commands/remove';
18
+ export { default as renameCmd } from './commands/rename';
19
+ export { default as revert } from './commands/revert';
20
+ export { default as tag } from './commands/tag';
21
+ export { default as verify } from './commands/verify';
22
+ export * from './utils';
3
23
  export declare const options: Partial<CLIOptions>;