chkit 0.1.0-beta.10

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 (138) hide show
  1. package/README.md +76 -0
  2. package/dist/bin/chkit.d.ts +3 -0
  3. package/dist/bin/chkit.d.ts.map +1 -0
  4. package/dist/bin/chkit.js +304 -0
  5. package/dist/bin/chkit.js.map +1 -0
  6. package/dist/bin/command-registry.d.ts +34 -0
  7. package/dist/bin/command-registry.d.ts.map +1 -0
  8. package/dist/bin/command-registry.js +87 -0
  9. package/dist/bin/command-registry.js.map +1 -0
  10. package/dist/bin/commands/check.d.ts +3 -0
  11. package/dist/bin/commands/check.d.ts.map +1 -0
  12. package/dist/bin/commands/check.js +131 -0
  13. package/dist/bin/commands/check.js.map +1 -0
  14. package/dist/bin/commands/codegen.d.ts +2 -0
  15. package/dist/bin/commands/codegen.d.ts.map +1 -0
  16. package/dist/bin/commands/codegen.js +25 -0
  17. package/dist/bin/commands/codegen.js.map +1 -0
  18. package/dist/bin/commands/drift.d.ts +23 -0
  19. package/dist/bin/commands/drift.d.ts.map +1 -0
  20. package/dist/bin/commands/drift.js +179 -0
  21. package/dist/bin/commands/drift.js.map +1 -0
  22. package/dist/bin/commands/generate/output.d.ts +8 -0
  23. package/dist/bin/commands/generate/output.d.ts.map +1 -0
  24. package/dist/bin/commands/generate/output.js +58 -0
  25. package/dist/bin/commands/generate/output.js.map +1 -0
  26. package/dist/bin/commands/generate/plan-pipeline.d.ts +7 -0
  27. package/dist/bin/commands/generate/plan-pipeline.d.ts.map +1 -0
  28. package/dist/bin/commands/generate/plan-pipeline.js +143 -0
  29. package/dist/bin/commands/generate/plan-pipeline.js.map +1 -0
  30. package/dist/bin/commands/generate/rename-mappings.d.ts +29 -0
  31. package/dist/bin/commands/generate/rename-mappings.d.ts.map +1 -0
  32. package/dist/bin/commands/generate/rename-mappings.js +195 -0
  33. package/dist/bin/commands/generate/rename-mappings.js.map +1 -0
  34. package/dist/bin/commands/generate.d.ts +3 -0
  35. package/dist/bin/commands/generate.d.ts.map +1 -0
  36. package/dist/bin/commands/generate.js +154 -0
  37. package/dist/bin/commands/generate.js.map +1 -0
  38. package/dist/bin/commands/init.d.ts +2 -0
  39. package/dist/bin/commands/init.d.ts.map +1 -0
  40. package/dist/bin/commands/init.js +12 -0
  41. package/dist/bin/commands/init.js.map +1 -0
  42. package/dist/bin/commands/migrate.d.ts +3 -0
  43. package/dist/bin/commands/migrate.d.ts.map +1 -0
  44. package/dist/bin/commands/migrate.js +270 -0
  45. package/dist/bin/commands/migrate.js.map +1 -0
  46. package/dist/bin/commands/plugin-like.d.ts +38 -0
  47. package/dist/bin/commands/plugin-like.d.ts.map +1 -0
  48. package/dist/bin/commands/plugin-like.js +101 -0
  49. package/dist/bin/commands/plugin-like.js.map +1 -0
  50. package/dist/bin/commands/plugin.d.ts +3 -0
  51. package/dist/bin/commands/plugin.d.ts.map +1 -0
  52. package/dist/bin/commands/plugin.js +148 -0
  53. package/dist/bin/commands/plugin.js.map +1 -0
  54. package/dist/bin/commands/pull.d.ts +2 -0
  55. package/dist/bin/commands/pull.d.ts.map +1 -0
  56. package/dist/bin/commands/pull.js +25 -0
  57. package/dist/bin/commands/pull.js.map +1 -0
  58. package/dist/bin/commands/status.d.ts +3 -0
  59. package/dist/bin/commands/status.d.ts.map +1 -0
  60. package/dist/bin/commands/status.js +53 -0
  61. package/dist/bin/commands/status.js.map +1 -0
  62. package/dist/bin/commands/typegen.d.ts +2 -0
  63. package/dist/bin/commands/typegen.d.ts.map +1 -0
  64. package/dist/bin/commands/typegen.js +25 -0
  65. package/dist/bin/commands/typegen.js.map +1 -0
  66. package/dist/bin/config.d.ts +13 -0
  67. package/dist/bin/config.d.ts.map +1 -0
  68. package/dist/bin/config.js +39 -0
  69. package/dist/bin/config.js.map +1 -0
  70. package/dist/bin/global-flags.d.ts +16 -0
  71. package/dist/bin/global-flags.d.ts.map +1 -0
  72. package/dist/bin/global-flags.js +7 -0
  73. package/dist/bin/global-flags.js.map +1 -0
  74. package/dist/bin/help.d.ts +5 -0
  75. package/dist/bin/help.d.ts.map +1 -0
  76. package/dist/bin/help.js +84 -0
  77. package/dist/bin/help.js.map +1 -0
  78. package/dist/bin/internal-plugins/index.d.ts +3 -0
  79. package/dist/bin/internal-plugins/index.d.ts.map +1 -0
  80. package/dist/bin/internal-plugins/index.js +5 -0
  81. package/dist/bin/internal-plugins/index.js.map +1 -0
  82. package/dist/bin/internal-plugins/skill-hint.d.ts +16 -0
  83. package/dist/bin/internal-plugins/skill-hint.d.ts.map +1 -0
  84. package/dist/bin/internal-plugins/skill-hint.js +101 -0
  85. package/dist/bin/internal-plugins/skill-hint.js.map +1 -0
  86. package/dist/bin/journal-store.d.ts +13 -0
  87. package/dist/bin/journal-store.d.ts.map +1 -0
  88. package/dist/bin/journal-store.js +79 -0
  89. package/dist/bin/journal-store.js.map +1 -0
  90. package/dist/bin/json-output.d.ts +8 -0
  91. package/dist/bin/json-output.d.ts.map +1 -0
  92. package/dist/bin/json-output.js +21 -0
  93. package/dist/bin/json-output.js.map +1 -0
  94. package/dist/bin/lib.d.ts +8 -0
  95. package/dist/bin/lib.d.ts.map +1 -0
  96. package/dist/bin/lib.js +8 -0
  97. package/dist/bin/lib.js.map +1 -0
  98. package/dist/bin/migration-store.d.ts +22 -0
  99. package/dist/bin/migration-store.d.ts.map +1 -0
  100. package/dist/bin/migration-store.js +60 -0
  101. package/dist/bin/migration-store.js.map +1 -0
  102. package/dist/bin/plugin-runtime.d.ts +42 -0
  103. package/dist/bin/plugin-runtime.d.ts.map +1 -0
  104. package/dist/bin/plugin-runtime.js +298 -0
  105. package/dist/bin/plugin-runtime.js.map +1 -0
  106. package/dist/bin/safety-markers.d.ts +24 -0
  107. package/dist/bin/safety-markers.d.ts.map +1 -0
  108. package/dist/bin/safety-markers.js +94 -0
  109. package/dist/bin/safety-markers.js.map +1 -0
  110. package/dist/bin/schema-loader.d.ts +3 -0
  111. package/dist/bin/schema-loader.d.ts.map +1 -0
  112. package/dist/bin/schema-loader.js +6 -0
  113. package/dist/bin/schema-loader.js.map +1 -0
  114. package/dist/bin/table-scope.d.ts +39 -0
  115. package/dist/bin/table-scope.d.ts.map +1 -0
  116. package/dist/bin/table-scope.js +167 -0
  117. package/dist/bin/table-scope.js.map +1 -0
  118. package/dist/bin/version.d.ts +2 -0
  119. package/dist/bin/version.d.ts.map +1 -0
  120. package/dist/bin/version.js +5 -0
  121. package/dist/bin/version.js.map +1 -0
  122. package/dist/drift-diff.d.ts +8 -0
  123. package/dist/drift-diff.d.ts.map +1 -0
  124. package/dist/drift-diff.js +46 -0
  125. package/dist/drift-diff.js.map +1 -0
  126. package/dist/drift.d.ts +65 -0
  127. package/dist/drift.d.ts.map +1 -0
  128. package/dist/drift.js +204 -0
  129. package/dist/drift.js.map +1 -0
  130. package/dist/index.d.ts +2 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +2 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/plugins.d.ts +142 -0
  135. package/dist/plugins.d.ts.map +1 -0
  136. package/dist/plugins.js +11 -0
  137. package/dist/plugins.js.map +1 -0
  138. package/package.json +33 -0
@@ -0,0 +1,270 @@
1
+ import { mkdir, readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import process from 'node:process';
4
+ import { createInterface } from 'node:readline/promises';
5
+ import { defineFlags, typedFlags } from '../../plugins.js';
6
+ import { GLOBAL_FLAGS } from '../global-flags.js';
7
+ import { emitJson } from '../json-output.js';
8
+ import { createJournalStoreFromConfig } from '../journal-store.js';
9
+ import { checksumSQL, findChecksumMismatches, listMigrations, readSnapshot, } from '../migration-store.js';
10
+ import { collectDestructiveOperationMarkers, extractExecutableStatements, extractMigrationOperationSummaries, migrationContainsDangerOperation, } from '../safety-markers.js';
11
+ import { databaseKeyFromOperationKey, resolveTableScope, tableKeyFromOperationKey, tableKeysFromDefinitions } from '../table-scope.js';
12
+ const MIGRATE_FLAGS = defineFlags([
13
+ { name: '--apply', type: 'boolean', description: 'Apply pending migrations on ClickHouse (no prompt)' },
14
+ { name: '--execute', type: 'boolean', description: 'Alias for --apply' },
15
+ { name: '--allow-destructive', type: 'boolean', description: 'Allow destructive migrations tagged with risk=danger' },
16
+ ]);
17
+ export const migrateCommand = {
18
+ name: 'migrate',
19
+ description: 'Review or execute pending migrations',
20
+ flags: MIGRATE_FLAGS,
21
+ run: cmdMigrate,
22
+ };
23
+ function isBackgroundOrCI() {
24
+ return process.env.CI === '1' || process.env.CI === 'true' || !process.stdin.isTTY || !process.stdout.isTTY;
25
+ }
26
+ function printDestructiveOperationDetails(markers) {
27
+ console.log('Destructive operations detected:');
28
+ for (const [index, marker] of markers.entries()) {
29
+ console.log(`${index + 1}. ${marker.migration}`);
30
+ console.log(` operation: ${marker.type}`);
31
+ console.log(` key: ${marker.key}`);
32
+ console.log(` warning: ${marker.warningCode}`);
33
+ console.log(` reason: ${marker.reason}`);
34
+ console.log(` impact: ${marker.impact}`);
35
+ console.log(` recommendation: ${marker.recommendation}`);
36
+ }
37
+ }
38
+ async function confirmDestructiveExecution(markers) {
39
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
40
+ try {
41
+ printDestructiveOperationDetails(markers);
42
+ console.log('');
43
+ console.log('Type "yes" to continue. Any other input cancels.');
44
+ const response = await rl.question('Apply destructive operations? [no/yes]: ');
45
+ return response.trim().toLowerCase() === 'yes';
46
+ }
47
+ finally {
48
+ rl.close();
49
+ }
50
+ }
51
+ async function filterPendingByScope(migrationsDir, pending, selectedTables) {
52
+ const selectedDatabases = new Set([...selectedTables].map((table) => table.split('.')[0] ?? ''));
53
+ const inScope = [];
54
+ for (const file of pending) {
55
+ const sql = await readFile(join(migrationsDir, file), 'utf8');
56
+ const operations = extractMigrationOperationSummaries(sql);
57
+ const matches = operations.some((operation) => {
58
+ const tableKey = tableKeyFromOperationKey(operation.key);
59
+ if (tableKey)
60
+ return selectedTables.has(tableKey);
61
+ const database = databaseKeyFromOperationKey(operation.key);
62
+ if (database)
63
+ return selectedDatabases.has(database);
64
+ return false;
65
+ });
66
+ if (matches)
67
+ inScope.push(file);
68
+ }
69
+ return inScope;
70
+ }
71
+ async function cmdMigrate(ctx) {
72
+ const { flags, config, configPath, dirs, pluginRuntime } = ctx;
73
+ const f = typedFlags(flags, [...GLOBAL_FLAGS, ...MIGRATE_FLAGS]);
74
+ const executeRequested = f['--apply'] === true || f['--execute'] === true;
75
+ const allowDestructive = f['--allow-destructive'] === true;
76
+ const tableSelector = f['--table'];
77
+ const jsonMode = f['--json'] === true;
78
+ const { migrationsDir, metaDir } = dirs;
79
+ if (!config.clickhouse) {
80
+ throw new Error('clickhouse config is required for migrate (journal is stored in ClickHouse)');
81
+ }
82
+ const { journalStore, db } = createJournalStoreFromConfig(config.clickhouse);
83
+ const snapshot = await readSnapshot(metaDir);
84
+ const tableScope = resolveTableScope(tableSelector, tableKeysFromDefinitions(snapshot?.definitions ?? []));
85
+ await pluginRuntime.runOnConfigLoaded({
86
+ command: 'migrate',
87
+ config,
88
+ configPath,
89
+ tableScope,
90
+ flags,
91
+ });
92
+ await mkdir(migrationsDir, { recursive: true });
93
+ const files = await listMigrations(migrationsDir);
94
+ const journal = await journalStore.readJournal();
95
+ const appliedNames = new Set(journal.applied.map((entry) => entry.name));
96
+ const pendingAll = files.filter((f) => !appliedNames.has(f));
97
+ const checksumMismatches = await findChecksumMismatches(migrationsDir, journal);
98
+ if (checksumMismatches.length > 0) {
99
+ if (jsonMode) {
100
+ emitJson('migrate', {
101
+ mode: executeRequested ? 'execute' : 'plan',
102
+ scope: tableScope,
103
+ error: 'Checksum mismatch detected on applied migrations',
104
+ checksumMismatches,
105
+ });
106
+ process.exitCode = 1;
107
+ return;
108
+ }
109
+ throw new Error(`Checksum mismatch detected on applied migrations: ${checksumMismatches
110
+ .map((item) => item.name)
111
+ .join(', ')}`);
112
+ }
113
+ if (tableScope.enabled && tableScope.matchCount === 0) {
114
+ if (jsonMode) {
115
+ emitJson('migrate', {
116
+ mode: executeRequested ? 'execute' : 'plan',
117
+ scope: tableScope,
118
+ pending: [],
119
+ applied: [],
120
+ warning: `No tables matched selector "${tableScope.selector ?? ''}".`,
121
+ });
122
+ }
123
+ else {
124
+ console.log(`No tables matched selector "${tableScope.selector ?? ''}". No migrations selected.`);
125
+ }
126
+ return;
127
+ }
128
+ const pending = tableScope.enabled
129
+ ? await filterPendingByScope(migrationsDir, pendingAll, new Set(tableScope.matchedTables))
130
+ : pendingAll;
131
+ if (pending.length === 0) {
132
+ if (jsonMode) {
133
+ emitJson('migrate', {
134
+ mode: executeRequested ? 'execute' : 'plan',
135
+ scope: tableScope,
136
+ pending: [],
137
+ applied: [],
138
+ });
139
+ }
140
+ else {
141
+ console.log('No pending migrations.');
142
+ }
143
+ return;
144
+ }
145
+ const planned = {
146
+ mode: executeRequested ? 'execute' : 'plan',
147
+ scope: tableScope,
148
+ pending,
149
+ };
150
+ if (jsonMode && !executeRequested) {
151
+ emitJson('migrate', planned);
152
+ return;
153
+ }
154
+ if (!jsonMode) {
155
+ if (tableScope.enabled) {
156
+ console.log(`Table scope: ${tableScope.selector ?? ''} (${tableScope.matchCount} matched)`);
157
+ for (const table of tableScope.matchedTables)
158
+ console.log(`- ${table}`);
159
+ }
160
+ console.log(`Pending migrations: ${pending.length}`);
161
+ for (const file of pending)
162
+ console.log(`- ${file}`);
163
+ }
164
+ let shouldExecute = executeRequested;
165
+ if (!shouldExecute) {
166
+ if (isBackgroundOrCI() || jsonMode) {
167
+ if (!jsonMode) {
168
+ console.log('\nPlan only. Re-run with --apply to apply and journal these migrations.');
169
+ }
170
+ return;
171
+ }
172
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
173
+ try {
174
+ console.log('');
175
+ console.log('Type "yes" to continue. Any other input cancels.');
176
+ const response = await rl.question('Apply pending migrations now? [no/yes]: ');
177
+ shouldExecute = response.trim().toLowerCase() === 'yes';
178
+ }
179
+ finally {
180
+ rl.close();
181
+ }
182
+ if (!shouldExecute) {
183
+ console.log('Migration apply cancelled by user.');
184
+ return;
185
+ }
186
+ }
187
+ const destructiveMigrations = [];
188
+ const destructiveOperations = [];
189
+ for (const file of pending) {
190
+ const sql = await readFile(join(migrationsDir, file), 'utf8');
191
+ if (migrationContainsDangerOperation(sql)) {
192
+ destructiveMigrations.push(file);
193
+ destructiveOperations.push(...collectDestructiveOperationMarkers(file, sql));
194
+ }
195
+ }
196
+ let destructiveAllowed = allowDestructive || config.safety?.allowDestructive === true;
197
+ if (destructiveMigrations.length > 0 && !destructiveAllowed) {
198
+ const error = 'Blocked destructive migration execution. Re-run with --allow-destructive or set safety.allowDestructive=true after review.';
199
+ if (jsonMode) {
200
+ emitJson('migrate', {
201
+ mode: 'execute',
202
+ scope: tableScope,
203
+ error,
204
+ destructiveMigrations,
205
+ destructiveOperations,
206
+ });
207
+ process.exitCode = 3;
208
+ return;
209
+ }
210
+ if (isBackgroundOrCI()) {
211
+ printDestructiveOperationDetails(destructiveOperations);
212
+ throw new Error(`${error}\nDestructive migrations: ${destructiveMigrations.join(', ')}\n` +
213
+ 'Non-interactive run detected. Pass --allow-destructive to proceed.');
214
+ }
215
+ const confirmed = await confirmDestructiveExecution(destructiveOperations);
216
+ if (!confirmed) {
217
+ throw new Error(`Destructive migration cancelled by user.\nDestructive migrations: ${destructiveMigrations.join(', ')}`);
218
+ }
219
+ destructiveAllowed = true;
220
+ }
221
+ if (destructiveMigrations.length > 0 && !destructiveAllowed) {
222
+ throw new Error('Blocked destructive migration execution.');
223
+ }
224
+ const appliedNow = [];
225
+ for (const file of pending) {
226
+ const fullPath = join(migrationsDir, file);
227
+ const sql = await readFile(fullPath, 'utf8');
228
+ const parsedStatements = extractExecutableStatements(sql);
229
+ const statements = await pluginRuntime.runOnBeforeApply({
230
+ command: 'migrate',
231
+ config,
232
+ tableScope,
233
+ flags,
234
+ migration: file,
235
+ sql,
236
+ statements: parsedStatements,
237
+ });
238
+ for (const statement of statements) {
239
+ await db.execute(statement);
240
+ }
241
+ const entry = {
242
+ name: file,
243
+ appliedAt: new Date().toISOString().replace('Z', ''),
244
+ checksum: checksumSQL(sql),
245
+ };
246
+ appliedNow.push(entry);
247
+ await journalStore.appendEntry(entry);
248
+ await pluginRuntime.runOnAfterApply({
249
+ command: 'migrate',
250
+ config,
251
+ tableScope,
252
+ flags,
253
+ migration: file,
254
+ statements,
255
+ appliedAt: entry.appliedAt,
256
+ });
257
+ if (!jsonMode)
258
+ console.log(`Applied: ${file}`);
259
+ }
260
+ if (jsonMode) {
261
+ emitJson('migrate', {
262
+ mode: 'execute',
263
+ scope: tableScope,
264
+ applied: appliedNow,
265
+ });
266
+ return;
267
+ }
268
+ console.log(`\nMigrations recorded in ClickHouse _chkit_migrations table.`);
269
+ }
270
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/bin/commands/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,UAAU,EAA2C,MAAM,kBAAkB,CAAA;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EACL,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,YAAY,GAEb,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,kCAAkC,EAClC,gCAAgC,GAEjC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,wBAAwB,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S,EAAE,IAAI;YACf,GAAG;YACH,UAAU,EAAE,gBAAgB;SAC7B,CAAC,CAAA;QACF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC7B,CAAC;QAED,MAAM,KAAK,GAA0B;YACnC,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;YACpD,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC;SAC3B,CAAA;QACD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACtB,MAAM,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;QACrC,MAAM,aAAa,CAAC,eAAe,CAAC;YAClC,OAAO,EAAE,SAAS;YAClB,MAAM;YACN,UAAU;YACV,KAAK;YACL,SAAS,EAAE,IAAI;YACf,UAAU;YACV,SAAS,EAAE,KAAK,CAAC,SAAS;SAC3B,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ;YAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,QAAQ,CAAC,SAAS,EAAE;YAClB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,UAAU;SACpB,CAAC,CAAA;QACF,OAAM;IACR,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAA;AAC7E,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { getCommandContext } from '../config.js';
2
+ import { type PluginRuntime } from '../plugin-runtime.js';
3
+ import { type TableScope } from '../table-scope.js';
4
+ export interface PluginLikeContext {
5
+ config: Awaited<ReturnType<typeof getCommandContext>>['config'];
6
+ configPath: string;
7
+ jsonMode: boolean;
8
+ runtime: PluginRuntime;
9
+ commandArgs: string[];
10
+ tableScope: TableScope;
11
+ }
12
+ interface BuildPluginLikeContextInput {
13
+ args: string[];
14
+ command: 'plugin' | 'codegen' | 'pull';
15
+ handleInvalidPluginOptions?: boolean;
16
+ }
17
+ interface MissingPluginArgs {
18
+ pluginName: string;
19
+ availablePlugins: string[];
20
+ }
21
+ interface MissingCommandArgs {
22
+ pluginName: string;
23
+ commandName: string;
24
+ availableCommands: string[];
25
+ }
26
+ interface RunPluginLikeCommandInput {
27
+ context: PluginLikeContext;
28
+ pluginName: string;
29
+ commandName: string;
30
+ commandArgs: string[];
31
+ missingPluginMessage?: (args: MissingPluginArgs) => string;
32
+ missingCommandMessage?: (args: MissingCommandArgs) => string;
33
+ }
34
+ export declare function stripGlobalFlags(args: string[]): string[];
35
+ export declare function buildPluginLikeContext(input: BuildPluginLikeContextInput): Promise<PluginLikeContext | null>;
36
+ export declare function runPluginLikeCommand(input: RunPluginLikeCommandInput): Promise<void>;
37
+ export {};
38
+ //# sourceMappingURL=plugin-like.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-like.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/plugin-like.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAY,MAAM,cAAc,CAAA;AAG1D,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAA+C,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGhG,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC/D,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,aAAa,CAAA;IACtB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,UAAU,EAAE,UAAU,CAAA;CACvB;AAED,UAAU,2BAA2B;IACnC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;IACtC,0BAA0B,CAAC,EAAE,OAAO,CAAA;CACrC;AAED,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,EAAE,CAAA;CAC3B;AAED,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAA;CAC5B;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,MAAM,CAAA;IAC1D,qBAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,MAAM,CAAA;CAC7D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAiBzD;AAED,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,2BAA2B,GACjC,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAqCnC;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6C1F"}
@@ -0,0 +1,101 @@
1
+ import process from 'node:process';
2
+ import { getCommandContext, parseArg } from '../config.js';
3
+ import { loadSchemaDefinitions } from '../lib.js';
4
+ import { printOutput } from '../json-output.js';
5
+ import { loadPluginRuntime } from '../plugin-runtime.js';
6
+ import { resolveTableScope, tableKeysFromDefinitions } from '../table-scope.js';
7
+ import { CLI_VERSION } from '../version.js';
8
+ export function stripGlobalFlags(args) {
9
+ const tokens = [];
10
+ for (let i = 0; i < args.length; i += 1) {
11
+ const value = args[i];
12
+ if (!value)
13
+ continue;
14
+ if (value === '--json')
15
+ continue;
16
+ if (value === '--config') {
17
+ i += 1;
18
+ continue;
19
+ }
20
+ if (value === '--table') {
21
+ i += 1;
22
+ continue;
23
+ }
24
+ tokens.push(value);
25
+ }
26
+ return tokens;
27
+ }
28
+ export async function buildPluginLikeContext(input) {
29
+ const commandArgs = stripGlobalFlags(input.args);
30
+ const { config, configPath, jsonMode } = await getCommandContext(input.args);
31
+ const selector = parseArg('--table', input.args);
32
+ const definitions = await loadSchemaDefinitions(config.schema);
33
+ const tableScope = resolveTableScope(selector, tableKeysFromDefinitions(definitions));
34
+ const runtime = await loadPluginRuntime({
35
+ config,
36
+ configPath,
37
+ cliVersion: CLI_VERSION,
38
+ });
39
+ try {
40
+ await runtime.runOnConfigLoaded({
41
+ command: input.command,
42
+ config,
43
+ configPath,
44
+ tableScope,
45
+ });
46
+ }
47
+ catch (error) {
48
+ const message = error instanceof Error ? error.message : String(error);
49
+ if (input.handleInvalidPluginOptions && message.includes('Invalid plugin option')) {
50
+ printOutput({ ok: false, error: message }, jsonMode);
51
+ process.exitCode = 2;
52
+ return null;
53
+ }
54
+ throw error;
55
+ }
56
+ return {
57
+ config,
58
+ configPath,
59
+ jsonMode,
60
+ runtime,
61
+ commandArgs,
62
+ tableScope,
63
+ };
64
+ }
65
+ export async function runPluginLikeCommand(input) {
66
+ const selectedPlugin = input.context.runtime.plugins.find((entry) => entry.plugin.manifest.name === input.pluginName);
67
+ if (!selectedPlugin) {
68
+ const availablePlugins = input.context.runtime.plugins
69
+ .map((entry) => entry.plugin.manifest.name)
70
+ .sort();
71
+ if (input.missingPluginMessage) {
72
+ throw new Error(input.missingPluginMessage({ pluginName: input.pluginName, availablePlugins }));
73
+ }
74
+ throw new Error(`Unknown plugin "${input.pluginName}". Available: ${availablePlugins.length > 0 ? availablePlugins.join(', ') : '(none)'}.`);
75
+ }
76
+ const foundCommand = input.context.runtime.getCommand(input.pluginName, input.commandName);
77
+ if (!foundCommand) {
78
+ const availableCommands = (selectedPlugin.plugin.commands ?? []).map((command) => command.name).sort();
79
+ if (input.missingCommandMessage) {
80
+ throw new Error(input.missingCommandMessage({
81
+ pluginName: input.pluginName,
82
+ commandName: input.commandName,
83
+ availableCommands,
84
+ }));
85
+ }
86
+ throw new Error(`Unknown command "${input.commandName}" for plugin "${input.pluginName}". Available: ${availableCommands.length > 0 ? availableCommands.join(', ') : '(none)'}.`);
87
+ }
88
+ const exitCode = await input.context.runtime.runPluginCommand(input.pluginName, input.commandName, {
89
+ config: input.context.config,
90
+ configPath: input.context.configPath,
91
+ jsonMode: input.context.jsonMode,
92
+ tableScope: input.context.tableScope,
93
+ args: input.commandArgs,
94
+ print(value) {
95
+ printOutput(value, input.context.jsonMode);
96
+ },
97
+ });
98
+ if (exitCode !== 0)
99
+ process.exitCode = exitCode;
100
+ }
101
+ //# sourceMappingURL=plugin-like.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-like.js","sourceRoot":"","sources":["../../../src/bin/commands/plugin-like.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAsB,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAmB,MAAM,mBAAmB,CAAA;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAqC3C,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC7C,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC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AAC,WAAW;QACvB,KAAK,CAAC,KAAK;YACT,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC5C,CAAC;KACF,CAAC,CAAA;IAEF,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACjD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type CommandDef } from '../../plugins.js';
2
+ export declare const pluginCommand: CommandDef;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,UAAU,EAA4C,MAAM,kBAAkB,CAAA;AAOxG,eAAO,MAAM,aAAa,EAAE,UAK3B,CAAA"}
@@ -0,0 +1,148 @@
1
+ import { typedFlags } from '../../plugins.js';
2
+ import { GLOBAL_FLAGS } from '../global-flags.js';
3
+ import { emitJson, printOutput } from '../json-output.js';
4
+ import { parseFlags, UnknownFlagError, MissingFlagValueError } from '@chkit/core';
5
+ import { resolveTableScope, tableKeysFromDefinitions } from '../table-scope.js';
6
+ import { loadSchemaDefinitions } from '../schema-loader.js';
7
+ export const pluginCommand = {
8
+ name: 'plugin',
9
+ description: 'List plugins and run plugin namespace commands',
10
+ flags: [],
11
+ run: cmdPlugin,
12
+ };
13
+ const GLOBAL_STRING_FLAGS = new Set(['--config', '--table']);
14
+ const GLOBAL_BOOLEAN_FLAGS = new Set(['--json', '-h', '--help']);
15
+ async function cmdPlugin(ctx) {
16
+ const { flags, config, configPath, pluginRuntime } = ctx;
17
+ const jsonMode = flags['--json'] === true;
18
+ const argv = process.argv.slice(2);
19
+ const pluginIdx = argv.indexOf('plugin');
20
+ const afterPlugin = pluginIdx >= 0 ? argv.slice(pluginIdx + 1) : [];
21
+ const filtered = [];
22
+ for (let i = 0; i < afterPlugin.length; i++) {
23
+ const token = afterPlugin[i];
24
+ if (GLOBAL_BOOLEAN_FLAGS.has(token))
25
+ continue;
26
+ if (GLOBAL_STRING_FLAGS.has(token)) {
27
+ i++;
28
+ continue;
29
+ }
30
+ filtered.push(token);
31
+ }
32
+ const pluginName = filtered[0];
33
+ const commandName = filtered[1];
34
+ const commandArgs = filtered.slice(2);
35
+ if (pluginRuntime.plugins.length === 0) {
36
+ if (jsonMode) {
37
+ emitJson('plugin', {
38
+ error: 'No plugins configured. Add entries to config.plugins first.',
39
+ plugins: [],
40
+ });
41
+ process.exitCode = 1;
42
+ return;
43
+ }
44
+ throw new Error('No plugins configured. Add entries to config.plugins first.');
45
+ }
46
+ if (!pluginName) {
47
+ const payload = {
48
+ plugins: pluginRuntime.plugins.map((entry) => ({
49
+ name: entry.plugin.manifest.name,
50
+ version: entry.plugin.manifest.version ?? null,
51
+ commands: (entry.plugin.commands ?? []).map((command) => ({
52
+ name: command.name,
53
+ description: command.description ?? '',
54
+ })),
55
+ })),
56
+ };
57
+ if (jsonMode) {
58
+ emitJson('plugin', payload);
59
+ return;
60
+ }
61
+ console.log('Configured plugins:');
62
+ for (const plugin of payload.plugins) {
63
+ console.log(`- ${plugin.name}${plugin.version ? ` (v${plugin.version})` : ''}`);
64
+ if (plugin.commands.length === 0) {
65
+ console.log(' (no commands)');
66
+ continue;
67
+ }
68
+ for (const command of plugin.commands) {
69
+ console.log(` - ${command.name}${command.description ? `: ${command.description}` : ''}`);
70
+ }
71
+ }
72
+ return;
73
+ }
74
+ const selectedPlugin = pluginRuntime.plugins.find((entry) => entry.plugin.manifest.name === pluginName);
75
+ if (!selectedPlugin) {
76
+ const known = pluginRuntime.plugins.map((entry) => entry.plugin.manifest.name).sort();
77
+ throw new Error(`Unknown plugin "${pluginName}". Available: ${known.length > 0 ? known.join(', ') : '(none)'}.`);
78
+ }
79
+ if (!commandName) {
80
+ const commands = (selectedPlugin.plugin.commands ?? []).map((command) => ({
81
+ name: command.name,
82
+ description: command.description ?? '',
83
+ }));
84
+ const payload = {
85
+ plugin: selectedPlugin.plugin.manifest.name,
86
+ commands,
87
+ };
88
+ if (jsonMode) {
89
+ emitJson('plugin', payload);
90
+ return;
91
+ }
92
+ if (commands.length === 0) {
93
+ console.log(`Plugin "${selectedPlugin.plugin.manifest.name}" has no registered commands.`);
94
+ return;
95
+ }
96
+ console.log(`Plugin commands for "${selectedPlugin.plugin.manifest.name}":`);
97
+ for (const command of commands) {
98
+ console.log(`- ${command.name}${command.description ? `: ${command.description}` : ''}`);
99
+ }
100
+ return;
101
+ }
102
+ const gf = typedFlags(flags, GLOBAL_FLAGS);
103
+ const tableSelector = gf['--table'];
104
+ let tableScope;
105
+ try {
106
+ const definitions = await loadSchemaDefinitions(ctx.config.schema);
107
+ tableScope = resolveTableScope(tableSelector, tableKeysFromDefinitions(definitions));
108
+ }
109
+ catch {
110
+ tableScope = resolveTableScope(tableSelector, []);
111
+ }
112
+ // Parse plugin-specific flags when the command declares them
113
+ const targetCommand = (selectedPlugin.plugin.commands ?? []).find((cmd) => cmd.name === commandName);
114
+ let mergedFlags = { ...flags };
115
+ if (targetCommand?.flags && targetCommand.flags.length > 0) {
116
+ try {
117
+ const parsed = parseFlags(commandArgs, targetCommand.flags);
118
+ mergedFlags = { ...flags, ...parsed };
119
+ }
120
+ catch (error) {
121
+ if (error instanceof UnknownFlagError || error instanceof MissingFlagValueError) {
122
+ if (jsonMode) {
123
+ emitJson('plugin', { ok: false, error: error.message });
124
+ }
125
+ else {
126
+ console.error(error.message);
127
+ }
128
+ process.exitCode = 1;
129
+ return;
130
+ }
131
+ throw error;
132
+ }
133
+ }
134
+ const exitCode = await pluginRuntime.runPluginCommand(pluginName, commandName, {
135
+ config,
136
+ configPath,
137
+ jsonMode,
138
+ tableScope,
139
+ args: commandArgs,
140
+ flags: mergedFlags,
141
+ print(value) {
142
+ printOutput(value, jsonMode);
143
+ },
144
+ });
145
+ if (exitCode !== 0)
146
+ process.exitCode = exitCode;
147
+ }
148
+ //# sourceMappingURL=plugin.js.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qB,EAAE,CAAC;gBAChF,IAAI,QAAQ,EAAE,CAAC;oBACb,QAAQ,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBACzD,CAAC;qBAAM,CAAC;oBACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;gBAC9B,CAAC;gBACD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;gBACpB,OAAM;YACR,CAAC;YACD,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,gBAAgB,CAAC,UAAU,EAAE,WAAW,EAAE;QAC7E,MAAM;QACN,UAAU;QACV,QAAQ;QACR,UAAU;QACV,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,KAAK,CAAC,KAAK;YACT,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAC9B,CAAC;KACF,CAAC,CAAA;IAEF,IAAI,QAAQ,KAAK,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAA;AACjD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function cmdPull(args: string[]): Promise<void>;
2
+ //# sourceMappingURL=pull.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/pull.ts"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB3D"}
@@ -0,0 +1,25 @@
1
+ import { buildPluginLikeContext, runPluginLikeCommand } from './plugin-like.js';
2
+ export async function cmdPull(args) {
3
+ const context = await buildPluginLikeContext({
4
+ args,
5
+ command: 'pull',
6
+ handleInvalidPluginOptions: true,
7
+ });
8
+ if (!context)
9
+ return;
10
+ const pluginName = 'pull';
11
+ const commandName = 'schema';
12
+ await runPluginLikeCommand({
13
+ context,
14
+ pluginName,
15
+ commandName,
16
+ commandArgs: context.commandArgs,
17
+ missingPluginMessage() {
18
+ return 'Pull plugin is not configured. Add a plugin with manifest.name "pull" to config.plugins.';
19
+ },
20
+ missingCommandMessage({ availableCommands }) {
21
+ return `Pull plugin is configured but does not expose command "${commandName}". Available: ${availableCommands.length > 0 ? availableCommands.join(', ') : '(none)'}.`;
22
+ },
23
+ });
24
+ }
25
+ //# sourceMappingURL=pull.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull.js","sourceRoot":"","sources":["../../../src/bin/commands/pull.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAE/E,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAc;IAC1C,MAAM,OAAO,GAAG,MAAM,sBAAsB,CAAC;QAC3C,IAAI;QACJ,OAAO,EAAE,MAAM;QACf,0BAA0B,EAAE,IAAI;KACjC,CAAC,CAAA;IACF,IAAI,CAAC,OAAO;QAAE,OAAM;IAEpB,MAAM,UAAU,GAAG,MAAM,CAAA;IACzB,MAAM,WAAW,GAAG,QAAQ,CAAA;IAC5B,MAAM,oBAAoB,CAAC;QACzB,OAAO;QACP,UAAU;QACV,WAAW;QACX,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,oBAAoB;YAClB,OAAO,0FAA0F,CAAA;QACnG,CAAC;QACD,qBAAqB,CAAC,EAAE,iBAAiB,EAAE;YACzC,OAAO,0DAA0D,WAAW,iBAAiB,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAA;QACxK,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CommandDef } from '../../plugins.js';
2
+ export declare const statusCommand: CommandDef;
3
+ //# sourceMappingURL=status.d.ts.map