Skip to content

feat(cli): scaffold ossie CLI#151

Merged
QMalcolm merged 15 commits into
mainfrom
qmalcolm--feat-cli-scaffold
Jul 17, 2026
Merged

feat(cli): scaffold ossie CLI#151
QMalcolm merged 15 commits into
mainfrom
qmalcolm--feat-cli-scaffold

Conversation

@QMalcolm

@QMalcolm QMalcolm commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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

QMalcolm added 6 commits June 9, 2026 16:12
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.
@QMalcolm

Copy link
Copy Markdown
Contributor Author

@QMalcolm QMalcolm left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Found two items that need to be updated. Outside of that, and updating the PR description, this should go to "ready for review"

Comment thread cli/internal/ossiedir/osidir.go Outdated
Comment thread .gitignore Outdated
QMalcolm added 2 commits June 23, 2026 15:32
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
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.
@jbonofre

Copy link
Copy Markdown
Member

Superseded by #179

@jbonofre jbonofre closed this Jul 14, 2026
@khush-bhatia khush-bhatia reopened this Jul 14, 2026
@khush-bhatia

Copy link
Copy Markdown
Contributor

Superseded by #179

Hey @jbonofre The referenced PR #179 is not in a healthy state. What do you think about continuing to review and merge the original PRs on the repo now that the transfer is done ?

Comment thread cli/go.mod Outdated
@@ -0,0 +1,10 @@
module github.com/open-semantic-interchange/ossie/cli

go 1.22

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's have one source of truth for the go version ? Here it says 1.22 but the .tool-versions says 1.26.2

Comment thread cli/go.mod Outdated
Comment thread cli/main.go Outdated
Comment thread cli/cmd/convert.go Outdated
Comment thread cli/cmd/root.go Outdated
Comment thread cli/cmd/root.go Outdated
Comment thread cli/cmd/root.go Outdated
run: go vet ./...

- name: go test
run: go test ./...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for setting up the workflow for tests.

khush-bhatia
khush-bhatia previously approved these changes Jul 14, 2026
QMalcolm added 3 commits July 15, 2026 15:42
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.
Comment thread cli/cmd/plugin/plugin.go Outdated
Comment thread cli/cmd/plugin/plugin.go Outdated
Comment thread cli/cmd/convert.go Outdated
Comment thread cli/cmd/convert.go Outdated
Comment thread cli/cmd/convert.go Outdated
Co-authored-by: Khushboo Bhatia <khushboo.kanjani@gmail.com>
khush-bhatia
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.
@QMalcolm
QMalcolm merged commit 710da10 into main Jul 17, 2026
2 checks passed
@QMalcolm
QMalcolm deleted the qmalcolm--feat-cli-scaffold branch July 17, 2026 16:01
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.

3 participants