aitasks 1.0.2 → 1.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.
Files changed (2) hide show
  1. package/dist/index.js +119 -43
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1890,7 +1890,7 @@ var require_commander = __commonJS((exports) => {
1890
1890
  var require_package = __commonJS((exports, module) => {
1891
1891
  module.exports = {
1892
1892
  name: "aitasks",
1893
- version: "1.0.2",
1893
+ version: "1.0.3",
1894
1894
  description: "CLI task management tool built for AI agents",
1895
1895
  type: "module",
1896
1896
  bin: {
@@ -27159,30 +27159,6 @@ var TreeRow = ({ item, isSelected, paneWidth }) => {
27159
27159
  ]
27160
27160
  }, undefined, true, undefined, this);
27161
27161
  };
27162
- var SectionDivider = ({ section, count, total, isFirst }) => {
27163
- const color = section === "in_progress" ? "yellow" : "green";
27164
- const label = section === "in_progress" ? "IN PROGRESS" : "DONE";
27165
- const countLabel = total !== undefined && total !== count ? `${count} of ${total}` : `${count}`;
27166
- return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27167
- marginTop: isFirst ? 0 : 1,
27168
- paddingLeft: 1,
27169
- children: [
27170
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27171
- color,
27172
- bold: true,
27173
- children: label
27174
- }, undefined, false, undefined, this),
27175
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27176
- color: "#AAAAAA",
27177
- children: [
27178
- " (",
27179
- countLabel,
27180
- ")"
27181
- ]
27182
- }, undefined, true, undefined, this)
27183
- ]
27184
- }, undefined, true, undefined, this);
27185
- };
27186
27162
  var c2 = (color, text) => {
27187
27163
  if (color.startsWith("#"))
27188
27164
  return source_default.hex(color)(text);
@@ -27360,6 +27336,7 @@ var TreeBoardComponent = ({ getTasks }) => {
27360
27336
  const [tasks, setTasks] = import_react29.useState(() => getTasks());
27361
27337
  const [selectedIdx, setSelectedIdx] = import_react29.useState(0);
27362
27338
  const [scrollOffset, setScrollOffset] = import_react29.useState(0);
27339
+ const [leftScrollOffset, setLeftScrollOffset] = import_react29.useState(0);
27363
27340
  const { exit } = use_app_default();
27364
27341
  const { stdout } = use_stdout_default();
27365
27342
  import_react29.useEffect(() => {
@@ -27370,9 +27347,45 @@ var TreeBoardComponent = ({ getTasks }) => {
27370
27347
  }, [getTasks]);
27371
27348
  const items = import_react29.useMemo(() => buildTree(tasks), [tasks]);
27372
27349
  const clampIdx = Math.min(selectedIdx, Math.max(0, items.length - 1));
27350
+ const leftRows = import_react29.useMemo(() => {
27351
+ const ipCnt = items.filter((i) => i.section === "in_progress").length;
27352
+ const ipTotal = items.filter((i) => i.section === "in_progress" || i.section === "middle").length;
27353
+ const doneCnt = items.filter((i) => i.section === "done").length;
27354
+ const result2 = [];
27355
+ let firstSection = true;
27356
+ for (let idx = 0;idx < items.length; idx++) {
27357
+ const item = items[idx];
27358
+ if (item.showSectionHeader && item.section !== "middle") {
27359
+ if (!firstSection)
27360
+ result2.push({ kind: "spacer" });
27361
+ result2.push({
27362
+ kind: "section",
27363
+ section: item.section,
27364
+ count: item.section === "in_progress" ? ipCnt : doneCnt,
27365
+ total: item.section === "in_progress" ? ipTotal : undefined
27366
+ });
27367
+ firstSection = false;
27368
+ }
27369
+ result2.push({ kind: "item", item, itemIdx: idx });
27370
+ }
27371
+ return result2;
27372
+ }, [items]);
27373
+ const selectedRowIdx = leftRows.findIndex((r2) => r2.kind === "item" && r2.itemIdx === clampIdx);
27373
27374
  import_react29.useEffect(() => {
27374
27375
  setScrollOffset(0);
27375
27376
  }, [clampIdx]);
27377
+ import_react29.useEffect(() => {
27378
+ if (selectedRowIdx < 0)
27379
+ return;
27380
+ const visH = Math.max(1, (stdout.rows ?? 30) - 4);
27381
+ setLeftScrollOffset((o) => {
27382
+ if (selectedRowIdx < o)
27383
+ return selectedRowIdx;
27384
+ if (selectedRowIdx >= o + visH)
27385
+ return selectedRowIdx - visH + 1;
27386
+ return o;
27387
+ });
27388
+ }, [selectedRowIdx, stdout]);
27376
27389
  use_input_default((input, key) => {
27377
27390
  if (input === "q" || key.escape)
27378
27391
  exit();
@@ -27440,16 +27453,30 @@ var TreeBoardComponent = ({ getTasks }) => {
27440
27453
  process.stdin.off("data", onData);
27441
27454
  };
27442
27455
  }, []);
27443
- const ipCount = items.filter((i) => i.section === "in_progress").length;
27444
- const ipTotalCount = items.filter((i) => i.section === "in_progress" || i.section === "middle").length;
27445
- const doneCount = items.filter((i) => i.section === "done").length;
27446
27456
  const leftInner = leftWidth - 2;
27447
27457
  const rightInner = rightWidth - 2;
27458
+ const leftVisibleH = Math.max(1, rows - 4);
27459
+ const leftTotalRows = leftRows.length;
27460
+ const leftMaxOffset = Math.max(0, leftTotalRows - leftVisibleH);
27461
+ const leftOffset = Math.min(leftScrollOffset, leftMaxOffset);
27462
+ const visibleLeftRows = leftRows.slice(leftOffset, leftOffset + leftVisibleH);
27463
+ const leftScrollbar = (() => {
27464
+ const bar = Array(leftVisibleH).fill(" ");
27465
+ if (leftTotalRows > leftVisibleH) {
27466
+ const thumbH = Math.max(1, Math.floor(leftVisibleH / leftTotalRows * leftVisibleH));
27467
+ const thumbPos = leftMaxOffset > 0 ? Math.floor(leftOffset / leftMaxOffset * (leftVisibleH - thumbH)) : 0;
27468
+ for (let i = 0;i < leftVisibleH; i++) {
27469
+ bar[i] = i >= thumbPos && i < thumbPos + thumbH ? "\u2588" : "\u2591";
27470
+ }
27471
+ }
27472
+ return bar;
27473
+ })();
27448
27474
  return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27449
27475
  flexDirection: "column",
27450
27476
  width: cols,
27451
27477
  children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27452
27478
  width: cols,
27479
+ height: rows,
27453
27480
  children: [
27454
27481
  /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27455
27482
  width: leftWidth,
@@ -27484,21 +27511,70 @@ var TreeBoardComponent = ({ getTasks }) => {
27484
27511
  dimColor: true,
27485
27512
  children: "\u2500".repeat(leftInner)
27486
27513
  }, undefined, false, undefined, this),
27487
- items.map((item, idx) => /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(import_react29.default.Fragment, {
27488
- children: [
27489
- item.showSectionHeader && item.section !== "middle" && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(SectionDivider, {
27490
- section: item.section,
27491
- count: item.section === "in_progress" ? ipCount : doneCount,
27492
- total: item.section === "in_progress" ? ipTotalCount : undefined,
27493
- isFirst: idx === 0
27494
- }, undefined, false, undefined, this),
27495
- /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TreeRow, {
27496
- item,
27497
- isSelected: idx === clampIdx,
27498
- paneWidth: leftInner
27514
+ visibleLeftRows.map((row, i) => {
27515
+ const sb = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27516
+ width: 1,
27517
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27518
+ dimColor: true,
27519
+ children: leftScrollbar[i]
27499
27520
  }, undefined, false, undefined, this)
27500
- ]
27501
- }, item.task.id, true, undefined, this))
27521
+ }, undefined, false, undefined, this);
27522
+ if (row.kind === "spacer") {
27523
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27524
+ children: [
27525
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27526
+ flexGrow: 1,
27527
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27528
+ children: " "
27529
+ }, undefined, false, undefined, this)
27530
+ }, undefined, false, undefined, this),
27531
+ sb
27532
+ ]
27533
+ }, `sp-${leftOffset + i}`, true, undefined, this);
27534
+ }
27535
+ if (row.kind === "section") {
27536
+ const color = row.section === "in_progress" ? "yellow" : "green";
27537
+ const label = row.section === "in_progress" ? "IN PROGRESS" : "DONE";
27538
+ const cnt = row.total !== undefined && row.total !== row.count ? `${row.count} of ${row.total}` : `${row.count}`;
27539
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27540
+ children: [
27541
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27542
+ flexGrow: 1,
27543
+ paddingLeft: 1,
27544
+ children: [
27545
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27546
+ color,
27547
+ bold: true,
27548
+ children: label
27549
+ }, undefined, false, undefined, this),
27550
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Text, {
27551
+ color: "#AAAAAA",
27552
+ children: [
27553
+ " (",
27554
+ cnt,
27555
+ ")"
27556
+ ]
27557
+ }, undefined, true, undefined, this)
27558
+ ]
27559
+ }, undefined, true, undefined, this),
27560
+ sb
27561
+ ]
27562
+ }, `sec-${row.section}`, true, undefined, this);
27563
+ }
27564
+ return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27565
+ children: [
27566
+ /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
27567
+ flexGrow: 1,
27568
+ children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(TreeRow, {
27569
+ item: row.item,
27570
+ isSelected: row.itemIdx === clampIdx,
27571
+ paneWidth: leftInner - 1
27572
+ }, undefined, false, undefined, this)
27573
+ }, undefined, false, undefined, this),
27574
+ sb
27575
+ ]
27576
+ }, row.item.task.id, true, undefined, this);
27577
+ })
27502
27578
  ]
27503
27579
  }, undefined, true, undefined, this),
27504
27580
  /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
@@ -27945,4 +28021,4 @@ program2.parseAsync(process.argv).catch((err) => {
27945
28021
  process.exit(1);
27946
28022
  });
27947
28023
 
27948
- //# debugId=7BF15E0EE4CC68E364756E2164756E21
28024
+ //# debugId=09373F4729776D6C64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aitasks",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "CLI task management tool built for AI agents",
5
5
  "type": "module",
6
6
  "bin": {