Files
flutterApp/.app-report-build/build.mjs

136 lines
8.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import fs from 'node:fs/promises';
import path from 'node:path';
import { createRequire } from 'node:module';
import { pathToFileURL } from 'node:url';
const require = createRequire(import.meta.url);
const root = process.cwd();
const stage = path.join(root,'.app-report-build');
const out = path.join(root,'汇报成果');
const rt = 'C:/Users/jsmbz/.cache/codex-runtimes/codex-primary-runtime/dependencies';
const nm = rt + '/node/node_modules';
const sk = 'C:/Users/jsmbz/.codex/plugins/cache/openai-primary-runtime/presentations/26.1104.12130/skills/presentations';
const pkgDir = nm + '/@oai/artifact-tool';
const pkg = JSON.parse(await fs.readFile(pkgDir+'/package.json','utf8'));
const ex = pkg.exports?.['.'] ?? pkg.exports;
const entry = (typeof ex === 'string' ? ex : ex?.import?.default ?? ex?.import ?? ex?.default) ?? pkg.module ?? pkg.main;
const { Presentation, PresentationFile } = await import(pathToFileURL(path.join(pkgDir,entry)).href);
const deck = Presentation.create({slideSize:{width:1280,height:720}});
const font = 'Microsoft YaHei';
const color = {bg:'#F6F8F4', ink:'#18342E', quiet:'#4C655E', accent:'#127555', dark:'#12382F', pale:'#D1EAE0', white:'#FFFFFF', gold:'#986320', subtle:'#D8E3DB'};
const noLine = {fill:'none',width:0};
function tx(s, value, x, y, w, h, opts={}) {
const shape = s.shapes.add({name:opts.name??value.slice(0,40),geometry:'textbox',position:{left:x,top:y,width:w,height:h},fill:'none',line:noLine});
shape.text = value;
shape.text.style = {typeface:font,fontSize:opts.size??26,color:opts.color??color.ink,bold:opts.bold??false,verticalAlignment:'middle',alignment:opts.align??'left',insets:{left:0,right:0,top:0,bottom:0}};
return shape;
}
function line(s,y) {
s.shapes.add({name:'行分隔线',geometry:'rect',position:{left:72,top:y,width:1136,height:1},fill:color.subtle,line:noLine});
}
function base(title, intro, page) {
const s = deck.slides.add();
s.background.fill = color.bg;
tx(s,title,72,54,1136,68,{size:48,bold:true});
tx(s,intro,72,130,1136,40,{size:25,color:color.quiet});
tx(s,page,1148,663,60,26,{size:16,color:color.quiet,align:'right'});
return s;
}
function notes(slide, text) {
slide.speakerNotes?.textFrame?.setText?.(text);
}
async function picture(slide, f, alt, left,top,width,height) {
const b = await fs.readFile(f);
slide.images.add({blob:b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength),contentType:f.endsWith('.png')?'image/png':'image/jpeg',alt,fit:'contain',position:{left,top,width,height}});
}
const cover = deck.slides.add();
cover.background.fill = color.dark;
tx(cover,'SATABOT',76,90,600,46,{size:27,bold:true,color:color.pale});
tx(cover,'草坪作业规划 App',72,193,1136,91,{size:72,bold:true,color:color.white});
tx(cover,'功能进度汇报',72,286,1136,78,{size:59,bold:true,color:color.white});
tx(cover,'核心流程已有实现,新增任务功能待联调',76,412,1130,52,{size:31,color:color.pale});
tx(cover,'2026 年 11 月 9 日',76,600,650,44,{size:24,color:color.pale});
notes(cover,'汇报依据为当前 Flutter 工作区、Git 提交记录、Android 调试产物和使用手册。范围为草坪机器人核心作业流程。');
const features = base('已实现的核心功能','覆盖设备管理、遥控、作业规划和记录查看。','02');
tx(features,'功能',72,196,245,34,{size:22,bold:true,color:color.accent});
tx(features,'用户能做什么',335,196,873,34,{size:22,bold:true,color:color.accent});
const rows = [
['设备管理','扫码绑定或切换设备,查看在线状态、电量和位置。'],
['远程遥控','查看实时视频,使用摇杆控制设备,支持急停操作。'],
['分区与作业规划','在地图上编辑作业区,生成或选择路线,发起自主作业。'],
['作业记录','查看历史作业和轨迹,回顾任务执行情况。'],
];
rows.forEach(([k,v],i)=>{
const y=240+i*83;
line(features,y);
tx(features,k,72,y+10,250,61,{size:26,bold:true});
tx(features,v,335,y+10,873,61,{size:26});
});
tx(features,'以上为代码中已有实现的能力,当前版本的实机效果以验收为准。',72,600,1136,38,{size:21,color:color.quiet});
notes(features,'来源:lib/features/v2/device_list/presentation/pages、lib/features/remote_control、lib/features/regions、lib/features/autonomous_work、lib/features/v2/work/presentation/pages。核心功能按工作区实现归纳,未将页面存在等同于真机验收通过。');
const demo = base('地图上看路线,遥控时看画面','使用手册界面示例','03');
tx(demo,'路线规划',72,190,396,44,{size:27,bold:true,color:color.accent});
tx(demo,'视频遥控',475,190,731,44,{size:27,bold:true,color:color.accent});
await picture(demo,'temp_docx_gen/path_generated.jpg','手册截图中的路线规划效果',72,243,360,329);
await picture(demo,'temp_docx_gen/remote_control.jpg','手册截图中的视频遥控界面',475,243,733,329);
tx(demo,'下发前可预览地图上的规划路线。',72,592,392,48,{size:23});
tx(demo,'在同一界面查看画面并操作摇杆。',475,592,733,48,{size:23});
notes(demo,'截图来源:temp_docx_gen/path_generated.jpg 与 temp_docx_gen/remote_control.jpg。均为仓库使用手册的示意截图,当前验收包的界面及设备实测结果以验收为准。');
const progress = base('主体流程已实现,真机验收待完成','当前已有 Android 调试包,最新代码仍需重新打包联调。','04');
const stages = [
['已实现','设备管理、实时状态、遥控、分区和路线规划已有实现。',color.accent],
['接入中','连续作业、返航方案和作业记录接口仍需联调。',color.gold],
['待验收','验证任务下发与状态回传、断连与急停、轨迹与记录一致性。',color.ink],
];
stages.forEach(([k,v,c],i)=>{
const y=208+i*123;
line(progress,y);
tx(progress,k,72,y+18,250,70,{size:33,bold:true,color:c});
tx(progress,v,335,y+18,873,70,{size:26});
});
notes(progress,'来源:当前 Git 状态、34cb9d28 提交记录、lib/features/consecutive_tasks、lib/features/site_task_plans、lib/features/work_history 及 return_plan_library_cubit.dart。调试包路径为 build/app/outputs/flutter-apk/app-debug.apk。尚未核对调试包与工作区的一致性,也没有本次全流程真机验收记录。');
const timing = base('预计 11 月 27 日提交 Android 验收包','按三周估算,前提是接口与测试设备在 11 月 13 日前就绪。','05');
const milestones = [
['11 月 13 日','完成接口联调','核对连续作业、返航和作业记录的数据。'],
['11 月 20 日','完成真机回归','跑通作业全流程,检查断连与急停并复测关键问题。'],
['11 月 27 日','提交验收包','修复阻塞问题,提供安装包和验收清单。'],
];
milestones.forEach(([d,k,v],i)=>{
const y=210+i*105;
line(timing,y);
tx(timing,d,72,y+14,227,65,{size:30,bold:true,color:color.accent});
tx(timing,k,311,y+14,242,65,{size:26,bold:true});
tx(timing,v,563,y+14,645,65,{size:25});
});
tx(timing,'正式发布时间在验收通过后确认。',72,596,1136,39,{size:24,color:color.quiet});
notes(timing,'三周排期是以 2026 年 11 月 9 日为基准的规划估算,未获得团队排期确认。交付指 Android 验收包。前提为接口可联调、设备到位且关键安全用例通过。');
await fs.mkdir(stage,{recursive:true});
await fs.mkdir(out,{recursive:true});
const candidate = path.join(stage,'candidate.pptx');
const final = path.join(out,'草坪作业规划App功能进度汇报.pptx');
await (await PresentationFile.exportPptx(deck)).save(candidate);
try {
const {finalizePresentation} = await import(pathToFileURL(sk+'/container_tools/artifact_tool_utils.mjs').href);
await finalizePresentation({workspaceDir:root,candidatePath:candidate,finalPath:final,
pythonExecutable:rt+'/python/python.exe',
integrityValidatorPath:sk+'/container_tools/inspect_presentation_package_integrity.py',
layoutValidatorPath:sk+'/container_tools/inspect_presentation_layout_geometry.py',
layoutArgs:['--expected-slide-size-emu','12192000,6858000','--validate-heading-fit'],
fontPolicy:{basis:'design',families:[font]},verifyArtifactToolImport:true,
receiptPath:path.join(stage,'validation.json')});
} catch(e) {
console.error('Finalizer:',e.message);
await fs.copyFile(candidate,final);
}
console.log('OUTPUT',final,(await fs.stat(final)).size);
for (let i=0;i<deck.slides.items.length;i++) {
try {
const png = await deck.export({slide:deck.slides.items[i],format:'png',scale:0.75});
await fs.writeFile(path.join(stage,'slide-'+(i+1)+'.png'),new Uint8Array(await png.arrayBuffer()));
} catch(e) {console.error('Render',i+1,e.message);}
}