perttool 0.5.0 → 0.5.2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +66 -28
  3. package/dist/cli.js +41 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/command/actuals-discovery.d.ts.map +1 -1
  6. package/dist/command/actuals-discovery.js +92 -13
  7. package/dist/command/actuals-discovery.js.map +1 -1
  8. package/dist/history/git-probe.d.ts +4 -0
  9. package/dist/history/git-probe.d.ts.map +1 -1
  10. package/dist/history/git-probe.js +23 -14
  11. package/dist/history/git-probe.js.map +1 -1
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/schema/registry.d.ts +53 -0
  17. package/dist/schema/registry.d.ts.map +1 -0
  18. package/dist/schema/registry.js +346 -0
  19. package/dist/schema/registry.js.map +1 -0
  20. package/dist/version.d.ts +1 -1
  21. package/dist/version.js +1 -1
  22. package/package.json +5 -2
  23. package/schemas/Perttool.AgentGuidanceResult.v1.schema.json +607 -0
  24. package/schemas/Perttool.AnalysisResult.v4.schema.json +790 -0
  25. package/schemas/Perttool.CheckResult.v3.schema.json +203 -0
  26. package/schemas/Perttool.CliError.v1.schema.json +119 -0
  27. package/schemas/Perttool.CommandHelpResult.v1.schema.json +377 -0
  28. package/schemas/Perttool.Common.v1.schema.json +1893 -0
  29. package/schemas/Perttool.ExportResult.v1.schema.json +96 -0
  30. package/schemas/Perttool.FormatResult.v1.schema.json +82 -0
  31. package/schemas/Perttool.GuideResult.v1.schema.json +138 -0
  32. package/schemas/Perttool.ImportResult.v1.schema.json +111 -0
  33. package/schemas/Perttool.InitResult.v1.schema.json +70 -0
  34. package/schemas/Perttool.MutationResult.v3.schema.json +194 -0
  35. package/schemas/Perttool.NextResult.v5.schema.json +1264 -0
  36. package/schemas/Perttool.OverrideDecision.v1.schema.json +402 -0
  37. package/schemas/Perttool.ProjectHistoryResult.v1.schema.json +283 -0
  38. package/schemas/Perttool.ProjectResult.v3.schema.json +217 -0
  39. package/schemas/Perttool.SchemaResult.v1.schema.json +137 -0
  40. package/schemas/Perttool.UnitMigrationResult.v3.schema.json +343 -0
  41. package/schemas/Perttool.VelocityObservationResult.v1.schema.json +301 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,42 @@ This project records its notable changes here. The format is based on [Keep a Ch
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.2] - 2026-07-30
8
+
9
+ Compatible CLI Contract 6 and Grammar 5 beta patch. This version completes
10
+ the bundled result schemas and adds selectable full and reference-based
11
+ outline projections without changing existing result identities or runtime
12
+ payload meanings.
13
+
14
+ ### Added
15
+
16
+ - Added full and reference-based outline views to `perttool schema`, including
17
+ separate lookup of one bundled `$ref` detail without changing default
18
+ complete-artifact output.
19
+
20
+ ### Fixed
21
+
22
+ - Replaced underspecified nested JSON Schema object placeholders with complete
23
+ closed record definitions and added nested unknown-field rejection coverage.
24
+
25
+ ## [0.5.1] - 2026-07-30
26
+
27
+ Compatible CLI Contract 6 and Grammar 5 beta patch. This version adds
28
+ machine-readable result artifacts and corrects Git 2.54 UTC commit-time
29
+ handling without changing existing result identities or payload meanings.
30
+
31
+ ### Added
32
+
33
+ - Added bundled Draft 2020-12 artifacts for every active Contract 6 command
34
+ result and public `Perttool.OverrideDecision.v1`, with a closed public
35
+ catalog, `perttool schema`, package-root lookup APIs, and isolated package
36
+ validation.
37
+
38
+ ### Fixed
39
+
40
+ - Accepted the strict ISO `Z` UTC form emitted by Git 2.54 for `%cI` commit
41
+ metadata while retaining fixed-offset validation.
42
+
7
43
  ## [0.5.0] - 2026-07-29
8
44
 
9
45
  Contract 6 beta release. This version atomically publishes Grammar 5,
@@ -216,7 +252,9 @@ First public development preview. Intended to evaluate the DSL and CLI, read-onl
216
252
  - Not published to the npm registry; use the GitHub Release asset
217
253
  - Requires Node.js 24 or later
218
254
 
219
- [Unreleased]: https://github.com/mako10k/perttool/compare/v0.5.0...HEAD
255
+ [Unreleased]: https://github.com/mako10k/perttool/compare/v0.5.2...HEAD
256
+ [0.5.2]: https://github.com/mako10k/perttool/compare/v0.5.1...v0.5.2
257
+ [0.5.1]: https://github.com/mako10k/perttool/compare/v0.5.0...v0.5.1
220
258
  [0.5.0]: https://github.com/mako10k/perttool/compare/v0.4.0...v0.5.0
221
259
  [0.4.0]: https://github.com/mako10k/perttool/compare/v0.3.0...v0.4.0
222
260
  [0.3.0]: https://github.com/mako10k/perttool/compare/v0.2.0...v0.3.0
package/README.md CHANGED
@@ -5,38 +5,40 @@ It validates an Activity-on-Arrow plan, calculates precedence and
5
5
  resource-constrained schedules, recommends the next task, and applies
6
6
  source-preserving changes through preview-first commands.
7
7
 
8
- The prepared `0.5.0` source implements Grammar 5 and CLI Contract 6,
8
+ Version `0.5.2` beta implements Grammar 5 and CLI Contract 6,
9
9
  including explicit task work events, lifecycle commands, read-only Git
10
- history, observed velocity, AnalysisResult v4, and NextResult v5. Publication
11
- remains a gated operation; npm `beta` and `latest` still resolve to Contract 5
12
- `0.4.0` until that operation completes. Beta releases may contain breaking
13
- CLI or schema changes. Version `0.5.0` requires Node.js 22 or later. Contract
14
- 5, Contract 4, and Contract 3 remain available by pinning `0.4.0`, `0.3.0`,
15
- and `0.2.0`, respectively.
10
+ history, observed velocity, AnalysisResult v4, and NextResult v5. It adds
11
+ complete Draft 2020-12 artifacts for every active Contract 6 result and the
12
+ public OverrideDecision result, selectable full and outline schema views,
13
+ and Git 2.54 UTC compatibility. npm `beta` resolves to `0.5.2`; `latest`
14
+ remains on the separately accepted `0.5.1`. Beta releases may contain
15
+ breaking CLI or schema changes. Version `0.5.2` requires Node.js 22 or later.
16
+ The first machine-schema Contract 6 artifact remains available by pinning
17
+ `0.5.1`; Contract 5, Contract 4, and Contract 3 remain available by pinning
18
+ `0.4.0`, `0.3.0`, and `0.2.0`, respectively.
16
19
 
17
20
  ## Run without installing
18
21
 
19
22
  Use `npx` for an occasional invocation and select Contract 6 explicitly:
20
23
 
21
24
  ```sh
22
- npx --yes --package=perttool@0.5.0 -- perttool --version
23
- npx --yes --package=perttool@0.5.0 -- perttool document check PLAN.pert
24
- npx --yes --package=perttool@0.5.0 -- perttool dag next PLAN.pert --format json
25
- npx --yes --package=perttool@0.5.0 -- perttool project history PLAN.pert --format json
25
+ npx --yes --package=perttool@0.5.2 -- perttool --version
26
+ npx --yes --package=perttool@0.5.2 -- perttool document check PLAN.pert
27
+ npx --yes --package=perttool@0.5.2 -- perttool dag next PLAN.pert --format json
28
+ npx --yes --package=perttool@0.5.2 -- perttool project history PLAN.pert --format json
26
29
  ```
27
30
 
28
31
  The equivalent explicit `npm exec` form is:
29
32
 
30
33
  ```sh
31
- npm exec --yes --package=perttool@0.5.0 -- perttool --version
32
- npm exec --yes --package=perttool@0.5.0 -- perttool document check PLAN.pert
33
- npm exec --yes --package=perttool@0.5.0 -- perttool dag analyze PLAN.pert
34
- npm exec --yes --package=perttool@0.5.0 -- perttool project history PLAN.pert --format json
34
+ npm exec --yes --package=perttool@0.5.2 -- perttool --version
35
+ npm exec --yes --package=perttool@0.5.2 -- perttool document check PLAN.pert
36
+ npm exec --yes --package=perttool@0.5.2 -- perttool dag analyze PLAN.pert
37
+ npm exec --yes --package=perttool@0.5.2 -- perttool project history PLAN.pert --format json
35
38
  ```
36
39
 
37
40
  `npx` and `npm exec` may download the selected package version into the npm
38
- cache. The `0.5.0` registry commands become available only after the gated
39
- publication. Pinning `0.4.0` selects Contract 5 and therefore omits Grammar 5
41
+ cache. Pinning `0.4.0` selects Contract 5 and therefore omits Grammar 5
40
42
  lifecycle and history; `0.3.0` selects Contract 4, and `0.2.0` selects
41
43
  Contract 3.
42
44
 
@@ -45,16 +47,15 @@ Contract 3.
45
47
  Install the CLI globally when it is used regularly:
46
48
 
47
49
  ```sh
48
- npm install --global perttool@0.5.0
50
+ npm install --global perttool
49
51
  perttool --version
50
52
  ```
51
53
 
52
- The prepared release will move npm `beta` to Contract 6 `0.5.0` while leaving
53
- `latest` on Contract 5 `0.4.0`. Before publication, both tags still resolve
54
- to `0.4.0`, so use a locally packed `0.5.0` artifact for candidate testing.
55
- After publication, `perttool@beta` follows Contract 6. Contract 5, Contract 4,
56
- and Contract 3 remain available as exact pins `perttool@0.4.0`,
57
- `perttool@0.3.0`, and `perttool@0.2.0`.
54
+ npm `beta` resolves to Contract 6 `0.5.2`; `latest` remains on accepted
55
+ Contract 6 `0.5.1`. The pre-schema Contract 6 artifact remains available as
56
+ `perttool@0.5.0`; Contract 5,
57
+ Contract 4, and Contract 3 remain available as exact pins
58
+ `perttool@0.4.0`, `perttool@0.3.0`, and `perttool@0.2.0`.
58
59
 
59
60
  ## Plan files
60
61
 
@@ -280,6 +281,7 @@ details.
280
281
  | Goal | Command |
281
282
  | --- | --- |
282
283
  | Discover commands | `perttool help [resource [action]]` |
284
+ | Discover or read JSON Schemas | `perttool schema [schema-id]` |
283
285
  | Read domain guidance | `perttool guide [topic [subtopic]]` |
284
286
  | Validate a document | `perttool document check <file>` |
285
287
  | Canonically format it | `perttool document format <file>` |
@@ -307,15 +309,49 @@ domain concepts. Both run without a document:
307
309
  ```sh
308
310
  perttool task set --help
309
311
  perttool help dag next --format json
312
+ perttool schema --format json
313
+ perttool schema Perttool.NextResult.v5 --format json
314
+ perttool schema Perttool.NextResult.v5 --view outline --format json
310
315
  perttool guide editing --level detail --format json
311
316
  ```
312
317
 
318
+ ### JSON Schema artifacts
319
+
320
+ `perttool schema --format json` returns the complete result-schema catalog.
321
+ Supplying a schema identity returns its Draft 2020-12 artifact in the
322
+ `schema` field of `Perttool.SchemaResult.v1`:
323
+
324
+ ```sh
325
+ perttool schema Perttool.CheckResult.v3 --format json
326
+ ```
327
+
328
+ The default and `--view full` return the complete artifact. For a shorter
329
+ outer shape, `--view outline` replaces complex nested records with absolute
330
+ references to the complete bundled artifact. Pass one local, relative, or
331
+ copied absolute reference back with `--ref` to display that internal layer:
332
+
333
+ ```sh
334
+ perttool schema Perttool.NextResult.v5 --view outline --format json
335
+ perttool schema Perttool.NextResult.v5 --view outline \
336
+ --ref '#/$defs/recommendation' --format json
337
+ ```
338
+
339
+ Packed installations also expose each artifact at
340
+ `perttool/schemas/<schema-id>.schema.json`; relative references resolve
341
+ against the bundled `Perttool.Common.v1.schema.json`. The stable `$id` is an
342
+ identifier only: validation does not require network access. Consumers must
343
+ select compatibility from each result's `schema_version`, not from
344
+ `tool_version`. See the
345
+ [JSON Schema Artifact Contract](docs/specs/json-schema.md) for the complete
346
+ 18-result inventory and versioning rules.
347
+
313
348
  ## LLM and automation use
314
349
 
315
- Use `--format json` for machine consumers. Prepared `0.5.0` consumers must
316
- check `cli_contract_version == 6`; consumers of published `0.4.0` must
317
- continue to require Contract 5, and consumers pinned to `0.3.0` must require
318
- Contract 4.
350
+ Use `--format json` for machine consumers. `0.5.2`, `0.5.1`, and `0.5.0`
351
+ consumers must check `cli_contract_version == 6`; consumers pinned to `0.4.0`
352
+ must continue to require Contract 5, and consumers pinned to `0.3.0` must
353
+ require Contract 4. Bundled machine-readable result artifacts require
354
+ `0.5.1`; complete nested records and outline/detail views require `0.5.2`.
319
355
  In every case, check the result-specific `schema_version` before reading the
320
356
  rest of a result.
321
357
  A complete, known, non-truncated `Perttool.NextResult.v5` with temporal policy
@@ -335,6 +371,8 @@ diagnostics, and future or unavailable temporal eligibility must fail closed.
335
371
  - [Temporal and Unit Interface Contract (CLI Contract 4)](docs/specs/temporal-unit-interface.md)
336
372
  - [Owner-Aware Governance Interface Contract (CLI Contract 5)](docs/specs/governance-interface.md)
337
373
  - [Project Actuals and Git History Contract (CLI Contract 6)](docs/specs/project-actuals.md)
374
+ - [JSON Schema Artifact Contract](docs/specs/json-schema.md)
375
+ - [JSON Schema source acceptance](docs/process/json-schema-acceptance.md)
338
376
  - [Contract 5-to-6 migration](docs/process/cli-contract-6-migration.md)
339
377
  - [Contract 4-to-5 migration](docs/process/cli-contract-5-migration.md)
340
378
  - [Issue #4 governance implementation acceptance](docs/process/governance-acceptance.md)
package/dist/cli.js CHANGED
@@ -31,6 +31,7 @@ import { convertWithVelocity, durationSuffix } from "./model/units.js";
31
31
  import { recommendationInvariantExitCode } from "./recommendation/failure.js";
32
32
  import { recommendationAnalysisToJson } from "./recommendation/json.js";
33
33
  import { TARGET_GRAMMAR_5_CAPABILITY, } from "./parser/document-parser.js";
34
+ import { getJsonSchemaResult, renderJsonSchemaResult, serializeJsonSchemaResult, } from "./schema/registry.js";
34
35
  import { TOOL_VERSION } from "./version.js";
35
36
  class UsageError extends Error {
36
37
  code = "PTCLI-001";
@@ -2541,6 +2542,44 @@ function runCommandHelp(args) {
2541
2542
  }
2542
2543
  return result.ok ? 0 : 1;
2543
2544
  }
2545
+ function runJsonSchema(args) {
2546
+ const parsed = parseCommandOptions("schema", args);
2547
+ if (parsed.positionals.length > 1) {
2548
+ throw new UsageError("schema accepts at most one <schema-id>");
2549
+ }
2550
+ const viewValue = parsed.values.get("view");
2551
+ const view = viewValue === undefined || viewValue === "full" || viewValue === "outline"
2552
+ ? viewValue
2553
+ : (() => {
2554
+ throw new UsageError("--view must be full or outline");
2555
+ })();
2556
+ const reference = parsed.values.get("ref");
2557
+ if (parsed.positionals.length === 0 &&
2558
+ (view !== undefined || reference !== undefined)) {
2559
+ throw new UsageError("schema view selection requires one <schema-id>");
2560
+ }
2561
+ if (reference !== undefined && view !== "outline") {
2562
+ throw new UsageError("--ref requires --view outline");
2563
+ }
2564
+ const format = outputFormat(parsed.values.get("format"));
2565
+ const result = getJsonSchemaResult(parsed.positionals[0] ?? null, {
2566
+ ...(view === undefined ? {} : { view }),
2567
+ ...(reference === undefined ? {} : { ref: reference }),
2568
+ });
2569
+ if (format === "json") {
2570
+ process.stdout.write(serializeJsonSchemaResult(result));
2571
+ }
2572
+ else {
2573
+ const rendered = renderJsonSchemaResult(result);
2574
+ if (result.ok) {
2575
+ process.stdout.write(rendered);
2576
+ }
2577
+ else {
2578
+ process.stderr.write(rendered);
2579
+ }
2580
+ }
2581
+ return result.ok ? 0 : 1;
2582
+ }
2544
2583
  function runAgentHelp(args) {
2545
2584
  const parsed = parseCommandOptions("agent.help", args);
2546
2585
  if (parsed.positionals.length > 2) {
@@ -2587,6 +2626,8 @@ async function dispatchCommand(descriptor, args) {
2587
2626
  switch (descriptor.operation) {
2588
2627
  case "help":
2589
2628
  return runCommandHelp(args);
2629
+ case "schema":
2630
+ return runJsonSchema(args);
2590
2631
  case "guide":
2591
2632
  return runGuide(args);
2592
2633
  case "document.check":