markform 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.
package/README.md CHANGED
@@ -1,76 +1,248 @@
1
1
  # Markform
2
2
 
3
- Agent-friendly, human-readable, editable forms stored as `.form.md` files.
3
+ Agent-friendly, human-readable forms stored as `.form.md` files.
4
4
 
5
- Markform enables AI agents to fill out forms using structured patches, while keeping the
6
- form source in human-readable Markdown.
5
+ Markform enables AI agents to fill out structured forms using patches, while keeping the
6
+ form source in human-readable Markdown with [Markdoc](https://markdoc.dev/) tags.
7
7
 
8
- ## Documentation
8
+ ## Installation
9
9
 
10
- - [Development Guide](docs/development.md) - Getting started, workflows, and AI SDK
11
- integration
10
+ ```bash
11
+ npm install markform
12
+ # or
13
+ pnpm add markform
14
+ ```
12
15
 
13
- - [Publishing](docs/publishing.md) - Release workflow and npm publishing
16
+ Requires Node.js 24+.
14
17
 
15
- - [Architecture Design](docs/project/architecture/current/arch-markform-initial-design.md)
16
- \- Technical specification
18
+ ## Quick Start
17
19
 
18
- ## Project Structure
20
+ The fastest way to try Markform is the interactive `examples` command:
21
+
22
+ ```bash
23
+ # Try it without installing (uses npx)
24
+ npx markform examples
19
25
 
26
+ # Or after installing globally
27
+ npm install -g markform
28
+ markform examples
20
29
  ```
21
- packages/markform/ # Main package
22
- src/engine/ # Core: parsing, validation, serialization
23
- src/cli/ # CLI commands (inspect, export, serve, fill)
24
- src/harness/ # Execution harness for agents
25
- src/integrations/ # AI SDK tools
26
- examples/ # Example forms
30
+
31
+ This walks you through:
32
+
33
+ 1. Selecting an example form (simple, political research, earnings analysis)
34
+
35
+ 2. Filling in user fields interactively
36
+
37
+ 3. Optionally running an AI agent to complete remaining fields
38
+
39
+ ## CLI Commands
40
+
41
+ ### Explore Examples
42
+
43
+ ```bash
44
+ # Interactive: select an example, fill it, optionally run agent
45
+ markform examples
46
+
47
+ # List available examples
48
+ markform examples --list
49
+
50
+ # Start with a specific example
51
+ markform examples --name political-research
27
52
  ```
28
53
 
29
- ## Quick Start
54
+ ### Inspect Forms
55
+
56
+ ```bash
57
+ # View form structure, progress, and validation issues
58
+ markform inspect my-form.form.md
59
+
60
+ # Output as JSON
61
+ markform inspect my-form.form.md --format=json
62
+ ```
63
+
64
+ ### Fill Forms
65
+
66
+ ```bash
67
+ # Interactive mode: fill user-role fields via prompts
68
+ markform fill my-form.form.md --interactive
69
+
70
+ # Agent mode: use an LLM to fill agent-role fields
71
+ markform fill my-form.form.md --model=anthropic/claude-sonnet-4-5
72
+
73
+ # Mock agent for testing (uses pre-filled form as source)
74
+ markform fill my-form.form.md --mock --mock-source filled.form.md
75
+ ```
76
+
77
+ ### Export and Transform
30
78
 
31
79
  ```bash
32
- # Install dependencies
33
- pnpm install
80
+ # Export as readable markdown (strips Markdoc tags)
81
+ markform export my-form.form.md --format=markdown
82
+
83
+ # Export values as JSON
84
+ markform export my-form.form.md --format=json
85
+
86
+ # Export values as YAML
87
+ markform export my-form.form.md --format=yaml
88
+
89
+ # Dump just the current values
90
+ markform dump my-form.form.md
91
+ ```
34
92
 
35
- # Build
36
- pnpm build
93
+ ### Apply Patches
37
94
 
38
- # Run tests
39
- pnpm test
95
+ ```bash
96
+ # Apply a JSON patch to update field values
97
+ markform apply my-form.form.md --patch '[{"op":"set","fieldId":"name","value":"Alice"}]'
98
+ ```
40
99
 
41
- # CLI usage (use pnpm markform in development)
42
- pnpm markform inspect packages/markform/examples/simple/simple.form.md
43
- pnpm markform export packages/markform/examples/simple/simple.form.md --format=json
44
- pnpm markform serve packages/markform/examples/simple/simple.form.md
100
+ ### Web Interface
45
101
 
46
- # Fill a form with live agent (requires API key for chosen provider)
47
- pnpm markform fill packages/markform/examples/simple/simple.form.md \
48
- --agent=live --model=openai/gpt-5.2
102
+ ```bash
103
+ # Serve a form as a web page for browsing
104
+ markform serve my-form.form.md
105
+ ```
49
106
 
50
- # Fill a form with mock agent (for testing)
51
- pnpm markform fill packages/markform/examples/simple/simple.form.md \
52
- --agent=mock \
53
- --mock-source packages/markform/examples/simple/simple-mock-filled.form.md
107
+ ### List Models
54
108
 
55
- # See available providers and models
56
- pnpm markform fill --help
109
+ ```bash
110
+ # See supported AI providers and example models
111
+ markform models
57
112
  ```
58
113
 
59
- ## Supported Providers
114
+ ### View Documentation
115
+
116
+ ```bash
117
+ # Display this README with terminal formatting
118
+ markform instructions
119
+
120
+ # Output raw markdown (for piping)
121
+ markform instructions --raw
122
+ ```
123
+
124
+ ## Supported AI Providers
60
125
 
61
126
  | Provider | Env Variable | Example Models |
62
127
  | --- | --- | --- |
63
- | openai | `OPENAI_API_KEY` | gpt-5.2, gpt-5-mini, gpt-5.2-pro |
64
- | google | `GOOGLE_API_KEY` | gemini-2.5-pro, gemini-2.0-flash |
65
- | anthropic | `ANTHROPIC_API_KEY` | claude-sonnet-4-5, claude-haiku-4-5 |
128
+ | openai | `OPENAI_API_KEY` | gpt-5-mini, gpt-5.1, gpt-5.2 |
129
+ | anthropic | `ANTHROPIC_API_KEY` | claude-sonnet-4-5, claude-opus-4-5 |
130
+ | google | `GOOGLE_API_KEY` | gemini-2.5-pro, gemini-2.5-flash |
66
131
  | xai | `XAI_API_KEY` | grok-4, grok-4-fast |
67
132
  | deepseek | `DEEPSEEK_API_KEY` | deepseek-chat, deepseek-reasoner |
68
133
 
69
- ## Example Form
134
+ Set the appropriate environment variable for your provider before running `markform fill`.
135
+ See [`src/settings.ts`](src/settings.ts) for the full list of models.
136
+
137
+ ## Programmatic Usage
138
+
139
+ Markform exports a parsing engine and AI SDK integration for use in your own
140
+ applications.
141
+
142
+ ### Basic Parsing
143
+
144
+ ```typescript
145
+ import { parseForm, serializeForm } from "markform";
146
+
147
+ // Parse a .form.md file
148
+ const form = parseForm(markdownContent);
149
+
150
+ // Access schema and values
151
+ console.log(form.schema.title);
152
+ console.log(form.values);
153
+
154
+ // Serialize back to markdown
155
+ const output = serializeForm(form);
156
+ ```
157
+
158
+ ### AI SDK Integration
159
+
160
+ Markform provides tools compatible with the [Vercel AI SDK](https://sdk.vercel.ai/):
161
+
162
+ ```typescript
163
+ import { parseForm } from "markform";
164
+ import { createMarkformTools, MarkformSessionStore } from "markform/ai-sdk";
165
+ import { generateText } from "ai";
166
+ import { anthropic } from "@ai-sdk/anthropic";
167
+
168
+ const form = parseForm(markdownContent);
169
+ const store = new MarkformSessionStore(form);
170
+ const tools = createMarkformTools({ sessionStore: store });
171
+
172
+ const result = await generateText({
173
+ model: anthropic("claude-sonnet-4-5-20250929"),
174
+ prompt: "Fill out this form with appropriate values...",
175
+ tools,
176
+ maxSteps: 10,
177
+ });
178
+ ```
179
+
180
+ **Available tools:**
181
+
182
+ | Tool | Description |
183
+ | --- | --- |
184
+ | `markform_inspect` | Get current form state, issues, progress |
185
+ | `markform_apply` | Apply patches to update field values |
186
+ | `markform_export` | Export schema and values as JSON |
187
+ | `markform_get_markdown` | Get canonical Markdown representation |
188
+
189
+ ## Form Structure
190
+
191
+ A `.form.md` file combines YAML frontmatter with Markdoc-tagged content:
192
+
193
+ ```markdown
194
+ ---
195
+ markform:
196
+ markform_version: "0.1.0"
197
+ roles:
198
+ - user
199
+ - agent
200
+ role_instructions:
201
+ user: "Fill in your details."
202
+ agent: "Complete the analysis fields."
203
+ ---
204
+
205
+ {% form id="my_form" title="My Form" %}
206
+
207
+ {% field-group id="basics" title="Basic Info" %}
208
+
209
+ {% string-field id="name" label="Name" role="user" required=true %}{% /string-field %}
210
+
211
+ {% number-field id="score" label="Score" role="agent" min=0 max=100 %}{% /number-field %}
212
+
213
+ {% /field-group %}
214
+
215
+ {% /form %}
216
+ ```
217
+
218
+ **Key concepts:**
219
+
220
+ - **Roles**: Define who fills what (`user` for humans, `agent` for AI)
221
+
222
+ - **Field types**: `string-field`, `number-field`, `string-list`, `single-select`,
223
+ `multi-select`, `checkboxes`
224
+
225
+ - **Validation**: `required`, `min/max`, `minLength/maxLength`, `pattern`
226
+
227
+ - **Structure**: Fields organized in `field-group` containers
228
+
229
+ ## Example Forms
230
+
231
+ The package includes example forms in the `examples/` directory:
232
+
233
+ - `simple/simple.form.md` - Basic form demonstrating all field types
234
+
235
+ - `political-research/political-research.form.md` - Biographical research form
236
+
237
+ - `earnings-analysis/earnings-analysis.form.md` - Financial analysis form
238
+
239
+ View them with `markform examples --list` or try them interactively with `markform
240
+ examples`.
241
+
242
+ ## Contributing
70
243
 
71
- See
72
- [`packages/markform/examples/simple/simple.form.md`](packages/markform/examples/simple/simple.form.md)
73
- for a working example.
244
+ For development and contributing, see the
245
+ [GitHub repository](https://github.com/jlevy/markform).
74
246
 
75
247
  ## License
76
248
 
package/dist/ai-sdk.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { A as FieldValue, H as InspectResult, L as Id, N as FormSchema, dt as Patch, ft as PatchSchema, mn as ValidatorRegistry, t as ApplyResult, ut as ParsedForm } from "./coreTypes-T7dAuewt.mjs";
3
+ import { A as FieldValue, H as InspectResult, L as Id, N as FormSchema, dt as Patch, ft as PatchSchema, gn as ValidatorRegistry, t as ApplyResult, ut as ParsedForm } from "./coreTypes--6etkcwb.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/integrations/toolTypes.d.ts
package/dist/ai-sdk.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as PatchSchema, r as inspect, t as applyPatches, u as serialize } from "./apply-C0vjijlP.mjs";
1
+ import { et as PatchSchema, r as inspect, t as applyPatches, u as serialize } from "./apply-BQdd-fdx.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/integrations/ai-sdk.ts