atris 3.16.0 → 3.16.1

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.
@@ -4,6 +4,7 @@ const path = require('path');
4
4
  const TASK_STATUS_BUCKETS = {
5
5
  backlog: new Set(['open']),
6
6
  inProgress: new Set(['claimed']),
7
+ review: new Set(['review']),
7
8
  completed: new Set(['done', 'failed'])
8
9
  };
9
10
 
@@ -145,6 +146,44 @@ function getTasksFromDbBucket(atrisDir, bucketName) {
145
146
  }
146
147
  }
147
148
 
149
+ // Single-read task lane counts for boot/status surfaces.
150
+ // Prefers the task DB (source of truth); falls back to TODO.md parsing.
151
+ // Review counts only exist on the DB path — markdown views don't carry the lane.
152
+ function getTaskCounts(atrisDir) {
153
+ try {
154
+ const taskDb = require('./task-db');
155
+ if (fs.existsSync(taskDb.getDbPath())) {
156
+ const workspaceRoot = taskDb.workspaceRoot(path.dirname(path.resolve(atrisDir)));
157
+ const rows = taskDb.listTasks(taskDb.open(), { workspaceRoot, limit: 500 });
158
+ if (rows.length) {
159
+ const counts = { backlog: 0, active: 0, review: 0, reviewCertified: 0, source: 'db' };
160
+ for (const row of rows) {
161
+ const status = String(row.status || '').toLowerCase();
162
+ if (TASK_STATUS_BUCKETS.backlog.has(status)) counts.backlog++;
163
+ else if (TASK_STATUS_BUCKETS.inProgress.has(status)) counts.active++;
164
+ else if (TASK_STATUS_BUCKETS.review.has(status)) {
165
+ counts.review++;
166
+ try {
167
+ const meta = typeof row.metadata === 'string' ? JSON.parse(row.metadata || '{}') : (row.metadata || {});
168
+ if (meta.agent_certified && meta.approval_status !== 'accepted') counts.reviewCertified++;
169
+ } catch { /* unreadable metadata — count as uncertified */ }
170
+ }
171
+ }
172
+ return counts;
173
+ }
174
+ }
175
+ } catch (e) {
176
+ if (process.env.ATRIS_DEBUG) console.error('[state-detection] db count read failed:', e.message);
177
+ }
178
+ return {
179
+ backlog: getBacklogTasks(atrisDir).length,
180
+ active: getInProgressTasks(atrisDir).length,
181
+ review: 0,
182
+ reviewCertified: 0,
183
+ source: 'todo'
184
+ };
185
+ }
186
+
148
187
  function escapeRegExp(value) {
149
188
  return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
150
189
  }
@@ -320,5 +359,6 @@ module.exports = {
320
359
  getTodayLogPath,
321
360
  getBacklogTasks,
322
361
  getInProgressTasks,
323
- getCompletedTasks
362
+ getCompletedTasks,
363
+ getTaskCounts
324
364
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atris",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
4
4
  "main": "bin/atris.js",
5
5
  "bin": {
6
6
  "atris": "bin/atris.js",