contribute-now 0.2.0 → 0.2.1-staging.42dccfe

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/dist/index.js +53 -19
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -169,6 +169,13 @@ async function createBranch(branch, from) {
169
169
  async function resetHard(ref) {
170
170
  return run(["reset", "--hard", ref]);
171
171
  }
172
+ async function updateLocalBranch(branch, target) {
173
+ const current = await getCurrentBranch();
174
+ if (current === branch) {
175
+ return resetHard(target);
176
+ }
177
+ return run(["branch", "-f", branch, target]);
178
+ }
172
179
  async function pushSetUpstream(remote, branch) {
173
180
  return run(["push", "-u", remote, branch]);
174
181
  }
@@ -454,8 +461,14 @@ feat: add user authentication system
454
461
  fix(auth): resolve token expiry issue
455
462
  docs: update contributing guidelines
456
463
  feat!: redesign authentication API`;
457
- var CLEAN_COMMIT_SYSTEM_PROMPT = `You are a git commit message generator. Generate a Clean Commit message following this exact format:
458
- <emoji> <type>[!][(<scope>)]: <description>
464
+ var CLEAN_COMMIT_SYSTEM_PROMPT = `You are a git commit message generator. Generate a Clean Commit message following this EXACT format:
465
+ <emoji> <type>[!][ (<scope>)]: <description>
466
+
467
+ CRITICAL spacing rules (must follow exactly):
468
+ - There MUST be a space between the emoji and the type
469
+ - If a scope is used, there MUST be a space before the opening parenthesis
470
+ - There MUST be a colon and a space after the type or scope before the description
471
+ - Pattern: EMOJI SPACE TYPE SPACE OPENPAREN SCOPE CLOSEPAREN COLON SPACE DESCRIPTION
459
472
 
460
473
  Emoji and type table:
461
474
  \uD83D\uDCE6 new – new features, files, or capabilities
@@ -470,15 +483,21 @@ Emoji and type table:
470
483
 
471
484
  Rules:
472
485
  - Breaking change (!) only for: new, update, remove, security
473
- - Description: concise, imperative mood, max 72 chars
486
+ - Description: concise, imperative mood, max 72 chars, lowercase start
474
487
  - Scope: optional, camelCase or kebab-case component name
475
488
  - Return ONLY the commit message line, nothing else
476
489
 
477
- Examples:
478
- \uD83D\uDCE6 new: user authentication system
490
+ Correct examples:
491
+ \uD83D\uDCE6 new: add user authentication system
479
492
  \uD83D\uDD27 update (api): improve error handling
480
493
  ⚙️ setup (ci): configure github actions workflow
481
- \uD83D\uDCE6 new!: completely redesign authentication system`;
494
+ \uD83D\uDCE6 new!: redesign authentication system
495
+ \uD83D\uDDD1️ remove (deps): drop unused lodash dependency
496
+
497
+ WRONG (never do this):
498
+ ⚙️setup(ci): ... ← missing spaces
499
+ \uD83D\uDCE6new: ... ← missing space after emoji
500
+ \uD83D\uDD27 update(api): ... ← missing space before scope`;
482
501
  var BRANCH_NAME_SYSTEM_PROMPT = `You are a git branch name generator. Convert natural language descriptions into proper git branch names.
483
502
 
484
503
  Format: <prefix>/<kebab-case-name>
@@ -512,8 +531,21 @@ Rules:
512
531
  - Suggest the most likely correct resolution strategy
513
532
  - Never auto-resolve — provide guidance only
514
533
  - Be concise and actionable`;
534
+ function suppressSubprocessWarnings() {
535
+ const prev = process.env.NODE_NO_WARNINGS;
536
+ process.env.NODE_NO_WARNINGS = "1";
537
+ return prev;
538
+ }
539
+ function restoreWarnings(prev) {
540
+ if (prev === undefined) {
541
+ delete process.env.NODE_NO_WARNINGS;
542
+ } else {
543
+ process.env.NODE_NO_WARNINGS = prev;
544
+ }
545
+ }
515
546
  async function checkCopilotAvailable() {
516
547
  let client = null;
548
+ const prev = suppressSubprocessWarnings();
517
549
  try {
518
550
  client = new CopilotClient;
519
551
  await client.start();
@@ -536,6 +568,7 @@ async function checkCopilotAvailable() {
536
568
  }
537
569
  return `Copilot health check failed: ${msg}`;
538
570
  } finally {
571
+ restoreWarnings(prev);
539
572
  try {
540
573
  await client.stop();
541
574
  } catch {}
@@ -543,17 +576,18 @@ async function checkCopilotAvailable() {
543
576
  return null;
544
577
  }
545
578
  async function callCopilot(systemMessage, userMessage, model) {
579
+ const prev = suppressSubprocessWarnings();
546
580
  const client = new CopilotClient;
547
581
  await client.start();
548
582
  try {
549
583
  const sessionConfig = {
550
- systemMessage: { content: systemMessage }
584
+ systemMessage: { mode: "replace", content: systemMessage }
551
585
  };
552
586
  if (model)
553
587
  sessionConfig.model = model;
554
588
  const session = await client.createSession(sessionConfig);
555
589
  try {
556
- const response = await session.sendAndWait({ content: userMessage });
590
+ const response = await session.sendAndWait({ prompt: userMessage });
557
591
  if (!response?.data?.content)
558
592
  return null;
559
593
  return response.data.content;
@@ -561,6 +595,7 @@ async function callCopilot(systemMessage, userMessage, model) {
561
595
  await session.destroy();
562
596
  }
563
597
  } finally {
598
+ restoreWarnings(prev);
564
599
  await client.stop();
565
600
  }
566
601
  }
@@ -1181,8 +1216,8 @@ var start_default = defineCommand5({
1181
1216
  }
1182
1217
  info(`Creating branch: ${pc7.bold(branchName)}`);
1183
1218
  await fetchRemote(syncSource.remote);
1184
- const resetResult = await resetHard(syncSource.ref);
1185
- if (resetResult.exitCode !== 0) {}
1219
+ const updateResult = await updateLocalBranch(baseBranch, syncSource.ref);
1220
+ if (updateResult.exitCode !== 0) {}
1186
1221
  const result = await createBranch(branchName, baseBranch);
1187
1222
  if (result.exitCode !== 0) {
1188
1223
  error(`Failed to create branch: ${result.stderr}`);
@@ -1534,7 +1569,7 @@ var update_default = defineCommand9({
1534
1569
  heading("\uD83D\uDD03 contrib update");
1535
1570
  info(`Updating ${pc11.bold(currentBranch)} with latest ${pc11.bold(baseBranch)}...`);
1536
1571
  await fetchRemote(syncSource.remote);
1537
- await resetHard(syncSource.ref);
1572
+ await updateLocalBranch(baseBranch, syncSource.ref);
1538
1573
  const rebaseResult = await rebase(baseBranch);
1539
1574
  if (rebaseResult.exitCode !== 0) {
1540
1575
  warn("Rebase hit conflicts. Resolve them manually.");
@@ -1626,7 +1661,7 @@ import pc13 from "picocolors";
1626
1661
  // package.json
1627
1662
  var package_default = {
1628
1663
  name: "contribute-now",
1629
- version: "0.2.0",
1664
+ version: "0.2.1-staging.42dccfe",
1630
1665
  description: "Git workflow CLI for squash-merge two-branch models. Keeps dev in sync with main after squash merges.",
1631
1666
  type: "module",
1632
1667
  bin: {
@@ -1638,12 +1673,12 @@ var package_default = {
1638
1673
  ],
1639
1674
  scripts: {
1640
1675
  build: "bun build src/index.ts --outfile dist/index.js --target node --packages external",
1676
+ cli: "bun run src/index.ts --",
1641
1677
  dev: "bun src/index.ts",
1642
1678
  test: "bun test",
1643
1679
  lint: "biome check .",
1644
1680
  "lint:fix": "biome check --write .",
1645
1681
  format: "biome format --write .",
1646
- prepare: "husky || true",
1647
1682
  "www:dev": "bun run --cwd www dev",
1648
1683
  "www:build": "bun run --cwd www build",
1649
1684
  "www:preview": "bun run --cwd www preview"
@@ -1680,7 +1715,6 @@ var package_default = {
1680
1715
  "@biomejs/biome": "^2.4.4",
1681
1716
  "@types/bun": "latest",
1682
1717
  "@types/figlet": "^1.7.0",
1683
- husky: "^9.1.7",
1684
1718
  typescript: "^5.7.0"
1685
1719
  }
1686
1720
  };
@@ -1688,9 +1722,10 @@ var package_default = {
1688
1722
  // src/ui/banner.ts
1689
1723
  var LOGO;
1690
1724
  try {
1691
- LOGO = figlet.textSync("contrib", { font: "ANSI Shadow" });
1725
+ LOGO = figlet.textSync(`Contribute
1726
+ Now`, { font: "ANSI Shadow" });
1692
1727
  } catch {
1693
- LOGO = "contribute-now";
1728
+ LOGO = "Contribute Now";
1694
1729
  }
1695
1730
  function getVersion() {
1696
1731
  return package_default.version ?? "unknown";
@@ -1698,12 +1733,11 @@ function getVersion() {
1698
1733
  function getAuthor() {
1699
1734
  return typeof package_default.author === "string" ? package_default.author : "unknown";
1700
1735
  }
1701
- function showBanner(minimal = false) {
1736
+ function showBanner(showLinks = false) {
1702
1737
  console.log(pc13.cyan(`
1703
1738
  ${LOGO}`));
1704
1739
  console.log(` ${pc13.dim(`v${getVersion()}`)} ${pc13.dim("—")} ${pc13.dim(`Built by ${getAuthor()}`)}`);
1705
- if (!minimal) {
1706
- console.log(` ${pc13.dim(package_default.description)}`);
1740
+ if (showLinks) {
1707
1741
  console.log();
1708
1742
  console.log(` ${pc13.yellow("Star")} ${pc13.cyan("https://github.com/warengonzaga/contribute-now")}`);
1709
1743
  console.log(` ${pc13.green("Contribute")} ${pc13.cyan("https://github.com/warengonzaga/contribute-now/blob/main/CONTRIBUTING.md")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contribute-now",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-staging.42dccfe",
4
4
  "description": "Git workflow CLI for squash-merge two-branch models. Keeps dev in sync with main after squash merges.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,12 +12,12 @@
12
12
  ],
13
13
  "scripts": {
14
14
  "build": "bun build src/index.ts --outfile dist/index.js --target node --packages external",
15
+ "cli": "bun run src/index.ts --",
15
16
  "dev": "bun src/index.ts",
16
17
  "test": "bun test",
17
18
  "lint": "biome check .",
18
19
  "lint:fix": "biome check --write .",
19
20
  "format": "biome format --write .",
20
- "prepare": "husky || true",
21
21
  "www:dev": "bun run --cwd www dev",
22
22
  "www:build": "bun run --cwd www build",
23
23
  "www:preview": "bun run --cwd www preview"
@@ -54,7 +54,6 @@
54
54
  "@biomejs/biome": "^2.4.4",
55
55
  "@types/bun": "latest",
56
56
  "@types/figlet": "^1.7.0",
57
- "husky": "^9.1.7",
58
57
  "typescript": "^5.7.0"
59
58
  }
60
59
  }