Problem: the hexagonal refactor churns the backend tree for nine more phases; the UI delivery stack (web/ SPA, cmd/desktop Wails wrapper, compose/web image) must move to its own repo first so doc/layout rewrites land once on a backend-only tree. Change: - New repo git.hubris.network/dtoro/oikos-web (v0.33.0): web/, desktop/ (updateURL repointed to oikos-web releases), compose/, own CI (web + desktop jobs), own deploy script (CI-green gate, TOCTOU guard, version-tagged images, prune-to-3), own webhook receiver on :9798 + launchd unit, own compose project publishing the same 8091:80. - Cutover executed on mac-mini in order: oikos stack's web service stopped+removed, oikos-web project brought up on 8091; outer Caddy untouched (targets the published port) — serving + Authentik flow + /wails 404 quirk verified post-cutover. - Stripped from oikos: web/, cmd/desktop/, compose/web/, desktop CI workflow, ci.yml web job, Makefile ui/desktop/desktop-package/install targets, the compose web service, oikos-web from deploy.sh's fallback prune list; wails + go-keyring dropped from go.mod, vendor synced. - README / CONTRIBUTING / AGENTS.md / .agents dev+operations docs now point at the new repo; mbse + mascot design docs carry a path note. Risk: production SPA serving depends on the new pipeline now; rollback is versioned-image re-up of the old web service from a pre-split checkout (port 8091). Desktop builds installed before the split still check dtoro/oikos releases — one manual reinstall, noted in the oikos-web release notes. Verification: go vet, make test (race), make generate-check, golangci (no new findings; baseline down 400→365); post-cutover curls — localhost:8091 200, /wails/runtime.js 404, outer Caddy 302 Authentik.
111 lines
2.7 KiB
JavaScript
111 lines
2.7 KiB
JavaScript
'use strict';
|
|
|
|
let FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM, isTTY=true;
|
|
if (typeof process !== 'undefined') {
|
|
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
|
|
isTTY = process.stdout && process.stdout.isTTY;
|
|
}
|
|
|
|
const $ = {
|
|
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== 'dumb' && (
|
|
FORCE_COLOR != null && FORCE_COLOR !== '0' || isTTY
|
|
),
|
|
|
|
// modifiers
|
|
reset: init(0, 0),
|
|
bold: init(1, 22),
|
|
dim: init(2, 22),
|
|
italic: init(3, 23),
|
|
underline: init(4, 24),
|
|
inverse: init(7, 27),
|
|
hidden: init(8, 28),
|
|
strikethrough: init(9, 29),
|
|
|
|
// colors
|
|
black: init(30, 39),
|
|
red: init(31, 39),
|
|
green: init(32, 39),
|
|
yellow: init(33, 39),
|
|
blue: init(34, 39),
|
|
magenta: init(35, 39),
|
|
cyan: init(36, 39),
|
|
white: init(37, 39),
|
|
gray: init(90, 39),
|
|
grey: init(90, 39),
|
|
|
|
// background colors
|
|
bgBlack: init(40, 49),
|
|
bgRed: init(41, 49),
|
|
bgGreen: init(42, 49),
|
|
bgYellow: init(43, 49),
|
|
bgBlue: init(44, 49),
|
|
bgMagenta: init(45, 49),
|
|
bgCyan: init(46, 49),
|
|
bgWhite: init(47, 49)
|
|
};
|
|
|
|
function run(arr, str) {
|
|
let i=0, tmp, beg='', end='';
|
|
for (; i < arr.length; i++) {
|
|
tmp = arr[i];
|
|
beg += tmp.open;
|
|
end += tmp.close;
|
|
if (!!~str.indexOf(tmp.close)) {
|
|
str = str.replace(tmp.rgx, tmp.close + tmp.open);
|
|
}
|
|
}
|
|
return beg + str + end;
|
|
}
|
|
|
|
function chain(has, keys) {
|
|
let ctx = { has, keys };
|
|
|
|
ctx.reset = $.reset.bind(ctx);
|
|
ctx.bold = $.bold.bind(ctx);
|
|
ctx.dim = $.dim.bind(ctx);
|
|
ctx.italic = $.italic.bind(ctx);
|
|
ctx.underline = $.underline.bind(ctx);
|
|
ctx.inverse = $.inverse.bind(ctx);
|
|
ctx.hidden = $.hidden.bind(ctx);
|
|
ctx.strikethrough = $.strikethrough.bind(ctx);
|
|
|
|
ctx.black = $.black.bind(ctx);
|
|
ctx.red = $.red.bind(ctx);
|
|
ctx.green = $.green.bind(ctx);
|
|
ctx.yellow = $.yellow.bind(ctx);
|
|
ctx.blue = $.blue.bind(ctx);
|
|
ctx.magenta = $.magenta.bind(ctx);
|
|
ctx.cyan = $.cyan.bind(ctx);
|
|
ctx.white = $.white.bind(ctx);
|
|
ctx.gray = $.gray.bind(ctx);
|
|
ctx.grey = $.grey.bind(ctx);
|
|
|
|
ctx.bgBlack = $.bgBlack.bind(ctx);
|
|
ctx.bgRed = $.bgRed.bind(ctx);
|
|
ctx.bgGreen = $.bgGreen.bind(ctx);
|
|
ctx.bgYellow = $.bgYellow.bind(ctx);
|
|
ctx.bgBlue = $.bgBlue.bind(ctx);
|
|
ctx.bgMagenta = $.bgMagenta.bind(ctx);
|
|
ctx.bgCyan = $.bgCyan.bind(ctx);
|
|
ctx.bgWhite = $.bgWhite.bind(ctx);
|
|
|
|
return ctx;
|
|
}
|
|
|
|
function init(open, close) {
|
|
let blk = {
|
|
open: `\x1b[${open}m`,
|
|
close: `\x1b[${close}m`,
|
|
rgx: new RegExp(`\\x1b\\[${close}m`, 'g')
|
|
};
|
|
return function (txt) {
|
|
if (this !== void 0 && this.has !== void 0) {
|
|
!!~this.has.indexOf(open) || (this.has.push(open),this.keys.push(blk));
|
|
return txt === void 0 ? this : $.enabled ? run(this.keys, txt+'') : txt+'';
|
|
}
|
|
return txt === void 0 ? chain([open], [blk]) : $.enabled ? run([blk], txt+'') : txt+'';
|
|
};
|
|
}
|
|
|
|
module.exports = $;
|