@orkestrel/guide 0.0.21 → 0.0.22

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.
@@ -1389,6 +1389,22 @@ export declare interface GuideInterface {
1389
1389
  */
1390
1390
  export declare type GuideModule = string | readonly string[];
1391
1391
 
1392
+ /**
1393
+ * Checks whether a source declares at least one behavioural member — a `class` or `interface`
1394
+ * in its surface that carries a call-signature member — so a guide owes a `## Methods` group only
1395
+ * where the source has one to document.
1396
+ *
1397
+ * @param source - The reflected source under parity
1398
+ * @returns True if a surface `class` or `interface` declares a member; false otherwise
1399
+ *
1400
+ * @example
1401
+ * ```ts
1402
+ * hasBehaviouralSurface(createSource({ files: { 'src/types.ts': 'export interface Widget { render(): void }' }, module: 'src' })) // true
1403
+ * hasBehaviouralSurface(createSource({ files: { 'src/constants.ts': 'export const NAMES = Object.freeze({})' }, module: 'src' })) // false
1404
+ * ```
1405
+ */
1406
+ export declare function hasBehaviouralSurface(source: SourceInterface): boolean;
1407
+
1392
1408
  /**
1393
1409
  * Checks whether an opaque inventory key contains only canonical slash-separated
1394
1410
  * segments. Empty, `.` and `..` segments are rejected without rewriting the
@@ -1389,6 +1389,22 @@ export declare interface GuideInterface {
1389
1389
  */
1390
1390
  export declare type GuideModule = string | readonly string[];
1391
1391
 
1392
+ /**
1393
+ * Checks whether a source declares at least one behavioural member — a `class` or `interface`
1394
+ * in its surface that carries a call-signature member — so a guide owes a `## Methods` group only
1395
+ * where the source has one to document.
1396
+ *
1397
+ * @param source - The reflected source under parity
1398
+ * @returns True if a surface `class` or `interface` declares a member; false otherwise
1399
+ *
1400
+ * @example
1401
+ * ```ts
1402
+ * hasBehaviouralSurface(createSource({ files: { 'src/types.ts': 'export interface Widget { render(): void }' }, module: 'src' })) // true
1403
+ * hasBehaviouralSurface(createSource({ files: { 'src/constants.ts': 'export const NAMES = Object.freeze({})' }, module: 'src' })) // false
1404
+ * ```
1405
+ */
1406
+ export declare function hasBehaviouralSurface(source: SourceInterface): boolean;
1407
+
1392
1408
  /**
1393
1409
  * Checks whether an opaque inventory key contains only canonical slash-separated
1394
1410
  * segments. Empty, `.` and `..` segments are rejected without rewriting the
@@ -851,6 +851,23 @@ function findMissingSymbols(symbols, source) {
851
851
  return findMissing(symbols.map(computeSymbolKey), source.map(computeSymbolKey));
852
852
  }
853
853
  /**
854
+ * Checks whether a source declares at least one behavioural member — a `class` or `interface`
855
+ * in its surface that carries a call-signature member — so a guide owes a `## Methods` group only
856
+ * where the source has one to document.
857
+ *
858
+ * @param source - The reflected source under parity
859
+ * @returns True if a surface `class` or `interface` declares a member; false otherwise
860
+ *
861
+ * @example
862
+ * ```ts
863
+ * hasBehaviouralSurface(createSource({ files: { 'src/types.ts': 'export interface Widget { render(): void }' }, module: 'src' })) // true
864
+ * hasBehaviouralSurface(createSource({ files: { 'src/constants.ts': 'export const NAMES = Object.freeze({})' }, module: 'src' })) // false
865
+ * ```
866
+ */
867
+ function hasBehaviouralSurface(source) {
868
+ return source.surface().some((symbol) => (symbol.keyword === "class" || symbol.keyword === "interface") && source.methods(symbol.name).length > 0);
869
+ }
870
+ /**
854
871
  * Finds the names in `names` that have no example — a fence containing the name at a
855
872
  * word boundary in `fences`, or a membership in `examples`, both count as
856
873
  * "has an example"; presence-only, fence and JSDoc content are never checked.
@@ -3615,7 +3632,7 @@ var Parity = class Parity {
3615
3632
  text: `${row.entry.spec} has no ## ${heading} section.`
3616
3633
  });
3617
3634
  }
3618
- if (row.guide.methods().length === 0) findings.push({
3635
+ if (row.guide.methods().length === 0 && hasBehaviouralSurface(row.source)) findings.push({
3619
3636
  spec: row.entry.spec,
3620
3637
  text: `${row.entry.spec} has no documented method groups.`
3621
3638
  });
@@ -4087,6 +4104,6 @@ function createManifestEntryContract() {
4087
4104
  return createContract(manifestEntryShape);
4088
4105
  }
4089
4106
  //#endregion
4090
- export { DRIFT_CATEGORIES, EXPORT_KEYWORDS, EXTERNAL_SCHEMES, Guide, KIND, MANIFEST, METHODS, Parity, SUMMARY, SURFACE, Source, SourceManager, TESTS, WRAP_WIDTH, buildCell, buildComment, buildFence, buildTable, collectDeclarations, collectExamples, collectFences, collectGroups, collectKeys, collectSummaries, collectTitles, compareMembership, computeDrift, computeModuleKey, computeSymbolKey, createDriftContract, createGuide, createManifestEntryContract, createMethodEntryContract, createMethodGroupContract, createSource, createSourceExampleContract, createSourceManager, createSurfaceSymbolContract, driftShape, escapeRegExp, extractBodyLines, extractCellLinks, extractCellText, extractDeclaration, extractExampleLines, extractExampleMethods, extractExamples, extractExports, extractFenceImports, extractFences, extractHidden, extractLinks, extractMemberMethods, extractMethods, extractRowEntry, extractRowSummary, extractRowSymbol, extractSourceComments, extractSourceLines, extractSurface, extractTagline, extractTests, extractUnnamed, findColumnIndex, findDrift, findFirstCode, findMissing, findMissingSymbols, findUnexampled, findUnlisted, formatDrift, formatSide, hasCanonicalSegments, identifyDrift, isDrift, isDriftCategory, isExportKeyword, isExternalLink, isManifestEntry, isMethodEntry, isMethodGroup, isSourceExample, isSurfaceSymbol, joinHead, locateComment, manifestEntryShape, maskFences, methodEntryShape, methodGroupShape, normalizeComment, normalizeDirectories, normalizeIdentifier, normalizeSummary, parseManifest, renderExample, renderMethods, renderSurface, replaceCell, replaceExample, replaceFence, replaceSummary, resolveLink, resolvePath, selectModuleKeys, selectSectionBlocks, sourceExampleShape, spliceSpan, surfaceSymbolShape, unwrapComment, wrapText };
4107
+ export { DRIFT_CATEGORIES, EXPORT_KEYWORDS, EXTERNAL_SCHEMES, Guide, KIND, MANIFEST, METHODS, Parity, SUMMARY, SURFACE, Source, SourceManager, TESTS, WRAP_WIDTH, buildCell, buildComment, buildFence, buildTable, collectDeclarations, collectExamples, collectFences, collectGroups, collectKeys, collectSummaries, collectTitles, compareMembership, computeDrift, computeModuleKey, computeSymbolKey, createDriftContract, createGuide, createManifestEntryContract, createMethodEntryContract, createMethodGroupContract, createSource, createSourceExampleContract, createSourceManager, createSurfaceSymbolContract, driftShape, escapeRegExp, extractBodyLines, extractCellLinks, extractCellText, extractDeclaration, extractExampleLines, extractExampleMethods, extractExamples, extractExports, extractFenceImports, extractFences, extractHidden, extractLinks, extractMemberMethods, extractMethods, extractRowEntry, extractRowSummary, extractRowSymbol, extractSourceComments, extractSourceLines, extractSurface, extractTagline, extractTests, extractUnnamed, findColumnIndex, findDrift, findFirstCode, findMissing, findMissingSymbols, findUnexampled, findUnlisted, formatDrift, formatSide, hasBehaviouralSurface, hasCanonicalSegments, identifyDrift, isDrift, isDriftCategory, isExportKeyword, isExternalLink, isManifestEntry, isMethodEntry, isMethodGroup, isSourceExample, isSurfaceSymbol, joinHead, locateComment, manifestEntryShape, maskFences, methodEntryShape, methodGroupShape, normalizeComment, normalizeDirectories, normalizeIdentifier, normalizeSummary, parseManifest, renderExample, renderMethods, renderSurface, replaceCell, replaceExample, replaceFence, replaceSummary, resolveLink, resolvePath, selectModuleKeys, selectSectionBlocks, sourceExampleShape, spliceSpan, surfaceSymbolShape, unwrapComment, wrapText };
4091
4108
 
4092
4109
  //# sourceMappingURL=index.js.map