fact-kit-facts 0.7.1 → 0.8.0-alpha.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "indexFormat": "2.0",
3
- "formatVersion": "2.0",
2
+ "indexFormat": "2.1",
3
+ "formatVersion": "2.1",
4
4
  "package": "fact-kit-facts",
5
5
  "entry": "fact-kit-go",
6
6
  "component": "fact-kit-facts.go",
@@ -1,6 +1,6 @@
1
1
  {
2
- "indexFormat": "2.0",
3
- "formatVersion": "2.0",
2
+ "indexFormat": "2.1",
3
+ "formatVersion": "2.1",
4
4
  "package": "fact-kit-facts",
5
5
  "entry": "fact-kit-py",
6
6
  "component": "fact-kit-facts.pypi",
@@ -1,6 +1,6 @@
1
1
  {
2
- "indexFormat": "2.0",
3
- "formatVersion": "2.0",
2
+ "indexFormat": "2.1",
3
+ "formatVersion": "2.1",
4
4
  "package": "fact-kit-facts",
5
5
  "entry": "fact-kit-rs",
6
6
  "component": "fact-kit-facts.crates",
@@ -1,6 +1,6 @@
1
1
  {
2
- "indexFormat": "2.0",
3
- "formatVersion": "2.0",
2
+ "indexFormat": "2.1",
3
+ "formatVersion": "2.1",
4
4
  "package": "fact-kit-facts",
5
5
  "entry": "fact-kit-swift",
6
6
  "component": "fact-kit-facts.swift",
package/dist/index.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
- "indexFormat": "2.0",
3
- "formatVersion": "2.0",
2
+ "indexFormat": "2.1",
3
+ "formatVersion": "2.1",
4
4
  "package": "fact-kit-facts",
5
5
  "entry": ".",
6
6
  "component": "fact-kit-facts.npm",
7
7
  "describes": {
8
- "fact-kit-js": "0.12.1"
8
+ "fact-kit-js": "0.13.0-alpha.1"
9
9
  },
10
10
  "publish": {
11
11
  "target": "npm",
@@ -2141,6 +2141,102 @@
2141
2141
  }
2142
2142
  }
2143
2143
  }
2144
+ },
2145
+ {
2146
+ "since": "0.13.0-alpha.1",
2147
+ "content": {
2148
+ "schema": {
2149
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2150
+ "title": "Fact index (dist/<entry>/index.json)",
2151
+ "type": "object",
2152
+ "required": [
2153
+ "indexFormat",
2154
+ "formatVersion",
2155
+ "package",
2156
+ "entry",
2157
+ "describes",
2158
+ "facts"
2159
+ ],
2160
+ "properties": {
2161
+ "indexFormat": {
2162
+ "type": "string",
2163
+ "pattern": "^[0-9]+\\.[0-9]+$",
2164
+ "description": "`2.1` for what this version builds. The only key a reader uses to tell the format: a missing field reads as `1.0`, any `1.x` and any `2.x` is read, and any other major version is `unsupported-index-format`."
2165
+ },
2166
+ "formatVersion": {
2167
+ "type": "string",
2168
+ "pattern": "^[0-9]+\\.[0-9]+$",
2169
+ "description": "Written with the same value as `indexFormat` (`2.1`), so that a tool that reads the outputs of several kits finds the format under one key name. The readers of fact-kit do not read it, and when it differs from `indexFormat` only `indexFormat` counts."
2170
+ },
2171
+ "package": {
2172
+ "type": "string",
2173
+ "minLength": 1
2174
+ },
2175
+ "entry": {
2176
+ "type": "string",
2177
+ "minLength": 1,
2178
+ "description": "Sub-path of the entry, e.g. `claude-code`. In an aggregate package it is the path of the index in that package, and `.` for the root."
2179
+ },
2180
+ "component": {
2181
+ "type": "string",
2182
+ "minLength": 1,
2183
+ "description": "Aggregate package only: the name of the component package the index was built in."
2184
+ },
2185
+ "dataFormatVersion": {
2186
+ "type": "string",
2187
+ "minLength": 1,
2188
+ "description": "Optional version of the data format that an entry declares for itself. It was `formatVersion` before 2.0. The readers do not read it and do not return it, so read it from `index.json` directly."
2189
+ },
2190
+ "describes": {
2191
+ "description": "The component this entry describes and the latest published version it covers, e.g. `{ \"claude-code\": \"2.1.308\" }`. `{}` means the described thing has no version. `check` rejects an entry with several keys, and entries of one package that disagree (different components, or `{}` mixed with a component).",
2192
+ "type": "object",
2193
+ "additionalProperties": {
2194
+ "type": "string",
2195
+ "minLength": 1
2196
+ }
2197
+ },
2198
+ "publish": {
2199
+ "description": "Where the described component is published and under what name there (its PublishName), e.g. `{ \"target\": \"npm\", \"name\": \"fact-kit\" }`. `describes` is keyed by the component name, which can differ from the name on the registry. `readFacts` on the JS side uses it to find the installed package when `describes` is not keyed by an npm package name, and only when `target` is `npm`. The readers of the other languages return it and do not check any version. `check` rejects entries of one package that disagree. Left out, `readFacts` takes the `describes` key as the npm package name.",
2200
+ "type": "object",
2201
+ "required": [
2202
+ "target",
2203
+ "name"
2204
+ ],
2205
+ "additionalProperties": false,
2206
+ "properties": {
2207
+ "target": {
2208
+ "enum": [
2209
+ "npm",
2210
+ "pypi",
2211
+ "crates",
2212
+ "go",
2213
+ "swift"
2214
+ ]
2215
+ },
2216
+ "name": {
2217
+ "type": "string",
2218
+ "minLength": 1
2219
+ }
2220
+ }
2221
+ },
2222
+ "layer": {
2223
+ "description": "The layer the facts of this entry belong to. `org`, `product` and `implementation` go from the top down. `tool` is the commands, fields and behavior of a tool, and the source declares it itself. Optional: an entry that does not write it has no `layer` in its index.",
2224
+ "enum": [
2225
+ "org",
2226
+ "product",
2227
+ "implementation",
2228
+ "tool"
2229
+ ]
2230
+ },
2231
+ "facts": {
2232
+ "type": "array",
2233
+ "items": {
2234
+ "$ref": "urn:fact-kit:fact"
2235
+ }
2236
+ }
2237
+ }
2238
+ }
2239
+ }
2144
2240
  }
2145
2241
  ],
2146
2242
  "tool": "fact-kit",
@@ -2164,12 +2260,12 @@
2164
2260
  "indexFormat": {
2165
2261
  "type": "string",
2166
2262
  "pattern": "^[0-9]+\\.[0-9]+$",
2167
- "description": "`2.0` for what this version builds. The only key a reader uses to tell the format: a missing field reads as `1.0`, any `1.x` and any `2.x` is read, and any other major version is `unsupported-index-format`."
2263
+ "description": "`2.1` for what this version builds. The only key a reader uses to tell the format: a missing field reads as `1.0`, any `1.x` and any `2.x` is read, and any other major version is `unsupported-index-format`."
2168
2264
  },
2169
2265
  "formatVersion": {
2170
2266
  "type": "string",
2171
2267
  "pattern": "^[0-9]+\\.[0-9]+$",
2172
- "description": "Written with the same value as `indexFormat` (`2.0`), so that a tool that reads the outputs of several kits finds the format under one key name. The readers of fact-kit do not read it, and when it differs from `indexFormat` only `indexFormat` counts."
2268
+ "description": "Written with the same value as `indexFormat` (`2.1`), so that a tool that reads the outputs of several kits finds the format under one key name. The readers of fact-kit do not read it, and when it differs from `indexFormat` only `indexFormat` counts."
2173
2269
  },
2174
2270
  "package": {
2175
2271
  "type": "string",
@@ -2222,6 +2318,15 @@
2222
2318
  }
2223
2319
  }
2224
2320
  },
2321
+ "layer": {
2322
+ "description": "The layer the facts of this entry belong to. `org`, `product` and `implementation` go from the top down. `tool` is the commands, fields and behavior of a tool, and the source declares it itself. Optional: an entry that does not write it has no `layer` in its index.",
2323
+ "enum": [
2324
+ "org",
2325
+ "product",
2326
+ "implementation",
2327
+ "tool"
2328
+ ]
2329
+ },
2225
2330
  "facts": {
2226
2331
  "type": "array",
2227
2332
  "items": {
@@ -2397,6 +2502,74 @@
2397
2502
  }
2398
2503
  }
2399
2504
  }
2505
+ },
2506
+ {
2507
+ "since": "0.13.0-alpha.1",
2508
+ "content": {
2509
+ "schema": {
2510
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2511
+ "title": "Default export of facts/<entry>/index.ts",
2512
+ "type": "object",
2513
+ "required": [
2514
+ "describes"
2515
+ ],
2516
+ "additionalProperties": false,
2517
+ "properties": {
2518
+ "layer": {
2519
+ "description": "The layer the facts of this entry belong to. `org`, `product` and `implementation` go from the top down. `tool` is the commands, fields and behavior of a tool, and the source declares it itself. Optional: an entry that does not write it has no `layer` in its index.",
2520
+ "enum": [
2521
+ "org",
2522
+ "product",
2523
+ "implementation",
2524
+ "tool"
2525
+ ]
2526
+ },
2527
+ "describes": {
2528
+ "type": "object",
2529
+ "additionalProperties": {
2530
+ "type": "string",
2531
+ "minLength": 1
2532
+ }
2533
+ },
2534
+ "dataFormatVersion": {
2535
+ "type": "string",
2536
+ "minLength": 1,
2537
+ "description": "Written to `dataFormatVersion` of the index. A source that still writes `formatVersion` fails with `format`, because `formatVersion` of the index is now written by the build from `indexFormat`."
2538
+ },
2539
+ "publish": {
2540
+ "description": "Where the described component is published and under what name there (its PublishName), e.g. `{ \"target\": \"npm\", \"name\": \"fact-kit\" }`. `describes` is keyed by the component name, which can differ from the name on the registry. `readFacts` on the JS side uses it to find the installed package when `describes` is not keyed by an npm package name, and only when `target` is `npm`. The readers of the other languages return it and do not check any version. `check` rejects entries of one package that disagree. Left out, `readFacts` takes the `describes` key as the npm package name.",
2541
+ "type": "object",
2542
+ "required": [
2543
+ "target",
2544
+ "name"
2545
+ ],
2546
+ "additionalProperties": false,
2547
+ "properties": {
2548
+ "target": {
2549
+ "enum": [
2550
+ "npm",
2551
+ "pypi",
2552
+ "crates",
2553
+ "go",
2554
+ "swift"
2555
+ ]
2556
+ },
2557
+ "name": {
2558
+ "type": "string",
2559
+ "minLength": 1
2560
+ }
2561
+ }
2562
+ },
2563
+ "facts": {
2564
+ "description": "Facts as they appear in the index, with three differences that the build resolves. `variants` may be the result of `history(...)`, and `content` may then be left out. `relates` lists other fact objects of this package, which become `derivedFrom`. An item may be `derive(upstreamSpec, id, map?)`, a fact computed from an installed upstream package. Optional: the facts of the entry may all be in `*.facts.ts` files, which the build collects after these (`fact-kit.facts-file-collection`).",
2565
+ "type": "array",
2566
+ "items": {
2567
+ "$ref": "urn:fact-kit:fact"
2568
+ }
2569
+ }
2570
+ }
2571
+ }
2572
+ }
2400
2573
  }
2401
2574
  ],
2402
2575
  "tool": "fact-kit",
@@ -2413,6 +2586,15 @@
2413
2586
  ],
2414
2587
  "additionalProperties": false,
2415
2588
  "properties": {
2589
+ "layer": {
2590
+ "description": "The layer the facts of this entry belong to. `org`, `product` and `implementation` go from the top down. `tool` is the commands, fields and behavior of a tool, and the source declares it itself. Optional: an entry that does not write it has no `layer` in its index.",
2591
+ "enum": [
2592
+ "org",
2593
+ "product",
2594
+ "implementation",
2595
+ "tool"
2596
+ ]
2597
+ },
2416
2598
  "describes": {
2417
2599
  "type": "object",
2418
2600
  "additionalProperties": {
@@ -2460,6 +2642,105 @@
2460
2642
  }
2461
2643
  }
2462
2644
  },
2645
+ {
2646
+ "id": "fact-kit.entry-layer",
2647
+ "topics": [
2648
+ "authoring",
2649
+ "build",
2650
+ "read"
2651
+ ],
2652
+ "title": {
2653
+ "en": "The layer of an entry"
2654
+ },
2655
+ "description": {
2656
+ "en": "The optional `layer` field of an entry, its four values, and how it gets into the index and out of the readers."
2657
+ },
2658
+ "variants": [
2659
+ {
2660
+ "since": "0.13.0-alpha.1",
2661
+ "content": {
2662
+ "value": {
2663
+ "field": "layer",
2664
+ "where": "The default export of `facts/<entry>/index.ts`, next to `describes` and `publish`. `defineFacts` takes it.",
2665
+ "values": [
2666
+ "org",
2667
+ "product",
2668
+ "implementation",
2669
+ "tool"
2670
+ ],
2671
+ "required": false,
2672
+ "order": "`org`, `product` and `implementation` go from the top down.",
2673
+ "tool": "`tool` is the commands, fields and behavior of a tool. The source declares it itself, whether the tool is its own or from a third party.",
2674
+ "declared": "The entry declares its layer. A reader does not work it out from the directory or from `describes`.",
2675
+ "index": "The build writes it to the top-level `layer` of the index, after `publish` and before `facts`. An entry that does not write `layer` has no `layer` key in its index.",
2676
+ "invalid": "A value that is not one of the four makes `defineFacts`, `build` and `check` fail. The problem code is `format`, its location ends in `/layer`, and the message names `layer`.",
2677
+ "readers": "`loadInstalledIndex` returns it as `index.layer`, and `readFacts` returns it as `layer`. Both give undefined when the index has none."
2678
+ }
2679
+ }
2680
+ }
2681
+ ],
2682
+ "tool": "fact-kit",
2683
+ "source": {
2684
+ "kind": "published"
2685
+ },
2686
+ "content": {
2687
+ "value": {
2688
+ "field": "layer",
2689
+ "where": "The default export of `facts/<entry>/index.ts`, next to `describes` and `publish`. `defineFacts` takes it.",
2690
+ "values": [
2691
+ "org",
2692
+ "product",
2693
+ "implementation",
2694
+ "tool"
2695
+ ],
2696
+ "required": false,
2697
+ "order": "`org`, `product` and `implementation` go from the top down.",
2698
+ "tool": "`tool` is the commands, fields and behavior of a tool. The source declares it itself, whether the tool is its own or from a third party.",
2699
+ "declared": "The entry declares its layer. A reader does not work it out from the directory or from `describes`.",
2700
+ "index": "The build writes it to the top-level `layer` of the index, after `publish` and before `facts`. An entry that does not write `layer` has no `layer` key in its index.",
2701
+ "invalid": "A value that is not one of the four makes `defineFacts`, `build` and `check` fail. The problem code is `format`, its location ends in `/layer`, and the message names `layer`.",
2702
+ "readers": "`loadInstalledIndex` returns it as `index.layer`, and `readFacts` returns it as `layer`. Both give undefined when the index has none."
2703
+ }
2704
+ }
2705
+ },
2706
+ {
2707
+ "id": "fact-kit.index-format-2-1",
2708
+ "topics": [
2709
+ "build",
2710
+ "read"
2711
+ ],
2712
+ "title": {
2713
+ "en": "Index format 2.1"
2714
+ },
2715
+ "description": {
2716
+ "en": "What changes in the index format when `layer` is added, and how readers of 2.0 and older take a 2.1 index."
2717
+ },
2718
+ "variants": [
2719
+ {
2720
+ "since": "0.13.0-alpha.1",
2721
+ "content": {
2722
+ "value": {
2723
+ "indexFormat": "2.1",
2724
+ "change": "The minor version goes up by one, from 2.0 to 2.1, because the index may now have a top-level `layer`. The build writes 2.1 for every index, with or without `layer`.",
2725
+ "readers": "A reader takes any `1.x` and any `2.x`, so it reads 2.0 and 2.1 alike and skips the top-level keys it does not know. A reader that does not know `layer` ignores it.",
2726
+ "conformance": "The cases `index-format-2-1-layer` and `index-format-2-1-layer-other-value` have a top-level `layer` and all five readers read them."
2727
+ }
2728
+ }
2729
+ }
2730
+ ],
2731
+ "tool": "fact-kit",
2732
+ "source": {
2733
+ "kind": "published"
2734
+ },
2735
+ "content": {
2736
+ "value": {
2737
+ "indexFormat": "2.1",
2738
+ "change": "The minor version goes up by one, from 2.0 to 2.1, because the index may now have a top-level `layer`. The build writes 2.1 for every index, with or without `layer`.",
2739
+ "readers": "A reader takes any `1.x` and any `2.x`, so it reads 2.0 and 2.1 alike and skips the top-level keys it does not know. A reader that does not know `layer` ignores it.",
2740
+ "conformance": "The cases `index-format-2-1-layer` and `index-format-2-1-layer-other-value` have a top-level `layer` and all five readers read them."
2741
+ }
2742
+ }
2743
+ },
2463
2744
  {
2464
2745
  "id": "fact-kit.index-format-detection",
2465
2746
  "topics": [
@@ -4987,6 +5268,120 @@
4987
5268
  ]
4988
5269
  }
4989
5270
  }
5271
+ },
5272
+ {
5273
+ "since": "0.13.0-alpha.1",
5274
+ "content": {
5275
+ "value": {
5276
+ "module": "fact-kit",
5277
+ "export": "readFacts",
5278
+ "signature": "readFacts(spec, options?) => FactReader",
5279
+ "parameters": [
5280
+ {
5281
+ "name": "spec",
5282
+ "type": "string",
5283
+ "required": true,
5284
+ "summary": "`<package>` or `<package>/<path>`, scoped names included, and the path may have several segments. The package must export `./index.json` or `./<path>/index.json`."
5285
+ },
5286
+ {
5287
+ "name": "options.root",
5288
+ "type": "string",
5289
+ "required": false,
5290
+ "default": "process.cwd()",
5291
+ "summary": "Directory the package is resolved from, normally the hub being built."
5292
+ },
5293
+ {
5294
+ "name": "options.version",
5295
+ "type": "string",
5296
+ "required": false,
5297
+ "default": "the installed version of the described component, else the latest published",
5298
+ "summary": "Version of the described component the reader runs, or `head` for the unreleased state. Without it, an installed described component sets the version, and one that is not installed leaves the latest published facts."
5299
+ },
5300
+ {
5301
+ "name": "options.include",
5302
+ "type": "string[]",
5303
+ "required": false,
5304
+ "default": "[]",
5305
+ "summary": "Labels of `pending` rows that a reader on `head` also gets."
5306
+ },
5307
+ {
5308
+ "name": "options.platform",
5309
+ "type": "string",
5310
+ "required": false,
5311
+ "summary": "Platform of the reader. A row with a `platforms` condition applies only when it lists this one."
5312
+ },
5313
+ {
5314
+ "name": "options.os",
5315
+ "type": "\"macos\" | \"linux\" | \"windows\"",
5316
+ "required": false,
5317
+ "summary": "Operating system of the reader. A row with an `os` condition applies only when it lists this one."
5318
+ },
5319
+ {
5320
+ "name": "options.onRead",
5321
+ "type": "(read: { package, version, entry, id, since }) => void",
5322
+ "required": false,
5323
+ "summary": "Called synchronously once per `get`, `value` and `has` that finds the fact, and once per read of a field other than `id` on an element of `facts`. Filtering `facts` by `id` does not call it."
5324
+ }
5325
+ ],
5326
+ "returns": {
5327
+ "members": [
5328
+ {
5329
+ "name": "package",
5330
+ "type": "string"
5331
+ },
5332
+ {
5333
+ "name": "version",
5334
+ "type": "string",
5335
+ "summary": "Version of the installed fact package, from its `package.json`."
5336
+ },
5337
+ {
5338
+ "name": "entry",
5339
+ "type": "string"
5340
+ },
5341
+ {
5342
+ "name": "describes",
5343
+ "type": "Record<string, string>"
5344
+ },
5345
+ {
5346
+ "name": "publish",
5347
+ "type": "{ target: \"npm\" | \"pypi\" | \"crates\" | \"go\" | \"swift\"; name: string } | undefined",
5348
+ "summary": "The `publish` field of the index, as it is. Undefined for an index that has none."
5349
+ },
5350
+ {
5351
+ "name": "layer",
5352
+ "type": "\"org\" | \"product\" | \"implementation\" | \"tool\" | undefined",
5353
+ "summary": "The top-level `layer` of the index, as it is. Undefined for an index that has none, such as every index before format 2.1."
5354
+ },
5355
+ {
5356
+ "name": "facts",
5357
+ "type": "SelectedFact[]",
5358
+ "summary": "The facts this reader sees, each flattened to its row."
5359
+ },
5360
+ {
5361
+ "name": "has",
5362
+ "type": "(id: string) => boolean"
5363
+ },
5364
+ {
5365
+ "name": "get",
5366
+ "type": "(id: string) => SelectedFact",
5367
+ "summary": "Throws when there is no such fact."
5368
+ },
5369
+ {
5370
+ "name": "value",
5371
+ "type": "<T>(id: string) => T",
5372
+ "summary": "The `content.value` of the fact. Throws when the fact has no value content."
5373
+ }
5374
+ ]
5375
+ },
5376
+ "throws": [
5377
+ "The spec is not of the form `<package>` or `<package>/<path>` (`not-found`).",
5378
+ "The package cannot be resolved from `root` (`not-found`).",
5379
+ "The resolved file is not a fact index (`not-an-index`) or has an index format of another major version than 1 and 2 (`unsupported-index-format`). Only `indexFormat` is read, and a missing one reads as `1.0`.",
5380
+ "A version is not semver (`invalid-version`).",
5381
+ "No `version` is given, and the described component is installed under `root` in a newer version than the facts describe (`describes-behind`). The component is looked up as `publish.name` when the index has `publish` with target `npm`, is not looked up when `publish` has another target, and is looked up by the `describes` key when there is no `publish`."
5382
+ ]
5383
+ }
5384
+ }
4990
5385
  }
4991
5386
  ],
4992
5387
  "tool": "fact-kit",
@@ -5069,6 +5464,11 @@
5069
5464
  "type": "{ target: \"npm\" | \"pypi\" | \"crates\" | \"go\" | \"swift\"; name: string } | undefined",
5070
5465
  "summary": "The `publish` field of the index, as it is. Undefined for an index that has none."
5071
5466
  },
5467
+ {
5468
+ "name": "layer",
5469
+ "type": "\"org\" | \"product\" | \"implementation\" | \"tool\" | undefined",
5470
+ "summary": "The top-level `layer` of the index, as it is. Undefined for an index that has none, such as every index before format 2.1."
5471
+ },
5072
5472
  {
5073
5473
  "name": "facts",
5074
5474
  "type": "SelectedFact[]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fact-kit-facts",
3
- "version": "0.7.1",
3
+ "version": "0.8.0-alpha.1",
4
4
  "description": "Facts about fact-kit: the spec of its index format, commands and API",
5
5
  "license": "MIT",
6
6
  "type": "module",