@dreamlogic-ai/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dreamlogic-ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @dreamlogic-ai/cli
2
+
3
+ > **Dreamlogic AI Skill Manager** โ€” Install, update and manage AI agent skills for your team.
4
+
5
+ <p align="center">
6
+ <strong>by Dreamlogic-ai ยท MAJORNINE</strong>
7
+ </p>
8
+
9
+ ---
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ npx @dreamlogic-ai/cli
15
+ ```
16
+
17
+ You'll be guided through:
18
+ 1. ๐Ÿ”‘ Entering your API key
19
+ 2. ๐Ÿ“ฆ Selecting skills to install
20
+ 3. โš™๏ธ Configuring MCP for your AI agent
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ # Run without installing (recommended)
26
+ npx @dreamlogic-ai/cli
27
+
28
+ # Or install globally
29
+ npm install -g @dreamlogic-ai/cli
30
+ dreamlogic
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ | Command | Description |
36
+ |---------|-------------|
37
+ | `dreamlogic` | Interactive mode (menu) |
38
+ | `dreamlogic login` | Authenticate with API key |
39
+ | `dreamlogic catalog` | Browse available skills |
40
+ | `dreamlogic install [skills...]` | Install skills (multi-select) |
41
+ | `dreamlogic update` | Check & apply updates |
42
+ | `dreamlogic list` | List installed skills |
43
+ | `dreamlogic rollback <skill>` | Restore previous version |
44
+ | `dreamlogic status` | Full status overview |
45
+ | `dreamlogic setup-mcp` | Configure MCP for AI agents |
46
+ | `dreamlogic logout` | Clear credentials |
47
+
48
+ ## Non-interactive Mode (CI/CD)
49
+
50
+ ```bash
51
+ # Set API key via environment variable
52
+ export DREAMLOGIC_API_KEY=sk-user-xxxxx
53
+
54
+ # Install specific skill silently
55
+ dreamlogic install suno-cover-v5 --yes
56
+
57
+ # Auto-update all skills
58
+ dreamlogic update --yes
59
+ ```
60
+
61
+ ## Environment Variables
62
+
63
+ | Variable | Default | Description |
64
+ |----------|---------|-------------|
65
+ | `DREAMLOGIC_API_KEY` | โ€” | Override saved API key |
66
+ | `DREAMLOGIC_SERVER` | `https://skill.dreamlogic-claw.com` | Override server URL |
67
+ | `DREAMLOGIC_INSTALL_DIR` | `~/dreamlogic-skills` | Override install directory |
68
+ | `DREAMLOGIC_NO_COLOR` | โ€” | Disable colored output |
69
+ | `CI` | โ€” | CI mode (disable interactive prompts) |
70
+
71
+ ## Supported AI Agents
72
+
73
+ The `setup-mcp` command can auto-configure:
74
+
75
+ - โœ… Claude Desktop
76
+ - โœ… Claude CLI
77
+ - โœ… Cursor
78
+ - ๐Ÿ“‹ Codex CLI (manual guide)
79
+ - ๐Ÿ“‹ Cline (manual guide)
80
+
81
+ ## Security
82
+
83
+ - API keys stored with file permission `600` (owner-only)
84
+ - All downloads verified with SHA256 checksums
85
+ - ZIP extraction uses `yauzl` (safe against Zip Slip attacks)
86
+ - Atomic install: staging โ†’ rename (no partial installs)
87
+ - No secrets embedded in CLI code
88
+
89
+ ## Requirements
90
+
91
+ - Node.js โ‰ฅ 18
92
+ - A valid Dreamlogic API key
93
+
94
+ ## License
95
+
96
+ MIT ยฉ Dreamlogic-ai
@@ -0,0 +1 @@
1
+ export declare function catalogCommand(): Promise<void>;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * catalog command โ€” list available skills from server
3
+ */
4
+ import { ApiClient } from "../lib/api-client.js";
5
+ import { getServer } from "../lib/config.js";
6
+ import { ui } from "../lib/ui.js";
7
+ import { requireAuth } from "./helpers.js";
8
+ export async function catalogCommand() {
9
+ const apiKey = requireAuth();
10
+ if (!apiKey)
11
+ return;
12
+ const client = new ApiClient(getServer(), apiKey);
13
+ const spinner = ui.spinner("Fetching skill catalog...");
14
+ spinner.start();
15
+ try {
16
+ const skills = await client.listSkills();
17
+ spinner.succeed(` ${skills.length} skill(s) available`);
18
+ console.log();
19
+ if (skills.length === 0) {
20
+ ui.info("No skills available yet. Check back soon!");
21
+ return;
22
+ }
23
+ for (const s of skills) {
24
+ const ver = s.latest_version ? ui.dim(` v${s.latest_version.replace(/^v/, "")}`) : "";
25
+ const size = s.package_size ? ui.dim(` ยท ${ui.fileSize(s.package_size)}`) : "";
26
+ const status = s.status === "active" ? ui.success("โ—") :
27
+ s.status === "deprecated" ? ui.warn("โ—") : ui.dim("โ—");
28
+ console.log(` ${status} ${ui.brand(s.name)}${ver}${size}`);
29
+ console.log(` ${ui.dim(s.description)}`);
30
+ console.log(` ${ui.dim("ID: " + s.id)}`);
31
+ console.log();
32
+ }
33
+ }
34
+ catch (err) {
35
+ spinner.fail(" Failed to fetch catalog");
36
+ ui.err(err.message);
37
+ process.exitCode = 1;
38
+ }
39
+ }
@@ -0,0 +1,2 @@
1
+ /** Ensure user is authenticated; return key or null */
2
+ export declare function requireAuth(): string | null;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared helpers for commands
3
+ */
4
+ import { getApiKey } from "../lib/config.js";
5
+ import { ui } from "../lib/ui.js";
6
+ /** Ensure user is authenticated; return key or null */
7
+ export function requireAuth() {
8
+ const key = getApiKey();
9
+ if (!key) {
10
+ ui.err("Not logged in. Run: dreamlogic login");
11
+ process.exitCode = 1;
12
+ return null;
13
+ }
14
+ return key;
15
+ }
@@ -0,0 +1,4 @@
1
+ export declare function installCommand(skillIds: string[], opts: {
2
+ yes?: boolean;
3
+ fromFile?: string;
4
+ }): Promise<void>;
@@ -0,0 +1,138 @@
1
+ /**
2
+ * install command โ€” download and install skills
3
+ * Supports: interactive multi-select, single skill by name, --from-file
4
+ */
5
+ import { checkbox, confirm } from "@inquirer/prompts";
6
+ import { ApiClient } from "../lib/api-client.js";
7
+ import { getServer, getInstallDir, loadInstalled } from "../lib/config.js";
8
+ import { installSkill } from "../lib/installer.js";
9
+ import { ui } from "../lib/ui.js";
10
+ import { requireAuth } from "./helpers.js";
11
+ import chalk from "chalk";
12
+ export async function installCommand(skillIds, opts) {
13
+ const apiKey = requireAuth();
14
+ if (!apiKey)
15
+ return;
16
+ const client = new ApiClient(getServer(), apiKey);
17
+ // Fetch catalog
18
+ const spinner = ui.spinner("Fetching available skills...");
19
+ spinner.start();
20
+ let skills;
21
+ try {
22
+ skills = await client.listSkills();
23
+ spinner.succeed(` ${skills.length} skill(s) available`);
24
+ }
25
+ catch (err) {
26
+ spinner.fail(" Failed to connect");
27
+ ui.err(err.message);
28
+ process.exitCode = 1;
29
+ return;
30
+ }
31
+ const installed = loadInstalled();
32
+ // If no specific skill IDs given, show interactive selector
33
+ let selectedIds;
34
+ if (skillIds.length === 0) {
35
+ if (skills.length === 0) {
36
+ ui.info("No skills available yet.");
37
+ return;
38
+ }
39
+ const choices = skills.map((s) => {
40
+ const isInstalled = !!installed[s.id];
41
+ const ver = s.latest_version || "unknown";
42
+ const currentVer = installed[s.id]?.version;
43
+ let tag = "";
44
+ if (!isInstalled) {
45
+ tag = chalk.green(" [NEW]");
46
+ }
47
+ else if (currentVer && s.latest_version && currentVer !== s.latest_version) {
48
+ tag = chalk.yellow(` [UPDATE: ${currentVer} โ†’ ${s.latest_version}]`);
49
+ }
50
+ else {
51
+ tag = chalk.dim(" [INSTALLED]");
52
+ }
53
+ return {
54
+ name: `${s.name} (${ver}) โ€” ${s.description}${tag}`,
55
+ value: s.id,
56
+ checked: !isInstalled, // auto-check new skills
57
+ };
58
+ });
59
+ console.log();
60
+ selectedIds = await checkbox({
61
+ message: "Select skills to install (Space to select, Enter to confirm):",
62
+ choices,
63
+ });
64
+ if (selectedIds.length === 0) {
65
+ ui.info("Nothing selected.");
66
+ return;
67
+ }
68
+ }
69
+ else {
70
+ // Validate requested skill IDs
71
+ const invalid = skillIds.filter((id) => !skills.find((s) => s.id === id));
72
+ if (invalid.length > 0) {
73
+ ui.err(`Unknown skill(s): ${invalid.join(", ")}`);
74
+ ui.info("Available: " + skills.map((s) => s.id).join(", "));
75
+ process.exitCode = 1;
76
+ return;
77
+ }
78
+ selectedIds = skillIds;
79
+ }
80
+ // R1-12: --from-file only works with single skill
81
+ if (opts.fromFile && selectedIds.length > 1) {
82
+ ui.err("--from-file can only be used with a single skill.");
83
+ process.exitCode = 1;
84
+ return;
85
+ }
86
+ // Confirm
87
+ if (!opts.yes) {
88
+ console.log();
89
+ ui.header("Installation Plan");
90
+ for (const id of selectedIds) {
91
+ const s = skills.find((s) => s.id === id);
92
+ if (!s)
93
+ continue; // R1-19: guard
94
+ const ver = s.latest_version || "unknown";
95
+ const size = s.package_size ? ui.fileSize(s.package_size) : "unknown";
96
+ ui.line(` ๐Ÿ“ฆ ${chalk.bold(s.name)} ${ver} (${size})`);
97
+ }
98
+ ui.line(` ๐Ÿ“‚ Install to: ${getInstallDir()}`);
99
+ console.log();
100
+ const ok = await confirm({ message: "Proceed?", default: true });
101
+ if (!ok) {
102
+ ui.info("Cancelled.");
103
+ return;
104
+ }
105
+ }
106
+ // Install each
107
+ let successCount = 0;
108
+ for (const id of selectedIds) {
109
+ const s = skills.find((s) => s.id === id);
110
+ if (!s) {
111
+ ui.err(`Skill '${id}' no longer in catalog`);
112
+ continue;
113
+ } // R1-19
114
+ console.log();
115
+ ui.header(`Installing ${s.name}`);
116
+ try {
117
+ const result = await installSkill(client, s.id, s.package_file || `${s.id}-${s.latest_version}.zip`, s.package_sha256, s.latest_version || "unknown", { fromFile: opts.fromFile });
118
+ ui.ok(`Installed to ${result.path}`);
119
+ successCount++;
120
+ }
121
+ catch (err) {
122
+ ui.err(`Failed to install ${s.name}: ${err.message}`);
123
+ }
124
+ }
125
+ console.log();
126
+ if (successCount === selectedIds.length) {
127
+ ui.ok(`All ${successCount} skill(s) installed successfully! ๐ŸŽ‰`);
128
+ }
129
+ else {
130
+ ui.warning(`${successCount}/${selectedIds.length} installed. Check errors above.`);
131
+ }
132
+ // Suggest MCP setup
133
+ if (successCount > 0) {
134
+ console.log();
135
+ ui.info("To configure MCP for your AI agent, run:");
136
+ ui.line(` ${chalk.cyan("dreamlogic setup-mcp")}`);
137
+ }
138
+ }
@@ -0,0 +1 @@
1
+ export declare function listCommand(): void;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * list command โ€” show locally installed skills
3
+ */
4
+ import { loadInstalled, getInstallDir } from "../lib/config.js";
5
+ import { ui } from "../lib/ui.js";
6
+ import chalk from "chalk";
7
+ export function listCommand() {
8
+ const installed = loadInstalled();
9
+ const entries = Object.entries(installed);
10
+ if (entries.length === 0) {
11
+ ui.info("No skills installed. Run: dreamlogic install");
12
+ return;
13
+ }
14
+ console.log();
15
+ ui.line(`๐Ÿ“‚ Install directory: ${getInstallDir()}`);
16
+ console.log();
17
+ for (const [id, info] of entries) {
18
+ ui.line(` ${chalk.green("โ—")} ${chalk.bold(id)}`);
19
+ ui.table([
20
+ ["Version", info.version],
21
+ ["Installed", new Date(info.installed_at).toLocaleString()],
22
+ ["Path", info.path],
23
+ ["SHA256", info.sha256.slice(0, 16) + "..."],
24
+ ]);
25
+ if (info.previous_version) {
26
+ ui.line(` ${ui.dim(`Previous: ${info.previous_version}`)}`);
27
+ }
28
+ console.log();
29
+ }
30
+ ui.line(` Total: ${entries.length} skill(s)`);
31
+ }
@@ -0,0 +1,3 @@
1
+ export declare function loginCommand(opts: {
2
+ key?: string;
3
+ }): Promise<void>;
@@ -0,0 +1,70 @@
1
+ /**
2
+ * login command โ€” authenticate and save API key
3
+ */
4
+ import { password, confirm } from "@inquirer/prompts";
5
+ import { ApiClient, ApiError } from "../lib/api-client.js";
6
+ import { loadConfig, saveConfig, getApiKey, getServer, maskKey, getDefaultInstallDir, } from "../lib/config.js";
7
+ import { DEFAULT_SERVER } from "../types.js";
8
+ import { ui } from "../lib/ui.js";
9
+ const KEY_RE = /^sk-(admin|user)-[a-f0-9]{16,}$/;
10
+ export async function loginCommand(opts) {
11
+ const existingKey = getApiKey();
12
+ if (existingKey && !opts.key) {
13
+ ui.info(`Already logged in as ${maskKey(existingKey)}`);
14
+ const relogin = await confirm({
15
+ message: "Re-authenticate with a different key?",
16
+ default: false,
17
+ });
18
+ if (!relogin)
19
+ return;
20
+ }
21
+ let apiKey = opts.key || "";
22
+ // R1-04: Warn about key visibility in args/history
23
+ if (opts.key) {
24
+ ui.warning("Key passed via CLI argument โ€” it may be visible in shell history.");
25
+ ui.info("Prefer: dreamlogic login (interactive) or DREAMLOGIC_API_KEY env var");
26
+ }
27
+ if (!apiKey) {
28
+ apiKey = await password({
29
+ message: "Enter your Dreamlogic API Key:",
30
+ mask: "*",
31
+ validate: (v) => KEY_RE.test(v) || "Key must match format: sk-user-xxxx... or sk-admin-xxxx...",
32
+ });
33
+ }
34
+ if (!KEY_RE.test(apiKey)) {
35
+ ui.err("Invalid key format. Expected: sk-user-xxxx... or sk-admin-xxxx...");
36
+ process.exitCode = 1;
37
+ return;
38
+ }
39
+ const server = getServer();
40
+ const spinner = ui.spinner("Verifying key...");
41
+ spinner.start();
42
+ try {
43
+ const client = new ApiClient(server, apiKey);
44
+ const user = await client.me();
45
+ spinner.succeed(` Welcome, ${ui.brand(user.name)}! (${user.role})`);
46
+ const config = loadConfig() || { api_key: "", server: DEFAULT_SERVER, install_dir: getDefaultInstallDir() };
47
+ config.api_key = apiKey;
48
+ config.server = server;
49
+ if (!config.install_dir)
50
+ config.install_dir = getDefaultInstallDir();
51
+ saveConfig(config);
52
+ ui.ok("Configuration saved to ~/.dreamlogic/config.json");
53
+ }
54
+ catch (err) {
55
+ spinner.fail(" Authentication failed");
56
+ if (err instanceof ApiError) {
57
+ if (err.status === 401) {
58
+ ui.err("Invalid or disabled API key. Please check your key and try again.");
59
+ }
60
+ else {
61
+ ui.err(`Server error: ${err.message}`);
62
+ }
63
+ }
64
+ else {
65
+ ui.err(`Connection failed: ${err.message}`);
66
+ ui.info(`Server: ${server}`);
67
+ }
68
+ process.exitCode = 1;
69
+ }
70
+ }
@@ -0,0 +1 @@
1
+ export declare function logoutCommand(): Promise<void>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * logout command โ€” clear saved credentials
3
+ */
4
+ import { confirm } from "@inquirer/prompts";
5
+ import { clearConfig, maskKey, getApiKey } from "../lib/config.js";
6
+ import { ui } from "../lib/ui.js";
7
+ export async function logoutCommand() {
8
+ const key = getApiKey();
9
+ if (!key) {
10
+ ui.info("Not logged in.");
11
+ return;
12
+ }
13
+ ui.info(`Current key: ${maskKey(key)}`);
14
+ const ok = await confirm({ message: "Clear saved credentials?", default: true });
15
+ if (ok) {
16
+ clearConfig();
17
+ ui.ok("Credentials cleared.");
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ export declare function rollbackCommand(skillId: string): Promise<void>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * rollback command โ€” restore previous version of a skill (D-13)
3
+ */
4
+ import { confirm } from "@inquirer/prompts";
5
+ import { rollbackSkill } from "../lib/installer.js";
6
+ import { loadInstalled } from "../lib/config.js";
7
+ import { ui } from "../lib/ui.js";
8
+ export async function rollbackCommand(skillId) {
9
+ const installed = loadInstalled();
10
+ if (!installed[skillId]) {
11
+ ui.err(`Skill '${skillId}' is not installed.`);
12
+ process.exitCode = 1;
13
+ return;
14
+ }
15
+ const info = installed[skillId];
16
+ if (!info.previous_version) {
17
+ ui.err(`No previous version available for rollback.`);
18
+ ui.info(`Current version: ${info.version}`);
19
+ return;
20
+ }
21
+ ui.info(`Current: ${info.version}`);
22
+ ui.info(`Rollback to: ${info.previous_version}`);
23
+ const ok = await confirm({ message: "Proceed with rollback?", default: true });
24
+ if (!ok) {
25
+ ui.info("Cancelled.");
26
+ return;
27
+ }
28
+ const spinner = ui.spinner("Rolling back...");
29
+ spinner.start();
30
+ const success = rollbackSkill(skillId);
31
+ if (success) {
32
+ spinner.succeed(` Rolled back to previous version`);
33
+ ui.ok("Rollback complete.");
34
+ }
35
+ else {
36
+ spinner.fail(" Rollback failed");
37
+ ui.err("No backup found. Manual restore required.");
38
+ process.exitCode = 1;
39
+ }
40
+ }
@@ -0,0 +1,3 @@
1
+ export declare function setupMcpCommand(opts: {
2
+ dryRun?: boolean;
3
+ }): Promise<void>;