@braingrid/cli 0.2.17 → 0.2.18

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/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.18] - 2025-12-17
11
+
12
+ ### Added
13
+
14
+ - **Current task auto-detection**
15
+ - `task show` now works without a task ID - automatically detects the current task
16
+ - `task update` now works without a task ID - updates the current task
17
+ - Current task is determined by: first IN_PROGRESS task, or first PLANNED task if none in progress
18
+ - `task delete` still requires explicit task ID for safety
19
+
20
+ - **Status line shows current task**
21
+ - Claude Code status line now displays: `BrainGrid: PROJ-X > REQ-Y > TASK-Z [completed/total]`
22
+ - Shows the current task being worked on alongside progress count
23
+ - Automatically updates as tasks are completed
24
+
10
25
  ## [0.2.17] - 2025-12-17
11
26
 
12
27
  ### Added
package/dist/cli.js CHANGED
@@ -422,7 +422,7 @@ import axios3, { AxiosError as AxiosError2 } from "axios";
422
422
 
423
423
  // src/build-config.ts
424
424
  var BUILD_ENV = true ? "production" : process.env.NODE_ENV === "test" ? "development" : "production";
425
- var CLI_VERSION = true ? "0.2.17" : "0.0.0-test";
425
+ var CLI_VERSION = true ? "0.2.18" : "0.0.0-test";
426
426
  var PRODUCTION_CONFIG = {
427
427
  apiUrl: "https://app.braingrid.ai",
428
428
  workosAuthUrl: "https://auth.braingrid.ai",
@@ -4518,6 +4518,21 @@ function getServices3() {
4518
4518
  const taskService = new TaskService(config.apiUrl, auth);
4519
4519
  return { taskService, auth };
4520
4520
  }
4521
+ async function getCurrentTask(taskService, projectId, requirementId) {
4522
+ const response = await taskService.listTasks(projectId, requirementId);
4523
+ const inProgress = response.tasks.find((t) => t.status === "IN_PROGRESS");
4524
+ if (inProgress) {
4525
+ return { success: true, taskId: inProgress.number };
4526
+ }
4527
+ const planned = response.tasks.find((t) => t.status === "PLANNED");
4528
+ if (planned) {
4529
+ return { success: true, taskId: planned.number };
4530
+ }
4531
+ return {
4532
+ success: false,
4533
+ error: "No active task found. All tasks are completed or cancelled."
4534
+ };
4535
+ }
4521
4536
  async function handleTaskList(opts) {
4522
4537
  let stopSpinner = null;
4523
4538
  try {
@@ -4679,7 +4694,19 @@ async function handleTaskShow(id, opts) {
4679
4694
  };
4680
4695
  }
4681
4696
  const requirementId = requirementResult.requirementId;
4682
- const taskId = normalizeTaskId(id);
4697
+ let taskId;
4698
+ if (id) {
4699
+ taskId = normalizeTaskId(id);
4700
+ } else {
4701
+ const currentTask = await getCurrentTask(taskService, projectId, requirementId);
4702
+ if (!currentTask.success) {
4703
+ return {
4704
+ success: false,
4705
+ message: chalk8.red(`\u274C ${currentTask.error}`)
4706
+ };
4707
+ }
4708
+ taskId = currentTask.taskId;
4709
+ }
4683
4710
  const config = getConfig();
4684
4711
  stopSpinner = showSpinner("Loading task", chalk8.gray);
4685
4712
  const task2 = await taskService.getTask(projectId, requirementId, taskId);
@@ -4799,13 +4826,13 @@ async function handleTaskUpdate(id, opts) {
4799
4826
  message: chalk8.red("\u274C Not authenticated. Please run `braingrid login` first.")
4800
4827
  };
4801
4828
  }
4802
- if (!opts.status && !opts.title) {
4829
+ if (!opts?.status && !opts?.title) {
4803
4830
  return {
4804
4831
  success: false,
4805
4832
  message: chalk8.red("\u274C Please provide at least one field to update (--status or --title)")
4806
4833
  };
4807
4834
  }
4808
- const workspace = await workspaceManager.getProject(opts.project);
4835
+ const workspace = await workspaceManager.getProject(opts?.project);
4809
4836
  if (!workspace.success) {
4810
4837
  return {
4811
4838
  success: false,
@@ -4813,7 +4840,7 @@ async function handleTaskUpdate(id, opts) {
4813
4840
  };
4814
4841
  }
4815
4842
  const projectId = workspace.projectId;
4816
- const requirementResult = await workspaceManager.getRequirement(opts.requirement);
4843
+ const requirementResult = await workspaceManager.getRequirement(opts?.requirement);
4817
4844
  if (!requirementResult.success) {
4818
4845
  return {
4819
4846
  success: false,
@@ -4821,12 +4848,24 @@ async function handleTaskUpdate(id, opts) {
4821
4848
  };
4822
4849
  }
4823
4850
  const requirementId = requirementResult.requirementId;
4824
- const taskId = normalizeTaskId(id);
4851
+ let taskId;
4852
+ if (id) {
4853
+ taskId = normalizeTaskId(id);
4854
+ } else {
4855
+ const currentTask = await getCurrentTask(taskService, projectId, requirementId);
4856
+ if (!currentTask.success) {
4857
+ return {
4858
+ success: false,
4859
+ message: chalk8.red(`\u274C ${currentTask.error}`)
4860
+ };
4861
+ }
4862
+ taskId = currentTask.taskId;
4863
+ }
4825
4864
  const config = getConfig();
4826
4865
  stopSpinner = showSpinner("Updating task", chalk8.gray);
4827
4866
  const task2 = await taskService.updateTask(projectId, requirementId, taskId, {
4828
- status: opts.status,
4829
- title: opts.title
4867
+ status: opts?.status,
4868
+ title: opts?.title
4830
4869
  });
4831
4870
  stopSpinner();
4832
4871
  stopSpinner = null;
@@ -4835,7 +4874,7 @@ async function handleTaskUpdate(id, opts) {
4835
4874
  successMessage: `Updated task ${task2.number}`,
4836
4875
  apiUrl: config.apiUrl,
4837
4876
  projectShortId: projectId,
4838
- requirementShortId: opts.requirement || requirementId,
4877
+ requirementShortId: opts?.requirement || requirementId,
4839
4878
  requirementId
4840
4879
  });
4841
4880
  return {
@@ -7182,7 +7221,7 @@ task.command("summary").description("Show task summary table (quick overview wit
7182
7221
  process.exit(1);
7183
7222
  }
7184
7223
  });
7185
- task.command("show <id>").description("Show task details").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").option("--format <format>", "output format (table, json, xml, markdown)", "table").action(async (id, opts) => {
7224
+ task.command("show [id]").description("Show task details (auto-detects current task if not provided)").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").option("--format <format>", "output format (table, json, xml, markdown)", "table").action(async (id, opts) => {
7186
7225
  const result = await handleTaskShow(id, opts);
7187
7226
  console.log(result.message);
7188
7227
  if (!result.success) {
@@ -7196,7 +7235,7 @@ task.command("create").description("Create a new task").option("-r, --requiremen
7196
7235
  process.exit(1);
7197
7236
  }
7198
7237
  });
7199
- task.command("update <id>").description("Update task information").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").option("--status <status>", "new status (PLANNED, IN_PROGRESS, COMPLETED, CANCELLED)").option("--title <title>", "new task title").action(async (id, opts) => {
7238
+ task.command("update [id]").description("Update task (auto-detects current task if not provided)").option("-r, --requirement <id>", "requirement ID (REQ-456, auto-detects project if initialized)").option("-p, --project <id>", "project ID (PROJ-123, optional if project is initialized)").option("--status <status>", "new status (PLANNED, IN_PROGRESS, COMPLETED, CANCELLED)").option("--title <title>", "new task title").action(async (id, opts) => {
7200
7239
  const result = await handleTaskUpdate(id, opts);
7201
7240
  console.log(result.message);
7202
7241
  if (!result.success) {