Sync OneOS workspace with new prototypes, annotations, and Gitea remote fix.
Add vehicle-h2-fee-ledger, customer-management, lease and self-operated ledgers, annotation sources, agent skills, and vite annotation runtime support. Update vehicle management, contract templates, and lease contract flows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
38
.local/extract-annotation-source/extract.mjs
Normal file
38
.local/extract-annotation-source/extract.mjs
Normal file
@@ -0,0 +1,38 @@
|
||||
import { chromium } from 'playwright';
|
||||
import { writeFileSync } from 'node:fs';
|
||||
|
||||
const url = process.argv[2];
|
||||
if (!url) {
|
||||
console.error('Usage: node extract.mjs <url>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const browser = await chromium.launch({ headless: true });
|
||||
const page = await browser.newPage();
|
||||
const errors = [];
|
||||
page.on('console', (m) => {
|
||||
if (m.type() === 'error') errors.push(m.text());
|
||||
});
|
||||
|
||||
await page.goto(url, { waitUntil: 'networkidle', timeout: 60000 });
|
||||
const title = await page.title();
|
||||
|
||||
let source = null;
|
||||
try {
|
||||
await page.waitForFunction(() => window.__AXHUB_ANNOTATION_SOURCE__, { timeout: 30000 });
|
||||
source = await page.evaluate(() => window.__AXHUB_ANNOTATION_SOURCE__);
|
||||
} catch {
|
||||
// fall through
|
||||
}
|
||||
|
||||
const out = { title, errors, source };
|
||||
writeFileSync('output.json', JSON.stringify(out, null, 2));
|
||||
console.log(JSON.stringify({
|
||||
title,
|
||||
errorCount: errors.length,
|
||||
hasSource: !!source,
|
||||
nodeCount: source?.nodes?.length ?? 0,
|
||||
directoryNodeCount: source?.directory?.nodes?.length ?? 0,
|
||||
}, null, 2));
|
||||
|
||||
await browser.close();
|
||||
407
.local/extract-annotation-source/output.json
Normal file
407
.local/extract-annotation-source/output.json
Normal file
File diff suppressed because one or more lines are too long
60
.local/extract-annotation-source/package-lock.json
generated
Normal file
60
.local/extract-annotation-source/package-lock.json
generated
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "extract-annotation-source",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "extract-annotation-source",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"playwright": "^1.49.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
|
||||
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright": {
|
||||
"version": "1.49.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.49.1.tgz",
|
||||
"integrity": "sha512-VYL8zLoNTBxVOrJBbDuRgDWa3i+mfQgDTrL8Ah9QXZ7ax4Dsj0MSq5bYgytRnDVVe+njoKnfsYkH3HzqVj5UZA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"playwright-core": "1.49.1"
|
||||
},
|
||||
"bin": {
|
||||
"playwright": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/playwright-core": {
|
||||
"version": "1.49.1",
|
||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.49.1.tgz",
|
||||
"integrity": "sha512-BzmpVcs4kE2CH15rWfzpjzVGhWERJfmnXmniSyKeRZUs9Ws65m+RGIi7mjJK/euCegfn3i7jvqWeWyHe9y3Vgg==",
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"playwright-core": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
.local/extract-annotation-source/package.json
Normal file
16
.local/extract-annotation-source/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "extract-annotation-source",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"dependencies": {
|
||||
"playwright": "^1.49.1"
|
||||
}
|
||||
}
|
||||
90
.local/sync-vehicle-h2-prd.mjs
Normal file
90
.local/sync-vehicle-h2-prd.mjs
Normal file
@@ -0,0 +1,90 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const root = '/Users/sylvawong/oneos1.2';
|
||||
const prdPath = join(root, 'src/resources/vehicle-h2-fee-ledger/PRD.md');
|
||||
const prd = readFileSync(prdPath, 'utf8');
|
||||
|
||||
const resourcesAlias = join(root, 'src/resources/vehicle-h2-fee-ledger/车辆氢费明细-需求文档.md');
|
||||
writeFileSync(resourcesAlias, prd, 'utf8');
|
||||
|
||||
const runtimePath = join(root, '.local/extract-annotation-source/output.json');
|
||||
const runtime = JSON.parse(readFileSync(runtimePath, 'utf8'));
|
||||
const runtimeSource = runtime.source;
|
||||
|
||||
const annPath = join(root, 'src/prototypes/vehicle-h2-fee-ledger/annotation-source.json');
|
||||
const ann = JSON.parse(readFileSync(annPath, 'utf8'));
|
||||
|
||||
function findChild(nodes, id) {
|
||||
for (const n of nodes || []) {
|
||||
if (n.id === id) return n;
|
||||
if (n.children) {
|
||||
const found = findChild(n.children, id);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
const docRoot = ann.directory.nodes[0];
|
||||
const prdNode = findChild(docRoot.children, 'vh2-doc-prd');
|
||||
if (prdNode) {
|
||||
prdNode.markdown = prd;
|
||||
prdNode.markdownPath = 'src/resources/vehicle-h2-fee-ledger/PRD.md';
|
||||
}
|
||||
|
||||
const pageAnn = findChild(docRoot.children, 'vh2-doc-page-annotations');
|
||||
if (pageAnn && runtimeSource?.directory) {
|
||||
const runtimePage = findChild(runtimeSource.directory.nodes[0].children, 'vh2-doc-page-annotations');
|
||||
if (runtimePage?.children) {
|
||||
for (const child of runtimePage.children) {
|
||||
const local = findChild(pageAnn.children, child.id);
|
||||
if (local && child.markdown) {
|
||||
local.markdown = child.markdown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const overview = findChild(docRoot.children, 'vh2-doc-overview');
|
||||
const runtimeOverview = findChild(runtimeSource.directory.nodes[0].children, 'vh2-doc-overview');
|
||||
if (overview && runtimeOverview?.markdown) {
|
||||
overview.markdown = runtimeOverview.markdown;
|
||||
}
|
||||
|
||||
if (runtimeSource?.nodes) {
|
||||
const markdownMap = { ...(ann.markdownMap || {}) };
|
||||
for (const node of runtimeSource.nodes) {
|
||||
const local = ann.data.nodes.find((n) => n.id === node.id);
|
||||
if (!local) continue;
|
||||
if (node.annotationText != null && node.annotationText !== '') {
|
||||
local.annotationText = node.annotationText;
|
||||
}
|
||||
if (node.hasMarkdown && node.annotationText) {
|
||||
markdownMap[node.id] = node.annotationText;
|
||||
}
|
||||
if (node.updatedAt) local.updatedAt = node.updatedAt;
|
||||
if (node.controls) local.controls = node.controls;
|
||||
}
|
||||
ann.markdownMap = markdownMap;
|
||||
}
|
||||
|
||||
ann.data.updatedAt = Date.now();
|
||||
writeFileSync(annPath, JSON.stringify(ann, null, 2) + '\n', 'utf8');
|
||||
|
||||
const pagePath = join(root, 'src/prototypes/vehicle-h2-fee-ledger/H2LedgerPage.jsx');
|
||||
let page = readFileSync(pagePath, 'utf8');
|
||||
const prdForJs = prd.replace(/\\/g, '\\\\').replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
||||
const startMarker = 'var H2_LEDGER_REQUIREMENT_DOC = `';
|
||||
const endMarker = '`;\n\n/** 将 PRD Markdown 排版为 React 节点';
|
||||
const startIdx = page.indexOf(startMarker);
|
||||
const endIdx = page.indexOf(endMarker);
|
||||
if (startIdx === -1 || endIdx === -1) {
|
||||
throw new Error('H2_LEDGER_REQUIREMENT_DOC markers not found');
|
||||
}
|
||||
page = page.slice(0, startIdx + startMarker.length) + prdForJs + page.slice(endIdx);
|
||||
writeFileSync(pagePath, page, 'utf8');
|
||||
|
||||
console.log('Synced PRD to:', prdPath);
|
||||
console.log('Synced alias:', resourcesAlias);
|
||||
console.log('Synced annotation-source.json and H2LedgerPage.jsx');
|
||||
Reference in New Issue
Block a user