@yaks/project 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +145 -2
- package/_dist/comp.d.ts +12 -0
- package/_dist/comp.d.ts.map +1 -0
- package/_dist/graph.d.ts +6 -0
- package/_dist/graph.d.ts.map +1 -0
- package/_dist/guard.d.ts +23 -0
- package/_dist/guard.d.ts.map +1 -0
- package/_dist/mod.d.ts +26 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/plugin.d.ts +12 -0
- package/_dist/plugin.d.ts.map +1 -0
- package/_dist/tools.d.ts +15 -0
- package/_dist/tools.d.ts.map +1 -0
- package/_dist/tree.d.ts +23 -0
- package/_dist/tree.d.ts.map +1 -0
- package/_dist/views.d.ts +24 -0
- package/_dist/views.d.ts.map +1 -0
- package/_dist/vocab.d.ts +7 -0
- package/_dist/vocab.d.ts.map +1 -0
- package/comp.js +45 -0
- package/comp.js.map +1 -0
- package/comp.ts +54 -0
- package/deno.json +1 -0
- package/graph.js +14 -0
- package/graph.js.map +1 -0
- package/graph.ts +18 -0
- package/guard.js +99 -0
- package/guard.js.map +1 -0
- package/guard.ts +119 -0
- package/mod.js +26 -0
- package/mod.js.map +1 -0
- package/mod.ts +26 -0
- package/package.json +37 -4
- package/plugin.js +38 -0
- package/plugin.js.map +1 -0
- package/plugin.ts +39 -0
- package/tools.js +105 -0
- package/tools.js.map +1 -0
- package/tools.ts +138 -0
- package/tree.js +74 -0
- package/tree.js.map +1 -0
- package/tree.ts +105 -0
- package/views.js +27 -0
- package/views.js.map +1 -0
- package/views.ts +29 -0
- package/vocab.js +14 -0
- package/vocab.js.map +1 -0
- package/vocab.json +205 -0
- package/vocab.ts +16 -0
package/tools.ts
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// The implementations of the tools declared with `tool: true` in
|
|
2
|
+
// ./vocab.json, exported as `@yaks/project/tools` — the entry point a server
|
|
3
|
+
// imports to register them. Both are checks: tools whose verb is `check`,
|
|
4
|
+
// which is all a "doctor" is (@yaks/tools ./check.ts).
|
|
5
|
+
//
|
|
6
|
+
// Two invariants, and both are about a portfolio quietly stopping being one:
|
|
7
|
+
//
|
|
8
|
+
// A board is its query. ./guard.ts refuses an unroutable query as it is
|
|
9
|
+
// written, while whoever typed it is still there — but that is not the only way
|
|
10
|
+
// a query stops routing. The vocabulary moves: a property is renamed, a status
|
|
11
|
+
// retires, a component this server used to load is gone. Every board written
|
|
12
|
+
// against the old declarations now matches nothing and reports no error, which
|
|
13
|
+
// is exactly the failure the precondition hook exists to prevent, arriving from
|
|
14
|
+
// the other direction.
|
|
15
|
+
//
|
|
16
|
+
// Governed work is under A project. `governed` is the keyword a component
|
|
17
|
+
// declares to mean that a project answers for the entities carrying it
|
|
18
|
+
// (@yaks/kernel): a task, a memory, a design. One that is filed under no
|
|
19
|
+
// project, and that no project reaches along a containment edge, is work
|
|
20
|
+
// nobody's portfolio can see — it is on no board, in nobody's queue, and
|
|
21
|
+
// nothing will ever report that it was dropped.
|
|
22
|
+
|
|
23
|
+
import { and, every, present } from '@yaks/query'
|
|
24
|
+
import { human } from '@yaks/id'
|
|
25
|
+
import type { Finding } from 'jsr:@yaks/tools@0.2.36'
|
|
26
|
+
import { checked } from '@yaks/tools/check'
|
|
27
|
+
import type { Bundle, Comp, Graph } from 'jsr:@yaks/graph@0.2.36'
|
|
28
|
+
import type { Runs } from 'jsr:@yaks/graph@0.2.36/tools'
|
|
29
|
+
import type { Vocab } from 'jsr:@yaks/vocab@0.2.36'
|
|
30
|
+
import { BOARD, FILED, PROJECT } from './comp.js'
|
|
31
|
+
import { unroutable } from './guard.js'
|
|
32
|
+
|
|
33
|
+
/** The configuration `@yaks/project`'s checks accept. */
|
|
34
|
+
export type Options = {
|
|
35
|
+
/** which relation tags mean containment, when working out whether a project
|
|
36
|
+
* reaches something. The default is `contains` — @yaks/task's tag, and the
|
|
37
|
+
* one the fleet graph uses — because a package cannot know what another
|
|
38
|
+
* package named the edge meaning "part of". */
|
|
39
|
+
through?: string[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The containment relation tags assumed when configuration names none. */
|
|
43
|
+
let CONTAINS = ['contains']
|
|
44
|
+
|
|
45
|
+
let comp = (b: Bundle, name: string) => b[name] as Comp | undefined
|
|
46
|
+
|
|
47
|
+
// The components a project answers for, read off the loaded vocabulary rather
|
|
48
|
+
// than listed here: a server that loads another governed component gets it
|
|
49
|
+
// checked without an edit to this file.
|
|
50
|
+
let governedIn = (v: Vocab): string[] =>
|
|
51
|
+
v.all.filter((name) => v.comp(name)?.keywords.governed === true)
|
|
52
|
+
|
|
53
|
+
// Everything a project can see: the projects themselves, whatever is filed
|
|
54
|
+
// under one, and whatever those reach along the containment edges. A cycle of
|
|
55
|
+
// orphans looks internally connected, so reachability is only meaningful from
|
|
56
|
+
// the project seed — which is the whole reason this is a walk and not a
|
|
57
|
+
// property read.
|
|
58
|
+
let reached = async (
|
|
59
|
+
graph: Pick<Graph, 'read'>,
|
|
60
|
+
through: string[],
|
|
61
|
+
): Promise<Set<string>> => {
|
|
62
|
+
let seeds = [
|
|
63
|
+
...await graph.read(and(present(PROJECT))),
|
|
64
|
+
...await graph.read(and(present(`${FILED}.project`))),
|
|
65
|
+
]
|
|
66
|
+
// Only the edges a containment tag marks: reading every edge to keep these
|
|
67
|
+
// reads the whole edge table, more than one read may hold.
|
|
68
|
+
let links = (await Promise.all(
|
|
69
|
+
through.map((tag) => graph.read(and(present('edge'), present(tag)))),
|
|
70
|
+
)).flat()
|
|
71
|
+
let out = new Map<string, string[]>()
|
|
72
|
+
for (let b of links) {
|
|
73
|
+
let e = comp(b, 'edge')
|
|
74
|
+
if (!e?.from || !e?.to) continue
|
|
75
|
+
out.set(String(e.from), [...out.get(String(e.from)) ?? [], String(e.to)])
|
|
76
|
+
}
|
|
77
|
+
let seen = new Set(seeds.map((b) => b.entity.eid))
|
|
78
|
+
let front = [...seen]
|
|
79
|
+
while (front.length) {
|
|
80
|
+
let here = front.pop()!
|
|
81
|
+
for (let there of out.get(here) ?? []) {
|
|
82
|
+
if (seen.has(there)) continue
|
|
83
|
+
seen.add(there)
|
|
84
|
+
front.push(there)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return seen
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The implementations of the tools ./vocab.json declares. The loaded
|
|
91
|
+
* vocabulary is what a board's query routes through, and what declares which
|
|
92
|
+
* components are governed, so both checks are built against the components this
|
|
93
|
+
* graph actually has. */
|
|
94
|
+
export let runs = (
|
|
95
|
+
host: { vocab: Vocab },
|
|
96
|
+
options: Options = {},
|
|
97
|
+
): Runs => ({
|
|
98
|
+
board_check: async (call, graph) => {
|
|
99
|
+
let id = human(host.vocab)
|
|
100
|
+
let found = (await graph.read(and(present(`${BOARD}.query`), every())))
|
|
101
|
+
.flatMap((b): Finding[] => {
|
|
102
|
+
let query = String(comp(b, BOARD)?.query ?? '')
|
|
103
|
+
let why = query.trim() && unroutable(query, host.vocab)
|
|
104
|
+
return why
|
|
105
|
+
? [{
|
|
106
|
+
level: 'fail',
|
|
107
|
+
text: `${id(b)} no longer routes (${why}): ${query}`,
|
|
108
|
+
}]
|
|
109
|
+
: []
|
|
110
|
+
})
|
|
111
|
+
return checked(
|
|
112
|
+
call.entity.eid,
|
|
113
|
+
'every saved board query still routes',
|
|
114
|
+
found,
|
|
115
|
+
)
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
project_check: async (call, graph) => {
|
|
119
|
+
let id = human(host.vocab)
|
|
120
|
+
let seen = await reached(graph, options.through ?? CONTAINS)
|
|
121
|
+
let found: Finding[] = []
|
|
122
|
+
for (let word of governedIn(host.vocab)) {
|
|
123
|
+
for (let b of await graph.read(and(present(word), every()))) {
|
|
124
|
+
if (seen.has(b.entity.eid)) continue
|
|
125
|
+
found.push({
|
|
126
|
+
level: 'fail',
|
|
127
|
+
text: `${id(b)} (${word}) is under no project — nobody's portfolio ` +
|
|
128
|
+
`holds it, so nothing will ever say it was dropped`,
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return checked(
|
|
133
|
+
call.entity.eid,
|
|
134
|
+
'every governed entity is reachable from a project',
|
|
135
|
+
found,
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
})
|
package/tree.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Sub-projects: a project filed under another project is part of it.
|
|
2
|
+
//
|
|
3
|
+
// A project's parent is its own `filed.project`, the property that files a task
|
|
4
|
+
// under it, so one walk answers "everything under P" at any depth:
|
|
5
|
+
// `.filed.project->P` selects what is filed under P, its sub-projects, what is
|
|
6
|
+
// filed under those, and so on down (@yaks/query's walk over a reference
|
|
7
|
+
// property, which @yaks/sql and @yaks/match both evaluate). A property holds
|
|
8
|
+
// one value, so a project has at most one parent without a rule saying so.
|
|
9
|
+
//
|
|
10
|
+
// What a walk down cannot answer is the way up, which is {@link lineage}: an
|
|
11
|
+
// entity's project and every project above it, nearest first. A sub-project
|
|
12
|
+
// with no `repo` of its own lands through the nearest one above it that has
|
|
13
|
+
// one, and its agents are owed each common persona along the way
|
|
14
|
+
// (@yaks/persona). {@link nesting} refuses the one shape a tree cannot take: a
|
|
15
|
+
// project filed under itself, or under a project already under it.
|
|
16
|
+
import { after, each } from "@yaks/fp";
|
|
17
|
+
import { Refused } from "@yaks/graph/errors";
|
|
18
|
+
import { FILED, PROJECT } from "./comp.js";
|
|
19
|
+
let parentOf = (b)=>{
|
|
20
|
+
let p = b?.[FILED]?.project;
|
|
21
|
+
return typeof p == 'string' && p ? p : undefined;
|
|
22
|
+
};
|
|
23
|
+
let up = (g, eid, seen, out)=>{
|
|
24
|
+
if (!eid || seen.has(eid)) return out;
|
|
25
|
+
seen.add(eid);
|
|
26
|
+
return after(g.get([
|
|
27
|
+
eid
|
|
28
|
+
]), ([b])=>{
|
|
29
|
+
if (b?.[PROJECT]) out.push(b);
|
|
30
|
+
return up(g, parentOf(b), seen, out);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The projects an entity is under, nearest first: the entity itself when it is
|
|
35
|
+
* a project, then each project its `filed.project` chain passes through. A
|
|
36
|
+
* task's lineage starts at the project it is filed in. Synchronous over a
|
|
37
|
+
* synchronous storage, a promise over one that returns promises.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { lineage } from '@yaks/project'
|
|
41
|
+
*
|
|
42
|
+
* // (await lineage(g, 'T-7')).find((p) => p.repo) — where T-7 lands
|
|
43
|
+
* ```
|
|
44
|
+
*/ export let lineage = (g, eid)=>up(g, eid, new Set(), []);
|
|
45
|
+
// Where this batch files each entity it moves: a removed filing, or a cleared
|
|
46
|
+
// project, leaves it under nothing.
|
|
47
|
+
let moves = (bundles)=>{
|
|
48
|
+
let out = new Map();
|
|
49
|
+
for (let b of bundles){
|
|
50
|
+
let f = b[FILED];
|
|
51
|
+
if (f === null) out.set(b.entity.eid, undefined);
|
|
52
|
+
else if (f && 'project' in f) out.set(b.entity.eid, parentOf(b));
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* The `precondition` hook that keeps projects a tree: it refuses filing an
|
|
58
|
+
* entity under a project that is already under it, itself included. The
|
|
59
|
+
* parents it walks are the ones this batch leaves, so two projects filed under
|
|
60
|
+
* each other in one batch are refused too.
|
|
61
|
+
*/ export let nesting = (bundles, tx)=>{
|
|
62
|
+
let moved = moves(bundles);
|
|
63
|
+
let parent = (eid)=>moved.has(eid) ? moved.get(eid) : after(tx.get([
|
|
64
|
+
eid
|
|
65
|
+
]), ([b])=>parentOf(b));
|
|
66
|
+
let reaches = (at, eid, seen)=>!at || seen.has(at) ? false : at == eid || (seen.add(at), after(parent(at), (p)=>reaches(p, eid, seen)));
|
|
67
|
+
return after(each([
|
|
68
|
+
...moved
|
|
69
|
+
], null, (_, [eid, under])=>after(reaches(under, eid, new Set()), (loop)=>{
|
|
70
|
+
if (!loop) return null;
|
|
71
|
+
throw new Refused(`${eid} cannot be filed under ${under}: ${under} is already under ` + `it, and a project's sub-projects form a tree`);
|
|
72
|
+
})), ()=>bundles);
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=tree.js.map
|
package/tree.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sources":["./tree.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,mEAAmE;AACnE,+EAA+E;AAC/E,yEAAyE;AACzE,6EAA6E;AAC7E,2EAA2E;AAC3E,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,iEAAiE;AACjE,+EAA+E;AAC/E,mEAAmE;AAGnE,SAAS,KAAK,EAAE,IAAI,wBAA6B;AACjD,SAAS,OAAO,kCAAuC;AACvD,SAAS,KAAK,EAAE,OAAO,oBAAmB;AAK1C,IAAI,WAAW,CAAC;EACd,IAAI,IAAK,GAAG,CAAC,MAAM,EAAuB;EAC1C,OAAO,OAAO,KAAK,YAAY,IAAI,IAAI;AACzC;AAEA,IAAI,KAAK,CACP,GACA,KACA,MACA;EAEA,IAAI,CAAC,OAAO,KAAK,GAAG,CAAC,MAAM,OAAO;EAClC,KAAK,GAAG,CAAC;EACT,OAAO,MAAM,EAAE,GAAG,CAAC;IAAC;GAAI,GAAG,CAAC,CAAC,EAAE;IAC7B,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC;IAC3B,OAAO,GAAG,GAAG,SAAS,IAAI,MAAM;EAClC;AACF;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,IAAI,UAAU,CACnB,GACA,MACiC,GAAG,GAAG,KAAK,IAAI,OAAO,EAAE,EAAC;AAE5D,8EAA8E;AAC9E,oCAAoC;AACpC,IAAI,QAAQ,CAAC;EACX,IAAI,MAAM,IAAI;EACd,KAAK,IAAI,KAAK,QAAS;IACrB,IAAI,IAAI,CAAC,CAAC,MAAM;IAChB,IAAI,MAAM,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE;SACjC,IAAI,KAAK,aAAa,GAAG,IAAI,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,SAAS;EAC/D;EACA,OAAO;AACT;AAEA;;;;;CAKC,GACD,OAAO,IAAI,UAAgB,CAAC,SAAS;EACnC,IAAI,QAAQ,MAAM;EAClB,IAAI,SAAS,CAAC,MACZ,MAAM,GAAG,CAAC,OAAO,MAAM,GAAG,CAAC,OAAO,MAAM,GAAG,GAAG,CAAC;MAAC;KAAI,GAAG,CAAC,CAAC,EAAE,GAAK,SAAS;EAC3E,IAAI,UAAU,CACZ,IACA,KACA,OAEA,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,QAAQ,MAAM,OAClC,CAAC,KAAK,GAAG,CAAC,KAAK,MAAM,OAAO,KAAK,CAAC,IAAM,QAAQ,GAAG,KAAK,MAAM;EAClE,OAAO,MACL,KACE;OAAI;GAAM,EACV,MACA,CAAC,GAAG,CAAC,KAAK,MAAM,GACd,MAAM,QAAQ,OAAO,KAAK,IAAI,QAAQ,CAAC;MACrC,IAAI,CAAC,MAAM,OAAO;MAClB,MAAM,IAAI,QACR,GAAG,IAAI,uBAAuB,EAAE,MAAM,EAAE,EAAE,MAAM,kBAAkB,CAAC,GACjE,CAAC,4CAA4C,CAAC;IAEpD,KAEJ,IAAM;AAEV,EAAC"}
|
package/tree.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Sub-projects: a project filed under another project is part of it.
|
|
2
|
+
//
|
|
3
|
+
// A project's parent is its own `filed.project`, the property that files a task
|
|
4
|
+
// under it, so one walk answers "everything under P" at any depth:
|
|
5
|
+
// `.filed.project->P` selects what is filed under P, its sub-projects, what is
|
|
6
|
+
// filed under those, and so on down (@yaks/query's walk over a reference
|
|
7
|
+
// property, which @yaks/sql and @yaks/match both evaluate). A property holds
|
|
8
|
+
// one value, so a project has at most one parent without a rule saying so.
|
|
9
|
+
//
|
|
10
|
+
// What a walk down cannot answer is the way up, which is {@link lineage}: an
|
|
11
|
+
// entity's project and every project above it, nearest first. A sub-project
|
|
12
|
+
// with no `repo` of its own lands through the nearest one above it that has
|
|
13
|
+
// one, and its agents are owed each common persona along the way
|
|
14
|
+
// (@yaks/persona). {@link nesting} refuses the one shape a tree cannot take: a
|
|
15
|
+
// project filed under itself, or under a project already under it.
|
|
16
|
+
|
|
17
|
+
import type { Bundle, Comp, Eid, Hook } from 'jsr:@yaks/graph@0.2.36'
|
|
18
|
+
import { after, each } from '@yaks/fp'
|
|
19
|
+
import { Refused } from '@yaks/graph/errors'
|
|
20
|
+
import { FILED, PROJECT } from './comp.js'
|
|
21
|
+
|
|
22
|
+
/** What reading up a lineage needs: entities by eid, synchronously or not. */
|
|
23
|
+
export type Reads = { get: (eids: Eid[]) => Bundle[] | Promise<Bundle[]> }
|
|
24
|
+
|
|
25
|
+
let parentOf = (b: Bundle | undefined): Eid | undefined => {
|
|
26
|
+
let p = (b?.[FILED] as Comp | undefined)?.project
|
|
27
|
+
return typeof p == 'string' && p ? p : undefined
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let up = (
|
|
31
|
+
g: Reads,
|
|
32
|
+
eid: Eid | undefined,
|
|
33
|
+
seen: Set<Eid>,
|
|
34
|
+
out: Bundle[],
|
|
35
|
+
): Bundle[] | Promise<Bundle[]> => {
|
|
36
|
+
if (!eid || seen.has(eid)) return out
|
|
37
|
+
seen.add(eid)
|
|
38
|
+
return after(g.get([eid]), ([b]) => {
|
|
39
|
+
if (b?.[PROJECT]) out.push(b)
|
|
40
|
+
return up(g, parentOf(b), seen, out)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The projects an entity is under, nearest first: the entity itself when it is
|
|
46
|
+
* a project, then each project its `filed.project` chain passes through. A
|
|
47
|
+
* task's lineage starts at the project it is filed in. Synchronous over a
|
|
48
|
+
* synchronous storage, a promise over one that returns promises.
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { lineage } from '@yaks/project'
|
|
52
|
+
*
|
|
53
|
+
* // (await lineage(g, 'T-7')).find((p) => p.repo) — where T-7 lands
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export let lineage = (
|
|
57
|
+
g: Reads,
|
|
58
|
+
eid: Eid,
|
|
59
|
+
): Bundle[] | Promise<Bundle[]> => up(g, eid, new Set(), [])
|
|
60
|
+
|
|
61
|
+
// Where this batch files each entity it moves: a removed filing, or a cleared
|
|
62
|
+
// project, leaves it under nothing.
|
|
63
|
+
let moves = (bundles: Bundle[]): Map<Eid, Eid | undefined> => {
|
|
64
|
+
let out = new Map<Eid, Eid | undefined>()
|
|
65
|
+
for (let b of bundles) {
|
|
66
|
+
let f = b[FILED] as Comp | null | undefined
|
|
67
|
+
if (f === null) out.set(b.entity.eid, undefined)
|
|
68
|
+
else if (f && 'project' in f) out.set(b.entity.eid, parentOf(b))
|
|
69
|
+
}
|
|
70
|
+
return out
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The `precondition` hook that keeps projects a tree: it refuses filing an
|
|
75
|
+
* entity under a project that is already under it, itself included. The
|
|
76
|
+
* parents it walks are the ones this batch leaves, so two projects filed under
|
|
77
|
+
* each other in one batch are refused too.
|
|
78
|
+
*/
|
|
79
|
+
export let nesting: Hook = (bundles, tx) => {
|
|
80
|
+
let moved = moves(bundles)
|
|
81
|
+
let parent = (eid: Eid) =>
|
|
82
|
+
moved.has(eid) ? moved.get(eid) : after(tx.get([eid]), ([b]) => parentOf(b))
|
|
83
|
+
let reaches = (
|
|
84
|
+
at: Eid | undefined,
|
|
85
|
+
eid: Eid,
|
|
86
|
+
seen: Set<Eid>,
|
|
87
|
+
): boolean | Promise<boolean> =>
|
|
88
|
+
!at || seen.has(at) ? false : at == eid ||
|
|
89
|
+
(seen.add(at), after(parent(at), (p) => reaches(p, eid, seen)))
|
|
90
|
+
return after(
|
|
91
|
+
each(
|
|
92
|
+
[...moved],
|
|
93
|
+
null,
|
|
94
|
+
(_, [eid, under]) =>
|
|
95
|
+
after(reaches(under, eid, new Set()), (loop) => {
|
|
96
|
+
if (!loop) return null
|
|
97
|
+
throw new Refused(
|
|
98
|
+
`${eid} cannot be filed under ${under}: ${under} is already under ` +
|
|
99
|
+
`it, and a project's sub-projects form a tree`,
|
|
100
|
+
)
|
|
101
|
+
}),
|
|
102
|
+
),
|
|
103
|
+
() => bundles,
|
|
104
|
+
)
|
|
105
|
+
}
|
package/views.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./views` facet: the pages this package offers a browsing app's
|
|
3
|
+
* sidebar, each a list of what its query finds (@yaks/browse destinations):
|
|
4
|
+
* the projects work is filed under, and the boards that are saved searches
|
|
5
|
+
* over it.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { destinations } from '@yaks/project/views'
|
|
9
|
+
* destinations.map((d) => d.name) // ['Projects', 'Saved searches']
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/ /** The sidebar's pages: a key for the address, a name, an icon, a query. */ export let destinations = [
|
|
14
|
+
{
|
|
15
|
+
key: 'projects',
|
|
16
|
+
name: 'Projects',
|
|
17
|
+
icon: 'folder',
|
|
18
|
+
query: '.project !archived * .order=doc.title'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: 'searches',
|
|
22
|
+
name: 'Saved searches',
|
|
23
|
+
icon: 'bookmark',
|
|
24
|
+
query: '.board *'
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
//# sourceMappingURL=views.js.map
|
package/views.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views.js","sources":["./views.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,0EAA0E,GAC1E,OAAO,IAAI,eAAe;EACxB;IACE,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;EACT;EACA;IACE,KAAK;IACL,MAAM;IACN,MAAM;IACN,OAAO;EACT;CACD,CAAA"}
|
package/views.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./views` facet: the pages this package offers a browsing app's
|
|
3
|
+
* sidebar, each a list of what its query finds (@yaks/browse destinations):
|
|
4
|
+
* the projects work is filed under, and the boards that are saved searches
|
|
5
|
+
* over it.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { destinations } from '@yaks/project/views'
|
|
9
|
+
* destinations.map((d) => d.name) // ['Projects', 'Saved searches']
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The sidebar's pages: a key for the address, a name, an icon, a query. */
|
|
16
|
+
export let destinations = [
|
|
17
|
+
{
|
|
18
|
+
key: 'projects',
|
|
19
|
+
name: 'Projects',
|
|
20
|
+
icon: 'folder',
|
|
21
|
+
query: '.project !archived * .order=doc.title',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: 'searches',
|
|
25
|
+
name: 'Saved searches',
|
|
26
|
+
icon: 'bookmark',
|
|
27
|
+
query: '.board *',
|
|
28
|
+
},
|
|
29
|
+
]
|
package/vocab.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The portfolio's component declarations and nothing else, exported as
|
|
2
|
+
// `@yaks/project/vocab`. It imports no storage, no SQL and no runtime API, so a
|
|
3
|
+
// browser tab loading this vocabulary loads nothing else with it.
|
|
4
|
+
import { projectDoc } from "./comp.js";
|
|
5
|
+
import manifest from './package.json' with {
|
|
6
|
+
type: 'json'
|
|
7
|
+
};
|
|
8
|
+
export { projectDoc };
|
|
9
|
+
/** What this package is: its manifest's description, the one place it is
|
|
10
|
+
* written, which a host stamps on each document here. */ export let description = manifest.description;
|
|
11
|
+
/** Every document this plugin declares. */ export let docs = [
|
|
12
|
+
projectDoc
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=vocab.js.map
|
package/vocab.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vocab.js","sources":["./vocab.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,gFAAgF;AAChF,kEAAkE;AAGlE,SAAS,UAAU,oBAAmB;AACtC,OAAO,cAAc,sBAAsB;EAAE,MAAM;AAAO,EAAC;AAE3D,SAAS,UAAU,GAAE;AAErB;uDACuD,GACvD,OAAO,IAAI,cAAsB,SAAS,WAAW,CAAA;AAErD,yCAAyC,GACzC,OAAO,IAAI,OAAmB;EAAC;CAAW,CAAA"}
|
package/vocab.json
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "urn:uuid:2385f33f-db14-4861-a5db-ec3406078f8b",
|
|
3
|
+
"$vocabulary": {
|
|
4
|
+
"https://yak.sh/vocab/core": true,
|
|
5
|
+
"https://yak.sh/vocab/id": true,
|
|
6
|
+
"https://yak.sh/vocab/names": true,
|
|
7
|
+
"https://yak.sh/vocab/kernel": true
|
|
8
|
+
},
|
|
9
|
+
"title": "project",
|
|
10
|
+
"$defs": {
|
|
11
|
+
"board": {
|
|
12
|
+
"$id": "urn:uuid:ac3d34f3-adb9-4b01-8cf5-32b17551cb93",
|
|
13
|
+
"component": true,
|
|
14
|
+
"type": "object",
|
|
15
|
+
"by_name": true,
|
|
16
|
+
"description": "a saved filter over the tasks; membership is never stored",
|
|
17
|
+
"properties": {
|
|
18
|
+
"query": {
|
|
19
|
+
"$id": "urn:uuid:6b48fd0c-247d-4efd-810b-f567bb96a64d",
|
|
20
|
+
"type": "string",
|
|
21
|
+
"format": "query",
|
|
22
|
+
"description": "the filter that is the board; the empty query selects nothing"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"filed": {
|
|
27
|
+
"$id": "urn:uuid:2810226e-ef92-4929-ab40-ec44662844b5",
|
|
28
|
+
"component": true,
|
|
29
|
+
"type": "object",
|
|
30
|
+
"description": "optional portfolio filing, separate from being a task; a project filed under another project is its sub-project",
|
|
31
|
+
"properties": {
|
|
32
|
+
"priority": {
|
|
33
|
+
"$id": "urn:uuid:d31222fe-a146-4257-a8f9-079ca4fd1cae",
|
|
34
|
+
"type": "number",
|
|
35
|
+
"format": "priority",
|
|
36
|
+
"description": "queue order — lower is more urgent"
|
|
37
|
+
},
|
|
38
|
+
"project": {
|
|
39
|
+
"$id": "urn:uuid:8834f7f3-03a1-43dc-8dc7-01cab994b0f2",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"ref": "project",
|
|
42
|
+
"death": "detach",
|
|
43
|
+
"description": "what it is filed under, which for a project is its parent; deleting the project frees what was filed under it rather than taking it along"
|
|
44
|
+
},
|
|
45
|
+
"assignee": {
|
|
46
|
+
"$id": "urn:uuid:5d285ebc-81fd-4efd-9a6e-d09e595c6959",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"ref": "entity",
|
|
49
|
+
"death": "detach",
|
|
50
|
+
"description": "whose queue this task is filed in"
|
|
51
|
+
},
|
|
52
|
+
"domain": {
|
|
53
|
+
"$id": "urn:uuid:ef12abb3-7abe-464c-a2cd-77789b4ddb74",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"well": "domains",
|
|
56
|
+
"description": "the work area this task is filed in"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"project": {
|
|
61
|
+
"$id": "urn:uuid:0ff86f43-ff47-497a-8af8-15aa81fa6d09",
|
|
62
|
+
"component": true,
|
|
63
|
+
"type": "object",
|
|
64
|
+
"by_name": true,
|
|
65
|
+
"description": "something tasks are grouped under; filed under another project, it is that project's sub-project",
|
|
66
|
+
"properties": {
|
|
67
|
+
"color": {
|
|
68
|
+
"$id": "urn:uuid:0b2a8c3e-6492-49f5-8e0f-76254bef6eff",
|
|
69
|
+
"type": "string"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"repo": {
|
|
74
|
+
"$id": "urn:uuid:393b7d7f-61d7-4e2a-9b3e-e3b31c8d10b9",
|
|
75
|
+
"component": true,
|
|
76
|
+
"type": "object",
|
|
77
|
+
"properties": {
|
|
78
|
+
"repository": {
|
|
79
|
+
"$id": "urn:uuid:915c0b91-199d-4cea-9a39-6396f81208bd",
|
|
80
|
+
"type": "string",
|
|
81
|
+
"ref": "entity",
|
|
82
|
+
"death": "detach",
|
|
83
|
+
"description": "the @yaks/git repository this project's work is in; its checkouts are `worktree`s of it"
|
|
84
|
+
},
|
|
85
|
+
"base_branch": {
|
|
86
|
+
"$id": "urn:uuid:bac65cb7-31ec-4261-826c-bd3ba75ec45f",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "what work branches from and lands into"
|
|
89
|
+
},
|
|
90
|
+
"push": {
|
|
91
|
+
"$id": "urn:uuid:f71a7042-c894-48e7-9b46-2f2de13f6e1f",
|
|
92
|
+
"type": "boolean",
|
|
93
|
+
"description": "whether landing also pushes"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"description": "a project's landing policy for its source: which repository it is in, what work branches from, and whether a change is published. A sub-project without one lands through the nearest project above it that has one"
|
|
97
|
+
},
|
|
98
|
+
"venture": {
|
|
99
|
+
"$id": "urn:uuid:4d939a16-2c22-47f3-9752-3ca0fdb49743",
|
|
100
|
+
"component": true,
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"phase": {
|
|
104
|
+
"$id": "urn:uuid:5733db31-b49e-4e4b-9170-6d9eb700f71e",
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": [
|
|
107
|
+
"building",
|
|
108
|
+
"launching",
|
|
109
|
+
"live"
|
|
110
|
+
],
|
|
111
|
+
"description": "where it is: a phase, not a status, because nothing here is ever done. Suspending it is the separate `paused` component, so a phase never has to be remembered and put back, and putting it away for good is the kernel's `archived`"
|
|
112
|
+
},
|
|
113
|
+
"tagline": {
|
|
114
|
+
"$id": "urn:uuid:8ea69e58-0662-467f-a164-b8ad1d6f3bbe",
|
|
115
|
+
"type": "string",
|
|
116
|
+
"description": "one line describing what it is"
|
|
117
|
+
},
|
|
118
|
+
"site": {
|
|
119
|
+
"$id": "urn:uuid:84bd8c0f-279a-44e0-bafa-220638c682f9",
|
|
120
|
+
"type": "string",
|
|
121
|
+
"format": "uri",
|
|
122
|
+
"description": "its address on the web"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"description": "a business being built: the phase it is in and its address. Who runs it is an edge, and the model an agent uses is @yaks/model's"
|
|
126
|
+
},
|
|
127
|
+
"paused": {
|
|
128
|
+
"$id": "urn:uuid:1fc3b6ad-6b43-4761-b71e-5a2014206a90",
|
|
129
|
+
"component": true,
|
|
130
|
+
"type": "object",
|
|
131
|
+
"properties": {
|
|
132
|
+
"at": {
|
|
133
|
+
"$id": "urn:uuid:e24dde9f-c5f5-459c-8ca1-11eefb22a78a",
|
|
134
|
+
"type": "string",
|
|
135
|
+
"format": "date-time",
|
|
136
|
+
"stamped": true,
|
|
137
|
+
"description": "when work on it was suspended"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"description": "work on it is suspended. A separate component, so the phase underneath is untouched and resuming means removing this one"
|
|
141
|
+
},
|
|
142
|
+
"board_check": {
|
|
143
|
+
"tool": true,
|
|
144
|
+
"noun": "board",
|
|
145
|
+
"verb": "check",
|
|
146
|
+
"title": "Check board queries",
|
|
147
|
+
"description": "Check saved board queries (filters defining which records a board displays) against the store’s vocabulary, its schema of components and fields. A board is its query, so a query naming removed components or invalid fields can leave work missing from the board; this check reports why it no longer resolves. Takes no arguments. Returns a report in content.body, with warning or failure findings when present; it does not repair the records or configuration.",
|
|
148
|
+
"input": {},
|
|
149
|
+
"readOnly": true
|
|
150
|
+
},
|
|
151
|
+
"project_check": {
|
|
152
|
+
"tool": true,
|
|
153
|
+
"noun": "project",
|
|
154
|
+
"verb": "check",
|
|
155
|
+
"title": "Check project coverage",
|
|
156
|
+
"description": "Report records that should belong to a project but do not. A record is checked if it has a component marked governed: true in the schema, such as task or design. It is covered if filed directly under a project or reached through containment relationships from a project or a filed record. The server chooses which relationships mean containment; the default is contains. Uncovered work can be missed by project-based reports. Takes no arguments. Returns a report in content.body, with warning or failure findings when present; it does not repair the records or configuration.",
|
|
157
|
+
"input": {},
|
|
158
|
+
"readOnly": true
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"kinds": {
|
|
162
|
+
"board": {
|
|
163
|
+
"$id": "urn:uuid:ac3d34f3-adb9-4b01-8cf5-32b17551cb93",
|
|
164
|
+
"description": "a saved filter over the tasks; membership is never stored",
|
|
165
|
+
"with": {
|
|
166
|
+
"doc": true
|
|
167
|
+
},
|
|
168
|
+
"prefix": "B",
|
|
169
|
+
"examples": [
|
|
170
|
+
{
|
|
171
|
+
"board": {
|
|
172
|
+
"query": ".task !completed"
|
|
173
|
+
},
|
|
174
|
+
"doc": {
|
|
175
|
+
"title": "Open work"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"project": {
|
|
181
|
+
"$id": "urn:uuid:0ff86f43-ff47-497a-8af8-15aa81fa6d09",
|
|
182
|
+
"description": "something tasks are grouped under; filed under another project, it is that project's sub-project",
|
|
183
|
+
"with": {
|
|
184
|
+
"doc": true,
|
|
185
|
+
"topic": true
|
|
186
|
+
},
|
|
187
|
+
"before": [
|
|
188
|
+
"board",
|
|
189
|
+
"email"
|
|
190
|
+
],
|
|
191
|
+
"prefix": "P",
|
|
192
|
+
"examples": [
|
|
193
|
+
{
|
|
194
|
+
"project": {},
|
|
195
|
+
"doc": {
|
|
196
|
+
"title": "Recipe box"
|
|
197
|
+
},
|
|
198
|
+
"topic": {
|
|
199
|
+
"name": "recipe box"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
package/vocab.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The portfolio's component declarations and nothing else, exported as
|
|
2
|
+
// `@yaks/project/vocab`. It imports no storage, no SQL and no runtime API, so a
|
|
3
|
+
// browser tab loading this vocabulary loads nothing else with it.
|
|
4
|
+
|
|
5
|
+
import type { VocabDoc } from 'jsr:@yaks/vocab@0.2.36'
|
|
6
|
+
import { projectDoc } from './comp.js'
|
|
7
|
+
import manifest from './package.json' with { type: 'json' }
|
|
8
|
+
|
|
9
|
+
export { projectDoc }
|
|
10
|
+
|
|
11
|
+
/** What this package is: its manifest's description, the one place it is
|
|
12
|
+
* written, which a host stamps on each document here. */
|
|
13
|
+
export let description: string = manifest.description
|
|
14
|
+
|
|
15
|
+
/** Every document this plugin declares. */
|
|
16
|
+
export let docs: VocabDoc[] = [projectDoc]
|