feat(cli): scaffold ossie CLI#151
Merged
Merged
Conversation
The OSI converters currently require manual environment setup and
per-converter invocation. This lays the foundation for a unified CLI
(osi) that will discover and invoke converters as plugins via a
stdin/stdout JSON protocol.
Creates cli/ at the repo root as a self-contained Go module
(github.com/open-semantic-interchange/osi/cli). All commands are
stubbed — no logic is wired in this commit.
Design decisions:
- Go chosen for static binary distribution; no runtime dependency
for end users (brew/apt installable)
- internal/osidir owns ~/.osi/plugins/ initialization and respects
$OSI_PLUGIN_DIR for override; uses os.UserHomeDir() rather than
$HOME for Windows portability
- PersistentPreRunE on the root command ensures dir init runs before
every subcommand; commented caveat that Cobra does not chain this
automatically if a subcommand defines its own
- MarkFlagsMutuallyExclusive("from", "to") handles the both-set case
on osi convert; the neither-set case is validated manually in RunE
since Cobra only guards against both being provided
Build pipeline (Makefile, .goreleaser.yaml) and CI follow in
separate commits.
Enables local builds and cross-platform release artifacts for the OSI CLI. Makefile provides standard targets for day-to-day development: build, test, lint, release-dry-run, and clean. All targets are designed to run from within cli/. GoReleaser config targets linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, and windows/amd64. windows/arm64 is excluded — no widely available CI runner and negligible current demand. CGO_ENABLED=0 is set for fully static binaries, enabling cross-compilation from any host without a C toolchain. Version, commit, and date are injected at build time via ldflags from the vars declared in main.go.
Runs go build, go vet, and go test on every push and pull request that touches cli/ or the workflow file itself. The paths filter prevents CLI changes from triggering unrelated workflows in this polyglot repo and vice versa. Go version is derived from go-version-file: cli/go.mod so the workflow automatically picks up any future toolchain bumps without a separate workflow edit. defaults.run.working-directory avoids repeating cd cli/ on every step. Cross-platform build testing is not included — CGO_ENABLED=0 means the linux/amd64 build is representative of all targets. GoReleaser snapshot builds are deferred to a future release workflow.
Covers the only logic in F1 that warrants testing: $OSI_PLUGIN_DIR env var override, default path construction via os.UserHomeDir(), directory creation, and idempotent re-invocation of EnsurePluginDir. t.Setenv is used throughout so env var mutations are automatically restored after each test. t.TempDir is used for filesystem tests so no cleanup is needed and tests are safe to run in parallel.
Project branding has changed from OSI to OSSIE. Updates all user-facing and internal references in the CLI: - Binary name: osi → ossie - Go module path: .../osi/cli → .../ossie/cli - Default plugin directory: ~/.osi → ~/.ossie - Environment variable: OSI_PLUGIN_DIR → OSSIE_PLUGIN_DIR - GoReleaser project name and archive ids - All command descriptions and flag help text - Output directory default: ./osi-output → ./ossie-output
Completes the OSI → OSSIE rename by updating the internal package directory, package declaration, and import reference in cmd/root.go.
Contributor
Author
This was referenced Jun 16, 2026
QMalcolm
commented
Jun 23, 2026
QMalcolm
left a comment
Contributor
Author
There was a problem hiding this comment.
Found two items that need to be updated. Outside of that, and updating the PR description, this should go to "ready for review"
The osi → ossie rename missed this unexported constant. The value (.ossie) was already correct; only the identifier name was stale.
The osi → ossie rename missed the gitignore entry, so the local build artifact cli/ossie would no longer be ignored by git.
QMalcolm
marked this pull request as ready for review
June 23, 2026 21:04
File names were inconsistent with the package directory name (ossiedir/). Pure rename — no code changes.
This was referenced Jul 8, 2026
Member
|
Superseded by #179 |
Contributor
| @@ -0,0 +1,10 @@ | |||
| module github.com/open-semantic-interchange/ossie/cli | |||
|
|
|||
| go 1.22 | |||
Contributor
There was a problem hiding this comment.
Let's have one source of truth for the go version ? Here it says 1.22 but the .tool-versions says 1.26.2
| run: go vet ./... | ||
|
|
||
| - name: go test | ||
| run: go test ./... |
Contributor
There was a problem hiding this comment.
Thanks for setting up the workflow for tests.
khush-bhatia
previously approved these changes
Jul 14, 2026
Ossie has moved from the Open Semantic Interchange to incubation with the Apache Software Foundation. As such, the references in this PR needed to be updated accordingly.
cli/go.mod declared `go 1.22` while cli/.tool-versions pins golang 1.26.2, giving contributors two conflicting sources of truth for which Go version this module targets. Flagged in review by khush-bhatia on PR #151. There's no existing compatibility requirement forcing a lower minimum, so align go.mod to the same version .tool-versions already pins rather than introduce a toolchain directive or lower the asdf pin.
convert.go hand-rolled a check for the "neither --from nor --to set" case alongside MarkFlagsMutuallyExclusive, which already covers the "both set" case. Suggested by khush-bhatia on PR #151 that cobra's MarkFlagsOneRequired covers this directly. Combining MarkFlagsMutuallyExclusive with MarkFlagsOneRequired on the same flag set gives "exactly one of" semantics entirely through cobra's flag annotations, so the manual check and its now-unneeded fmt.Errorf branch in runConvert are removed.
Co-authored-by: Khushboo Bhatia <khushboo.kanjani@gmail.com>
khush-bhatia
previously approved these changes
Jul 15, 2026
cli/go.mod and cli/.tool-versions each pinned the Go version independently — even after b834d75 aligned their values, nothing forced the two to move together, so they could drift apart again on the next bump. Removed cli/.tool-versions from the repo so go.mod is the only in-repo source of truth. Verified this doesn't break tooling: CI already resolves its Go version from go.mod via actions/setup-go's `go-version-file: cli/go.mod` (.github/workflows/cli-ci.yml), and asdf's golang plugin (~/.asdf/plugins/golang/bin/parse-legacy-file) reads the version straight out of go.mod's `go` directive when no .tool-versions is present. Rather than deleting the file with no path back, gitignored cli/.tool-versions so contributors whose version manager still wants its own pin file can keep one locally without risk of it getting committed and re-introducing a second tracked source of truth. Treats the toolchain-manager pin as personal environment config, not project config — the same rationale as gitignoring editor-specific config instead of committing it. Caveats: - Relies on asdf's legacy-version-file lookup, which is off by default and must be enabled per-user via `legacy_version_file = yes` in ~/.asdfrc (or ASDF_LEGACY_VERSION_FILE=yes) for `asdf install`/`asdf current` to auto-detect the version from go.mod. Not adding a repo-level workaround since asdf has no per-project way to set this. - No automated enforcement that a contributor's local pin matches go.mod; a stale local .tool-versions can still silently drift, as demonstrated on this machine when the global asdf fallback (golang 1.20.1) was too old to parse a 3-component go directive. Accepted as the tradeoff for not owning tooling-manager config in the repo.
khush-bhatia
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the initial scaffold for the ossie CLI 🙂 None of the commands do anything currently, all the currently planned commands are stubbed out for future PRs to implement. In addition the the basic scaffolding, the PR adds basic tests and CI tooling.
Screen.Recording.2026-06-23.at.15.56.48.mov