schema: kata.ai/schema/merapi/1.0

name: ${package.name}
version: ${package.version}

components:
    # main
    main: Main

    # bot management
    bot: bots/Bot
    channel: bots/Channel
    deployment: bots/Deployment
    environment: bots/Environment
    session: bots/Session

    # Project managements
    project: projects/Project

    # user management
    user: users/User
    team: users/Team

    # nlu management
    nlu: nlus/Nlu

    # helper
    compile: scripts/Compile
    helper: scripts/Helper
    tester: scripts/Tester

    # command deprecated
    deprecated: deprecated/Deprecated

    # api
    api: api/Api
    zaun: api/Zaun


config:
    trackingId: "UA-131926842-1"
    channels:
        type:
            - line
            - slack
            - generic
            - fbmessenger
            - telegram
            - qiscus
            - twitter

        url:
            line: https://api.line.me
            telegram: https://api.telegram.org
            fbmessenger: https://graph.facebook.com/v2.6/me/messages
            slack: https://slack.com/api
            qiscus: https://<appId>.qiscus.com
            twitter: https://api.twitter.com

commands:
    bot:
        type: group
        desc: Commands for bot management
        subcommands:
            init:
                desc: Initialize new bot.yml file
                args: "<name>"
                params:
                    config:
                        type: string
                        desc: Parameter string
                handler: bot.init
                alias: init
            revisions:
                desc: Get list bot revision
                handler: bot.revisions
                alias: revisions
            push:
                desc: Push and update reversion bot
                params:
                    tag:
                        type: string
                        desc: Tag version for deployment
                handler: bot.push
                alias: push
            pull:
                desc: Pull bot with specific revision
                args: "[revision]"
                handler: bot.pull
                alias: pull
            discard:
                desc: Discard bot
                params:
                    draft:
                        type: string
                handler: bot.discard
                alias: discard
            console:
                desc: Interactive command
                params:
                    session:
                        type: string
                        desc: Session id to use in console
                        short: s
                handler: bot.console
                alias: console
            errors:
                desc: Get list error log
                handler: bot.errors
                alias: errors
    deployment:
        type: group
        desc: Commands for deployment bot
        subcommands:
            create:
                desc: Create a Deployment of the selected project
                args: "[versionType]"
                handler: deployment.create
                alias: create-deployment
            list:
                desc: Get List deployment
                handler: deployment.list
                alias: list-deployment
            rollback:
                desc: Rollback deployment by bot version
                args: "<version>"
                handler: deployment.rollback
                alias: rollback-deployment
    environment:
        type: group
        desc: Commands for environment bot
        subcommands:
            create:
                desc: Create an environment on the selected project
                args: "<slug>"
                handler: environment.create
                alias: create-environment
            list:
                desc: List environments of the selected project
                handler: environment.list
                alias: list-environment
            update:
                desc: Update an environment of the selected project
                args: "[newDeploymentVersion]"
                handler: environment.update
                alias: update-environment
    channels:
        type: group
        desc: Commands for channel
        subcommands:
            create:
                args: "<channelName>"
                desc: Create a channel on the selected environment
                params:
                    data:
                        type: json
                        desc: Channel json data
                        short: d
                handler: channel.addChannel
                alias: create-channel
            list:
                desc: Get list channels of the selected environment
                handler: channel.list
                alias: list-channel
            delete:
                desc: Delete a channel from the selected environment
                args: "<channelName>"
                handler: channel.removeChannel
                alias: delete-channel
            update:
                desc: Update a channel from selected environment
                args: "<channelName>"
                params:
                    data:
                        type: json
                        desc: Channel json data
                        short: d
                handler: channel.updateChannel
                alias: update-channel
    project:
        type: group
        desc: Commands for bot projects
        subcommands:
            create:
                desc: Create a project
                handler: project.create
                alias: create-project
            select:
                desc: Select a project
                handler: project.select
                alias: select-project
            list:
                desc: Get list project
                handler: project.list
                alias: list-project
            delete:
                desc: Delete project by project id
                args: "[projectName]"
                handler: project.delete
                alias: delete-project
            update:
                desc: Update project by project id
                args: "[projectName]"
                handler: project.update
                alias: update-project
    config:
        type: group
        desc: Command for config management
        subcommands:
            view:
                desc: View config stored in .katajson file
                handler: helper.viewConfig
                alias: view-config
    set:
        type: command
        desc: Command for set property value
        args: "<prop> <value>"
        handler: helper.setProp
    user:
        type: group
        desc: Commands for user management
        subcommands:
            createUser:
                desc: Create new user
                args: "<username>"
                params:
                    admin:
                        type: boolean
                        desc: Label admin
                        short: a
                    internal:
                        type: boolean
                        desc: Label internal
                        short: i
                handler: user.createUser
                alias: create-user
            switch:
                desc: Switch between team and user
                args: "<type> [name]"
                handler: user.switch
                alias: switch
            login:
                desc: Login to kata
                params:
                    user:
                        type: string
                        desc: Username login
                        short: u
                    password:
                        type: string
                        desc: Password login
                        short: p
                    token:
                        type: string
                        desc: Token login
                        short: t
                handler: user.login
                alias: login
            logout:
                desc: Logout from kata
                handler: user.logout
                alias: logout
            forgotpassword:
                desc: Forgot password
                args: "<username>"
                handler: user.forgot
                alias: forgot-password
            whoami:
                desc: Identify current user
                handler: user.whoami
                alias: whoami
            changePassword:
                desc: Change current user password
                handler: user.changePassword
                alias: change-password
            listTeam:
                desc: Get list all team
                handler: user.listTeam
                alias: list-team
            listTeamUser:
                desc: Get list all team user
                args: "[teamName]"
                handler: user.listTeamUser
                alias: list-team-user
            createTeam:
                desc: Create team
                args: "<name>"
                handler: user.createTeam
                alias: create-team
            inviteMember:
                desc: Invite member to team
                args: "<username>"
                handler: team.addMember
                params:
                    admin:
                        type: boolean
                        desc: Admin label for new member
                        short: a
                alias: invite-member
            impersonate:
                desc: Impersonate as certain user
                args: "<username>"
                handler: user.impersonate
                alias: impersonate
            unimpersonate:
                desc: Unimpersonate current user, set back to admin
                handler: user.unimpersonate
                alias: unimpersonate
    nlu:
        type: group
        desc: Command for nlu management
        subcommands:
            pull:
                desc: Pull nlu from server
                handler: nlu.pull
                alias: nl-pull
            push:
                desc: Create or update nlu
                handler: nlu.push
                alias: nl-push
            init:
                desc: Init nlu file
                handler: nlu.pull
                alias: nl-init
            train:
                desc: Train nlu
                handler: nlu.train
                params:
                    file:
                        type: string
                        desc: File path contain data training
                        short: f
                    sentence:
                        type: string
                        desc: String to train
                        short: s
                alias: nl-train
            predict:
                desc: Predict NL
                handler: nlu.predict
                params:
                    file:
                        type: string
                        desc: File path contain data to predict
                        short: f
                    sentence:
                        type: string
                        desc: String to predict
                        short: s
                    nlu:
                        type: string
                        desc: NLU to use
                        short: nlu
                alias: nl-predict
            listProfiles:
                desc: Get list default profiles
                handler: nlu.listProfiles
                alias: list-profiles
            snapshot:
                desc: Snapshot profiles
                handler: nlu.snapshot
                alias: nl-snapshot
            listTraining:
                desc: Get list training
                handler: nlu.listTraining
                params:
                    page:
                        type: number
                        desc: Number page
                        short: p
                alias: nl-list-training
            listPrediction:
                desc: Get list prediction log
                handler: nlu.listPrediction
                params:
                    page:
                        type: number
                        desc: Number page
                        short: p
                alias: nl-list-prediction
            listRevision:
                desc: Get list revision
                handler: nlu.listRevision
                alias: nl-list-revision
            issueToken:
                desc: Issue token
                handler: nlu.issueToken
                alias: nl-issue-token
            detail:
                desc: Get NL detail
                handler: nlu.detail
                alias: nl-detail
    deprecated:
        type: group
        desc: Command for deprecated management
        subcommands:
            addChannel:
                desc: This command is deprecated, please use create-channel
                handler: deprecated.addChannel
                alias: add-channel
            removeChannel:
                desc: This command is deprecated, please use delete-channel
                handler: deprecated.removeChannel
                alias: remove-channel
            configView:
                desc: This command is deprecated, please use view-config
                handler: deprecated.configView
                alias: config-view
            addMember:
                desc: This command is deprecated, please use invite-member
                handler: deprecated.addMember
                alias: add-member
# entry point
main: main
