cli-changescribe 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -46,6 +46,7 @@ changescribe commit
46
46
  changescribe pr --base main --mode release
47
47
  changescribe pr --base main --create-pr --mode release
48
48
  changescribe pr --dry-run
49
+ changescribe pr --create-pr --skip-format
49
50
  ```
50
51
 
51
52
  ### Npm script parity aliases
@@ -62,4 +63,6 @@ changescribe staging:pr
62
63
 
63
64
  - `changescribe commit` stages changes if nothing is staged and commits/pushes by default.
64
65
  - `changescribe pr` can create or update a GitHub PR when `--create-pr` is passed (requires `gh`).
66
+ - `feature:pr` and `staging:pr` aliases accept overrides (e.g., `--base main`).
67
+ - `--skip-format` (or `--no-format`) skips the format step during `--create-pr`.
65
68
  - The CLI must be run inside a git repo.
@@ -30,6 +30,10 @@ async function main() {
30
30
  printHelp();
31
31
  return;
32
32
  }
33
+ if (rest.includes('-h') || rest.includes('--help')) {
34
+ printHelp();
35
+ return;
36
+ }
33
37
 
34
38
  if (command === 'commit') {
35
39
  await runCommit(rest);
@@ -47,12 +51,26 @@ async function main() {
47
51
  }
48
52
 
49
53
  if (command === 'feature:pr') {
50
- await runPrSummary(['--base', 'staging', '--create-pr', '--mode', 'feature']);
54
+ await runPrSummary([
55
+ '--base',
56
+ 'staging',
57
+ '--create-pr',
58
+ '--mode',
59
+ 'feature',
60
+ ...rest,
61
+ ]);
51
62
  return;
52
63
  }
53
64
 
54
65
  if (command === 'staging:pr') {
55
- await runPrSummary(['--base', 'main', '--create-pr', '--mode', 'release']);
66
+ await runPrSummary([
67
+ '--base',
68
+ 'main',
69
+ '--create-pr',
70
+ '--mode',
71
+ 'release',
72
+ ...rest,
73
+ ]);
56
74
  return;
57
75
  }
58
76
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "cli-changescribe",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI for generating commit messages and PR summaries",
5
5
  "bin": {
6
- "changescribe": "./bin/changescribe.js"
6
+ "changescribe": "bin/changescribe.js"
7
7
  },
8
8
  "type": "commonjs",
9
9
  "files": [
@@ -29,4 +29,4 @@
29
29
  "dotenv": "^17.2.1",
30
30
  "groq-sdk": "^0.8.0"
31
31
  }
32
- }
32
+ }
package/src/pr-summary.js CHANGED
@@ -495,6 +495,17 @@ function checkExistingPr(base, head) {
495
495
  }
496
496
  }
497
497
 
498
+ function hasNpmScript(scriptName, cwd = process.cwd()) {
499
+ try {
500
+ const packagePath = path.join(cwd, 'package.json');
501
+ const raw = fs.readFileSync(packagePath, 'utf8');
502
+ const pkg = JSON.parse(raw);
503
+ return Boolean(pkg?.scripts?.[scriptName]);
504
+ } catch {
505
+ return false;
506
+ }
507
+ }
508
+
498
509
  function extractPrTitle(summary, mode) {
499
510
  const targetSection = mode === 'release' ? 'release summary' : 'what change';
500
511
  // Try to extract a title from the summary
@@ -673,6 +684,7 @@ function parseArgs(argv) {
673
684
  issue: DEFAULT_ISSUE,
674
685
  createPr: false,
675
686
  mode: '',
687
+ skipFormat: false,
676
688
  };
677
689
 
678
690
  for (let i = 0; i < argv.length; i += 1) {
@@ -693,6 +705,8 @@ function parseArgs(argv) {
693
705
  args.dryRun = true;
694
706
  } else if (current === '--create-pr') {
695
707
  args.createPr = true;
708
+ } else if (current === '--skip-format' || current === '--no-format') {
709
+ args.skipFormat = true;
696
710
  } else if (current === '--mode' && argv[i + 1]) {
697
711
  args.mode = argv[i + 1];
698
712
  i += 1;
@@ -752,12 +766,18 @@ async function main(argv) {
752
766
  // Safety checks before creating PR
753
767
  if (args.createPr) {
754
768
  // Run format as a last-minute verification step
755
- step('Running npm run format before PR creation...');
756
- try {
757
- execSync('npm run format', { encoding: 'utf8', stdio: 'inherit' });
758
- } catch (_error) {
759
- fail('npm run format failed; fix formatting errors first.');
760
- process.exit(1);
769
+ if (args.skipFormat) {
770
+ warn('Skipping format step (flagged)');
771
+ } else if (!hasNpmScript('format')) {
772
+ warn('Skipping format step (no npm script named "format")');
773
+ } else {
774
+ step('Running npm run format before PR creation...');
775
+ try {
776
+ execSync('npm run format', { encoding: 'utf8', stdio: 'inherit' });
777
+ } catch (_error) {
778
+ fail('npm run format failed; fix formatting errors first.');
779
+ process.exit(1);
780
+ }
761
781
  }
762
782
 
763
783
  // Run tests as an extra verification step