Module: ReleaseHx

Defined in:
lib/releasehx.rb,
lib/releasehx/cli.rb,
lib/releasehx/configuration.rb,
lib/releasehx/generated.rb,
lib/releasehx/helpers.rb,
lib/releasehx/mcp/asset_packager.rb,
lib/releasehx/mcp/manifest.rb,
lib/releasehx/mcp/resource_pack.rb,
lib/releasehx/mcp/server.rb,
lib/releasehx/ops/check_ops.rb,
lib/releasehx/ops/draft_ops.rb,
lib/releasehx/ops/enrich_ops.rb,
lib/releasehx/ops/template_ops.rb,
lib/releasehx/ops/write_ops.rb,
lib/releasehx/rest/yaml_client.rb,
lib/releasehx/rhyml/adapter.rb,
lib/releasehx/rhyml/change.rb,
lib/releasehx/rhyml/liquid.rb,
lib/releasehx/rhyml/loaders.rb,
lib/releasehx/rhyml/release.rb,
lib/releasehx/rhyml.rb,
lib/releasehx/sgyml/helpers.rb,
lib/releasehx/transforms/adf_to_markdown.rb,
lib/releasehx/version.rb

Overview

Auto-generated by Sourcerer::Builder

Defined Under Namespace

Modules: CheckOps, DraftOps, EnrichOps, MCP, REST, RHYML, SgymlHelpers, TemplateOps, Transforms, WriteOps Classes: CLI, Configuration, Error

Constant Summary collapse

DUMP =
Custom log level, lower than DEBUG
Logger::DEBUG - 1
ATTRIBUTES =
{:globals=>{"attribute-undefined"=>"drop-line", "attribute-missing"=>"skip", "appendix-caption"=>"Appendix", "appendix-refsig"=>"Appendix", "caution-caption"=>"Caution", "chapter-refsig"=>"Chapter", "example-caption"=>"Example", "figure-caption"=>"Figure", "important-caption"=>"Important", "last-update-label"=>"Last updated", "note-caption"=>"Note", "part-refsig"=>"Part", "prewrap"=>"", "sectids"=>"", "section-refsig"=>"Section", "table-caption"=>"Table", "tip-caption"=>"Tip", "toc-placement"=>"macro", "toc-title"=>"Table of Contents", "untitled-label"=>"Untitled", "version-label"=>"Version", "warning-caption"=>"Warning", "notitle"=>"", "docfile"=>"/home/runner/work/releasehx/releasehx/README.adoc", "docdir"=>"/home/runner/work/releasehx/releasehx", "docfilesuffix"=>".adoc", "docname"=>"README", "embedded"=>"", "asciidoctor"=>"", "asciidoctor-version"=>"2.0.23", "safe-mode-name"=>"unsafe", "safe-mode-unsafe"=>"", "safe-mode-level"=>0, "max-include-depth"=>64, "user-home"=>"/home/runner", "doctype"=>"article", "htmlsyntax"=>"html", "backend-html5-doctype-article"=>"", "doctype-article"=>"", "backend-html5"=>"", "backend"=>"html5", "outfilesuffix"=>".html", "filetype"=>"html", "filetype-html"=>"", "basebackend-html-doctype-article"=>"", "basebackend-html"=>"", "basebackend"=>"html", "stylesdir"=>".", "iconsdir"=>"./images/icons", "localdate"=>"2026-01-01", "localyear"=>"2026", "localtime"=>"18:45:03 UTC", "localdatetime"=>"2026-01-01 18:45:03 UTC", "docdate"=>"2026-01-01", "docyear"=>"2026", "doctime"=>"18:44:21 UTC", "docdatetime"=>"2026-01-01 18:44:21 UTC", "page-layout"=>"default", "page-permalink"=>"/docs", "page-nav_order"=>"1", "doctitle"=>"ReleaseHx", "docopslab_git_www"=>"https://github.com/DocOps", "this_prod_slug"=>"releasehx", "releasehx_prod_repo"=>"https://github.com/DocOps/releasehx", "releasehx_demo_repo"=>"https://github.com/DocOps/releasehx-demo", "this_prod_repo"=>"https://github.com/DocOps/releasehx", "this_prod_vrsn_major"=>"0", "this_prod_vrsn_minor"=>"1", "this_prod_vrsn_major-minor"=>"0.1", "this_prod_vrsn_patch"=>"1", "this_prod_vrsn"=>"0.1.1", "next_prod_vrsn"=>"0.2.0", "tagline"=>"Generate formatted release histories from Jira, GitHub, GitLab, YAML, or JSON sources.", "description"=>"CLI utility and Ruby API for generating structured release notes and changelog documents from various issue-tracking platforms or YAML definitions into plaintext drafts (<strong>AsciiDoc</strong>, <strong>Markdown</strong>, <strong>YAML</strong>) and rich-text output (<strong>HTML</strong> and <strong>PDF</strong>).", "gem_config_definition_path"=>"./specs/data/config-def.yml", "app_default_config_path"=>"./.releasehx.yml", "default_markup"=>"markdown", "default_slug_type"=>"kebab", "default_tplt_lang"=>"liquid", "default_drafts_dir"=>"_drafts", "default_enrich_dir"=>"_publish", "default_output_dir"=>".", "default_payloads_dir"=>"_payloads", "default_templates_dir"=>"_templates", "default_mappings_dir"=>"_mappings", "default_api_clients_dir"=>"_apis", "default_cache_dir"=>".releasehx/cache", "default_api_cred_env"=>"RELEASEHX_API_CRED", "default_api_key_env"=>"RELEASEHX_API_KEY", "default_api_user_env"=>"RELEASEHX_API_USER", "default_api_org_env"=>"RELEASEHX_API_ORG", "markdown_extensions"=>".md, .markdown", "asciidoc_extensions"=>".adoc, .ad, .asciidoc", "yaml_extensions"=>".yml, .yaml, .rhyml", "draft_source_file_types"=>"AsciiDoc, Markdown, YAML", "draft_source_extensions"=>".md, .markdown, .adoc, .ad, .asciidoc, .yml, .yaml, .rhyml", "enrich_file_types"=>"HTML, PDF", "enrich_extensions"=>".html, .pdf", "docker_base_command"=>"docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/workdir docopslab/releasehx rhx", "this_prod_repo_branch"=>"https://github.com/DocOps/releasehx/tree/release/0.1", "docs_extn"=>"", "toc"=>"", "toclevels"=>"3", "authorcount"=>0, "toc-position"=>"content"}}
SNIPPET_LOOKUP =
{"helpscreen"=>"helpscreen.txt"}
REGION_LOOKUP =
{"ai-prompt"=>"releasehx-ai-prompt.adoc"}
FORMAT_MAP =
A map of file extensions to their canonical format names. Used internally by format detection and extension resolution methods. TODO: We should externalize this into a YAML file for easier docs integration. Maybe even something that goes in Sourcerer or somewhere to universalize these.

Returns:

  • (Hash<String, String>)
    Extension-to-format mapping.
{
  'md' => 'markdown',
  'mkd' => 'markdown',
  'mkdn' => 'markdown',
  'mdown' => 'markdown',
  'markdown' => 'markdown',
  'ad' => 'asciidoc',
  'adoc' => 'asciidoc',
  'asciidoc' => 'asciidoc',
  'yaml' => 'yaml',
  'yml' => 'yaml',
  'json' => 'json',
  'pdf' => 'pdf',
  'html' => 'html'
}.freeze
VERSION =
ReleaseHx::ATTRIBUTES[:globals]['this_prod_vrsn']

Class Method Summary collapse

Class Method Details

.attrsObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/releasehx.rb', line 30

def self.attrs
  if ENV['RELEASEHX_DEV_RELOAD'] == 'true'
    # Development-only reload from source document
    require 'asciidoctor' # explicitly required here for dev-only reload
    Sourcerer.load_attributes(File.expand_path('../README.adoc', __dir__))
  else
    # Always use pre-generated attributes at runtime
    ReleaseHx::ATTRIBUTES[:globals]
  end
end

.file_format_id(key) ⇒ String?

Converts a file extension or format name to its canonical format identifier. Used to normalize various extension formats (e.g., 'md', 'mkd', 'markdown') to a standard ID.

Parameters:

  • key (String)
    The format or extension to look up.

Returns:

  • (String, nil)
    The canonical format ID, or nil if not recognized.


50
51
52
53
54
55
56
57
# File 'lib/releasehx/helpers.rb', line 50

def self.file_format_id key
  return nil if key.nil?

  string = key.to_s.strip
  return nil if string.empty?

  FORMAT_MAP[string.downcase]
end

.format_extension(string, config) ⇒ String

Resolves the user's preferred file extension for a given format. Consults the configuration's extension preferences and falls back to format detection.

Parameters:

  • string (String)
    The format or extension to look up.
  • config (Hash)
    The configuration hash containing extension preferences.

Returns:

  • (String)
    The preferred file extension.


36
37
38
39
40
41
42
43
# File 'lib/releasehx/helpers.rb', line 36

def self.format_extension string, config
  return string unless config.is_a?(Hash) && config.key?('extensions')

  format = file_format_id(string)
  return string.downcase unless format

  config.dig('extensions', format) || string.downcase
end

.loggerLogger

Provides a singleton logger instance for the application.

Returns:

  • (Logger)
    The application-wide logger instance.


47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/releasehx.rb', line 47

def logger
  return @logger if @logger

  $stdout.sync = true
  log = Logger.new($stdout)
  log.level = Logger::INFO
  log.formatter = proc do |severity, _datetime, _progname, msg|
    sev = severity == DUMP ? 'DUMP' : severity
    "#{sev}: #{msg}\n"
  end

  log.singleton_class.class_eval do
    define_method(:dump) do |msg|
      add(DUMP, msg)
    end
  end

  @logger = log
end

.read_built_snippet(name) ⇒ Object



11
12
13
14
15
16
# File 'lib/releasehx/generated.rb', line 11

def self.read_built_snippet name
  fname = SNIPPET_LOOKUP[name.to_s] || name.to_s
  path = File.expand_path("../../../build/snippets/#{fname}", __FILE__)
  raise "Snippet not found: #{name}" unless File.exist?(path)
  File.read(path)
end