Skip to content

enhance CLI with apply, merge, set, and firmware upload - #47

Merged
jkandasa merged 2 commits into
mycontroller-org:mainfrom
jkandasa:cli_improvements
Sep 11, 2026
Merged

enhance CLI with apply, merge, set, and firmware upload#47
jkandasa merged 2 commits into
mycontroller-org:mainfrom
jkandasa:cli_improvements

Conversation

@jkandasa

Copy link
Copy Markdown
Member

Summary

  • Add myc apply -f to add, merge, or delete gateways, nodes, sources, fields, firmware, and data repositories from YAML/JSON (including items, --dry-run, and --replace).
  • merge deep-merges maps (labels, others, provider) and keyed arrays; add fails if the resource exists unless --replace / replace: true recreates it with the same id.
  • Add myc set <kind> <id> <key-path> for stored properties (scripts via --file) and myc set value field for live field values.
  • Add myc upload firmware <id> <file> for binaries and print stored file details after upload.
  • Treat a missing field document with a supplied id as create so replace can recreate the same id.
  • Document the CLI in docs/cli.md.

Test plan

  • go test ./cmd/client/command/apply/ ./cmd/client/command/set/ ./cmd/client/command/upload/ ./cmd/client/api/ ./pkg/api/field/
  • myc apply -f resources.yaml --dry-run then apply without --replace on existing resources (expect failed: already exists)
  • myc apply -f resources.yaml --replace recreates with the same ids
  • operation: merge keeps omitted labels/provider keys and overlays only file values
  • myc set field <id> formatter.onReceive --file script.js and myc set value field <quick-id> 23.5
  • myc upload firmware <id> ./firmware.bin prints name, size, checksum, modified

Add myc apply for YAML/JSON resource files (add, merge, delete, replace),
myc set for nested properties with --file, myc set value field for live
values, and myc upload firmware for binaries. Document the CLI in docs/cli.md.
Wire myc reboot node and myc action for reboot, reset, firmware-update,
heartbeat, refresh-node-info, and gateway discover-nodes. Resolve node
quick ids (gw.node), look up gateways before acting, and accept multiple
space-separated ids.
@jkandasa
jkandasa merged commit b28c3d3 into mycontroller-org:main Sep 11, 2026
1 check passed
@jkandasa
jkandasa deleted the cli_improvements branch September 11, 2026 11:36
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.

1 participant