@credenceanalytics/credmktcli
v1.5.0
Published
Credence Marketplace CLI Tool
Downloads
106
Readme
credmkt-cli
Support for market place page where in any kind of feature like report/app/noderedflow can be published. User can visit market place download the Package and install.
- credmkt-cli
Installation
Prerequisites
- Node.js >= v18 (Download Link) installed.
Online Mode
- Run the following command to install.
$ npm install -g @credenceanalytics/credmktcli@latest - Test installation by typing following command:
$ credmktcli --help
Offline Mode
- Extract credmkt-cli.zip.
- Place the extracted
credmkt-clifolder to somewhere safe on your disk.
- Place the extracted
- Run
npm link --forceinsidecredmkt-cli/folder. - Test installation by typing following command:
$ credmktcli --help
Commands
credmktcli setup
Run this command in the credence/ folder.
This command creates a new directory named custom-packages/ in the credence/ folder and initializes configuration including:
- Database connection details
- Application user ID
- Reporting WAR path
- Node-RED API URL (default:
http://127.0.0.1:8001) - App Builder API URL (default:
http://127.0.0.1:3004) - API key (automatically retrieved from database)
Usage
$ credmktcli setupFolder structure before running the command [dev environment]
credence/
├── visualizer-dashpages/
├── pages/
├── apps/
└── microservices/Folder structure after running the command [dev environment]
credence/
├── custom-packages/
├── visualizer-dashpages/
├── apps/
├── pages/
└── microservices/credmktcli package:init
Run this command in package repository must be a git repo.
This command helps in setting up a new package by creating a cred_package.json file in the specified directory. It prompts the user to enter various details about the package such as name, version, description, author and keywords and writes these details into a newly created cred_package.json file.
Usage
$ credmktcli package:initFolder structure after running the command
<Package repo>/
└── cred_package.jsoncredmktcli package:add
This command is used to add content to an existing package in a Git repository. It supports:
- Visualizer dashboards (file-based)
- Pagebuilder pages (file-based)
- Node-RED flows (API-based, automatically exported)
- App Builder apps (API-based, automatically exported)
This command checks if the current directory is a Git repository and contains a cred_package.json file. It then prompts the user to choose what type of content to add.
For Node-RED flows and App Builder apps, the command fetches available items from their respective APIs, lets you select which ones to add, and automatically exports the content.
This command is not for reports - reports must be added manually to the reports/ folder
Usage
$ credmktcli package:addFolder structure before running the command
<Package repo>/
└── cred_package.jsonFolder structure after running the command
└── <Package repo>/
├── visualizer-dashboard/
│ └── <Added dashboard>/
│ └── files
├── pages/
│ └── <Added pages>/
│ └── files
├── jobcenternodered_flows/
│ └── <Flow_Name>.json
├── appbuilder_apps/
│ └── <app_id>.zip
└── cred_package.json
credmktcli package:build
This command updates existing Node-RED flows in a package by fetching the latest versions from the Node-RED API. It's useful when flows have been modified in Node-RED and you want to update your package with the latest changes.
Current support: Node-RED flows only (App Builder apps will be supported in future versions)
Usage
$ credmktcli package:buildWhen to use this command
Use package:build when:
- You've already added Node-RED flows to your package using
package:add - The flows have been modified in Node-RED
- You want to update the package with the latest flow definitions
Note: This command does NOT commit changes or bump version. After running package:build, use package:publish to create a new version.
How it works
- Validation: Checks if current directory is a git repository with
cred_package.json - Discovery: Reads all Node-RED flows listed in
packageFolders.jobcenternodered_flows - API Fetch: Connects to Node-RED API to get current flow definitions
- Matching: Matches package flows against API flows by ID
- Update: Exports latest flow definitions and overwrites JSON files in
jobcenternodered_flows/folder - Summary: Displays which flows were updated and which were not found
Example output
$ credmktcli package:build
Building package content from APIs...
Found 3 Node-RED flow(s) in package
Fetching available flows from Node-RED API...
Updating 2 Node-RED flow(s)...
Build Summary:
──────────────────────────────────────────────────
✓ Updated 2 Node-RED flow(s) successfully
⚠ Warning: 1 flow(s) no longer exist in Node-RED:
- "Old Flow" (ID: abc123)
──────────────────────────────────────────────────
Package content updated. Run 'credmktcli package:publish' to create new version.Folder structure
Before running the command:
<Package repo>/
├── jobcenternodered_flows/
│ ├── Flow_1.json (outdated)
│ ├── Flow_2.json (outdated)
│ └── Old_Flow.json (will show warning - deleted from Node-RED)
└── cred_package.jsonAfter running the command:
<Package repo>/
├── jobcenternodered_flows/
│ ├── Flow_1.json (✓ updated)
│ ├── Flow_2.json (✓ updated)
│ └── Old_Flow.json (unchanged - not in Node-RED)
└── cred_package.jsoncredmktcli package:publish
This command is used to update the version of a package, commit and push changes to the Git repository, and create a ZIP archive of the package.
Usage
$ credmktcli package:publishFolder structure
└── <Package repo>/
├── visualizer-dashboard/
│ └── <Added dashboard>/
│ └── files
├── pages/
│ └── <Added pages>/
│ └── files
├── jobcenternodered_flows/
│ └── <Flow>.json
├── appbuilder_apps/
│ └── <app-id>.zip
└── cred_package.json
credmktcli package:apply
This command is used to extract and install a package from a specified ZIP file. This command handles extracting the package, optionally overwriting existing directories, and setting up the package correctly.
Usage
$ credmktcli package:applyFolder structure before running the command [production environment]
└── credence/
├── custom-packages/
├── visualizer-dashpages/
├── apps/
├── microservices/
└── pages/Folder structure after running the command [production environment]
credence/
├── custom-packages/
│ └── <Installed Package>/
│ ├── visualizer-dashboard/
│ │ └── <different dashboards>
│ ├── pages/
│ │ └── <different pages>
│ ├── jobcenternodered_flows/
│ │ └── <flow files>
│ ├── appbuilder_apps/
│ │ └── <app files>
│ └── cred_package.json
├── visualizer-dashpages/
│ └── dash/
│ └── <different dashboards>
├── pages/
│ └── <different pages>
├── apps/
└── microservices/Note: Node-RED flows and App Builder apps are installed via their respective APIs, not copied to file system directories.
credmktcli package:update
This command applies multiple packages in version order from the updates/packages/ folder. It discovers all package ZIP files in the updates/packages/ subfolder, sorts them by semantic version, and applies them sequentially with comprehensive error handling and recovery.
Run this command in the credence/ folder.
Usage
$ credmktcli package:updateRequired folder structure
credence/
└── updates/
└── packages/
├── mypackage-1.0.0.zip
├── mypackage-1.1.0.zip
├── anotherpackage-2.0.0.zip
└── anotherpackage-2.1.0.zipPackage naming convention
All package ZIP files must follow the naming pattern: <package-name>-<version>.zip
Examples of valid names:
dashboard-reports-1.0.0.zipuser-analytics-2.1.3.zipcustom-widgets-1.5.0.zip
How it works
- Discovery: Scans
updates/packages/folder for ZIP files - Validation: Validates package names against naming convention
- Sorting: Groups packages by name and sorts by semantic version (oldest to newest)
- Confirmation: Shows the application order and asks for user confirmation
- Sequential Application: Applies packages one by one with failure recovery
- Reporting: Provides detailed summary with success/failure counts
Error handling
- Failed packages create
.failedfiles with error details - Processing continues even if individual packages fail
- Final summary shows all results
Folder structure before running the command [production environment]
└── credence/
├── custom-packages/
├── updates/
│ └── packages/
│ ├── package-a-1.0.0.zip
│ ├── package-a-1.1.0.zip
│ └── package-b-2.0.0.zip
├── visualizer-dashpages/
├── apps/
├── microservices/
└── pages/Folder structure after running the command [production environment]
credence/
├── custom-packages/
│ ├── package-a-1.1.0/
│ │ ├── visualizer-dashboard/
│ │ │ └── <dashboards>
│ │ ├── pages/
│ │ │ └── <pages>
│ │ ├── jobcenternodered_flows/
│ │ │ └── <flows>
│ │ ├── appbuilder_apps/
│ │ │ └── <apps>
│ │ └── cred_package.json
│ └── package-b-2.0.0/
│ ├── reports/
│ │ └── <reports>
│ └── cred_package.json
├── updates/
│ └── packages/
│ ├── package-a-1.0.0.zip
│ ├── package-a-1.1.0.zip
│ ├── package-b-2.0.0.zip
│ └── package-a-1.0.0.failed (if failed)
├── visualizer-dashpages/
│ └── dash/
│ └── <applied dashboards>
├── pages/
│ └── <applied pages>
├── apps/
└── microservices/How to add and publish report package
Run credmktcli setup (one time only) command
Run credmktcli package:init command
First export your report using Export button from Report Manager view.
Extract zip and copy/paste .rptdesign and .json file in you package git repository inside reports/ folder.
Package git repository structure:
.
└── <Package git repository>/
├── .git/
├── reports/
│ ├── <some report>.rptdesign
│ └── <some report>.json
└── cred_package.jsonRun credmktcli package:publish command to push changes. It will also create -.zip file
Use this zip in credmktcli package:apply command
How to add Node-RED flows to package
Prerequisites
- credmktcli setup command completed (one time only)
- Node-RED API URL configured in setup
- Node-RED instance running and accessible
Steps
Run credmktcli package:init command in your package git repository
Run credmktcli package:add command
Select "Node Red Flow" from the menu
The command will fetch all available flows from Node-RED and display them
Select the flow(s) you want to add from the list
The flow content will be automatically exported to the
jobcenternodered_flows/folderThe
cred_package.jsonfile will be updated with flow metadata:{ "packageFolders": { "jobcenternodered_flows": [ {"id": "flow-id", "name": "Flow Name"} ] } }Run credmktcli package:publish command to push changes and create the ZIP file
Package git repository structure:
.
└── <Package git repository>/
├── .git/
├── jobcenternodered_flows/
│ ├── Flow_1.json
│ └── Flow_2.json
└── cred_package.jsonInstallation behavior
When installing a package with Node-RED flows using package:apply:
- The installer fetches all existing flows from Node-RED
- Matches flows by name (not ID)
- If no match found: Creates a new flow
- If 1 match found: Prompts for confirmation before updating
- If multiple matches found: Exits with error (requires unique flow names)
How to add App Builder apps to package
Prerequisites
- credmktcli setup command completed (one time only)
- App Builder API URL configured in setup
- App Builder instance running and accessible
Steps
Run credmktcli package:init command in your package git repository
Run credmktcli package:add command
Select "Appbuilder App" from the menu
The command will fetch all available apps from App Builder and display them
Select the app(s) you want to add from the list
The app content will be automatically exported as ZIP files to the
appbuilder_apps/folderThe
cred_package.jsonfile will be updated with app metadata:{ "packageFolders": { "appbuilder_apps": [ {"id": "app-id", "name": "App Name"} ] } }Run credmktcli package:publish command to push changes and create the ZIP file
Package git repository structure:
.
└── <Package git repository>/
├── .git/
├── appbuilder_apps/
│ ├── app-id-1.zip
│ └── app-id-2.zip
└── cred_package.jsonHow to update an existing package
Once you have published a package (e.g., mypackage-1.0.0.zip), you may need to update it with new content or modifications.
Steps to update and publish a new version:
Navigate to your package git repository
cd <Package git repository>Make your changes:
- To add new content: Run
credmktcli package:addand select the type of content to add- Visualizer dashboards
- Pagebuilder pages
- Node-RED flows (fetched from API)
- App Builder apps (fetched from API)
- To update existing content:
- For Node-RED flows: Run
credmktcli package:buildto automatically update all flows from Node-RED API - For App Builder apps: Run
credmktcli package:addagain and select the same item (you'll be prompted to overwrite) - For reports: Manually replace files in the
reports/folder - For dashboards/pages: Manually update files in their respective folders
- For Node-RED flows: Run
- To add new content: Run
Publish the updated package:
credmktcli package:publishWhen prompted, choose version bump type:
- patch (1.0.0 → 1.0.1) - for bug fixes
- minor (1.0.0 → 1.1.0) - for new features
- major (1.0.0 → 2.0.0) - for breaking changes
The command will:
- Update version in
cred_package.json - Commit changes to git
- Push to remote repository
- Create new ZIP file:
<package-name>-<new-version>.zip
- Update version in
Example workflow:
Example 1: Adding new content
# Start with existing package repository
cd my-dashboard-package
# Add a new Node-RED flow
credmktcli package:add
# Select "Node Red Flow" → choose flow → automatically exported
# Publish new version
credmktcli package:publish
# Choose "minor" → creates my-dashboard-package-1.1.0.zipExample 2: Updating existing Node-RED flows
# Navigate to package repository
cd my-dashboard-package
# Update all Node-RED flows from API (fetches latest versions)
credmktcli package:build
# Publish updated version
credmktcli package:publish
# Choose "patch" → creates my-dashboard-package-1.1.1.zipVersion management:
The marketplace tracks installed package versions in the database. When applying updates:
- You can install a higher version (upgrade)
- If you try to install a lower version (downgrade), you'll receive a warning
- Use
package:updatecommand to apply multiple versions sequentially
