Skip to content

Latest commit

 

History

History
118 lines (96 loc) · 1.98 KB

README.md

File metadata and controls

118 lines (96 loc) · 1.98 KB

READMEs Programming System

System Configuration

version: 1.0
context: enabled
variables:
  readme_content: ""
  previous_output: ""
  system_state: ""
  topic: ""
parser:
  heading_section: ^##\s+(.+)$
  heading_function: ^#\s+(.+)$
  list_item: ^(\s+)-\s+(.+)$
  key_value: ^(\s+)-\s+(\w+):\s*(.+)$
  nested_list: ^(\s+)-\s+(\w+):$
  indentation: 2

Parser Implementation

const parseLibrary = md => md.match(/^#\s+(.+)$/gm)
const parseTemplate = md => md.match(/^###\s+(.+)$/gm)
const parseContext = md => JSON.parse(md.match(/\{[\s\S]+\}/m)[0])

Function Library

## CORE

# system_init
  - description: Bootstrap system from README
  - parameters:
    - content: string
  - returns:
    - system_state: ready
    - functions: loaded
    - templates: parsed

# system_execute
  - description: Run template with context
  - parameters:
    - template: string
    - input: string
    - context: object

# system_compose_program
  - description: Generates a composed program by combining README.md with custom libraries
  - parameters:
    - readme_file: string
    - libraries: [string]
  - returns:
    - composed_readme: string
    - execution_state: ready

## CUSTOM

Program Templates

### Bootstrap
# Execute
  - function: system_init
  - input: "{{readme_content}}"
  - outputs:
    - system_state
    - functions
    - templates

### Program Composing
# Execute
  - function: system_compose_program
  - libraries:
    - my_first_library.md
  - readme_content: "{{readme_content}}"

Execution Context

{
  "previous_output": "",
  "variables": {},
  "state": "ready"
}

Program Execution

Bootstrap

# Execute
  - function: system_init
  - input: "{{readme_content}}"
  - outputs:
    - system_state
    - functions
    - templates

Program Composition

# Execute
  - function: system_compose_program
  - libraries:
    - my_first_library.md
  - readme_content: "{{readme_content}}"

Help Documentation