harn-stdlib 0.10.197

Embedded Harn standard library source catalog
Documentation
/** Generated by scripts/generate_cli_localization.mjs. Do not edit. */
import { MESSAGE_58, MESSAGE_59 } from "std/cli/localization/messages/part_11"
import {
  MESSAGE_60,
  MESSAGE_61,
  MESSAGE_62,
  MESSAGE_63,
  MESSAGE_64,
} from "std/cli/localization/messages/part_12"
import { MESSAGE_65, MESSAGE_66, MESSAGE_67 } from "std/cli/localization/messages/part_13"
import { MESSAGE_125 } from "std/cli/localization/messages/part_25"
import { MESSAGE_193 } from "std/cli/localization/messages/part_38"
import { MESSAGE_195, MESSAGE_197, MESSAGE_198 } from "std/cli/localization/messages/part_39"
import { MESSAGE_224 } from "std/cli/localization/messages/part_44"
import { MESSAGE_41 } from "std/cli/localization/messages/part_8"
import { MessageTemplate, render_message } from "std/cli/message_template"

const MESSAGES: dict<string, MessageTemplate> = {
  "  create  {0}": MESSAGE_41,
  "  harn doctor              # verify the local environment": MESSAGE_58,
  "  harn fmt main.harn       # format code": MESSAGE_59,
  "  harn lint main.harn      # lint code": MESSAGE_60,
  "  harn package docs        # generate API docs": MESSAGE_61,
  "  harn package pack        # build an inspectable artifact": MESSAGE_62,
  "  harn package verify      # run the canonical package gate": MESSAGE_63,
  "  harn playground --task \"Explain this repo\"    # run the lab": MESSAGE_64,
  "  harn playground --watch --task \"Refine the prompt\"  # live iteration": MESSAGE_65,
  "  harn run main.harn       # run the program": MESSAGE_66,
  "  harn serve mcp main.harn # expose the starter MCP server": MESSAGE_67,
  "  skip  {0} (already exists)": MESSAGE_125,
  "Creating project '{0}'...": MESSAGE_193,
  "Failed to write {0}: {1}": MESSAGE_195,
  "Initialization failed for {0} file(s).": MESSAGE_197,
  "Initializing harn project in current directory...": MESSAGE_198,
  "destination is not a regular file": MESSAGE_224,
}

/**
 * Select a registered CLI template without interpreting argument text.
 * @effects: []
 * @errors: ["Unregistered CLI localization message", "CLI localization argument count does not match its registered template"]
 */
pub fn cli_message(locale: string, source: string, values: list<string>) -> string {
  const template = MESSAGES[source]
  guard template != nil else {
    throw "Unregistered CLI localization message"
  }
  return render_message(template, locale, values)
}