lmgh guide

Typed GitHub domain objects, CI failure-log extraction, and human-in-the-loop TOML proposals in lmgh.

Overview

lmgh bridges the lmcode-go virtual machine and the GitHub CLI (gh). Instead of parsing raw JSON or scraping terminal text in shell scripts, LMScript programs compile against schema/lmgh.dsl.json and interact with two built-in contexts: gh (the GitHub operation catalog) and report (a structured findings sink).

Read operations and CI failure analysis

The gh context provides typed read access to repositories, issues, pull requests, releases, and GitHub Actions workflow runs:

Write operations and human-in-the-loop TOML workflows

All write methods on gh honor gh.dry_run(true), which logs the intended operation into report without invoking gh. For high-impact pull-request creation and review actions, lmgh provides three structured mechanisms:

  1. Two-step PR creation: gh.pr_prepare(owner, repo, title, body, base, head, draft) writes pr-review-OWNER-REPO.toml and refuses to overwrite an existing file. After operator review, gh.pr_submit(owner, repo, path) strictly validates field names, case sensitivity, and repository match before running gh pr create.
  2. Two-step PR review: gh.pr_review_prepare(owner, repo, number, event, body) writes pr-review-verdict-OWNER-REPO-NUMBER.toml for APPROVE, REQUEST_CHANGES, or COMMENT verdicts. gh.pr_review_submit(owner, repo, number, path) verifies the file, posts the review with --body-file, and returns a Review object with confirmed(), id(), url(), and state().
  3. Inline TOML proposals: pr_create_toml(toml_text) accepts a complete [pr] table; its explicit dry callback validates and echoes every proposal field offline during dry invocations, and creates the pull request once in live mode.

Invocation dry mode versus operation dry_run

When LMCODE_INVOCATION_FILE sets dry: true, the lmcode-go runtime skips domain callbacks (except pr_create_toml's offline validator) and returns typed dummy values without starting subprocesses or writing report files. Calling gh.dry_run(false) inside bytecode cannot override an invocation-level dry run.

Standard library scope

The pinned lmcode-go SDK supplies the standard library that lmgh registers next to its host methods; lmgh --lmcode-signatures prints the exact registry. The v0.3.2 host does not register the REST or CLI router interfaces (RestGet, CliCommand, rest_cli and related functions), so programs targeting lmgh should not rely on them.