Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
67713e3
feat: v3 api support
kulti Oct 15, 2024
d8016f5
fix: use v3 as API prefix
danya Nov 5, 2024
5ab985f
fix: invalid path for devices commands
danya Nov 6, 2024
b456abc
chore: rename v3 version binary to enapter3
kulti Nov 11, 2024
108fe59
chore: change command keys format (from _ to -)
kulti Nov 12, 2024
225cd0c
feat: add profiles download/upload commands
kulti Dec 10, 2024
76c48cf
refactor,tests: don't compare helps in update case
kulti Dec 10, 2024
d677015
tests: add http req tests
kulti Dec 10, 2024
13a7520
feat: name for blueprint archive as *.enbp
kulti Dec 16, 2024
089b1a3
feat: support rule-engine commands
kulti Dec 24, 2024
01eede6
feat: require name for rule, not slug
kulti Dec 27, 2024
0f7b1b9
feat: set req body content type
kulti Dec 27, 2024
460dda3
feat: add verbose mode
kulti Dec 27, 2024
f87ec20
bug: clean path before zip dir
kulti Dec 27, 2024
ede09da
refactor: move device-id option into devices subcommand
kulti Dec 30, 2024
1113090
feat: fix provisioning command names
kulti Dec 30, 2024
9d5c75f
feat: fix blueprints command names
kulti Dec 30, 2024
0157302
feat: fix devices command names
kulti Dec 30, 2024
093b120
feat: add device inspect and list commands
kulti Dec 30, 2024
0a6dc6a
feat: remove blueprint commands position args
kulti Dec 30, 2024
f0e1d42
fix: remove redundant print
rnovatorov Jan 6, 2025
b862131
feat: remove name field from rule
anataty Jan 7, 2025
7ea959a
rule-engine: fix create and update commands
rnovatorov Jan 10, 2025
f1228d5
feat: support streaming of rule logs
danya Jan 13, 2025
d1de38f
feat: provision lua device with a slug
kulti Jan 13, 2025
a7e00d8
feat: add reconnections for rule logs streaming
danya Jan 15, 2025
9c49ada
bug: get nil req body in verbose mode
kulti Feb 17, 2025
4133022
feat: add device delete command
kulti Feb 17, 2025
4303049
feat: support device command executions
kulti Feb 21, 2025
57c6825
fix(rule-engine): validate runtime-version
egakupi Mar 14, 2025
f076950
fix: uppercase logs enums
danya Apr 10, 2025
f6ebef4
feat: stream device logs via WebSocket
danya May 7, 2025
d334735
feat: list devices from specified site
kulti May 16, 2025
2b2236d
feat: list and inspect sites
kulti May 16, 2025
7fe0250
tests: check request
kulti May 20, 2025
fe5bdac
feat: assign-blueprint and provision lua-device with blueprint from path
kulti May 20, 2025
a317541
chore: bump go version to 1.23
kulti May 20, 2025
119cbe3
feat: rename inspect -> get
kulti Jun 27, 2025
7fa43a2
feat: rename api-host to api-url and make it visible option
kulti Jun 27, 2025
616f5db
feat: allow insecure http connection to api
kulti Jun 27, 2025
f794362
feat: add ENVIRONMENT VARIABLES to all helps
kulti Jun 27, 2025
fd8aef8
feat: rework device command execution
kulti Jun 27, 2025
ad86590
feat: cleanup unnecessary option prefixes
kulti Jun 27, 2025
b340927
fix: site-id is not required to provision standalone on Gateway
kulti Jun 27, 2025
b4373f6
feat: add missed short name for device-id option
kulti Jun 27, 2025
c10afcd
feat: hide ephemeral API
kulti Jun 30, 2025
c28a28b
docs: add expand supported values to help messages
kulti Jun 30, 2025
3711249
feat: generate device communication config
kulti Jun 30, 2025
a89e3a4
feat: delete default exec-interval value
kulti Jul 1, 2025
2ea210c
fix: make site list close to API
kulti Jul 1, 2025
45a46e0
doc: update help messages
kulti Jul 2, 2025
fb28810
feat: suggest --api-allow-insecure option
kulti Jul 9, 2025
6bfee06
feat: support non-json error response
kulti Jul 9, 2025
551bdf3
feat: support pagination for devices and sites lists
kulti Jul 10, 2025
cce32db
feat: rename provisioning to 'device create'
kulti Aug 4, 2025
93040a7
feat: rename assign-blueprint to change-blueprint
kulti Aug 4, 2025
51a58cc
bug: device generate communication config should be POST
kulti Aug 22, 2025
0512c02
bug: create lua_device or change bluerint should handle blueprin uplo…
kulti Aug 22, 2025
ce7f742
doc: improve usage for duration flags
kulti Aug 22, 2025
8d794fa
feat: support TLS for WebSockets
danya Aug 25, 2025
12daafe
feat: delete rule one by one
kulti Aug 28, 2025
04ad25c
chore: update ci
kulti Aug 28, 2025
6899d6c
feat: write CLI logs to stderr
danya Aug 28, 2025
3bedad7
feat: improve WebSockets error handling
danya Aug 28, 2025
00ed95c
feat: add device telemetry command
danya Aug 28, 2025
995790a
fix: rename new_rule_script to script when update rule
kulti Sep 3, 2025
203bd8b
help: add notice about device list order
kulti Sep 3, 2025
0e26007
fix: update device expand values
kulti Sep 3, 2025
bdce974
feat: add device update command
danya Sep 8, 2025
7ba2b35
refactor: change 'devices' to 'device'
danya Sep 8, 2025
db2e66a
Merge master into v3 branch
danya Sep 8, 2025
97a3dfa
feat: print downloaded file name
danya Sep 8, 2025
add51fa
feat: expect logs timestamp as int64
danya Nov 3, 2025
7ae5c8f
feat: add custom user agent header
danya Nov 3, 2025
3141bc2
chore: migrate to golangci-lint v2
danya Nov 3, 2025
26e7e84
cmd device change-blueprint: fix typo in description
rnovatorov Sep 19, 2025
6fbb219
fix tests of help messages
rnovatorov Dec 8, 2025
2b0de71
ci: run on `v3` branch
rnovatorov Dec 8, 2025
2b3af02
device: create-standalone: add `--device-slug` option
rnovatorov Dec 8, 2025
78f264e
refactor: consistent use of the singular form
danya Dec 10, 2025
658124e
fix: broken paths on Windows
danya Dec 10, 2025
11e5f06
feat: add initial version of remote terminal
danya Dec 11, 2025
a8f947e
feat: add connection management
danya Dec 23, 2025
51b454d
feat: use associated site-id for site commands
danya Dec 24, 2025
847b137
feat: use associated site-id for device commands
danya Dec 24, 2025
8e40885
feat: use associated site-id from rule-engine commands
danya Dec 24, 2025
669d4a8
feat: use associated site-id for provisioning commands
danya Dec 28, 2025
e43f62f
test: add more tests
danya Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,34 @@ name: CI

on:
push:
branches: [master]
branches: [master, v3]
pull_request:
branches: [master]
branches: [master, v3]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ~1.17
go-version: ~1.23
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Test
run: go test -timeout 1m ./...

golangci-lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ~1.17
go-version: ~1.23
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8
with:
version: v1.33
version: v2.5.0
25 changes: 6 additions & 19 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,18 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ~1.17
go-version: ~1.23

- name: Create release
id: goreleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update install links
run: |
wget -q https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O jq
chmod +x ./jq
tag=$(echo '${{steps.goreleaser.outputs.metadata}}' | ./jq --raw-output '.tag')
linux_name=$(echo '${{steps.goreleaser.outputs.artifacts}}' | ./jq --raw-output '.[] | select((.goos=="linux") and (.type=="Archive")) | .name')
mac_name=$(echo '${{steps.goreleaser.outputs.artifacts}}' | ./jq --raw-output '.[] | select((.goos=="darwin") and (.type=="Archive")) | .name')
win_name=$(echo '${{steps.goreleaser.outputs.artifacts}}' | ./jq --raw-output '.[] | select((.goos=="windows") and (.type=="Archive")) | .name')
download_url_prefix="https://github.com/${{github.repository}}/releases/download/${tag}"
short_url_api_prefix="https://go.enapter.com/rest/v3/short-urls"
curl -q -H "X-Api-Key: ${{secrets.ENAPTER_SHLINK_API_KEY}}" -H "Content-Type: application/json" -X PATCH ${short_url_api_prefix}/enaptercli-linux-install -d "{\"longUrl\":\"${download_url_prefix}/${linux_name}\"}"
curl -q -H "X-Api-Key: ${{secrets.ENAPTER_SHLINK_API_KEY}}" -H "Content-Type: application/json" -X PATCH ${short_url_api_prefix}/enaptercli-macos-install -d "{\"longUrl\":\"${download_url_prefix}/${mac_name}\"}"
curl -q -H "X-Api-Key: ${{secrets.ENAPTER_SHLINK_API_KEY}}" -H "Content-Type: application/json" -X PATCH ${short_url_api_prefix}/enaptercli-windows-install -d "{\"longUrl\":\"${download_url_prefix}/${win_name}\"}"
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vscode
^enapter$
enapter3
dist
.DS_Store
.DS_Store
.env
107 changes: 51 additions & 56 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,94 +1,89 @@
run:
timeout: 5m

version: "2"
linters:
disable-all: true
default: none
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- copyloopvar
- dogsled
- dupl
- err113
- errcheck
- errorlint
- exhaustive
# - exhaustivestruct
- exportloopref
- funlen
- gci
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
# - godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- golint
- gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
# - interfacer # is prone to bad suggestions (officialy deprecated)
- lll
- maligned
- misspell
- mnd
- nakedret
- nestif
# - nlreturn
- noctx
- nolintlint
- prealloc
- revive
- rowserrcheck
- scopelint
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- testpackage
- tparallel
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
# - wrapcheck
# - wsl

linters-settings:
lll:
line-length: 110
gci:
local-prefixes: github.com/enapter/enapter-cli

issues:
exclude-rules:
# Exclude gosec from running on tests files because this makes no sense.
- path: _test\.go
linters:
- gosec

# Exclude lll issues for long lines with go:generate.
- linters:
- lll
source: "^//go:generate "

# Import paths can be long.
- linters:
- lll
source: "^import "

# Links to articles can be long.
- linters:
- lll
source: "//.*(http|https)://"
settings:
lll:
line-length: 110
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- gosec
path: _test\.go
- linters:
- lll
source: '^//go:generate '
- linters:
- lll
source: '^import '
- linters:
- lll
source: //.*(http|https)://
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(github.com/enapter/enapter-cli/)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
61 changes: 47 additions & 14 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
---
project_name: enapter-cli
version: 2

release:
github:
owner: enapter
name: enapter-cli
project_name: enapter-cli

builds:
- binary: enapter
- binary: enapter3
main: ./cmd/enapter/
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
env:
- CGO_ENABLED=0
goos:
- darwin
- windows
- linux
- windows
- darwin
goarch:
- amd64
env:
- CGO_ENABLED=0
main: ./cmd/enapter/
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}
- arm64
ignore:
- goos: linux
goarch: arm64
- goos: windows
goarch: arm64

release:
github:
owner: enapter
name: enapter-cli

archives:
- formats: ['tar.gz']
wrap_in_directory: true
format_overrides:
- goos: windows
formats: ['zip']
name_template: '{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}'

checksum:
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'

snapshot:
version_template: 'SNAPSHOT-{{ .Tag }}'

changelog:
skip: true
disable: true

brews:
- repository:
owner: enapter
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
name: enapter@3
directory: Formula
homepage: https://github.com/Enapter/enapter-cli
description: Command-line tool for Enapter Energy Management System Toolkit

install: |
bin.install "enapter3"
test: |
assert_match "Enapter CLI #{version}", shell_output("#{bin}/enapter3 --version")
Loading
Loading