pinsay-cli 0.7.2 → 0.7.3

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/cli.js +35 -2
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -15,7 +15,7 @@ var init_build_constants = __esm({
15
15
  "src/build-constants.ts"() {
16
16
  "use strict";
17
17
  BUILD_DEFAULT_SERVER = true ? "https://app.pinsay.dev" : "https://app.pinsay.dev";
18
- BUILD_CLI_VERSION = true ? "0.7.2" : "0.0.0-dev";
18
+ BUILD_CLI_VERSION = true ? "0.7.3" : "0.0.0-dev";
19
19
  }
20
20
  });
21
21
 
@@ -5506,6 +5506,16 @@ function headSha(cwd2) {
5506
5506
  }
5507
5507
  return result.stdout.trim();
5508
5508
  }
5509
+ function resolveCommit(ref, cwd2) {
5510
+ const result = spawnSync2("git", ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`], {
5511
+ cwd: cwd2,
5512
+ encoding: "utf8"
5513
+ });
5514
+ if (result.status !== 0) {
5515
+ throw new Error(`Not a commit in this repository: ${ref}`);
5516
+ }
5517
+ return result.stdout.trim();
5518
+ }
5509
5519
  function getRemoteUrl(cwd2, remote = "origin") {
5510
5520
  const result = spawnSync2("git", ["remote", "get-url", remote], {
5511
5521
  cwd: cwd2,
@@ -5666,11 +5676,21 @@ async function markApplied(options, ctx) {
5666
5676
  const warning = delegationWarning(projectCtx.delegation ?? "auto", models);
5667
5677
  if (warning)
5668
5678
  console.error(warning);
5679
+ let existingSha;
5680
+ if (options.noCommit) {
5681
+ try {
5682
+ existingSha = resolveCommit(options.commit ?? "HEAD", ctx.cwd);
5683
+ } catch (err) {
5684
+ console.error(err.message);
5685
+ process.exit(1);
5686
+ }
5687
+ }
5669
5688
  if (options.dryRun) {
5670
5689
  console.log(`[dry-run] Would mark comment ${options.id} as applied`);
5671
5690
  console.log(`[dry-run] Reply: ${options.reply}`);
5672
5691
  console.log(`[dry-run] AppliedBy: ${appliedByLabel}`);
5673
5692
  console.log(`[dry-run] Models: ${describeModels(models)}`);
5693
+ console.log(`[dry-run] Commit: ${existingSha ?? "a new commit of the staged changes"}`);
5674
5694
  return {
5675
5695
  committed: false,
5676
5696
  patchedIds: typeof options.id === "number" ? [options.id] : []
@@ -5698,6 +5718,9 @@ async function markApplied(options, ctx) {
5698
5718
  sha = headSha(ctx.cwd);
5699
5719
  const remote = getRemoteUrl(ctx.cwd);
5700
5720
  commitUrl = commitUrlFor(sha, remote);
5721
+ } else {
5722
+ sha = existingSha;
5723
+ commitUrl = sha ? commitUrlFor(sha, getRemoteUrl(ctx.cwd)) : null;
5701
5724
  }
5702
5725
  for (const item of pending) {
5703
5726
  await api(ctx.server, `/api/comments/${item.id}`, {
@@ -5746,6 +5769,9 @@ async function markApplied(options, ctx) {
5746
5769
  sha = headSha(ctx.cwd);
5747
5770
  const remote = getRemoteUrl(ctx.cwd);
5748
5771
  commitUrl = commitUrlFor(sha, remote);
5772
+ } else {
5773
+ sha = existingSha;
5774
+ commitUrl = sha ? commitUrlFor(sha, getRemoteUrl(ctx.cwd)) : null;
5749
5775
  }
5750
5776
  await api(ctx.server, `/api/comments/${id}`, {
5751
5777
  method: "PATCH",
@@ -5914,6 +5940,11 @@ async function applyCommand(cwd2, parsed, positionals = []) {
5914
5940
  }
5915
5941
  const noCommit = parsed["no-commit"] === true;
5916
5942
  const dryRun = parsed["dry-run"] === true;
5943
+ const commitRef = typeof parsed["commit"] === "string" ? parsed["commit"] : void 0;
5944
+ if (commitRef && !noCommit) {
5945
+ console.error("--commit <sha> needs --no-commit (plain --mark records the commit it makes).");
5946
+ process.exit(2);
5947
+ }
5917
5948
  const toolExplicit = typeof parsed["tool"] === "string" ? parsed["tool"] : void 0;
5918
5949
  const tool2 = toolExplicit || config.aiTool;
5919
5950
  if (!toolExplicit && config.aiTool) {
@@ -5942,6 +5973,7 @@ async function applyCommand(cwd2, parsed, positionals = []) {
5942
5973
  id: markId,
5943
5974
  reply,
5944
5975
  noCommit,
5976
+ commit: commitRef,
5945
5977
  dryRun,
5946
5978
  tool: tool2,
5947
5979
  models,
@@ -12842,7 +12874,8 @@ Options:
12842
12874
  --tool <name> Hand off prompt to claude, opencode, cursor, or clipboard
12843
12875
  --mark <id>|all Commit staged changes and mark comment(s) applied
12844
12876
  --reply <text> Reply text for applied comment (required with --mark)
12845
- --no-commit Skip git commit during --mark (PATCH only)
12877
+ --no-commit Mark without committing: the fix is already committed (records --commit, default HEAD)
12878
+ --commit <sha> With --no-commit: the commit that holds the fix (default HEAD)
12846
12879
  --dry-run Print what --mark would do without making git/API changes
12847
12880
  --models <list> Every model that worked on the item, with its role, for --mark/--fail:
12848
12881
  "<id>=<role>,<id>=<role>" (role: planner|implementer|reviewer, optional;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinsay-cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Click-to-comment feedback for your web app: install the widget, then turn pending comments into AI apply prompts.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -12,7 +12,7 @@
12
12
  "directory": "."
13
13
  },
14
14
  "bugs": {
15
- "url": "https://github.com/moamen-ui/pinsay-api/issues"
15
+ "url": "https://github.com/moamen-ui/pinsay-cli/issues"
16
16
  },
17
17
  "keywords": [
18
18
  "feedback",