@unclex/ken-task 0.1.0 → 0.1.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.
package/dist/cli.js CHANGED
@@ -80,8 +80,11 @@ worktree is missing or holds another branch; uncommitted changes in its worktree
80
80
  problem with its fix; a deviation from the canonical shape, read anyway, with the
81
81
  upgrade.
82
82
 
83
- --json one array of objects: path, title, every field read, other (the fields
84
- ken-task does not know), state, unmet blockers and notes
83
+ --json one array of objects: path, rel (the path in the folder, extension kept),
84
+ title, every field read, other (the fields ken-task does not know), state,
85
+ unmet blockers and notes; created as the 90-day note reads it, on every row
86
+ but a problem, so sorting ready rows by due, created, path is
87
+ \`ken task ready\`'s order
85
88
 
86
89
  Examples:
87
90
  ken task list
package/dist/list.js CHANGED
@@ -111,9 +111,8 @@ export function resolveRef(root, folder, live, path, ref) {
111
111
  * then earliest created, then path, so two runs agree.
112
112
  */
113
113
  export function readyTasks(root, configured, today) {
114
- const created = since(root, real(configured));
115
- const key = (row) => [row.due ?? '~', created(row.path, row.created)[0], row.path];
116
- return listTasks(root, configured, today, { created })
114
+ const key = (row) => [row.due ?? '~', row.created ?? '~', row.path];
115
+ return listTasks(root, configured, today)
117
116
  .filter((row) => row.state === 'ready')
118
117
  .map((row) => ({ row, key: key(row) }))
119
118
  .sort((a, b) => (a.key.join('\0') < b.key.join('\0') ? -1 : 1))
@@ -125,9 +124,10 @@ export function readyTasks(root, configured, today) {
125
124
  * problem, so no file can stop the listing. `quiet` leaves unsaid which repos are not
126
125
  * cloned here, for a caller that says it itself.
127
126
  */
128
- export function listTasks(root, configured, today, { created = since(root, real(configured)), quiet = false } = {}) {
127
+ export function listTasks(root, configured, today, { quiet = false } = {}) {
129
128
  // the real path, as the root is, so that every path compares as the disk names it
130
129
  const folder = real(configured);
130
+ const created = since(root, folder);
131
131
  const tasks = new Map(walk(folder).map((path) => [path, load(path)]));
132
132
  const repo = repos(quiet);
133
133
  return [...tasks.entries()]
@@ -194,13 +194,23 @@ export function listTasks(root, configured, today, { created = since(root, real(
194
194
  if (open && fields.due && fields.due < today)
195
195
  notes.push(`overdue: due ${fields.due}`);
196
196
  // a problem row's note is its fix; it is never asked its age, so it cannot fail again
197
- if (open && !problems.length) {
198
- const [from, by] = created(path, fields.created);
197
+ const born = problems.length ? undefined : created(path, fields.created);
198
+ if (open && born) {
199
+ const [from, by] = born;
199
200
  const age = days(from, today);
200
201
  if (age > 90)
201
202
  notes.push(`open ${age} days, since ${from} by ${by}: finish it, or close it`);
202
203
  }
203
- return { path, title, ...fields, state, unmet: open ? unmet : [], notes };
204
+ return {
205
+ path,
206
+ rel: relative(folder, path),
207
+ title,
208
+ ...fields,
209
+ ...(born && { created: born[0] }),
210
+ state,
211
+ unmet: open ? unmet : [],
212
+ notes
213
+ };
204
214
  }
205
215
  }
206
216
  /** What needs you about the branch `name` of the task at `path`, in state `state`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unclex/ken-task",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Plain-text tasks in one folder, one file per task, a git worktree per task. Reached as `ken task`.",
5
5
  "type": "module",
6
6
  "license": "MIT",