@autono/open-pages 0.1.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.
Files changed (110) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +108 -0
  3. package/bin.js +2 -0
  4. package/dist/build-TP72kiw7.js +35 -0
  5. package/dist/cli/bin.d.ts +1 -0
  6. package/dist/cli/bin.js +100 -0
  7. package/dist/config-C9or4m4J.d.ts +23 -0
  8. package/dist/config-L0IbktJ0.js +3135 -0
  9. package/dist/design-C13iz9_4.js +35 -0
  10. package/dist/dev-I2IyEh5W.js +97 -0
  11. package/dist/export-B-kBRWB1.js +4 -0
  12. package/dist/export-ic28osQP.js +131 -0
  13. package/dist/index.d.ts +56 -0
  14. package/dist/index.js +3 -0
  15. package/dist/locale/index.d.ts +24 -0
  16. package/dist/locale/index.js +881 -0
  17. package/dist/open-pages-plugin-D_DN_zjh.js +632 -0
  18. package/dist/preview-BrDuvgAN.js +21 -0
  19. package/dist/sync-Be_hxSOF.js +139 -0
  20. package/dist/sync-lKEXyPOh.js +3 -0
  21. package/dist/types-C5NCdDT-.d.ts +219 -0
  22. package/dist/update-CV62NhBT.js +37 -0
  23. package/dist/update-package-Cxt57pz7.js +152 -0
  24. package/dist/version-B6AiiGvT.js +26 -0
  25. package/dist/version-CeffgdfZ.js +3 -0
  26. package/dist/vite/index.d.ts +14 -0
  27. package/dist/vite/index.js +7 -0
  28. package/env.d.ts +59 -0
  29. package/package.json +106 -0
  30. package/skills/apply-comments/SKILL.md +86 -0
  31. package/skills/create-page/SKILL.md +92 -0
  32. package/skills/create-theme/SKILL.md +223 -0
  33. package/skills/current-page/SKILL.md +106 -0
  34. package/skills/page-authoring/SKILL.md +148 -0
  35. package/skills/page-authoring/references/assets-and-fonts.md +85 -0
  36. package/skills/page-authoring/references/html-pages.md +65 -0
  37. package/skills/page-authoring/references/interactivity.md +77 -0
  38. package/skills/page-authoring/references/layout-and-responsive.md +71 -0
  39. package/skills/page-authoring/references/typography-and-color.md +60 -0
  40. package/src/app/app.tsx +45 -0
  41. package/src/app/components/asset-view.tsx +1665 -0
  42. package/src/app/components/command/command-menu.tsx +227 -0
  43. package/src/app/components/command/command.tsx +142 -0
  44. package/src/app/components/command/home-command-menu.tsx +96 -0
  45. package/src/app/components/icon-tooltip.tsx +34 -0
  46. package/src/app/components/language-toggle.tsx +46 -0
  47. package/src/app/components/sidebar/folder-item.tsx +269 -0
  48. package/src/app/components/sidebar/icon-picker.tsx +61 -0
  49. package/src/app/components/sidebar/sidebar-footer.tsx +139 -0
  50. package/src/app/components/sidebar/sidebar.tsx +302 -0
  51. package/src/app/components/theme-toggle.tsx +66 -0
  52. package/src/app/components/themes/theme-detail.tsx +226 -0
  53. package/src/app/components/themes/themes-gallery.tsx +104 -0
  54. package/src/app/components/ui/badge.tsx +48 -0
  55. package/src/app/components/ui/button.tsx +93 -0
  56. package/src/app/components/ui/card.tsx +92 -0
  57. package/src/app/components/ui/context-menu.tsx +247 -0
  58. package/src/app/components/ui/dialog.tsx +155 -0
  59. package/src/app/components/ui/dropdown-menu.tsx +267 -0
  60. package/src/app/components/ui/input.tsx +25 -0
  61. package/src/app/components/ui/label.tsx +21 -0
  62. package/src/app/components/ui/popover.tsx +82 -0
  63. package/src/app/components/ui/progress.tsx +33 -0
  64. package/src/app/components/ui/scroll-area.tsx +53 -0
  65. package/src/app/components/ui/select.tsx +195 -0
  66. package/src/app/components/ui/separator.tsx +26 -0
  67. package/src/app/components/ui/slider.tsx +68 -0
  68. package/src/app/components/ui/sonner.tsx +48 -0
  69. package/src/app/components/ui/tabs.tsx +79 -0
  70. package/src/app/components/ui/textarea.tsx +22 -0
  71. package/src/app/components/ui/toggle-group.tsx +84 -0
  72. package/src/app/components/ui/toggle.tsx +45 -0
  73. package/src/app/components/ui/tooltip.tsx +75 -0
  74. package/src/app/favicon.ico +0 -0
  75. package/src/app/frame/inspect.ts +140 -0
  76. package/src/app/frame/main.tsx +91 -0
  77. package/src/app/frame.html +12 -0
  78. package/src/app/index.html +13 -0
  79. package/src/app/lib/asset-filter.test.ts +176 -0
  80. package/src/app/lib/asset-filter.ts +80 -0
  81. package/src/app/lib/assets.ts +257 -0
  82. package/src/app/lib/design.ts +58 -0
  83. package/src/app/lib/folders.ts +239 -0
  84. package/src/app/lib/frame.ts +38 -0
  85. package/src/app/lib/locale-store.ts +67 -0
  86. package/src/app/lib/page-thumb.tsx +46 -0
  87. package/src/app/lib/pages.ts +28 -0
  88. package/src/app/lib/sdk.ts +43 -0
  89. package/src/app/lib/themes.ts +22 -0
  90. package/src/app/lib/use-locale.ts +8 -0
  91. package/src/app/lib/use-page-module.ts +48 -0
  92. package/src/app/lib/use-page-titles.ts +29 -0
  93. package/src/app/lib/use-restart-server.ts +78 -0
  94. package/src/app/lib/utils.test.ts +25 -0
  95. package/src/app/lib/utils.ts +6 -0
  96. package/src/app/main.tsx +14 -0
  97. package/src/app/routes/assets.tsx +9 -0
  98. package/src/app/routes/home-shell.tsx +252 -0
  99. package/src/app/routes/home.tsx +846 -0
  100. package/src/app/routes/page.tsx +329 -0
  101. package/src/app/routes/themes.tsx +34 -0
  102. package/src/app/styles.css +405 -0
  103. package/src/app/virtual.d.ts +53 -0
  104. package/src/locale/en.ts +218 -0
  105. package/src/locale/format.ts +12 -0
  106. package/src/locale/index.ts +6 -0
  107. package/src/locale/ja.ts +221 -0
  108. package/src/locale/types.ts +215 -0
  109. package/src/locale/zh-cn.ts +218 -0
  110. package/src/locale/zh-tw.ts +218 -0
package/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yiwei Ho (open-slide)
4
+ Copyright (c) 2026 Autono Holdings Inc. (open-pdf modifications)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # @autono/open-pages
2
+
3
+ Runtime and CLI for [open-pages](https://openpages.sh) — the web page framework built for agents. Pages are React components (or plain HTML); the dev server previews them live in a real browser frame on every save, and `open-pages export` builds each one into a static folder you can deploy anywhere.
4
+
5
+ ## Install
6
+
7
+ Most workspaces get this installed by the scaffolder:
8
+
9
+ ```bash
10
+ npm create @autono/open-pages@latest my-pages
11
+ ```
12
+
13
+ Use this package directly only when wiring up an existing workspace by hand:
14
+
15
+ ```bash
16
+ pnpm add @autono/open-pages react react-dom
17
+ ```
18
+
19
+ ## What's inside
20
+
21
+ - **Dev server + workspace viewer** — a home page listing every page with live thumbnails, folders, search, and sort; a per-page viewer at `/p/<id>` with desktop / tablet (820px) / mobile (390px) viewport toggles, reload, and open-in-new-tab.
22
+ - **Inspect mode** — press `i`, click any element on the page to see its exact source line and leave a comment. Comments persist as `@page-comment` markers in the source, ready for a coding agent to apply.
23
+ - **Vite plugin** — discovers `pages/<id>/index.tsx` and `pages/<id>/index.html`, exposes pages via virtual modules, generates a Tailwind v4 stylesheet scoped to `pages/` and `themes/`, hot-reloads on add/remove/edit.
24
+ - **Export CLI** — builds each page into `export/<id>/index.html` plus hashed assets with relative URLs.
25
+ - **Agent skills** — file-based skills (`create-page`, `page-authoring`, `apply-comments`, `create-theme`, `current-page`) that sync into workspaces; no MCP server required.
26
+
27
+ ## CLI
28
+
29
+ Once installed, the `open-pages` bin is available in the workspace:
30
+
31
+ | Command | Description |
32
+ | --- | --- |
33
+ | `open-pages dev` | Start the dev server. Flags: `-p, --port <port>`, `--host [host]`, `--open`, `--no-skills-check`. |
34
+ | `open-pages build` | Build the workspace viewer as a static site, pages included. Flags: `--out-dir <dir>` (defaults to `dist`). |
35
+ | `open-pages preview` | Preview the production build. Flags: `-p, --port <port>`, `--host [host]`, `--open`. |
36
+ | `open-pages export [pages...]` | Build pages into self-contained static folders, one per page. Flags: `--out-dir <dir>` (defaults to `export`). |
37
+ | `open-pages sync:skills` | Sync built-in agent skills into this workspace. Flags: `--dry-run`. |
38
+ | `open-pages update` | Update `@autono/open-pages` to the latest version and sync skills. Flags: `--force`, `--no-skills`. |
39
+
40
+ ## Authoring
41
+
42
+ A page is one folder under `pages/` with an `index.tsx` that default-exports a React component. Style with Tailwind via `className`; it is a real web page, so hooks, state, and browser APIs all work.
43
+
44
+ ```tsx
45
+ import type { PageMeta } from '@autono/open-pages';
46
+
47
+ export const meta: PageMeta = {
48
+ title: 'Hello, open-pages',
49
+ createdAt: '2026-08-28T00:00:00.000Z',
50
+ };
51
+
52
+ export default function Page() {
53
+ return (
54
+ <main className="mx-auto max-w-2xl px-6 py-24">
55
+ <h1 className="text-5xl font-bold tracking-tight">Hello, open-pages</h1>
56
+ <p className="mt-4 text-lg text-slate-600">This is a real web page.</p>
57
+ </main>
58
+ );
59
+ }
60
+ ```
61
+
62
+ A folder holding an `index.html` instead is served as-is (with its sibling CSS and JS) and exported the same way.
63
+
64
+ ## Exports
65
+
66
+ ```ts
67
+ import {
68
+ type PageComponent,
69
+ type PageKind, // 'react' | 'html'
70
+ type PageMeta,
71
+ type PageModule,
72
+ type OpenPagesConfig,
73
+ type DesignSystem,
74
+ defaultDesign,
75
+ designToCssVars,
76
+ cssVarsToString,
77
+ } from '@autono/open-pages';
78
+ ```
79
+
80
+ The Vite plugin is exposed under a subpath for advanced setups:
81
+
82
+ ```ts
83
+ import { createViteConfig } from '@autono/open-pages/vite';
84
+ ```
85
+
86
+ ## Config
87
+
88
+ Create `open-pages.config.ts` in the workspace root (all fields optional):
89
+
90
+ ```ts
91
+ import type { OpenPagesConfig } from '@autono/open-pages';
92
+
93
+ const openPagesConfig: OpenPagesConfig = {
94
+ pagesDir: 'pages',
95
+ port: 5173,
96
+ base: '/', // set to '/my-pages/' to host the built site under a subpath
97
+ };
98
+
99
+ export default openPagesConfig;
100
+ ```
101
+
102
+ ## Docs
103
+
104
+ Full documentation: [docs.openpages.sh](https://docs.openpages.sh)
105
+
106
+ ## License
107
+
108
+ MIT
package/bin.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './dist/cli/bin.js';
@@ -0,0 +1,35 @@
1
+ import "./design-C13iz9_4.js";
2
+ import { findPages, loadUserConfig } from "./open-pages-plugin-D_DN_zjh.js";
3
+ import { createViteConfig } from "./config-L0IbktJ0.js";
4
+ import "./update-package-Cxt57pz7.js";
5
+ import { readCoreVersion } from "./version-B6AiiGvT.js";
6
+ import { buildPage } from "./export-ic28osQP.js";
7
+ import path from "node:path";
8
+ import { build as build$1, mergeConfig } from "vite";
9
+
10
+ //#region src/cli/build.ts
11
+ async function build(opts = {}) {
12
+ const userCwd = process.cwd();
13
+ const config = await loadUserConfig(userCwd);
14
+ const outDir = path.resolve(userCwd, opts.outDir ?? "dist");
15
+ const base = await createViteConfig({
16
+ userCwd,
17
+ config,
18
+ mode: "build"
19
+ });
20
+ await build$1(mergeConfig(base, { build: { outDir } }));
21
+ const htmlPages = (await findPages(userCwd, config.pagesDir ?? "pages")).filter((e) => e.kind === "html");
22
+ const coreVersion = readCoreVersion();
23
+ const siteBase = config.base ?? "/";
24
+ for (const entry of htmlPages) await buildPage({
25
+ userCwd,
26
+ config,
27
+ coreVersion,
28
+ entry,
29
+ outDir: path.join(outDir, "__page", entry.id),
30
+ base: `${siteBase.replace(/\/$/, "")}/__page/${entry.id}/`
31
+ });
32
+ }
33
+
34
+ //#endregion
35
+ export { build };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ import { detectSkillsDrift, syncSkills } from "../sync-Be_hxSOF.js";
3
+ import chalk from "chalk";
4
+ import { readFile } from "node:fs/promises";
5
+ import path from "node:path";
6
+ import * as readline from "node:readline/promises";
7
+ import { fileURLToPath } from "node:url";
8
+ import { Command, Option } from "commander";
9
+
10
+ //#region src/cli/run.ts
11
+ async function readVersion() {
12
+ const here = path.dirname(fileURLToPath(import.meta.url));
13
+ const pkgPath = path.resolve(here, "..", "..", "package.json");
14
+ const raw = await readFile(pkgPath, "utf8");
15
+ return JSON.parse(raw).version;
16
+ }
17
+ function parsePort(value) {
18
+ const n = Number(value);
19
+ if (!Number.isInteger(n) || n < 0 || n > 65535) throw new Error(`Invalid port: ${value}`);
20
+ return n;
21
+ }
22
+ async function runSkillsDriftCheck(skillsDir) {
23
+ if (process.env.OPEN_PAGES_SKIP_SKILLS_CHECK === "1") return;
24
+ let drift;
25
+ try {
26
+ drift = await detectSkillsDrift(skillsDir);
27
+ } catch {
28
+ return;
29
+ }
30
+ const stale = drift.filter((d) => d.status !== "unchanged");
31
+ if (stale.length === 0) return;
32
+ const names = stale.map((d) => d.name).join(", ");
33
+ const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
34
+ if (!interactive) {
35
+ process.stderr.write(`${chalk.yellow("!")} Skills out of date (${names}). Run \`open-pages sync:skills\` to update.\n`);
36
+ return;
37
+ }
38
+ const rl = readline.createInterface({
39
+ input: process.stdin,
40
+ output: process.stdout
41
+ });
42
+ try {
43
+ const answer = (await rl.question(`${chalk.yellow("!")} Skills out of date: ${chalk.bold(names)}. Sync now? ${chalk.dim("(Y/n) ")}`)).trim().toLowerCase();
44
+ if (answer === "" || answer === "y" || answer === "yes") await syncSkills(skillsDir);
45
+ else process.stdout.write(chalk.dim("Skipped. Run `open-pages sync:skills` later to update.\n"));
46
+ } finally {
47
+ rl.close();
48
+ }
49
+ }
50
+ function resolveBuiltinSkillsDir() {
51
+ const here = path.dirname(fileURLToPath(import.meta.url));
52
+ return path.resolve(here, "..", "..", "skills");
53
+ }
54
+ async function run(argv) {
55
+ const version = await readVersion();
56
+ const program = new Command();
57
+ program.name("open-pages").description("Author web pages — we handle the Vite/React stack.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-pages --help` for usage)"));
58
+ program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
59
+ if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
60
+ const { dev } = await import("../dev-I2IyEh5W.js");
61
+ await dev(flags);
62
+ });
63
+ program.command("build").description("Build the workspace as a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
64
+ const { build } = await import("../build-TP72kiw7.js");
65
+ await build(flags);
66
+ });
67
+ program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
68
+ const { preview } = await import("../preview-BrDuvgAN.js");
69
+ await preview(flags);
70
+ });
71
+ program.command("export").description("Build pages into self-contained static folders (one per page)").argument("[pages...]", "page ids to export (default: all)").option("--out-dir <dir>", "output directory (defaults to `export`)").action(async (pages, flags) => {
72
+ const { exportPages } = await import("../export-B-kBRWB1.js");
73
+ await exportPages({
74
+ pages,
75
+ outDir: flags.outDir
76
+ });
77
+ });
78
+ program.command("sync:skills").description("Sync built-in skills from @autono/open-pages into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
79
+ const { syncSkills: syncSkills$1 } = await import("../sync-lKEXyPOh.js");
80
+ await syncSkills$1(resolveBuiltinSkillsDir(), flags);
81
+ });
82
+ program.command("update").description("Update @autono/open-pages to the latest version and sync skills").option("--force", "reinstall even if already on the latest version").option("--no-skills", "skip the skills sync after updating").action(async (flags) => {
83
+ const { update } = await import("../update-CV62NhBT.js");
84
+ await update({
85
+ current: version,
86
+ ...flags
87
+ });
88
+ });
89
+ await program.parseAsync(argv, { from: "user" });
90
+ }
91
+
92
+ //#endregion
93
+ //#region src/cli/bin.ts
94
+ run(process.argv.slice(2)).catch((err) => {
95
+ const message = err instanceof Error ? err.message : String(err);
96
+ process.stderr.write(`${chalk.red("error:")} ${message}\n`);
97
+ process.exit(1);
98
+ });
99
+
100
+ //#endregion
@@ -0,0 +1,23 @@
1
+ import { Locale } from "./types-C5NCdDT-.js";
2
+
3
+ //#region src/config.d.ts
4
+ type OpenPagesBuildConfig = {
5
+ showPageBrowser?: boolean;
6
+ showPageUi?: boolean;
7
+ };
8
+ type OpenPagesConfig = {
9
+ base?: string;
10
+ pagesDir?: string;
11
+ themesDir?: string;
12
+ assetsDir?: string;
13
+ port?: number;
14
+ allowedHosts?: string[] | true;
15
+ /**
16
+ * @deprecated Pick the UI language from the language switcher in the page UI
17
+ * instead. When set, this only seeds the initial language until the user
18
+ * chooses one (their choice is then remembered locally).
19
+ */
20
+ locale?: Locale;
21
+ build?: OpenPagesBuildConfig;
22
+ }; //#endregion
23
+ export { OpenPagesConfig };