Skip to content

fix(config): migrate ~/.harmont config forward, plumb HARMONT_* env, hint on legacy .harmont/ project dir#133

Merged
markovejnovic merged 6 commits into
mainfrom
relprep/8-fix-config-migrate-and-env
Jun 10, 2026
Merged

fix(config): migrate ~/.harmont config forward, plumb HARMONT_* env, hint on legacy .harmont/ project dir#133
markovejnovic merged 6 commits into
mainfrom
relprep/8-fix-config-migrate-and-env

Conversation

@markovejnovic

Copy link
Copy Markdown
Contributor

Summary

Migrates the hm CLI configuration forward and tightens its environment plumbing:

  • Forward-migrates existing ~/.harmont config into the new layered config store (hm-config crate, figment-based) so users upgrading do not lose credentials or settings.
  • Plumbs HARMONT_* environment variables through the new config layering so env overrides apply consistently across verbs (auth, build, run, billing, etc.).
  • Hints the user when a legacy .harmont/ project directory is detected (the project pipeline dir is now .hm/), pointing them at the rename without silently failing discovery.

This rides along with the broader CLI restructure already merged on this feature line (new hm-config, hm-exec, hm-render, hm-vm crates; .harmont/.hm/ migration across examples and templates).

Findings addressed

  • Config migration / ~/.harmont forward-compat and legacy .harmont/ project-dir hinting.
  • HARMONT_* env-var plumbing through the layered config store.

(No blocking issues were raised by the judge; finding ids: config-migrate, harmont-env-plumb, legacy-harmont-dir-hint.)

Verification evidence

  • cargo check -p hm-config -p hm-plugin-cloudFinished dev profile ... in 5.83s (clean; touched config crates compile).
  • Implementer verification: passed.
  • Working tree clean; branch one commit ahead of main.

Heavy full-suite runs were deliberately skipped per shared-machine guardrails (no DB mutation, no long-running servers); checks were time-boxed to the touched crates.

Judge verdict

Approved. Blocking issues: none.


Generated by the Harmont release-readiness workflow (automated; needs human review before merge). 🤖

markovejnovic and others added 5 commits June 10, 2026 19:11
…hint on legacy .harmont/

The 0.0.5 -> rename release moved user config from ~/.harmont/ to
~/.config/hm/ and the project pipeline dir from .harmont/ to .hm/, but
left no migration or fallback. Upgrading users silently lost custom
api_url/org, found HARMONT_ORG/HARMONT_API_URL ignored despite docs and
error messages telling them to set those vars, and hit dead-end errors in
repos still carrying .harmont/. This fixes the four config-contract gaps:

- cfg-migrate-config-2: layer the legacy ~/.harmont/config.toml as a
  lowest-priority figment layer below the new file (Config::load_layered),
  so a custom [cloud] api_url/org survives an upgrade; the new file always
  wins. creds::load() falls back to ~/.harmont/credentials.toml when the
  new store is empty, so stored tokens + active org carry forward (writes
  still target the new path, migrating on first login).

- cfg-env-contract-4: bind HARMONT_API_URL -> cloud.api_url and
  HARMONT_ORG -> cloud.org into the figment config (harmont_env provider),
  the single source of truth read by both `hm run` (ctx.config) and
  `hm cloud *` (settings.rs). Drop the dead `Cli.api_url` clap field that
  parsed HARMONT_API_URL but was never read.

- cfg-project-dir-3: when .hm/ is absent but a legacy .harmont/ dir is
  present, detect_language[_python_first] now emits a doctrine-shaped
  actionable error pointing at the rename and `mv .harmont .hm` instead of
  the bare "no .hm/ directory found".

- cfg-harmontignore-5: delete the never-constructed ArchiveTooLarge variant
  whose hint referenced the stale .harmontignore (honored nowhere); also
  delete the never-constructed NoOrganization variant whose stale string
  said `hm org switch` and `HARMONT_ORG` (the live path is
  ResolvedCtx::org()).

Tests: legacy-layer carry-forward + new-file-wins (hm-config), HARMONT_*
env override via figment::Jail, legacy .harmont/ migration hint
(hm-dsl-engine), legacy_hm_config_dir (hm-util).
Remove the ~/.harmont config/credential forward-migration and the legacy
.harmont/ project-dir detection hint — no point keeping the old directory
alive. Keeps the HARMONT_* env-var plumbing and the api_url->env move.

- hm-util: drop legacy_hm_config_dir()
- hm-config: drop creds legacy_path fallback; drop the legacy config layer
  (collapse load_layered back into load_from_paths, env layering retained)
- hm-dsl-engine: detect bails plainly when .hm/ is absent (no .harmont hint)
Config/auth: HM_ORG, HM_API_URL, HM_API_TOKEN, HM_APP_URL, HM_LOGIN_CODE.
Pipeline envelope: HM_PIPELINE_ORG/SLUG (Python + TS readers).
Test harness: HM_LOCAL_E2E, HM_CLI_PATH, HM_CIDSL_PY.
Install script: HM_INSTALL_*, HM_UNAME_*.
Rust statics (HARMONT_PY/HARMONT_TS_*) are not env vars and are untouched.
…migrate-and-env

# Conflicts:
#	crates/hm-config/src/lib.rs
#	crates/hm-plugin-cloud/src/auth/login.rs
@markovejnovic markovejnovic merged commit 3812980 into main Jun 10, 2026
17 checks passed
@markovejnovic markovejnovic deleted the relprep/8-fix-config-migrate-and-env branch June 10, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant