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.
149 lines
5.4 KiB
JavaScript
149 lines
5.4 KiB
JavaScript
'use strict';
|
|
|
|
function resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {
|
|
let spaceBefore = false;
|
|
let atNewline = startOnNewline;
|
|
let hasSpace = startOnNewline;
|
|
let comment = '';
|
|
let commentSep = '';
|
|
let hasNewline = false;
|
|
let reqSpace = false;
|
|
let tab = null;
|
|
let anchor = null;
|
|
let tag = null;
|
|
let newlineAfterProp = null;
|
|
let comma = null;
|
|
let found = null;
|
|
let start = null;
|
|
for (const token of tokens) {
|
|
if (reqSpace) {
|
|
if (token.type !== 'space' &&
|
|
token.type !== 'newline' &&
|
|
token.type !== 'comma')
|
|
onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
|
reqSpace = false;
|
|
}
|
|
if (tab) {
|
|
if (atNewline && token.type !== 'comment' && token.type !== 'newline') {
|
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
|
}
|
|
tab = null;
|
|
}
|
|
switch (token.type) {
|
|
case 'space':
|
|
// At the doc level, tabs at line start may be parsed
|
|
// as leading white space rather than indentation.
|
|
// In a flow collection, only the parser handles indent.
|
|
if (!flow &&
|
|
(indicator !== 'doc-start' || next?.type !== 'flow-collection') &&
|
|
token.source.includes('\t')) {
|
|
tab = token;
|
|
}
|
|
hasSpace = true;
|
|
break;
|
|
case 'comment': {
|
|
if (!hasSpace)
|
|
onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');
|
|
const cb = token.source.substring(1) || ' ';
|
|
if (!comment)
|
|
comment = cb;
|
|
else
|
|
comment += commentSep + cb;
|
|
commentSep = '';
|
|
atNewline = false;
|
|
break;
|
|
}
|
|
case 'newline':
|
|
if (atNewline) {
|
|
if (comment)
|
|
comment += token.source;
|
|
else if (!found || indicator !== 'seq-item-ind')
|
|
spaceBefore = true;
|
|
}
|
|
else
|
|
commentSep += token.source;
|
|
atNewline = true;
|
|
hasNewline = true;
|
|
if (anchor || tag)
|
|
newlineAfterProp = token;
|
|
hasSpace = true;
|
|
break;
|
|
case 'anchor':
|
|
if (anchor)
|
|
onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');
|
|
if (token.source.endsWith(':'))
|
|
onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);
|
|
anchor = token;
|
|
start ?? (start = token.offset);
|
|
atNewline = false;
|
|
hasSpace = false;
|
|
reqSpace = true;
|
|
break;
|
|
case 'tag': {
|
|
if (tag)
|
|
onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');
|
|
tag = token;
|
|
start ?? (start = token.offset);
|
|
atNewline = false;
|
|
hasSpace = false;
|
|
reqSpace = true;
|
|
break;
|
|
}
|
|
case indicator:
|
|
// Could here handle preceding comments differently
|
|
if (anchor || tag)
|
|
onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);
|
|
if (found)
|
|
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);
|
|
found = token;
|
|
atNewline =
|
|
indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';
|
|
hasSpace = false;
|
|
break;
|
|
case 'comma':
|
|
if (flow) {
|
|
if (comma)
|
|
onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);
|
|
comma = token;
|
|
atNewline = false;
|
|
hasSpace = false;
|
|
break;
|
|
}
|
|
// else fallthrough
|
|
default:
|
|
onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);
|
|
atNewline = false;
|
|
hasSpace = false;
|
|
}
|
|
}
|
|
const last = tokens[tokens.length - 1];
|
|
const end = last ? last.offset + last.source.length : offset;
|
|
if (reqSpace &&
|
|
next &&
|
|
next.type !== 'space' &&
|
|
next.type !== 'newline' &&
|
|
next.type !== 'comma' &&
|
|
(next.type !== 'scalar' || next.source !== '')) {
|
|
onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');
|
|
}
|
|
if (tab &&
|
|
((atNewline && tab.indent <= parentIndent) ||
|
|
next?.type === 'block-map' ||
|
|
next?.type === 'block-seq'))
|
|
onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');
|
|
return {
|
|
comma,
|
|
found,
|
|
spaceBefore,
|
|
comment,
|
|
hasNewline,
|
|
anchor,
|
|
tag,
|
|
newlineAfterProp,
|
|
end,
|
|
start: start ?? end
|
|
};
|
|
}
|
|
|
|
exports.resolveProps = resolveProps;
|