Skip to content

Provide pretty-printed schema in web UI #116

@IanMayo

Description

@IanMayo

APM Task Assignment: Enhanced Pretty-Printed JSON Schema Documentation in Tool Vault SPA

1. Agent Role & APM Context

You are activated as an Implementation Agent within the Agentic Project Management (APM) framework for the Future Debrief Tool Vault Packager enhancement project. Your role is to execute the assigned schema documentation task diligently while logging all work meticulously to the project's Memory Bank. You will work within the existing monorepo architecture, specifically focusing on the libs/tool-vault-packager package which uses npm (not pnpm) for dependency management.

2. Enhanced Task Assignment

Objective: Implement enhanced pretty-printed schema documentation with cross-reference navigation and relationship visualization to improve accessibility for non-technical users.

Detailed Action Steps:

Phase 1: Enhanced Backend Schema Documentation Generation

  • Integrate json-schema-for-humans library into the Python packaging system
    • Install json-schema-for-humans package in libs/tool-vault-packager/requirements.txt
    • Use the js_offline template for interactive SPA-compatible output
  • Implement enhanced schema relationship analysis in packager.py
    • Add schema cross-reference discovery and mapping
    • Build relationship graphs showing "references" and "referenced by" connections
    • Generate navigation data for interactive linking between schemas
  • Modify packager.py to generate enhanced schema documentation during tool packaging
    • Generate interactive HTML with embedded cross-reference links
    • Implement file path-based categorization (features/, states/, commands/, etc.)
    • Create static HTML files with relationship navigation embedded
    • Strict validation: Fail build process if any schema documentation cannot be generated
  • Extend server.py with hybrid API strategy
    • Add /api/tools/{tool_name}/schema-docs endpoint for individual schema docs
    • Implement static file serving for generated HTML documentation
    • Add proper error handling with build failure on documentation generation errors
    • Ensure CORS compatibility for SPA integration

Phase 2: Frontend Integration with Relationship Visualization

  • Modify InfoTab.tsx (libs/tool-vault-packager/spa/src/components/InfoTab.tsx)
    • Target Lines 98-105: Replace JSON.stringify() raw schema display
    • Implement new PrettySchemaDisplay component integration with cross-reference support
    • Add relationship navigation: "References" and "Referenced by" sections
    • Implement interactive schema linking with click-through navigation
  • Create Enhanced PrettySchemaDisplay.tsx component
    • Fetch and render cross-referenced schema HTML from API endpoints
    • Implement schema relationship visualization with clickable links
    • Add interactive navigation between related schemas
    • Handle loading states, error states, and build failure scenarios
    • Implement proper sanitization for embedded HTML content with cross-references
  • Update ToolView.tsx for relationship data
    • Add state management for schema relationship data
    • Ensure proper data flow for cross-reference navigation
    • Support schema categorization based on file paths

Phase 3: Enhanced Interactive Features

  • Implement Schema Relationship Navigation
    • Cross-reference links between schemas with hover previews
    • "References" and "Referenced by" sections with clickable navigation
    • Breadcrumb navigation showing schema relationships
    • Interactive schema category browsing
  • Add File Path-Based Categorization
    • Automatic categorization based on schema file locations
    • Category-based navigation and filtering
    • Visual indicators for schema types and relationships

Phase 4: Build System Integration with Strict Validation

  • Update npm build scripts in libs/tool-vault-packager/package.json
    • Ensure enhanced schema documentation generation is included in build process
    • Implement strict validation: Build must fail if schema docs cannot be generated
    • Verify SPA build includes new relationship navigation components
  • Test package creation with enhanced documentation
    • Verify .pyz packages include generated schema docs with cross-references
    • Test both development server and production package modes
    • Validate that build fails appropriately on documentation generation errors

3. Enhanced Technical Specifications & Constraints

Architecture Requirements:

  • Maintain existing dual runtime system (development vs production .pyz)
  • Follow Tool Vault Packager npm-based dependency management (not pnpm)
  • Preserve existing API structure and add new endpoints without breaking changes
  • Ensure generated documentation with cross-references works offline in .pyz packages
  • Strict validation: Any schema documentation generation failure must fail the entire build

Enhanced Component Specifications:

// Enhanced component interface with relationship support
interface PrettySchemaDisplayProps {
  schema: JSONSchema;
  toolName: string;
  relationships?: SchemaRelationships;
  onSchemaNavigate?: (schemaName: string) => void;
  fallbackToRaw?: boolean;
}

interface SchemaRelationships {
  references: Array<{name: string, title: string, category: string}>;
  referencedBy: Array<{name: string, title: string, category: string}>;
}

Enhanced UX Requirements:

  • Interactive schema relationship visualization with clickable navigation
  • File path-based categorization with visual indicators
  • Cross-reference hover previews and navigation breadcrumbs
  • Mobile-responsive design matching existing SPA theme
  • Screen reader accessibility for enhanced navigation features
  • Fast loading with appropriate caching for relationship data

Enhanced Python Integration:

  • Use json-schema-for-humans with js_offline template for interactivity
  • Implement schema relationship analysis and cross-reference mapping
  • Generate static HTML files with embedded navigation and relationships
  • Critical: Strict validation with build failure on any documentation generation error
  • File path-based automatic categorization system

4. Expected Enhanced Output & Deliverables

Success Criteria:

  • Tool pages display human-readable schema documentation with interactive cross-references
  • Users can navigate between related schemas using clickable relationship links
  • File path-based categorization provides intuitive schema organization
  • Documentation includes parameter descriptions, types, required fields, examples, and relationships
  • Non-technical users can understand tool input requirements and schema relationships
  • Generated documentation is responsive, interactive, and matches SPA design system
  • Critical: Build process fails cleanly when schema documentation cannot be generated
  • Both development server and .pyz production packages work correctly

Specific Enhanced Deliverables:

  1. Modified Files:
    • libs/tool-vault-packager/packager.py - Enhanced schema doc generation with relationships
    • libs/tool-vault-packager/server.py - Hybrid API endpoints with static file serving
    • libs/tool-vault-packager/spa/src/components/InfoTab.tsx - Cross-reference navigation
    • libs/tool-vault-packager/spa/src/components/ToolView.tsx - Relationship state management
  2. New Files:
    • libs/tool-vault-packager/spa/src/components/PrettySchemaDisplay.tsx - Enhanced component with relationships
  3. Updated Dependencies:
    • libs/tool-vault-packager/requirements.txt - Add json-schema-for-humans
  4. Enhanced Test Verification:
    • Successful build of both SPA and .pyz package with relationship features
    • Functional testing of cross-reference navigation and categorization
    • Critical: Verification that build fails appropriately on documentation errors
    • Interactive relationship navigation testing

5. Memory Bank Logging Instructions (Mandatory)

Upon successful completion of this enhanced task, you must log your work comprehensively to the project's Memory_Bank.md file. Ensure your log includes:

  • A reference to GitHub Issue Provide pretty-printed schema in web UI #116 and this enhanced task assignment
  • A clear description of all actions taken across backend relationship analysis and frontend navigation
  • Code snippets for key modifications, especially the enhanced InfoTab.tsx transformation
  • Documentation of the relationship mapping and cross-reference implementation
  • Any architectural decisions made regarding schema categorization and navigation design
  • Integration challenges encountered with interactive features and solutions implemented
  • Critical: Documentation of strict validation implementation and build failure handling
  • Confirmation of successful execution with both development and production testing results including relationship features

6. Enhanced Clarification Instruction

If any part of this enhanced task assignment is unclear, especially regarding the schema relationship mapping, cross-reference navigation implementation, or strict validation requirements, please state your specific questions before proceeding. Pay particular attention to the interactive navigation requirements and the critical build failure validation system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TAPIssue captures a Task Assignment PromptdocumentationImprovements or additions to documentationenhancementNew feature or requestlibs/tool-vault-packager

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions