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,462 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file dev.command.ts
|
|
4
|
+
* @description Parallel development orchestrator for the Sovkora full-stack.
|
|
5
|
+
* Spawns the Router (Spring Boot) backend, Web Client (which serves the operator console), and Mobile
|
|
6
|
+
* Expo servers with color-coded prefixed output and premium DevX logging.
|
|
7
|
+
*
|
|
8
|
+
* This is the *application* layer of the dev loop. The *infrastructure* layer
|
|
9
|
+
* (Docker middleware + native AI engines) is started separately by
|
|
10
|
+
* `sovkora start --mode dev`. Run that first, then `sovkora dev`.
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
46
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
|
+
};
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.devCommand = exports.KRIZAKA_BUILD_MODULES = void 0;
|
|
50
|
+
exports.bannerAddress = bannerAddress;
|
|
51
|
+
exports.bannerLabelWidth = bannerLabelWidth;
|
|
52
|
+
exports.absoluteUploadDir = absoluteUploadDir;
|
|
53
|
+
exports.resolveEnabledServices = resolveEnabledServices;
|
|
54
|
+
const commander_1 = require("commander");
|
|
55
|
+
const fs = __importStar(require("node:fs"));
|
|
56
|
+
const path = __importStar(require("node:path"));
|
|
57
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
58
|
+
const prompts_1 = require("../ui/prompts");
|
|
59
|
+
const process_1 = require("../utils/process");
|
|
60
|
+
const config_1 = require("../utils/config");
|
|
61
|
+
const workspace_guard_1 = require("./workspace-guard");
|
|
62
|
+
/** The Krizaka services `dev` runs beside Sovkora's: modules of krizaka-java, read from its checkout at the release
|
|
63
|
+
* sovkora-parent imports (`.krizaka-java`, the folder scripts/generate-docs.mjs and CI use; ADR-029). */
|
|
64
|
+
exports.KRIZAKA_BUILD_MODULES = {
|
|
65
|
+
identity: ".krizaka-java/krizaka-users/krizaka-users-service",
|
|
66
|
+
billing: ".krizaka-java/krizaka-billing/krizaka-billing-service",
|
|
67
|
+
notifications: ".krizaka-java/krizaka-service-kit/krizaka-notifications-service",
|
|
68
|
+
};
|
|
69
|
+
const SERVICE_KEYS = [
|
|
70
|
+
"edge",
|
|
71
|
+
"router",
|
|
72
|
+
"identity",
|
|
73
|
+
"automation",
|
|
74
|
+
"knowledge",
|
|
75
|
+
"job",
|
|
76
|
+
"billing",
|
|
77
|
+
"studio",
|
|
78
|
+
"notifications",
|
|
79
|
+
"web",
|
|
80
|
+
"mobile",
|
|
81
|
+
"workers",
|
|
82
|
+
];
|
|
83
|
+
/** Back-compat aliases for `--only` tokens (old name → canonical key). */
|
|
84
|
+
// `admin` is gone: the operator console is served by the web client (admin.<domain>), so the old token means `web`.
|
|
85
|
+
const SERVICE_ALIASES = { core: "router", admin: "web" };
|
|
86
|
+
/**
|
|
87
|
+
* Every worker this repository ships, discovered from its own declaration.
|
|
88
|
+
*
|
|
89
|
+
* <b>Nothing started a pack's worker before this.</b> `sovkora dev` launched eight JVM services and
|
|
90
|
+
* two UIs and no Python at all; the media worker was started only by the e2e harness, and the
|
|
91
|
+
* document-validation pack's by nobody. A user who installed that pack got a run that stayed
|
|
92
|
+
* RUNNING forever — and its first job command was discarded by the broker, because no queue was
|
|
93
|
+
* bound when it was published (docs/evaluations/first-real-use.md, B3).
|
|
94
|
+
*
|
|
95
|
+
* The launcher does not know how to start a worker: each `worker.yaml` says so under `run:`. The
|
|
96
|
+
* two in this repository already start differently — one as a module, one as a script beside a venv
|
|
97
|
+
* one directory up — so a launcher carrying that knowledge would carry it for the workers that
|
|
98
|
+
* existed when it was written, and a pack shipped from outside this repository has nobody to ask
|
|
99
|
+
* (AGENTS.md §12).
|
|
100
|
+
*/
|
|
101
|
+
function discoverWorkers(root, enabled) {
|
|
102
|
+
const found = [];
|
|
103
|
+
const skip = new Set(["node_modules", ".git", "target", ".venv", "dist", "__pycache__"]);
|
|
104
|
+
const walk = (dir, depth) => {
|
|
105
|
+
if (depth > 5)
|
|
106
|
+
return;
|
|
107
|
+
let entries;
|
|
108
|
+
try {
|
|
109
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
for (const entry of entries) {
|
|
115
|
+
if (entry.isDirectory() && !skip.has(entry.name)) {
|
|
116
|
+
walk(path.join(dir, entry.name), depth + 1);
|
|
117
|
+
}
|
|
118
|
+
else if (entry.isFile() && entry.name === "worker.yaml") {
|
|
119
|
+
const declared = readWorkerRun(path.join(dir, entry.name));
|
|
120
|
+
if (declared) {
|
|
121
|
+
found.push({
|
|
122
|
+
serviceKey: "workers",
|
|
123
|
+
label: declared.label,
|
|
124
|
+
color: chalk_1.default.magenta,
|
|
125
|
+
command: declared.python,
|
|
126
|
+
args: declared.args,
|
|
127
|
+
cwd: dir,
|
|
128
|
+
enabled,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
walk(root, 0);
|
|
135
|
+
return found;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The `run:` block of one worker.yaml, or null when it declares none.
|
|
139
|
+
*
|
|
140
|
+
* Parsed with a reader narrow enough to need no dependency: `name`, and a `run:` mapping with a
|
|
141
|
+
* `python` string and an `args` inline list. A worker that declares no `run:` is not started and
|
|
142
|
+
* says nothing — the same fail-closed direction as every other declaration in this repository.
|
|
143
|
+
*/
|
|
144
|
+
function readWorkerRun(file) {
|
|
145
|
+
let text;
|
|
146
|
+
try {
|
|
147
|
+
text = fs.readFileSync(file, "utf8");
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const body = text
|
|
153
|
+
.split("\n")
|
|
154
|
+
.filter((line) => !line.trimStart().startsWith("#"))
|
|
155
|
+
.join("\n");
|
|
156
|
+
const name = /^name:\s*(\S+)/m.exec(body);
|
|
157
|
+
const python = /^[ \t]+python:[ \t]*"([^"]+)"/m.exec(body);
|
|
158
|
+
const args = /^[ \t]+args:[ \t]*\[([^\]]*)\]/m.exec(body);
|
|
159
|
+
if (!python || !args)
|
|
160
|
+
return null;
|
|
161
|
+
const parsed = args[1]
|
|
162
|
+
.split(",")
|
|
163
|
+
.map((a) => a.trim().replace(/^["']|["']$/g, ""))
|
|
164
|
+
.filter((a) => a.length > 0);
|
|
165
|
+
return {
|
|
166
|
+
label: (name ? name[1] : path.basename(path.dirname(file))).toUpperCase(),
|
|
167
|
+
python: python[1],
|
|
168
|
+
args: parsed,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** What the dev banner shows after a process's name: its port and URL, or that it consumes a queue (a worker). */
|
|
172
|
+
function bannerAddress(port) {
|
|
173
|
+
return port === undefined ? "queue worker — no HTTP port" : `:${port} http://localhost:${port}`;
|
|
174
|
+
}
|
|
175
|
+
/** The width of the banner's name column: the longest name plus a space, at least 14. */
|
|
176
|
+
function bannerLabelWidth(configs) {
|
|
177
|
+
return Math.max(14, ...configs.map((cfg) => cfg.label.length + 1));
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Parses the `--only` value into a validated set of service keys. Accepts a
|
|
181
|
+
* comma-separated list (e.g. "web,mobile"); unknown tokens are rejected so a
|
|
182
|
+
* typo never silently launches nothing.
|
|
183
|
+
*/
|
|
184
|
+
function parseOnly(raw) {
|
|
185
|
+
const selected = new Set();
|
|
186
|
+
if (!raw)
|
|
187
|
+
return selected;
|
|
188
|
+
for (const token of raw
|
|
189
|
+
.split(",")
|
|
190
|
+
.map((t) => t.trim().toLowerCase())
|
|
191
|
+
.filter(Boolean)) {
|
|
192
|
+
const canonical = SERVICE_ALIASES[token] ?? token;
|
|
193
|
+
if (SERVICE_KEYS.includes(canonical)) {
|
|
194
|
+
selected.add(canonical);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
(0, prompts_1.logWarning)(`Unknown --only service "${token}" (expected: ${SERVICE_KEYS.join(", ")}).`).catch((err) => console.error(String(err)));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return selected;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The one upload directory every service shares, made absolute.
|
|
204
|
+
*
|
|
205
|
+
* `spring-boot:run` starts each service in its own module directory, so a relative `UPLOAD_DIR`
|
|
206
|
+
* (`.env`: `var/orazaka-uploads`) named a different folder per service: the job service wrote a
|
|
207
|
+
* generated image under `orazaka-job-service/var/…` and the conversation service, which serves
|
|
208
|
+
* `/api/v1/assets/…`, looked under its own and answered 404. Resolved once against the workspace.
|
|
209
|
+
*/
|
|
210
|
+
function absoluteUploadDir(root, configured) {
|
|
211
|
+
return path.resolve(root, configured && configured.trim() !== "" ? configured : path.join("var", "orazaka-uploads"));
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Pure resolver for which services the dev stack should launch. Extracted so the
|
|
215
|
+
* skip/only precedence is unit-testable without spawning real processes.
|
|
216
|
+
*
|
|
217
|
+
* Precedence: `--only` (allow-list) wins; otherwise each `--skip-*` flag removes
|
|
218
|
+
* its service. `--skip-router` accepts the legacy `--skip-core` spelling.
|
|
219
|
+
*/
|
|
220
|
+
function resolveEnabledServices(opts) {
|
|
221
|
+
const only = parseOnly(opts.only);
|
|
222
|
+
const skip = {
|
|
223
|
+
edge: Boolean(opts.skipEdge),
|
|
224
|
+
router: Boolean(opts.skipRouter ?? opts.skipCore),
|
|
225
|
+
identity: Boolean(opts.skipIdentity),
|
|
226
|
+
automation: Boolean(opts.skipAutomation),
|
|
227
|
+
knowledge: Boolean(opts.skipKnowledge),
|
|
228
|
+
job: Boolean(opts.skipJob),
|
|
229
|
+
billing: Boolean(opts.skipBilling),
|
|
230
|
+
studio: Boolean(opts.skipStudio),
|
|
231
|
+
notifications: Boolean(opts.skipNotifications),
|
|
232
|
+
web: Boolean(opts.skipWeb),
|
|
233
|
+
mobile: Boolean(opts.skipMobile),
|
|
234
|
+
workers: Boolean(opts.skipWorkers),
|
|
235
|
+
};
|
|
236
|
+
const enabled = {};
|
|
237
|
+
for (const key of SERVICE_KEYS) {
|
|
238
|
+
enabled[key] = only.size > 0 ? only.has(key) : !skip[key];
|
|
239
|
+
}
|
|
240
|
+
return enabled;
|
|
241
|
+
}
|
|
242
|
+
exports.devCommand = new commander_1.Command("dev")
|
|
243
|
+
.description("Launch the full Sovkora application stack in parallel (9 services + Web, Mobile)")
|
|
244
|
+
.option("--only <services>", "Launch only these services (comma-separated: edge,router,identity,automation,knowledge,job,billing,studio,notifications,web,mobile)")
|
|
245
|
+
.option("--skip-edge", "Skip the Edge gateway (strangler facade on :8088)")
|
|
246
|
+
.option("--skip-identity", "Skip the Identity service (:8083)")
|
|
247
|
+
.option("--skip-router", "Skip the Router (Spring Boot) backend — run RouterApplication from your IDE instead")
|
|
248
|
+
.option("--skip-core", "Deprecated alias for --skip-router")
|
|
249
|
+
.option("--skip-automation", "Skip the Automation service (AMQP on :8082)")
|
|
250
|
+
.option("--skip-knowledge", "Skip the Knowledge service (:8084)")
|
|
251
|
+
.option("--skip-job", "Skip the Job Orchestration service (:8090)")
|
|
252
|
+
.option("--skip-billing", "Skip the Billing service (:8095)")
|
|
253
|
+
.option("--skip-studio", "Skip the Studio service (:8096)")
|
|
254
|
+
.option("--skip-notifications", "Skip the Notification service (:8097)")
|
|
255
|
+
.option("--skip-admin", "Deprecated no-op: the operator console is served by the web client")
|
|
256
|
+
.option("--skip-mobile", "Skip Expo mobile server")
|
|
257
|
+
.option("--skip-web", "Skip Web client")
|
|
258
|
+
.option("--skip-workers", "Skip the Python workers declared by worker.yaml")
|
|
259
|
+
.action(async (opts) => {
|
|
260
|
+
const root = (0, workspace_guard_1.requireWorkspace)("dev");
|
|
261
|
+
const uiRoot = path.join(root, "apps");
|
|
262
|
+
process.env.UPLOAD_DIR = absoluteUploadDir(root, process.env.UPLOAD_DIR);
|
|
263
|
+
const enabled = resolveEnabledServices(opts);
|
|
264
|
+
const isEnabled = (key) => enabled[key];
|
|
265
|
+
const processes = [
|
|
266
|
+
{
|
|
267
|
+
serviceKey: "edge",
|
|
268
|
+
label: "EDGE",
|
|
269
|
+
color: chalk_1.default.blue,
|
|
270
|
+
command: "./mvnw",
|
|
271
|
+
args: ["spring-boot:run", "-pl", "services/edge/sovkora-edge-service"],
|
|
272
|
+
cwd: root,
|
|
273
|
+
enabled: isEnabled("edge"),
|
|
274
|
+
port: config_1.PORTS.edge,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
serviceKey: "router",
|
|
278
|
+
label: "ROUTER",
|
|
279
|
+
color: chalk_1.default.green,
|
|
280
|
+
command: "./mvnw",
|
|
281
|
+
args: [
|
|
282
|
+
"spring-boot:run",
|
|
283
|
+
"-pl",
|
|
284
|
+
"services/conversation/sovkora-conversation-service",
|
|
285
|
+
"-Dspring-boot.run.profiles=e2e",
|
|
286
|
+
],
|
|
287
|
+
cwd: root,
|
|
288
|
+
enabled: isEnabled("router"),
|
|
289
|
+
port: config_1.PORTS.router,
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
serviceKey: "identity",
|
|
293
|
+
label: "IDENTITY",
|
|
294
|
+
color: chalk_1.default.white,
|
|
295
|
+
command: "./mvnw",
|
|
296
|
+
// Run from the workspace root, like the e2e harness: Sovkora's onboarding schemas are
|
|
297
|
+
// file:infra/users/… paths in .env (USERS_ONBOARDING_SCHEMA).
|
|
298
|
+
args: ["spring-boot:run", "-pl", exports.KRIZAKA_BUILD_MODULES.identity, `-Dspring-boot.run.workingDirectory=${root}`],
|
|
299
|
+
cwd: root,
|
|
300
|
+
enabled: isEnabled("identity"),
|
|
301
|
+
port: config_1.PORTS.identity,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
serviceKey: "automation",
|
|
305
|
+
label: "AUTOMATION",
|
|
306
|
+
color: chalk_1.default.gray,
|
|
307
|
+
command: "./mvnw",
|
|
308
|
+
args: ["spring-boot:run", "-pl", "services/automation/sovkora-automation-service"],
|
|
309
|
+
cwd: root,
|
|
310
|
+
enabled: isEnabled("automation"),
|
|
311
|
+
port: config_1.PORTS.automationWorker,
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
serviceKey: "knowledge",
|
|
315
|
+
label: "KNOWLEDGE",
|
|
316
|
+
color: chalk_1.default.magenta,
|
|
317
|
+
command: "./mvnw",
|
|
318
|
+
args: ["spring-boot:run", "-pl", "services/knowledge/sovkora-knowledge-service"],
|
|
319
|
+
cwd: root,
|
|
320
|
+
enabled: isEnabled("knowledge"),
|
|
321
|
+
port: config_1.PORTS.knowledge,
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
serviceKey: "job",
|
|
325
|
+
label: "JOB",
|
|
326
|
+
color: chalk_1.default.gray,
|
|
327
|
+
command: "./mvnw",
|
|
328
|
+
args: ["spring-boot:run", "-pl", "services/job/sovkora-job-service"],
|
|
329
|
+
cwd: root,
|
|
330
|
+
enabled: isEnabled("job"),
|
|
331
|
+
port: config_1.PORTS.jobService,
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
serviceKey: "billing",
|
|
335
|
+
label: "BILLING",
|
|
336
|
+
color: chalk_1.default.green,
|
|
337
|
+
command: "./mvnw",
|
|
338
|
+
args: ["spring-boot:run", "-pl", exports.KRIZAKA_BUILD_MODULES.billing],
|
|
339
|
+
cwd: root,
|
|
340
|
+
enabled: isEnabled("billing"),
|
|
341
|
+
port: config_1.PORTS.billing,
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
serviceKey: "studio",
|
|
345
|
+
label: "STUDIO",
|
|
346
|
+
color: chalk_1.default.yellow,
|
|
347
|
+
command: "./mvnw",
|
|
348
|
+
args: ["spring-boot:run", "-pl", "services/studio/orazaka-studio-service"],
|
|
349
|
+
cwd: root,
|
|
350
|
+
enabled: isEnabled("studio"),
|
|
351
|
+
port: config_1.PORTS.studio,
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
serviceKey: "notifications",
|
|
355
|
+
label: "NOTIFICATIONS",
|
|
356
|
+
color: chalk_1.default.blue,
|
|
357
|
+
command: "./mvnw",
|
|
358
|
+
args: ["spring-boot:run", "-pl", exports.KRIZAKA_BUILD_MODULES.notifications],
|
|
359
|
+
cwd: root,
|
|
360
|
+
enabled: isEnabled("notifications"),
|
|
361
|
+
port: config_1.PORTS.notifications,
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
serviceKey: "web",
|
|
365
|
+
label: "WEB-CLIENT",
|
|
366
|
+
color: chalk_1.default.cyan,
|
|
367
|
+
command: "npm",
|
|
368
|
+
args: ["run", "dev", "--", "--port", String(config_1.PORTS.web)],
|
|
369
|
+
cwd: path.join(uiRoot, "web"),
|
|
370
|
+
enabled: isEnabled("web"),
|
|
371
|
+
port: config_1.PORTS.web,
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
serviceKey: "mobile",
|
|
375
|
+
label: "MOBILE",
|
|
376
|
+
color: chalk_1.default.yellow,
|
|
377
|
+
command: "npx",
|
|
378
|
+
args: ["expo", "start"],
|
|
379
|
+
cwd: path.join(uiRoot, "mobile"),
|
|
380
|
+
enabled: isEnabled("mobile"),
|
|
381
|
+
port: config_1.PORTS.mobile,
|
|
382
|
+
},
|
|
383
|
+
];
|
|
384
|
+
// Workers are appended rather than listed: each declares its own `run:` in worker.yaml, so a
|
|
385
|
+
// pack that ships one is started without editing this file (AGENTS.md §12).
|
|
386
|
+
processes.push(...discoverWorkers(root, isEnabled("workers")));
|
|
387
|
+
const activeConfigs = processes.filter((p) => p.enabled);
|
|
388
|
+
const skippedConfigs = processes.filter((p) => !p.enabled);
|
|
389
|
+
if (activeConfigs.length === 0) {
|
|
390
|
+
await (0, prompts_1.logWarning)("All processes skipped — nothing to launch.");
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
// ─── Startup Banner ──────────────────────────────────────
|
|
394
|
+
// The label column and the box grow to the longest row: a worker named by its worker.yaml
|
|
395
|
+
// (`ORAZAKA-WORKER-VALIDATION`) is longer than a service, and has no HTTP port to show.
|
|
396
|
+
const labelW = bannerLabelWidth([...activeConfigs, ...skippedConfigs]);
|
|
397
|
+
const BOX_W = Math.max(54, ...activeConfigs.map((cfg) => ` ● ${cfg.label.padEnd(labelW)}${bannerAddress(cfg.port)}`.length + 2));
|
|
398
|
+
const pad = (text, width) => text + " ".repeat(Math.max(0, width - text.length));
|
|
399
|
+
console.log("");
|
|
400
|
+
console.log(chalk_1.default.cyan.bold(" ┌" + "─".repeat(BOX_W) + "┐"));
|
|
401
|
+
console.log(chalk_1.default.cyan.bold(" │") + chalk_1.default.white.bold(pad(" 🥷 Sovkora Dev Stack", BOX_W)) + chalk_1.default.cyan.bold("│"));
|
|
402
|
+
console.log(chalk_1.default.cyan.bold(" ├" + "─".repeat(BOX_W) + "┤"));
|
|
403
|
+
for (const cfg of activeConfigs) {
|
|
404
|
+
const address = bannerAddress(cfg.port);
|
|
405
|
+
const row = ` ● ${cfg.label.padEnd(labelW)}${address}`;
|
|
406
|
+
console.log(chalk_1.default.cyan(" │") +
|
|
407
|
+
` ${cfg.color("●")} ${cfg.color(cfg.label.padEnd(labelW))}` +
|
|
408
|
+
(cfg.port === undefined
|
|
409
|
+
? chalk_1.default.dim(address)
|
|
410
|
+
: chalk_1.default.white(`:${cfg.port}`) + chalk_1.default.dim(` http://localhost:${cfg.port}`)) +
|
|
411
|
+
" ".repeat(Math.max(0, BOX_W - row.length)) +
|
|
412
|
+
chalk_1.default.cyan("│"));
|
|
413
|
+
}
|
|
414
|
+
if (skippedConfigs.length > 0) {
|
|
415
|
+
const dashContent = " " +
|
|
416
|
+
Array.from({ length: Math.floor((BOX_W - 4) / 2) }, () => "─ ")
|
|
417
|
+
.join("")
|
|
418
|
+
.trimEnd();
|
|
419
|
+
console.log(chalk_1.default.cyan(" │") + chalk_1.default.dim(pad(dashContent, BOX_W)) + chalk_1.default.cyan("│"));
|
|
420
|
+
for (const cfg of skippedConfigs) {
|
|
421
|
+
const row = ` ○ ${cfg.label.padEnd(labelW)}skipped`;
|
|
422
|
+
console.log(chalk_1.default.cyan(" │") +
|
|
423
|
+
` ${chalk_1.default.dim("○")} ${chalk_1.default.dim(cfg.label.padEnd(labelW))}` +
|
|
424
|
+
chalk_1.default.dim("skipped") +
|
|
425
|
+
" ".repeat(Math.max(0, BOX_W - row.length)) +
|
|
426
|
+
chalk_1.default.cyan("│"));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
console.log(chalk_1.default.cyan.bold(" └" + "─".repeat(BOX_W) + "┘"));
|
|
430
|
+
console.log("");
|
|
431
|
+
console.log(chalk_1.default.dim(" Press Ctrl+C to stop all processes"));
|
|
432
|
+
console.log("");
|
|
433
|
+
// ─── Spawn Processes ─────────────────────────────────────
|
|
434
|
+
const children = [];
|
|
435
|
+
for (const cfg of activeConfigs) {
|
|
436
|
+
children.push((0, process_1.spawnWithPrefix)(cfg));
|
|
437
|
+
}
|
|
438
|
+
// ─── Graceful Shutdown (guard against double-fire) ───────
|
|
439
|
+
let shuttingDown = false;
|
|
440
|
+
const shutdown = () => {
|
|
441
|
+
if (shuttingDown)
|
|
442
|
+
return;
|
|
443
|
+
shuttingDown = true;
|
|
444
|
+
console.log("");
|
|
445
|
+
console.log(chalk_1.default.yellow.bold(" ⏹ Shutting down…"));
|
|
446
|
+
console.log("");
|
|
447
|
+
for (const child of children) {
|
|
448
|
+
child.kill("SIGTERM");
|
|
449
|
+
}
|
|
450
|
+
// Force kill after 5 seconds
|
|
451
|
+
setTimeout(() => {
|
|
452
|
+
for (const child of children) {
|
|
453
|
+
if (!child.killed) {
|
|
454
|
+
child.kill("SIGKILL");
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
process.exit(0);
|
|
458
|
+
}, 5000);
|
|
459
|
+
};
|
|
460
|
+
process.on("SIGINT", shutdown);
|
|
461
|
+
process.on("SIGTERM", shutdown);
|
|
462
|
+
});
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file docs.command.ts
|
|
4
|
+
* @description `sovkora docs [build|sync]` (AGENTS.md §10) — code-driven documentation.
|
|
5
|
+
* `build` regenerates docs/_generated/ from the code (with `--check` for the build gate);
|
|
6
|
+
* `sync` copies the docs into the Krizaka site content tree.
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.docsCommand = void 0;
|
|
46
|
+
const commander_1 = require("commander");
|
|
47
|
+
const path = __importStar(require("node:path"));
|
|
48
|
+
const fs = __importStar(require("node:fs"));
|
|
49
|
+
const node_child_process_1 = require("node:child_process");
|
|
50
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
51
|
+
const prompts_1 = require("../ui/prompts");
|
|
52
|
+
const workspace_guard_1 = require("./workspace-guard");
|
|
53
|
+
/** Sovkora workspace root (where the generator + docs/ live). */
|
|
54
|
+
function resolveMonorepoRoot() {
|
|
55
|
+
return (0, workspace_guard_1.requireWorkspace)("docs");
|
|
56
|
+
}
|
|
57
|
+
/** Krizaka site root (products/<workspace> → products → krizaka-com). */
|
|
58
|
+
function resolveKrizakaRoot(root) {
|
|
59
|
+
return path.resolve(root, "..", "..");
|
|
60
|
+
}
|
|
61
|
+
function runGenerator(root, check) {
|
|
62
|
+
const node = process.execPath;
|
|
63
|
+
const result = (0, node_child_process_1.spawnSync)(node, ["scripts/generate-docs.mjs", ...(check ? ["--check"] : [])], {
|
|
64
|
+
cwd: root,
|
|
65
|
+
stdio: "inherit",
|
|
66
|
+
shell: false,
|
|
67
|
+
});
|
|
68
|
+
return result.status ?? 1;
|
|
69
|
+
}
|
|
70
|
+
const buildCommand = new commander_1.Command("build")
|
|
71
|
+
.description("Regenerate docs/_generated/ from the code")
|
|
72
|
+
.option("--check", "Fail if any generated doc is stale (build gate), without writing")
|
|
73
|
+
.action(async (opts) => {
|
|
74
|
+
const root = resolveMonorepoRoot();
|
|
75
|
+
await (0, prompts_1.intro)(chalk_1.default.cyan(`sovkora docs build${opts.check ? " --check" : ""}`));
|
|
76
|
+
const code = runGenerator(root, Boolean(opts.check));
|
|
77
|
+
if (code === 0) {
|
|
78
|
+
await (0, prompts_1.outro)(chalk_1.default.green(opts.check ? "✔ docs up to date" : "✔ docs generated"));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
await (0, prompts_1.logWarning)("docs build failed — generated docs are stale or the generator errored.");
|
|
82
|
+
process.exitCode = code;
|
|
83
|
+
});
|
|
84
|
+
const syncCommand = new commander_1.Command("sync")
|
|
85
|
+
.description("Copy docs/ (+ generated) into the Krizaka site content tree")
|
|
86
|
+
.action(async () => {
|
|
87
|
+
const root = resolveMonorepoRoot();
|
|
88
|
+
const krizaka = resolveKrizakaRoot(root);
|
|
89
|
+
await (0, prompts_1.intro)(chalk_1.default.cyan("sovkora docs sync"));
|
|
90
|
+
// Always regenerate first so the synced docs reflect the current code.
|
|
91
|
+
if (runGenerator(root, false) !== 0) {
|
|
92
|
+
await (0, prompts_1.logWarning)("generator failed — aborting sync.");
|
|
93
|
+
process.exitCode = 1;
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const docsSrc = path.join(root, "docs");
|
|
97
|
+
const genSrc = path.join(docsSrc, "_generated");
|
|
98
|
+
const contentDest = path.join(krizaka, "orazaka-content", "docs");
|
|
99
|
+
// Mirror: wipe the destination so deleted/renamed docs never linger, then
|
|
100
|
+
// re-publish. The site reads a FLAT slug namespace, so curated docs/*.md and
|
|
101
|
+
// generated _generated/*.md are flattened into one level (architecture.json
|
|
102
|
+
// is data, routed separately to app/data/).
|
|
103
|
+
fs.rmSync(contentDest, { recursive: true, force: true });
|
|
104
|
+
fs.mkdirSync(contentDest, { recursive: true });
|
|
105
|
+
let published = 0;
|
|
106
|
+
const copyMarkdown = (dir) => {
|
|
107
|
+
if (!fs.existsSync(dir))
|
|
108
|
+
return;
|
|
109
|
+
for (const name of fs.readdirSync(dir)) {
|
|
110
|
+
if (name.endsWith(".md")) {
|
|
111
|
+
fs.copyFileSync(path.join(dir, name), path.join(contentDest, name));
|
|
112
|
+
published++;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
copyMarkdown(docsSrc); // curated (top level)
|
|
117
|
+
copyMarkdown(genSrc); // generated (flattened)
|
|
118
|
+
// ADR source records keep their folder.
|
|
119
|
+
const adrSrc = path.join(docsSrc, "adr");
|
|
120
|
+
if (fs.existsSync(adrSrc))
|
|
121
|
+
fs.cpSync(adrSrc, path.join(contentDest, "adr"), { recursive: true });
|
|
122
|
+
// The 3D architecture scene reads architecture.json from the site's data dir.
|
|
123
|
+
const archSrc = path.join(genSrc, "architecture.json");
|
|
124
|
+
const archDest = path.join(krizaka, "app", "data", "architecture.json");
|
|
125
|
+
if (fs.existsSync(archSrc) && fs.existsSync(path.dirname(archDest))) {
|
|
126
|
+
fs.copyFileSync(archSrc, archDest);
|
|
127
|
+
}
|
|
128
|
+
await (0, prompts_1.logSuccess)(`Published ${published} docs → ${path.relative(krizaka, contentDest)}`);
|
|
129
|
+
await (0, prompts_1.note)(`architecture.json → ${path.relative(krizaka, archDest)}`, "Site data");
|
|
130
|
+
await (0, prompts_1.outro)(chalk_1.default.green("✔ docs synced"));
|
|
131
|
+
});
|
|
132
|
+
exports.docsCommand = new commander_1.Command("docs")
|
|
133
|
+
.description("Code-driven documentation: build (generate) | sync (to the site)")
|
|
134
|
+
.addCommand(buildCommand)
|
|
135
|
+
.addCommand(syncCommand);
|