pubuilder 0.3.0 → 0.5.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/README.md CHANGED
@@ -33,7 +33,7 @@ npx pubuilder scan # scan app/ or pages/ routes and draft ia.config.t
33
33
  npx pubuilder scan --dry-run # preview without writing
34
34
  ```
35
35
 
36
- - First run drafts the config — you only polish titles and replace `[param]` segments with sample paths (e.g. `/artflo/1`).
36
+ - First run drafts the config — you only polish titles and replace `[param]` segments with sample paths (e.g. `/agents/1`).
37
37
  - Re-running **merges**: your hand-tuned titles, hierarchy, and variants are preserved; only new routes are added. Routes that disappeared are reported, never deleted.
38
38
  - Keep `ia.config.ts` a pure data file (it is actually loaded during scan).
39
39
  - Non-Next.js projects aren't scannable yet (v1) — the CLI generates an annotated template to start from instead.
@@ -42,7 +42,7 @@ npx pubuilder scan --dry-run # preview without writing
42
42
 
43
43
  ```ts
44
44
  // ia.config.ts
45
- import { defineIA } from 'pubuilder'
45
+ import { defineIA } from 'pubuilder/config'
46
46
 
47
47
  export default defineIA({
48
48
  pages: [
@@ -57,7 +57,7 @@ export default defineIA({
57
57
  // screens that differ by query string become child nodes
58
58
  variants: [
59
59
  { title: 'All', query: { category: 'all' } },
60
- { title: 'Art', query: { category: 'art', tab: 1 } },
60
+ { title: 'Coding', query: { category: 'coding', tab: 1 } },
61
61
  ],
62
62
  },
63
63
  { path: 'https://example.com/brand', title: 'Brand', external: true },
@@ -72,6 +72,29 @@ export default defineIA({
72
72
  - `external` — link-out node, no thumbnail/inspection (auto-detected for `http(s)://`)
73
73
  - `viewport` — virtual viewport for thumbnails, default `1440x900`
74
74
 
75
+ ## AI publishing
76
+
77
+ Select a block in the minimap, paste a Figma node URL, and a local `claude` CLI process publishes it for you.
78
+
79
+ - Runs via **your own** Claude account (`claude login`) — pubuilder never stores an API key
80
+ - Skill drawer (🧰) to store your Figma token (shared across projects, saved under your home dir) and toggle/upload the skills the agent uses
81
+ - SSE log streams progress; HMR reflects the result immediately
82
+ - Agent runs with `acceptEdits` + a tool allowlist (`Read`, `Glob`, `Grep`, `Edit`, `Write`, a restricted `Bash`) — no arbitrary command execution
83
+
84
+ **Quick start**
85
+
86
+ ```bash
87
+ pnpm add -D pubuilder
88
+ ```
89
+
90
+ ```json
91
+ { "scripts": { "dev": "pubuilder dev -- next dev" } }
92
+ ```
93
+
94
+ Or run `npx pubuilder serve` in a separate terminal alongside your existing dev script. Requires the [`claude` CLI](https://docs.claude.com/en/docs/claude-code) installed and logged in.
95
+
96
+ Adds a `.pubuilder/` directory at your project root (cache, settings, uploaded skills) — add it to `.gitignore`.
97
+
75
98
  ## Requirements
76
99
 
77
100
  - React ≥ 18, same-origin pages (live thumbnails are iframes)
package/dist/api.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ import type { BlockSelection } from './types';
2
+ export declare const DEFAULT_SERVER_URL = "http://localhost:4816";
3
+ export interface SkillInfo {
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ source: 'project' | 'global' | 'uploaded';
8
+ enabled: boolean;
9
+ }
10
+ export interface AgentEvent {
11
+ type: 'log' | 'tool' | 'error' | 'done';
12
+ text: string;
13
+ }
14
+ export interface TokenStatus {
15
+ configured: boolean;
16
+ masked: string | null;
17
+ }
18
+ /** 서버 에러 응답의 code(server/errors.ts 계약)를 UI 분기용으로 실어 나르는 에러 */
19
+ export declare class ApiError extends Error {
20
+ readonly code?: string | undefined;
21
+ constructor(message: string, code?: string | undefined);
22
+ }
23
+ export declare class PubuilderApi {
24
+ private readonly baseUrl;
25
+ constructor(baseUrl?: string);
26
+ private request;
27
+ isAlive(): Promise<boolean>;
28
+ listSkills(): Promise<SkillInfo[]>;
29
+ toggleSkill(id: string, enabled: boolean): Promise<void>;
30
+ uploadSkill(filename: string, content: string): Promise<SkillInfo>;
31
+ removeSkill(id: string): Promise<void>;
32
+ tokenStatus(): Promise<TokenStatus>;
33
+ saveToken(token: string): Promise<void>;
34
+ deleteToken(): Promise<void>;
35
+ startPublish(payload: {
36
+ selection: BlockSelection;
37
+ outerHTML: string;
38
+ figmaUrl: string;
39
+ }): Promise<{
40
+ jobId: string;
41
+ }>;
42
+ cancelPublish(jobId: string): Promise<void>;
43
+ /** SSE 구독 — 반환값 호출로 해제 */
44
+ subscribePublish(jobId: string, onEvent: (e: AgentEvent) => void): () => void;
45
+ }
46
+ /** PageMap이 provider로 감싸고, SkillDrawer/PublishPanel이 useContext로 획득 */
47
+ export declare const PubuilderServerContext: import("react").Context<PubuilderApi>;