Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Zebradil
Copy link
Member

@Zebradil Zebradil commented Aug 9, 2025

Summary by CodeRabbit

  • New Features

    • The render command now handles both syncing external sources and rendering manifests, with new --sync and --render flags for more control.
  • Refactor

    • Consolidated CLI commands by removing the all and sync commands; all related functionality is now available via the render command.
    • Improved CLI help text and usage documentation for clarity.
    • Unified error handling for command execution.
  • Documentation

    • Updated all documentation and examples to reference the new render command structure and usage.
    • Clarified command arguments and usage in guides and examples.
  • Tests

    • Updated integration tests to use the revised render command.

@coderabbitai
Copy link

coderabbitai bot commented Aug 9, 2025

Walkthrough

The changes consolidate the CLI's sync, render, and all commands into a single render command with new flags to control behavior. The all.go and sync.go files are removed, and related documentation and tests are updated to reference the unified render command. Helper functions and usage documentation are refactored accordingly.

Changes

Cohort / File(s) Change Summary
Command Consolidation & Refactor
cmd/all.go, cmd/sync.go, cmd/root.go, cmd/render.go, cmd/util.go, main.go
Removes all and sync commands; refactors render command to handle both syncing and rendering with new flags; updates command registration; adds error handling helper; updates main entrypoint.
Documentation Updates
docs/README.md, docs/optimizations.md, docs/plugins.md, docs/smart-mode.md
Updates all documentation to replace references to all and sync commands with the unified render command and new usage patterns.
Integration Test Adjustments
internal/integration/render_test.go
Updates tests to use the new RenderCmd function instead of the removed RunAllCmd.
Comment and Minor Additions
cmd/embedded/embdedded.go
Adds a package-level comment describing the purpose of the embedded package.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI (render)
    participant Myks Globe

    User->>CLI (render): myks render [flags] [envs] [apps]
    CLI (render)->>CLI (render): Parse flags (--sync/--render)
    CLI (render)->>Myks Globe: Initialize with args
    alt --sync only
        CLI (render)->>Myks Globe: Sync()
    else --render only
        CLI (render)->>Myks Globe: Render()
    else default (both)
        CLI (render)->>Myks Globe: SyncAndRender()
    end
    Myks Globe-->>CLI (render): Success/Error
    CLI (render)-->>User: Output result or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Poem

🥕
The garden’s grown with one command,
No more “all” or “sync” to understand!
Just “render” now, both jobs in tow,
Simpler paths for seeds to sow.
Docs and tests all hop in line—
Streamlined code, and carrots shine!
—your happy code rabbit 🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch single-command

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Zebradil Zebradil changed the title feat!(cmd): replace all, sync, and render commands with a single render command feat(cmd)!: replace all, sync, and render commands with a single render command Aug 9, 2025
@Zebradil
Copy link
Member Author

Zebradil commented Aug 9, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
cmd/root.go (1)

70-81: Incorrect issues URL in help text

Help text points to example repo. Should link to the actual project issues.

-  • Report issues at https://github.com/example/myks/issues
+  • Report issues at https://github.com/mykso/myks/issues
🧹 Nitpick comments (11)
cmd/util.go (1)

13-17: Good DRY helper for fatal error handling; consider testability.

Centralizing fatal logging is solid. Optional: add a variant that returns error (e.g., okOrErr) and have okOrFatal wrap it. This makes core ops callable from tests and libraries without forcing process exit.

cmd/embedded/embdedded.go (1)

1-1: Nit: filename typo.

Consider renaming file from embdedded.go to embedded.go for consistency and to avoid confusion.

docs/optimizations.md (2)

5-5: Typo: “impreve” → “improve”.

Minor spelling fix to polish docs.


35-36: Clarify default behavior and flags.

Since render now handles both sync and render by default, consider adding a short note here about flags to run sync-only or render-only (if available), to guide users migrating from separate commands.

docs/smart-mode.md (1)

25-25: Typo: “Than means” → “That means”.

Minor grammar fix.

internal/integration/render_test.go (1)

90-90: Test updates to RenderCmd(false, false) are consistent; consider avoiding hard exits in tests.

LGTM for replacing the removed RunAllCmd. Caution: RenderCmd uses fatal exits on errors, which will terminate the test process. Consider exposing an error-returning variant (e.g., RenderCmdE or RunRender) and using it in tests to assert failures without exiting.

Also applies to: 120-120

docs/plugins.md (1)

32-32: Wording nit: prefer “myks’ render logic”

“Like the render logic of myks” reads a bit awkward. Suggest tightening the phrasing.

-Like the render logic of myks, a plugin is executed for every
+Like myks' render logic, a plugin is executed for every
docs/README.md (2)

156-159: Clarify accepted argument formats

Mention that both arguments accept comma-separated lists and the special value ALL (as reflected in the command’s usage template).

-The `render` command accepts two optional arguments:
+The `render` command accepts two optional arguments (comma-separated lists or `ALL`):
 environments and applications to process. When no arguments are provided, myks
 will use the [Smart Mode](/docs/smart-mode.md) to detect what to process.

226-226: Fix markdownlint MD014: drop prompt or show output

Static analysis flagged MD014. Either remove the leading “$ ” or include a sample output block.

-$ myks render envs --log-level debug
+myks render envs --log-level debug
cmd/render.go (2)

39-73: Usage template grammar fix

Minor grammar issue in the Smart Mode sentence.

-  0. When no arguments are provided, myks uses the Smart Mode to determine the environments and applications to process.
-     In Smart Mode, myks relies on git to only processes applications with changes.
+  0. When no arguments are provided, myks uses Smart Mode to determine the environments and applications to process.
+     In Smart Mode, myks relies on git to only process applications with changes.

74-77: Enforce mutual exclusivity via cobra

Cobra can enforce mutually exclusive flags at parse time, improving UX vs runtime fatal.

 renderCmd.Flags().BoolP("sync", "s", false, "only sync external sources")
 renderCmd.Flags().BoolP("render", "r", false, "only render manifests")
+
+// Enforce mutual exclusivity between --sync and --render
+if err := renderCmd.MarkFlagsMutuallyExclusive("sync", "render"); err != nil {
+	log.Fatal().Err(err).Msg("Failed to mark flags mutually exclusive")
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e20f78d and d80c854.

📒 Files selected for processing (12)
  • cmd/all.go (0 hunks)
  • cmd/embedded/embdedded.go (1 hunks)
  • cmd/render.go (1 hunks)
  • cmd/root.go (2 hunks)
  • cmd/sync.go (0 hunks)
  • cmd/util.go (1 hunks)
  • docs/README.md (3 hunks)
  • docs/optimizations.md (1 hunks)
  • docs/plugins.md (1 hunks)
  • docs/smart-mode.md (1 hunks)
  • internal/integration/render_test.go (2 hunks)
  • main.go (1 hunks)
💤 Files with no reviewable changes (2)
  • cmd/sync.go
  • cmd/all.go
🧰 Additional context used
🧬 Code Graph Analysis (3)
internal/integration/render_test.go (1)
cmd/render.go (1)
  • RenderCmd (82-104)
main.go (1)
cmd/root.go (1)
  • NewMyksCmd (32-47)
cmd/render.go (2)
cmd/smart-mode.go (2)
  • AnnotationSmartMode (18-18)
  • AnnotationTrue (19-19)
internal/myks/globe.go (1)
  • New (131-178)
🪛 markdownlint-cli2 (0.17.2)
docs/README.md

226-226: Dollar signs used before commands without showing output

(MD014, commands-show-output)

🔇 Additional comments (9)
cmd/embedded/embdedded.go (1)

1-1: Package doc comment LGTM.

Accurately documents package purpose and follows Go doc style.

docs/optimizations.md (1)

32-32: Docs aligned with new CLI command.

Example updated to myks render … matches the unified command behavior (sync+render by default).

docs/smart-mode.md (1)

32-32: Docs updated to use render — looks good.

Example now reflects removed all command.

main.go (1)

24-27: LGTM: inline Execute refactor

Directly executing the constructed command is clean and preserves behavior.

docs/README.md (2)

58-59: Command consolidation update looks good

Replacing “myks all” with “myks render” aligns with the new CLI.


147-150: Clear two-stage overview

The sync + render stage explanation is clear and consistent with the code.

cmd/root.go (1)

32-47: Command registration update is sound

Removing all/sync and registering only render, plus other commands, matches the new model.

cmd/render.go (2)

10-23: Well-structured command: usage, args, annotations, completion

Good separation via constructor; Args range, Smart Mode annotation, and completion hook are all appropriate.


100-103: Verify cleanup semantics for sync-only runs

Cleanup runs whenever envAppMap == nil, even if only --sync is used. If cleanup removes stale rendered artifacts, doing it after sync-only may be surprising.

Do we intend to clean rendered manifests when only syncing? If not, guard cleanup to run only when a render happened.

-	// Cleaning up only if all environments and applications were processed
-	if envAppMap == nil {
+	// Clean up only if all envs/apps were processed AND a render occurred
+	if !sync && envAppMap == nil {
 		okOrFatal(g.CleanupRenderedManifests(false), "Unable to cleanup rendered manifests")
 	}

Comment on lines +151 to 155
The `render` command handles both stages and accepts optional flags to control behavior:
- By default, it runs both sync and render stages sequentially
- Use `--sync` to only sync external sources
- Use `--render` to only render manifests

Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Document mutual exclusivity of flags

The code errors if both flags are provided (see cmd/render.go). Make this explicit in the docs.

 The `render` command handles both stages and accepts optional flags to control behavior:
 - By default, it runs both sync and render stages sequentially
 - Use `--sync` to only sync external sources
 - Use `--render` to only render manifests
+Note: `--sync` and `--render` are mutually exclusive.

🏁 Script executed:

#!/bin/bash
# Verify no stale references to removed commands remain in docs/help text.
rg -n -S -e 'myks all' -e 'myks sync' -e '^\\s+sync\\s' -e '^\\s+all\\s' -- glob:'**/*.{md,go,txt}'

Length of output: 163


Let’s re-run the search with correct glob patterns to catch any lingering references:


🏁 Script executed:

#!/bin/bash
# Verify no stale references to removed commands remain in docs/help text.
rg -n -S -e 'myks all' -e 'myks sync' --glob '**/*.md' --glob '**/*.go' --glob '**/*.txt'

Length of output: 342


Document mutual-exclusivity & clean up stale “myks sync” reference

  • In docs/README.md, add a note that the flags cannot be combined:
     The `render` command handles both stages and accepts optional flags to control behavior:
     - By default, it runs both sync and render stages sequentially
     - Use `--sync` to only sync external sources
     - Use `--render` to only render manifests
    +Note: `--sync` and `--render` are mutually exclusive.
  • In CHANGELOG.md (around line 584), there’s still a reference to the standalone myks sync step; update or remove it to reflect the new flags-based workflow.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The `render` command handles both stages and accepts optional flags to control behavior:
- By default, it runs both sync and render stages sequentially
- Use `--sync` to only sync external sources
- Use `--render` to only render manifests
The `render` command handles both stages and accepts optional flags to control behavior:
- By default, it runs both sync and render stages sequentially
- Use `--sync` to only sync external sources
- Use `--render` to only render manifests
Note: `--sync` and `--render` are mutually exclusive.
🤖 Prompt for AI Agents
In docs/README.md around lines 151 to 155, add a clear note stating that the
`--sync` and `--render` flags for the `render` command are mutually exclusive
and cannot be combined. Additionally, in CHANGELOG.md near line 584, locate and
update or remove any references to the old standalone `myks sync` step to
accurately reflect the new workflow that uses these flags instead.

@Zebradil Zebradil merged commit b23a468 into release4 Aug 9, 2025
8 checks passed
@Zebradil Zebradil deleted the single-command branch August 9, 2025 23:02
@Zebradil Zebradil mentioned this pull request Aug 9, 2025
Zebradil added a commit that referenced this pull request Aug 10, 2025
@Zebradil Zebradil mentioned this pull request Oct 20, 2025
Zebradil added a commit that referenced this pull request Oct 20, 2025
New major version with a number of improvements.

feat(cmd)!: replace `all`, `sync`, and `render` commands with a single `render` command (#570)

chore: fix typos in documentation and rename embedded.go

refactor(cmd): ensure mutuall exclusivity of sync and render flags via Cobra

feat: add config-in-root option that sets root-dir to the config file location

feat: add kbld support (#626)
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