diff --git a/.changeset/calm-rats-battle.md b/.changeset/calm-rats-battle.md new file mode 100644 index 000000000..39684883c --- /dev/null +++ b/.changeset/calm-rats-battle.md @@ -0,0 +1,7 @@ +--- +"@smartthings/cli": patch +"@smartthings/cli-lib": patch +"@smartthings/cli-testlib": patch +--- + +Add ability to enable debug logging (to console) via env variable. diff --git a/package-lock.json b/package-lock.json index 788865bef..6e0470522 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3572,17 +3572,18 @@ } }, "node_modules/@smartthings/plugin-cli-edge": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@smartthings/plugin-cli-edge/-/plugin-cli-edge-1.11.0.tgz", - "integrity": "sha512-xE5rtPnKaNZ9vqxtqBrxi7VP9wWBLKyzM0kqewKRHLpRSSV4BTTPP8IyhihOkFc/iah3rvV7dCNFJ8SY3BWmvw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@smartthings/plugin-cli-edge/-/plugin-cli-edge-1.12.0.tgz", + "integrity": "sha512-gDukaLikONJSDu0COkuOkNsOT3Gy4ZiAxX2DRsevH9jLI4gkLtVuGHSmUdGyQ/Z3SYpcCbAhE4lt2gMk1rQLsg==", "dependencies": { - "@oclif/core": "^1.6.4", - "@smartthings/cli-lib": "^1.0.0-beta.2", - "@smartthings/core-sdk": "^3.4.0", + "@log4js-node/log4js-api": "^1.0.2", + "@oclif/core": "^1.7.0", + "@smartthings/cli-lib": "^1.0.0-beta.4", + "@smartthings/core-sdk": "^3.4.1", "axios": "^0.21.4", "inquirer": "^8.2.2", "js-yaml": "^4.1.0", - "jszip": "^3.7.1", + "jszip": "^3.9.1", "picomatch": "^2.3.1", "tslib": "^2.3.1" }, @@ -11435,9 +11436,9 @@ } }, "node_modules/jszip": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz", - "integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.9.1.tgz", + "integrity": "sha512-H9A60xPqJ1CuC4Ka6qxzXZeU8aNmgOeP5IFqwJbQQwtu2EUYxota3LdsiZWplF7Wgd9tkAd0mdu36nceSaPuYw==", "dependencies": { "lie": "~3.3.0", "pako": "~1.0.2", @@ -17641,9 +17642,9 @@ "@oclif/plugin-autocomplete": "^1.2.0", "@oclif/plugin-not-found": "^2.3.1", "@oclif/plugin-plugins": "^2.1.0", - "@smartthings/cli-lib": "^1.0.0-beta.3", + "@smartthings/cli-lib": "^1.0.0-beta.4", "@smartthings/core-sdk": "^3.4.1", - "@smartthings/plugin-cli-edge": "^1.11.0", + "@smartthings/plugin-cli-edge": "^1.12.0", "aws-sdk": "^2.1106.0", "cli-table": "^0.3.11", "inquirer": "^8.2.2", @@ -17654,7 +17655,7 @@ "smartthings": "bin/run" }, "devDependencies": { - "@smartthings/cli-testlib": "^1.0.0-beta.1", + "@smartthings/cli-testlib": "^1.0.0-beta.2", "@types/cli-table": "^0.3.0", "@types/inquirer": "^8.2.1", "@types/jest": "^27.4.1", @@ -17682,7 +17683,7 @@ }, "packages/lib": { "name": "@smartthings/cli-lib", - "version": "1.0.0-beta.3", + "version": "1.0.0-beta.4", "license": "Apache-2.0", "dependencies": { "@log4js-node/log4js-api": "^1.0.2", @@ -17733,10 +17734,10 @@ }, "packages/testlib": { "name": "@smartthings/cli-testlib", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "license": "Apache-2.0", "dependencies": { - "@smartthings/cli-lib": "^1.0.0-beta.1", + "@smartthings/cli-lib": "^1.0.0-beta.4", "@smartthings/core-sdk": "^3.4.1" }, "devDependencies": { @@ -20617,10 +20618,10 @@ "@oclif/plugin-autocomplete": "^1.2.0", "@oclif/plugin-not-found": "^2.3.1", "@oclif/plugin-plugins": "^2.1.0", - "@smartthings/cli-lib": "^1.0.0-beta.3", - "@smartthings/cli-testlib": "^1.0.0-beta.1", + "@smartthings/cli-lib": "^1.0.0-beta.4", + "@smartthings/cli-testlib": "^1.0.0-beta.2", "@smartthings/core-sdk": "^3.4.1", - "@smartthings/plugin-cli-edge": "^1.11.0", + "@smartthings/plugin-cli-edge": "^1.12.0", "@types/cli-table": "^0.3.0", "@types/inquirer": "^8.2.1", "@types/jest": "^27.4.1", @@ -20693,7 +20694,7 @@ "@smartthings/cli-testlib": { "version": "file:packages/testlib", "requires": { - "@smartthings/cli-lib": "^1.0.0-beta.1", + "@smartthings/cli-lib": "^1.0.0-beta.4", "@smartthings/core-sdk": "^3.4.1", "@types/jest": "^27.4.1", "@types/js-yaml": "^4.0.5", @@ -20727,17 +20728,18 @@ } }, "@smartthings/plugin-cli-edge": { - "version": "1.11.0", - "resolved": "https://registry.npmjs.org/@smartthings/plugin-cli-edge/-/plugin-cli-edge-1.11.0.tgz", - "integrity": "sha512-xE5rtPnKaNZ9vqxtqBrxi7VP9wWBLKyzM0kqewKRHLpRSSV4BTTPP8IyhihOkFc/iah3rvV7dCNFJ8SY3BWmvw==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/@smartthings/plugin-cli-edge/-/plugin-cli-edge-1.12.0.tgz", + "integrity": "sha512-gDukaLikONJSDu0COkuOkNsOT3Gy4ZiAxX2DRsevH9jLI4gkLtVuGHSmUdGyQ/Z3SYpcCbAhE4lt2gMk1rQLsg==", "requires": { - "@oclif/core": "^1.6.4", - "@smartthings/cli-lib": "^1.0.0-beta.2", - "@smartthings/core-sdk": "^3.4.0", + "@log4js-node/log4js-api": "^1.0.2", + "@oclif/core": "^1.7.0", + "@smartthings/cli-lib": "^1.0.0-beta.4", + "@smartthings/core-sdk": "^3.4.1", "axios": "^0.21.4", "inquirer": "^8.2.2", "js-yaml": "^4.1.0", - "jszip": "^3.7.1", + "jszip": "^3.9.1", "picomatch": "^2.3.1", "tslib": "^2.3.1" } @@ -26853,9 +26855,9 @@ } }, "jszip": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz", - "integrity": "sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==", + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.9.1.tgz", + "integrity": "sha512-H9A60xPqJ1CuC4Ka6qxzXZeU8aNmgOeP5IFqwJbQQwtu2EUYxota3LdsiZWplF7Wgd9tkAd0mdu36nceSaPuYw==", "requires": { "lie": "~3.3.0", "pako": "~1.0.2", diff --git a/packages/cli/README.md b/packages/cli/README.md index 3c9a44678..0b14147d6 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -273,7 +273,7 @@ DESCRIPTION get a specific app or a list of apps ``` -_See code: [src/commands/apps.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps.ts)_ +_See code: [src/commands/apps.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps.ts)_ ## `smartthings apps:authorize ARN` @@ -315,7 +315,7 @@ EXAMPLES It requires your machine to be configured to run the AWS CLI ``` -_See code: [src/commands/apps/authorize.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/authorize.ts)_ +_See code: [src/commands/apps/authorize.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/authorize.ts)_ ## `smartthings apps:create` @@ -344,7 +344,7 @@ DESCRIPTION create an app ``` -_See code: [src/commands/apps/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/create.ts)_ +_See code: [src/commands/apps/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/create.ts)_ ## `smartthings apps:delete [ID]` @@ -367,7 +367,7 @@ DESCRIPTION delete the app ``` -_See code: [src/commands/apps/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/delete.ts)_ +_See code: [src/commands/apps/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/delete.ts)_ ## `smartthings apps:oauth [ID]` @@ -393,7 +393,7 @@ DESCRIPTION get OAuth information for the app ``` -_See code: [src/commands/apps/oauth.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/oauth.ts)_ +_See code: [src/commands/apps/oauth.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/oauth.ts)_ ## `smartthings apps:oauth:generate [ID]` @@ -422,7 +422,7 @@ DESCRIPTION regenerate the OAuth clientId and clientSecret of an app ``` -_See code: [src/commands/apps/oauth/generate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/oauth/generate.ts)_ +_See code: [src/commands/apps/oauth/generate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/oauth/generate.ts)_ ## `smartthings apps:oauth:update [ID]` @@ -451,7 +451,7 @@ DESCRIPTION update the OAuth settings of the app ``` -_See code: [src/commands/apps/oauth/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/oauth/update.ts)_ +_See code: [src/commands/apps/oauth/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/oauth/update.ts)_ ## `smartthings apps:register [ID]` @@ -474,7 +474,7 @@ DESCRIPTION send request to app target URL to confirm existence and authorize lifecycle events ``` -_See code: [src/commands/apps/register.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/register.ts)_ +_See code: [src/commands/apps/register.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/register.ts)_ ## `smartthings apps:settings [ID]` @@ -500,7 +500,7 @@ DESCRIPTION get the settings of the app ``` -_See code: [src/commands/apps/settings.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/settings.ts)_ +_See code: [src/commands/apps/settings.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/settings.ts)_ ## `smartthings apps:settings:update [ID]` @@ -529,7 +529,7 @@ DESCRIPTION update the settings of the app ``` -_See code: [src/commands/apps/settings/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/settings/update.ts)_ +_See code: [src/commands/apps/settings/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/settings/update.ts)_ ## `smartthings apps:update [ID]` @@ -561,7 +561,7 @@ DESCRIPTION update the settings of the app ``` -_See code: [src/commands/apps/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/apps/update.ts)_ +_See code: [src/commands/apps/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/apps/update.ts)_ ## `smartthings autocomplete [SHELL]` @@ -622,7 +622,7 @@ DESCRIPTION get a specific capability ``` -_See code: [src/commands/capabilities.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities.ts)_ +_See code: [src/commands/capabilities.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities.ts)_ ## `smartthings capabilities:create` @@ -650,7 +650,7 @@ DESCRIPTION create a capability for a user ``` -_See code: [src/commands/capabilities/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/create.ts)_ +_See code: [src/commands/capabilities/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/create.ts)_ ## `smartthings capabilities:delete [ID] [VERSION]` @@ -675,7 +675,7 @@ DESCRIPTION delete a capability ``` -_See code: [src/commands/capabilities/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/delete.ts)_ +_See code: [src/commands/capabilities/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/delete.ts)_ ## `smartthings capabilities:namespaces` @@ -700,7 +700,7 @@ DESCRIPTION list all capability namespaces currently available in a user account ``` -_See code: [src/commands/capabilities/namespaces.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/namespaces.ts)_ +_See code: [src/commands/capabilities/namespaces.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/namespaces.ts)_ ## `smartthings capabilities:presentation [ID] [VERSION]` @@ -730,7 +730,7 @@ DESCRIPTION get presentation information for a specific capability ``` -_See code: [src/commands/capabilities/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation.ts)_ +_See code: [src/commands/capabilities/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation.ts)_ ## `smartthings capabilities:presentation:create [ID] [VERSION]` @@ -761,7 +761,7 @@ DESCRIPTION create presentation model for a capability ``` -_See code: [src/commands/capabilities/presentation/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation/create.ts)_ +_See code: [src/commands/capabilities/presentation/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation/create.ts)_ ## `smartthings capabilities:presentation:update [ID] [VERSION]` @@ -792,7 +792,7 @@ DESCRIPTION update presentation information of a capability ``` -_See code: [src/commands/capabilities/presentation/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation/update.ts)_ +_See code: [src/commands/capabilities/presentation/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/presentation/update.ts)_ ## `smartthings capabilities:translations [ID] [VERSION] [TAG]` @@ -951,7 +951,7 @@ EXAMPLES └──────────────────────────────────────┴───────────────────────┴──────────────────────────────────────────────────┘ ``` -_See code: [src/commands/capabilities/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/translations.ts)_ +_See code: [src/commands/capabilities/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/translations.ts)_ ## `smartthings capabilities:translations:create [ID] [VERSION]` @@ -1075,7 +1075,7 @@ EXAMPLES label: Output Modulation ``` -_See code: [src/commands/capabilities/translations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/create.ts)_ +_See code: [src/commands/capabilities/translations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/create.ts)_ ## `smartthings capabilities:translations:update [ID] [VERSION]` @@ -1199,7 +1199,7 @@ EXAMPLES label: Output Modulation ``` -_See code: [src/commands/capabilities/translations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/update.ts)_ +_See code: [src/commands/capabilities/translations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/update.ts)_ ## `smartthings capabilities:translations:upsert [ID] [VERSION]` @@ -1323,7 +1323,7 @@ EXAMPLES label: Output Modulation ``` -_See code: [src/commands/capabilities/translations/upsert.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/upsert.ts)_ +_See code: [src/commands/capabilities/translations/upsert.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/translations/upsert.ts)_ ## `smartthings capabilities:update [ID] [VERSION]` @@ -1354,7 +1354,7 @@ DESCRIPTION update a capability ``` -_See code: [src/commands/capabilities/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/capabilities/update.ts)_ +_See code: [src/commands/capabilities/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/capabilities/update.ts)_ ## `smartthings config [NAME]` @@ -1379,7 +1379,7 @@ DESCRIPTION list config file entries ``` -_See code: [src/commands/config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/config.ts)_ +_See code: [src/commands/config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/config.ts)_ ## `smartthings config:reset` @@ -1400,7 +1400,7 @@ DESCRIPTION to use?" You can use this command to clear those answers. ``` -_See code: [src/commands/config/reset.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/config/reset.ts)_ +_See code: [src/commands/config/reset.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/config/reset.ts)_ ## `smartthings device-preferences [IDORINDEX]` @@ -2301,7 +2301,7 @@ EXAMPLES $ smartthings devicepreferences 3 -o dp.json # write details as JSON for third preference to dp.json ``` -_See code: [src/commands/devicepreferences.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences.ts)_ +_See code: [src/commands/devicepreferences.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences.ts)_ ## `smartthings devicepreferences:create` @@ -2348,7 +2348,7 @@ EXAMPLES $ smartthings devicepreferences: create - i dp.json - o dp - saved.json ``` -_See code: [src/commands/devicepreferences/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences/create.ts)_ +_See code: [src/commands/devicepreferences/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences/create.ts)_ ## `smartthings devicepreferences:translations [PREFERENCEID] [TAG]` @@ -2390,7 +2390,7 @@ EXAMPLES $ smartthings devicepreferences:translations motionSensitivity ko ``` -_See code: [src/commands/devicepreferences/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations.ts)_ +_See code: [src/commands/devicepreferences/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations.ts)_ ## `smartthings devicepreferences:translations:create [PREFERENCEID]` @@ -2423,7 +2423,7 @@ EXAMPLES $ smartthings devicepreferences:translations:create -i preferenceTranslation.json ``` -_See code: [src/commands/devicepreferences/translations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations/create.ts)_ +_See code: [src/commands/devicepreferences/translations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations/create.ts)_ ## `smartthings devicepreferences:translations:update [PREFERENCEID]` @@ -2456,7 +2456,7 @@ EXAMPLES $ smartthings devicepreferences:translations:update -i preferenceTranslation.json ``` -_See code: [src/commands/devicepreferences/translations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations/update.ts)_ +_See code: [src/commands/devicepreferences/translations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences/translations/update.ts)_ ## `smartthings devicepreferences:update [ID]` @@ -2494,7 +2494,7 @@ EXAMPLES $ smartthings devicepreferences:update -i dp.yaml my-preference-id # update device preference my-preference-id with data from dp.yaml ``` -_See code: [src/commands/devicepreferences/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devicepreferences/update.ts)_ +_See code: [src/commands/devicepreferences/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devicepreferences/update.ts)_ ## `smartthings deviceprofiles [ID]` @@ -2540,7 +2540,7 @@ EXAMPLES $ smartthings deviceprofiles 4 -j -o profile.json # write the profile to the file "profile.json" ``` -_See code: [src/commands/deviceprofiles.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles.ts)_ +_See code: [src/commands/deviceprofiles.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles.ts)_ ## `smartthings deviceprofiles:create` @@ -2583,7 +2583,7 @@ EXAMPLES $ smartthings deviceprofiles:create # create a device profile with interactive dialog ``` -_See code: [src/commands/deviceprofiles/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/create.ts)_ +_See code: [src/commands/deviceprofiles/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/create.ts)_ ## `smartthings deviceprofiles:delete [ID]` @@ -2615,7 +2615,7 @@ EXAMPLES $ smartthings deviceprofiles:delete 5 # delete the 5th profile in the list ``` -_See code: [src/commands/deviceprofiles/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/delete.ts)_ +_See code: [src/commands/deviceprofiles/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/delete.ts)_ ## `smartthings deviceprofiles:device-config [ID]` @@ -2646,7 +2646,7 @@ ALIASES $ smartthings device-profiles:device-config ``` -_See code: [src/commands/deviceprofiles/device-config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/device-config.ts)_ +_See code: [src/commands/deviceprofiles/device-config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/device-config.ts)_ ## `smartthings deviceprofiles:presentation [ID]` @@ -2694,7 +2694,7 @@ EXAMPLES flag then no language header is specified in the API request ``` -_See code: [src/commands/deviceprofiles/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/presentation.ts)_ +_See code: [src/commands/deviceprofiles/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/presentation.ts)_ ## `smartthings deviceprofiles:publish [ID]` @@ -2725,7 +2725,7 @@ ALIASES $ smartthings device-profiles:publish ``` -_See code: [src/commands/deviceprofiles/publish.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/publish.ts)_ +_See code: [src/commands/deviceprofiles/publish.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/publish.ts)_ ## `smartthings deviceprofiles:translations [ID] [TAG]` @@ -2859,7 +2859,7 @@ EXAMPLES └───────────┴────────────┴───────────────────────────────┘ ``` -_See code: [src/commands/deviceprofiles/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations.ts)_ +_See code: [src/commands/deviceprofiles/translations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations.ts)_ ## `smartthings deviceprofiles:translations:delete [ID] [TAG]` @@ -2927,7 +2927,7 @@ EXAMPLES Device profile "3acbf2fc-6be2-4be0-aeb5-44759cbd66c2" translation "en" deleted ``` -_See code: [src/commands/deviceprofiles/translations/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations/delete.ts)_ +_See code: [src/commands/deviceprofiles/translations/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations/delete.ts)_ ## `smartthings deviceprofiles:translations:upsert [ID]` @@ -3025,7 +3025,7 @@ EXAMPLES description: Switchable outlet 1 power ``` -_See code: [src/commands/deviceprofiles/translations/upsert.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations/upsert.ts)_ +_See code: [src/commands/deviceprofiles/translations/upsert.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/translations/upsert.ts)_ ## `smartthings deviceprofiles:update [ID]` @@ -3058,7 +3058,7 @@ ALIASES $ smartthings device-profiles:update ``` -_See code: [src/commands/deviceprofiles/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/update.ts)_ +_See code: [src/commands/deviceprofiles/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/update.ts)_ ## `smartthings deviceprofiles:view [ID]` @@ -3089,7 +3089,7 @@ ALIASES $ smartthings device-profiles:view ``` -_See code: [src/commands/deviceprofiles/view.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view.ts)_ +_See code: [src/commands/deviceprofiles/view.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view.ts)_ ## `smartthings deviceprofiles:view:create` @@ -3166,7 +3166,7 @@ EXAMPLES - capability: switch ``` -_See code: [src/commands/deviceprofiles/view/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view/create.ts)_ +_See code: [src/commands/deviceprofiles/view/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view/create.ts)_ ## `smartthings deviceprofiles:view:update [ID]` @@ -3252,7 +3252,7 @@ EXAMPLES - capability: switch ``` -_See code: [src/commands/deviceprofiles/view/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view/update.ts)_ +_See code: [src/commands/deviceprofiles/view/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/deviceprofiles/view/update.ts)_ ## `smartthings devices [ID]` @@ -3291,7 +3291,7 @@ DESCRIPTION list all devices available in a user account or retrieve a single device ``` -_See code: [src/commands/devices.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices.ts)_ +_See code: [src/commands/devices.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices.ts)_ ## `smartthings devices:capability-status [ID] [COMPONENT] [CAPABILITY]` @@ -3320,7 +3320,7 @@ DESCRIPTION get the current status of all of a device capability's attributes ``` -_See code: [src/commands/devices/capability-status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/capability-status.ts)_ +_See code: [src/commands/devices/capability-status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/capability-status.ts)_ ## `smartthings devices:commands [ID] [COMMAND]` @@ -3348,7 +3348,7 @@ DESCRIPTION execute a device command ``` -_See code: [src/commands/devices/commands.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/commands.ts)_ +_See code: [src/commands/devices/commands.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/commands.ts)_ ## `smartthings devices:component-status [ID] [COMPONENT]` @@ -3376,7 +3376,7 @@ DESCRIPTION get the current status of a device component's attributes ``` -_See code: [src/commands/devices/component-status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/component-status.ts)_ +_See code: [src/commands/devices/component-status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/component-status.ts)_ ## `smartthings devices:delete [ID]` @@ -3399,7 +3399,7 @@ DESCRIPTION delete a device ``` -_See code: [src/commands/devices/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/delete.ts)_ +_See code: [src/commands/devices/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/delete.ts)_ ## `smartthings devices:health [ID]` @@ -3425,7 +3425,7 @@ DESCRIPTION get the current health status of a device ``` -_See code: [src/commands/devices/health.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/health.ts)_ +_See code: [src/commands/devices/health.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/health.ts)_ ## `smartthings devices:preferences [ID]` @@ -3451,7 +3451,7 @@ DESCRIPTION get the current preferences of a device ``` -_See code: [src/commands/devices/preferences.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/preferences.ts)_ +_See code: [src/commands/devices/preferences.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/preferences.ts)_ ## `smartthings devices:presentation [ID]` @@ -3477,7 +3477,7 @@ DESCRIPTION get a device presentation ``` -_See code: [src/commands/devices/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/presentation.ts)_ +_See code: [src/commands/devices/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/presentation.ts)_ ## `smartthings devices:rename [ID] [LABEL]` @@ -3505,7 +3505,7 @@ DESCRIPTION rename a device ``` -_See code: [src/commands/devices/rename.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/rename.ts)_ +_See code: [src/commands/devices/rename.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/rename.ts)_ ## `smartthings devices:status [ID]` @@ -3531,7 +3531,7 @@ DESCRIPTION get the current status of all of a device's component's attributes ``` -_See code: [src/commands/devices/status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/status.ts)_ +_See code: [src/commands/devices/status.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/status.ts)_ ## `smartthings devices:update [ID]` @@ -3560,7 +3560,7 @@ DESCRIPTION get the current status of all of a device's component's attributes ``` -_See code: [src/commands/devices/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/devices/update.ts)_ +_See code: [src/commands/devices/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/devices/update.ts)_ ## `smartthings edge:channels [IDORINDEX]` @@ -3569,7 +3569,7 @@ list all channels owned by you or retrieve a single channel ``` USAGE $ smartthings edge:channels [IDORINDEX] [-h] [-p ] [-t ] [--language ] [-O ] [-j] - [-y] [-o ] [-A] [-I] [--subscriber-id --subscriber-type HUB] + [-y] [-o ] [-I | -A] [--subscriber-id --subscriber-type HUB] ARGUMENTS IDORINDEX the channel id or number in list @@ -3604,7 +3604,7 @@ EXAMPLES $ smartthings edge:channels --subscriber-type HUB --subscriber-id ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels.ts)_ ## `smartthings edge:channels:assign [DRIVERID] [VERSION]` @@ -3634,7 +3634,7 @@ ALIASES $ smartthings edge:drivers:publish ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/assign.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/assign.ts)_ ## `smartthings edge:channels:assignments [IDORINDEX]` @@ -3690,7 +3690,7 @@ DESCRIPTION create a channel ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/create.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/create.ts)_ ## `smartthings edge:channels:delete [ID]` @@ -3714,7 +3714,7 @@ DESCRIPTION delete a channel ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/delete.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/delete.ts)_ ## `smartthings edge:channels:drivers [IDORINDEX]` @@ -3745,7 +3745,7 @@ ALIASES $ smartthings edge:channels:assignments ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/drivers.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/drivers.ts)_ ## `smartthings edge:channels:enroll [HUBID]` @@ -3771,7 +3771,7 @@ DESCRIPTION enroll a hub in a channel ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/enroll.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/enroll.ts)_ ## `smartthings edge:channels:enrollments [IDORINDEX]` @@ -3799,7 +3799,7 @@ DESCRIPTION list all channels a given hub is enrolled in ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/enrollments.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/enrollments.ts)_ ## `smartthings edge:channels:invitations [IDORINDEX]` @@ -3991,7 +3991,7 @@ EXAMPLES $ smartthings edge:channels:invites # list details about the invite with id ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/invites.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/invites.ts)_ ## `smartthings edge:channels:invites:accept ID` @@ -4018,7 +4018,7 @@ ALIASES $ smartthings edge:channels:invitations:accept ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/invites/accept.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/invites/accept.ts)_ ## `smartthings edge:channels:invites:create` @@ -4049,7 +4049,7 @@ ALIASES $ smartthings edge:channels:invitations:create ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/invites/create.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/invites/create.ts)_ ## `smartthings edge:channels:invites:delete [ID]` @@ -4080,7 +4080,7 @@ ALIASES $ smartthings edge:channels:invites:revoke ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/invites/delete.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/invites/delete.ts)_ ## `smartthings edge:channels:invites:revoke [ID]` @@ -4151,7 +4151,7 @@ EXAMPLES 699c7308-8c72-4363-9571-880d0f5cc725 ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/metainfo.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/metainfo.ts)_ ## `smartthings edge:channels:unassign [DRIVERID]` @@ -4180,7 +4180,7 @@ ALIASES $ smartthings edge:drivers:unpublish ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/unassign.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/unassign.ts)_ ## `smartthings edge:channels:unenroll [HUBID]` @@ -4206,7 +4206,7 @@ DESCRIPTION unenroll a hub from a channel ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/unenroll.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/unenroll.ts)_ ## `smartthings edge:channels:update [ID]` @@ -4236,7 +4236,7 @@ DESCRIPTION update a channel ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/channels/update.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/channels/update.ts)_ ## `smartthings edge:drivers [IDORINDEX]` @@ -4285,7 +4285,7 @@ EXAMPLES $ smartthings edge:drivers 699c7308-8c72-4363-9571-880d0f5cc725 --version 2021-10-25T00:48:23.295969 ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers.ts)_ ## `smartthings edge:drivers:delete [ID]` @@ -4309,7 +4309,7 @@ DESCRIPTION delete an edge driver ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/delete.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/delete.ts)_ ## `smartthings edge:drivers:install [DRIVERID]` @@ -4343,7 +4343,7 @@ EXAMPLES $ smartthings edge:drivers:install -H -C # install a driver from a channel on an enrolled hub ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/install.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/install.ts)_ ## `smartthings edge:drivers:installed [IDORINDEX]` @@ -4372,7 +4372,7 @@ DESCRIPTION list all drivers installed on a given hub ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/installed.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/installed.ts)_ ## `smartthings edge:drivers:logcat [DRIVERID]` @@ -4399,7 +4399,7 @@ DESCRIPTION stream logs from installed drivers ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/logcat.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/logcat.ts)_ ## `smartthings edge:drivers:package [PROJECTDIRECTORY]` @@ -4453,7 +4453,7 @@ EXAMPLES $ smartthings edge:drivers:package -u driver.zip ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/package.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/package.ts)_ ## `smartthings edge:drivers:publish [DRIVERID] [VERSION]` @@ -4507,7 +4507,7 @@ DESCRIPTION uninstall an edge driver from a hub ``` -_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.11.0/src/commands/edge/drivers/uninstall.ts)_ +_See code: [@smartthings/plugin-cli-edge](https://github.com/SmartThingsCommunity/edge-cli-plugin/blob/v1.12.0/src/commands/edge/drivers/uninstall.ts)_ ## `smartthings edge:drivers:unpublish [DRIVERID]` @@ -4563,7 +4563,7 @@ DESCRIPTION get a specific app or a list of apps ``` -_See code: [src/commands/installedapps.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/installedapps.ts)_ +_See code: [src/commands/installedapps.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/installedapps.ts)_ ## `smartthings installedapps:delete [ID]` @@ -4588,7 +4588,7 @@ DESCRIPTION delete the installed app instance ``` -_See code: [src/commands/installedapps/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/installedapps/delete.ts)_ +_See code: [src/commands/installedapps/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/installedapps/delete.ts)_ ## `smartthings installedapps:rename [ID] [NAME]` @@ -4618,7 +4618,7 @@ DESCRIPTION renamed an installed app instance ``` -_See code: [src/commands/installedapps/rename.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/installedapps/rename.ts)_ +_See code: [src/commands/installedapps/rename.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/installedapps/rename.ts)_ ## `smartthings installedschema [ID]` @@ -4647,7 +4647,7 @@ DESCRIPTION get a specific schema connector instance or a list of instances ``` -_See code: [src/commands/installedschema.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/installedschema.ts)_ +_See code: [src/commands/installedschema.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/installedschema.ts)_ ## `smartthings installedschema:delete [ID]` @@ -4672,7 +4672,7 @@ DESCRIPTION delete the installed schema connector instance ``` -_See code: [src/commands/installedschema/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/installedschema/delete.ts)_ +_See code: [src/commands/installedschema/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/installedschema/delete.ts)_ ## `smartthings locations [IDORINDEX]` @@ -4698,7 +4698,7 @@ DESCRIPTION list locations or get information for a specific Location ``` -_See code: [src/commands/locations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations.ts)_ +_See code: [src/commands/locations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations.ts)_ ## `smartthings locations:create` @@ -4724,7 +4724,7 @@ DESCRIPTION create a Location for a user ``` -_See code: [src/commands/locations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/create.ts)_ +_See code: [src/commands/locations/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/create.ts)_ ## `smartthings locations:delete [ID]` @@ -4752,7 +4752,7 @@ EXAMPLES $ smartthings locations:delete my-location-id # delete the location with the specified id ``` -_See code: [src/commands/locations/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/delete.ts)_ +_See code: [src/commands/locations/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/delete.ts)_ ## `smartthings locations:rooms [IDORINDEX]` @@ -4783,7 +4783,7 @@ ALIASES $ smartthings rooms ``` -_See code: [src/commands/locations/rooms.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/rooms.ts)_ +_See code: [src/commands/locations/rooms.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/rooms.ts)_ ## `smartthings locations:rooms:create` @@ -4813,7 +4813,7 @@ ALIASES $ smartthings rooms:create ``` -_See code: [src/commands/locations/rooms/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/rooms/create.ts)_ +_See code: [src/commands/locations/rooms/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/rooms/create.ts)_ ## `smartthings locations:rooms:delete [ID]` @@ -4840,7 +4840,7 @@ ALIASES $ smartthings rooms:delete ``` -_See code: [src/commands/locations/rooms/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/rooms/delete.ts)_ +_See code: [src/commands/locations/rooms/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/rooms/delete.ts)_ ## `smartthings locations:rooms:update [ID]` @@ -4873,7 +4873,7 @@ ALIASES $ smartthings rooms:update ``` -_See code: [src/commands/locations/rooms/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/rooms/update.ts)_ +_See code: [src/commands/locations/rooms/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/rooms/update.ts)_ ## `smartthings locations:update [ID]` @@ -4902,7 +4902,7 @@ DESCRIPTION update a location ``` -_See code: [src/commands/locations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/locations/update.ts)_ +_See code: [src/commands/locations/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/locations/update.ts)_ ## `smartthings logout` @@ -4917,7 +4917,7 @@ FLAGS --language= ISO language code or "NONE" to not specify a language. Defaults to the OS locale ``` -_See code: [src/commands/logout.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/logout.ts)_ +_See code: [src/commands/logout.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/logout.ts)_ ## `smartthings organizations [ID]` @@ -4943,7 +4943,7 @@ DESCRIPTION list all organizations the user belongs to ``` -_See code: [src/commands/organizations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/organizations.ts)_ +_See code: [src/commands/organizations.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/organizations.ts)_ ## `smartthings organizations:current` @@ -4968,7 +4968,7 @@ DESCRIPTION return the currently active organization ``` -_See code: [src/commands/organizations/current.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/organizations/current.ts)_ +_See code: [src/commands/organizations/current.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/organizations/current.ts)_ ## `smartthings plugins` @@ -5255,7 +5255,7 @@ EXAMPLES flag then no language header is specified in the API request ``` -_See code: [src/commands/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/presentation.ts)_ +_See code: [src/commands/presentation.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/presentation.ts)_ ## `smartthings presentation:device-config PRESENTATIONID [MANUFACTURERNAME]` @@ -5283,7 +5283,7 @@ DESCRIPTION query device config by presentationId ``` -_See code: [src/commands/presentation/device-config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/presentation/device-config.ts)_ +_See code: [src/commands/presentation/device-config.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/presentation/device-config.ts)_ ## `smartthings presentation:device-config:create` @@ -5309,7 +5309,7 @@ DESCRIPTION create a device config ``` -_See code: [src/commands/presentation/device-config/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/presentation/device-config/create.ts)_ +_See code: [src/commands/presentation/device-config/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/presentation/device-config/create.ts)_ ## `smartthings presentation:device-config:generate ID` @@ -5339,7 +5339,7 @@ DESCRIPTION generate the default device configuration ``` -_See code: [src/commands/presentation/device-config/generate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/presentation/device-config/generate.ts)_ +_See code: [src/commands/presentation/device-config/generate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/presentation/device-config/generate.ts)_ ## `smartthings rooms [IDORINDEX]` @@ -5480,7 +5480,7 @@ DESCRIPTION get a specific rule ``` -_See code: [src/commands/rules.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/rules.ts)_ +_See code: [src/commands/rules.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/rules.ts)_ ## `smartthings rules:create` @@ -5507,7 +5507,7 @@ DESCRIPTION create a rule ``` -_See code: [src/commands/rules/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/rules/create.ts)_ +_See code: [src/commands/rules/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/rules/create.ts)_ ## `smartthings rules:delete [ID]` @@ -5531,7 +5531,7 @@ DESCRIPTION delete a rule ``` -_See code: [src/commands/rules/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/rules/delete.ts)_ +_See code: [src/commands/rules/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/rules/delete.ts)_ ## `smartthings rules:execute [ID]` @@ -5570,7 +5570,7 @@ EXAMPLES $ smartthings rules:execute 699c7308-8c72-4363-9571-880d0f5cc725 ``` -_See code: [src/commands/rules/execute.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/rules/execute.ts)_ +_See code: [src/commands/rules/execute.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/rules/execute.ts)_ ## `smartthings rules:update [ID]` @@ -5600,7 +5600,7 @@ DESCRIPTION update a rule ``` -_See code: [src/commands/rules/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/rules/update.ts)_ +_See code: [src/commands/rules/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/rules/update.ts)_ ## `smartthings schema [ID]` @@ -5627,7 +5627,7 @@ DESCRIPTION list all ST Schema Apps currently available in a user account ``` -_See code: [src/commands/schema.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema.ts)_ +_See code: [src/commands/schema.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema.ts)_ ## `smartthings schema:authorize ARN` @@ -5669,7 +5669,7 @@ EXAMPLES It requires your machine to be configured to run the AWS CLI ``` -_See code: [src/commands/schema/authorize.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema/authorize.ts)_ +_See code: [src/commands/schema/authorize.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema/authorize.ts)_ ## `smartthings schema:create` @@ -5698,7 +5698,7 @@ DESCRIPTION create an ST Schema connector ``` -_See code: [src/commands/schema/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema/create.ts)_ +_See code: [src/commands/schema/create.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema/create.ts)_ ## `smartthings schema:delete [ID]` @@ -5721,7 +5721,7 @@ DESCRIPTION delete the ST Schema connector ``` -_See code: [src/commands/schema/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema/delete.ts)_ +_See code: [src/commands/schema/delete.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema/delete.ts)_ ## `smartthings schema:regenerate [ID]` @@ -5748,7 +5748,7 @@ DESCRIPTION may affect existing installations. ``` -_See code: [src/commands/schema/regenerate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema/regenerate.ts)_ +_See code: [src/commands/schema/regenerate.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema/regenerate.ts)_ ## `smartthings schema:update [ID]` @@ -5778,10 +5778,18 @@ DESCRIPTION update an ST Schema connector ``` -_See code: [src/commands/schema/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/v1.0.0-beta.4/packages/cli/src/commands/schema/update.ts)_ +_See code: [src/commands/schema/update.ts](https://github.com/SmartThingsCommunity/smartthings-cli/blob/@smartthings/cli@1.0.0-beta.4/packages/cli/src/commands/schema/update.ts)_ # Configuration and Logging +## Enable Debug Logging + +Debug logging can be enabled via the `SMARTTHINGS_DEBUG` environment variable. This will log at debug level to the console as well as the default log file. + +```console +SMARTTHINGS_DEBUG=true smartthings +``` + More details about advanced configuration and logging in the CLI can be found on the -[configuration documentation page](https://github.com/SmartThingsCommunity/smartthings-cli/blob/master/packages/cli/doc/configuration.md). +[configuration documentation page](./doc/configuration.md). diff --git a/packages/cli/doc/configuration.md b/packages/cli/doc/configuration.md index d0052cdb9..036ffb1eb 100644 --- a/packages/cli/doc/configuration.md +++ b/packages/cli/doc/configuration.md @@ -73,8 +73,8 @@ The CLI uses [log4js](https://log4js-node.github.io/log4js-node/) for logging. Logging can be configured using a YAML file called `logging.yaml` in the same location as the config file mentioned above. The contents of this file are passed directly to log4js (overriding any default behavior) so any valid log4js configuration can be included -here. The following categories are used in the CLI: +here. The following log categories are used in the CLI: -* rest-client - This category is used for the SDK that interfaces with the API. - Turn this on to see detailed information for HTTP calls are made to SmartThings. -* cli - This is the generic logger used by the CLI. +* `cli` - Generic logger used by the CLI. Log entries will have the command name appended. (ex. `cli.DriversCommand`) +* `rest-client` - Used for the SDK that interfaces with the SmartThings API. +* `login-authenticator` - Used in the default OAuth login flow. diff --git a/packages/cli/package.json b/packages/cli/package.json index 58c02b0c0..33c4af408 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -46,7 +46,7 @@ "hooks": { "init": "./lib/hooks/init/init-config" }, - "repositoryPrefix": "<%- repo %>/blob/v<%- version %>/packages/cli/<%- commandPath %>", + "repositoryPrefix": "<%- repo %>/blob/@smartthings/cli@<%- version %>/packages/cli/<%- commandPath %>", "additionalHelpFlags": [ "-h" ] @@ -71,9 +71,9 @@ "@oclif/plugin-autocomplete": "^1.2.0", "@oclif/plugin-not-found": "^2.3.1", "@oclif/plugin-plugins": "^2.1.0", - "@smartthings/cli-lib": "^1.0.0-beta.3", + "@smartthings/cli-lib": "^1.0.0-beta.4", "@smartthings/core-sdk": "^3.4.1", - "@smartthings/plugin-cli-edge": "^1.11.0", + "@smartthings/plugin-cli-edge": "^1.12.0", "aws-sdk": "^2.1106.0", "cli-table": "^0.3.11", "inquirer": "^8.2.2", @@ -81,7 +81,7 @@ "log4js": "6.3.0" }, "devDependencies": { - "@smartthings/cli-testlib": "^1.0.0-beta.1", + "@smartthings/cli-testlib": "^1.0.0-beta.2", "@types/cli-table": "^0.3.0", "@types/inquirer": "^8.2.1", "@types/jest": "^27.4.1", diff --git a/packages/cli/src/__tests__/lib/log-utils.test.ts b/packages/cli/src/__tests__/lib/log-utils.test.ts new file mode 100644 index 000000000..909d37d5e --- /dev/null +++ b/packages/cli/src/__tests__/lib/log-utils.test.ts @@ -0,0 +1,90 @@ +import { buildDefaultLog4jsConfig, loadLog4jsConfig } from '../../lib/log-utils' +import log4js from 'log4js' +import yaml from 'js-yaml' +import { yamlExists } from '@smartthings/cli-lib' + + +jest.mock('fs') +jest.mock('js-yaml') + +describe('log-utils', () => { + afterEach(() => { + jest.resetAllMocks() + }) + + describe('buildDefaultLog4jsConfig', () => { + it('returns "default" category configured at warn level with file appender', () => { + expect(buildDefaultLog4jsConfig('filename')).toStrictEqual({ + appenders: { + smartthings: expect.objectContaining({ + type: 'file', + filename: 'filename', + maxLogSize: 1_000_000, + backups: 1, + keepFileExt: true, + }), + }, + categories: { + default: { appenders: ['smartthings'], level: 'warn' }, + }, + }) + }) + }) + + it('lowers "default" category level to debug and adds stderr appender when debug env variable is set', () => { + process.env.SMARTTHINGS_DEBUG = 'true' + + expect(buildDefaultLog4jsConfig('filename')).toStrictEqual({ + appenders: { + smartthings: expect.objectContaining({ + type: 'file', + filename: 'filename', + maxLogSize: 1_000_000, + backups: 1, + keepFileExt: true, + }), + debug: expect.objectContaining({ type: 'stderr' }), + }, + categories: { + default: { appenders: ['smartthings', 'debug'], level: 'debug' }, + }, + }) + }) + + describe('loadLog4jsConfig', () => { + const defaultConfig: log4js.Configuration = { + appenders: {}, + categories: {}, + } + const mockYamlExists = jest.mocked(yamlExists) + const mockLoad = jest.mocked(yaml.load) + + it('returns default config if requested file is not found', () => { + mockYamlExists.mockReturnValueOnce(false) + + expect(loadLog4jsConfig('filename', defaultConfig)).toStrictEqual(defaultConfig) + expect(mockYamlExists).toBeCalledWith('filename') + }) + + it('returns valid config if found', () => { + const loadedConfig: log4js.Configuration = { + appenders: { appender: { type: '' } }, + categories: {}, + } + mockLoad.mockReturnValueOnce(loadedConfig) + mockYamlExists.mockReturnValueOnce(true) + + expect(loadLog4jsConfig('filename', defaultConfig)).toStrictEqual(loadedConfig) + }) + + it('throws error if config is invalid', () => { + const invalidConfig = { + appenders: {}, + } + mockLoad.mockReturnValueOnce(invalidConfig) + mockYamlExists.mockReturnValueOnce(true) + + expect(() => loadLog4jsConfig('filename', defaultConfig)).toThrow('invalid or unreadable logging config file format') + }) + }) +}) diff --git a/packages/cli/src/lib/log-utils.ts b/packages/cli/src/lib/log-utils.ts index fff3d02a0..c8d631e80 100644 --- a/packages/cli/src/lib/log-utils.ts +++ b/packages/cli/src/lib/log-utils.ts @@ -1,7 +1,6 @@ import fs from 'fs' import yaml from 'js-yaml' -import { Configuration as Log4jsConfig, FileAppender, StandardErrorAppender, LogLevelFilterAppender } from 'log4js' - +import { Configuration as Log4jsConfig, FileAppender, StandardErrorAppender } from 'log4js' import { yamlExists } from '@smartthings/cli-lib' @@ -11,6 +10,13 @@ const LOGGING_DOCS_URL = 'https://github.com/SmartThingsCommunity/smartthings-cl export function buildDefaultLog4jsConfig(logFilename: string): Log4jsConfig { + const config: Log4jsConfig = { + appenders: {}, + categories: { + default: { appenders: ['smartthings'], level: 'warn' }, + }, + } + const fileAppender: FileAppender = { type: 'file', filename: logFilename, @@ -19,26 +25,17 @@ export function buildDefaultLog4jsConfig(logFilename: string): Log4jsConfig { keepFileExt: true, } - const stderrAppender: StandardErrorAppender = { type: 'stderr' } + config.appenders.smartthings = fileAppender - const LogLevelFilterAppender: LogLevelFilterAppender = { - type: 'logLevelFilter', - appender: 'stderr', - level: 'error', - } + if (process.env.SMARTTHINGS_DEBUG) { + const stderrAppender: StandardErrorAppender = { type: 'stderr' } - return { - appenders: { - smartthings: fileAppender, - stderr: stderrAppender, - errors: LogLevelFilterAppender, - }, - categories: { - default: { appenders: ['smartthings', 'errors'], level: 'warn' }, - 'rest-client': { appenders: ['smartthings', 'errors'], level: 'warn' }, - cli: { appenders: ['smartthings', 'errors'], level: 'warn' }, - }, + config.appenders.debug = stderrAppender + config.categories.default.appenders.push('debug') + config.categories.default.level = 'debug' } + + return config } function isLog4jsConfig(config: unknown): config is Log4jsConfig { diff --git a/packages/lib/src/__tests__/smartthings-command.test.ts b/packages/lib/src/__tests__/smartthings-command.test.ts index d22af8683..164755db1 100644 --- a/packages/lib/src/__tests__/smartthings-command.test.ts +++ b/packages/lib/src/__tests__/smartthings-command.test.ts @@ -132,7 +132,7 @@ describe('SmartThingsCommand', () => { it('should set logger on first access', () => { const getLoggerMock = jest.mocked(log4js.getLogger) expect(smartThingsCommand.logger).toBeDefined() - expect(getLoggerMock).toBeCalledWith('cli') + expect(getLoggerMock).toBeCalledWith('cli.TestCommand') }) describe('stringConfigValue', () => { diff --git a/packages/lib/src/smartthings-command.ts b/packages/lib/src/smartthings-command.ts index 6bc9ce403..18fe55bd5 100644 --- a/packages/lib/src/smartthings-command.ts +++ b/packages/lib/src/smartthings-command.ts @@ -85,7 +85,7 @@ export abstract class SmartThingsCommand extends Command implements SmartThingsC private _logger?: log4js.Logger get logger(): log4js.Logger { if (!this._logger) { - this._logger = log4js.getLogger('cli') + this._logger = log4js.getLogger(`cli.${this.constructor.name}`) } return this._logger } diff --git a/packages/testlib/src/index.ts b/packages/testlib/src/index.ts index 2837fe242..a8b12046d 100644 --- a/packages/testlib/src/index.ts +++ b/packages/testlib/src/index.ts @@ -19,6 +19,7 @@ jest.mock('@smartthings/cli-lib', () => { resetManagedConfig: jest.fn(), formatAndWriteItem: jest.fn(), withLocationsAndRooms: jest.fn(), + yamlExists: jest.fn(), summarizedText: 'summarized text', // TODO refactor test using this } })