mirror of
https://github.com/Heretek-AI/openclaw.git
synced 2026-07-19 18:53:33 -04:00
a9ae1a6778
Matrix Protocol: - docker-compose.matrix.yml: Dendrite homeserver + PostgreSQL + Nginx TLS - src/channels/plugins/matrix-channel.ts: OpenClaw plugin implementation - docs/matrix-triad-setup.md: Setup guide with auth scheme (@tm1-4:triad.local) MCP Server Integration: - docs/mcp-triad-integration.md: SearXNG, Playwright, GitHub MCP configs - docs/mcp-curiosity-mapping.md: Gap-to-capability mapping Node Sync Architecture: - src/services/node-sync-service.ts: WebSocket peer sync + presence detection - src/services/node-sync-service.test.ts: Unit tests - docs/node-sync-architecture.md: Architecture docs Triad Resilience: - scripts/triad-corruption-check.mjs: SQLite + log + config + git integrity - docs/triad-resilience.md: Recovery procedures - .secure/deployment-logs/README.md: Schema v2 - skills/triad-heartbeat/SKILL.md: Corruption check integration NPM Publish Workflow: - scripts/npm-publish.mjs: version, changelog, validate, publish, rollback - .github/workflows/npm-publish.yml: GitHub Actions with provenance - docs/npm-publish-guide.md: Complete documentation All deliverables tested in Docker before production.
77 lines
1.9 KiB
JavaScript
Executable File
77 lines
1.9 KiB
JavaScript
Executable File
#!/usr/bin/env -S node --import tsx
|
|
|
|
import { pathToFileURL } from "node:url";
|
|
|
|
export type SparkleBuildFloors = {
|
|
dateKey: number;
|
|
legacyFloor: number;
|
|
laneFloor: number;
|
|
lane: number;
|
|
};
|
|
|
|
const CALVER_REGEX = /^([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})([.-].*)?$/;
|
|
|
|
export function sparkleBuildFloorsFromShortVersion(
|
|
shortVersion: string,
|
|
): SparkleBuildFloors | null {
|
|
const match = CALVER_REGEX.exec(shortVersion.trim());
|
|
if (!match) {
|
|
return null;
|
|
}
|
|
|
|
const year = Number.parseInt(match[1], 10);
|
|
const month = Number.parseInt(match[2], 10);
|
|
const day = Number.parseInt(match[3], 10);
|
|
if (
|
|
!Number.isInteger(year) ||
|
|
!Number.isInteger(month) ||
|
|
!Number.isInteger(day) ||
|
|
month < 1 ||
|
|
month > 12 ||
|
|
day < 1 ||
|
|
day > 31
|
|
) {
|
|
return null;
|
|
}
|
|
|
|
const dateKey = Number(`${year}${String(month).padStart(2, "0")}${String(day).padStart(2, "0")}`);
|
|
const legacyFloor = Number(`${dateKey}0`);
|
|
|
|
let lane = 90;
|
|
const suffix = match[4] ?? "";
|
|
if (suffix.length > 0) {
|
|
const numericSuffix = /([0-9]+)$/.exec(suffix)?.[1];
|
|
if (numericSuffix) {
|
|
lane = Math.min(Number.parseInt(numericSuffix, 10), 89);
|
|
} else {
|
|
lane = 1;
|
|
}
|
|
}
|
|
|
|
const laneFloor = Number(`${dateKey}${String(lane).padStart(2, "0")}`);
|
|
return { dateKey, legacyFloor, laneFloor, lane };
|
|
}
|
|
|
|
export function canonicalSparkleBuildFromVersion(shortVersion: string): number | null {
|
|
return sparkleBuildFloorsFromShortVersion(shortVersion)?.laneFloor ?? null;
|
|
}
|
|
|
|
function runCli(args: string[]): number {
|
|
const [command, version] = args;
|
|
if (command !== "canonical-build" || !version) {
|
|
return 1;
|
|
}
|
|
|
|
const build = canonicalSparkleBuildFromVersion(version);
|
|
if (build === null) {
|
|
return 1;
|
|
}
|
|
|
|
console.log(String(build));
|
|
return 0;
|
|
}
|
|
|
|
if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
|
|
process.exit(runCli(process.argv.slice(2)));
|
|
}
|