@dylanpiercey/work 0.0.1 → 0.0.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.
package/bin/work.mjs CHANGED
@@ -83,7 +83,9 @@ async function setup() {
83
83
  "bottom",
84
84
  "pnpm",
85
85
  ];
86
- const binOf = { ripgrep: "rg", "ast-grep": "sg", bottom: "btm" };
86
+ // Note: ast-grep's short alias `sg` collides with the coreutils
87
+ // setgroups command — check the long binary name.
88
+ const binOf = { ripgrep: "rg", bottom: "btm" };
87
89
  for (const tool of tools) {
88
90
  if (have(binOf[tool] || tool)) continue;
89
91
  log(`installing ${tool} via mise`);
package/dist/index.mjs CHANGED
@@ -15566,6 +15566,29 @@ function withoutDismissed(workspaceId, fullName, list) {
15566
15566
  //#endregion
15567
15567
  //#region src/server/diff.ts
15568
15568
  var MAX_FILE_BYTES = 5e5;
15569
+ /** Diffs compare against remote-tracking refs, which only move when this
15570
+ * machine fetches or pushes — a PR merged on GitHub leaves them stale and
15571
+ * the diff shows already-merged work until the next fetch. Opening the
15572
+ * diff freshens the base refs itself (throttled per repo; each ref
15573
+ * fetched independently since one missing ref fails a combined fetch,
15574
+ * and capped so a slow remote can't hang the view — stale refs then
15575
+ * self-correct on the next open). */
15576
+ var FETCH_TTL_MS = 3e4;
15577
+ var FETCH_WAIT_MS = 8e3;
15578
+ var lastFetch = /* @__PURE__ */ new Map();
15579
+ async function freshenBaseRefs(dir, fullName, refs) {
15580
+ const now = Date.now();
15581
+ if (now - (lastFetch.get(fullName) ?? 0) < FETCH_TTL_MS) return;
15582
+ lastFetch.set(fullName, now);
15583
+ const fetches = [...new Set(refs)].map((ref) => git([
15584
+ "fetch",
15585
+ "--quiet",
15586
+ "--no-tags",
15587
+ "origin",
15588
+ ref
15589
+ ], dir).catch(() => {}));
15590
+ await Promise.race([Promise.all(fetches), new Promise((resolve) => setTimeout(resolve, FETCH_WAIT_MS))]);
15591
+ }
15569
15592
  /** The ref the working tree is compared against by default, best first:
15570
15593
  * the workspace branch's remote (a lane worktree then shows its whole
15571
15594
  * delta vs the pushed workspace branch, and a worktree on the workspace
@@ -15605,6 +15628,16 @@ async function resolveBase(dir, wsBranch, baseBranch, baseRef) {
15605
15628
  async function workspaceDiff(ws, baseRef) {
15606
15629
  return Promise.all(ws.repos.map(async (repo) => {
15607
15630
  const dir = path.join(ws.path, repo.worktree);
15631
+ const branch = await git([
15632
+ "rev-parse",
15633
+ "--abbrev-ref",
15634
+ "HEAD"
15635
+ ], dir).catch(() => "HEAD");
15636
+ await freshenBaseRefs(dir, repo.full_name, [
15637
+ ws.branch,
15638
+ ...branch !== "HEAD" ? [branch] : [],
15639
+ ...baseRef ? [baseRef] : [repo.base_branch]
15640
+ ]);
15608
15641
  const { mergeBase, label } = await resolveBase(dir, ws.branch, repo.base_branch, baseRef);
15609
15642
  const [nameStatus, untracked] = await Promise.all([git([
15610
15643
  "diff",
package/install.sh CHANGED
@@ -18,6 +18,11 @@ log() { printf '==> %s\n' "$*"; }
18
18
  die() { printf 'error: %s\n' "$*" >&2; exit 1; }
19
19
  have() { command -v "$1" >/dev/null 2>&1; }
20
20
 
21
+ # Everything runs inside main() so bash parses the whole script before
22
+ # executing anything — when piped from curl, commands that read stdin
23
+ # (apt-get, installers) would otherwise swallow the rest of the script.
24
+ main() {
25
+
21
26
  PKG="${WORK_PKG:-@dylanpiercey/work@latest}"
22
27
  SUDO=""
23
28
  if [[ "$(id -u)" != 0 ]]; then
@@ -100,5 +105,11 @@ log "running work setup"
100
105
  if [[ "${WORK_YES:-0}" == 1 ]]; then
101
106
  work setup --yes
102
107
  else
103
- work setup
108
+ # Reattach the terminal for interactive prompts (gh auth) — stdin is
109
+ # the script itself under `curl | bash`.
110
+ work setup </dev/tty || work setup --yes
104
111
  fi
112
+
113
+ }
114
+
115
+ main "$@"
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dylanpiercey/work",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "description": "Web GUI for agentic dev workspaces",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/DylanPiercey/work.git"
10
+ },
7
11
  "bin": {
8
12
  "work": "bin/work.mjs"
9
13
  },