schemashift-cli 0.9.0 → 0.11.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.
- package/dist/cli.js +289 -8
- package/dist/index.cjs +32 -2
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +28 -3
- package/package.json +14 -8
package/dist/cli.js
CHANGED
|
@@ -10,12 +10,17 @@ import { existsSync as existsSync4, readFileSync as readFileSync4, statSync, wri
|
|
|
10
10
|
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
11
11
|
import { fileURLToPath } from "url";
|
|
12
12
|
import {
|
|
13
|
+
ApprovalManager,
|
|
13
14
|
BehavioralWarningAnalyzer,
|
|
14
15
|
BundleEstimator,
|
|
15
16
|
CompatibilityAnalyzer,
|
|
16
17
|
DetailedAnalyzer,
|
|
17
18
|
detectFormLibraries,
|
|
18
19
|
GovernanceEngine,
|
|
20
|
+
GovernanceFixer,
|
|
21
|
+
GraphExporter,
|
|
22
|
+
getAllMigrationTemplates,
|
|
23
|
+
getMigrationTemplate,
|
|
19
24
|
IncrementalTracker,
|
|
20
25
|
loadConfig,
|
|
21
26
|
MigrationAuditLog,
|
|
@@ -28,6 +33,7 @@ import {
|
|
|
28
33
|
TransformEngine,
|
|
29
34
|
TypeDedupDetector
|
|
30
35
|
} from "@schemashift/core";
|
|
36
|
+
import { createIoTsToEffectHandler } from "@schemashift/io-ts-effect";
|
|
31
37
|
import { createIoTsToZodHandler } from "@schemashift/io-ts-zod";
|
|
32
38
|
import { createJoiToZodHandler } from "@schemashift/joi-zod";
|
|
33
39
|
|
|
@@ -35888,7 +35894,12 @@ var TIER_FEATURES = {
|
|
|
35888
35894
|
"zod->valibot",
|
|
35889
35895
|
"any->valibot",
|
|
35890
35896
|
"zod->yup",
|
|
35891
|
-
"valibot->zod"
|
|
35897
|
+
"valibot->zod",
|
|
35898
|
+
"zod->arktype",
|
|
35899
|
+
"arktype->zod",
|
|
35900
|
+
"zod->superstruct",
|
|
35901
|
+
"superstruct->zod",
|
|
35902
|
+
"io-ts->effect"
|
|
35892
35903
|
],
|
|
35893
35904
|
devices: 4,
|
|
35894
35905
|
ciSupport: true,
|
|
@@ -35930,7 +35941,12 @@ var TIER_FEATURES = {
|
|
|
35930
35941
|
"any->valibot",
|
|
35931
35942
|
"zod->valibot",
|
|
35932
35943
|
"zod->yup",
|
|
35933
|
-
"valibot->zod"
|
|
35944
|
+
"valibot->zod",
|
|
35945
|
+
"zod->arktype",
|
|
35946
|
+
"arktype->zod",
|
|
35947
|
+
"zod->superstruct",
|
|
35948
|
+
"superstruct->zod",
|
|
35949
|
+
"io-ts->effect"
|
|
35934
35950
|
],
|
|
35935
35951
|
devices: Infinity,
|
|
35936
35952
|
ciSupport: true,
|
|
@@ -36235,6 +36251,11 @@ var LicenseManager = class {
|
|
|
36235
36251
|
|
|
36236
36252
|
// src/cli.ts
|
|
36237
36253
|
import { createYupToZodHandler, createZodToYupHandler } from "@schemashift/yup-zod";
|
|
36254
|
+
import { createArktypeToZodHandler, createZodToArktypeHandler } from "@schemashift/zod-arktype";
|
|
36255
|
+
import {
|
|
36256
|
+
createSuperstructToZodHandler,
|
|
36257
|
+
createZodToSuperstructHandler
|
|
36258
|
+
} from "@schemashift/zod-superstruct";
|
|
36238
36259
|
import { createZodV3ToV4Handler } from "@schemashift/zod-v3-v4";
|
|
36239
36260
|
import { createValibotToZodHandler, createZodToValibotHandler } from "@schemashift/zod-valibot";
|
|
36240
36261
|
import { Command } from "commander";
|
|
@@ -37024,6 +37045,11 @@ engine.registerHandler("zod-v3", "v4", createZodV3ToV4Handler());
|
|
|
37024
37045
|
engine.registerHandler("zod", "valibot", createZodToValibotHandler());
|
|
37025
37046
|
engine.registerHandler("zod", "yup", createZodToYupHandler());
|
|
37026
37047
|
engine.registerHandler("valibot", "zod", createValibotToZodHandler());
|
|
37048
|
+
engine.registerHandler("zod", "arktype", createZodToArktypeHandler());
|
|
37049
|
+
engine.registerHandler("arktype", "zod", createArktypeToZodHandler());
|
|
37050
|
+
engine.registerHandler("zod", "superstruct", createZodToSuperstructHandler());
|
|
37051
|
+
engine.registerHandler("superstruct", "zod", createSuperstructToZodHandler());
|
|
37052
|
+
engine.registerHandler("io-ts", "effect", createIoTsToEffectHandler());
|
|
37027
37053
|
var POLAR_URL = "https://schemashift.qwady.app";
|
|
37028
37054
|
program.name("schemashift").version(pkg.version).description("TypeScript schema migration CLI");
|
|
37029
37055
|
program.command("init").description("Create .schemashiftrc.json config file").option("-f, --force", "Overwrite existing config").action((options) => {
|
|
@@ -37366,12 +37392,56 @@ Migration Readiness: ${from} -> ${to}
|
|
|
37366
37392
|
}
|
|
37367
37393
|
}
|
|
37368
37394
|
});
|
|
37369
|
-
program.command("migrate <path>").description("Migrate schemas from one library to another").
|
|
37395
|
+
program.command("migrate <path>").description("Migrate schemas from one library to another").option("-f, --from <library>", "Source library (yup, joi, io-ts, zod-v3, zod)").option("-t, --to <library>", "Target library (zod, v4, valibot, yup, arktype, superstruct)").option("-d, --dry-run", "Preview changes without writing files").option("-v, --verbose", "Show detailed transformation info").option("-c, --config <path>", "Path to config file").option("--report <format>", "Generate report (json, html, csv)").option("--report-output <path>", "Report output path").option("--git-branch", "Create git branch for changes").option("--git-commit", "Auto-commit changes").option("--no-backup", "Skip backup creation").option("--yes", "Skip confirmation prompt").option("--ci", "CI mode (non-interactive, exit code on failure)").option("--cross-file", "Resolve cross-file schema dependencies (Pro+)").option("--chain <path>", "Chain migrations, e.g. yup->zod->valibot (Pro+)").option("--compat-check", "Run compatibility check before migration (Pro+)").option("--fail-on-warnings", "Exit 1 if any warnings (Team+)").option(
|
|
37370
37396
|
"--max-risk-score <score>",
|
|
37371
37397
|
"Exit 1 if any file exceeds risk score (Team+)",
|
|
37372
37398
|
Number.parseInt
|
|
37373
|
-
).option("--incremental", "Enable incremental migration (file-by-file with progress tracking)").option("--resume", "Resume a previously started incremental migration").option("--incremental-status", "Show incremental migration progress").option("--scaffold-tests", "Generate validation tests after migration (Pro+)").option("--audit", "Enable migration audit logging (Team+)").action(async (targetPath, options) => {
|
|
37399
|
+
).option("--incremental", "Enable incremental migration (file-by-file with progress tracking)").option("--resume", "Resume a previously started incremental migration").option("--incremental-status", "Show incremental migration progress").option("--scaffold-tests", "Generate validation tests after migration (Pro+)").option("--audit", "Enable migration audit logging (Team+)").option("--preset <name>", "Use a migration preset template (Individual+)").action(async (targetPath, options) => {
|
|
37374
37400
|
const startTime = Date.now();
|
|
37401
|
+
if (options.preset) {
|
|
37402
|
+
const validation2 = await licenseManager.validate();
|
|
37403
|
+
const features2 = validation2.license?.features || TIER_FEATURES[LicenseTier.FREE];
|
|
37404
|
+
if (!features2.advancedAnalysis) {
|
|
37405
|
+
console.error(pc4.red("Migration presets require Individual tier or higher."));
|
|
37406
|
+
console.log(`Upgrade at: ${pc4.cyan(POLAR_URL)}`);
|
|
37407
|
+
process.exit(1);
|
|
37408
|
+
}
|
|
37409
|
+
const preset = getMigrationTemplate(options.preset);
|
|
37410
|
+
if (!preset) {
|
|
37411
|
+
console.error(pc4.red(`Unknown preset: ${options.preset}`));
|
|
37412
|
+
const names = getAllMigrationTemplates().map((t) => t.name);
|
|
37413
|
+
console.log(`Available presets: ${names.join(", ")}`);
|
|
37414
|
+
process.exit(1);
|
|
37415
|
+
}
|
|
37416
|
+
const step = preset.migrationSteps[0];
|
|
37417
|
+
if (step && !options.from) options.from = step.from;
|
|
37418
|
+
if (step && !options.to) options.to = step.to;
|
|
37419
|
+
console.log(pc4.bold(`
|
|
37420
|
+
Using preset: ${preset.name}`));
|
|
37421
|
+
console.log(pc4.dim(preset.description));
|
|
37422
|
+
if (preset.preChecks.length > 0) {
|
|
37423
|
+
console.log(pc4.bold("\nPre-migration checklist:"));
|
|
37424
|
+
for (const check of preset.preChecks) {
|
|
37425
|
+
console.log(` ${pc4.yellow("\u2022")} ${check.description}`);
|
|
37426
|
+
}
|
|
37427
|
+
}
|
|
37428
|
+
if (preset.packageChanges.length > 0) {
|
|
37429
|
+
console.log(pc4.bold("\nRecommended package changes:"));
|
|
37430
|
+
for (const change of preset.packageChanges) {
|
|
37431
|
+
const verb = change.action === "install" ? "+" : change.action === "remove" ? "-" : "\u2191";
|
|
37432
|
+
console.log(
|
|
37433
|
+
` ${pc4.cyan(verb)} ${change.package}${change.version ? `@${change.version}` : ""}`
|
|
37434
|
+
);
|
|
37435
|
+
}
|
|
37436
|
+
}
|
|
37437
|
+
console.log("");
|
|
37438
|
+
}
|
|
37439
|
+
if (!options.chain && (!options.from || !options.to)) {
|
|
37440
|
+
console.error(pc4.red("Either --from and --to, or --chain must be specified."));
|
|
37441
|
+
console.error(pc4.dim(" Single-step: schemashift migrate <path> -f yup -t zod"));
|
|
37442
|
+
console.error(pc4.dim(" Chain: schemashift migrate <path> --chain yup->zod->valibot"));
|
|
37443
|
+
process.exit(1);
|
|
37444
|
+
}
|
|
37375
37445
|
if (options.maxRiskScore !== void 0 && Number.isNaN(options.maxRiskScore)) {
|
|
37376
37446
|
console.error(pc4.red("--max-risk-score must be a valid number."));
|
|
37377
37447
|
process.exit(1);
|
|
@@ -37495,10 +37565,14 @@ Compatibility score: ${pc4.cyan(compatResult.overallScore.toString())}%`);
|
|
|
37495
37565
|
if (options.chain) {
|
|
37496
37566
|
const migrationChain = new MigrationChain();
|
|
37497
37567
|
chainSteps = migrationChain.parseChain(options.chain);
|
|
37498
|
-
|
|
37499
|
-
|
|
37568
|
+
if (chainSteps.length > 0) {
|
|
37569
|
+
if (!options.from) options.from = chainSteps[0]?.from;
|
|
37570
|
+
if (!options.to) options.to = chainSteps[chainSteps.length - 1]?.to;
|
|
37571
|
+
}
|
|
37572
|
+
const chainValidation = migrationChain.validateChain(chainSteps, engine);
|
|
37573
|
+
if (!chainValidation.valid) {
|
|
37500
37574
|
console.error(pc4.red("Chain migration validation failed:"));
|
|
37501
|
-
for (const err of
|
|
37575
|
+
for (const err of chainValidation.errors) {
|
|
37502
37576
|
console.error(` ${pc4.red(err)}`);
|
|
37503
37577
|
}
|
|
37504
37578
|
process.exit(1);
|
|
@@ -38063,7 +38137,7 @@ Compatibility score: ${pc4.cyan(result.overallScore.toString())}%`);
|
|
|
38063
38137
|
console.log(pc4.green("\nNo compatibility issues detected."));
|
|
38064
38138
|
}
|
|
38065
38139
|
});
|
|
38066
|
-
program.command("governance <path>").description("Run schema governance checks (Team+)").option("--json", "Output as JSON").option("-c, --config <path>", "Path to config file").action(async (targetPath, options) => {
|
|
38140
|
+
program.command("governance <path>").description("Run schema governance checks (Team+)").option("--json", "Output as JSON").option("--fix", "Auto-fix fixable violations").option("--fix-dry-run", "Preview auto-fixes without applying").option("-c, --config <path>", "Path to config file").action(async (targetPath, options) => {
|
|
38067
38141
|
const validation = await licenseManager.validate();
|
|
38068
38142
|
const features = validation.license?.features || TIER_FEATURES[LicenseTier.FREE];
|
|
38069
38143
|
if (!features.governance) {
|
|
@@ -38120,6 +38194,55 @@ program.command("governance <path>").description("Run schema governance checks (
|
|
|
38120
38194
|
console.log(` ${pc4.dim(`${v.filePath}:${v.lineNumber}`)}`);
|
|
38121
38195
|
}
|
|
38122
38196
|
}
|
|
38197
|
+
if ((options.fix || options.fixDryRun) && result.violations.length > 0) {
|
|
38198
|
+
const governanceFixer = new GovernanceFixer();
|
|
38199
|
+
const fixableCount = result.violations.filter((v) => governanceFixer.canFix(v)).length;
|
|
38200
|
+
if (fixableCount === 0) {
|
|
38201
|
+
console.log(pc4.yellow("\nNo auto-fixable violations found."));
|
|
38202
|
+
} else {
|
|
38203
|
+
console.log(
|
|
38204
|
+
pc4.bold(
|
|
38205
|
+
`
|
|
38206
|
+
${options.fixDryRun ? "Fix Preview" : "Auto-fixing"} (${fixableCount} fixable)
|
|
38207
|
+
`
|
|
38208
|
+
)
|
|
38209
|
+
);
|
|
38210
|
+
const byFile = /* @__PURE__ */ new Map();
|
|
38211
|
+
for (const v of result.violations) {
|
|
38212
|
+
const existing = byFile.get(v.filePath) ?? [];
|
|
38213
|
+
existing.push(v);
|
|
38214
|
+
byFile.set(v.filePath, existing);
|
|
38215
|
+
}
|
|
38216
|
+
let totalFixed = 0;
|
|
38217
|
+
for (const [filePath, fileViolations] of byFile) {
|
|
38218
|
+
const sourceCode = readFileSync4(filePath, "utf-8");
|
|
38219
|
+
const summary = governanceFixer.fixAll(fileViolations, sourceCode);
|
|
38220
|
+
if (summary.fixed > 0) {
|
|
38221
|
+
const shortPath = filePath.replace(`${process.cwd()}/`, "");
|
|
38222
|
+
console.log(` ${pc4.cyan(shortPath)}: ${summary.fixed} fix(es)`);
|
|
38223
|
+
for (const r of summary.results) {
|
|
38224
|
+
if (r.success) {
|
|
38225
|
+
console.log(` ${pc4.green("\u2713")} ${r.explanation}`);
|
|
38226
|
+
}
|
|
38227
|
+
}
|
|
38228
|
+
if (!options.fixDryRun && summary.results.length > 0) {
|
|
38229
|
+
const lastSuccess = [...summary.results].reverse().find((r) => r.success);
|
|
38230
|
+
if (lastSuccess?.fixedCode) {
|
|
38231
|
+
writeFileSync4(filePath, lastSuccess.fixedCode);
|
|
38232
|
+
}
|
|
38233
|
+
}
|
|
38234
|
+
totalFixed += summary.fixed;
|
|
38235
|
+
}
|
|
38236
|
+
}
|
|
38237
|
+
if (options.fixDryRun) {
|
|
38238
|
+
console.log(pc4.yellow(`
|
|
38239
|
+
Dry run: ${totalFixed} fix(es) would be applied.`));
|
|
38240
|
+
} else {
|
|
38241
|
+
console.log(pc4.green(`
|
|
38242
|
+
${totalFixed} fix(es) applied.`));
|
|
38243
|
+
}
|
|
38244
|
+
}
|
|
38245
|
+
}
|
|
38123
38246
|
console.log("");
|
|
38124
38247
|
if (result.passed) {
|
|
38125
38248
|
console.log(pc4.green("Governance check passed."));
|
|
@@ -38130,6 +38253,164 @@ program.command("governance <path>").description("Run schema governance checks (
|
|
|
38130
38253
|
}
|
|
38131
38254
|
}
|
|
38132
38255
|
});
|
|
38256
|
+
program.command("presets").description("List available migration presets").option("--json", "Output as JSON").option("--category <category>", "Filter by category").action((options) => {
|
|
38257
|
+
let templates = getAllMigrationTemplates();
|
|
38258
|
+
if (options.category) {
|
|
38259
|
+
templates = templates.filter((t) => t.category === options.category);
|
|
38260
|
+
}
|
|
38261
|
+
if (options.json) {
|
|
38262
|
+
console.log(JSON.stringify(templates, null, 2));
|
|
38263
|
+
return;
|
|
38264
|
+
}
|
|
38265
|
+
console.log(pc4.bold("\nAvailable Migration Presets\n"));
|
|
38266
|
+
for (const t of templates) {
|
|
38267
|
+
console.log(` ${pc4.cyan(t.name)}`);
|
|
38268
|
+
console.log(` ${t.description}`);
|
|
38269
|
+
console.log(` Category: ${t.category} | Effort: ${t.estimatedEffort}`);
|
|
38270
|
+
console.log(` Steps: ${t.migrationSteps.map((s) => `${s.from}\u2192${s.to}`).join(", ")}`);
|
|
38271
|
+
console.log("");
|
|
38272
|
+
}
|
|
38273
|
+
console.log(pc4.dim("Use with: schemashift migrate <path> --preset <name>"));
|
|
38274
|
+
});
|
|
38275
|
+
program.command("graph <path>").description("Visualize schema dependency graph (Pro+)").option("--format <format>", "Output format: dot, mermaid", "mermaid").option("-o, --output <file>", "Write output to file").option("--filter <library>", "Only show files using a specific library").option("--highlight-circular", "Highlight circular dependencies").option("--color", "Color-code nodes by schema library").action(async (targetPath, options) => {
|
|
38276
|
+
const validation = await licenseManager.validate();
|
|
38277
|
+
const features = validation.license?.features || TIER_FEATURES[LicenseTier.FREE];
|
|
38278
|
+
if (!features.crossFileResolution) {
|
|
38279
|
+
console.error(pc4.red("Dependency graph visualization requires Pro tier or higher."));
|
|
38280
|
+
console.log(`Upgrade at: ${pc4.cyan(POLAR_URL)}`);
|
|
38281
|
+
process.exit(1);
|
|
38282
|
+
}
|
|
38283
|
+
const files = await glob2(join3(targetPath, "**/*.{ts,tsx}"), {
|
|
38284
|
+
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
38285
|
+
});
|
|
38286
|
+
if (files.length === 0) {
|
|
38287
|
+
console.log(pc4.yellow("No files found."));
|
|
38288
|
+
process.exit(0);
|
|
38289
|
+
}
|
|
38290
|
+
const analyzer = new SchemaAnalyzer();
|
|
38291
|
+
for (const file of files) {
|
|
38292
|
+
analyzer.addSourceFiles([file]);
|
|
38293
|
+
}
|
|
38294
|
+
const resolvedFiles = files.map((f) => resolve2(f));
|
|
38295
|
+
const depResolver = new SchemaDependencyResolver();
|
|
38296
|
+
const depResult = depResolver.resolve(analyzer.getProject(), resolvedFiles);
|
|
38297
|
+
const analysisResult = analyzer.analyze();
|
|
38298
|
+
const nodeMetadata = /* @__PURE__ */ new Map();
|
|
38299
|
+
for (const file of resolvedFiles) {
|
|
38300
|
+
const schemas = analysisResult.schemas.filter((s) => s.filePath === file);
|
|
38301
|
+
const library = schemas[0]?.library;
|
|
38302
|
+
nodeMetadata.set(file, { library, schemaCount: schemas.length });
|
|
38303
|
+
}
|
|
38304
|
+
const graphExporter = new GraphExporter();
|
|
38305
|
+
const exportOptions = {
|
|
38306
|
+
colorByLibrary: options.color || false,
|
|
38307
|
+
highlightCircular: options.highlightCircular || false,
|
|
38308
|
+
filterLibrary: options.filter,
|
|
38309
|
+
nodeMetadata
|
|
38310
|
+
};
|
|
38311
|
+
let output;
|
|
38312
|
+
if (options.format === "dot") {
|
|
38313
|
+
output = graphExporter.exportDot(depResult, exportOptions);
|
|
38314
|
+
} else {
|
|
38315
|
+
output = graphExporter.exportMermaid(depResult, exportOptions);
|
|
38316
|
+
}
|
|
38317
|
+
if (options.output) {
|
|
38318
|
+
writeFileSync4(options.output, output);
|
|
38319
|
+
console.log(pc4.green(`Graph written to ${options.output}`));
|
|
38320
|
+
} else {
|
|
38321
|
+
console.log(output);
|
|
38322
|
+
}
|
|
38323
|
+
console.log(
|
|
38324
|
+
pc4.dim(`
|
|
38325
|
+
${depResult.sortedFiles.length} files, ${depResult.crossFileRefs} cross-file refs`)
|
|
38326
|
+
);
|
|
38327
|
+
if (depResult.circularWarnings.length > 0) {
|
|
38328
|
+
console.log(pc4.yellow(`${depResult.circularWarnings.length} circular dependency warning(s)`));
|
|
38329
|
+
}
|
|
38330
|
+
});
|
|
38331
|
+
program.command("approvals").description("Manage migration approval workflows (TEAM)").argument("[path]", "Project path", ".").option("--create", "Create a new migration request").option("--approve <id>", "Approve a pending migration request").option("--reject <id>", "Reject a pending migration request").option("--list", "List all migration requests").option("--status <status>", "Filter by status (pending/approved/rejected)").option("-f, --from <lib>", "Source schema library (for --create)").option("-t, --to <lib>", "Target schema library (for --create)").option("--reviewer <name>", "Reviewer name (for --approve/--reject)").option("--reason <reason>", "Reason for decision").option("--json", "Output as JSON").action(
|
|
38332
|
+
async (inputPath, opts) => {
|
|
38333
|
+
const validation = await licenseManager.validate();
|
|
38334
|
+
const features = validation.license?.features || TIER_FEATURES[LicenseTier.FREE];
|
|
38335
|
+
if (!features.governance) {
|
|
38336
|
+
console.log(pc4.red("Approval workflows require a TEAM license."));
|
|
38337
|
+
console.log(`Upgrade at: ${pc4.cyan(POLAR_URL)}`);
|
|
38338
|
+
return;
|
|
38339
|
+
}
|
|
38340
|
+
const projectPath = resolve2(inputPath);
|
|
38341
|
+
const manager = new ApprovalManager(projectPath);
|
|
38342
|
+
if (opts.create) {
|
|
38343
|
+
if (!opts.from || !opts.to) {
|
|
38344
|
+
console.log(pc4.red("--from and --to are required with --create"));
|
|
38345
|
+
return;
|
|
38346
|
+
}
|
|
38347
|
+
const files = await glob2("**/*.{ts,tsx,js,jsx}", {
|
|
38348
|
+
cwd: projectPath,
|
|
38349
|
+
ignore: ["node_modules/**", "dist/**"],
|
|
38350
|
+
absolute: true
|
|
38351
|
+
});
|
|
38352
|
+
const reviewer = opts.reviewer ?? process.env.USER ?? "unknown";
|
|
38353
|
+
const request = manager.createRequest(opts.from, opts.to, files, reviewer);
|
|
38354
|
+
if (opts.json) {
|
|
38355
|
+
console.log(JSON.stringify(request, null, 2));
|
|
38356
|
+
} else {
|
|
38357
|
+
console.log(pc4.green(`Migration request created: ${pc4.bold(request.id)}`));
|
|
38358
|
+
console.log(` From: ${request.from} \u2192 To: ${request.to}`);
|
|
38359
|
+
console.log(` Files: ${request.files.length}`);
|
|
38360
|
+
console.log(` Status: ${pc4.yellow("pending")}`);
|
|
38361
|
+
}
|
|
38362
|
+
} else if (opts.approve) {
|
|
38363
|
+
const reviewer = opts.reviewer ?? process.env.USER ?? "unknown";
|
|
38364
|
+
const request = manager.review({
|
|
38365
|
+
requestId: opts.approve,
|
|
38366
|
+
status: "approved",
|
|
38367
|
+
reviewedBy: reviewer,
|
|
38368
|
+
reason: opts.reason
|
|
38369
|
+
});
|
|
38370
|
+
console.log(pc4.green(`Migration request ${pc4.bold(request.id)} approved by ${reviewer}`));
|
|
38371
|
+
} else if (opts.reject) {
|
|
38372
|
+
const reviewer = opts.reviewer ?? process.env.USER ?? "unknown";
|
|
38373
|
+
const request = manager.review({
|
|
38374
|
+
requestId: opts.reject,
|
|
38375
|
+
status: "rejected",
|
|
38376
|
+
reviewedBy: reviewer,
|
|
38377
|
+
reason: opts.reason
|
|
38378
|
+
});
|
|
38379
|
+
console.log(pc4.red(`Migration request ${pc4.bold(request.id)} rejected by ${reviewer}`));
|
|
38380
|
+
if (opts.reason) {
|
|
38381
|
+
console.log(` Reason: ${opts.reason}`);
|
|
38382
|
+
}
|
|
38383
|
+
} else {
|
|
38384
|
+
const status = opts.status;
|
|
38385
|
+
const requests = manager.listRequests(status);
|
|
38386
|
+
if (opts.json) {
|
|
38387
|
+
console.log(JSON.stringify(requests, null, 2));
|
|
38388
|
+
} else {
|
|
38389
|
+
const summary = manager.getSummary();
|
|
38390
|
+
console.log(pc4.bold(`
|
|
38391
|
+
Migration Approval Requests (${summary.total} total)
|
|
38392
|
+
`));
|
|
38393
|
+
console.log(
|
|
38394
|
+
` ${pc4.yellow(`Pending: ${summary.pending}`)} ${pc4.green(`Approved: ${summary.approved}`)} ${pc4.red(`Rejected: ${summary.rejected}`)}
|
|
38395
|
+
`
|
|
38396
|
+
);
|
|
38397
|
+
for (const req of requests) {
|
|
38398
|
+
const statusColor = req.status === "approved" ? pc4.green : req.status === "rejected" ? pc4.red : pc4.yellow;
|
|
38399
|
+
console.log(` ${pc4.bold(req.id)} [${statusColor(req.status)}]`);
|
|
38400
|
+
console.log(
|
|
38401
|
+
` ${req.from} \u2192 ${req.to} | ${req.files.length} files | by ${req.requestedBy}`
|
|
38402
|
+
);
|
|
38403
|
+
if (req.reviewedBy) {
|
|
38404
|
+
console.log(` Reviewed by ${req.reviewedBy} at ${req.reviewedAt}`);
|
|
38405
|
+
}
|
|
38406
|
+
}
|
|
38407
|
+
if (requests.length === 0) {
|
|
38408
|
+
console.log(pc4.dim(" No migration requests found."));
|
|
38409
|
+
}
|
|
38410
|
+
}
|
|
38411
|
+
}
|
|
38412
|
+
}
|
|
38413
|
+
);
|
|
38133
38414
|
program.command("pricing").description("Show pricing information").action(() => {
|
|
38134
38415
|
console.log(pc4.bold("\nSchemaShift Pricing\n"));
|
|
38135
38416
|
console.log(`${pc4.green("FREE")} - $0`);
|
package/dist/index.cjs
CHANGED
|
@@ -39,14 +39,23 @@ __export(src_exports, {
|
|
|
39
39
|
TIER_FEATURES: () => TIER_FEATURES,
|
|
40
40
|
TransformEngine: () => import_core5.TransformEngine,
|
|
41
41
|
WatchMode: () => WatchMode,
|
|
42
|
+
createArktypeToZodHandler: () => import_zod_arktype.createArktypeToZodHandler,
|
|
43
|
+
createIoTsToEffectHandler: () => import_io_ts_effect.createIoTsToEffectHandler,
|
|
42
44
|
createIoTsToZodHandler: () => import_io_ts_zod.createIoTsToZodHandler,
|
|
43
45
|
createJoiToZodHandler: () => import_joi_zod.createJoiToZodHandler,
|
|
46
|
+
createSuperstructToZodHandler: () => import_zod_superstruct.createSuperstructToZodHandler,
|
|
47
|
+
createValibotToZodHandler: () => import_zod_valibot.createValibotToZodHandler,
|
|
44
48
|
createYupToZodHandler: () => import_yup_zod.createYupToZodHandler,
|
|
49
|
+
createZodToArktypeHandler: () => import_zod_arktype.createZodToArktypeHandler,
|
|
50
|
+
createZodToSuperstructHandler: () => import_zod_superstruct.createZodToSuperstructHandler,
|
|
51
|
+
createZodToValibotHandler: () => import_zod_valibot.createZodToValibotHandler,
|
|
52
|
+
createZodToYupHandler: () => import_yup_zod.createZodToYupHandler,
|
|
45
53
|
createZodV3ToV4Handler: () => import_zod_v3_v4.createZodV3ToV4Handler,
|
|
46
54
|
loadConfig: () => import_core5.loadConfig
|
|
47
55
|
});
|
|
48
56
|
module.exports = __toCommonJS(src_exports);
|
|
49
57
|
var import_core5 = require("@schemashift/core");
|
|
58
|
+
var import_io_ts_effect = require("@schemashift/io-ts-effect");
|
|
50
59
|
var import_io_ts_zod = require("@schemashift/io-ts-zod");
|
|
51
60
|
var import_joi_zod = require("@schemashift/joi-zod");
|
|
52
61
|
|
|
@@ -33845,7 +33854,12 @@ var TIER_FEATURES = {
|
|
|
33845
33854
|
"zod->valibot",
|
|
33846
33855
|
"any->valibot",
|
|
33847
33856
|
"zod->yup",
|
|
33848
|
-
"valibot->zod"
|
|
33857
|
+
"valibot->zod",
|
|
33858
|
+
"zod->arktype",
|
|
33859
|
+
"arktype->zod",
|
|
33860
|
+
"zod->superstruct",
|
|
33861
|
+
"superstruct->zod",
|
|
33862
|
+
"io-ts->effect"
|
|
33849
33863
|
],
|
|
33850
33864
|
devices: 4,
|
|
33851
33865
|
ciSupport: true,
|
|
@@ -33887,7 +33901,12 @@ var TIER_FEATURES = {
|
|
|
33887
33901
|
"any->valibot",
|
|
33888
33902
|
"zod->valibot",
|
|
33889
33903
|
"zod->yup",
|
|
33890
|
-
"valibot->zod"
|
|
33904
|
+
"valibot->zod",
|
|
33905
|
+
"zod->arktype",
|
|
33906
|
+
"arktype->zod",
|
|
33907
|
+
"zod->superstruct",
|
|
33908
|
+
"superstruct->zod",
|
|
33909
|
+
"io-ts->effect"
|
|
33891
33910
|
],
|
|
33892
33911
|
devices: Infinity,
|
|
33893
33912
|
ciSupport: true,
|
|
@@ -34188,7 +34207,10 @@ var LicenseManager = class {
|
|
|
34188
34207
|
|
|
34189
34208
|
// src/index.ts
|
|
34190
34209
|
var import_yup_zod = require("@schemashift/yup-zod");
|
|
34210
|
+
var import_zod_arktype = require("@schemashift/zod-arktype");
|
|
34211
|
+
var import_zod_superstruct = require("@schemashift/zod-superstruct");
|
|
34191
34212
|
var import_zod_v3_v4 = require("@schemashift/zod-v3-v4");
|
|
34213
|
+
var import_zod_valibot = require("@schemashift/zod-valibot");
|
|
34192
34214
|
|
|
34193
34215
|
// src/backup.ts
|
|
34194
34216
|
var import_node_fs = require("fs");
|
|
@@ -34772,9 +34794,17 @@ Changed: ${(0, import_node_path2.relative)(process.cwd(), fullPath)}`));
|
|
|
34772
34794
|
TIER_FEATURES,
|
|
34773
34795
|
TransformEngine,
|
|
34774
34796
|
WatchMode,
|
|
34797
|
+
createArktypeToZodHandler,
|
|
34798
|
+
createIoTsToEffectHandler,
|
|
34775
34799
|
createIoTsToZodHandler,
|
|
34776
34800
|
createJoiToZodHandler,
|
|
34801
|
+
createSuperstructToZodHandler,
|
|
34802
|
+
createValibotToZodHandler,
|
|
34777
34803
|
createYupToZodHandler,
|
|
34804
|
+
createZodToArktypeHandler,
|
|
34805
|
+
createZodToSuperstructHandler,
|
|
34806
|
+
createZodToValibotHandler,
|
|
34807
|
+
createZodToYupHandler,
|
|
34778
34808
|
createZodV3ToV4Handler,
|
|
34779
34809
|
loadConfig
|
|
34780
34810
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { TransformResult } from '@schemashift/core';
|
|
2
2
|
export { SchemaAnalyzer, TransformEngine, loadConfig } from '@schemashift/core';
|
|
3
|
+
export { createIoTsToEffectHandler } from '@schemashift/io-ts-effect';
|
|
3
4
|
export { createIoTsToZodHandler } from '@schemashift/io-ts-zod';
|
|
4
5
|
export { createJoiToZodHandler } from '@schemashift/joi-zod';
|
|
5
6
|
export { LicenseManager, LicenseTier, TIER_FEATURES } from '@schemashift/license';
|
|
6
|
-
export { createYupToZodHandler } from '@schemashift/yup-zod';
|
|
7
|
+
export { createYupToZodHandler, createZodToYupHandler } from '@schemashift/yup-zod';
|
|
8
|
+
export { createArktypeToZodHandler, createZodToArktypeHandler } from '@schemashift/zod-arktype';
|
|
9
|
+
export { createSuperstructToZodHandler, createZodToSuperstructHandler } from '@schemashift/zod-superstruct';
|
|
7
10
|
export { createZodV3ToV4Handler } from '@schemashift/zod-v3-v4';
|
|
11
|
+
export { createValibotToZodHandler, createZodToValibotHandler } from '@schemashift/zod-valibot';
|
|
8
12
|
|
|
9
13
|
interface BackupManifest {
|
|
10
14
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { TransformResult } from '@schemashift/core';
|
|
2
2
|
export { SchemaAnalyzer, TransformEngine, loadConfig } from '@schemashift/core';
|
|
3
|
+
export { createIoTsToEffectHandler } from '@schemashift/io-ts-effect';
|
|
3
4
|
export { createIoTsToZodHandler } from '@schemashift/io-ts-zod';
|
|
4
5
|
export { createJoiToZodHandler } from '@schemashift/joi-zod';
|
|
5
6
|
export { LicenseManager, LicenseTier, TIER_FEATURES } from '@schemashift/license';
|
|
6
|
-
export { createYupToZodHandler } from '@schemashift/yup-zod';
|
|
7
|
+
export { createYupToZodHandler, createZodToYupHandler } from '@schemashift/yup-zod';
|
|
8
|
+
export { createArktypeToZodHandler, createZodToArktypeHandler } from '@schemashift/zod-arktype';
|
|
9
|
+
export { createSuperstructToZodHandler, createZodToSuperstructHandler } from '@schemashift/zod-superstruct';
|
|
7
10
|
export { createZodV3ToV4Handler } from '@schemashift/zod-v3-v4';
|
|
11
|
+
export { createValibotToZodHandler, createZodToValibotHandler } from '@schemashift/zod-valibot';
|
|
8
12
|
|
|
9
13
|
interface BackupManifest {
|
|
10
14
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import { loadConfig, SchemaAnalyzer, TransformEngine } from "@schemashift/core";
|
|
9
|
+
import { createIoTsToEffectHandler } from "@schemashift/io-ts-effect";
|
|
9
10
|
import { createIoTsToZodHandler } from "@schemashift/io-ts-zod";
|
|
10
11
|
import { createJoiToZodHandler } from "@schemashift/joi-zod";
|
|
11
12
|
|
|
@@ -33804,7 +33805,12 @@ var TIER_FEATURES = {
|
|
|
33804
33805
|
"zod->valibot",
|
|
33805
33806
|
"any->valibot",
|
|
33806
33807
|
"zod->yup",
|
|
33807
|
-
"valibot->zod"
|
|
33808
|
+
"valibot->zod",
|
|
33809
|
+
"zod->arktype",
|
|
33810
|
+
"arktype->zod",
|
|
33811
|
+
"zod->superstruct",
|
|
33812
|
+
"superstruct->zod",
|
|
33813
|
+
"io-ts->effect"
|
|
33808
33814
|
],
|
|
33809
33815
|
devices: 4,
|
|
33810
33816
|
ciSupport: true,
|
|
@@ -33846,7 +33852,12 @@ var TIER_FEATURES = {
|
|
|
33846
33852
|
"any->valibot",
|
|
33847
33853
|
"zod->valibot",
|
|
33848
33854
|
"zod->yup",
|
|
33849
|
-
"valibot->zod"
|
|
33855
|
+
"valibot->zod",
|
|
33856
|
+
"zod->arktype",
|
|
33857
|
+
"arktype->zod",
|
|
33858
|
+
"zod->superstruct",
|
|
33859
|
+
"superstruct->zod",
|
|
33860
|
+
"io-ts->effect"
|
|
33850
33861
|
],
|
|
33851
33862
|
devices: Infinity,
|
|
33852
33863
|
ciSupport: true,
|
|
@@ -34146,8 +34157,14 @@ var LicenseManager = class {
|
|
|
34146
34157
|
};
|
|
34147
34158
|
|
|
34148
34159
|
// src/index.ts
|
|
34149
|
-
import { createYupToZodHandler } from "@schemashift/yup-zod";
|
|
34160
|
+
import { createYupToZodHandler, createZodToYupHandler } from "@schemashift/yup-zod";
|
|
34161
|
+
import { createArktypeToZodHandler, createZodToArktypeHandler } from "@schemashift/zod-arktype";
|
|
34162
|
+
import {
|
|
34163
|
+
createSuperstructToZodHandler,
|
|
34164
|
+
createZodToSuperstructHandler
|
|
34165
|
+
} from "@schemashift/zod-superstruct";
|
|
34150
34166
|
import { createZodV3ToV4Handler } from "@schemashift/zod-v3-v4";
|
|
34167
|
+
import { createValibotToZodHandler, createZodToValibotHandler } from "@schemashift/zod-valibot";
|
|
34151
34168
|
|
|
34152
34169
|
// src/backup.ts
|
|
34153
34170
|
import {
|
|
@@ -34738,9 +34755,17 @@ export {
|
|
|
34738
34755
|
TIER_FEATURES,
|
|
34739
34756
|
TransformEngine,
|
|
34740
34757
|
WatchMode,
|
|
34758
|
+
createArktypeToZodHandler,
|
|
34759
|
+
createIoTsToEffectHandler,
|
|
34741
34760
|
createIoTsToZodHandler,
|
|
34742
34761
|
createJoiToZodHandler,
|
|
34762
|
+
createSuperstructToZodHandler,
|
|
34763
|
+
createValibotToZodHandler,
|
|
34743
34764
|
createYupToZodHandler,
|
|
34765
|
+
createZodToArktypeHandler,
|
|
34766
|
+
createZodToSuperstructHandler,
|
|
34767
|
+
createZodToValibotHandler,
|
|
34768
|
+
createZodToYupHandler,
|
|
34744
34769
|
createZodV3ToV4Handler,
|
|
34745
34770
|
loadConfig
|
|
34746
34771
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "schemashift-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "TypeScript schema migration CLI - migrate between Zod, Yup, Joi, and more",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,13 +48,19 @@
|
|
|
48
48
|
},
|
|
49
49
|
"author": "Joseph May",
|
|
50
50
|
"license": "MIT",
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=22.0.0"
|
|
53
|
+
},
|
|
51
54
|
"dependencies": {
|
|
52
|
-
"@schemashift/core": "0.
|
|
53
|
-
"@schemashift/io-ts-
|
|
54
|
-
"@schemashift/
|
|
55
|
-
"@schemashift/
|
|
56
|
-
"@schemashift/zod
|
|
57
|
-
"@schemashift/zod-
|
|
55
|
+
"@schemashift/core": "0.11.0",
|
|
56
|
+
"@schemashift/io-ts-effect": "0.11.0",
|
|
57
|
+
"@schemashift/io-ts-zod": "0.11.0",
|
|
58
|
+
"@schemashift/joi-zod": "0.11.0",
|
|
59
|
+
"@schemashift/yup-zod": "0.11.0",
|
|
60
|
+
"@schemashift/zod-arktype": "0.11.0",
|
|
61
|
+
"@schemashift/zod-superstruct": "0.11.0",
|
|
62
|
+
"@schemashift/zod-valibot": "0.11.0",
|
|
63
|
+
"@schemashift/zod-v3-v4": "0.11.0",
|
|
58
64
|
"commander": "14.0.2",
|
|
59
65
|
"cosmiconfig": "9.0.0",
|
|
60
66
|
"glob": "13.0.0",
|
|
@@ -63,7 +69,7 @@
|
|
|
63
69
|
"picocolors": "1.1.1"
|
|
64
70
|
},
|
|
65
71
|
"devDependencies": {
|
|
66
|
-
"@schemashift/license": "0.
|
|
72
|
+
"@schemashift/license": "0.11.0"
|
|
67
73
|
},
|
|
68
74
|
"publishConfig": {
|
|
69
75
|
"access": "public"
|