Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(envs,cli)!: envs first cli #48

Merged
merged 19 commits into from
Apr 30, 2024
Merged

Conversation

Yohe-Am
Copy link
Contributor

@Yohe-Am Yohe-Am commented Apr 9, 2024

  • Re-structure CLI around environments.
  • Basic tests for envs.

Motivation and context

#24 and #46

Migration notes

  • ghjk ports sync has been replaced by a new suite of commands under ghjk envs and ghjk sync.
  • This PR breaks the install identification scheme. Fully remove all .ghjk dirs and ~/.local/share/ghjk to avoid any problems and bloat.

Checklist

  • The change come with new or modified tests
  • Hard-to-understand functions have explanatory comments
  • End-user documentation is updated to reflect the change

Copy link
Contributor Author

@Yohe-Am Yohe-Am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read here for an overview of what the current CLI experience looks like. Not in there is the env var hook/loader scheme which looks a bit like:

  • The shell specific hooks are responsible for sourceing all the activate hooks.
  • ghjk envs activate only launches a new shell with with $GHJK_ENV set.
    • The hooks are what discover and load the activate scripts and the actual env vars.
  • envs cook is required to actually reify the environments.
    • If the env is not cooked by the time the hooks are trying to activate it, they'll complain to the user to do so.
    • If the env is recooked, the hooks will detect and reload the variables.
    • Recooking is required whenever one changes their ghjkfile.
  • sync is cook and envs activate rolled into one.
    • It avoids launching a new shell if the target env is already active.
    • Should be the common contact point.

This is a bit more involved than I'd like so very open to any scale of feedback. Live review might be in order.

This PR is stacked on #46 but reading that is a not a necessity to grasp this.

Also, most of the broken tests are fixed in #47.

@Yohe-Am Yohe-Am requested review from zifeo and Natoandro and removed request for zifeo April 9, 2024 06:56
@Yohe-Am Yohe-Am mentioned this pull request Apr 9, 2024
10 tasks
@Yohe-Am Yohe-Am force-pushed the feat/envs-module branch from e386802 to ff5aadf Compare April 9, 2024 19:16
@Yohe-Am
Copy link
Contributor Author

Yohe-Am commented Apr 30, 2024

Until dsherret/dax#264 gets merged upstream, I've decided to vendor dax with the patched applied insie this repo.

@Yohe-Am
Copy link
Contributor Author

Yohe-Am commented Apr 30, 2024

Aand, I had to publish https://jsr.io/@ghjk/dax because vendoring wan't enough either. Dax is critical to the ghjk experience so might as well. We might want to modify more of it.

@Yohe-Am Yohe-Am merged commit 91738a4 into feat/envs-module Apr 30, 2024
6 of 7 checks passed
@Yohe-Am Yohe-Am deleted the feat/envs-cli branch April 30, 2024 19:11
Copy link
Member

@zifeo zifeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Yohe-Am added a commit that referenced this pull request Jun 21, 2024
* feat(envs): Envs module

* feat: rework `ghjk.ts` interface and integrate with other modules

* wip: minor fixup

* fix: improve uninited dir experience

* wip: `$ ghjk envs sync`

* refactor(envs,cli)!: envs first cli (#48)

* refactor(envs): envs first CLI

* wip: missing file

* wip: wip

* wip: wip 2

* feat(tests): basic tests

* docs: some snippets for `README.md`

* doc: typo

* fix: `Deno.Command` troubles

* fix: cross platform shell fn for getting ctime

* fix: `!` as instId separator

* fix(tests): missing flag

* wip: wip

* feat: `ghjk p resolve`

* refactor: polish CLI code

* wip: clearEnv fix

* fix: vendor dax patch

* fix: forgotten change

* fix: use `@ghjk/dax` fork

* fix: remove vendor dir from Dockerfile

* feat: env hooks (#59)

* feat(envs,tasks): env `onEnter`/`onExit` hooks

* wip: anon tasks

* feat: anonymous tasks

* tests: anon tasks

* wip: wip

* feat: env onEnter/onExit hooks

* tests: env hook tests

* fix: bug in path outputs

* fix: use latest setup-ghjk

* fix: bug on check task

* chore: bump deno to 1.43.1

* fix: miss field in test harness

* fix: use `no-prune` on docker tests

* fix: don't rmi at all

* fix: timeout

* docs: metatype ecosystem banner in README.md (#49)

* docs: metatype ecosystem banner in README.md

* fix: utm

---------

Co-authored-by: Teo Stocco <[email protected]>

* fix(port): `cpy_bs` doesn't work on arm (#60)

* wip: linux/arm in docker on mac-14

* wip: try `custom-macos`

* wip: try inline docker

* wip: try `custom-macos`

* fix: remove unnecessary action

* fix: move platform flags into tests

* refactor: merge new job into matrix

* fix: broken aarch64 ports

* wip: log

* fix: diambiguate platforms in harness

* fix: silly ci bug

* fix: env depending on itself case

* fix: lint issue

* fix: use 5m timeout for everything

* refactor(envs): `GHJK_NEXTFILE` based env reloading (#83)

* wip: nextfile

* tests: nextfile

* refactor: pid based nextfile

* refactor: replace with ghjkdir vars instead of $HOME

* fix: env hook tests

* fix: bashisms

* feat(modules): ports outdated command (#62)

* wip(modules): add installSetIds to

* wip(modules-ports): read recipe.json and get cooked installSetIds

* wip(ports): wip for version getter func

* feat(modules): restrcutre ctx tree and recipe.json content

* feat(ports): add table to show version diff

* fix: fix unhandled prov type in envs/posix cook

* wip: wip update outdated installs

* wip: add ghjk file with multiple installs

* chore(test): wip add test

* refactor: refactor table structure and update cargo_binstall

* refactor(ghjk.ts): replace `secureConfig` with `hack.ts` (#87)

* refactor(ghjk.ts): replace secureConfig with hack.ts

* docs: improve README

* fix(ci): update action job

* fix: address llm feedback

* fix: cargo-binstall bug

* fix: ports outdated test fix

* feat!: metatype integration polish (#91)

* feat: multipl env inheritance

* refactor: handle GHJK_CLEANUP_POSIX edgecases

* feat: task on task inheritance

* fix: bugs!

* feat(port): `deno_ghrel`

* fix: `portsOutdated` tests

* fix: diamond inheritance bug

* small stuff

* fix: apply llm feedback

* fix: minor fixes

* fix: path var merging

* feat: `std.ts` and `sedLock`

* fix: task path combinations

* fix: task path combinations 2

* chore: set version 0.2.0

* fix: more target sed pattern

* fix(ci): pre-commit issue

* fix: 10m timeout

* fix: explicit GITHUB_TOKEN

---------

Co-authored-by: Teo Stocco <[email protected]>
Co-authored-by: Estifanos Bireda <[email protected]>
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.

2 participants