@autono/create-open-pages 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import chalk from "chalk";
3
3
  import { cp, mkdir, readFile, readdir, rm, symlink, writeFile } from "node:fs/promises";
4
- import { basename, dirname, join, resolve } from "node:path";
4
+ import { basename, dirname, join, resolve, sep } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { Command } from "commander";
7
7
  import prompts from "prompts";
8
8
  import { spawn } from "node:child_process";
9
+ import { createHash } from "node:crypto";
9
10
  import { existsSync } from "node:fs";
10
11
 
11
12
  //#region src/git.ts
@@ -102,7 +103,7 @@ async function isDirNonEmpty(target) {
102
103
  return entries.some((e) => !e.startsWith("."));
103
104
  }
104
105
  function coreVersionRange() {
105
- return `^0.5.0`;
106
+ return `^0.6.0`;
106
107
  }
107
108
  async function linkOrCopy(relSrc, dst) {
108
109
  await rm(dst, {
@@ -128,6 +129,32 @@ async function materializeTemplateLinks(target) {
128
129
  await linkOrCopy(join("..", "..", ".agents", "skills", entry.name), join(claudeSkills, entry.name));
129
130
  }
130
131
  }
132
+ async function writeUiManifest(target) {
133
+ const manifest = {};
134
+ for (const entry of [
135
+ "ui",
136
+ "lib",
137
+ "hooks"
138
+ ]) {
139
+ const root = join(target, entry);
140
+ if (!existsSync(root)) continue;
141
+ for (const rel of await collectFiles(root)) {
142
+ const wsRel = join(entry, rel).split(sep).join("/");
143
+ manifest[wsRel] = createHash("sha256").update(await readFile(join(root, rel))).digest("hex");
144
+ }
145
+ }
146
+ const sorted = Object.fromEntries(Object.entries(manifest).sort(([a], [b]) => a.localeCompare(b)));
147
+ await writeFile(join(target, "ui", ".sync-manifest.json"), `${JSON.stringify(sorted, null, 2)}\n`);
148
+ }
149
+ async function collectFiles(dir, prefix = "") {
150
+ const out = [];
151
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
152
+ const rel = prefix ? join(prefix, entry.name) : entry.name;
153
+ if (entry.isDirectory()) out.push(...await collectFiles(join(dir, entry.name), rel));
154
+ else if (entry.isFile()) out.push(rel);
155
+ }
156
+ return out;
157
+ }
131
158
  async function runInstall(pm, cwd) {
132
159
  await new Promise((res, rej) => {
133
160
  const child = spawn(pm, ["install"], {
@@ -147,6 +174,7 @@ async function init(opts) {
147
174
  if (await isDirNonEmpty(target) && !force) throw new Error(`Target ${target} is not empty. Pass --force to scaffold into it anyway.`);
148
175
  await cp(TEMPLATE_DIR, target, { recursive: true });
149
176
  await materializeTemplateLinks(target);
177
+ await writeUiManifest(target);
150
178
  const pkgPath = join(target, "package.json");
151
179
  if (existsSync(pkgPath)) {
152
180
  const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autono/create-open-pages",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Scaffold an open-pages workspace — agent skills preconfigured, live real-PDF preview out of the box.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,8 @@ Then open `http://localhost:5173`, edit `pages/getting-started/index.tsx`, or cr
31
31
  | `npm run export` | Build pages into `export/<id>/`, one deployable folder per page. |
32
32
  | `npm run preview` | Preview the built workspace locally. |
33
33
  | `npm run sync:skills` | Sync the bundled agent skills into the workspace. |
34
- | `npm run update` | Update `@autono/open-pages` and sync skills. |
34
+ | `npx open-pages sync:ui` | Update `ui/`, `lib/`, and `hooks/` to the installed runtime's set; files you edited are kept (`--force` to overwrite). |
35
+ | `npm run update` | Update `@autono/open-pages` and sync skills and UI. |
35
36
 
36
37
  ## Authoring a page
37
38