refira-cli 0.1.0 → 0.1.1

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 (2) hide show
  1. package/README.md +153 -0
  2. package/package.json +6 -7
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ # Refira CLI
2
+
3
+ A command-line tool and deterministic AI Agent Harness for designing and previewing standalone HTML5 and Tailwind CSS prototypes in Refira workspaces.
4
+
5
+ Refira CLI enables autonomous coding agents (such as Google Antigravity, Claude Code, Cursor Agent, and Aider) and developers to interact directly with the Refira canvas, fetch design tokens, scaffold clean templates, and validate markup before publishing.
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ Refira is an AI design workspace that maintains persistent design context and renders prototypes inside sandboxed iframes. Refira CLI serves two purposes:
12
+ 1. **Developer & Agent CLI:** Manage sessions, pull design tokens, and push live page markup.
13
+ 2. **Deterministic Agent Harness:** Automatically lint markup with `htmlparser2` to enforce design consistency and prevent broken prototype states before code reaches the backend.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ Run directly using NPX without installation:
20
+ ```bash
21
+ npx refira-cli --help
22
+ ```
23
+
24
+ Or install globally on your system:
25
+ ```bash
26
+ npm install --global refira-cli
27
+ ```
28
+
29
+ Verify installation:
30
+ ```bash
31
+ refira --version
32
+ ```
33
+
34
+ ---
35
+
36
+ ## Command Reference
37
+
38
+ ### 1. Authentication
39
+
40
+ #### `refira auth login`
41
+ Authenticates against a Refira instance and stores credentials locally in `.refirarc` (or globally in `~/.refirarc`).
42
+
43
+ ```bash
44
+ refira auth login --api-url https://api.refira.dev --api-key rfr_your_api_key
45
+ ```
46
+
47
+ Options:
48
+ - `--api-url <url>`: Refira backend API endpoint (default: `http://localhost:3001`).
49
+ - `--api-key <key>`: Project-scoped API key with `rfr_` prefix.
50
+ - `-g, --global`: Save credentials globally in user home directory.
51
+
52
+ #### `refira auth status`
53
+ Verifies the current session and displays project and user identifiers.
54
+
55
+ ```bash
56
+ refira auth status
57
+ ```
58
+
59
+ ---
60
+
61
+ ### 2. Workspace Initialization
62
+
63
+ #### `refira init`
64
+ Connects to the project API, downloads design tokens, and deterministically generates operational guidelines for AI coding agents:
65
+ - `AGENTS.md`: Operational instructions for Antigravity, Codex, Gemini CLI, and other agents.
66
+ - `.cursorrules`: Rule definitions for Cursor.
67
+ - `.agents/skills/refira/SKILL.md`: Design craftsmanship skill focusing on high-aesthetic UI execution.
68
+
69
+ ```bash
70
+ refira init --project-id <project-uuid>
71
+ ```
72
+
73
+ ---
74
+
75
+ ### 3. Design Context & Tokens
76
+
77
+ #### `refira context`
78
+ Displays project design tokens (primary typography font, palette colors) and the existing page roster.
79
+
80
+ ```bash
81
+ refira context
82
+ ```
83
+
84
+ ---
85
+
86
+ ### 4. Page Scaffolding
87
+
88
+ #### `refira scaffold`
89
+ Generates a standalone HTML5 starter template pre-configured with:
90
+ - Google Fonts specified in project design tokens.
91
+ - Tailwind CSS CDN and theme extensions.
92
+ - Lucide Icons script.
93
+ - Body content slot marking where agent layout markup should be placed.
94
+
95
+ ```bash
96
+ refira scaffold --page checkout
97
+ ```
98
+
99
+ Options:
100
+ - `--page <slug>`: Required page slug (e.g., `checkout`, `dashboard`, `landing`).
101
+ - `--output <path>`: Custom destination file path (default: `<slug>.html`).
102
+
103
+ ---
104
+
105
+ ### 5. Live Preview & Harness Validation
106
+
107
+ #### `refira preview`
108
+ Inspects an HTML markup file using the Refira Agent Harness. If violations are detected, execution halts with Exit Code 1 and actionable remediation instructions. If valid, the markup is streamed directly to the Refira Canvas.
109
+
110
+ ```bash
111
+ refira preview checkout.html --page checkout
112
+ ```
113
+
114
+ Arguments:
115
+ - `<file>`: Path to the HTML file to inspect and preview.
116
+
117
+ Options:
118
+ - `--page <slug>`: Target page slug.
119
+
120
+ ---
121
+
122
+ ### 6. Agent Skill Installation
123
+
124
+ #### `refira skill install`
125
+ Installs the Refira design craftsmanship guide (`SKILL.md`) for AI agents.
126
+
127
+ ```bash
128
+ # Local project installation (.agents/skills/refira/SKILL.md)
129
+ refira skill install
130
+
131
+ # Global installation (~/.agents/skills/refira/SKILL.md)
132
+ refira skill install --global
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Agent Harness Invariants
138
+
139
+ All markup submitted via `refira preview` must conform to these strict architectural rules:
140
+
141
+ | Rule | Status | Description |
142
+ |---|---|---|
143
+ | **Standalone HTML5 + Tailwind** | Required | Markup must be valid native HTML5 with Tailwind CSS utility classes. |
144
+ | **No UI Frameworks** | Prohibited | React, Vue, Svelte, Angular, Solid, and JSX syntax (`className=`, `onClick={...}`, `<Component />`) are rejected. |
145
+ | **No External / Inter-Page Navigation** | Prohibited | Prototypes run inside sandboxed iframes. Anchors (`<a href="...">`) pointing to external URLs or relative pages (e.g. `/checkout`) are rejected. Only in-page anchors (`href="#section"`) or placeholders (`href="#"`) are allowed. |
146
+ | **No Raw Emojis in Markup** | Prohibited | Raw unicode emojis (e.g. rocket, fire, sparkles) in HTML text nodes or attributes are rejected to maintain professional aesthetic quality. Use Lucide Icons or Heroicons SVG elements instead. |
147
+ | **Graphics & Animation Libraries** | Permitted | Standalone CDN scripts such as Three.js, GSAP, Spline Viewer, and Lucide Icons are explicitly allowed in document `<head>` or `<script>`. |
148
+
149
+ ---
150
+
151
+ ## License
152
+
153
+ MIT License. Distributed as part of the Refira workspace ecosystem.
package/package.json CHANGED
@@ -1,26 +1,25 @@
1
1
  {
2
2
  "name": "refira-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Refira CLI tool and AI Agent Harness for deterministic prototype generation",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "refira": "./dist/index.js"
8
8
  },
9
9
  "main": "./dist/index.js",
10
- "files": ["dist"],
10
+ "files": ["dist", "README.md"],
11
11
  "scripts": {
12
12
  "build": "bun build src/index.ts --outfile dist/index.js --target node",
13
13
  "prepublishOnly": "bun run build",
14
14
  "test": "vitest run",
15
15
  "type-check": "tsc --noEmit"
16
16
  },
17
- "dependencies": {
18
- "@refira/shared": "workspace:*",
19
- "commander": "^12.1.0",
20
- "htmlparser2": "^9.1.0"
21
- },
17
+ "dependencies": {},
22
18
  "devDependencies": {
19
+ "@refira/shared": "workspace:*",
23
20
  "@types/node": "^20.14.0",
21
+ "commander": "^12.1.0",
22
+ "htmlparser2": "^9.1.0",
24
23
  "typescript": "^5.5.4",
25
24
  "vitest": "^2.0.5"
26
25
  }