sovkora 0.0.0-stage → 1.1.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 +202 -0
- package/NOTICE +9 -0
- package/README.md +67 -2
- package/dist/commands/agent.command.js +267 -0
- package/dist/commands/chat.command.js +214 -0
- package/dist/commands/chat.handlers.js +150 -0
- package/dist/commands/chat.types.js +44 -0
- package/dist/commands/cinema.command.js +643 -0
- package/dist/commands/config.command.js +228 -0
- package/dist/commands/db.command.js +114 -0
- package/dist/commands/demo.command.js +55 -0
- package/dist/commands/dev.command.js +462 -0
- package/dist/commands/docs.command.js +135 -0
- package/dist/commands/doctor.command.js +119 -0
- package/dist/commands/forgot.command.js +57 -0
- package/dist/commands/generate.command.js +376 -0
- package/dist/commands/graph.command.js +54 -0
- package/dist/commands/init.command.js +380 -0
- package/dist/commands/init.steps.js +115 -0
- package/dist/commands/install.command.js +459 -0
- package/dist/commands/login.command.js +110 -0
- package/dist/commands/logs.command.js +215 -0
- package/dist/commands/logs.steps.js +130 -0
- package/dist/commands/mcp.command.js +104 -0
- package/dist/commands/models.command.js +164 -0
- package/dist/commands/onboard.command.js +236 -0
- package/dist/commands/pack.command.js +255 -0
- package/dist/commands/profile.command.js +51 -0
- package/dist/commands/recover.command.js +489 -0
- package/dist/commands/register.command.js +94 -0
- package/dist/commands/release.command.js +99 -0
- package/dist/commands/reset.command.js +79 -0
- package/dist/commands/runs.command.js +201 -0
- package/dist/commands/settings.command.js +85 -0
- package/dist/commands/start.command.js +590 -0
- package/dist/commands/status.command.js +167 -0
- package/dist/commands/stop.command.js +313 -0
- package/dist/commands/studio.command.js +266 -0
- package/dist/commands/test.command.js +134 -0
- package/dist/commands/verify.command.js +52 -0
- package/dist/commands/video.command.js +73 -0
- package/dist/commands/workspace-guard.js +72 -0
- package/dist/index.js +207 -0
- package/dist/renderers.js +250 -0
- package/dist/services/api-client.js +150 -0
- package/dist/services/auth.api.js +87 -0
- package/dist/services/chat.api.js +117 -0
- package/dist/services/cinema-estimate.json +42 -0
- package/dist/services/cinema.childsafe.js +52 -0
- package/dist/services/cinema.director.js +285 -0
- package/dist/services/cinema.production.js +417 -0
- package/dist/services/cinema.staging.js +323 -0
- package/dist/services/cinema.story.js +758 -0
- package/dist/services/cinema.treatment.js +393 -0
- package/dist/services/composer.run.js +94 -0
- package/dist/services/demo/demo.documents.js +108 -0
- package/dist/services/demo/demo.guard.js +49 -0
- package/dist/services/demo/demo.persona.js +114 -0
- package/dist/services/demo/demo.seed.js +281 -0
- package/dist/services/diagnostics.js +327 -0
- package/dist/services/image-model-recipes.json +93 -0
- package/dist/services/image-models.js +152 -0
- package/dist/services/local-store.js +145 -0
- package/dist/services/mcp.api.js +38 -0
- package/dist/services/model-catalog.js +70 -0
- package/dist/services/notify.js +55 -0
- package/dist/services/pack.api.js +23 -0
- package/dist/services/pack.bundle.js +241 -0
- package/dist/services/pack.sources.js +101 -0
- package/dist/services/release-manifest.js +266 -0
- package/dist/services/runs.view.js +80 -0
- package/dist/services/runs.wait.js +38 -0
- package/dist/services/semver.js +55 -0
- package/dist/services/settings.api.js +108 -0
- package/dist/services/string-utils.js +70 -0
- package/dist/services/studio.api.js +120 -0
- package/dist/services/templates.js +893 -0
- package/dist/services/tool-installer.js +353 -0
- package/dist/services/tool-path.js +72 -0
- package/dist/services/version-manager.js +253 -0
- package/dist/services/workspace-bootstrap.js +68 -0
- package/dist/threads.js +202 -0
- package/dist/types/api.types.js +6 -0
- package/dist/types/local.types.js +6 -0
- package/dist/ui/box.js +46 -0
- package/dist/ui/logger.js +28 -0
- package/dist/ui/platform.js +32 -0
- package/dist/ui/prompts.js +130 -0
- package/dist/ui/table.js +33 -0
- package/dist/utils/config.js +150 -0
- package/dist/utils/development-status.js +22 -0
- package/dist/utils/endpoints.js +41 -0
- package/dist/utils/health.js +94 -0
- package/dist/utils/pid.js +83 -0
- package/dist/utils/platform.js +358 -0
- package/dist/utils/process.js +139 -0
- package/dist/utils/state-dir.js +105 -0
- package/package.json +95 -4
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file workspace-bootstrap.ts
|
|
4
|
+
* @description Turns an empty directory into a Sovkora workspace: clones the one Sovkora repository (krizaka/sovkora,
|
|
5
|
+
* ADR-029). This is what makes `npx sovkora install` work on a machine that has nothing yet — the CLI on npm carries no
|
|
6
|
+
* copy of the platform, it fetches the real one.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.WORKSPACE_REPOSITORY = void 0;
|
|
43
|
+
exports.bootstrapWorkspace = bootstrapWorkspace;
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
const node_child_process_1 = require("node:child_process");
|
|
47
|
+
const platform_1 = require("../utils/platform");
|
|
48
|
+
/** The one repository of the platform. */
|
|
49
|
+
exports.WORKSPACE_REPOSITORY = "https://github.com/krizaka/sovkora.git";
|
|
50
|
+
const inherit = (cmd, args, cwd) => (0, node_child_process_1.spawnSync)(cmd, [...args], { cwd, stdio: "inherit", shell: process.platform === "win32" });
|
|
51
|
+
/**
|
|
52
|
+
* Clones the repository into {@code target} (shallow when asked). A directory that already holds it is reused as it is.
|
|
53
|
+
*/
|
|
54
|
+
function bootstrapWorkspace(target, opts = {}) {
|
|
55
|
+
const root = path.resolve(target);
|
|
56
|
+
const run = opts.run ?? inherit;
|
|
57
|
+
const depth = opts.depth && opts.depth > 0 ? ["--depth", String(opts.depth)] : [];
|
|
58
|
+
if (!fs.existsSync(path.join(root, platform_1.WORKSPACE_MANIFEST))) {
|
|
59
|
+
if (fs.existsSync(root) && fs.readdirSync(root).length > 0) {
|
|
60
|
+
return { ok: false, root, error: `${root} exists and is not empty — choose another directory (--dir).` };
|
|
61
|
+
}
|
|
62
|
+
const clone = run("git", ["clone", ...depth, opts.repository ?? exports.WORKSPACE_REPOSITORY, root], path.dirname(root));
|
|
63
|
+
if (clone.status !== 0) {
|
|
64
|
+
return { ok: false, root, error: `git clone failed${clone.error ? ": " + clone.error.message : ""}.` };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return { ok: true, root };
|
|
68
|
+
}
|
package/dist/threads.js
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file threads.ts
|
|
4
|
+
* @description Local thread management for persistent conversation history.
|
|
5
|
+
* Mirrors orazaka-ui's useThreadManagement and useMessageHistory hooks.
|
|
6
|
+
* Threads and messages are persisted under the CLI state directory (utils/state-dir.ts).
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.loadConfig = loadConfig;
|
|
43
|
+
exports.saveConfig = saveConfig;
|
|
44
|
+
exports.requireAuth = requireAuth;
|
|
45
|
+
exports.createThread = createThread;
|
|
46
|
+
exports.listThreads = listThreads;
|
|
47
|
+
exports.switchThread = switchThread;
|
|
48
|
+
exports.updateThreadTitle = updateThreadTitle;
|
|
49
|
+
exports.loadMessages = loadMessages;
|
|
50
|
+
exports.appendMessage = appendMessage;
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const crypto = __importStar(require("node:crypto"));
|
|
54
|
+
const state_dir_1 = require("./utils/state-dir");
|
|
55
|
+
const configPath = () => (0, state_dir_1.statePath)("config.json");
|
|
56
|
+
const threadsDir = () => (0, state_dir_1.statePath)("threads");
|
|
57
|
+
// ── Config Persistence ───────────────────────────────────────────────────────
|
|
58
|
+
/**
|
|
59
|
+
* Loads the CLI configuration from disk.
|
|
60
|
+
*
|
|
61
|
+
* @returns The parsed config, or null if absent or malformed.
|
|
62
|
+
*/
|
|
63
|
+
function loadConfig() {
|
|
64
|
+
if (!fs.existsSync(configPath()))
|
|
65
|
+
return null;
|
|
66
|
+
try {
|
|
67
|
+
const raw = JSON.parse(fs.readFileSync(configPath(), "utf-8"));
|
|
68
|
+
if (raw && typeof raw.token === "string" && typeof raw.username === "string") {
|
|
69
|
+
return {
|
|
70
|
+
token: raw.token,
|
|
71
|
+
username: raw.username,
|
|
72
|
+
activeThreadId: raw.activeThreadId || crypto.randomUUID(),
|
|
73
|
+
threads: Array.isArray(raw.threads) ? raw.threads : [],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Persists the CLI configuration to disk.
|
|
84
|
+
*
|
|
85
|
+
* @param config - The config object to write.
|
|
86
|
+
*/
|
|
87
|
+
function saveConfig(config) {
|
|
88
|
+
fs.writeFileSync(configPath(), JSON.stringify(config, null, 2), "utf-8");
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Ensures the config file exists and returns a guaranteed config.
|
|
92
|
+
* If no config exists, exits with an auth error.
|
|
93
|
+
*
|
|
94
|
+
* @returns The loaded config.
|
|
95
|
+
*/
|
|
96
|
+
function requireAuth() {
|
|
97
|
+
const config = loadConfig();
|
|
98
|
+
if (!config?.token) {
|
|
99
|
+
console.error('\x1b[31mError: Unauthorized. Please run "login" command first.\x1b[0m');
|
|
100
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
return config;
|
|
104
|
+
}
|
|
105
|
+
// ── Thread Management ────────────────────────────────────────────────────────
|
|
106
|
+
/**
|
|
107
|
+
* Creates a new conversation thread and persists it to the config.
|
|
108
|
+
*
|
|
109
|
+
* @param title - Optional display title for the thread.
|
|
110
|
+
* @returns The newly created thread.
|
|
111
|
+
*/
|
|
112
|
+
function createThread(title) {
|
|
113
|
+
const config = requireAuth();
|
|
114
|
+
const thread = {
|
|
115
|
+
conversationId: crypto.randomUUID(),
|
|
116
|
+
title: title || "New Memory Block",
|
|
117
|
+
updatedAt: Date.now(),
|
|
118
|
+
};
|
|
119
|
+
const updated = {
|
|
120
|
+
...config,
|
|
121
|
+
activeThreadId: thread.conversationId,
|
|
122
|
+
threads: [thread, ...config.threads],
|
|
123
|
+
};
|
|
124
|
+
saveConfig(updated);
|
|
125
|
+
return thread;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Lists all stored conversation threads.
|
|
129
|
+
*
|
|
130
|
+
* @returns The array of threads, most recent first.
|
|
131
|
+
*/
|
|
132
|
+
function listThreads() {
|
|
133
|
+
const config = loadConfig();
|
|
134
|
+
return config?.threads || [];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Switches the active thread to the given ID.
|
|
138
|
+
*
|
|
139
|
+
* @param threadId - The conversation ID to activate.
|
|
140
|
+
*/
|
|
141
|
+
function switchThread(threadId) {
|
|
142
|
+
const config = requireAuth();
|
|
143
|
+
const exists = config.threads.some((t) => t.conversationId === threadId);
|
|
144
|
+
if (!exists) {
|
|
145
|
+
console.error(`\x1b[31mError: Thread "${threadId}" not found.\x1b[0m`);
|
|
146
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
saveConfig({ ...config, activeThreadId: threadId });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Updates the title of a thread (e.g., after the first message).
|
|
153
|
+
*
|
|
154
|
+
* @param threadId - The conversation ID.
|
|
155
|
+
* @param title - The new title.
|
|
156
|
+
*/
|
|
157
|
+
function updateThreadTitle(threadId, title) {
|
|
158
|
+
const config = loadConfig();
|
|
159
|
+
if (!config)
|
|
160
|
+
return;
|
|
161
|
+
const updated = config.threads.map((t) => t.conversationId === threadId ? { ...t, title, updatedAt: Date.now() } : t);
|
|
162
|
+
saveConfig({ ...config, threads: updated });
|
|
163
|
+
}
|
|
164
|
+
// ── Message History ──────────────────────────────────────────────────────────
|
|
165
|
+
/**
|
|
166
|
+
* Resolves the file path for a thread's message history.
|
|
167
|
+
*
|
|
168
|
+
* @param threadId - The conversation ID.
|
|
169
|
+
* @returns The absolute path to the thread's JSON file.
|
|
170
|
+
*/
|
|
171
|
+
function threadFilePath(threadId) {
|
|
172
|
+
return path.join(threadsDir(), `${threadId}.json`);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Loads messages for a given thread from disk.
|
|
176
|
+
*
|
|
177
|
+
* @param threadId - The conversation ID.
|
|
178
|
+
* @returns The array of stored messages.
|
|
179
|
+
*/
|
|
180
|
+
function loadMessages(threadId) {
|
|
181
|
+
const fp = threadFilePath(threadId);
|
|
182
|
+
if (!fs.existsSync(fp))
|
|
183
|
+
return [];
|
|
184
|
+
try {
|
|
185
|
+
return JSON.parse(fs.readFileSync(fp, "utf-8"));
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Appends a message to a thread's persistent history.
|
|
193
|
+
*
|
|
194
|
+
* @param threadId - The conversation ID.
|
|
195
|
+
* @param message - The message to append.
|
|
196
|
+
*/
|
|
197
|
+
function appendMessage(threadId, message) {
|
|
198
|
+
fs.mkdirSync(threadsDir(), { recursive: true });
|
|
199
|
+
const messages = loadMessages(threadId);
|
|
200
|
+
messages.push(message);
|
|
201
|
+
fs.writeFileSync(threadFilePath(threadId), JSON.stringify(messages, null, 2), "utf-8");
|
|
202
|
+
}
|
package/dist/ui/box.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file box.ts
|
|
4
|
+
* @description UI component for printing styled box structures, headers, and card layouts using Chalk.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Box = void 0;
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
exports.Box = {
|
|
13
|
+
/**
|
|
14
|
+
* Renders a box with a title and a list of key-value pairs or content lines.
|
|
15
|
+
*/
|
|
16
|
+
render: (title, content, options = {}) => {
|
|
17
|
+
const width = options.width || 60;
|
|
18
|
+
const borderChalk = chalk_1.default[options.borderColor || "cyan"];
|
|
19
|
+
const titleChalk = chalk_1.default[options.titleColor || "white"].bold;
|
|
20
|
+
const top = borderChalk(`┌${"─".repeat(width - 2)}┐`);
|
|
21
|
+
const middle = borderChalk(`├${"─".repeat(width - 2)}┤`);
|
|
22
|
+
const bottom = borderChalk(`└${"─".repeat(width - 2)}┘`);
|
|
23
|
+
console.log(top);
|
|
24
|
+
// Render Title
|
|
25
|
+
const titleText = ` ${title}`;
|
|
26
|
+
const titleLine = titleChalk(titleText.padEnd(width - 4));
|
|
27
|
+
console.log(`${borderChalk("│")}${titleLine}${borderChalk("│")}`);
|
|
28
|
+
console.log(middle);
|
|
29
|
+
// Render Content
|
|
30
|
+
for (const item of content) {
|
|
31
|
+
if (typeof item === "string") {
|
|
32
|
+
const text = ` ${item}`;
|
|
33
|
+
const line = chalk_1.default.white(text.padEnd(width - 4));
|
|
34
|
+
console.log(`${borderChalk("│")}${line}${borderChalk("│")}`);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const keyText = ` ${item.key}:`;
|
|
38
|
+
const valText = String(item.value);
|
|
39
|
+
const padding = width - 4 - keyText.length;
|
|
40
|
+
const line = `${chalk_1.default.yellow(keyText)} ${chalk_1.default.white(valText.padEnd(padding - 1))}`;
|
|
41
|
+
console.log(`${borderChalk("│")}${line}${borderChalk("│")}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
console.log(bottom);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file logger.ts
|
|
4
|
+
* @description Unified status logger presenting styled CLI warnings, errors, and success markers.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Logger = void 0;
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
exports.Logger = {
|
|
13
|
+
success: (message) => {
|
|
14
|
+
console.log(chalk_1.default.green(`✓ ${message}`));
|
|
15
|
+
},
|
|
16
|
+
error: (message) => {
|
|
17
|
+
console.error(chalk_1.default.red(`❌ Error: ${message}`));
|
|
18
|
+
},
|
|
19
|
+
info: (message) => {
|
|
20
|
+
console.log(chalk_1.default.cyan(`ℹ ${message}`));
|
|
21
|
+
},
|
|
22
|
+
warn: (message) => {
|
|
23
|
+
console.warn(chalk_1.default.yellow(`⚠ Warning: ${message}`));
|
|
24
|
+
},
|
|
25
|
+
hint: (message) => {
|
|
26
|
+
console.log(chalk_1.default.gray(` Hint: ${message}`));
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveDockerComposeCmd = exports.writeEnvFile = exports.mergeEnvFile = exports.parseEnvFile = exports.ensureDir = exports.getSystemInfo = exports.isAppleSilicon = exports.getPlatform = exports.resolveModelsDir = exports.resolveEnvFile = exports.resolveComposeFile = exports.resolvePidFile = exports.resolveLogDir = exports.resolveVarDir = exports.resolveWorkspaceRoot = exports.locateWorkspace = exports.resolveWorkspaceRootSmart = exports.detectOrazakaWorkspace = exports.getToolVersion = exports.hasTool = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @file platform.ts (barrel re-export)
|
|
6
|
+
* @description Re-exports all platform utilities from src/utils/platform.ts.
|
|
7
|
+
* Keeps backward compatibility for commands importing from '../ui/platform'.
|
|
8
|
+
*
|
|
9
|
+
* The actual implementation lives in src/utils/platform.ts to satisfy
|
|
10
|
+
* the dependency-cruiser rule: services must not import from the UI layer.
|
|
11
|
+
*/
|
|
12
|
+
var platform_1 = require("../utils/platform");
|
|
13
|
+
Object.defineProperty(exports, "hasTool", { enumerable: true, get: function () { return platform_1.hasTool; } });
|
|
14
|
+
Object.defineProperty(exports, "getToolVersion", { enumerable: true, get: function () { return platform_1.getToolVersion; } });
|
|
15
|
+
Object.defineProperty(exports, "detectOrazakaWorkspace", { enumerable: true, get: function () { return platform_1.detectOrazakaWorkspace; } });
|
|
16
|
+
Object.defineProperty(exports, "resolveWorkspaceRootSmart", { enumerable: true, get: function () { return platform_1.resolveWorkspaceRootSmart; } });
|
|
17
|
+
Object.defineProperty(exports, "locateWorkspace", { enumerable: true, get: function () { return platform_1.locateWorkspace; } });
|
|
18
|
+
Object.defineProperty(exports, "resolveWorkspaceRoot", { enumerable: true, get: function () { return platform_1.resolveWorkspaceRoot; } });
|
|
19
|
+
Object.defineProperty(exports, "resolveVarDir", { enumerable: true, get: function () { return platform_1.resolveVarDir; } });
|
|
20
|
+
Object.defineProperty(exports, "resolveLogDir", { enumerable: true, get: function () { return platform_1.resolveLogDir; } });
|
|
21
|
+
Object.defineProperty(exports, "resolvePidFile", { enumerable: true, get: function () { return platform_1.resolvePidFile; } });
|
|
22
|
+
Object.defineProperty(exports, "resolveComposeFile", { enumerable: true, get: function () { return platform_1.resolveComposeFile; } });
|
|
23
|
+
Object.defineProperty(exports, "resolveEnvFile", { enumerable: true, get: function () { return platform_1.resolveEnvFile; } });
|
|
24
|
+
Object.defineProperty(exports, "resolveModelsDir", { enumerable: true, get: function () { return platform_1.resolveModelsDir; } });
|
|
25
|
+
Object.defineProperty(exports, "getPlatform", { enumerable: true, get: function () { return platform_1.getPlatform; } });
|
|
26
|
+
Object.defineProperty(exports, "isAppleSilicon", { enumerable: true, get: function () { return platform_1.isAppleSilicon; } });
|
|
27
|
+
Object.defineProperty(exports, "getSystemInfo", { enumerable: true, get: function () { return platform_1.getSystemInfo; } });
|
|
28
|
+
Object.defineProperty(exports, "ensureDir", { enumerable: true, get: function () { return platform_1.ensureDir; } });
|
|
29
|
+
Object.defineProperty(exports, "parseEnvFile", { enumerable: true, get: function () { return platform_1.parseEnvFile; } });
|
|
30
|
+
Object.defineProperty(exports, "mergeEnvFile", { enumerable: true, get: function () { return platform_1.mergeEnvFile; } });
|
|
31
|
+
Object.defineProperty(exports, "writeEnvFile", { enumerable: true, get: function () { return platform_1.writeEnvFile; } });
|
|
32
|
+
Object.defineProperty(exports, "resolveDockerComposeCmd", { enumerable: true, get: function () { return platform_1.resolveDockerComposeCmd; } });
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file prompts.ts
|
|
4
|
+
* @description Dynamic loader wrapper for ESM-only @clack/prompts in a CommonJS project.
|
|
5
|
+
* Uses native TypeScript `typeof import()` with resolution-mode for zero-cast type safety.
|
|
6
|
+
* Exposes a rich set of interactive primitives for premium CLI UX.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports._setTestLoader = _setTestLoader;
|
|
10
|
+
exports._resetLoader = _resetLoader;
|
|
11
|
+
exports.intro = intro;
|
|
12
|
+
exports.outro = outro;
|
|
13
|
+
exports.text = text;
|
|
14
|
+
exports.password = password;
|
|
15
|
+
exports.select = select;
|
|
16
|
+
exports.multiselect = multiselect;
|
|
17
|
+
exports.confirm = confirm;
|
|
18
|
+
exports.note = note;
|
|
19
|
+
exports.log = log;
|
|
20
|
+
exports.logStep = logStep;
|
|
21
|
+
exports.logSuccess = logSuccess;
|
|
22
|
+
exports.logWarning = logWarning;
|
|
23
|
+
exports.logError = logError;
|
|
24
|
+
exports.logInfo = logInfo;
|
|
25
|
+
exports.createSpinner = createSpinner;
|
|
26
|
+
exports.isCancel = isCancel;
|
|
27
|
+
exports.handleCancel = handleCancel;
|
|
28
|
+
let cache = null;
|
|
29
|
+
let loader = () => import("@clack/prompts");
|
|
30
|
+
async function getPrompts() {
|
|
31
|
+
cache ??= await loader();
|
|
32
|
+
return cache;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Test-only: inject a mock loader and reset the module cache.
|
|
36
|
+
* Production code must never call this.
|
|
37
|
+
*/
|
|
38
|
+
function _setTestLoader(mockLoader) {
|
|
39
|
+
cache = null;
|
|
40
|
+
loader = mockLoader;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Test-only: reset to the real @clack/prompts loader.
|
|
44
|
+
*/
|
|
45
|
+
function _resetLoader() {
|
|
46
|
+
cache = null;
|
|
47
|
+
loader = () => import("@clack/prompts");
|
|
48
|
+
}
|
|
49
|
+
// ─── Core Primitives ───────────────────────────────────────────
|
|
50
|
+
async function intro(message) {
|
|
51
|
+
const p = await getPrompts();
|
|
52
|
+
p.intro(message);
|
|
53
|
+
}
|
|
54
|
+
async function outro(message) {
|
|
55
|
+
const p = await getPrompts();
|
|
56
|
+
p.outro(message);
|
|
57
|
+
}
|
|
58
|
+
async function text(options) {
|
|
59
|
+
const p = await getPrompts();
|
|
60
|
+
return p.text(options);
|
|
61
|
+
}
|
|
62
|
+
async function password(options) {
|
|
63
|
+
const p = await getPrompts();
|
|
64
|
+
return p.password(options);
|
|
65
|
+
}
|
|
66
|
+
// ─── Select & Multiselect ──────────────────────────────────────
|
|
67
|
+
async function select(options) {
|
|
68
|
+
const p = await getPrompts();
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
return p.select(options);
|
|
71
|
+
}
|
|
72
|
+
async function multiselect(options) {
|
|
73
|
+
const p = await getPrompts();
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
return p.multiselect(options);
|
|
76
|
+
}
|
|
77
|
+
// ─── Confirm ───────────────────────────────────────────────────
|
|
78
|
+
async function confirm(options) {
|
|
79
|
+
const p = await getPrompts();
|
|
80
|
+
return p.confirm(options);
|
|
81
|
+
}
|
|
82
|
+
// ─── Note & Log ────────────────────────────────────────────────
|
|
83
|
+
async function note(message, title) {
|
|
84
|
+
const p = await getPrompts();
|
|
85
|
+
p.note(message, title);
|
|
86
|
+
}
|
|
87
|
+
async function log(message) {
|
|
88
|
+
const p = await getPrompts();
|
|
89
|
+
p.log.message(message);
|
|
90
|
+
}
|
|
91
|
+
async function logStep(message) {
|
|
92
|
+
const p = await getPrompts();
|
|
93
|
+
p.log.step(message);
|
|
94
|
+
}
|
|
95
|
+
async function logSuccess(message) {
|
|
96
|
+
const p = await getPrompts();
|
|
97
|
+
p.log.success(message);
|
|
98
|
+
}
|
|
99
|
+
async function logWarning(message) {
|
|
100
|
+
const p = await getPrompts();
|
|
101
|
+
p.log.warn(message);
|
|
102
|
+
}
|
|
103
|
+
async function logError(message) {
|
|
104
|
+
const p = await getPrompts();
|
|
105
|
+
p.log.error(message);
|
|
106
|
+
}
|
|
107
|
+
async function logInfo(message) {
|
|
108
|
+
const p = await getPrompts();
|
|
109
|
+
p.log.info(message);
|
|
110
|
+
}
|
|
111
|
+
async function createSpinner() {
|
|
112
|
+
const p = await getPrompts();
|
|
113
|
+
return p.spinner();
|
|
114
|
+
}
|
|
115
|
+
// ─── Cancel Detection ──────────────────────────────────────────
|
|
116
|
+
function isCancel(value) {
|
|
117
|
+
return typeof value === "symbol";
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Handles cancellation by printing a message and exiting.
|
|
121
|
+
* Use this after any prompt to guard against user cancellation.
|
|
122
|
+
*/
|
|
123
|
+
function handleCancel(value, message) {
|
|
124
|
+
if (isCancel(value)) {
|
|
125
|
+
console.log("");
|
|
126
|
+
console.log(message ?? "Operation cancelled.");
|
|
127
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
130
|
+
}
|
package/dist/ui/table.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file table.ts
|
|
4
|
+
* @description Tabular data rendering component using cli-table3 and Chalk.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TableFormatter = void 0;
|
|
11
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
12
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
+
exports.TableFormatter = {
|
|
14
|
+
/**
|
|
15
|
+
* Formats and prints a structured ASCII table to console.
|
|
16
|
+
*/
|
|
17
|
+
render: (head, rows, options = {}) => {
|
|
18
|
+
const headColorChalk = chalk_1.default[options.headColor || "cyan"].bold;
|
|
19
|
+
const styledHead = head.map((h) => headColorChalk(h));
|
|
20
|
+
const table = new cli_table3_1.default({
|
|
21
|
+
head: styledHead,
|
|
22
|
+
...(options.colWidths ? { colWidths: options.colWidths } : {}),
|
|
23
|
+
style: {
|
|
24
|
+
head: [],
|
|
25
|
+
border: ["gray"],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
for (const row of rows) {
|
|
29
|
+
table.push(row);
|
|
30
|
+
}
|
|
31
|
+
console.log(table.toString());
|
|
32
|
+
},
|
|
33
|
+
};
|