delimit-cli 2.3.1 → 2.3.2

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 (2) hide show
  1. package/bin/delimit-cli.js +26 -9
  2. package/package.json +1 -1
@@ -950,7 +950,7 @@ program
950
950
  program
951
951
  .command('lint [old_spec] [new_spec]')
952
952
  .description('Lint API specs for breaking changes and policy violations')
953
- .option('-p, --policy <file>', 'Custom policy file')
953
+ .option('-p, --policy <preset|file>', 'Policy preset (strict/default/relaxed) or file path')
954
954
  .option('--current-version <ver>', 'Current API version for semver bump')
955
955
  .option('-n, --name <name>', 'API name for context')
956
956
  .option('--json', 'Output raw JSON')
@@ -1000,9 +1000,21 @@ program
1000
1000
  { policy: options.policy, version: options.currentVersion, name: options.name }
1001
1001
  );
1002
1002
  } else {
1003
+ const resolvedOld = path.resolve(oldSpec);
1004
+ const resolvedNew = path.resolve(newSpec);
1005
+ if (!fs.existsSync(resolvedOld)) {
1006
+ console.error(chalk.red(`\n File not found: ${resolvedOld}\n`));
1007
+ process.exit(1);
1008
+ return;
1009
+ }
1010
+ if (!fs.existsSync(resolvedNew)) {
1011
+ console.error(chalk.red(`\n File not found: ${resolvedNew}\n`));
1012
+ process.exit(1);
1013
+ return;
1014
+ }
1003
1015
  result = apiEngine.lint(
1004
- path.resolve(oldSpec),
1005
- path.resolve(newSpec),
1016
+ resolvedOld,
1017
+ resolvedNew,
1006
1018
  { policy: options.policy, version: options.currentVersion, name: options.name }
1007
1019
  );
1008
1020
  }
@@ -1068,10 +1080,11 @@ program
1068
1080
  .option('--json', 'Output raw JSON')
1069
1081
  .action(async (oldSpec, newSpec, options) => {
1070
1082
  try {
1071
- const result = apiEngine.diff(
1072
- path.resolve(oldSpec),
1073
- path.resolve(newSpec)
1074
- );
1083
+ const resolvedOld = path.resolve(oldSpec);
1084
+ const resolvedNew = path.resolve(newSpec);
1085
+ if (!fs.existsSync(resolvedOld)) { console.error(chalk.red(`\n File not found: ${resolvedOld}\n`)); process.exit(1); return; }
1086
+ if (!fs.existsSync(resolvedNew)) { console.error(chalk.red(`\n File not found: ${resolvedNew}\n`)); process.exit(1); return; }
1087
+ const result = apiEngine.diff(resolvedOld, resolvedNew);
1075
1088
 
1076
1089
  if (options.json) {
1077
1090
  console.log(JSON.stringify(result, null, 2));
@@ -1102,9 +1115,13 @@ program
1102
1115
  .option('--json', 'Output raw JSON')
1103
1116
  .action(async (oldSpec, newSpec, options) => {
1104
1117
  try {
1118
+ const resolvedOld = path.resolve(oldSpec);
1119
+ const resolvedNew = path.resolve(newSpec);
1120
+ if (!fs.existsSync(resolvedOld)) { console.error(chalk.red(`\n File not found: ${resolvedOld}\n`)); process.exit(1); return; }
1121
+ if (!fs.existsSync(resolvedNew)) { console.error(chalk.red(`\n File not found: ${resolvedNew}\n`)); process.exit(1); return; }
1105
1122
  const result = apiEngine.explain(
1106
- path.resolve(oldSpec),
1107
- path.resolve(newSpec),
1123
+ resolvedOld,
1124
+ resolvedNew,
1108
1125
  {
1109
1126
  template: options.template,
1110
1127
  oldVersion: options.oldVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delimit-cli",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Prevent breaking API changes before they reach production. Deterministic diff engine + policy enforcement + semver classification.",
5
5
  "main": "index.js",
6
6
  "bin": {