Coder Social home page Coder Social logo

nimbella / commander-cli Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 3.0 7.66 MB

Commander CLI is a Nimbella Commander development tool that allows you to create, run & publish your serverless functions as commands that can run in Slack, Microsoft Teams, and Mattermost.

Home Page: https://nimbella.com/product/commander

License: Apache License 2.0

JavaScript 99.93% Batchfile 0.07%
command-line-tool commander mattermost microsoft-teams nimbella slack

commander-cli's People

Contributors

bhageena avatar joshuaauerbachwatson avatar jthomas avatar niks3089 avatar rabbah avatar satyarohith avatar v-shant avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

commander-cli's Issues

better error when api host is invalid

> nim commander
Please wait, we're registering your account with commander...nc> Error: Request failed with status code 401
    at createError (node_modules/axios/lib/core/createError.js:16:15)
    at settle (node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (node_modules/axios/lib/adapters/http.js:236:11)
    at IncomingMessage.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1226:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)

csm_update <path> is not updating the content

I changed the commands.yml and removed certain parameters and tried csm_update <path>. I saw the message as updated successfully. However, command_list did not show any commands updated.

csm_install doesn't work for local project

/nc csm_install ./github fails with the below message, while same setup works for remote/github path

 /nc csm_install ./github
Error: Invalid file type. Navigate to https://nimbella.com/resources-commander/reference#csm_install for more help.
 nc> 

integrate commander client / config with nimbella cli credential store

  • performed client add operation
  • exited the repo then ran nim commander again which showed:
> nim commander
Your client: xyz (cli) (abc...)
Your namespace: not-my-slack-namespace

A csm install at that point failed with this message:

nc> csm_install .
  ✔ Packaging foo...
  ✔ Installing foo...
Error: You are not an administrator of nc application. Navigate to https://nimbella.com/resources-commander/reference#csm_install for more help.

Update version of marked used?

When I'm installing this dependency for this Nimbella CLI - it's complaining about the following:

 ~/code/nimbella/nimbella-cli  master ⇡2  npm install                                                                                                            1 ✘  10:50:12
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/marked
npm WARN   marked@"^0.8.2" from [email protected]
npm WARN   node_modules/commander
npm WARN     commander@"nimbella/commander-cli#9bde76cc8d9e80ebda444f2d5a10102dc1590aca" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer marked@"^1.0.0 || ^2.0.0" from [email protected]
npm WARN node_modules/marked-terminal
npm WARN   marked-terminal@"^4.0.0" from [email protected]
npm WARN   node_modules/commander

marked is now at 2.0.3 - whereas this repo is using a pre-1.0.0 version. Could we upgrade that version? Happy to sumbit a PR....

cannot start commander cli if credential store is missing

If there are no logged namespace, the repl will fail to start:

nc> Error: You do not have a current namespace.  Use 'nim auth login' to create a new one or 'nim auth switch' to use an existing one
    at getCredentials (/Users/rabbah/projects/nimbella/commander-cli/node_modules/nimbella-deployer/lib/credentials.js:1:3282)
    at async Object.isFirstLogin (/Users/rabbah/projects/nimbella/commander-cli/src/credentials.js:100:25)

add help/example for csm install from local path and personal git

Under quick tipcs for commander help:

Commander Commands
command_create <command> [<parameters>] ... - Creates a command & opens online source editor
csm_install <command-set> ... - Install from Nimbella Command Set Registry: https://github.com/nimbella/command-sets

I suggest adding how to install from a path where path should have /local/path/to/command-set and github:your-repo/path/to/command-set as quick tips as well.

csm_install fails when absolute path is givem

 nc> csm_install /Users/nikhil/projects/nimbella/portal-api/nimbella
Error: Invalid file type. Navigate to https://nimbella.com/resources-commander/reference#csm_install for more help.
 nc> csm_install ./nimbella
  ✔ Packaging nimbella...
  ✔ Uploading nimbella...
Installed nimbella command-set for app nc, containing the following commands:
test: Test command,

improve client login

  • the nim commander help menu should tell you how to login with a client id (i have to look this up every time)

  • the info you get slack is in the form of X:Y but the client login command expect X Y. We should change this to accept X:Y so it works with copy/paste.

client <bogus> is not rejected

start the repl and enter the command client bogus:

 nc> client bogus
Currently used credentials:
Account Name: Commander CLI
Username: ...
Client: cli

do not auto-register

instead inform the user the namespace is not yet registered and allow them to do it explicitly.

csm_install doesn't work

The code assumes the csm_install is only for local projects :

    if (command.startsWith('csm_install') || command.startsWith('csm_update')) {
      return await csmInstallOrUpdate(command);
    }

Hence regular command-sets from our github repo cannot be installed:

 nc> csm_install awsbill
Error: Path /Users/nikhil/projects/nimbella/awsbill doesn't exist.
 nc> csm_install gcloud
Error: Path /Users/nikhil/projects/nimbella/gcloud doesn't exist.
 nc>

nim commander docs does not work as expected

Run nim commander help and you get a help menu as follows:

> nim commander help
Commander CLI
A CLI to interact with Commander from your terminal.

USAGE
$ nim commander - launch Commander REPL
$ nim commander help - display help for Commander CLI.
$ nim commander docs - open documentation
$ nim commander <command> [command_params/command_options] - run commander commands
...

But run the shows command for docs and:

> nim commander docs
Command not found, Did you mean /nc csm ?

client may "register" in the local credential store before registering remotely

const register = async () => {
const { username, password } = await getUserCreds();
await setClientCreds({
accountName: 'Commander CLI',
username,
password,
client: 'cli',
});

try {
const res = await invokeCommand('register');
const text = res.data.attachments
? res.data.attachments[0].text

Note the credential store is updated first. So if the remote registration fails, the credential store is incorrect.

command_set create doesn't work

/nc command_set create fails with below message

/nc command_set create
Command not found, Did you mean /nc command_log ?
 nc> 

rethink credentials/metadata stored in nimbella credential store

the current implementation attaches a commander object to a namespace.

"commander": {
  "clients": {
      "aaa....": {
        "accountName": "Commander CLI",
        "username": "aaa...",
        "password": "bbb...",
        "client": "cli"
      },
      "wxyz": {
        "accountName": "x",
        "username": "wxyz",
        "password": "abcd",
        "client": "cli"
      }
  }
}

But we are moving toward associating the commander login with the nimbella namespace, much more tightly, because this has the advantage of treating the command namespace as just another nimbella identity in the credential store. With that, I have the following questions:

Does the metadata need to store the username/password? note that in the case of the account name === "Commander CLI" these values are redundant with the namespace properties already in the credential store?

If the client token is used to retrieve the namespace token, and a nimbella login is performed, the working identity is a first class instance of a Credential object. In this case, the commander metadata may need to only store the client (cli, slack, etc) that is associated with the namespace.

I think there is room here to clarify both the design and implementation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.