Skip to content

Commit c57289f

Browse files
committed
chore: initial commit — Movit kinematic motion protocol
Mermaid-style .movit DSL that renders to an animated 3D figure. Monorepo: parser, renderer, share codec, MCP server, language service, LSP, VS Code extension, plus the playground + landing.
0 parents  commit c57289f

84 files changed

Lines changed: 12312 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.0.1",
3+
"configurations": [
4+
{
5+
"name": "playground",
6+
"runtimeExecutable": "npm",
7+
"runtimeArgs": ["run", "dev", "-w", "playground"],
8+
"port": 5173
9+
}
10+
]
11+
}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
dist/
3+
coverage/
4+
*.tsbuildinfo
5+
.DS_Store
6+
.vite/
7+
.vercel

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Movit
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.

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<h1 align="center">◆ Movit</h1>
2+
3+
<p align="center"><b>Kinematic motion as text.</b> Mermaid gave LLMs a way to draw diagrams.<br/>
4+
Movit gives them a way to <i>show movement</i> — exercises, physiotherapy, posture —<br/>
5+
as a tiny human-readable language that renders to an animated 3D figure in the browser.</p>
6+
7+
---
8+
9+
## Why
10+
11+
Ask an LLM to explain a push-up and it can only give you prose or a flat image.
12+
The model *knows* the biomechanics ("elbows flex, shoulders abduct on the
13+
descent") — it just has no syntax to express it that a renderer can read.
14+
Diffusion-based text-to-motion models exist, but they're heavy, expensive, and
15+
give you no fine control over the anatomical phases.
16+
17+
Movit takes the opposite, lightweight approach (see [the research](#background)):
18+
19+
- The LLM writes a small **`.movit`** document — semantic phases, not 3D matrices.
20+
- A **client-side** parser + Three.js renderer animates it. Generation is a
21+
fraction of a cent of text; rendering runs at 60fps on a phone.
22+
- Every angle is **hard-clamped to a healthy range of motion**, so a model
23+
hallucinating "knee flex 200°" can't produce an anatomically impossible joint.
24+
25+
```movit
26+
movit exercise "Body-weight squat"
27+
rig humanoid
28+
pose start = standing
29+
30+
step "Descend" 1.6s ease-in-out:
31+
hips: flex 80
32+
knees: flex 95
33+
ankles: dorsiflex 14
34+
ground-lock: feet
35+
cue "Sit the hips back, chest proud, knees track over the toes"
36+
37+
step "Drive up" 1.2s ease-out:
38+
hips: flex 0
39+
knees: flex 0
40+
ankles: dorsiflex 0
41+
ground-lock: feet
42+
cue "Drive through the heels to stand tall"
43+
44+
repeat 8
45+
```
46+
47+
## Try it
48+
49+
```bash
50+
npm install
51+
npm run dev # opens the playground (Vite) at http://localhost:5173
52+
npm test # parser + renderer test suites
53+
```
54+
55+
In the playground: pick an example, watch it animate, edit the text live, and
56+
hit **Copy LLM prompt** to get a system prompt that teaches ChatGPT/Claude to
57+
write Movit for you.
58+
59+
## Packages
60+
61+
| Package | What it does |
62+
| --- | --- |
63+
| [`movit-parser`](packages/movit-parser) | `.movit` text → validated, ROM-clamped IR. Pure TypeScript, framework-agnostic. |
64+
| [`movit-render`](packages/movit-render) | IR → animated low-poly mannequin (Three.js), forward kinematics + ground-lock CCD IK. |
65+
| [`movit-share`](packages/movit-share) | Encode a `.movit` doc to a URL-safe token so a movement travels as a link. Pure, dependency-free. |
66+
| [`movit-mcp`](packages/movit-mcp) | MCP server: lets an LLM agent author, ROM-validate, and get a render link for a movement — natively. |
67+
| [`playground`](playground) | Live editor + 3D viewport + warnings + the LLM prompt + shareable links. |
68+
69+
The protocol and both libraries are **MIT-licensed** — the open core. See
70+
[`spec/SPEC.md`](spec/SPEC.md) for the full language and
71+
[`spec/llm-authoring.md`](spec/llm-authoring.md) for the authoring prompt.
72+
73+
## Scope (v0.1)
74+
75+
✅ Single-person fitness, stretching & posture · Mermaid-style DSL · ROM safety
76+
clamping · forward kinematics · ground-lock IK · live playground.
77+
78+
⏳ Deferred: reach-IK, two-person / partner movements + collision detection,
79+
FBX/GLB export, hosted SaaS editor and the expert-verified motion marketplace.
80+
81+
## Background
82+
83+
This project follows a design study, *"Kinematic Motion Definition Protocols for
84+
Large Language Models"*, which argues for a semantic DSL over diffusion models,
85+
specifies ROM-based safety constraints from clinical normative data, and lays
86+
out the open-core commercialization path. The spec cross-references its
87+
sections (§4 DSL, §5 biomechanics, §6 client rendering, §7 strategy).
88+
89+
> ⚠️ Movit's range-of-motion values are general literature data, not medical
90+
> advice. Consult a qualified professional for physiotherapy or exercise
91+
> prescription.

VERCEL_AGENTS.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Vercel Plugin — AI Agent Instructions
2+
3+
> Drop this file into any GitHub repo. AI coding agents (Claude Code, Codex, Cursor, Copilot, Grok Build) will pick it up automatically.
4+
5+
## Setup (one-time per machine)
6+
7+
```bash
8+
npx plugins add vercel/vercel-plugin
9+
```
10+
11+
Requires Node.js 18+ and Bun. After install, session context is injected automatically for Vercel/Next.js projects.
12+
13+
## Slash commands
14+
15+
| Command | Purpose |
16+
|---|---|
17+
| `/vercel-plugin:bootstrap` | Link project, provision env vars, set up DB |
18+
| `/vercel-plugin:deploy` | Deploy preview; pass `prod` for production |
19+
| `/vercel-plugin:env` | List, pull, add, remove, diff env vars |
20+
| `/vercel-plugin:status` | Recent deployments and environment overview |
21+
| `/vercel-plugin:marketplace` | Discover and install Marketplace integrations |
22+
23+
## Key skills (invoke on demand)
24+
25+
- `nextjs` — App Router, Server Components, Server Actions, rendering strategies
26+
- `ai-sdk` — AI SDK v6: streaming, tool calling, agents, MCP, embeddings
27+
- `ai-gateway` — Unified API to 100+ models with failover and cost tracking
28+
- `vercel-functions` — Serverless, Edge, Fluid Compute, streaming, Cron Jobs
29+
- `vercel-storage` — Blob, Edge Config, Neon Postgres, Upstash Redis
30+
- `deployments-cicd` — Deploy, promote, rollback, `--prebuilt`, CI config
31+
- `env-vars``.env` files, `vercel env`, OIDC tokens
32+
- `routing-middleware` — Rewrites, redirects, personalization (Node.js/Edge/Bun)
33+
- `runtime-cache` — Per-region KV cache with tag-based invalidation
34+
- `shadcn` — shadcn/ui CLI, components, theming, Tailwind integration
35+
- `workflow` — Durable execution, DurableAgent, steps, pause/resume
36+
- `vercel-sandbox` — Ephemeral VMs for running untrusted/AI-generated code
37+
- `verification` — Browser, API, data, and response flow verification
38+
39+
## Specialist agents
40+
41+
- `deployment-expert` — CI/CD, deploy strategies, environment variables, rollbacks
42+
- `performance-optimizer` — Core Web Vitals, caching, rendering, asset optimization
43+
- `ai-architect` — AI app design, model selection, streaming, MCP integration
44+
45+
## Platform defaults to assume
46+
47+
- Framework: Next.js App Router
48+
- Compute: Fluid Compute (not legacy Edge Functions)
49+
- Node.js: 24 LTS (18 is deprecated)
50+
- Function timeout: 300s default
51+
- AI SDK: v6 with `"provider/model"` strings via AI Gateway
52+
- Config: `vercel.ts` preferred over `vercel.json`
53+
- Databases: Via Vercel Marketplace (Vercel Postgres/KV are retired)
54+
55+
## Telemetry
56+
57+
```bash
58+
export VERCEL_PLUGIN_TELEMETRY=off # disable
59+
export VERCEL_PLUGIN_LOG_LEVEL=debug # enable debug logs
60+
```
61+
62+
```bash
63+
npx vercel-plugin doctor # validate plugin health
64+
```
65+
66+
## Issues
67+
68+
File bugs at <https://github.com/vercel/vercel-plugin/issues> with debug logs enabled.

editors/vscode/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Movit for VS Code
2+
3+
Language support for the **Movit** (`.movit`) kinematic motion DSL:
4+
5+
- **Syntax highlighting** (TextMate grammar) — keywords, kinds, joints, actions, easings, strings, numbers.
6+
- **Diagnostics** — parse errors and **range-of-motion safety clamps** as you type (e.g. `knees: flex 200° → clamped to 144°`).
7+
- **Completion** — context-aware: kinds after `movit`, joints at line start, actions after `<joint>:`, easings in a `step` header, poses after `pose start =`, effectors after `ground-lock:`.
8+
- **Hover** — the safe ROM range for a joint + action, and short docs for keywords.
9+
10+
The smart features are provided by [`movit-lsp`](../../packages/movit-lsp), which shares its language logic ([`movit-language`](../../packages/movit-language)) with the web playground — so the editor and the playground always agree.
11+
12+
## Develop / run locally
13+
14+
From the repo root:
15+
16+
```bash
17+
npm install
18+
npm run build -w movit-vscode # compiles the client + bundles the LSP to dist/server.cjs
19+
```
20+
21+
Then open this folder in VS Code and press **F5** ("Run Extension") to launch an Extension Development Host, and open any `.movit` file.
22+
23+
## Package
24+
25+
```bash
26+
npx @vscode/vsce package # produces movit-vscode-0.1.0.vsix
27+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"comments": {
3+
"lineComment": "#"
4+
},
5+
"brackets": [["[", "]"]],
6+
"autoClosingPairs": [
7+
{ "open": "\"", "close": "\"" },
8+
{ "open": "[", "close": "]" }
9+
],
10+
"surroundingPairs": [["\"", "\""]]
11+
}

editors/vscode/package.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "movit-vscode",
3+
"private": true,
4+
"displayName": "Movit",
5+
"description": "Language support for the Movit (.movit) kinematic motion DSL — syntax highlighting, range-of-motion diagnostics, completion, and hover.",
6+
"version": "0.1.0",
7+
"license": "MIT",
8+
"engines": {
9+
"vscode": "^1.85.0"
10+
},
11+
"categories": ["Programming Languages"],
12+
"activationEvents": ["onLanguage:movit"],
13+
"main": "./dist/extension.js",
14+
"contributes": {
15+
"languages": [
16+
{
17+
"id": "movit",
18+
"aliases": ["Movit", "movit"],
19+
"extensions": [".movit"],
20+
"configuration": "./language-configuration.json"
21+
}
22+
],
23+
"grammars": [
24+
{
25+
"language": "movit",
26+
"scopeName": "source.movit",
27+
"path": "./syntaxes/movit.tmLanguage.json"
28+
}
29+
]
30+
},
31+
"scripts": {
32+
"compile": "tsc -p ./",
33+
"bundle-server": "esbuild ../../packages/movit-lsp/src/server.ts --bundle --platform=node --format=cjs --outfile=dist/server.cjs",
34+
"build": "npm run compile && npm run bundle-server"
35+
},
36+
"dependencies": {
37+
"vscode-languageclient": "^9.0.1"
38+
},
39+
"devDependencies": {
40+
"@types/node": "^22.10.2",
41+
"@types/vscode": "^1.85.0",
42+
"esbuild": "^0.24.2",
43+
"typescript": "^5.7.2"
44+
}
45+
}

editors/vscode/src/extension.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Movit VS Code extension entry point.
3+
*
4+
* Syntax highlighting comes from the bundled TextMate grammar; everything
5+
* smarter (range-of-motion diagnostics, completion, hover) comes from the
6+
* Movit language server, which this client launches over stdio. The server is
7+
* bundled to `dist/server.cjs` by `npm run build` so it runs with plain node.
8+
*/
9+
10+
import * as path from "node:path";
11+
import { type ExtensionContext } from "vscode";
12+
import {
13+
LanguageClient,
14+
type LanguageClientOptions,
15+
type ServerOptions,
16+
TransportKind,
17+
} from "vscode-languageclient/node";
18+
19+
let client: LanguageClient | undefined;
20+
21+
export function activate(context: ExtensionContext): void {
22+
const serverModule = context.asAbsolutePath(path.join("dist", "server.cjs"));
23+
const serverOptions: ServerOptions = {
24+
run: { module: serverModule, transport: TransportKind.stdio },
25+
debug: { module: serverModule, transport: TransportKind.stdio },
26+
};
27+
const clientOptions: LanguageClientOptions = {
28+
documentSelector: [{ scheme: "file", language: "movit" }],
29+
};
30+
31+
client = new LanguageClient(
32+
"movit",
33+
"Movit Language Server",
34+
serverOptions,
35+
clientOptions,
36+
);
37+
void client.start();
38+
}
39+
40+
export function deactivate(): Thenable<void> | undefined {
41+
return client?.stop();
42+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "Movit",
4+
"scopeName": "source.movit",
5+
"patterns": [
6+
{ "include": "#comments" },
7+
{ "include": "#strings" },
8+
{ "include": "#keywords" },
9+
{ "include": "#kinds" },
10+
{ "include": "#actions" },
11+
{ "include": "#joints" },
12+
{ "include": "#constants" },
13+
{ "include": "#numbers" }
14+
],
15+
"repository": {
16+
"comments": {
17+
"patterns": [
18+
{ "name": "comment.line.number-sign.movit", "match": "#.*$" },
19+
{ "name": "comment.line.double-slash.movit", "match": "//.*$" }
20+
]
21+
},
22+
"strings": {
23+
"name": "string.quoted.double.movit",
24+
"begin": "\"",
25+
"end": "\"",
26+
"patterns": [
27+
{ "name": "constant.character.escape.movit", "match": "\\\\." }
28+
]
29+
},
30+
"keywords": {
31+
"name": "keyword.control.movit",
32+
"match": "\\b(movit|rig|pose|start|step|repeat|ground-lock|cue|hold)\\b"
33+
},
34+
"kinds": {
35+
"name": "storage.type.movit",
36+
"match": "\\b(exercise|stretch|posture)\\b"
37+
},
38+
"actions": {
39+
"name": "keyword.operator.movit",
40+
"match": "\\b(flex|extend|abduct|adduct|rotate-in|rotate-out|supinate|pronate|dorsiflex|plantarflex)\\b"
41+
},
42+
"joints": {
43+
"name": "variable.other.movit",
44+
"match": "\\b(shoulders|elbows|wrists|hips|knees|ankles|pelvis|spine|chest|neck|head|shoulder_left|shoulder_right|elbow_left|elbow_right|wrist_left|wrist_right|hip_left|hip_right|knee_left|knee_right|ankle_left|ankle_right)\\b"
45+
},
46+
"constants": {
47+
"name": "constant.language.movit",
48+
"match": "\\b(ease-in-out|ease-in|ease-out|linear|neutral|standing|plank|hands|feet|humanoid)\\b"
49+
},
50+
"numbers": {
51+
"name": "constant.numeric.movit",
52+
"match": "\\b[0-9]+(\\.[0-9]+)?s?\\b"
53+
}
54+
}
55+
}

0 commit comments

Comments
 (0)