diff --git a/.github/workflows/nightly-build.yaml b/.github/workflows/nightly-build.yaml index aa232422..bcb9168f 100644 --- a/.github/workflows/nightly-build.yaml +++ b/.github/workflows/nightly-build.yaml @@ -47,29 +47,29 @@ jobs: version="nightly" gitCommit=$(git rev-parse HEAD) buildTime=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - binName="jmm-$GOOS-$GOARCH" + binName="kit-$GOOS-$GOARCH" if [ $GOOS == "windows" ]; then binName="${binName}.exe" fi go build -o "$binName" \ - -ldflags="-s -w -X 'jmm/pkg/cmd/version.Version=${version}' -X 'jmm/pkg/cmd/version.GitCommit=${gitCommit}' -X 'jmm/pkg/cmd/version.BuildTime=${buildTime}'" + -ldflags="-s -w -X 'kit/pkg/cmd/version.Version=${version}' -X 'kit/pkg/cmd/version.GitCommit=${gitCommit}' -X 'kit/pkg/cmd/version.BuildTime=${buildTime}'" - name: Generate archive run: | if [ $GOOS == "windows" ]; then - zip -9 -y -r -q "jmm-${GOOS}-${GOARCH}.zip" "jmm-${GOOS}-${GOARCH}.exe" + zip -9 -y -r -q "kit-${GOOS}-${GOARCH}.zip" "kit-${GOOS}-${GOARCH}.exe" else - tar -czvf "jmm-${GOOS}-${GOARCH}.tar.gz" "jmm-${GOOS}-${GOARCH}" + tar -czvf "kit-${GOOS}-${GOARCH}.tar.gz" "kit-${GOOS}-${GOARCH}" fi - name: Upload artifacts uses: WebFreak001/deploy-nightly@v3.0.0 with: - upload_url: https://uploads.github.com/repos/jozu-ai/jmm/releases/140709733/assets{?name,label}", + upload_url: https://uploads.github.com/repos/jozu-ai/kitops/releases/140709733/assets{?name,label}", release_id: 140709733 - asset_path: jmm-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }} - asset_name: jmm-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }} + asset_path: kit-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }} + asset_name: kit-${{ matrix.os }}-${{ matrix.arch }}.${{ matrix.archive_ext }} asset_content_type: application/zip max_releases: 2 diff --git a/.gitignore b/.gitignore index cb6479ea..52a05cca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ .DS_Store -.jozuStore/** .vscode -jmm +kit diff --git a/README.md b/README.md index a38ae642..d49e03ef 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# JMM - Jozu Model Manager +# Kit ## Description -JMM is a command-line interface (CLI) tool designed to simplify the packaging, versioning, and distribution of AI/ML models as OCI (Open Container Initiative) artifacts. By leveraging the familiar workflow of containerization platforms like Docker, JMM enables data scientists and AI developers to encapsulate their models along with all necessary dependencies, configurations, and environments into a standardized, portable format. This facilitates easy sharing and deployment across diverse computing environments, ensuring that models are readily usable without compatibility issues. JMM supports a wide range of AI/ML frameworks, offers robust version control for model iterations, integrates security practices for safe distribution, and provides a seamless connection to model repositories for storing and retrieving models. With JMM, the aim is to streamline the end-to-end lifecycle of AI/ML model management, making it as effortless as managing containerized applications. +`kit` is a command-line interface (CLI) tool designed to simplify the packaging, versioning, and distribution of AI/ML models as OCI (Open Container Initiative) artifacts. By leveraging the familiar workflow of containerization platforms like Docker, `kit` enables data scientists and AI developers to encapsulate their models along with all necessary dependencies, configurations, and environments into a standardized, portable format. This facilitates easy sharing and deployment across diverse computing environments, ensuring that models are readily usable without compatibility issues. `kit` supports a wide range of AI/ML frameworks, offers robust version control for model iterations, integrates security practices for safe distribution, and provides a seamless connection to model repositories for storing and retrieving models. With `kit`, the aim is to streamline the end-to-end lifecycle of AI/ML model management, making it as effortless as managing containerized applications. ## Table of Contents @@ -15,19 +15,19 @@ JMM is a command-line interface (CLI) tool designed to simplify the packaging, v ## Build the project ```shell -go build +go build -o kit ``` ## Run the project ```shell -./jmm +./kit ``` Alternatively ```shell -go run jmm +go run kit ``` ## Contributing diff --git a/cmd/root.go b/cmd/root.go index 783e625d..dbd1f173 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,13 +4,13 @@ Copyright © 2024 Jozu.com package cmd import ( - "jmm/pkg/cmd/build" - "jmm/pkg/cmd/export" - "jmm/pkg/cmd/login" - "jmm/pkg/cmd/models" - "jmm/pkg/cmd/pull" - "jmm/pkg/cmd/push" - "jmm/pkg/cmd/version" + "kitops/pkg/cmd/build" + "kitops/pkg/cmd/export" + "kitops/pkg/cmd/list" + "kitops/pkg/cmd/login" + "kitops/pkg/cmd/pull" + "kitops/pkg/cmd/push" + "kitops/pkg/cmd/version" "os" "os/user" "path/filepath" @@ -30,8 +30,8 @@ type ( ) var ( - shortDesc = `Jozu Model Manager` - longDesc = `Jozu Model Manager is a tool to manage AI and ML models` + shortDesc = `KitOps model manager` + longDesc = `KitOps is a tool to manage AI and ML models` ) // rootCmd represents the base command when called without any subcommands @@ -42,7 +42,7 @@ func init() { rootCmd.AddCommand(login.NewCmdLogin()) rootCmd.AddCommand(pull.PullCommand()) rootCmd.AddCommand(push.PushCommand()) - rootCmd.AddCommand(models.ModelsCommand()) + rootCmd.AddCommand(list.ListCommand()) rootCmd.AddCommand(export.ExportCommand()) rootCmd.AddCommand(version.NewCmdVersion()) } @@ -50,7 +50,7 @@ func init() { func newRootCmd() *cobra.Command { flags := &RootFlags{} cmd := &cobra.Command{ - Use: "jmm", + Use: "kit", Short: shortDesc, Long: longDesc, PersistentPreRun: func(cmd *cobra.Command, args []string) { @@ -69,7 +69,7 @@ func newRootCmd() *cobra.Command { } func (f *RootFlags) addFlags(cmd *cobra.Command) { - cmd.PersistentFlags().StringVar(&f.ConfigHome, "config", "", "config file (default is $HOME/.jozu)") + cmd.PersistentFlags().StringVar(&f.ConfigHome, "config", "", "config file (default is $HOME/.kitops)") viper.BindPFlag("config", cmd.PersistentFlags().Lookup("config")) } @@ -85,7 +85,7 @@ func (o *RootOptions) Complete() error { if err != nil { return err } - configpath := filepath.Join(currentUser.HomeDir, ".jozu") + configpath := filepath.Join(currentUser.HomeDir, ".kitops") viper.Set("config", configpath) o.ConfigHome = configpath } diff --git a/cmd/root_test.go b/cmd/root_test.go index 654b707b..02cd4631 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -37,8 +37,8 @@ func TestRootCmd(t *testing.T) { err = o.Complete() assert.NoError(t, err) - assert.Equal(t, filepath.Join(currentUser.HomeDir, ".jozu"), o.ConfigHome) - assert.Equal(t, filepath.Join(currentUser.HomeDir, ".jozu"), viper.GetString("config")) + assert.Equal(t, filepath.Join(currentUser.HomeDir, ".kitops"), o.ConfigHome) + assert.Equal(t, filepath.Join(currentUser.HomeDir, ".kitops"), viper.GetString("config")) }) }) diff --git a/demos/README.md b/demos/README.md index 4c323cae..a4917bb9 100644 --- a/demos/README.md +++ b/demos/README.md @@ -7,14 +7,14 @@ Follow these steps to run the demo scripts successfully: 2. **Navigate to the Demo Directory:** Change your current working directory to the demo's directory by using the `cd` command followed by the path to the directory. For example: ```shell -cd jmm/demo/ +cd kitops/demo/ ``` -3. **Download the CLI Version:** Obtain the version of the Command Line Interface (CLI) tool that is required for the demo. You can get the [nightly](https://github.com/jozu-ai/jmm/releases/tag/nightly) builds. Once downloaded, move the CLI tool into the demo directory.Rename the CLI and remove any platform specifications from the name. Ensure that the CLI tool has the correct permissions to be executed. If necessary, you can change the permissions by running: +3. **Download the CLI Version:** Obtain the version of the Command Line Interface (CLI) tool that is required for the demo. You can get the [nightly](https://github.com/jozu-ai/kitops/releases/tag/nightly) builds. Once downloaded, move the CLI tool into the demo directory.Rename the CLI and remove any platform specifications from the name. Ensure that the CLI tool has the correct permissions to be executed. If necessary, you can change the permissions by running: ```shell -chmod +x ./jmm +chmod +x ./kitops ``` 4. **Run the Demo Script:** Execute the demo script by typing the name of the demo you want to execute to your terminal: diff --git a/demos/sprint-24w6-demo.sh b/demos/sprint-24w6-demo.sh index 34dffbdf..0d68410a 100755 --- a/demos/sprint-24w6-demo.sh +++ b/demos/sprint-24w6-demo.sh @@ -35,36 +35,36 @@ fi clear -pe "./jmm version" +pe "./kit version" -# Let's check if there are any models locally -pe "./jmm models" +# Let's check if there are any model kits locally +pe "./kit list" -# clean the local models and check again -pe "rm -rf ~/.jozu" -pe "./jmm models" +# clean the local model kits and check again +pe "rm -rf ~/.kitops" +pe "./kit list" -pe "./jmm build --help" +pe "./kit build --help" # Let's build the onnx model -pe "./jmm build ../examples/onnx -t localhost:5050/test-repo:test-tag" +pe "./kit build ../examples/onnx -t localhost:5050/test-repo:test-tag" -# Let's check if the model is built -pe "./jmm models" +# Let's check if the model kit is built +pe "./kit list" # run a local registry pe "$DOCKER run --name registry --rm -d -p 5050:5050 -e REGISTRY_HTTP_ADDR=:5050 registry" # Let's push the model to the local registry -pe "./jmm push localhost:5050/test-repo:test-tag --http" +pe "./kit push localhost:5050/test-repo:test-tag --http" # Let's check if the model is pushed -pe "./jmm models localhost:5050/test-repo --http" +pe "./kit list localhost:5050/test-repo --http" # clean the local models and check again -pe "rm -rf ~/.jozu" -pe "./jmm models" +pe "rm -rf ~/.kitops" +pe "./kit list" -# Let's pull the model to the local registry -pe "./jmm pull localhost:5050/test-repo:test-tag --http" +# Let's pull the model kit to the local registry +pe "./kit pull localhost:5050/test-repo:test-tag --http" -pe "./jmm models" +pe "./kit list" diff --git a/docs/src/docs/cli/flags.md b/docs/src/docs/cli/flags.md index 31537ef4..508e5ad3 100644 --- a/docs/src/docs/cli/flags.md +++ b/docs/src/docs/cli/flags.md @@ -49,8 +49,8 @@ These flags run next to a command. ### Example -`./kit models --help` +`./kit list --help` or -`./kit models -h` +`./kit list -h` diff --git a/docs/src/docs/cli/usage.md b/docs/src/docs/cli/usage.md index 4ce4c9ae..447bfb60 100644 --- a/docs/src/docs/cli/usage.md +++ b/docs/src/docs/cli/usage.md @@ -16,15 +16,15 @@ Available Commands: | `completion` | Generate the autocompletion script for the specified shell | | `help` | Help about any command | | `login` | A brief description of your command | -| `models` | List models | +| `list` | List model kits | | `pull` | Pull model from registry | | `push` | Push model to registry | | `version` | Display the version information for kit | ## Example -To list your available models you can do: +To list your available model kits you can do: ```sh -$ ./kit models +$ ./kit list ``` diff --git a/go.mod b/go.mod index 4f86db20..e073ae9c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module jmm +module kitops go 1.21.6 diff --git a/main.go b/main.go index 754ce9cc..cc28d029 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,7 @@ Copyright © 2024 Jozu.com */ package main -import "jmm/cmd" +import "kitops/cmd" func main() { cmd.Execute() diff --git a/pkg/artifact/jozu_file.go b/pkg/artifact/kit-file.go similarity index 90% rename from pkg/artifact/jozu_file.go rename to pkg/artifact/kit-file.go index c2151b6a..da2a17e7 100644 --- a/pkg/artifact/jozu_file.go +++ b/pkg/artifact/kit-file.go @@ -9,7 +9,7 @@ import ( ) type ( - JozuFile struct { + KitFile struct { ManifestVersion string `json:"manifestVersion"` Package Package `json:"package,omitempty"` Code []Code `json:"code,omitempty"` @@ -61,22 +61,21 @@ type ( } ) -func (jf *JozuFile) LoadModel(file *os.File) error { +func (kf *KitFile) LoadModel(file *os.File) error { // Read the file data, err := io.ReadAll(file) if err != nil { return err } - err = yaml.Unmarshal(data, jf) + err = yaml.Unmarshal(data, kf) if err != nil { return err } return nil } -func (jf *JozuFile) MarshalToJSON() ([]byte, error) { - // Marshal the JozuFile to JSON - jsonData, err := json.Marshal(jf) +func (kf *KitFile) MarshalToJSON() ([]byte, error) { + jsonData, err := json.Marshal(kf) if err != nil { return nil, err } diff --git a/pkg/cmd/build/jozu-file.md b/pkg/artifact/kit-file.md similarity index 91% rename from pkg/cmd/build/jozu-file.md rename to pkg/artifact/kit-file.md index dc183ea4..4436eeb1 100644 --- a/pkg/cmd/build/jozu-file.md +++ b/pkg/artifact/kit-file.md @@ -1,6 +1,6 @@ -# Jozu AI/ML Packaging Manifest Format Reference +# KitOps AI/ML Packaging Manifest Format Reference -The Jozu manifest for AI/ML is a YAML file designed to encapsulate all the necessary information about the package, including code, datasets, models, and their metadata. This reference documentation outlines the structure and specifications of the manifest format. +The Kit manifest for AI/ML is a YAML file designed to encapsulate all the necessary information about the package, including code, datasets, models, and their metadata. This reference documentation outlines the structure and specifications of the manifest format. ## Overview diff --git a/pkg/artifact/model-layer.go b/pkg/artifact/layer.go similarity index 100% rename from pkg/artifact/model-layer.go rename to pkg/artifact/layer.go diff --git a/pkg/artifact/model.go b/pkg/artifact/model.go index c2faaff6..7b535197 100644 --- a/pkg/artifact/model.go +++ b/pkg/artifact/model.go @@ -3,5 +3,5 @@ package artifact type Model struct { Repository string Layers []ModelLayer - Config *JozuFile + Config *KitFile } diff --git a/pkg/artifact/spec.md b/pkg/artifact/spec.md index 41facb82..d1ca7520 100644 --- a/pkg/artifact/spec.md +++ b/pkg/artifact/spec.md @@ -1,4 +1,4 @@ -# Jozu Model Specification v0.1 +# Kit Model Specification v0.1 A *model package* is an ordered collection AI/ML artifacts and the corresponding execution and training parameters. This specification outlines the format of these artifacts and corresponding parameters and describes how to create and use them. diff --git a/pkg/cmd/build/build.go b/pkg/cmd/build/build.go index 1f18085b..1a0e9085 100644 --- a/pkg/cmd/build/build.go +++ b/pkg/cmd/build/build.go @@ -8,10 +8,10 @@ import ( "os" "path" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" - "jmm/pkg/lib/filesystem" - "jmm/pkg/lib/storage" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" + "kitops/pkg/lib/filesystem" + "kitops/pkg/lib/storage" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -20,12 +20,7 @@ import ( var ( shortDesc = `Build a model` - longDesc = `A longer description that spans multiple lines and likely contains examples - and usage of using your command. For example: - - Cobra is a CLI library for Go that empowers applications. - This application is a tool to generate the needed files - to quickly create a Cobra application.` + longDesc = `Build a model TODO` ) type BuildFlags struct { @@ -99,17 +94,17 @@ func (options *BuildOptions) RunBuild() error { return err } defer modelfile.Close() - jozufile := &artifact.JozuFile{} - if err = jozufile.LoadModel(modelfile); err != nil { + kitfile := &artifact.KitFile{} + if err = kitfile.LoadModel(modelfile); err != nil { fmt.Println(err) return err } model := &artifact.Model{} - model.Config = jozufile + model.Config = kitfile // 2. package the Code - for _, code := range jozufile.Code { + for _, code := range kitfile.Code { codePath, err := filesystem.VerifySubpath(options.ContextDir, code.Path) if err != nil { return err @@ -121,7 +116,7 @@ func (options *BuildOptions) RunBuild() error { model.Layers = append(model.Layers, *layer) } // 3. package the DataSets - for _, dataset := range jozufile.DataSets { + for _, dataset := range kitfile.DataSets { datasetPath, err := filesystem.VerifySubpath(options.ContextDir, dataset.Path) if err != nil { return err @@ -134,7 +129,7 @@ func (options *BuildOptions) RunBuild() error { } // 4. package the TrainedModels - for _, trainedModel := range jozufile.Models { + for _, trainedModel := range kitfile.Models { modelPath, err := filesystem.VerifySubpath(options.ContextDir, trainedModel.Path) if err != nil { return err diff --git a/pkg/cmd/build/build_test.go b/pkg/cmd/build/build_test.go index ae7c8bcf..2f49a9c7 100644 --- a/pkg/cmd/build/build_test.go +++ b/pkg/cmd/build/build_test.go @@ -1,7 +1,7 @@ package build import ( - "jmm/pkg/lib/constants" + "kitops/pkg/lib/constants" "path" "testing" @@ -33,7 +33,7 @@ func TestBuildOptions_Complete(t *testing.T) { func TestBuildOptions_Validate(t *testing.T) { options := &BuildOptions{ - ModelFile: "Jozufile", + ModelFile: "Kitfile", ContextDir: "/path/to/context", } @@ -45,7 +45,7 @@ func TestBuildOptions_Validate(t *testing.T) { func TestBuildOptions_RunBuild(t *testing.T) { t.Skip("Skipping test for now") options := &BuildOptions{ - ModelFile: "Jozufile", + ModelFile: "Kitfile", ContextDir: "/path/to/context", } @@ -56,7 +56,7 @@ func TestBuildOptions_RunBuild(t *testing.T) { func TestBuildFlags_ToOptions(t *testing.T) { flags := &BuildFlags{ - ModelFile: "Jozufile", + ModelFile: "Kitfile", } options, err := flags.ToOptions() diff --git a/pkg/cmd/export/cmd.go b/pkg/cmd/export/cmd.go index 5f91337c..cb1460b7 100644 --- a/pkg/cmd/export/cmd.go +++ b/pkg/cmd/export/cmd.go @@ -4,7 +4,7 @@ import ( "context" "errors" "fmt" - "jmm/pkg/lib/storage" + "kitops/pkg/lib/storage" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/pkg/cmd/export/export.go b/pkg/cmd/export/export.go index aabc31cf..ee716c08 100644 --- a/pkg/cmd/export/export.go +++ b/pkg/cmd/export/export.go @@ -6,10 +6,10 @@ import ( "context" "fmt" "io" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" - "jmm/pkg/lib/filesystem" - "jmm/pkg/lib/repo" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" + "kitops/pkg/lib/filesystem" + "kitops/pkg/lib/repo" "os" "path" "path/filepath" @@ -81,7 +81,7 @@ func ExportModel(ctx context.Context, store oras.Target, ref *registry.Reference return nil } -func ExportConfig(config *artifact.JozuFile, exportDir string, overwrite bool) error { +func ExportConfig(config *artifact.KitFile, exportDir string, overwrite bool) error { configPath := path.Join(exportDir, constants.DefaultModelFileName) if fi, exists := filesystem.PathExists(configPath); exists { if !overwrite { diff --git a/pkg/cmd/models/cmd.go b/pkg/cmd/list/cmd.go similarity index 69% rename from pkg/cmd/models/cmd.go rename to pkg/cmd/list/cmd.go index 2412bce0..44bb6dc8 100644 --- a/pkg/cmd/models/cmd.go +++ b/pkg/cmd/list/cmd.go @@ -1,8 +1,8 @@ -package models +package list import ( "fmt" - "jmm/pkg/lib/storage" + "kitops/pkg/lib/storage" "os" "path" "text/tabwriter" @@ -13,27 +13,27 @@ import ( ) const ( - shortDesc = `List models` - longDesc = `List models TODO` + shortDesc = `List model kits in a repository` + longDesc = `List model kits TODO` ) var ( - flags *ModelsFlags - opts *ModelsOptions + flags *ListFlags + opts *ListOptions ) -type ModelsFlags struct { +type ListFlags struct { UseHTTP bool } -type ModelsOptions struct { +type ListOptions struct { configHome string storageHome string remoteRef *registry.Reference usehttp bool } -func (opts *ModelsOptions) complete(flags *ModelsFlags, args []string) error { +func (opts *ListOptions) complete(flags *ListFlags, args []string) error { opts.configHome = viper.GetString("config") opts.storageHome = path.Join(opts.configHome, "storage") if len(args) > 0 { @@ -50,17 +50,17 @@ func (opts *ModelsOptions) complete(flags *ModelsFlags, args []string) error { return nil } -func (opts *ModelsOptions) validate() error { +func (opts *ListOptions) validate() error { return nil } -// ModelsCommand represents the models command -func ModelsCommand() *cobra.Command { - flags = &ModelsFlags{} - opts = &ModelsOptions{} +// ListCommand represents the models command +func ListCommand() *cobra.Command { + flags = &ListFlags{} + opts = &ListOptions{} cmd := &cobra.Command{ - Use: "models [repository]", + Use: "list [repository]", Short: shortDesc, Long: longDesc, Run: RunCommand(opts), @@ -71,7 +71,7 @@ func ModelsCommand() *cobra.Command { return cmd } -func RunCommand(options *ModelsOptions) func(*cobra.Command, []string) { +func RunCommand(options *ListOptions) func(*cobra.Command, []string) { return func(cmd *cobra.Command, args []string) { if err := options.complete(flags, args); err != nil { fmt.Printf("Failed to parse argument: %s", err) @@ -84,14 +84,14 @@ func RunCommand(options *ModelsOptions) func(*cobra.Command, []string) { var allInfoLines []string if opts.remoteRef == nil { - lines, err := listLocalModels(opts.storageHome) + lines, err := listLocalKits(opts.storageHome) if err != nil { fmt.Println(err) return } allInfoLines = lines } else { - lines, err := listRemoteModels(cmd.Context(), opts.remoteRef, opts.usehttp) + lines, err := listRemoteKits(cmd.Context(), opts.remoteRef, opts.usehttp) if err != nil { fmt.Println(err) return @@ -106,7 +106,7 @@ func RunCommand(options *ModelsOptions) func(*cobra.Command, []string) { func printSummary(lines []string) { tw := tabwriter.NewWriter(os.Stdout, 0, 2, 3, ' ', 0) - fmt.Fprintln(tw, ModelsTableHeader) + fmt.Fprintln(tw, listTableHeader) for _, line := range lines { fmt.Fprintln(tw, line) } diff --git a/pkg/cmd/models/models.go b/pkg/cmd/list/list.go similarity index 85% rename from pkg/cmd/models/models.go rename to pkg/cmd/list/list.go index c6cf23cd..b714a3f9 100644 --- a/pkg/cmd/models/models.go +++ b/pkg/cmd/list/list.go @@ -1,16 +1,16 @@ /* Copyright © 2024 Jozu.com */ -package models +package list import ( "context" "encoding/json" "fmt" "io/fs" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" - "jmm/pkg/lib/storage" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" + "kitops/pkg/lib/storage" "math" "os" "path/filepath" @@ -20,11 +20,11 @@ import ( ) const ( - ModelsTableHeader = "REPOSITORY\tTAG\tMAINTAINER\tNAME\tSIZE\tDIGEST" - ModelsTableFmt = "%s\t%s\t%s\t%s\t%s\t%s\t" + listTableHeader = "REPOSITORY\tTAG\tMAINTAINER\tNAME\tSIZE\tDIGEST" + listTableFmt = "%s\t%s\t%s\t%s\t%s\t%s\t" ) -func listLocalModels(storageRoot string) ([]string, error) { +func listLocalKits(storageRoot string) ([]string, error) { storeDirs, err := findRepos(storageRoot) if err != nil { return nil, err @@ -34,7 +34,7 @@ func listLocalModels(storageRoot string) ([]string, error) { for _, storeDir := range storeDirs { store := storage.NewLocalStore(storageRoot, storeDir) - infolines, err := listModels(store) + infolines, err := listKits(store) if err != nil { return nil, err } @@ -43,7 +43,7 @@ func listLocalModels(storageRoot string) ([]string, error) { return allInfoLines, nil } -func listModels(store storage.Store) ([]string, error) { +func listKits(store storage.Store) ([]string, error) { index, err := store.ParseIndexJson() if err != nil { return nil, err @@ -81,19 +81,19 @@ func getManifest(store storage.Store, manifestDesc ocispec.Descriptor) (*ocispec return manifest, nil } -func readManifestConfig(store storage.Store, manifest *ocispec.Manifest) (*artifact.JozuFile, error) { +func readManifestConfig(store storage.Store, manifest *ocispec.Manifest) (*artifact.KitFile, error) { configBytes, err := store.Fetch(context.Background(), manifest.Config) if err != nil { return nil, fmt.Errorf("failed to read config: %w", err) } - config := &artifact.JozuFile{} + config := &artifact.KitFile{} if err := json.Unmarshal(configBytes, config); err != nil { return nil, fmt.Errorf("failed to parse config: %w", err) } return config, nil } -func getManifestInfoLine(repo string, desc ocispec.Descriptor, manifest *ocispec.Manifest, config *artifact.JozuFile) string { +func getManifestInfoLine(repo string, desc ocispec.Descriptor, manifest *ocispec.Manifest, config *artifact.KitFile) string { ref := desc.Annotations[ocispec.AnnotationRefName] if ref == "" { ref = "" @@ -111,7 +111,7 @@ func getManifestInfoLine(repo string, desc ocispec.Descriptor, manifest *ocispec } sizeStr := formatBytes(size) - info := fmt.Sprintf(ModelsTableFmt, repo, ref, config.Package.Authors[0], config.Package.Name, sizeStr, desc.Digest) + info := fmt.Sprintf(listTableFmt, repo, ref, config.Package.Authors[0], config.Package.Name, sizeStr, desc.Digest) return info } diff --git a/pkg/cmd/models/models_test.go b/pkg/cmd/list/list_test.go similarity index 91% rename from pkg/cmd/models/models_test.go rename to pkg/cmd/list/list_test.go index fb586e98..250141b6 100644 --- a/pkg/cmd/models/models_test.go +++ b/pkg/cmd/list/list_test.go @@ -1,10 +1,10 @@ -package models +package list import ( "fmt" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" - internal "jmm/pkg/lib/testing" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" + internal "kitops/pkg/lib/testing" "testing" "github.com/opencontainers/go-digest" @@ -12,12 +12,12 @@ import ( "github.com/stretchr/testify/assert" ) -func TestListModels(t *testing.T) { +func TestListKits(t *testing.T) { tests := []struct { testName string repo string manifests map[digest.Digest]ocispec.Manifest - configs map[digest.Digest]artifact.JozuFile + configs map[digest.Digest]artifact.KitFile index *ocispec.Index expectedOutputRegexps []string expectErrRegexp string @@ -39,7 +39,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configB", "layerB"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -57,7 +57,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configNotFound", "layerB"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -75,7 +75,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configB", "layerB1", "layerB2", "layerB3"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -93,7 +93,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configB", "layerB1", "layerB2", "layerB3"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -115,7 +115,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configB", "layerB1", "layerB2", "layerB3"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -137,7 +137,7 @@ func TestListModels(t *testing.T) { "manifestA": Manifest("configA", "layerA"), "manifestB": Manifest("configB", "layerB1", "layerB2", "layerB3"), }, - configs: map[digest.Digest]artifact.JozuFile{ + configs: map[digest.Digest]artifact.KitFile{ "configA": Config("maintainerA", "formatA"), "configB": Config("maintainerB", "formatB"), }, @@ -155,7 +155,7 @@ func TestListModels(t *testing.T) { Index: tt.index, Repo: tt.repo, } - summaryLines, err := listModels(testStore) + summaryLines, err := listKits(testStore) if tt.expectErrRegexp != "" { // Should be error assert.Empty(t, summaryLines, "Should not output summary on error") @@ -222,8 +222,8 @@ func Manifest(configDigest string, layerDigests ...string) ocispec.Manifest { return manifest } -func Config(maintainer, name string) artifact.JozuFile { - config := artifact.JozuFile{ +func Config(maintainer, name string) artifact.KitFile { + config := artifact.KitFile{ Package: artifact.Package{Authors: []string{maintainer}, Name: name}, } diff --git a/pkg/cmd/models/remote.go b/pkg/cmd/list/remote.go similarity index 93% rename from pkg/cmd/models/remote.go rename to pkg/cmd/list/remote.go index f31169b6..c684862c 100644 --- a/pkg/cmd/models/remote.go +++ b/pkg/cmd/list/remote.go @@ -1,19 +1,19 @@ -package models +package list import ( "context" "encoding/json" "fmt" "io" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "oras.land/oras-go/v2/registry" "oras.land/oras-go/v2/registry/remote" ) -func listRemoteModels(ctx context.Context, remoteRef *registry.Reference, useHttp bool) ([]string, error) { +func listRemoteKits(ctx context.Context, remoteRef *registry.Reference, useHttp bool) ([]string, error) { remoteRegistry, err := remote.NewRegistry(remoteRef.Registry) if err != nil { return nil, fmt.Errorf("failed to read registry: %w", err) @@ -82,7 +82,7 @@ func listImageTag(ctx context.Context, repo registry.Repository, ref *registry.R if err != nil { return nil, fmt.Errorf("failed to read config: %w", err) } - config := &artifact.JozuFile{} + config := &artifact.KitFile{} if err := json.Unmarshal(configBytes, config); err != nil { return nil, fmt.Errorf("failed to parse config: %w", err) } diff --git a/pkg/cmd/pull/cmd.go b/pkg/cmd/pull/cmd.go index 1a9dea43..346830ca 100644 --- a/pkg/cmd/pull/cmd.go +++ b/pkg/cmd/pull/cmd.go @@ -2,7 +2,7 @@ package pull import ( "fmt" - "jmm/pkg/lib/storage" + "kitops/pkg/lib/storage" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/pkg/cmd/pull/pull.go b/pkg/cmd/pull/pull.go index ac840cc9..9b6de397 100644 --- a/pkg/cmd/pull/pull.go +++ b/pkg/cmd/pull/pull.go @@ -8,7 +8,7 @@ import ( "encoding/json" "fmt" "io" - "jmm/pkg/lib/constants" + "kitops/pkg/lib/constants" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "oras.land/oras-go/v2" diff --git a/pkg/cmd/push/cmd.go b/pkg/cmd/push/cmd.go index fabbd842..e8c93aa4 100644 --- a/pkg/cmd/push/cmd.go +++ b/pkg/cmd/push/cmd.go @@ -2,7 +2,7 @@ package push import ( "fmt" - "jmm/pkg/lib/storage" + "kitops/pkg/lib/storage" "github.com/spf13/cobra" "github.com/spf13/viper" diff --git a/pkg/cmd/version/version.go b/pkg/cmd/version/version.go index 52b7245a..42992bf1 100644 --- a/pkg/cmd/version/version.go +++ b/pkg/cmd/version/version.go @@ -2,8 +2,9 @@ package version import ( "fmt" - "github.com/spf13/cobra" "runtime" + + "github.com/spf13/cobra" ) // Default build-time variable. @@ -19,11 +20,11 @@ func NewCmdVersion() *cobra.Command { cmd := &cobra.Command{ Use: "version", - Short: "Display the version information for jmm", - Long: `The version command prints detailed version information for the jmm CLI tool, + Short: "Display the version information for the CLI", + Long: `The version command prints detailed version information for the kit CLI tool, including the current version of the tool, the Git commit that the version was built from, the build time, and the version of Go it was compiled with. This can be useful for debugging -or verifying that you are running the expected version of jmm.`, +or verifying that you are running the expected version of kit.`, Run: func(cmd *cobra.Command, args []string) { fmt.Printf("Version: %s\nCommit: %s\nBuilt: %s\nGo version: %s\n", Version, GitCommit, BuildTime, GoVersion) }, diff --git a/pkg/lib/constants/consts.go b/pkg/lib/constants/consts.go index 361f66a0..5204d998 100644 --- a/pkg/lib/constants/consts.go +++ b/pkg/lib/constants/consts.go @@ -1,14 +1,14 @@ package constants const ( - DefaultModelFileName = "Jozufile" + DefaultModelFileName = "Kitfile" // Media type for the model layer - ModelLayerMediaType = "application/vnd.jozu.model.content.v1.tar+gzip" + ModelLayerMediaType = "application/vnd.kitops.modelkit.model.v1.tar+gzip" // Media type for the dataset layer - DataSetLayerMediaType = "application/vnd.jozu.dataset.content.v1.tar+gzip" + DataSetLayerMediaType = "application/vnd.kitops.modelkit.dataset.v1.tar+gzip" // Media type for the code layer - CodeLayerMediaType = "application/vnd.jozu.model.code.v1.tar+gzip" - // Media type for the model config (Jozufile) - ModelConfigMediaType = "application/vnd.jozu.model.config.v1+json" + CodeLayerMediaType = "application/vnd.kitops.modelkit.code.v1.tar+gzip" + // Media type for the model config (Kitfile) + ModelConfigMediaType = "application/vnd.kitops.modelkit.config.v1+json" ) diff --git a/pkg/lib/repo/repo.go b/pkg/lib/repo/repo.go index 3de579bc..051e32d2 100644 --- a/pkg/lib/repo/repo.go +++ b/pkg/lib/repo/repo.go @@ -4,14 +4,14 @@ import ( "context" "encoding/json" "fmt" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" ocispec "github.com/opencontainers/image-spec/specs-go/v1" "oras.land/oras-go/v2/content" ) -func GetManifestAndConfig(ctx context.Context, store content.Storage, manifestDesc ocispec.Descriptor) (*ocispec.Manifest, *artifact.JozuFile, error) { +func GetManifestAndConfig(ctx context.Context, store content.Storage, manifestDesc ocispec.Descriptor) (*ocispec.Manifest, *artifact.KitFile, error) { manifest, err := GetManifest(ctx, store, manifestDesc) if err != nil { return nil, nil, err @@ -39,12 +39,12 @@ func GetManifest(ctx context.Context, store content.Storage, manifestDesc ocispe return manifest, nil } -func GetConfig(ctx context.Context, store content.Storage, configDesc ocispec.Descriptor) (*artifact.JozuFile, error) { +func GetConfig(ctx context.Context, store content.Storage, configDesc ocispec.Descriptor) (*artifact.KitFile, error) { configBytes, err := content.FetchAll(ctx, store, configDesc) if err != nil { return nil, fmt.Errorf("failed to read config: %w", err) } - config := &artifact.JozuFile{} + config := &artifact.KitFile{} if err := json.Unmarshal(configBytes, config); err != nil { return nil, fmt.Errorf("failed to parse config: %w", err) } diff --git a/pkg/lib/storage/local.go b/pkg/lib/storage/local.go index 5aa86af9..9a020413 100644 --- a/pkg/lib/storage/local.go +++ b/pkg/lib/storage/local.go @@ -5,8 +5,8 @@ import ( "context" "encoding/json" "fmt" - "jmm/pkg/artifact" - "jmm/pkg/lib/constants" + "kitops/pkg/artifact" + "kitops/pkg/lib/constants" "os" "path/filepath" @@ -132,7 +132,7 @@ func (store *LocalStore) saveContentLayer(layer *artifact.ModelLayer) (ocispec.D return desc, nil } -func (store *LocalStore) saveConfigFile(model *artifact.JozuFile) (ocispec.Descriptor, error) { +func (store *LocalStore) saveConfigFile(model *artifact.KitFile) (ocispec.Descriptor, error) { ctx := context.Background() modelBytes, err := model.MarshalToJSON() if err != nil { diff --git a/pkg/lib/storage/store.go b/pkg/lib/storage/store.go index c70a28d5..fc87ccc1 100644 --- a/pkg/lib/storage/store.go +++ b/pkg/lib/storage/store.go @@ -2,7 +2,7 @@ package storage import ( "context" - "jmm/pkg/artifact" + "kitops/pkg/artifact" _ "crypto/sha256" _ "crypto/sha512" diff --git a/pkg/lib/testing/testing.go b/pkg/lib/testing/testing.go index cff64ddb..ce095bf1 100644 --- a/pkg/lib/testing/testing.go +++ b/pkg/lib/testing/testing.go @@ -5,8 +5,8 @@ import ( "encoding/json" "errors" "fmt" - "jmm/pkg/artifact" - "jmm/pkg/lib/storage" + "kitops/pkg/artifact" + "kitops/pkg/lib/storage" "github.com/opencontainers/go-digest" ocispec "github.com/opencontainers/image-spec/specs-go/v1" @@ -24,7 +24,7 @@ type TestStore struct { // Map of digest to Manifest, to simulate retrieval from e.g. disk Manifests map[digest.Digest]ocispec.Manifest // Map of digest to Config, to simulate retrieval from e.g. disk - Configs map[digest.Digest]artifact.JozuFile + Configs map[digest.Digest]artifact.KitFile // Index for the store Index *ocispec.Index }