@ankhorage/paradox 0.2.4 → 0.2.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 492d6fc: Update Ankhorage dependencies: `@ankhorage/policy`.
8
+
9
+ ## 0.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - 0c09385: Consume the complete Policy-owned README usage contract, including capability-aware rendering and canonical section ordering.
14
+
3
15
  ## 0.2.4
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/paradox
5
5
 
6
- ![license: MIT](./paradox/badges/license.svg) ![npm: v0.2.1](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![paradox: canonical](./paradox/badges/docs.svg)
6
+ ![license: MIT](./paradox/badges/license.svg) ![npm: v0.2.4](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![paradox: canonical](./paradox/badges/docs.svg)
7
7
 
8
8
  Deterministic documentation generator for TypeScript packages.
9
9
 
@@ -135,6 +135,10 @@ Source: `src/types/config.ts:9:1`
135
135
  ## Collaborators
136
136
 
137
137
  <!-- readme: collaborators -start -->
138
+ <table>
139
+ <tbody>
140
+ </tbody>
141
+ </table>
138
142
  <!-- readme: collaborators -end -->
139
143
 
140
144
  ## Donation
@@ -44,11 +44,10 @@ function validateCommentRules(comments) {
44
44
  */
45
45
  function validateUsageRules(comments) {
46
46
  const usageComments = comments.filter((comment) => comment.parsed.isUsage);
47
- if (usageComments.length === 0)
47
+ if (!DOCUMENTATION_POLICY.readmeUsage.required && usageComments.length === 0)
48
48
  return [];
49
49
  const findings = usageComments.flatMap((comment) => validateUsageComment(comment));
50
- const readmeExamples = usageComments.filter((comment) => isBelow(comment.sourcePath, DOCUMENTATION_POLICY.paths.examplesRoot) &&
51
- comment.parsed.isReadme);
50
+ const readmeExamples = usageComments.filter((comment) => isBelow(comment.sourcePath, DOCUMENTATION_POLICY.readmeUsage.root) && comment.parsed.isReadme);
52
51
  if (readmeExamples.length !== DOCUMENTATION_POLICY.readmeUsage.exactCount) {
53
52
  findings.push(createDocumentationFinding('documentation.usage.readme.unique', `Expected exactly one @usage + @readme example; found ${readmeExamples.length}.`));
54
53
  }
@@ -1,3 +1,4 @@
1
+ import { DOCUMENTATION_POLICY } from '@ankhorage/policy/documentation';
1
2
  import { slugifyAscii } from '@ankhorage/utility/string';
2
3
  /***
3
4
  * Renders a deterministic static HTML documentation app.
@@ -240,10 +241,13 @@ function renderHomeView(model, diagrams, exportsByModule) {
240
241
  * Renders complete CLI and programmatic usage documentation.
241
242
  */
242
243
  function renderUsagePanel(model) {
244
+ if (!DOCUMENTATION_POLICY.readmeUsage.required && model.usageEntries.length === 0)
245
+ return '';
246
+ const { usageEntries } = model;
243
247
  return `<section class="panel" data-search="${escapeAttribute([
244
248
  'usage',
245
249
  model.usage.command,
246
- ...model.usageEntries.flatMap((entry) => [
250
+ ...usageEntries.flatMap((entry) => [
247
251
  entry.title ?? '',
248
252
  entry.description ?? '',
249
253
  entry.sourcePath,
@@ -254,7 +258,7 @@ function renderUsagePanel(model) {
254
258
  <h3>CLI</h3>
255
259
  <pre>${escapeHtml(model.usage.command)}</pre>
256
260
  </article>
257
- ${model.usageEntries.map(renderUsageEntry).join('')}
261
+ ${usageEntries.map(renderUsageEntry).join('')}
258
262
  </section>`;
259
263
  }
260
264
  /***
@@ -1,3 +1,4 @@
1
+ import { DOCUMENTATION_POLICY } from '@ankhorage/policy/documentation';
1
2
  /***
2
3
  * Renders markdown artifacts from the documentation model.
3
4
  */
@@ -36,8 +37,21 @@ function renderReadme(model, outputDir, badges, diagrams) {
36
37
  * Renders the canonical CLI-first Usage chapter.
37
38
  */
38
39
  function renderUsage(lines, model) {
40
+ if (!DOCUMENTATION_POLICY.readmeUsage.required && model.usageEntries.length === 0)
41
+ return;
39
42
  const readmeExample = model.usageEntries.find((entry) => entry.area === 'examples' && entry.isReadme);
40
43
  lines.push('## Usage', '');
44
+ for (const section of DOCUMENTATION_POLICY.readmeUsage.sectionOrder) {
45
+ if (section === 'cli') {
46
+ renderCliUsage(lines, model);
47
+ }
48
+ else {
49
+ renderProgrammaticUsage(lines, model, readmeExample);
50
+ }
51
+ }
52
+ }
53
+ /*** Renders the canonical CLI usage section from package metadata. */
54
+ function renderCliUsage(lines, model) {
41
55
  lines.push('### CLI', '');
42
56
  lines.push('Ankhorage packages expose their command-line interface through `ankh`. Use `ankh --help` to discover available package commands, or run a package command with `--help` for package-specific usage.', '');
43
57
  lines.push('```zsh');
@@ -46,6 +60,9 @@ function renderUsage(lines, model) {
46
60
  lines.push(`# Show usage information for ${getPackageDisplayName(model.packageId)}`);
47
61
  lines.push(model.usage.command);
48
62
  lines.push('```', '');
63
+ }
64
+ /*** Renders the single README-promoted programmatic usage declaration. */
65
+ function renderProgrammaticUsage(lines, model, readmeExample) {
49
66
  if (readmeExample === undefined)
50
67
  return;
51
68
  lines.push(`### ${readmeExample.title ?? 'Programmatic Usage'}`, '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/paradox",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "Deterministic documentation generator for TypeScript packages.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -71,12 +71,12 @@
71
71
  "test:standalone": "bun test tests/cli.e2e.test.ts"
72
72
  },
73
73
  "dependencies": {
74
- "@ankhorage/policy": "^0.3.1",
74
+ "@ankhorage/policy": "^0.5.1",
75
75
  "@ankhorage/utility": "^1.8.1",
76
76
  "ts-morph": "^28.0.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@ankhorage/devtools": "^1.14.0",
79
+ "@ankhorage/devtools": "^2.0.0",
80
80
  "@types/bun": "^1.4.1",
81
81
  "@types/node": "^24.13.3",
82
82
  "typescript": "^5.9.3"