facet query
facet query <dir> reads the workspace, schedules it and prints a JSON array
of the nodes that match the filters, in tree order: a parent before its
children, and the headings and items of a file in text order. Without filters
it prints every node.
Filters
Section titled “Filters”Filters combine with AND:
| Option | Keeps |
|---|---|
--ref REF |
that node (refs) |
--under REF |
the nodes below it, at any depth (not itself) |
--type task,milestone |
these node types |
--state todo,doing |
these checkbox states (list below) |
--owner odile |
nodes whose owner:: lists @odile (@ optional) |
--text booth |
title or description contains the text (any case) |
--due-before 2027-04-01 |
due strictly before the day |
--due-after 2027-03-01 |
due strictly after the day |
--late |
nodes the scheduler marks late (they end after their due::) |
--today 2027-01-15 |
the day for today, lateness and repeats |
The node types are folder, file, group, task, requirement, event,
milestone and note (Nodes and properties).
The states are todo, doing, done, cancelled and waiting.
--state looks at the node’s own checkbox, so a node without one never
matches it.
The due day of a repeating task is its next occurrence; for other nodes it is
the first day of due:: (due:: 2027-03 counts as 1 March). Nodes without a
due day are left out by both due filters.
Example
Section titled “Example”Open tasks owned by Odile:
facet query examples/workspace --type task --state todo,doing --owner odileIt prints three nodes; the second one is:
[ { "ref": "!stand-signed", "path": "trade-fair/plan.md", "position": { "line": 8, "column": 7 }, "kind": "item", "type": "task", "title": "Sign stand contract", "state": "doing", "id": "stand-signed", "properties": [ { "key": "id", "raw": "stand-signed" }, { "key": "start", "raw": "2027-02-01" }, { "key": "duration", "raw": "2 weeks" }, { "key": "owner", "raw": "@odile" } ], "description": "Waiting for the second quote from !boothwright before signing.", "parent": "trade-fair/plan.md:4", "children": [], "schedule": { "start": "2027-02-01T00:00", "end": "2027-02-15T00:00", "basis": "fixed", "milestone": false, "box": false, "progress": 0, "state": "doing", "late": false } }]More filters:
# Everything below the Booth headingfacet query examples/workspace --under trade-fair/plan.md:4
# Late work in one folder, as of a given dayfacet query examples/workspace --under trade-fair/ --late --today 2027-01-15
# All requirementsfacet query examples/workspace --type requirementThe node fields
Section titled “The node fields”| Field | Holds |
|---|---|
ref |
its most stable ref: id, else requirement name, else location |
path |
its file, relative to the workspace (folder: index.md or itself) |
position |
where its title starts: 1-based line and column |
kind |
folder, file, heading or item |
type |
the node type (see above) |
title |
the title, without checkbox, requirement name or inline fields |
level |
a heading’s level (only for headings) |
state |
its own checkbox state (only for nodes with a checkbox) |
requirement |
the requirement name, without req~ (only for requirements) |
id |
its id:: (a file: its frontmatter id:), when it has one |
properties |
every property as written (key, raw), in source order |
description |
the description as written, blocks joined by a blank line |
parent |
the parent’s ref (absent for the workspace root) |
children |
the children’s refs, in order |
schedule |
the computed dates, below |
schedule holds what the scheduler computed
(Dates and scheduling):
| Field | Holds |
|---|---|
start, end |
local times YYYY-MM-DDTHH:mm; end is exclusive |
basis |
where the start comes from (list below) |
milestone |
whether it is a milestone (zero length) |
box |
whether it has its own start and end, with children inside |
progress |
from 0 to 1 |
state |
the rolled-up state (a leaf task: its own) |
late |
whether it ends after its due:: |
next |
the next occurrence of a repeating task |
undated |
why a node meant to be scheduled has no dates (list below) |
basis is one of:
fixed:start::, orend::minusduration::;after: the latest end of itsafter::targets, plus any offset;parent: only aduration::, so it starts with the nearest ancestor that has its own start;due: a milestone with onlydue::, at the start of that day;children: rolled up from its children.
progress is 1 for a done leaf, else its progress::, else 0; a parent’s is
weighted by its children’s spans, cancelled ones left out. state is absent
when there is no task at or below the node; a description is "" when there
is none. Properties keep duplicates.
undated is one of:
no-anchor: no start, noafter::and no ancestor with its own start;error: a bad value, or an unknown or badafter::target;cycle: the node is in a dependency cycle;predecessor: anafter::target or the anchoring ancestor has no dates.
Fields that do not apply are left out, so a node without dates has only
milestone, box, progress, late and possibly state, next or
undated.
Exit codes
Section titled “Exit codes”| Code | When |
|---|---|
| 0 | the query ran (an empty array is a valid answer) |
| 2 | a bad option, an unknown or ambiguous ref, or an unreadable folder |
Errors go to standard error, prefixed with facet query:, for example
facet query: unknown id "!nope".