CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
Recovery delivery of the accumulated, TL-accepted Epic 3 work that had never been
committed to Git (stories 3.6-3.17, see the crank board). Story 3.18 is not accepted
yet and is deliberately excluded: its logging surface, its capability registration,
its oracle projections and its tests are not part of this tree.
Accepted scope
- 3.6 typed static Resource Drafts; 3.7 publication and exact binding of static
Resource Versions; 3.8 MCP discovery/read and revocation of static Resources;
- 3.9 Resource import/export in API and UI plus TLS dependency maintenance;
3.10 REST-backed Resource templates; 3.11 shared REST read runtime and the MCP
revision/capability foundation;
- 3.12 parameterised Prompt Drafts with preview; 3.13 Prompt publication and exact
version binding to Agents; 3.14 MCP prompts; 3.15 Prompt import/export;
- 3.16 composite Prompts with published Resources (dependency content scan plus
dynamic read through the accepted 3.11 runtime, admin preview and MCP prompts/get);
- 3.17 bounded MCP completion suggestions from typed published schemas and the
resources/list admission fix for bound template publications.
Accepted evidence being reused (unchanged code paths)
- 3.16 candidate: core 7, admin-api 22, registry 4, mcp-server 4, UI 6; one final
`just verify` run 1651 passed / 0 failed / 2 ignored.
- 3.17 candidate: full run 1672 passed / 0 failed / 2 ignored, QA targeted reruns and
a real MCP Inspector 2.12.0 client smoke.
Delivery engineering in this commit
- CI: one event per change (feature branches are gated by their pull request, push
runs only on main), story events run the changed packages, the full workspace suite
stays the feature/release gate; no cache/sharding without a measured runner check.
- Release: the packaged archives, checksums and SBOM are now uploaded to the Gitea
release entry of the tag instead of dying with the runner workspace.
Not included on purpose: Story 3.18 work, build caches, runtime databases, local
credentials and scratch evidence.
Refs: crank kanban t_e39d7263; baseline 1b6db09bd1.
267 lines
7.0 KiB
JavaScript
267 lines
7.0 KiB
JavaScript
const { transform } = require('esbuild');
|
|
const crypto = require('crypto');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const ROOT_DIR = path.resolve(__dirname, '..');
|
|
const DIST_DIR = path.join(ROOT_DIR, 'dist');
|
|
const BUNDLE_DIR = path.join(DIST_DIR, 'js', 'bundles');
|
|
const BRAND_IMAGE_PATHS = [
|
|
path.join(ROOT_DIR, 'crank-community.png'),
|
|
path.resolve(ROOT_DIR, '..', '..', 'crank-community.png'),
|
|
];
|
|
const FONT_FILES = [
|
|
['@fontsource/inter', 'inter', ['400', '500', '600', '700']],
|
|
['@fontsource/jetbrains-mono', 'jetbrains-mono', ['400', '500']],
|
|
];
|
|
|
|
const BUNDLES = {
|
|
'protected-core': {
|
|
files: [
|
|
'js/config.js',
|
|
'js/i18n.js',
|
|
'js/slot-registry.js',
|
|
'js/overlay-loader.js',
|
|
'js/dom.js',
|
|
'js/diagnostics.js',
|
|
'js/page-transitions.js',
|
|
'js/workspace.js',
|
|
'js/api.js',
|
|
'js/ui-feedback.js',
|
|
'js/auth.js',
|
|
'js/onboarding.js',
|
|
],
|
|
footer: 'window.CrankAuth.guardProtectedPage();\n',
|
|
},
|
|
login: {
|
|
files: [
|
|
'js/config.js',
|
|
'js/i18n.js',
|
|
'js/diagnostics.js',
|
|
'js/api.js',
|
|
'js/auth.js',
|
|
'js/login.js',
|
|
],
|
|
},
|
|
operations: {
|
|
files: [
|
|
'node_modules/alpinejs/dist/cdn.min.js',
|
|
'js/openapi-import.js',
|
|
'js/catalog.js',
|
|
],
|
|
},
|
|
agents: {
|
|
files: [
|
|
'node_modules/alpinejs/dist/cdn.min.js',
|
|
'js/agents.js',
|
|
],
|
|
},
|
|
'api-keys': {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/api-keys.js',
|
|
],
|
|
},
|
|
logs: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/logs.js',
|
|
],
|
|
},
|
|
usage: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/usage.js',
|
|
],
|
|
},
|
|
secrets: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/secrets.js',
|
|
],
|
|
},
|
|
resources: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/resources.js',
|
|
],
|
|
},
|
|
prompts: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/prompts.js',
|
|
],
|
|
},
|
|
settings: {
|
|
files: [
|
|
'js/nav.js',
|
|
'js/settings.js',
|
|
],
|
|
},
|
|
'workspace-setup': {
|
|
files: [
|
|
'js/diagnostics.js',
|
|
'js/workspace-setup.js',
|
|
],
|
|
},
|
|
wizard: {
|
|
files: [
|
|
'node_modules/js-yaml/dist/browser/js-yaml.umd.min.js',
|
|
'js/wizard-state.js',
|
|
'js/wizard-shell.js',
|
|
'js/wizard-upstreams.js',
|
|
'js/wizard-model.js',
|
|
'js/wizard-mapping.js',
|
|
'js/wizard-live.js',
|
|
'js/wizard.js',
|
|
'js/nav.js',
|
|
],
|
|
},
|
|
};
|
|
|
|
function sha(input) {
|
|
return crypto.createHash('sha256').update(input).digest('hex').slice(0, 12);
|
|
}
|
|
|
|
function sourcePath(relativePath) {
|
|
return path.join(ROOT_DIR, relativePath);
|
|
}
|
|
|
|
function ensureDirectory(directoryPath) {
|
|
fs.mkdirSync(directoryPath, { recursive: true });
|
|
}
|
|
|
|
function removeDirectory(directoryPath) {
|
|
fs.rmSync(directoryPath, { recursive: true, force: true });
|
|
}
|
|
|
|
function copyFile(source, destination) {
|
|
ensureDirectory(path.dirname(destination));
|
|
fs.copyFileSync(source, destination);
|
|
}
|
|
|
|
function copyDirectory(source, destination) {
|
|
ensureDirectory(destination);
|
|
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
|
|
const sourceEntry = path.join(source, entry.name);
|
|
const destinationEntry = path.join(destination, entry.name);
|
|
if (entry.isDirectory()) {
|
|
copyDirectory(sourceEntry, destinationEntry);
|
|
continue;
|
|
}
|
|
copyFile(sourceEntry, destinationEntry);
|
|
}
|
|
}
|
|
|
|
function copyFonts() {
|
|
FONT_FILES.forEach(function([packageName, family, weights]) {
|
|
weights.forEach(function(weight) {
|
|
['latin', 'cyrillic'].forEach(function(subset) {
|
|
var fileName = `${family}-${subset}-${weight}-normal.woff2`;
|
|
copyFile(
|
|
path.join(ROOT_DIR, 'node_modules', packageName, 'files', fileName),
|
|
path.join(DIST_DIR, 'fonts', fileName)
|
|
);
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function readSource(relativePath) {
|
|
return fs.readFileSync(sourcePath(relativePath), 'utf8');
|
|
}
|
|
|
|
function resolveBrandImage() {
|
|
const match = BRAND_IMAGE_PATHS.find(function(filePath) {
|
|
return fs.existsSync(filePath);
|
|
});
|
|
if (!match) {
|
|
throw new Error('unable to resolve crank-community.png for UI build');
|
|
}
|
|
return match;
|
|
}
|
|
|
|
async function buildBundle(name, config) {
|
|
const source = config.files.map(readSource).join('\n\n') + '\n' + (config.footer || '');
|
|
const result = await transform(source, {
|
|
loader: 'js',
|
|
minify: true,
|
|
target: 'es2019',
|
|
legalComments: 'none',
|
|
});
|
|
const hash = sha(result.code);
|
|
const fileName = `${name}.${hash}.js`;
|
|
const relativeOutputPath = path.posix.join('js', 'bundles', fileName);
|
|
fs.writeFileSync(path.join(BUNDLE_DIR, fileName), result.code);
|
|
return relativeOutputPath;
|
|
}
|
|
|
|
function rewriteHtml(relativePath, replacements, prefix) {
|
|
const source = readSource(relativePath);
|
|
const output = source.replace(/%CRANK_BUNDLE_([A-Z0-9_]+)%/g, function(_match, token) {
|
|
const key = token.toLowerCase().replace(/_/g, '-');
|
|
const filePath = replacements[key];
|
|
if (!filePath) {
|
|
throw new Error(`missing bundle placeholder ${key}`);
|
|
}
|
|
return prefix ? path.posix.join(prefix, filePath) : filePath;
|
|
});
|
|
const destination = path.join(DIST_DIR, relativePath);
|
|
ensureDirectory(path.dirname(destination));
|
|
fs.writeFileSync(destination, output);
|
|
}
|
|
|
|
async function main() {
|
|
var overlayDirectory = process.env.CRANK_UI_OVERLAY_DIR || '';
|
|
removeDirectory(DIST_DIR);
|
|
ensureDirectory(BUNDLE_DIR);
|
|
|
|
const manifest = {};
|
|
for (const [name, config] of Object.entries(BUNDLES)) {
|
|
manifest[name] = await buildBundle(name, config);
|
|
}
|
|
|
|
copyDirectory(path.join(ROOT_DIR, 'css'), path.join(DIST_DIR, 'css'));
|
|
copyFonts();
|
|
copyDirectory(path.join(ROOT_DIR, 'data'), path.join(DIST_DIR, 'data'));
|
|
ensureDirectory(path.join(DIST_DIR, 'html', 'wizard'));
|
|
[
|
|
'html/wizard/index.html',
|
|
'html/wizard/step1.html',
|
|
'html/wizard/step2.html',
|
|
'html/wizard/step3-rest.html',
|
|
'html/wizard/step4.html',
|
|
'html/wizard/step5.html',
|
|
].forEach(function(relativePath) {
|
|
copyFile(path.join(ROOT_DIR, relativePath), path.join(DIST_DIR, relativePath));
|
|
});
|
|
copyDirectory(path.join(ROOT_DIR, 'icons'), path.join(DIST_DIR, 'icons'));
|
|
copyFile(resolveBrandImage(), path.join(DIST_DIR, 'Crank.png'));
|
|
if (overlayDirectory && fs.existsSync(overlayDirectory)) {
|
|
copyDirectory(overlayDirectory, path.join(DIST_DIR, 'overlay'));
|
|
}
|
|
|
|
rewriteHtml('index.html', manifest, '');
|
|
rewriteHtml('html/login.html', manifest, '..');
|
|
rewriteHtml('html/agents.html', manifest, '..');
|
|
rewriteHtml('html/api-keys.html', manifest, '..');
|
|
rewriteHtml('html/logs.html', manifest, '..');
|
|
rewriteHtml('html/secrets.html', manifest, '..');
|
|
rewriteHtml('html/resources.html', manifest, '..');
|
|
rewriteHtml('html/prompts.html', manifest, '..');
|
|
rewriteHtml('html/settings.html', manifest, '..');
|
|
rewriteHtml('html/usage.html', manifest, '..');
|
|
rewriteHtml('html/workspace-setup.html', manifest, '..');
|
|
rewriteHtml('html/wizard/index.html', manifest, '../..');
|
|
|
|
fs.writeFileSync(
|
|
path.join(DIST_DIR, 'build-manifest.json'),
|
|
JSON.stringify(manifest, null, 2) + '\n',
|
|
);
|
|
}
|
|
|
|
main().catch(function(error) {
|
|
console.error(error);
|
|
process.exitCode = 1;
|
|
});
|