@oddessentials/odd-docs 2.0.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/ir/builder.ts","../src/core/parser/schemaParser.ts","../src/core/ir/merger.ts","../src/core/capabilities.ts","../src/core/ir/validator.ts","../src/core/parser/manifestParser.ts","../src/core/parser/mcpIntrospection.ts","../src/core/renderer/markdownRenderer.ts","../src/core/renderer/htmlRenderer.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport type { DocIR } from './types.js';\nimport { enrichSchemaSection } from '../parser/schemaParser.js';\nimport type { ManifestParseResult } from '../parser/manifestParser.js';\n\n/**\n * Build a complete Doc IR from parsed sources\n */\nexport function buildDocIR(manifest: ManifestParseResult): DocIR {\n const enrichedInputs = enrichSchemaSection(manifest.inputs);\n\n const ir: DocIR = {\n version: '1.0.0',\n generatedAt: new Date().toISOString(),\n determinismKey: '', // Computed below\n entity: manifest.entity,\n inputs: enrichedInputs,\n constraints: manifest.constraints,\n lifecycle: manifest.lifecycle,\n provenance: {\n entity: 'manifest',\n inputs: 'manifest',\n },\n };\n\n // Compute determinism key\n ir.determinismKey = computeDeterminismKey(ir);\n\n return ir;\n}\n\n/**\n * Compute SHA-256 determinism key for caching and diffing\n */\nexport function computeDeterminismKey(ir: Omit<DocIR, 'determinismKey' | 'generatedAt'>): string {\n const canonical = JSON.stringify({\n entity: ir.entity,\n inputs: ir.inputs,\n constraints: ir.constraints,\n lifecycle: ir.lifecycle,\n });\n\n const hash = createHash('sha256').update(canonical).digest('hex');\n return `sha256:${hash}`;\n}\n","import type { Parameter, SchemaSection } from '../ir/types.js';\n\ninterface JSONSchema {\n type?: string;\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n default?: unknown;\n enum?: unknown[];\n minimum?: number;\n maximum?: number;\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n items?: JSONSchema;\n $ref?: string;\n}\n\n/**\n * Parse JSON Schema into a list of parameters for documentation\n */\nexport function parseSchema(schema: Record<string, unknown> | undefined): Parameter[] {\n if (!schema) return [];\n\n const jsonSchema = schema as JSONSchema;\n const parameters: Parameter[] = [];\n const required = new Set(jsonSchema.required ?? []);\n\n if (jsonSchema.properties) {\n for (const [name, propSchema] of Object.entries(jsonSchema.properties)) {\n parameters.push(parseProperty(name, propSchema, required.has(name)));\n }\n }\n\n return parameters;\n}\n\nfunction parseProperty(name: string, schema: JSONSchema, isRequired: boolean): Parameter {\n const param: Parameter = {\n name,\n type: resolveType(schema),\n required: isRequired,\n };\n\n if (schema.description) {\n param.description = schema.description;\n }\n\n if (schema.default !== undefined) {\n param.default = schema.default;\n }\n\n if (schema.enum) {\n param.enum = schema.enum;\n }\n\n // Build constraints string\n const constraints = buildConstraints(schema);\n if (constraints) {\n param.constraints = constraints;\n }\n\n return param;\n}\n\nfunction resolveType(schema: JSONSchema): string {\n if (schema.$ref) {\n // Extract type name from $ref\n const refParts = schema.$ref.split('/');\n return refParts[refParts.length - 1];\n }\n\n if (schema.enum) {\n return 'enum';\n }\n\n if (schema.type === 'array' && schema.items) {\n return `${resolveType(schema.items)}[]`;\n }\n\n return schema.type ?? 'unknown';\n}\n\nfunction buildConstraints(schema: JSONSchema): string | undefined {\n const parts: string[] = [];\n\n if (schema.minimum !== undefined) {\n parts.push(`min: ${schema.minimum}`);\n }\n if (schema.maximum !== undefined) {\n parts.push(`max: ${schema.maximum}`);\n }\n if (schema.minLength !== undefined) {\n parts.push(`minLength: ${schema.minLength}`);\n }\n if (schema.maxLength !== undefined) {\n parts.push(`maxLength: ${schema.maxLength}`);\n }\n if (schema.pattern) {\n parts.push(`pattern: ${schema.pattern}`);\n }\n\n return parts.length > 0 ? parts.join(', ') : undefined;\n}\n\n/**\n * Enrich a SchemaSection with parsed parameters\n */\nexport function enrichSchemaSection(section: SchemaSection): SchemaSection {\n return {\n ...section,\n parameters: parseSchema(section.schema),\n };\n}\n","import type { DocIR, ProvenanceSource, Capability, SideEffect, ErrorDefinition } from './types.js';\nimport { enrichSchemaSection } from '../parser/schemaParser.js';\nimport { computeDeterminismKey } from './builder.js';\n\n/**\n * Precedence order (highest wins):\n * 1. introspection (runtime truth)\n * 2. manifest (static contract)\n * 3. overlay (narrative metadata)\n * 4. narrative (explanatory context)\n */\nconst PRECEDENCE: ProvenanceSource[] = ['introspection', 'manifest', 'overlay', 'narrative'];\n\nfunction getPrecedence(source: ProvenanceSource): number {\n const index = PRECEDENCE.indexOf(source);\n return index === -1 ? PRECEDENCE.length : index;\n}\n\n/**\n * Merge multiple Doc IR sources with deterministic precedence\n * Lower precedence number = higher priority\n */\nexport function mergeDocIR(\n sources: Array<{ ir: Partial<DocIR>; source: ProvenanceSource }>\n): DocIR {\n // Sort by precedence (highest priority first)\n const sorted = [...sources].sort((a, b) => getPrecedence(a.source) - getPrecedence(b.source));\n\n // Start with empty IR\n let merged: DocIR = {\n version: '1.0.0',\n generatedAt: new Date().toISOString(),\n determinismKey: '',\n entity: { type: 'tool', id: '', version: '' },\n inputs: { provenance: 'manifest' },\n provenance: {},\n };\n\n // Merge in order (highest priority first, so they win)\n for (const { ir, source } of sorted) {\n merged = mergePartial(merged, ir, source);\n }\n\n // Enrich inputs with parsed parameters\n if (merged.inputs?.schema) {\n merged.inputs = enrichSchemaSection(merged.inputs);\n }\n if (merged.outputs?.schema) {\n merged.outputs = enrichSchemaSection(merged.outputs);\n }\n\n // Compute final determinism key\n merged.determinismKey = computeDeterminismKey(merged);\n\n return merged;\n}\n\nfunction mergePartial(base: DocIR, partial: Partial<DocIR>, source: ProvenanceSource): DocIR {\n const result = { ...base };\n\n // Entity - higher priority wins\n if (partial.entity) {\n const baseProvenance = base.provenance?.entity;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.entity = {\n ...result.entity,\n ...partial.entity,\n };\n result.provenance = { ...result.provenance, entity: source };\n }\n }\n\n // Inputs - higher priority wins\n if (partial.inputs) {\n const baseProvenance = base.inputs?.provenance;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.inputs = {\n ...result.inputs,\n ...partial.inputs,\n provenance: source,\n };\n result.provenance = { ...result.provenance, inputs: source };\n }\n }\n\n // Outputs - higher priority wins\n if (partial.outputs) {\n const baseProvenance = base.outputs?.provenance;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.outputs = {\n ...result.outputs,\n ...partial.outputs,\n provenance: source,\n };\n result.provenance = { ...result.provenance, outputs: source };\n }\n }\n\n // Overview - merge additively, lower priority adds but doesn't override\n if (partial.overview) {\n result.overview = result.overview ?? {};\n\n if (partial.overview.intent && !result.overview.intent) {\n result.overview.intent = partial.overview.intent;\n }\n\n // Merge use cases (dedupe)\n if (partial.overview.useCases) {\n const existing = new Set(result.overview.useCases ?? []);\n for (const useCase of partial.overview.useCases) {\n existing.add(useCase);\n }\n result.overview.useCases = [...existing];\n }\n\n // Merge side effects (dedupe by type)\n if (partial.overview.sideEffects) {\n result.overview.sideEffects = mergeSideEffects(\n result.overview.sideEffects ?? [],\n partial.overview.sideEffects,\n source\n );\n }\n }\n\n // Constraints - merge capabilities\n if (partial.constraints) {\n result.constraints = result.constraints ?? {};\n\n if (partial.constraints.capabilities) {\n result.constraints.capabilities = mergeCapabilities(\n result.constraints.capabilities ?? [],\n partial.constraints.capabilities,\n source\n );\n }\n\n // Higher priority wins for scalar values\n if (partial.constraints.timeoutMs !== undefined) {\n const baseProvenance = base.provenance?.constraints;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.constraints.timeoutMs = partial.constraints.timeoutMs;\n }\n }\n\n if (partial.constraints.resourceLimits) {\n const baseProvenance = base.provenance?.constraints;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.constraints.resourceLimits = {\n ...result.constraints.resourceLimits,\n ...partial.constraints.resourceLimits,\n };\n }\n }\n }\n\n // Narrative - always additive (lower priority adds context)\n if (partial.narrative) {\n result.narrative = result.narrative ?? {};\n\n if (partial.narrative.examples) {\n result.narrative.examples = [\n ...(result.narrative.examples ?? []),\n ...partial.narrative.examples,\n ];\n }\n\n if (partial.narrative.notes) {\n result.narrative.notes = [...(result.narrative.notes ?? []), ...partial.narrative.notes];\n }\n }\n\n // Errors - merge by code\n if (partial.errors) {\n result.errors = mergeErrors(result.errors ?? [], partial.errors, source);\n }\n\n // Lifecycle - higher priority wins\n if (partial.lifecycle) {\n const baseProvenance = base.provenance?.lifecycle;\n if (!baseProvenance || getPrecedence(source) <= getPrecedence(baseProvenance)) {\n result.lifecycle = {\n ...result.lifecycle,\n ...partial.lifecycle,\n };\n result.provenance = { ...result.provenance, lifecycle: source };\n }\n }\n\n return result;\n}\n\nfunction mergeSideEffects(\n base: SideEffect[],\n incoming: SideEffect[],\n source: ProvenanceSource\n): SideEffect[] {\n const byType = new Map<string, SideEffect>();\n\n // Add base effects\n for (const effect of base) {\n byType.set(effect.type, effect);\n }\n\n // Add/override with incoming (higher priority wins)\n for (const effect of incoming) {\n const existing = byType.get(effect.type);\n if (!existing || getPrecedence(source) <= getPrecedence(existing.provenance ?? 'narrative')) {\n byType.set(effect.type, { ...effect, provenance: source });\n }\n }\n\n // Return in stable order\n return [...byType.values()].sort((a, b) => a.type.localeCompare(b.type));\n}\n\nfunction mergeCapabilities(\n base: Capability[],\n incoming: Capability[],\n source: ProvenanceSource\n): Capability[] {\n const byType = new Map<string, Capability>();\n\n // Add base capabilities\n for (const cap of base) {\n byType.set(cap.type, cap);\n }\n\n // Add/override with incoming (higher priority wins)\n for (const cap of incoming) {\n const existing = byType.get(cap.type);\n if (!existing || getPrecedence(source) <= getPrecedence(existing.provenance ?? 'narrative')) {\n byType.set(cap.type, { ...cap, provenance: source });\n }\n }\n\n // Return in stable order\n return [...byType.values()].sort((a, b) => a.type.localeCompare(b.type));\n}\n\nfunction mergeErrors(\n base: ErrorDefinition[] | undefined,\n incoming: ErrorDefinition[] | undefined,\n source: ProvenanceSource\n): ErrorDefinition[] | undefined {\n if (!base) return incoming;\n if (!incoming) return base;\n\n const byCode = new Map<string, ErrorDefinition>();\n\n for (const err of base) {\n byCode.set(err.code, err);\n }\n\n for (const err of incoming) {\n const existing = byCode.get(err.code);\n if (!existing || getPrecedence(source) <= getPrecedence(existing.provenance ?? 'narrative')) {\n byCode.set(err.code, { ...err, provenance: source });\n }\n }\n\n return [...byCode.values()].sort((a, b) => a.code.localeCompare(b.code));\n}\n","/**\n * Known capabilities allowlist\n * Safety-affecting capabilities trigger stricter validation\n */\n\nexport const KNOWN_CAPABILITIES = [\n 'network',\n 'filesystem',\n 'secrets',\n 'exec',\n 'subprocess',\n 'database',\n 'queue',\n] as const;\n\nexport type KnownCapability = (typeof KNOWN_CAPABILITIES)[number];\n\n/**\n * Capabilities that imply safety-critical operations\n * Unknown capabilities matching these patterns fail in --strict mode\n */\nexport const SAFETY_AFFECTING_PATTERNS = ['network', 'exec', 'subprocess', 'write', 'delete'];\n\nexport function isKnownCapability(capability: string): capability is KnownCapability {\n return KNOWN_CAPABILITIES.includes(capability as KnownCapability);\n}\n\nexport function isSafetyAffecting(capability: string): boolean {\n return SAFETY_AFFECTING_PATTERNS.some((pattern) =>\n capability.toLowerCase().includes(pattern.toLowerCase())\n );\n}\n","import type { DocIR, ProvenanceSource } from '../ir/types.js';\nimport { isKnownCapability, isSafetyAffecting } from '../capabilities.js';\n\nexport type ValidationSeverity = 'error' | 'warning';\n\nexport interface ValidationIssue {\n severity: ValidationSeverity;\n code: string;\n message: string;\n path?: string;\n provenance?: ProvenanceSource;\n}\n\nexport interface ValidationResult {\n valid: boolean;\n issues: ValidationIssue[];\n}\n\nexport interface ValidateOptions {\n strict?: boolean;\n}\n\n/**\n * Validate Doc IR for completeness and consistency\n */\nexport function validateDocIR(ir: DocIR, options: ValidateOptions = {}): ValidationResult {\n const issues: ValidationIssue[] = [];\n\n // Required field checks\n if (!ir.entity.id) {\n issues.push({\n severity: 'error',\n code: 'MISSING_TOOL_ID',\n message: 'Tool ID is required',\n path: 'entity.id',\n });\n }\n\n if (!ir.entity.version) {\n issues.push({\n severity: 'error',\n code: 'MISSING_VERSION',\n message: 'Version is required',\n path: 'entity.version',\n });\n }\n\n if (!ir.inputs?.schema && !ir.inputs?.parameters?.length) {\n issues.push({\n severity: 'error',\n code: 'MISSING_PARAMETERS_SCHEMA',\n message: 'Parameters schema is required',\n path: 'inputs',\n });\n }\n\n // Capability validation\n if (ir.constraints?.capabilities) {\n for (const cap of ir.constraints.capabilities) {\n if (!isKnownCapability(cap.type)) {\n const isSafety = isSafetyAffecting(cap.type);\n issues.push({\n severity: options.strict && isSafety ? 'error' : 'warning',\n code: 'UNKNOWN_CAPABILITY',\n message: `Unknown capability: ${cap.type}${isSafety ? ' (safety-affecting)' : ''}`,\n path: `constraints.capabilities.${cap.type}`,\n provenance: cap.provenance,\n });\n }\n }\n }\n\n // Structural contradiction checks\n issues.push(...checkStructuralContradictions(ir));\n\n const hasErrors = issues.some((i) => i.severity === 'error');\n\n return {\n valid: !hasErrors,\n issues,\n };\n}\n\n/**\n * Check for structural contradictions between sources\n */\nfunction checkStructuralContradictions(ir: DocIR): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n\n // Check if narrative mentions parameters not in schema\n if (ir.narrative?.notes && ir.inputs?.parameters) {\n const schemaParams = new Set(ir.inputs.parameters.map((p) => p.name.toLowerCase()));\n\n for (const note of ir.narrative.notes) {\n // Match patterns like \"parameter X\" or \"the X parameter\"\n const paramMentions = note.match(/(?:parameter|param)\\s+[`\"']?(\\w+)[`\"']?/gi) ?? [];\n const theParamMentions = note.match(/the\\s+[`\"']?(\\w+)[`\"']?\\s+parameter/gi) ?? [];\n\n for (const match of [...paramMentions, ...theParamMentions]) {\n const paramName = match.replace(/.*?[`\"']?(\\w+)[`\"']?.*/i, '$1').toLowerCase();\n if (paramName && !schemaParams.has(paramName) && paramName !== 'parameter') {\n issues.push({\n severity: 'error',\n code: 'NARRATIVE_REFERENCES_UNDEFINED_PARAM',\n message: `Narrative references parameter \"${paramName}\" not in schema`,\n path: 'narrative.notes',\n provenance: 'narrative',\n });\n }\n }\n }\n }\n\n // Check if examples use parameters not in schema\n if (ir.narrative?.examples && ir.inputs?.parameters) {\n const schemaParams = new Set(ir.inputs.parameters.map((p) => p.name));\n\n for (const example of ir.narrative.examples) {\n if (example.input && typeof example.input === 'object') {\n for (const key of Object.keys(example.input as Record<string, unknown>)) {\n if (!schemaParams.has(key)) {\n issues.push({\n severity: 'warning',\n code: 'EXAMPLE_USES_UNDEFINED_PARAM',\n message: `Example uses parameter \"${key}\" not in schema`,\n path: `narrative.examples.${example.title ?? 'unnamed'}`,\n provenance: 'narrative',\n });\n }\n }\n }\n }\n }\n\n // Check for side effect / capability contradictions\n if (ir.overview?.sideEffects && ir.constraints?.capabilities) {\n const capTypes = new Set(ir.constraints.capabilities.map((c) => c.type));\n\n for (const effect of ir.overview.sideEffects) {\n // Map side effect types to capability types\n const expectedCap = mapSideEffectToCapability(effect.type);\n if (expectedCap && !capTypes.has(expectedCap)) {\n issues.push({\n severity: 'error',\n code: 'SIDE_EFFECT_CAPABILITY_MISMATCH',\n message: `Side effect \"${effect.type}\" requires capability \"${expectedCap}\" which is not declared`,\n path: `overview.sideEffects.${effect.type}`,\n provenance: effect.provenance,\n });\n }\n }\n }\n\n return issues;\n}\n\nfunction mapSideEffectToCapability(effectType: string): string | null {\n const mapping: Record<string, string> = {\n filesystem: 'filesystem',\n network: 'network',\n secrets: 'secrets',\n exec: 'exec',\n subprocess: 'subprocess',\n database: 'database',\n queue: 'queue',\n };\n return mapping[effectType] ?? null;\n}\n\n/**\n * Format validation result for CLI output\n */\nexport function formatValidationResult(result: ValidationResult, repoPath: string): string {\n const lines: string[] = [];\n\n lines.push(`Validating: ${repoPath}`);\n lines.push('');\n\n if (result.valid) {\n lines.push('✓ Validation passed');\n } else {\n lines.push('✗ Validation failed');\n }\n lines.push('');\n\n const errors = result.issues.filter((i) => i.severity === 'error');\n const warnings = result.issues.filter((i) => i.severity === 'warning');\n\n if (errors.length > 0) {\n lines.push(`Errors (${errors.length}):`);\n for (const issue of errors) {\n lines.push(` ✗ [${issue.code}] ${issue.message}`);\n if (issue.path) {\n lines.push(` at ${issue.path}`);\n }\n }\n lines.push('');\n }\n\n if (warnings.length > 0) {\n lines.push(`Warnings (${warnings.length}):`);\n for (const issue of warnings) {\n lines.push(` ⚠ [${issue.code}] ${issue.message}`);\n if (issue.path) {\n lines.push(` at ${issue.path}`);\n }\n }\n lines.push('');\n }\n\n return lines.join('\\n');\n}\n","import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { DocIR, Capability, SchemaSection } from '../ir/types.js';\n\ninterface ToolManifest {\n tool_id: string;\n version: string;\n description?: string;\n execution_mode?: 'IN_PROCESS' | 'RUNNER';\n parameters?: Record<string, unknown>;\n capabilities?: {\n network?: string[];\n filesystem?: string[];\n secrets?: string[];\n };\n timeout_ms?: number;\n resource_limits?: {\n memory_mb?: number;\n cpu_cores?: number;\n };\n deprecation?: {\n deprecated_at: string;\n sunset_date: string;\n migration_url?: string;\n };\n}\n\nexport interface ManifestParseResult {\n entity: DocIR['entity'];\n inputs: SchemaSection;\n constraints?: DocIR['constraints'];\n lifecycle?: DocIR['lifecycle'];\n}\n\n/**\n * Parse an MCP tool manifest file into partial Doc IR\n */\nexport async function parseManifest(repoPath: string): Promise<ManifestParseResult> {\n const manifestPath = join(repoPath, 'manifest.json');\n\n let content: string;\n try {\n content = await readFile(manifestPath, 'utf-8');\n } catch {\n throw new Error(`Manifest not found: ${manifestPath}`);\n }\n\n let manifest: ToolManifest;\n try {\n manifest = JSON.parse(content) as ToolManifest;\n } catch {\n throw new Error(`Invalid JSON in manifest: ${manifestPath}`);\n }\n\n // Validate required fields\n if (!manifest.tool_id) {\n throw new Error('Manifest missing required field: tool_id');\n }\n if (!manifest.version) {\n throw new Error('Manifest missing required field: version');\n }\n\n // Build capabilities array\n const capabilities: Capability[] = [];\n if (manifest.capabilities) {\n for (const [type, values] of Object.entries(manifest.capabilities)) {\n if (Array.isArray(values) && values.length > 0) {\n capabilities.push({ type, values, provenance: 'manifest' });\n }\n }\n }\n\n const result: ManifestParseResult = {\n entity: {\n type: 'tool',\n id: manifest.tool_id,\n version: manifest.version,\n description: manifest.description,\n },\n inputs: {\n schema: manifest.parameters,\n provenance: 'manifest',\n },\n };\n\n // Add constraints if present\n if (capabilities.length > 0 || manifest.timeout_ms || manifest.resource_limits) {\n result.constraints = {\n capabilities: capabilities.length > 0 ? capabilities : undefined,\n timeoutMs: manifest.timeout_ms,\n resourceLimits: manifest.resource_limits\n ? {\n memoryMb: manifest.resource_limits.memory_mb,\n cpuCores: manifest.resource_limits.cpu_cores,\n }\n : undefined,\n };\n }\n\n // Add lifecycle if deprecation present\n if (manifest.deprecation) {\n result.lifecycle = {\n version: manifest.version,\n deprecation: {\n deprecatedAt: manifest.deprecation.deprecated_at,\n sunsetDate: manifest.deprecation.sunset_date,\n migrationUrl: manifest.deprecation.migration_url,\n },\n };\n }\n\n return result;\n}\n","import { Client } from '@modelcontextprotocol/sdk/client/index.js';\nimport { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';\nimport type { DocIR, SchemaSection, Capability, ProvenanceSource } from '../ir/types.js';\n\nexport interface IntrospectionResult {\n tools?: ToolInfo[];\n resources?: ResourceInfo[];\n prompts?: PromptInfo[];\n}\n\nexport interface ToolInfo {\n name: string;\n description?: string;\n inputSchema?: Record<string, unknown>;\n}\n\nexport interface ResourceInfo {\n uri: string;\n name: string;\n description?: string;\n mimeType?: string;\n}\n\nexport interface PromptInfo {\n name: string;\n description?: string;\n arguments?: Array<{\n name: string;\n description?: string;\n required?: boolean;\n }>;\n}\n\nexport interface IntrospectionOptions {\n serverCommand?: string;\n serverArgs?: string[];\n timeout?: number;\n}\n\n/**\n * Connect to an MCP server and introspect its capabilities\n */\nexport async function introspectMcpServer(\n options: IntrospectionOptions\n): Promise<IntrospectionResult> {\n if (!options.serverCommand) {\n throw new Error('Server command is required for introspection');\n }\n\n const transport = new StdioClientTransport({\n command: options.serverCommand,\n args: options.serverArgs ?? [],\n });\n\n const client = new Client(\n {\n name: 'odd-docs',\n version: '0.1.0',\n },\n {\n capabilities: {},\n }\n );\n\n const result: IntrospectionResult = {};\n\n try {\n await client.connect(transport);\n\n // Get tools\n try {\n const toolsResponse = await client.listTools();\n result.tools = toolsResponse.tools.map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema as Record<string, unknown>,\n }));\n } catch {\n // tools/list not supported\n }\n\n // Get resources\n try {\n const resourcesResponse = await client.listResources();\n result.resources = resourcesResponse.resources.map((r) => ({\n uri: r.uri,\n name: r.name,\n description: r.description,\n mimeType: r.mimeType,\n }));\n } catch {\n // resources/list not supported\n }\n\n // Get prompts\n try {\n const promptsResponse = await client.listPrompts();\n result.prompts = promptsResponse.prompts.map((p) => ({\n name: p.name,\n description: p.description,\n arguments: p.arguments,\n }));\n } catch {\n // prompts/list not supported\n }\n } finally {\n await client.close();\n }\n\n return result;\n}\n\n/**\n * Convert introspection result to partial Doc IR\n */\nexport function introspectionToPartialIR(\n introspection: IntrospectionResult,\n toolName?: string\n): Partial<DocIR> {\n const provenance: ProvenanceSource = 'introspection';\n\n // Find the specific tool if name provided\n const tool = toolName\n ? introspection.tools?.find((t) => t.name === toolName)\n : introspection.tools?.[0];\n\n if (!tool) {\n return { provenance: { source: provenance } };\n }\n\n const inputs: SchemaSection = {\n schema: tool.inputSchema,\n provenance,\n };\n\n const capabilities: Capability[] = [];\n\n // Infer capabilities from resources\n if (introspection.resources?.length) {\n capabilities.push({\n type: 'resources',\n values: introspection.resources.map((r) => r.uri),\n provenance,\n });\n }\n\n return {\n entity: {\n type: 'tool',\n id: tool.name,\n version: '0.0.0', // Runtime doesn't provide version\n description: tool.description,\n },\n inputs,\n constraints: capabilities.length > 0 ? { capabilities } : undefined,\n provenance: {\n entity: provenance,\n inputs: provenance,\n },\n };\n}\n\n/**\n * Parse introspect URL/command\n * Supports:\n * - stdio://command args...\n * - npx package-name\n * - node script.js\n */\nexport function parseIntrospectTarget(target: string): IntrospectionOptions {\n if (target.startsWith('stdio://')) {\n const parts = target.slice(8).split(' ');\n return {\n serverCommand: parts[0],\n serverArgs: parts.slice(1),\n };\n }\n\n if (target.startsWith('npx ')) {\n const parts = target.split(' ');\n return {\n serverCommand: 'npx',\n serverArgs: parts.slice(1),\n };\n }\n\n if (target.startsWith('node ')) {\n const parts = target.split(' ');\n return {\n serverCommand: 'node',\n serverArgs: parts.slice(1),\n };\n }\n\n // Default: treat as command\n const parts = target.split(' ');\n return {\n serverCommand: parts[0],\n serverArgs: parts.slice(1),\n };\n}\n","import type { DocIR, Parameter, ProvenanceSource } from '../ir/types.js';\n\n/**\n * Render Doc IR to Markdown\n */\nexport function renderMarkdown(ir: DocIR): string {\n const lines: string[] = [];\n\n // Header\n lines.push(`# ${ir.entity.id}`);\n lines.push('');\n lines.push(`**Version:** ${ir.entity.version} `);\n lines.push(`**Type:** ${ir.entity.type} `);\n if (ir.entity.description) {\n lines.push('');\n lines.push(ir.entity.description);\n }\n lines.push('');\n\n // Overview\n if (ir.overview) {\n lines.push('## Overview');\n lines.push('');\n if (ir.overview.intent) {\n lines.push(`**Intent:** ${ir.overview.intent}`);\n lines.push('');\n }\n if (ir.overview.useCases?.length) {\n lines.push('### Use Cases');\n lines.push('');\n for (const useCase of ir.overview.useCases) {\n lines.push(`- ${useCase}`);\n }\n lines.push('');\n }\n if (ir.overview.sideEffects?.length) {\n lines.push('### Side Effects');\n lines.push('');\n for (const effect of ir.overview.sideEffects) {\n lines.push(\n `- **${effect.type}**: ${effect.description} ${provenanceBadge(effect.provenance)}`\n );\n }\n lines.push('');\n }\n }\n\n // Inputs\n if (ir.inputs?.parameters?.length) {\n lines.push('## Inputs');\n lines.push('');\n lines.push(provenanceBadge(ir.inputs.provenance));\n lines.push('');\n lines.push(renderParameterTable(ir.inputs.parameters));\n lines.push('');\n }\n\n // Outputs\n if (ir.outputs?.parameters?.length) {\n lines.push('## Outputs');\n lines.push('');\n lines.push(provenanceBadge(ir.outputs.provenance));\n lines.push('');\n lines.push(renderParameterTable(ir.outputs.parameters));\n lines.push('');\n }\n\n // Constraints\n if (ir.constraints) {\n lines.push('## Constraints');\n lines.push('');\n if (ir.constraints.capabilities?.length) {\n lines.push('### Capabilities');\n lines.push('');\n for (const cap of ir.constraints.capabilities) {\n const values = cap.values?.join(', ') ?? 'enabled';\n lines.push(`- **${cap.type}**: ${values} ${provenanceBadge(cap.provenance)}`);\n }\n lines.push('');\n }\n if (ir.constraints.timeoutMs) {\n lines.push(`**Timeout:** ${ir.constraints.timeoutMs}ms`);\n lines.push('');\n }\n if (ir.constraints.resourceLimits) {\n lines.push('### Resource Limits');\n lines.push('');\n if (ir.constraints.resourceLimits.memoryMb) {\n lines.push(`- Memory: ${ir.constraints.resourceLimits.memoryMb} MB`);\n }\n if (ir.constraints.resourceLimits.cpuCores) {\n lines.push(`- CPU: ${ir.constraints.resourceLimits.cpuCores} cores`);\n }\n lines.push('');\n }\n }\n\n // Errors\n if (ir.errors?.length) {\n lines.push('## Errors');\n lines.push('');\n lines.push('| Code | Description | Recovery |');\n lines.push('|------|-------------|----------|');\n for (const err of ir.errors) {\n lines.push(`| \\`${err.code}\\` | ${err.description ?? ''} | ${err.recovery ?? ''} |`);\n }\n lines.push('');\n }\n\n // Lifecycle\n if (ir.lifecycle?.deprecation) {\n lines.push('## Lifecycle');\n lines.push('');\n lines.push('> [!WARNING]');\n lines.push(`> This tool is deprecated as of ${ir.lifecycle.deprecation.deprecatedAt}.`);\n lines.push(`> Sunset date: ${ir.lifecycle.deprecation.sunsetDate}`);\n if (ir.lifecycle.deprecation.migrationUrl) {\n lines.push(`> Migration guide: ${ir.lifecycle.deprecation.migrationUrl}`);\n }\n lines.push('');\n }\n\n // Examples\n if (ir.narrative?.examples?.length) {\n lines.push('## Examples');\n lines.push('');\n for (const example of ir.narrative.examples) {\n if (example.title) {\n lines.push(`### ${example.title}`);\n lines.push('');\n }\n if (example.description) {\n lines.push(example.description);\n lines.push('');\n }\n if (example.input) {\n lines.push('**Input:**');\n lines.push('```json');\n lines.push(JSON.stringify(example.input, null, 2));\n lines.push('```');\n lines.push('');\n }\n if (example.output) {\n lines.push('**Output:**');\n lines.push('```json');\n lines.push(JSON.stringify(example.output, null, 2));\n lines.push('```');\n lines.push('');\n }\n }\n }\n\n // Notes\n if (ir.narrative?.notes?.length) {\n lines.push('## Notes');\n lines.push('');\n lines.push('*[author notes]*');\n lines.push('');\n for (const note of ir.narrative.notes) {\n lines.push(note);\n lines.push('');\n }\n }\n\n // Footer\n lines.push('---');\n lines.push('');\n lines.push(`*Generated at ${ir.generatedAt}* `);\n lines.push(`*Determinism key: \\`${ir.determinismKey}\\`*`);\n\n return lines.join('\\n');\n}\n\nfunction renderParameterTable(params: Parameter[]): string {\n const lines: string[] = [];\n lines.push('| Name | Type | Required | Default | Description |');\n lines.push('|------|------|----------|---------|-------------|');\n\n for (const param of params) {\n const required = param.required ? '✓' : '';\n const defaultVal = param.default !== undefined ? `\\`${JSON.stringify(param.default)}\\`` : '';\n const desc = param.description ?? '';\n lines.push(`| \\`${param.name}\\` | \\`${param.type}\\` | ${required} | ${defaultVal} | ${desc} |`);\n }\n\n return lines.join('\\n');\n}\n\nfunction provenanceBadge(source?: ProvenanceSource): string {\n if (!source) return '';\n const badges: Record<ProvenanceSource, string> = {\n introspection: '`[from introspection]`',\n manifest: '`[from schema]`',\n overlay: '`[from overlay]`',\n narrative: '`[author notes]`',\n };\n return badges[source] ?? '';\n}\n","import { marked } from 'marked';\nimport type { DocIR } from '../ir/types.js';\nimport { renderMarkdown } from './markdownRenderer.js';\n\n/**\n * Render Doc IR to static HTML\n */\nexport function renderHTML(ir: DocIR): string {\n // First render to markdown, then convert to HTML\n const markdown = renderMarkdown(ir);\n const htmlContent = marked.parse(markdown) as string;\n\n return `<!DOCTYPE html>\n<html lang=\"en\" data-theme=\"light\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <meta name=\"description\" content=\"${escapeHtml(ir.entity.description ?? `Documentation for ${ir.entity.id}`)}\">\n <title>${escapeHtml(ir.entity.id)} - odd-docs</title>\n <style>\n${getThemeStyles()}\n </style>\n</head>\n<body>\n <div class=\"container\">\n <header>\n <nav class=\"breadcrumb\">\n <a href=\"index.html\">Home</a> / <span>${escapeHtml(ir.entity.id)}</span>\n </nav>\n </header>\n <main class=\"content\">\n${htmlContent}\n </main>\n <footer>\n <p class=\"meta\">\n Generated by <a href=\"https://github.com/oddessentials/odd-docs\">odd-docs</a> at ${ir.generatedAt}\n </p>\n <p class=\"determinism\">\n <code>${ir.determinismKey}</code>\n </p>\n </footer>\n </div>\n <script>\n${getThemeScript()}\n </script>\n</body>\n</html>`;\n}\n\n/**\n * Generate index page for multiple docs\n */\nexport function renderIndexHTML(docs: DocIR[]): string {\n const items = docs\n .map(\n (ir) => `\n <li>\n <a href=\"${ir.entity.id}.html\">\n <strong>${escapeHtml(ir.entity.id)}</strong>\n <span class=\"version\">v${ir.entity.version}</span>\n </a>\n <p>${escapeHtml(ir.entity.description ?? '')}</p>\n </li>`\n )\n .join('\\n');\n\n return `<!DOCTYPE html>\n<html lang=\"en\" data-theme=\"light\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Documentation - odd-docs</title>\n <style>\n${getThemeStyles()}\n </style>\n</head>\n<body>\n <div class=\"container\">\n <header>\n <h1>Documentation</h1>\n </header>\n <main class=\"content\">\n <ul class=\"doc-list\">\n${items}\n </ul>\n </main>\n <footer>\n <p class=\"meta\">Generated by <a href=\"https://github.com/oddessentials/odd-docs\">odd-docs</a></p>\n </footer>\n </div>\n <script>\n${getThemeScript()}\n </script>\n</body>\n</html>`;\n}\n\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&#039;');\n}\n\nfunction getThemeStyles(): string {\n return `\n /* CSS Variables for theming */\n :root {\n /* Colors - neutral palette */\n --color-bg: #ffffff;\n --color-bg-secondary: #f8f9fa;\n --color-text: #1a1a2e;\n --color-text-muted: #6c757d;\n --color-border: #dee2e6;\n --color-link: #0066cc;\n --color-link-hover: #004499;\n --color-accent: #0066cc;\n --color-success: #28a745;\n --color-warning: #ffc107;\n --color-error: #dc3545;\n \n /* Typography */\n --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;\n --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;\n --font-size-base: 16px;\n --line-height: 1.6;\n \n /* Spacing */\n --space-xs: 0.25rem;\n --space-sm: 0.5rem;\n --space-md: 1rem;\n --space-lg: 1.5rem;\n --space-xl: 2rem;\n \n /* Layout */\n --max-width: 800px;\n --border-radius: 4px;\n }\n \n [data-theme=\"dark\"] {\n --color-bg: #1a1a2e;\n --color-bg-secondary: #16213e;\n --color-text: #e8e8e8;\n --color-text-muted: #a0a0a0;\n --color-border: #3a3a5e;\n --color-link: #66b3ff;\n --color-link-hover: #99ccff;\n }\n \n /* Reset */\n *, *::before, *::after {\n box-sizing: border-box;\n }\n \n body {\n margin: 0;\n padding: 0;\n font-family: var(--font-sans);\n font-size: var(--font-size-base);\n line-height: var(--line-height);\n color: var(--color-text);\n background: var(--color-bg);\n }\n \n /* Container */\n .container {\n max-width: var(--max-width);\n margin: 0 auto;\n padding: var(--space-lg);\n }\n \n /* Typography */\n h1, h2, h3, h4, h5, h6 {\n margin-top: var(--space-xl);\n margin-bottom: var(--space-md);\n line-height: 1.3;\n }\n \n h1 { font-size: 2rem; }\n h2 { font-size: 1.5rem; border-bottom: 1px solid var(--color-border); padding-bottom: var(--space-sm); }\n h3 { font-size: 1.25rem; }\n \n p { margin: var(--space-md) 0; }\n \n a {\n color: var(--color-link);\n text-decoration: none;\n }\n \n a:hover {\n color: var(--color-link-hover);\n text-decoration: underline;\n }\n \n /* Code */\n code {\n font-family: var(--font-mono);\n font-size: 0.9em;\n background: var(--color-bg-secondary);\n padding: var(--space-xs) var(--space-sm);\n border-radius: var(--border-radius);\n }\n \n pre {\n background: var(--color-bg-secondary);\n padding: var(--space-md);\n border-radius: var(--border-radius);\n overflow-x: auto;\n }\n \n pre code {\n background: none;\n padding: 0;\n }\n \n /* Tables */\n table {\n width: 100%;\n border-collapse: collapse;\n margin: var(--space-md) 0;\n }\n \n th, td {\n padding: var(--space-sm) var(--space-md);\n border: 1px solid var(--color-border);\n text-align: left;\n }\n \n th {\n background: var(--color-bg-secondary);\n font-weight: 600;\n }\n \n /* Provenance badges */\n code[class*=\"from\"] {\n font-size: 0.75em;\n color: var(--color-text-muted);\n background: transparent;\n }\n \n /* Blockquotes (for warnings/notes) */\n blockquote {\n margin: var(--space-md) 0;\n padding: var(--space-md);\n border-left: 4px solid var(--color-warning);\n background: var(--color-bg-secondary);\n }\n \n blockquote p:first-child { margin-top: 0; }\n blockquote p:last-child { margin-bottom: 0; }\n \n /* Lists */\n ul, ol {\n padding-left: var(--space-lg);\n }\n \n li { margin: var(--space-sm) 0; }\n \n /* Doc list (index page) */\n .doc-list {\n list-style: none;\n padding: 0;\n }\n \n .doc-list li {\n padding: var(--space-md);\n border: 1px solid var(--color-border);\n border-radius: var(--border-radius);\n margin-bottom: var(--space-md);\n }\n \n .doc-list a {\n display: flex;\n align-items: center;\n gap: var(--space-sm);\n }\n \n .doc-list .version {\n color: var(--color-text-muted);\n font-size: 0.875em;\n }\n \n .doc-list p {\n margin: var(--space-sm) 0 0;\n color: var(--color-text-muted);\n }\n \n /* Header */\n header {\n margin-bottom: var(--space-lg);\n }\n \n .breadcrumb {\n font-size: 0.875em;\n color: var(--color-text-muted);\n }\n \n .breadcrumb a {\n color: inherit;\n }\n \n /* Footer */\n footer {\n margin-top: var(--space-xl);\n padding-top: var(--space-lg);\n border-top: 1px solid var(--color-border);\n font-size: 0.875em;\n color: var(--color-text-muted);\n }\n \n .determinism code {\n font-size: 0.75em;\n }\n \n /* Theme toggle */\n .theme-toggle {\n position: fixed;\n top: var(--space-md);\n right: var(--space-md);\n padding: var(--space-sm) var(--space-md);\n border: 1px solid var(--color-border);\n border-radius: var(--border-radius);\n background: var(--color-bg);\n cursor: pointer;\n font-size: 0.875em;\n }\n \n /* Responsive */\n @media (max-width: 600px) {\n .container { padding: var(--space-md); }\n h1 { font-size: 1.5rem; }\n h2 { font-size: 1.25rem; }\n table { font-size: 0.875em; }\n }\n `;\n}\n\nfunction getThemeScript(): string {\n return `\n // Theme toggle\n const toggle = document.createElement('button');\n toggle.className = 'theme-toggle';\n toggle.textContent = '🌙';\n toggle.onclick = () => {\n const html = document.documentElement;\n const isDark = html.dataset.theme === 'dark';\n html.dataset.theme = isDark ? 'light' : 'dark';\n toggle.textContent = isDark ? '🌙' : '☀️';\n localStorage.setItem('theme', html.dataset.theme);\n };\n document.body.appendChild(toggle);\n \n // Restore saved theme\n const saved = localStorage.getItem('theme');\n if (saved) {\n document.documentElement.dataset.theme = saved;\n toggle.textContent = saved === 'dark' ? '☀️' : '🌙';\n } else if (window.matchMedia('(prefers-color-scheme: dark)').matches) {\n document.documentElement.dataset.theme = 'dark';\n toggle.textContent = '☀️';\n }\n `;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;;;ACqBpB,SAAS,YAAY,QAA0D;AACpF,MAAI,CAAC,OAAQ,QAAO,CAAC;AAErB,QAAM,aAAa;AACnB,QAAM,aAA0B,CAAC;AACjC,QAAM,WAAW,IAAI,IAAI,WAAW,YAAY,CAAC,CAAC;AAElD,MAAI,WAAW,YAAY;AACzB,eAAW,CAAC,MAAM,UAAU,KAAK,OAAO,QAAQ,WAAW,UAAU,GAAG;AACtE,iBAAW,KAAK,cAAc,MAAM,YAAY,SAAS,IAAI,IAAI,CAAC,CAAC;AAAA,IACrE;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,cAAc,MAAc,QAAoB,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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBT;","names":["parts"]}
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@oddessentials/odd-docs",
3
+ "version": "2.0.0",
4
+ "description": "MCP-native documentation generator for clients, servers, and tools",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "odd-docs": "dist/cli/index.js"
10
+ },
11
+ "scripts": {
12
+ "build": "tsup",
13
+ "dev": "tsup --watch",
14
+ "test": "vitest run",
15
+ "test:watch": "vitest",
16
+ "test:coverage": "vitest run --coverage",
17
+ "lint": "eslint src",
18
+ "lint:fix": "eslint src --fix",
19
+ "format": "prettier --write .",
20
+ "format:check": "prettier --check .",
21
+ "typecheck": "tsc --noEmit",
22
+ "clean": "rimraf dist",
23
+ "ci": "npm run lint && npm run format:check && npm run typecheck && npm run build && npm run test",
24
+ "release:dry-run": "semantic-release --dry-run",
25
+ "prepare": "husky"
26
+ },
27
+ "keywords": [
28
+ "mcp",
29
+ "documentation",
30
+ "cli",
31
+ "odd-essentials"
32
+ ],
33
+ "author": "Odd Essentials",
34
+ "license": "SEE LICENSE IN LICENSE",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/oddessentials/odd-docs.git"
38
+ },
39
+ "engines": {
40
+ "node": ">=22.0.0"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "templates"
48
+ ],
49
+ "dependencies": {
50
+ "@adobe/jsonschema2md": "^8.0.0",
51
+ "@modelcontextprotocol/sdk": "^1.0.0",
52
+ "ajv": "^8.17.0",
53
+ "commander": "^13.0.0",
54
+ "marked": "^15.0.0",
55
+ "open": "^11.0.0",
56
+ "yaml": "^2.7.0"
57
+ },
58
+ "devDependencies": {
59
+ "@commitlint/cli": "^19.0.0",
60
+ "@commitlint/config-conventional": "^19.0.0",
61
+ "@semantic-release/changelog": "^6.0.3",
62
+ "@semantic-release/git": "^10.0.1",
63
+ "@semantic-release/github": "^12.0.2",
64
+ "@types/node": "^22.0.0",
65
+ "@vitest/coverage-v8": "^3.2.4",
66
+ "eslint": "^9.0.0",
67
+ "husky": "^9.0.0",
68
+ "lint-staged": "^15.0.0",
69
+ "prettier": "^3.4.0",
70
+ "rimraf": "^6.1.2",
71
+ "semantic-release": "^25.0.2",
72
+ "tsup": "^8.0.0",
73
+ "typescript": "^5.7.0",
74
+ "typescript-eslint": "^8.0.0",
75
+ "vitest": "^3.0.0"
76
+ },
77
+ "lint-staged": {
78
+ "*.{ts,js}": [
79
+ "eslint --fix",
80
+ "prettier --write"
81
+ ],
82
+ "*.{json,md,yaml,yml}": [
83
+ "prettier --write"
84
+ ]
85
+ }
86
+ }