ticketlens 0.43.1 → 0.43.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticketlens",
3
- "version": "0.43.1",
3
+ "version": "0.43.2",
4
4
  "description": "Jira CLI for developers — fetch ticket context, triage your queue, and stop tab-switching. Zero dependencies, all local.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,4 @@
1
1
  import { spawnSync } from 'node:child_process';
2
- import { existsSync } from 'node:fs';
3
- import { join } from 'node:path';
4
2
 
5
3
  const TICKET_KEY_RE = /([A-Z][A-Z0-9]+-\d+)/g;
6
4
  const SPAWN_OPTS = { encoding: 'utf8', timeout: 10_000 };
@@ -29,13 +27,13 @@ export function detectBase(execFn, cwd) {
29
27
  * @param {object} [opts]
30
28
  * @param {string} [opts.cwd] Working directory (default: process.cwd())
31
29
  * @param {Function} [opts.execFn] spawnSync replacement (injectable for tests)
32
- * @param {Function} [opts.fsCheck] existsSync replacement (injectable for tests)
33
30
  * @returns {Array<{branch:string, base:string|null, tickets:string[], files:string[]}>|null}
34
31
  * One-element array for the current branch, or null if not in a git repo / detached HEAD.
35
32
  */
36
- export function scanCurrentBranch({ cwd = process.cwd(), execFn = spawnSync, fsCheck = existsSync } = {}) {
37
- if (!fsCheck(join(cwd, '.git'))) return null;
38
-
33
+ export function scanCurrentBranch({ cwd = process.cwd(), execFn = spawnSync } = {}) {
34
+ // rev-parse fails outside a repo and searches upward like git itself, so it
35
+ // doubles as the repo check and works from subdirectories (backlog #45).
36
+ // GIT_DIR/GIT_WORK_TREE overrides are honored, matching real git semantics.
39
37
  const branch = run(execFn, ['rev-parse', '--abbrev-ref', 'HEAD'], cwd)?.trim();
40
38
  if (!branch || branch === 'HEAD') return null;
41
39
 
@@ -50,11 +50,6 @@ export function buildCompareUrl({ owner, repo, base, head, title, body, ticketKe
50
50
  * @param {string} markdown - the exact markdown assemblePr() already produced
51
51
  * @param {object} [opts]
52
52
  * @returns {Promise<{ok: true, url: string} | {ok: false, reason: string, message: string}>}
53
- *
54
- * Known limitation (pre-existing in branch-scanner.mjs, not fixed here — see
55
- * backlog): run from a repo subdirectory misreports 'no-branch' even on a
56
- * real branch, since scanCurrentBranch only checks for .git at cwd exactly,
57
- * not via git's own upward search. Run from the repo root.
58
53
  */
59
54
  export async function openPr(ticketKey, markdown, {
60
55
  cwd = process.cwd(),