@pactor-app/skill 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.
- package/LICENSE +21 -0
- package/README.md +19 -0
- package/SKILL.md +252 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pactor Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @pactor-app/skill
|
|
2
|
+
|
|
3
|
+
Agent skill for rapidly building [Pactor](https://github.com/426-330/pactor) Server-Driven UI applications.
|
|
4
|
+
|
|
5
|
+
## Contents
|
|
6
|
+
|
|
7
|
+
- `SKILL.md` — The skill definition consumed by AI agents.
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
This package centralizes framework guidance so that any AI agent can assist users in bootstrapping Pactor apps, authoring custom components, wiring events, theming, and integrating routes/resources/permissions without scattering knowledge across README files.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Copy or symlink `SKILL.md` into your agent's skill directory. The file uses standard YAML frontmatter (`name`, `description`, `version`) followed by markdown guidance.
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
|
|
19
|
+
MIT
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pactor
|
|
3
|
+
description: |
|
|
4
|
+
Agent skill for rapidly building Pactor Server-Driven UI applications. Covers app bootstrapping, DSL authoring, custom components, theming, events, routing, resources, permissions, and project commands.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pactor-app
|
|
9
|
+
|
|
10
|
+
## When to activate
|
|
11
|
+
|
|
12
|
+
Activate this skill when the user works with **Pactor** or any `pactor-*` package:
|
|
13
|
+
|
|
14
|
+
- Building or extending a Pactor application
|
|
15
|
+
- Using `createPactorApplication`, `@pactor-app/app`, or `StaticDslLoader`
|
|
16
|
+
- Writing YAML/JSON DSL pages, components, events, or actions
|
|
17
|
+
- Creating or registering custom components / actions / services
|
|
18
|
+
- Switching or customizing UI kits (shadcn / custom registries)
|
|
19
|
+
- Configuring themes, skins, layouts, or menus
|
|
20
|
+
- Integrating data sources, routers, resources, or permissions
|
|
21
|
+
- Handling form linkage, event linkage, or action orchestration
|
|
22
|
+
- Using `@pactor-app/vite-plugin` or `@pactor-app/cli`
|
|
23
|
+
- Mentioning packages: `@pactor-app/core`, `@pactor-app/runtime`, `@pactor-app/app`, `@pactor-app/ui`, `@pactor-app/router`, `@pactor-app/resource`, `@pactor-app/permission`, `@pactor-app/expression`, `@pactor-app/schema`, `@pactor-app/chat`, `@pactor-app/markdown`
|
|
24
|
+
|
|
25
|
+
## What you can do with this skill
|
|
26
|
+
|
|
27
|
+
- Explain Pactor architecture, package boundaries, and dependency rules
|
|
28
|
+
- Guide a user from zero to a running Server-Driven UI app
|
|
29
|
+
- Register custom components, actions, services, and capabilities
|
|
30
|
+
- Design data flow, expressions, events, and action orchestration
|
|
31
|
+
- Configure themes/skins, layouts, routing, resources, and permissions
|
|
32
|
+
- Provide exact commands and example project pointers
|
|
33
|
+
|
|
34
|
+
## Framework in one sentence
|
|
35
|
+
|
|
36
|
+
**Pactor — Dynamic Application Runtime**: an enterprise-oriented **Server-Driven UI + AI-Native frontend runtime** where pages are YAML/JSON DSL rendered by a shared browser Runtime. Business projects install the framework via npm; ordinary pages do not need to be rebuilt or rebundled.
|
|
37
|
+
|
|
38
|
+
## Package map
|
|
39
|
+
|
|
40
|
+
| Directory | Package | What it provides |
|
|
41
|
+
|-----------|---------|------------------|
|
|
42
|
+
| `packages/core` | `@pactor-app/core` | DSL protocol types, AST, Registry interfaces |
|
|
43
|
+
| `packages/schema` | `@pactor-app/schema` | JSON Schema, TS types, validation rules |
|
|
44
|
+
| `packages/expression` | `@pactor-app/expression` | Controlled expression engine (no eval) |
|
|
45
|
+
| `packages/runtime` | `@pactor-app/runtime` | Renderer, RuntimeContext, State, DataSource, Action, Page Runtime |
|
|
46
|
+
| `packages/resource` | `@pactor-app/resource` | DSL loaders (HTTP / static), cache, versioning |
|
|
47
|
+
| `packages/router` | `@pactor-app/router` | Dynamic routing, Path Matcher, menu registry |
|
|
48
|
+
| `packages/permission` | `@pactor-app/permission` | Page/menu/component/action guards |
|
|
49
|
+
| `packages/ui` | `@pactor-app/ui` | shadcn UI kit — the single built-in kit (`shadcnUiKit` + prebuilt stylesheet + contracts/interaction core) |
|
|
50
|
+
| `packages/markdown` | `@pactor-app/markdown` | Markdown + DSL Part rendering |
|
|
51
|
+
| `packages/chat` | `@pactor-app/chat` | AI conversation, streaming, capabilities |
|
|
52
|
+
| `packages/vite-plugin` | `@pactor-app/vite-plugin` | Vite YAML modules, build-time validation, HMR |
|
|
53
|
+
| `packages/cli` | `@pactor-app/cli` | DSL validation, inspection, scaffolding |
|
|
54
|
+
| `packages/app` | `@pactor-app/app` | One-stop composition (`createPactorApplication`) |
|
|
55
|
+
|
|
56
|
+
## Dependency rules
|
|
57
|
+
|
|
58
|
+
Dependencies are strictly one-way:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
core ← schema ← expression ← runtime
|
|
62
|
+
↓
|
|
63
|
+
{permission, resource, router, ui} ← app
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Business apps depend only on `@pactor-app/app` + `@pactor-app/ui` (the single built-in shadcn UI kit), or install the `pactor-app` meta package to get every module at once.
|
|
67
|
+
- Never import implementation details from sibling packages.
|
|
68
|
+
- Renderer logic must resolve components via Registry, not `if (type === 'X')` branches.
|
|
69
|
+
|
|
70
|
+
## Quick start
|
|
71
|
+
|
|
72
|
+
### Install
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# shadcn UI kit (the single built-in kit)
|
|
76
|
+
pnpm add @pactor-app/app @pactor-app/ui
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Bootstrap with API loader
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { createPactorApplication } from '@pactor-app/app';
|
|
83
|
+
import '@pactor-app/ui/styles.css'; // required
|
|
84
|
+
|
|
85
|
+
createPactorApplication({
|
|
86
|
+
appId: 'my-app',
|
|
87
|
+
api: { baseURL: '/api/runtime' },
|
|
88
|
+
}).mount('#root');
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Server must provide the Envelope endpoints:
|
|
92
|
+
|
|
93
|
+
- `{baseURL}/bootstrap` — app, user, permissions, menus, layout
|
|
94
|
+
- `{baseURL}/pages/{id}` — page DSL
|
|
95
|
+
|
|
96
|
+
### Bootstrap locally with StaticDslLoader
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { createPactorApplication } from '@pactor-app/app';
|
|
100
|
+
import { StaticDslLoader } from '@pactor-app/resource';
|
|
101
|
+
import '@pactor-app/ui/styles.css';
|
|
102
|
+
import homePage from './pages/home.page.yaml';
|
|
103
|
+
|
|
104
|
+
const loader = new StaticDslLoader({
|
|
105
|
+
bootstrap: {
|
|
106
|
+
app: { name: 'My App' },
|
|
107
|
+
menus: [{ id: 'home', type: 'page', title: 'Home', path: '/', pageId: 'home' }],
|
|
108
|
+
layout: { type: 'admin' },
|
|
109
|
+
},
|
|
110
|
+
pages: { home: homePage },
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
createPactorApplication({ appId: 'my-app', loader }).mount('#root');
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For YAML imports add `@pactor-app/vite-plugin` to `vite.config.ts` and declare `*.page.yaml` modules.
|
|
117
|
+
|
|
118
|
+
## Workflow: custom component
|
|
119
|
+
|
|
120
|
+
1. Write a React component in the business project
|
|
121
|
+
2. Register via `components` option or `app.registerComponent`
|
|
122
|
+
3. Reference in DSL by `type`
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { createPactorApplication } from '@pactor-app/app';
|
|
126
|
+
import { RiskScore } from './components/RiskScore';
|
|
127
|
+
|
|
128
|
+
createPactorApplication({
|
|
129
|
+
appId: 'risk-admin',
|
|
130
|
+
api: { baseURL: '/api/runtime' },
|
|
131
|
+
components: { RiskScore },
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
body:
|
|
137
|
+
type: RiskScore
|
|
138
|
+
props:
|
|
139
|
+
score: "${row.riskScore}"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Custom components receive RuntimeContext (state, data, permissions, routing, services, actions).
|
|
143
|
+
|
|
144
|
+
## Workflow: theming and skins
|
|
145
|
+
|
|
146
|
+
- The built-in UI kit is shadcn (`@pactor-app/ui`); theming = overriding its CSS variable tokens (`--primary` / `--muted` / ...), dark via `data-pactor-theme="dark"`
|
|
147
|
+
- Layout and theme config usually come from bootstrap
|
|
148
|
+
- For business skin settings, see `examples/admin` (`skin.ts` / `SkinSettings`)
|
|
149
|
+
- Use `providers` and `headerExtra` slots in `@pactor-app/app` to inject global providers and settings entry
|
|
150
|
+
|
|
151
|
+
## Workflow: events and data flow
|
|
152
|
+
|
|
153
|
+
Expressions access runtime scopes:
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
text: "${state.user.name}"
|
|
157
|
+
visible: "${state.status == 'ACTIVE'}"
|
|
158
|
+
disabled: "${!permission('customer:edit')}"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Scope chain:
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
global → app → page → overlay → form → component → row → event
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Action orchestration:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
events:
|
|
171
|
+
onSubmit:
|
|
172
|
+
- action: setState
|
|
173
|
+
params: { keyword: "${event.keyword}" }
|
|
174
|
+
- action: reload
|
|
175
|
+
params: { dataSource: todos }
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Standard actions: `request`, `reload`, `setState`, `resetState`, `navigate`, `message`, `confirm`, `validate`, `submit`, `open`, `close`, `download`, `upload`, `sequence`, `parallel`, `if`, etc. Business can register custom actions.
|
|
179
|
+
|
|
180
|
+
## Workflow: routing, resources, permissions
|
|
181
|
+
|
|
182
|
+
- **Routing** (`@pactor-app/router`): dynamic routes from bootstrap `menus`, supports Path Matcher, params, hidden routes
|
|
183
|
+
- **Resources** (`@pactor-app/resource`): loads page/fragment DSL with HttpDslResourceLoader or StaticDslLoader, cache, versioning
|
|
184
|
+
- **Permissions** (`@pactor-app/permission`): page/menu/component/action guards. Frontend permissions only control UI; backend APIs must still authorize
|
|
185
|
+
|
|
186
|
+
Bootstrap orchestration:
|
|
187
|
+
|
|
188
|
+
```text
|
|
189
|
+
load bootstrap → write PermissionStore → build MenuRegistry → resolve layout → assemble shared registries → render page
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Common commands
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# install dependencies
|
|
196
|
+
pnpm install
|
|
197
|
+
|
|
198
|
+
# build all packages (ESM + CJS + d.ts)
|
|
199
|
+
pnpm build
|
|
200
|
+
|
|
201
|
+
# run all tests
|
|
202
|
+
pnpm test
|
|
203
|
+
|
|
204
|
+
# TypeScript check
|
|
205
|
+
pnpm typecheck
|
|
206
|
+
|
|
207
|
+
# start docs site
|
|
208
|
+
pnpm docs:dev
|
|
209
|
+
|
|
210
|
+
# examples
|
|
211
|
+
pnpm --filter example-vite-starter dev # minimal starter
|
|
212
|
+
pnpm --filter example-admin dev # shadcn admin dashboard (skin settings)
|
|
213
|
+
pnpm --filter example-chat dev # AI chat example
|
|
214
|
+
|
|
215
|
+
# @pactor-app/cli
|
|
216
|
+
pnpm pactor validate src/pages/**/*.page.yaml
|
|
217
|
+
pnpm pactor inspect src/pages/home.page.yaml
|
|
218
|
+
pnpm pactor create my-app
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
> Examples reference workspace `dist` outputs. After changing package code, run `pnpm build` before examples pick up changes.
|
|
222
|
+
|
|
223
|
+
## Design principles
|
|
224
|
+
|
|
225
|
+
1. **DSL is a protocol**, not just a config file: it describes app, page, state, data sources, components, events, actions, and lifecycle
|
|
226
|
+
2. **Dynamic DSL, static capabilities**: the server can deliver pages/menus/permissions, but components, actions, services, and capabilities must be defined by the frontend Runtime registries. Never inject arbitrary JavaScript through DSL
|
|
227
|
+
3. **Runtime is the core**: DSL → Parser/Validator → Runtime Context → expression/permission/data-source → Component Registry → React Renderer
|
|
228
|
+
4. **Allow React escape hatch**: 70%–80% ordinary pages use pure DSL; complex pages can be written directly in React
|
|
229
|
+
5. **Frontend permissions only control UI**: hiding menus, buttons, or intercepting actions does not replace backend authorization
|
|
230
|
+
6. **No eval in expressions**: use a controlled AST; disallow access to `window`, `document`, `localStorage`, `fetch`, `eval`, and other globals
|
|
231
|
+
|
|
232
|
+
## Common pitfalls
|
|
233
|
+
|
|
234
|
+
- **Do not** import UI kit internals directly into business DSL pages; use registered component names.
|
|
235
|
+
- **Do not** write `if (type === 'Button')` branches in a Renderer; use `ComponentRegistry`.
|
|
236
|
+
- **Do not** inject JavaScript from the server into DSL; register actions/services/capabilities in the frontend.
|
|
237
|
+
- **Do not** rely on frontend permission checks for security; enforce authorization on backend APIs.
|
|
238
|
+
- **Do not** forget to import `@pactor-app/ui/styles.css` when using the default shadcn kit.
|
|
239
|
+
|
|
240
|
+
## References
|
|
241
|
+
|
|
242
|
+
- Framework design specification: `docs/src/content/docs/framework-design.md`
|
|
243
|
+
- Quick start: `docs/src/content/docs/guides/getting-started.md`
|
|
244
|
+
- @pactor-app/app docs: `docs/src/content/docs/packages/app.md`
|
|
245
|
+
- Example projects:
|
|
246
|
+
- `examples/vite-starter` — minimal starter
|
|
247
|
+
- `examples/admin` — shadcn admin dashboard with skin settings
|
|
248
|
+
- `examples/chat` — AI chat
|
|
249
|
+
|
|
250
|
+
## How to use this skill
|
|
251
|
+
|
|
252
|
+
This skill is maintained as `packages/skill/SKILL.md`. AI agents can copy or link this file into their skill directory to provide contextual guidance when reading or editing Pactor projects.
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pactor-app/skill",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent skill for rapidly building pactor Server-Driven UI applications",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pactor",
|
|
7
|
+
"dsl",
|
|
8
|
+
"server-driven-ui",
|
|
9
|
+
"skill",
|
|
10
|
+
"agent"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/426-330/pactor.git",
|
|
16
|
+
"directory": "packages/skill"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/426-330/pactor/tree/main/packages/skill",
|
|
19
|
+
"bugs": "https://github.com/426-330/pactor/issues",
|
|
20
|
+
"type": "module",
|
|
21
|
+
"files": [
|
|
22
|
+
"SKILL.md",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {}
|
|
29
|
+
}
|