@fungi.computer/issues 0.2.0 → 0.4.0
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/README.md +69 -39
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -1
- package/dist/report.d.ts +259 -0
- package/dist/report.js +116 -0
- package/dist/validator.d.ts +3 -44
- package/dist/validator.js +6 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,53 +1,77 @@
|
|
|
1
|
-
# Issues
|
|
1
|
+
# Issues (`@fungi.computer/issues`)
|
|
2
|
+
|
|
3
|
+
Issues checks a folder of Markdown tickets in your repository and tells you
|
|
4
|
+
which ones are unblocked. `isTerminalIssueStatus(status)` shares the validator’s
|
|
5
|
+
resolved/wontfix rule with consumers that display the same issue graph.
|
|
6
|
+
|
|
7
|
+
```mermaid
|
|
8
|
+
flowchart LR
|
|
9
|
+
Folder[issues/ folder of Markdown] --> Issues[Issues package]
|
|
10
|
+
Issues -->|records| Tickets[Parsed tickets]
|
|
11
|
+
Issues -->|diagnostics| Problems[Broken links and states]
|
|
12
|
+
Tickets --> Ready[Unblocked tickets]
|
|
13
|
+
```
|
|
2
14
|
|
|
3
|
-
|
|
4
|
-
record of relative paths and Markdown text. It returns typed diagnostics,
|
|
5
|
-
summaries, the unblocked frontier, and metadata-only records. Any invalid ticket
|
|
6
|
-
makes `records` empty; callers can retain their previous valid projection.
|
|
7
|
-
Filesystem discovery, Git access, commit identity and persistence belong to the
|
|
8
|
-
caller. Repository tooling supplies the local filesystem adapter.
|
|
15
|
+
## Quick start
|
|
9
16
|
|
|
10
|
-
|
|
11
|
-
owns YAML extraction, Effect validates JSON values, @cfworker/json-schema
|
|
12
|
-
applies the contract (no code generation, so it runs in Workers and under a
|
|
13
|
-
strict CSP), and remark parses Markdown headings. Heading comparisons retain
|
|
14
|
-
literal inline Markdown; fenced code does not supply required sections. The
|
|
15
|
-
blocker walk is iterative, so dependency depth does not consume the JavaScript
|
|
16
|
-
call stack.
|
|
17
|
+
Install it:
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
indexing remain separate tracker work.
|
|
19
|
+
```sh
|
|
20
|
+
npm install @fungi.computer/issues
|
|
21
|
+
```
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```ts
|
|
24
24
|
import { inspectIssueTree } from "@fungi.computer/issues";
|
|
25
25
|
|
|
26
26
|
const { records, diagnostics } = inspectIssueTree({});
|
|
27
|
-
|
|
27
|
+
console.log({ records, diagnostics });
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Common tasks
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
The maintained stranger proof installs only package tarballs into a fresh npm
|
|
34
|
-
consumer, checks the exact shipped files, runs the public runtime fixture and
|
|
35
|
-
compiles every JavaScript entrypoint with strict NodeNext and no library-check
|
|
36
|
-
skip. This qualification does not publish npm releases or push a repository
|
|
37
|
-
split.
|
|
32
|
+
### Inspect a tree
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
`inspectIssueTree` returns the records and any diagnostics. See
|
|
35
|
+
[Inspect a tree](#inspect-a-tree).
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
### Find what is ready to work on
|
|
43
38
|
|
|
44
|
-
|
|
45
|
-
import { inspectIssueTree } from "@fungi.computer/issues";
|
|
39
|
+
See [Core concepts](#core-concepts).
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
### Run the checks
|
|
42
|
+
|
|
43
|
+
See Examples and checks.
|
|
44
|
+
|
|
45
|
+
## Reference
|
|
46
|
+
|
|
47
|
+
### Overview
|
|
48
|
+
|
|
49
|
+
Issues validates a Markdown issue tracker kept in a repository's `issues/`
|
|
50
|
+
folder and works out which tickets are unblocked.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm install @fungi.computer/issues
|
|
49
56
|
```
|
|
50
57
|
|
|
58
|
+
## Inspect a tree
|
|
59
|
+
|
|
60
|
+
`inspectIssueTree(files)` validates a complete `issues/` tree supplied as a
|
|
61
|
+
record of relative paths and Markdown text. It returns typed diagnostics,
|
|
62
|
+
summaries, the unblocked frontier, and metadata-only records. Any invalid ticket
|
|
63
|
+
makes `records` empty; callers can retain their previous valid projection.
|
|
64
|
+
Filesystem discovery, Git access, commit identity and persistence belong to the
|
|
65
|
+
caller. Repository tooling supplies the local filesystem adapter.
|
|
66
|
+
|
|
67
|
+
The single frontmatter contract lives in `src/issue-schema.ts`. VFile Matter
|
|
68
|
+
owns YAML extraction, Effect validates JSON values, @cfworker/json-schema
|
|
69
|
+
applies the contract (no code generation, so it runs in Workers and under a
|
|
70
|
+
strict CSP), and remark parses Markdown headings. Heading comparisons retain
|
|
71
|
+
literal inline Markdown; fenced code does not supply required sections. The
|
|
72
|
+
blocker walk is iterative, so dependency depth does not consume the JavaScript
|
|
73
|
+
call stack.
|
|
74
|
+
|
|
51
75
|
## Core concepts
|
|
52
76
|
|
|
53
77
|
The caller supplies a complete tree snapshot. Invalid tickets produce
|
|
@@ -59,11 +83,17 @@ with the caller.
|
|
|
59
83
|
The packed runtime fixture at `test/stranger/runtime.mjs` exercises the public
|
|
60
84
|
API in a fresh consumer. Run `pnpm run stranger` after building the package.
|
|
61
85
|
|
|
62
|
-
## Install
|
|
63
|
-
|
|
64
|
-
Install the package tarball with npm. The manifest pins its runtime
|
|
65
|
-
dependencies.
|
|
66
|
-
|
|
67
86
|
## Contribute and license
|
|
68
87
|
|
|
69
88
|
See [LICENSE](LICENSE) for the MIT terms.
|
|
89
|
+
|
|
90
|
+
## Packed consumer readiness
|
|
91
|
+
|
|
92
|
+
Run `pnpm run build`, `pnpm run pack` and `pnpm run stranger` in this package.
|
|
93
|
+
The maintained stranger proof installs only package tarballs into a fresh npm
|
|
94
|
+
consumer, checks the exact shipped files, runs the public runtime fixture and
|
|
95
|
+
compiles every JavaScript entrypoint with strict NodeNext and no library-check
|
|
96
|
+
skip. This qualification does not publish npm releases or push a repository
|
|
97
|
+
split.
|
|
98
|
+
|
|
99
|
+
See [LICENSE](LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { inspectIssueTree } from "./validator.js";
|
|
2
|
-
export type {
|
|
1
|
+
export { inspectIssueTree, isTerminalIssueStatus } from "./validator.js";
|
|
2
|
+
export type { IssueFrontmatter } from "./validator.js";
|
|
3
|
+
export { issueStatusSchema, issueDiagnosticSchema, issueSummarySchema, issueIndexRecordSchema, issueTrackerReportSchema, issueIndexSnapshotSchema, } from "./report.js";
|
|
4
|
+
export type { IssueStatus, IssueDiagnostic, IssueSummary, IssueIndexRecord, IssueTrackerReport, IssueIndexSnapshot, } from "./report.js";
|
|
5
|
+
export { issueIndexStateSchema, type IssueIndexState } from "./report.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { inspectIssueTree } from "./validator.js";
|
|
1
|
+
export { inspectIssueTree, isTerminalIssueStatus } from "./validator.js";
|
|
2
|
+
export { issueStatusSchema, issueDiagnosticSchema, issueSummarySchema, issueIndexRecordSchema, issueTrackerReportSchema, issueIndexSnapshotSchema, } from "./report.js";
|
|
3
|
+
export { issueIndexStateSchema } from "./report.js";
|
package/dist/report.d.ts
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/** Canonical issue states, shared by validation and serialized projections. */
|
|
3
|
+
export declare const issueStatusSchema: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
4
|
+
/** Canonical triage state of an issue. */
|
|
5
|
+
export type IssueStatus = typeof issueStatusSchema.Type;
|
|
6
|
+
/** A path, content or dependency violation in the complete input tree. */
|
|
7
|
+
export declare const issueDiagnosticSchema: Schema.Struct<{
|
|
8
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
9
|
+
readonly path: Schema.String;
|
|
10
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
11
|
+
readonly code: Schema.Literals<readonly ["invalid-ticket-path", "invalid-frontmatter", "id-path-mismatch", "duplicate-id", "title-mismatch", "missing-section", "unknown-blocker", "self-blocker", "blocker-cycle"]>;
|
|
12
|
+
/** Human-readable explanation of the failed rule. */
|
|
13
|
+
readonly detail: Schema.String;
|
|
14
|
+
}>;
|
|
15
|
+
/** A typed violation found in the complete issue tree. */
|
|
16
|
+
export type IssueDiagnostic = typeof issueDiagnosticSchema.Type;
|
|
17
|
+
/** Ticket identity and dependency state used by the ready frontier. */
|
|
18
|
+
export declare const issueSummarySchema: Schema.Struct<{
|
|
19
|
+
/** Stable ticket identifier from its parsed frontmatter. */
|
|
20
|
+
readonly id: Schema.String;
|
|
21
|
+
/** Issue file path relative to the issues directory. */
|
|
22
|
+
readonly path: Schema.String;
|
|
23
|
+
/** Canonical triage state of the ticket. */
|
|
24
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
25
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
26
|
+
readonly blocked: Schema.Boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/** Ticket identity and state used to evaluate dependency readiness. */
|
|
29
|
+
export type IssueSummary = typeof issueSummarySchema.Type;
|
|
30
|
+
/** Validated metadata, without raw issue text or Git objects. */
|
|
31
|
+
export declare const issueIndexRecordSchema: Schema.Struct<{
|
|
32
|
+
/** Stable ticket identifier from its frontmatter. */
|
|
33
|
+
readonly id: Schema.String;
|
|
34
|
+
/** Human-readable issue title. */
|
|
35
|
+
readonly title: Schema.String;
|
|
36
|
+
/** Canonical triage state of the ticket. */
|
|
37
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
38
|
+
/** Priority used to order the issue frontier. */
|
|
39
|
+
readonly priority: Schema.Literals<readonly ["p0", "p1", "p2", "p3"]>;
|
|
40
|
+
/** Declared assignee, or null when unassigned. */
|
|
41
|
+
readonly assignee: Schema.NullOr<Schema.String>;
|
|
42
|
+
/** Declared product areas associated with the issue. */
|
|
43
|
+
readonly areas: Schema.$Array<Schema.String>;
|
|
44
|
+
/** Stable identifiers of prerequisite tickets. */
|
|
45
|
+
readonly blocked_by: Schema.$Array<Schema.String>;
|
|
46
|
+
/** Final slice wires all of this effort's user surfaces. */
|
|
47
|
+
readonly reachable: Schema.optionalKey<Schema.Boolean>;
|
|
48
|
+
/** Issue file path relative to the issues directory. */
|
|
49
|
+
readonly path: Schema.String;
|
|
50
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
51
|
+
readonly blocked: Schema.Boolean;
|
|
52
|
+
}>;
|
|
53
|
+
/** Validated issue metadata retained in the Team index. */
|
|
54
|
+
export type IssueIndexRecord = typeof issueIndexRecordSchema.Type;
|
|
55
|
+
/** The validator's serialized result for one complete tree. */
|
|
56
|
+
export declare const issueTrackerReportSchema: Schema.Struct<{
|
|
57
|
+
/** Version of the serialized report representation. */
|
|
58
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
59
|
+
/** Pass only when the complete tree has no diagnostics. */
|
|
60
|
+
readonly status: Schema.Literals<readonly ["pass", "fail"]>;
|
|
61
|
+
/** Parsed graph summaries, retained even when validation fails. */
|
|
62
|
+
readonly issues: Schema.$Array<Schema.Struct<{
|
|
63
|
+
/** Stable ticket identifier from its parsed frontmatter. */
|
|
64
|
+
readonly id: Schema.String;
|
|
65
|
+
/** Issue file path relative to the issues directory. */
|
|
66
|
+
readonly path: Schema.String;
|
|
67
|
+
/** Canonical triage state of the ticket. */
|
|
68
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
69
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
70
|
+
readonly blocked: Schema.Boolean;
|
|
71
|
+
}>>;
|
|
72
|
+
/** Validated index records; empty when any diagnostic exists. */
|
|
73
|
+
readonly records: Schema.$Array<Schema.Struct<{
|
|
74
|
+
/** Stable ticket identifier from its frontmatter. */
|
|
75
|
+
readonly id: Schema.String;
|
|
76
|
+
/** Human-readable issue title. */
|
|
77
|
+
readonly title: Schema.String;
|
|
78
|
+
/** Canonical triage state of the ticket. */
|
|
79
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
80
|
+
/** Priority used to order the issue frontier. */
|
|
81
|
+
readonly priority: Schema.Literals<readonly ["p0", "p1", "p2", "p3"]>;
|
|
82
|
+
/** Declared assignee, or null when unassigned. */
|
|
83
|
+
readonly assignee: Schema.NullOr<Schema.String>;
|
|
84
|
+
/** Declared product areas associated with the issue. */
|
|
85
|
+
readonly areas: Schema.$Array<Schema.String>;
|
|
86
|
+
/** Stable identifiers of prerequisite tickets. */
|
|
87
|
+
readonly blocked_by: Schema.$Array<Schema.String>;
|
|
88
|
+
/** Final slice wires all of this effort's user surfaces. */
|
|
89
|
+
readonly reachable: Schema.optionalKey<Schema.Boolean>;
|
|
90
|
+
/** Issue file path relative to the issues directory. */
|
|
91
|
+
readonly path: Schema.String;
|
|
92
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
93
|
+
readonly blocked: Schema.Boolean;
|
|
94
|
+
}>>;
|
|
95
|
+
/** Unassigned ready ticket IDs whose declared blockers are settled. */
|
|
96
|
+
readonly frontier: Schema.$Array<Schema.String>;
|
|
97
|
+
/** Rule violations sorted by input path and diagnostic code. */
|
|
98
|
+
readonly diagnostics: Schema.$Array<Schema.Struct<{
|
|
99
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
100
|
+
readonly path: Schema.String;
|
|
101
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
102
|
+
readonly code: Schema.Literals<readonly ["invalid-ticket-path", "invalid-frontmatter", "id-path-mismatch", "duplicate-id", "title-mismatch", "missing-section", "unknown-blocker", "self-blocker", "blocker-cycle"]>;
|
|
103
|
+
/** Human-readable explanation of the failed rule. */
|
|
104
|
+
readonly detail: Schema.String;
|
|
105
|
+
}>>;
|
|
106
|
+
}>;
|
|
107
|
+
/** Complete-tree validation result with metadata and diagnostics. */
|
|
108
|
+
export type IssueTrackerReport = typeof issueTrackerReportSchema.Type;
|
|
109
|
+
/** A successful issue-tree projection at an immutable commit. */
|
|
110
|
+
export declare const issueIndexSnapshotSchema: Schema.Struct<{
|
|
111
|
+
/** Team tracker repository identity. */
|
|
112
|
+
readonly repository: Schema.String;
|
|
113
|
+
/** Immutable Git commit represented by this projection. */
|
|
114
|
+
readonly commit: Schema.String;
|
|
115
|
+
/** Successful complete-tree validation report. */
|
|
116
|
+
readonly report: Schema.Struct<{
|
|
117
|
+
/** Version of the serialized report representation. */
|
|
118
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
119
|
+
/** Pass only when the complete tree has no diagnostics. */
|
|
120
|
+
readonly status: Schema.Literals<readonly ["pass", "fail"]>;
|
|
121
|
+
/** Parsed graph summaries, retained even when validation fails. */
|
|
122
|
+
readonly issues: Schema.$Array<Schema.Struct<{
|
|
123
|
+
/** Stable ticket identifier from its parsed frontmatter. */
|
|
124
|
+
readonly id: Schema.String;
|
|
125
|
+
/** Issue file path relative to the issues directory. */
|
|
126
|
+
readonly path: Schema.String;
|
|
127
|
+
/** Canonical triage state of the ticket. */
|
|
128
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
129
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
130
|
+
readonly blocked: Schema.Boolean;
|
|
131
|
+
}>>;
|
|
132
|
+
/** Validated index records; empty when any diagnostic exists. */
|
|
133
|
+
readonly records: Schema.$Array<Schema.Struct<{
|
|
134
|
+
/** Stable ticket identifier from its frontmatter. */
|
|
135
|
+
readonly id: Schema.String;
|
|
136
|
+
/** Human-readable issue title. */
|
|
137
|
+
readonly title: Schema.String;
|
|
138
|
+
/** Canonical triage state of the ticket. */
|
|
139
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
140
|
+
/** Priority used to order the issue frontier. */
|
|
141
|
+
readonly priority: Schema.Literals<readonly ["p0", "p1", "p2", "p3"]>;
|
|
142
|
+
/** Declared assignee, or null when unassigned. */
|
|
143
|
+
readonly assignee: Schema.NullOr<Schema.String>;
|
|
144
|
+
/** Declared product areas associated with the issue. */
|
|
145
|
+
readonly areas: Schema.$Array<Schema.String>;
|
|
146
|
+
/** Stable identifiers of prerequisite tickets. */
|
|
147
|
+
readonly blocked_by: Schema.$Array<Schema.String>;
|
|
148
|
+
/** Final slice wires all of this effort's user surfaces. */
|
|
149
|
+
readonly reachable: Schema.optionalKey<Schema.Boolean>;
|
|
150
|
+
/** Issue file path relative to the issues directory. */
|
|
151
|
+
readonly path: Schema.String;
|
|
152
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
153
|
+
readonly blocked: Schema.Boolean;
|
|
154
|
+
}>>;
|
|
155
|
+
/** Unassigned ready ticket IDs whose declared blockers are settled. */
|
|
156
|
+
readonly frontier: Schema.$Array<Schema.String>;
|
|
157
|
+
/** Rule violations sorted by input path and diagnostic code. */
|
|
158
|
+
readonly diagnostics: Schema.$Array<Schema.Struct<{
|
|
159
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
160
|
+
readonly path: Schema.String;
|
|
161
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
162
|
+
readonly code: Schema.Literals<readonly ["invalid-ticket-path", "invalid-frontmatter", "id-path-mismatch", "duplicate-id", "title-mismatch", "missing-section", "unknown-blocker", "self-blocker", "blocker-cycle"]>;
|
|
163
|
+
/** Human-readable explanation of the failed rule. */
|
|
164
|
+
readonly detail: Schema.String;
|
|
165
|
+
}>>;
|
|
166
|
+
}>;
|
|
167
|
+
/** Projection completion time in milliseconds since the Unix epoch. */
|
|
168
|
+
readonly indexedAt: Schema.Number;
|
|
169
|
+
}>;
|
|
170
|
+
/** Successful metadata projection at one immutable Git commit. */
|
|
171
|
+
export type IssueIndexSnapshot = typeof issueIndexSnapshotSchema.Type;
|
|
172
|
+
/** Latest accepted work and its diagnostics are distinct from the last successful snapshot. */
|
|
173
|
+
export declare const issueIndexStateSchema: Schema.Struct<{
|
|
174
|
+
/** Last successfully validated metadata projection, if available. */
|
|
175
|
+
readonly snapshot: Schema.NullOr<Schema.Struct<{
|
|
176
|
+
/** Team tracker repository identity. */
|
|
177
|
+
readonly repository: Schema.String;
|
|
178
|
+
/** Immutable Git commit represented by this projection. */
|
|
179
|
+
readonly commit: Schema.String;
|
|
180
|
+
/** Successful complete-tree validation report. */
|
|
181
|
+
readonly report: Schema.Struct<{
|
|
182
|
+
/** Version of the serialized report representation. */
|
|
183
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
184
|
+
/** Pass only when the complete tree has no diagnostics. */
|
|
185
|
+
readonly status: Schema.Literals<readonly ["pass", "fail"]>;
|
|
186
|
+
/** Parsed graph summaries, retained even when validation fails. */
|
|
187
|
+
readonly issues: Schema.$Array<Schema.Struct<{
|
|
188
|
+
/** Stable ticket identifier from its parsed frontmatter. */
|
|
189
|
+
readonly id: Schema.String;
|
|
190
|
+
/** Issue file path relative to the issues directory. */
|
|
191
|
+
readonly path: Schema.String;
|
|
192
|
+
/** Canonical triage state of the ticket. */
|
|
193
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
194
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
195
|
+
readonly blocked: Schema.Boolean;
|
|
196
|
+
}>>;
|
|
197
|
+
/** Validated index records; empty when any diagnostic exists. */
|
|
198
|
+
readonly records: Schema.$Array<Schema.Struct<{
|
|
199
|
+
/** Stable ticket identifier from its frontmatter. */
|
|
200
|
+
readonly id: Schema.String;
|
|
201
|
+
/** Human-readable issue title. */
|
|
202
|
+
readonly title: Schema.String;
|
|
203
|
+
/** Canonical triage state of the ticket. */
|
|
204
|
+
readonly status: Schema.Literals<readonly ["needs-triage", "needs-info", "ready-for-agent", "ready-for-human", "in-progress", "resolved", "wontfix"]>;
|
|
205
|
+
/** Priority used to order the issue frontier. */
|
|
206
|
+
readonly priority: Schema.Literals<readonly ["p0", "p1", "p2", "p3"]>;
|
|
207
|
+
/** Declared assignee, or null when unassigned. */
|
|
208
|
+
readonly assignee: Schema.NullOr<Schema.String>;
|
|
209
|
+
/** Declared product areas associated with the issue. */
|
|
210
|
+
readonly areas: Schema.$Array<Schema.String>;
|
|
211
|
+
/** Stable identifiers of prerequisite tickets. */
|
|
212
|
+
readonly blocked_by: Schema.$Array<Schema.String>;
|
|
213
|
+
/** Final slice wires all of this effort's user surfaces. */
|
|
214
|
+
readonly reachable: Schema.optionalKey<Schema.Boolean>;
|
|
215
|
+
/** Issue file path relative to the issues directory. */
|
|
216
|
+
readonly path: Schema.String;
|
|
217
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
218
|
+
readonly blocked: Schema.Boolean;
|
|
219
|
+
}>>;
|
|
220
|
+
/** Unassigned ready ticket IDs whose declared blockers are settled. */
|
|
221
|
+
readonly frontier: Schema.$Array<Schema.String>;
|
|
222
|
+
/** Rule violations sorted by input path and diagnostic code. */
|
|
223
|
+
readonly diagnostics: Schema.$Array<Schema.Struct<{
|
|
224
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
225
|
+
readonly path: Schema.String;
|
|
226
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
227
|
+
readonly code: Schema.Literals<readonly ["invalid-ticket-path", "invalid-frontmatter", "id-path-mismatch", "duplicate-id", "title-mismatch", "missing-section", "unknown-blocker", "self-blocker", "blocker-cycle"]>;
|
|
228
|
+
/** Human-readable explanation of the failed rule. */
|
|
229
|
+
readonly detail: Schema.String;
|
|
230
|
+
}>>;
|
|
231
|
+
}>;
|
|
232
|
+
/** Projection completion time in milliseconds since the Unix epoch. */
|
|
233
|
+
readonly indexedAt: Schema.Number;
|
|
234
|
+
}>>;
|
|
235
|
+
/** Latest accepted job and diagnostics, separate from the last successful projection. */
|
|
236
|
+
readonly validation: Schema.NullOr<Schema.Struct<{
|
|
237
|
+
/** Team tracker repository identity. */
|
|
238
|
+
readonly repository: Schema.String;
|
|
239
|
+
/** Immutable Git commit accepted for validation. */
|
|
240
|
+
readonly commit: Schema.String;
|
|
241
|
+
/** Durable state of the latest accepted validation job. */
|
|
242
|
+
readonly state: Schema.Literals<readonly ["queued", "running", "failed", "succeeded", "superseded"]>;
|
|
243
|
+
/** Number of validation attempts claimed for this job. */
|
|
244
|
+
readonly attempts: Schema.Number;
|
|
245
|
+
/** Closed transport or lease failure, when the job could not finish. */
|
|
246
|
+
readonly failure: Schema.NullOr<Schema.Literals<readonly ["publisher-unavailable", "lease-expired"]>>;
|
|
247
|
+
/** Content violations from validation of this exact commit. */
|
|
248
|
+
readonly diagnostics: Schema.$Array<Schema.Struct<{
|
|
249
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
250
|
+
readonly path: Schema.String;
|
|
251
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
252
|
+
readonly code: Schema.Literals<readonly ["invalid-ticket-path", "invalid-frontmatter", "id-path-mismatch", "duplicate-id", "title-mismatch", "missing-section", "unknown-blocker", "self-blocker", "blocker-cycle"]>;
|
|
253
|
+
/** Human-readable explanation of the failed rule. */
|
|
254
|
+
readonly detail: Schema.String;
|
|
255
|
+
}>>;
|
|
256
|
+
}>>;
|
|
257
|
+
}>;
|
|
258
|
+
/** Current accepted validation state and the last successful index. */
|
|
259
|
+
export type IssueIndexState = typeof issueIndexStateSchema.Type;
|
package/dist/report.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/** Canonical issue states, shared by validation and serialized projections. */
|
|
3
|
+
export const issueStatusSchema = Schema.Literals([
|
|
4
|
+
"needs-triage",
|
|
5
|
+
"needs-info",
|
|
6
|
+
"ready-for-agent",
|
|
7
|
+
"ready-for-human",
|
|
8
|
+
"in-progress",
|
|
9
|
+
"resolved",
|
|
10
|
+
"wontfix",
|
|
11
|
+
]);
|
|
12
|
+
/** A path, content or dependency violation in the complete input tree. */
|
|
13
|
+
export const issueDiagnosticSchema = Schema.Struct({
|
|
14
|
+
/** Input file key identifying the ticket that needs correction. */
|
|
15
|
+
path: Schema.String,
|
|
16
|
+
/** Machine-readable rule violated by the ticket or dependency graph. */
|
|
17
|
+
code: Schema.Literals([
|
|
18
|
+
"invalid-ticket-path",
|
|
19
|
+
"invalid-frontmatter",
|
|
20
|
+
"id-path-mismatch",
|
|
21
|
+
"duplicate-id",
|
|
22
|
+
"title-mismatch",
|
|
23
|
+
"missing-section",
|
|
24
|
+
"unknown-blocker",
|
|
25
|
+
"self-blocker",
|
|
26
|
+
"blocker-cycle",
|
|
27
|
+
]),
|
|
28
|
+
/** Human-readable explanation of the failed rule. */
|
|
29
|
+
detail: Schema.String,
|
|
30
|
+
});
|
|
31
|
+
/** Ticket identity and dependency state used by the ready frontier. */
|
|
32
|
+
export const issueSummarySchema = Schema.Struct({
|
|
33
|
+
/** Stable ticket identifier from its parsed frontmatter. */
|
|
34
|
+
id: Schema.String,
|
|
35
|
+
/** Issue file path relative to the issues directory. */
|
|
36
|
+
path: Schema.String,
|
|
37
|
+
/** Canonical triage state of the ticket. */
|
|
38
|
+
status: issueStatusSchema,
|
|
39
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
40
|
+
blocked: Schema.Boolean,
|
|
41
|
+
});
|
|
42
|
+
/** Validated metadata, without raw issue text or Git objects. */
|
|
43
|
+
export const issueIndexRecordSchema = Schema.Struct({
|
|
44
|
+
/** Stable ticket identifier from its frontmatter. */
|
|
45
|
+
id: Schema.String,
|
|
46
|
+
/** Human-readable issue title. */
|
|
47
|
+
title: Schema.String,
|
|
48
|
+
/** Canonical triage state of the ticket. */
|
|
49
|
+
status: issueStatusSchema,
|
|
50
|
+
/** Priority used to order the issue frontier. */
|
|
51
|
+
priority: Schema.Literals(["p0", "p1", "p2", "p3"]),
|
|
52
|
+
/** Declared assignee, or null when unassigned. */
|
|
53
|
+
assignee: Schema.NullOr(Schema.String),
|
|
54
|
+
/** Declared product areas associated with the issue. */
|
|
55
|
+
areas: Schema.Array(Schema.String),
|
|
56
|
+
/** Stable identifiers of prerequisite tickets. */
|
|
57
|
+
blocked_by: Schema.Array(Schema.String),
|
|
58
|
+
/** Final slice wires all of this effort's user surfaces. */
|
|
59
|
+
reachable: Schema.optionalKey(Schema.Boolean),
|
|
60
|
+
/** Issue file path relative to the issues directory. */
|
|
61
|
+
path: Schema.String,
|
|
62
|
+
/** Whether a declared blocker is absent or not resolved/wontfix. */
|
|
63
|
+
blocked: Schema.Boolean,
|
|
64
|
+
});
|
|
65
|
+
/** The validator's serialized result for one complete tree. */
|
|
66
|
+
export const issueTrackerReportSchema = Schema.Struct({
|
|
67
|
+
/** Version of the serialized report representation. */
|
|
68
|
+
schemaVersion: Schema.Literal(1),
|
|
69
|
+
/** Pass only when the complete tree has no diagnostics. */
|
|
70
|
+
status: Schema.Literals(["pass", "fail"]),
|
|
71
|
+
/** Parsed graph summaries, retained even when validation fails. */
|
|
72
|
+
issues: Schema.Array(issueSummarySchema),
|
|
73
|
+
/** Validated index records; empty when any diagnostic exists. */
|
|
74
|
+
records: Schema.Array(issueIndexRecordSchema),
|
|
75
|
+
/** Unassigned ready ticket IDs whose declared blockers are settled. */
|
|
76
|
+
frontier: Schema.Array(Schema.String),
|
|
77
|
+
/** Rule violations sorted by input path and diagnostic code. */
|
|
78
|
+
diagnostics: Schema.Array(issueDiagnosticSchema),
|
|
79
|
+
});
|
|
80
|
+
/** A successful issue-tree projection at an immutable commit. */
|
|
81
|
+
export const issueIndexSnapshotSchema = Schema.Struct({
|
|
82
|
+
/** Team tracker repository identity. */
|
|
83
|
+
repository: Schema.String.check(Schema.isMinLength(1)),
|
|
84
|
+
/** Immutable Git commit represented by this projection. */
|
|
85
|
+
commit: Schema.String.check(Schema.isPattern(/^[0-9a-f]{40}$/u)),
|
|
86
|
+
/** Successful complete-tree validation report. */
|
|
87
|
+
report: issueTrackerReportSchema,
|
|
88
|
+
/** Projection completion time in milliseconds since the Unix epoch. */
|
|
89
|
+
indexedAt: Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0)),
|
|
90
|
+
});
|
|
91
|
+
/** Latest accepted work and its diagnostics are distinct from the last successful snapshot. */
|
|
92
|
+
export const issueIndexStateSchema = Schema.Struct({
|
|
93
|
+
/** Last successfully validated metadata projection, if available. */
|
|
94
|
+
snapshot: Schema.NullOr(issueIndexSnapshotSchema),
|
|
95
|
+
/** Latest accepted job and diagnostics, separate from the last successful projection. */
|
|
96
|
+
validation: Schema.NullOr(Schema.Struct({
|
|
97
|
+
/** Team tracker repository identity. */
|
|
98
|
+
repository: issueIndexSnapshotSchema.fields.repository,
|
|
99
|
+
/** Immutable Git commit accepted for validation. */
|
|
100
|
+
commit: issueIndexSnapshotSchema.fields.commit,
|
|
101
|
+
/** Durable state of the latest accepted validation job. */
|
|
102
|
+
state: Schema.Literals([
|
|
103
|
+
"queued",
|
|
104
|
+
"running",
|
|
105
|
+
"failed",
|
|
106
|
+
"succeeded",
|
|
107
|
+
"superseded",
|
|
108
|
+
]),
|
|
109
|
+
/** Number of validation attempts claimed for this job. */
|
|
110
|
+
attempts: Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0)),
|
|
111
|
+
/** Closed transport or lease failure, when the job could not finish. */
|
|
112
|
+
failure: Schema.NullOr(Schema.Literals(["publisher-unavailable", "lease-expired"])),
|
|
113
|
+
/** Content violations from validation of this exact commit. */
|
|
114
|
+
diagnostics: Schema.Array(issueDiagnosticSchema),
|
|
115
|
+
})),
|
|
116
|
+
});
|
package/dist/validator.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { IssueStatus, IssueTrackerReport } from "./report.js";
|
|
2
|
+
/** Whether an issue is settled and no longer blocks dependent work. */
|
|
3
|
+
export declare function isTerminalIssueStatus(status: IssueStatus): boolean;
|
|
3
4
|
/** Ticket metadata accepted by the local issue frontmatter schema. */
|
|
4
5
|
export type IssueFrontmatter = {
|
|
5
6
|
/** Final slice wires all of this effort's user surfaces. */
|
|
@@ -23,47 +24,5 @@ export type IssueFrontmatter = {
|
|
|
23
24
|
/** Stable ticket IDs that must be resolved or wontfix to settle blockers. */
|
|
24
25
|
readonly blocked_by: readonly string[];
|
|
25
26
|
};
|
|
26
|
-
/** A path, content or dependency rule violation in the supplied issue tree. */
|
|
27
|
-
export type IssueDiagnostic = {
|
|
28
|
-
/** Input file key identifying the ticket that needs correction. */
|
|
29
|
-
readonly path: string;
|
|
30
|
-
/** Machine-readable rule violated by the ticket or its dependency graph. */
|
|
31
|
-
readonly code: "invalid-ticket-path" | "invalid-frontmatter" | "id-path-mismatch" | "duplicate-id" | "title-mismatch" | "missing-section" | "unknown-blocker" | "self-blocker" | "blocker-cycle";
|
|
32
|
-
/** Human-readable explanation of the failed rule. */
|
|
33
|
-
readonly detail: string;
|
|
34
|
-
};
|
|
35
|
-
/** Ticket identity and dependency state used to assemble the ready frontier. */
|
|
36
|
-
export type IssueSummary = {
|
|
37
|
-
/** Stable ticket identifier from its parsed frontmatter. */
|
|
38
|
-
readonly id: string;
|
|
39
|
-
/** Ticket path relative to the supplied issue tree. */
|
|
40
|
-
readonly path: string;
|
|
41
|
-
/** Current triage state, without a synthetic blocked state. */
|
|
42
|
-
readonly status: IssueStatus;
|
|
43
|
-
/** Whether a declared blocker is absent or outside resolved and wontfix. */
|
|
44
|
-
readonly blocked: boolean;
|
|
45
|
-
};
|
|
46
|
-
/** The validated frontmatter fields Grove reads from the Team issue index. */
|
|
47
|
-
export type IssueIndexRecord = Readonly<Pick<IssueFrontmatter, "id" | "title" | "status" | "priority" | "assignee" | "areas" | "blocked_by" | "reachable"> & {
|
|
48
|
-
/** Ticket path relative to the supplied issue tree. */
|
|
49
|
-
path: string;
|
|
50
|
-
/** Whether any declared blocker remains unsettled. */
|
|
51
|
-
blocked: boolean;
|
|
52
|
-
}>;
|
|
53
|
-
/** Validation result and index projections for one complete issue tree. */
|
|
54
|
-
export type IssueTrackerReport = {
|
|
55
|
-
/** Version of this report representation, currently 1. */
|
|
56
|
-
readonly schemaVersion: 1;
|
|
57
|
-
/** Pass only when the complete tree has no diagnostics. */
|
|
58
|
-
readonly status: "pass" | "fail";
|
|
59
|
-
/** Parsed graph summaries, retained even when validation fails. */
|
|
60
|
-
readonly issues: readonly IssueSummary[];
|
|
61
|
-
/** Validated index records; empty if any diagnostic exists. */
|
|
62
|
-
readonly records: readonly IssueIndexRecord[];
|
|
63
|
-
/** Unassigned ready ticket IDs with all declared blockers settled. */
|
|
64
|
-
readonly frontier: readonly string[];
|
|
65
|
-
/** Rule violations sorted by input path and diagnostic code. */
|
|
66
|
-
readonly diagnostics: readonly IssueDiagnostic[];
|
|
67
|
-
};
|
|
68
27
|
/** Validate one pushed `issues/` tree as a schema and dependency graph. */
|
|
69
28
|
export declare function inspectIssueTree(files: Readonly<Record<string, string>>): IssueTrackerReport;
|
package/dist/validator.js
CHANGED
|
@@ -7,6 +7,10 @@ import { matter } from "vfile-matter";
|
|
|
7
7
|
import issueFrontmatterSchema from "./issue-schema.js";
|
|
8
8
|
const ISSUE_PATH = /^(?<effort>[a-z0-9]+(?:-[a-z0-9]+)*)\/(?<number>[0-9]{2}[a-z]?)-[a-z0-9]+(?:-[a-z0-9]+)*\.md$/u;
|
|
9
9
|
const TERMINAL_STATUSES = new Set(["resolved", "wontfix"]);
|
|
10
|
+
/** Whether an issue is settled and no longer blocks dependent work. */
|
|
11
|
+
export function isTerminalIssueStatus(status) {
|
|
12
|
+
return TERMINAL_STATUSES.has(status);
|
|
13
|
+
}
|
|
10
14
|
const FRONTIER_STATUSES = new Set([
|
|
11
15
|
"ready-for-agent",
|
|
12
16
|
"ready-for-human",
|
|
@@ -63,7 +67,7 @@ function requiredSections(frontmatter) {
|
|
|
63
67
|
sections.splice(1, 0, "Reproduction");
|
|
64
68
|
if (frontmatter.type === "research" || frontmatter.type === "decision")
|
|
65
69
|
sections.splice(1, 0, "Answer");
|
|
66
|
-
if (
|
|
70
|
+
if (isTerminalIssueStatus(frontmatter.status))
|
|
67
71
|
sections.push("Resolution");
|
|
68
72
|
return sections;
|
|
69
73
|
}
|
|
@@ -230,7 +234,7 @@ function issueSummaries(records) {
|
|
|
230
234
|
blocked: record.frontmatter.blocked_by.some((blocker) => {
|
|
231
235
|
const blockingRecord = records.get(blocker);
|
|
232
236
|
return (blockingRecord === undefined ||
|
|
233
|
-
!
|
|
237
|
+
!isTerminalIssueStatus(blockingRecord.frontmatter.status));
|
|
234
238
|
}),
|
|
235
239
|
}));
|
|
236
240
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/issues",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Pure validation and metadata projection for a complete issue tree",
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./report": {
|
|
17
|
+
"types": "./dist/report.d.ts",
|
|
18
|
+
"import": "./dist/report.js"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"files": [
|