Skip to content

Fix/watcher spelling and path logic#343

Open
Ansita20 wants to merge 1 commit into
microcks:masterfrom
Ansita20:fix/watcher-spelling-and-path-logic
Open

Fix/watcher spelling and path logic#343
Ansita20 wants to merge 1 commit into
microcks:masterfrom
Ansita20:fix/watcher-spelling-and-path-logic

Conversation

@Ansita20
Copy link
Copy Markdown

@Ansita20 Ansita20 commented May 8, 2026

Description

This pull request fixes several code quality and logic issues in the Microcks CLI.

Changes included:

  • Fixed a typo in the CLI command constructor function by renaming NewCommad() to NewCommand().
  • Fixed a naming typo in the watcher constructor by renaming NewWatchManger() to NewWatchManager() for consistency with the struct name.
  • Corrected the order of file path normalization in the import command so that ./ prefixes are removed before calling UploadArtifact(). This ensures consistent paths between uploaded artifacts and watcher configuration.

These fixes improve compilation reliability, code readability, and correct watcher behavior in watch mode.

Changes

  1. Command Constructor Fix

    • Renamed NewCommad()NewCommand()
    • Updated all references to match the corrected function name.
  2. WatchManager Constructor Fix

    • Renamed NewWatchManger()NewWatchManager()
    • Updated all call sites accordingly.
  3. File Path Normalization Fix

    • Moved path normalization logic before the UploadArtifact() call.
    • Ensures consistent artifact paths between upload and watcher configuration.

Testing

  • Built the CLI locally to verify compilation succeeds.
  • Verified that the import command works correctly with normalized file paths.
  • Confirmed that watcher configuration now uses consistent file paths.

Related issue(s)

Fixes #342

Copilot AI review requested due to automatic review settings May 8, 2026 21:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses typos in exported constructor names and fixes the import command’s path normalization order so uploaded artifact paths match watcher configuration paths (Fixes #342).

Changes:

  • Renamed cmd.NewCommad() to cmd.NewCommand() (command constructor typo fix).
  • Renamed watcher.NewWatchManger() to watcher.NewWatchManager() (constructor naming consistency).
  • Normalized ./ file path prefixes before calling UploadArtifact() to keep upload and watch-config paths consistent.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
watcher/main.go Updates watcher binary to use NewWatchManager() constructor.
pkg/watcher/watchManager.go Renames the watcher constructor to NewWatchManager().
cmd/import.go Moves ./ prefix trimming before upload; updates watcher constructor call.
cmd/cmd.go Renames CLI root command constructor to NewCommand().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/cmd.go
Comment thread cmd/import.go Outdated
}
}

// Normalize file path to match the watcher fsnotify events format.
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.

I don't see any help of moving this function upward. Maybe you could clarify why

Copy link
Copy Markdown
Contributor

@Caesarsage Caesarsage left a comment

Choose a reason for hiding this comment

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

Thanks @Ansita20 for your contribution

I think of you fix the copilot review and test. This will actually be mergable.

Good cleanup

@Ansita20
Copy link
Copy Markdown
Author

Thanks @Ansita20 for your contribution

I think of you fix the copilot review and test. This will actually be mergable.

Good cleanup

Ok sir, I will fix the unnecessary changes

@Ansita20
Copy link
Copy Markdown
Author

Thanks @Ansita20 for your contribution

I think of you fix the copilot review and test. This will actually be mergable.

Good cleanup

Sir I have fixed the errors..Can you please review the changes.
Thanks

Comment thread cmd/import.go
@@ -154,11 +154,6 @@ func NewImportCommand(globalClientOpts *connectors.ClientOptions) *cobra.Command
watchCfg = &config.WatchConfig{}
}

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 the renames @Ansita20, those parts look good.

seems you deleted the normalization block entirely:

-if strings.HasPrefix(f, "./") {
-    f = strings.TrimPrefix(f, "./")
-}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes sir I just saw that...there was some issues with the code so I had to remove it but forgot to fix and add it agian.
I have made the changes can you please check once again.
I am really sorry for the errors.

@Caesarsage
Copy link
Copy Markdown
Contributor

LGTM on the latest changes @Ansita20.

One last cleanup before merge: could you squash the commits into a single one? The branch currently has 7 commits from the review iterations, and a single clean commit reads better in the project history.

This could help: https://www.kubernetes.dev/docs/guide/github-workflow/#squash-commits

@Ansita20 Ansita20 force-pushed the fix/watcher-spelling-and-path-logic branch from 9daff63 to b0c819b Compare May 14, 2026 14:53
@Ansita20
Copy link
Copy Markdown
Author

LGTM on the latest changes @Ansita20.

One last cleanup before merge: could you squash the commits into a single one? The branch currently has 7 commits from the review iterations, and a single clean commit reads better in the project history.

This could help: https://www.kubernetes.dev/docs/guide/github-workflow/#squash-commits

Done

Signed-off-by: ansita20 <ansitasingh20@gmail.com>
@Ansita20 Ansita20 force-pushed the fix/watcher-spelling-and-path-logic branch from b0c819b to a6c0243 Compare May 14, 2026 14:59
@Ansita20
Copy link
Copy Markdown
Author

@Caesarsage Sir, I have reduced the commit to a single one.
Thanks a lot sir

@Caesarsage
Copy link
Copy Markdown
Contributor

thanks

LGTM

This is a good to have cleanup

cc @Harsh4902 for approval or further review

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.

CLI Code Quality and Logic Issues

3 participants