@fungi.computer/issues 0.1.0 → 0.3.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 CHANGED
@@ -1,53 +1,76 @@
1
- # Issues
1
+ # Issues (`@fungi.computer/issues`)
2
2
 
3
- `inspectIssueTree(files)` validates a complete `issues/` tree supplied as a
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.
3
+ Issues checks a folder of Markdown tickets in your repository and tells you
4
+ which ones are unblocked.
9
5
 
10
- The single frontmatter contract lives in `src/issue-schema.ts`. VFile Matter
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.
6
+ ```mermaid
7
+ flowchart LR
8
+ Folder[issues/ folder of Markdown] --> Issues[Issues package]
9
+ Issues -->|records| Tickets[Parsed tickets]
10
+ Issues -->|diagnostics| Problems[Broken links and states]
11
+ Tickets --> Ready[Unblocked tickets]
12
+ ```
13
+
14
+ ## Quick start
15
+
16
+ Install it:
17
17
 
18
- This recovers the validator and projection from
19
- `c83b1098c06c90e6ab9a74c0f11bcefab6b15ae4` with current parser and Effect
20
- dependencies. Queued immutable-commit reads, last-good persistence and Grove
21
- indexing remain separate tracker work.
18
+ ```sh
19
+ npm install @fungi.computer/issues
20
+ ```
22
21
 
23
- ```js
22
+ ```ts
24
23
  import { inspectIssueTree } from "@fungi.computer/issues";
25
24
 
26
25
  const { records, diagnostics } = inspectIssueTree({});
27
- // An empty tree has no records or diagnostics.
26
+ console.log({ records, diagnostics });
28
27
  ```
29
28
 
30
- ## Packed consumer readiness
29
+ ## Common tasks
31
30
 
32
- Run `pnpm run build`, `pnpm run pack` and `pnpm run stranger` in this package.
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.
31
+ ### Inspect a tree
38
32
 
39
- See [LICENSE](LICENSE) for the license and the package manifest for its public
40
- repository destination.
33
+ `inspectIssueTree` returns the records and any diagnostics. See
34
+ [Inspect a tree](#inspect-a-tree).
41
35
 
42
- ## Quick start
36
+ ### Find what is ready to work on
43
37
 
44
- ```ts
45
- import { inspectIssueTree } from "@fungi.computer/issues";
38
+ See [Core concepts](#core-concepts).
46
39
 
47
- const { records, diagnostics } = inspectIssueTree({});
48
- console.log({ records, diagnostics });
40
+ ### Run the checks
41
+
42
+ See Examples and checks.
43
+
44
+ ## Reference
45
+
46
+ ### Overview
47
+
48
+ Issues validates a Markdown issue tracker kept in a repository's `issues/`
49
+ folder and works out which tickets are unblocked.
50
+
51
+ ## Install
52
+
53
+ ```sh
54
+ npm install @fungi.computer/issues
49
55
  ```
50
56
 
57
+ ## Inspect a tree
58
+
59
+ `inspectIssueTree(files)` validates a complete `issues/` tree supplied as a
60
+ record of relative paths and Markdown text. It returns typed diagnostics,
61
+ summaries, the unblocked frontier, and metadata-only records. Any invalid ticket
62
+ makes `records` empty; callers can retain their previous valid projection.
63
+ Filesystem discovery, Git access, commit identity and persistence belong to the
64
+ caller. Repository tooling supplies the local filesystem adapter.
65
+
66
+ The single frontmatter contract lives in `src/issue-schema.ts`. VFile Matter
67
+ owns YAML extraction, Effect validates JSON values, @cfworker/json-schema
68
+ applies the contract (no code generation, so it runs in Workers and under a
69
+ strict CSP), and remark parses Markdown headings. Heading comparisons retain
70
+ literal inline Markdown; fenced code does not supply required sections. The
71
+ blocker walk is iterative, so dependency depth does not consume the JavaScript
72
+ call stack.
73
+
51
74
  ## Core concepts
52
75
 
53
76
  The caller supplies a complete tree snapshot. Invalid tickets produce
@@ -59,11 +82,17 @@ with the caller.
59
82
  The packed runtime fixture at `test/stranger/runtime.mjs` exercises the public
60
83
  API in a fresh consumer. Run `pnpm run stranger` after building the package.
61
84
 
62
- ## Install
63
-
64
- Install the package tarball with npm. The manifest pins its runtime
65
- dependencies.
66
-
67
85
  ## Contribute and license
68
86
 
69
87
  See [LICENSE](LICENSE) for the MIT terms.
88
+
89
+ ## Packed consumer readiness
90
+
91
+ Run `pnpm run build`, `pnpm run pack` and `pnpm run stranger` in this package.
92
+ The maintained stranger proof installs only package tarballs into a fresh npm
93
+ consumer, checks the exact shipped files, runs the public runtime fixture and
94
+ compiles every JavaScript entrypoint with strict NodeNext and no library-check
95
+ skip. This qualification does not publish npm releases or push a repository
96
+ split.
97
+
98
+ See [LICENSE](LICENSE).
package/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
1
  export { inspectIssueTree } from "./validator.js";
2
- export type { IssueDiagnostic, IssueFrontmatter, IssueIndexRecord, IssueStatus, IssueSummary, IssueTrackerReport, } 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
1
  export { inspectIssueTree } from "./validator.js";
2
+ export { issueStatusSchema, issueDiagnosticSchema, issueSummarySchema, issueIndexRecordSchema, issueTrackerReportSchema, issueIndexSnapshotSchema, } from "./report.js";
3
+ export { issueIndexStateSchema } from "./report.js";
@@ -6,6 +6,9 @@ declare const issueFrontmatterSchema: {
6
6
  additionalProperties: false;
7
7
  required: string[];
8
8
  properties: {
9
+ reachable: {
10
+ type: "boolean";
11
+ };
9
12
  id: {
10
13
  type: "string";
11
14
  pattern: string;
@@ -16,6 +16,7 @@ const issueFrontmatterSchema = {
16
16
  "blocked_by",
17
17
  ],
18
18
  properties: {
19
+ reachable: { type: "boolean" },
19
20
  id: {
20
21
  type: "string",
21
22
  pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*-[0-9]{2}[a-z]?$",
@@ -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
+ });
@@ -1,7 +1,8 @@
1
- /** Canonical triage state stored in ticket frontmatter. */
2
- export type IssueStatus = "needs-triage" | "needs-info" | "ready-for-agent" | "ready-for-human" | "in-progress" | "resolved" | "wontfix";
1
+ import type { IssueStatus, IssueTrackerReport } from "./report.js";
3
2
  /** Ticket metadata accepted by the local issue frontmatter schema. */
4
3
  export type IssueFrontmatter = {
4
+ /** Final slice wires all of this effort's user surfaces. */
5
+ readonly reachable?: boolean;
5
6
  /** Stable effort-and-number identifier, independent of the ticket slug. */
6
7
  readonly id: string;
7
8
  /** Ticket title, which must match the body's first Markdown heading. */
@@ -21,47 +22,5 @@ export type IssueFrontmatter = {
21
22
  /** Stable ticket IDs that must be resolved or wontfix to settle blockers. */
22
23
  readonly blocked_by: readonly string[];
23
24
  };
24
- /** A path, content or dependency rule violation in the supplied issue tree. */
25
- export type IssueDiagnostic = {
26
- /** Input file key identifying the ticket that needs correction. */
27
- readonly path: string;
28
- /** Machine-readable rule violated by the ticket or its dependency graph. */
29
- readonly code: "invalid-ticket-path" | "invalid-frontmatter" | "id-path-mismatch" | "duplicate-id" | "title-mismatch" | "missing-section" | "unknown-blocker" | "self-blocker" | "blocker-cycle";
30
- /** Human-readable explanation of the failed rule. */
31
- readonly detail: string;
32
- };
33
- /** Ticket identity and dependency state used to assemble the ready frontier. */
34
- export type IssueSummary = {
35
- /** Stable ticket identifier from its parsed frontmatter. */
36
- readonly id: string;
37
- /** Ticket path relative to the supplied issue tree. */
38
- readonly path: string;
39
- /** Current triage state, without a synthetic blocked state. */
40
- readonly status: IssueStatus;
41
- /** Whether a declared blocker is absent or outside resolved and wontfix. */
42
- readonly blocked: boolean;
43
- };
44
- /** The validated frontmatter fields Grove reads from the Team issue index. */
45
- export type IssueIndexRecord = Readonly<Pick<IssueFrontmatter, "id" | "title" | "status" | "priority" | "assignee" | "areas" | "blocked_by"> & {
46
- /** Ticket path relative to the supplied issue tree. */
47
- path: string;
48
- /** Whether any declared blocker remains unsettled. */
49
- blocked: boolean;
50
- }>;
51
- /** Validation result and index projections for one complete issue tree. */
52
- export type IssueTrackerReport = {
53
- /** Version of this report representation, currently 1. */
54
- readonly schemaVersion: 1;
55
- /** Pass only when the complete tree has no diagnostics. */
56
- readonly status: "pass" | "fail";
57
- /** Parsed graph summaries, retained even when validation fails. */
58
- readonly issues: readonly IssueSummary[];
59
- /** Validated index records; empty if any diagnostic exists. */
60
- readonly records: readonly IssueIndexRecord[];
61
- /** Unassigned ready ticket IDs with all declared blockers settled. */
62
- readonly frontier: readonly string[];
63
- /** Rule violations sorted by input path and diagnostic code. */
64
- readonly diagnostics: readonly IssueDiagnostic[];
65
- };
66
25
  /** Validate one pushed `issues/` tree as a schema and dependency graph. */
67
26
  export declare function inspectIssueTree(files: Readonly<Record<string, string>>): IssueTrackerReport;
package/dist/validator.js CHANGED
@@ -259,8 +259,8 @@ export function inspectIssueTree(files) {
259
259
  const summary = issueById.get(record.frontmatter.id);
260
260
  if (summary === undefined)
261
261
  throw new Error("Validated issue record has no summary");
262
- const { id, title, status, priority, assignee, areas, blocked_by } = record.frontmatter;
263
- return {
262
+ const { id, title, status, priority, assignee, areas, blocked_by, reachable, } = record.frontmatter;
263
+ const index = {
264
264
  id,
265
265
  title,
266
266
  status,
@@ -271,6 +271,7 @@ export function inspectIssueTree(files) {
271
271
  path: record.path,
272
272
  blocked: summary.blocked,
273
273
  };
274
+ return reachable === undefined ? index : { ...index, reachable };
274
275
  })
275
276
  : [];
276
277
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/issues",
3
- "version": "0.1.0",
3
+ "version": "0.3.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": [