shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

scripts/fetch-round9-live-latest.mjs

import fs from "node:fs"
import crypto from "node:crypto"
import assert from "node:assert/strict"

const name="shibosoftwaredev/f1c100s-linux-nema17-stepper-controller"
const dir="reports/round9-live-latest"
fs.mkdirSync(dir,{recursive:true})
const hash=b=>crypto.createHash("sha256").update(b).digest("hex")
async function request(endpoint,body){
  const r=await fetch(`https://registry-api.tscircuit.com/${endpoint}`,{
    method:body?"POST":"GET",headers:body?{"content-type":"application/json"}:undefined,
    body:body?JSON.stringify(body):undefined,signal:AbortSignal.timeout(45000)})
  assert.ok(r.ok,`${endpoint.split("?")[0]} HTTP ${r.status}`)
  return r.json()
}
const pkg=(await request("packages/get",{name})).package
assert.ok(pkg.latest_version&&pkg.latest_package_release_id)
const release=(await request("package_releases/get",{package_name_with_version:`${name}@${pkg.latest_version}`})).package_release
assert.equal(release.package_release_id,pkg.latest_package_release_id)
const files=(await request(`package_files/list?${new URLSearchParams({package_release_id:release.package_release_id})}`)).package_files
const write=(name,value)=>fs.writeFileSync(`${dir}/${name}`,JSON.stringify(value,null,2)+"\n")
write("package.json",pkg);write("release.json",release);write("files.json",files)
let build=null
if(release.latest_package_build_id){
  build=(await request(`package_builds/get?${new URLSearchParams({package_build_id:release.latest_package_build_id})}`)).package_build
  write("build.json",build)
}
const wanted=["dist/index/circuit.json","reports/solder-process-audit.json","reports/round5-fix-status.json",
  "verification.json","package.json","tscircuit.config.json","assembly-models.json","assembly-parts.json","assembly-metadata.ts",
  ...files.filter(f=>/^firmware\//.test(f.file_path)&&(/\.(c|h|py|md)$/.test(f.file_path)||f.file_path.endsWith("/Makefile"))).map(f=>f.file_path)]
const downloaded=[],missing=[]
for(const file of [...new Set(wanted)]){
  const entry=files.find(f=>f.file_path===file)
  if(!entry){missing.push(file);continue}
  const p=(await request(`package_files/get?${new URLSearchParams({package_file_id:entry.package_file_id})}`)).package_file
  assert.ok(p.content_text!=null||p.content_base64!=null,`readable ${file}`)
  const bytes=p.content_text!=null?Buffer.from(p.content_text):Buffer.from(p.content_base64,"base64")
  const local=`${dir}/latest-${file.replaceAll("/","_")}`
  fs.writeFileSync(local,bytes)
  if(file==="dist/index/circuit.json"){
    fs.mkdirSync(`${dir}/latest`,{recursive:true})
    fs.writeFileSync(`${dir}/latest/circuit.json`,bytes)
  }
  downloaded.push({file,local,sha256:hash(bytes)})
}
assert.ok(downloaded.some(f=>f.file==="dist/index/circuit.json"))
const end=(await request("packages/get",{name})).package
assert.equal(end.latest_package_release_id,pkg.latest_package_release_id,"no concurrent latest update during comparison")
const report={checkedAt:new Date().toISOString(),packageName:name,latestVersion:pkg.latest_version,
  latestReleaseId:release.package_release_id,latestBuildId:release.latest_package_build_id,
  buildCompletedAt:build?.user_code_job_completed_at??null,
  buildError:build?.user_code_job_error??build?.circuit_json_build_error??build?.transpilation_error??null,
  downloaded,missing,readOnlyRegistryOperations:true,publishedOrPromoted:false}
write("fetch-manifest.json",report)
console.log(JSON.stringify({...report,downloaded:downloaded.map(f=>f.file)}))