### Launch the Appling IDE Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Starts the local IDE and opens it in the browser at http://127.0.0.1:4410. Use --port to change the port. ```sh npx @appling/ide models ``` -------------------------------- ### Start the IDE with examples folder Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Runs the IDE on the 'examples' folder, printing the local URL for browser access. ```sh npx @appling/ide examples ``` -------------------------------- ### node packages/ide/out/server/main.js examples Source: https://github.com/alex20465/appling/blob/main/CLAUDE.md Start the IDE on http://127.0.0.1:4410. Ask the user to start it. ```sh node packages/ide/out/server/main.js examples ``` -------------------------------- ### IDE startup output Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Example output when starting the IDE on the examples folder, showing the local address. ```text Appling IDE for /home/you/project/examples at http://127.0.0.1:4410 ``` -------------------------------- ### Verify Appling CLI installation Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Runs the appling command to confirm it works. Without a path, it checks every .appling file below the current folder. ```sh npx appling check ``` -------------------------------- ### implement_next_task (MCP prompt) Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md MCP prompt that carries the text of the registry skill, allowing clients to start the workflow without installing the skill. ```APIDOC ## implement_next_task (MCP prompt) ### Description MCP prompt that carries the text of the registry skill, allowing clients to start the workflow without installing the skill. ### Method Prompt call ### Endpoint `implement_next_task` ### Parameters None ### Response #### Success Response - The prompt text. #### Response Example ```text [Prompt text] ``` ``` -------------------------------- ### Development commands Source: https://github.com/alex20465/appling/blob/main/README.md Commands to install dependencies, build, test, check, and format examples during development. Requires Node.js 24 and pnpm (enable with corepack enable). ```sh pnpm install pnpm build # generates the parser, then compiles every package pnpm test # vitest over every package pnpm check examples # validates the sample models pnpm fmt examples # canonical formatting ``` -------------------------------- ### Build and install the Appling VS Code extension Source: https://github.com/alex20465/appling/blob/main/packages/vscode/README.md Run these commands in order to build the language server, bundle the extension, package the VSIX, and install it into VS Code. ```sh pnpm --filter @appling/lang build pnpm --filter appling-vscode build # bundles the extension and the language server into out/ pnpm --filter appling-vscode package # out/appling.vsix code --install-extension out/appling.vsix ``` -------------------------------- ### setup(context) Source: https://github.com/alex20465/appling/blob/main/docs/codegen/extensions.md Returns steps that run once before any node, such as creating the project. These steps appear under the node name `(project)`. ```APIDOC ## setup(context) ### Description Returns steps that run once before any node, such as creating the project. These steps appear under the node name `(project)`. ### Method Function call ### Endpoint setup?(context: MapContext): Step[] ### Parameters - **context** (MapContext) - Required - The mapping context. ### Returns - **Step[]** - Steps to run during setup. ``` -------------------------------- ### Complete example module Source: https://github.com/alex20465/appling/blob/main/docs/language/experience.md A complete module example showing all experience layer constructs together: enum, entity, actions, query, projection, use case, pages, navigation, flow, and messages. Demonstrates how pages reference projections and use cases, and never reference entities or interfaces. ```appling module sales { enum OrderStatus { draft placed } entity Order { reference: String unique status: OrderStatus state default draft total: Money } action PlaceOrder on Order { } action Cancel on Order { input { reason: String? } } query OpenOrders from Order { where { status == placed } } projection OrderSummary from Order { reference status total } usecase Checkout (order: Order) { step PlaceOrder(order) } page Orders route "/orders" { list OpenOrders as OrderSummary { reference, status, total } actions Cancel } page OrderDetail route "/orders/{id}" { detail OrderSummary actions PlaceOrder, Cancel form Cancel } page Pay route "/checkout" { form Checkout } navigation Main { "Orders" -> Orders { "Checkout" -> Pay } } flow CheckoutFlow for Checkout { Orders -> OrderDetail -> Pay } messages en { OrderSummary.total = "Total" } } ``` -------------------------------- ### Install, build, test, check, and format the monorepo Source: https://github.com/alex20465/appling/blob/main/docs/contributing/development.md Run these commands in order from a fresh clone. `pnpm build` runs `langium generate` and `tsc` in `@appling/lang`, `tsc` in other packages, Vite for the IDE client, and Astro for the landing site. `check` and `fmt` use the built CLI, so rebuild after source changes. ```sh pnpm install pnpm build # every package in dependency order pnpm test # vitest over packages/*/test pnpm check examples # validates the sample models with the built CLI pnpm fmt examples # canonical formatting ``` -------------------------------- ### Install Appling CLI as a development dependency Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Adds the @appling/cli package to your project's devDependencies. Requires Node.js 24 or later. ```sh npm install --save-dev @appling/cli ``` -------------------------------- ### Install and register MCP server for Claude Code Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Installs @appling/ai as a dev dependency and registers the MCP server with Claude Code using the appling-mcp command. ```sh npm install --save-dev @appling/ai claude mcp add appling -- npx appling-mcp . ``` -------------------------------- ### Install Django code generator extension Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Adds the @appling/codegen-django package as a dev dependency, required for Django code generation. ```sh npm install --save-dev @appling/codegen-django ``` -------------------------------- ### Run Appling CLI without installing Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/installation.md Executes the check command directly via npx, avoiding a permanent installation. ```sh npx @appling/cli check models ``` -------------------------------- ### Build and install Appling VS Code extension Source: https://github.com/alex20465/appling/blob/main/docs/tools/editors.md Build the language server and VS Code extension from the repository, then package and install the .vsix. The extension bundles the server and a TextMate grammar, so no global install is needed. Enable editor.formatOnSave for [appling] to keep files canonical. ```sh pnpm --filter @appling/lang build pnpm --filter appling-vscode build pnpm --filter appling-vscode package code --install-extension packages/vscode/out/appling.vsix ``` -------------------------------- ### tasks.json example Source: https://github.com/alex20465/appling/blob/main/docs/reference/configuration.md Example of the task registry written by `appling generate`. Contains extension name, test command, and entries with status, steps, files, missing tasks, attempts, and notes. ```json { "extension": "@appling/codegen-django", "test": ["uv", "run", "python", "manage.py", "test"], "entries": { "sales.Order.invariant[\"total never negative\"]": { "qn": "sales.Order.invariant[\"total never negative\"]", "kind": "Invariant", "layer": "domain", "status": "partial", "steps": [ "template: sales/tests.py", "task: write the test bodies of OrderTotalNeverNegativeTest in sales/tests.py" ], "files": ["sales/tests.py"], "missing": [ { "what": "write the test bodies of OrderTotalNeverNegativeTest in sales/tests.py", "context": { "props": { "label": "total never negative", "condition": "total >= 0" }, "related": [{ "qn": "sales.Order.total", "kind": "Field", "edge": "uses" }] } } ], "attempts": 1, "notes": ["the test for a negative total needs a way to create lines"] } } } ``` -------------------------------- ### Example check output Source: https://github.com/alex20465/appling/blob/main/packages/cli/README.md Shows the one-line-per-problem output format of the check command, including file, line, column, error level, and message. ```text models/sales.appling:13:23 error A machine must govern an entity field marked "state" with an enum type. 2 file(s), 1 error(s) ``` -------------------------------- ### Run the IDE with npx Source: https://github.com/alex20465/appling/blob/main/packages/ide/README.md Starts the local browser-based IDE for Appling models. Serves .appling files from the given folder on http://127.0.0.1:4410 and only answers pages it served itself. ```sh npx @appling/ide [folder] [--port 4410] ``` -------------------------------- ### Example simulate reach output Source: https://github.com/alex20465/appling/blob/main/packages/cli/README.md Shows the output of the simulate reach command, indicating reachability and the transitions taken. ```text $ appling simulate reach sales.OrderFlow paid models paid is reachable from draft: PlaceOrder -> placed PaymentReceived -> paid ``` -------------------------------- ### Install and run appling-language-server globally Source: https://github.com/alex20465/appling/blob/main/docs/tools/editors.md Installs the @appling/lang package globally and starts the language server over stdio. The server speaks the Language Server Protocol and provides diagnostics, navigation, and formatting for .appling files. ```sh npm install --global @appling/lang appling-language-server --stdio ``` -------------------------------- ### Configure appling MCP server in JSON MCP client Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md JSON configuration for MCP clients like Claude Desktop that start servers from a config. Uses npx -p so the package does not need to be installed. Use an absolute folder path because the client controls the working directory. ```json { "mcpServers": { "appling": { "command": "npx", "args": ["-p", "@appling/ai", "appling-mcp", "/path/to/your/project"] } } } ``` -------------------------------- ### appling generate --plan Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Prints the steps for every target without running anything; no prerequisites are checked and no folder is touched. Each line names the element (or '(project)' for setup steps) and the step. ```sh appling generate --plan ``` ```text @appling/codegen-django -> build/shop (project): command: uv init --bare --name shop (project): command: uv add django~=6.1.0 (project): command: uv run django-admin startproject config . crm: command: uv run python manage.py startapp crm crm: template: config/settings.py sales: command: uv run python manage.py startapp sales sales: template: config/settings.py crm.Account: template: crm/models.py sales.OrderStatus: template: sales/enums.py sales.Order: template: sales/models.py sales.Order.invariant["total never negative"]: template: sales/tests.py (project): command: uv run python manage.py makemigrations 12 element(s): 11 generated, 1 partial, 0 todo ``` -------------------------------- ### Install registry skill for Claude Code Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Copies the appling-registry skill into the project's skills folder so Claude Code can load it for requests about the task registry. Requires the MCP server to be set up next to the skills folder. ```sh mkdir -p .claude/skills cp -r node_modules/@appling/ai/skills/appling-registry .claude/skills/ ``` -------------------------------- ### Run appling-mcp server (stdio and HTTP) Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Start the appling-mcp server. Without options it uses stdio; with --http it serves Streamable HTTP on 127.0.0.1:/mcp. The folder argument is optional and defaults to the current folder. ```sh appling-mcp [folder] # stdio appling-mcp [folder] --http [port] # Streamable HTTP on http://127.0.0.1:/mcp ``` -------------------------------- ### Install @appling/ai package Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Install the @appling/ai package as a dev dependency to use the MCP server and related AI tools. ```sh npm install --save-dev @appling/ai ``` -------------------------------- ### Release JSON example Source: https://github.com/alex20465/appling/blob/main/docs/reference/configuration.md Example of .appling/releases/.json written by `appling release `. A release is never overwritten. Contains version, created timestamp, and the semantic graph without dependencies. ```json { "version": "1.0.0", "created": "2026-10-23T10:15:00.000Z", "graph": { "nodes": [ { "qn": "sales.Order", "kind": "Entity", "layer": "domain", "level": "medium", "module": "sales", "props": {}, "data": {} } ], "edges": [ { "from": "sales", "to": "sales.Order", "kind": "contains" } ] } } ``` -------------------------------- ### Run generated Ash project Source: https://github.com/alex20465/appling/blob/main/docs/codegen/ash.md Commands to set up and run the generated project. `mix ash.setup` creates the database and runs migrations (requires PostgreSQL matching repo config). `iex -S mix` starts the app; without pages, Bandit serves JSON:API at http://localhost:4000 (e.g., GET /orders). With pages, use `mix phx.server` instead. `mix test` is the command stored in the registry for AI tools. ```sh cd build/shop mix ash.setup iex -S mix mix test ``` -------------------------------- ### Appling sales module example Source: https://github.com/alex20465/appling/blob/main/docs/index.md A complete Appling model describing a sales module with an Order entity, status enum, action, and state machine. Shows the declarative syntax for defining entities, enums, actions, and transitions. ```appling module sales { export Order enum OrderStatus { draft placed } entity Order { reference: String unique status: OrderStatus state default draft } action PlaceOrder on Order { requires { reference != "" } } machine OrderFlow on Order.status { transition draft -> placed via PlaceOrder } } ``` -------------------------------- ### appling simulate example output Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Example invocations and their output for `reach`, `actors`, and `risks`. The `reach` example shows that `paid` is reachable from `draft` via `PlaceOrder` and `PaymentReceived`. The `actors` example reports `sales.Shopper: no`. The `risks` example reports no invariant reads a field the action changes. ```sh $ appling simulate reach sales.OrderFlow paid examples paid is reachable from draft: PlaceOrder -> placed PaymentReceived -> paid $ appling simulate actors sales.Cancel examples sales.Shopper: no $ appling simulate risks sales.PlaceOrder examples no invariant reads a field this action changes ``` -------------------------------- ### Example graph JSON output Source: https://github.com/alex20465/appling/blob/main/packages/cli/README.md Shows the JSON structure of the semantic graph output by the graph command, including nodes, edges, and dependencies. ```json { "nodes": [{ "qn": "sales.Order.status", "kind": "Field", "layer": "domain", "level": "in", "module": "sales", "props": { "type": "OrderStatus", "modifiers": ["state"], "default": "draft" } }], "edges": [{ "from": "sales.Order.status", "to": "sales.OrderStatus", "kind": "type" }], "dependencies": [{ "from": "sales", "to": "crm", "count": 1 }] } ``` -------------------------------- ### Complete Appling module example Source: https://github.com/alex20465/appling/blob/main/docs/language/application.md A complete Appling module example showing the language's core constructs: enums, entities, events, actions, queries, projections, external services, use cases, and actors. It defines a sales domain with order statuses, customer and order entities, a payment event, actions to place and cancel orders, an open orders query with sorting and pagination, a projection for order summaries, an external payment service, and a checkout use case with error handling and policies. ```appling module sales { enum OrderStatus { draft placed paid cancelled } entity Customer { name: String } entity Order { reference: String unique customer: Customer status: OrderStatus state default draft total: Money placed_at: DateTime? } event PaymentReceived { order: Order } action PlaceOrder on Order { } action Cancel on Order { input { reason: String? } } query OpenOrders from Order { where { status in [placed, paid] } sort placed_at desc paginate 50 } projection OrderSummary from OpenOrders { reference status total customer_name = customer.name } external Payments { op Charge (amount: Money) returns String errors Declined } usecase Checkout (order: Order) { step PlaceOrder(order) step Payments.Charge(order.total) on Declined do Cancel(order, "declined") await PaymentReceived timeout "24h" do Cancel(order) policy { actor.is(Shopper) } } actor human Shopper } ``` -------------------------------- ### appling generate examples Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Generates a draft project for every target in appling.config.json. Refuses to run when the out folder exists and is not empty; prints a summary like '12 element(s): 11 generated, 1 partial, 0 todo'. ```sh appling generate examples ``` -------------------------------- ### Project setup commands Source: https://github.com/alex20465/appling/blob/main/docs/codegen/ash.md Commands for setting up a new Ash project, including Phoenix and JSON:API options, and generating initial migrations. ```bash mix igniter.new --install ash,ash_postgres --yes --no-git ``` ```bash mix igniter.install ash_json_api,bandit --yes ``` ```bash mix ash.codegen initial_resources ``` -------------------------------- ### layout.json example Source: https://github.com/alex20465/appling/blob/main/docs/reference/configuration.md Example of .appling/layout.json holding the IDE's view state: card positions per zoom level and layers shown. Created when you move a card or change layers; never affects the model. ```json { "positions": { "medium": { "sales.Order": { "x": 0, "y": 6.67 }, "sales.OrderFlow": { "x": 17.14, "y": 167.2 } }, "in": { "sales.Order": { "x": 0, "y": 6.67 } } }, "layers": ["domain", "behavior"] } ``` -------------------------------- ### Preview codegen plan with appling generate --plan Source: https://github.com/alex20465/appling/blob/main/docs/codegen/overview.md Prints every step without running anything; does not check prerequisites or touch the output folder. The excerpt shows the plan for the example models with the Django target, ending with a count of registry entries by status. ```sh $ appling generate --plan examples @appling/codegen-django -> build/shop (project): command: uv init --bare --name shop (project): command: uv add django~=6.1.0 djangorestframework~=3.16 (project): command: uv run django-admin startproject config . (project): template: config/settings.py crm: command: uv run python manage.py startapp crm crm: template: config/settings.py sales: command: uv run python manage.py startapp sales sales: template: config/settings.py crm.Account: template: crm/models.py crm.Account.policy[read]: template: crm/tests.py sales.OrderStatus: template: sales/enums.py sales.Line: template: sales/values.py sales.Order: template: sales/models.py ... sales.PublicApi: template: sales/api.py sales.PublicApi: template: sales/urls.py sales.PublicApi: template: config/urls.py (project): command: uv run python manage.py makemigrations 70 element(s): 45 generated, 15 partial, 10 todo ``` -------------------------------- ### migrations.json example Source: https://github.com/alex20465/appling/blob/main/docs/reference/configuration.md Lists migration step ids already applied by `appling generate --migrate`. Steps listed here are never applied again, so do not reorder or remove steps in a block after migrating. ```json [ "sales.since_v1_0_0#0", "sales.since_v1_0_0#1" ] ``` -------------------------------- ### Appling language example module Source: https://github.com/alex20465/appling/blob/main/packages/lang/README.md Shows a complete Appling module with declarations across layers: enum, entity, action, machine, and projection. Demonstrates syntax for exports, state fields, policies, and transitions. ```appling module sales { export Order, OrderSummary enum OrderStatus { draft placed } entity Order { reference: String unique status: OrderStatus state default draft policy read { actor.is(Clerk) } } action PlaceOrder on Order { requires { reference != "" } else MissingReference errors MissingReference } machine OrderFlow on Order.status { transition draft -> placed via PlaceOrder } projection OrderSummary from Order { reference status } } ``` -------------------------------- ### startLanguageServer Source: https://github.com/alex20465/appling/blob/main/docs/reference/api.md Starts the language server for the Appling language using Langium's LSP infrastructure. It initializes the connection and file system services. ```APIDOC ## startLanguageServer ### Description Starts the language server for the Appling language using Langium's LSP infrastructure. It initializes the connection and file system services. ### Method startLanguageServer ### Parameters - `services` (object) - Required - The shared services object returned by `createApplingLspServices`. ### Request Example ```ts import { startLanguageServer } from 'langium/lsp'; import { NodeFileSystem } from 'langium/node'; import { createApplingLspServices } from '@appling/lang/lsp'; startLanguageServer(createApplingLspServices({ connection, ...NodeFileSystem }).shared); ``` ### Response No return value. ``` -------------------------------- ### pnpm install Source: https://github.com/alex20465/appling/blob/main/CLAUDE.md Install workspace dependencies using the pinned pnpm via corepack. A global pnpm 8 cannot install into this workspace. ```sh pnpm install ``` -------------------------------- ### Coverage report output Source: https://github.com/alex20465/appling/blob/main/docs/codegen/registry.md Example output printed by `appling generate` and `appling generate --plan`, showing the counts of generated, partial, and todo elements. ```text 70 element(s): 45 generated, 15 partial, 10 todo ``` -------------------------------- ### POST /api/chat Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Starts a chat turn and returns a stream of JSON lines. ```APIDOC ## POST /api/chat ### Description Starts a chat turn and returns a stream of JSON lines. ### Method POST ### Endpoint /api/chat ### Request Body - **message** (string) - Required - The user message - **history** (array) - Optional - Chat history ### Request Example { "message": "Hello", "history": [] } ### Response #### Success Response (200) - **stream** (stream) - A stream of JSON lines #### Response Example {"type":"token","content":"Hello"} {"type":"done"} ``` -------------------------------- ### GET /api/release Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Returns the version and date of the latest release, or `null` if no release is available. ```APIDOC ## GET /api/release ### Description Returns the version and date of the latest release, or `null` if no release is available. ### Method GET ### Endpoint /api/release ### Response #### Success Response (200) - **version** (string) - The version of the latest release - **date** (string) - The date of the latest release #### Response Example { "version": "1.0.0", "date": "2023-01-01" } ``` -------------------------------- ### Build and test a single package Source: https://github.com/alex20465/appling/blob/main/docs/contributing/development.md Use these commands when working on one package. `pnpm --filter @appling/lang build` regenerates the parser after a grammar change. `pnpm vitest run` targets a single test file or updates snapshots. The `node` commands run the built CLI and IDE server directly. ```sh pnpm --filter @appling/lang build # after a grammar change pnpm vitest run packages/lang/test/validation.test.ts -t "name" # one file, one test pnpm vitest run -u # update snapshots node packages/cli/out/main.js graph examples # the semantic graph as JSON node packages/ide/out/server/main.js examples # the IDE on http://127.0.0.1:4410 ``` -------------------------------- ### Start the Appling language server with Langium LSP Source: https://github.com/alex20465/appling/blob/main/docs/reference/api.md Initializes the Appling language server using Langium's LSP services and Node file system. Requires a connection object from the LSP client. ```TypeScript import { startLanguageServer } from 'langium/lsp'; import { NodeFileSystem } from 'langium/node'; import { createApplingLspServices } from '@appling/lang/lsp'; startLanguageServer(createApplingLspServices({ connection, ...NodeFileSystem }).shared); ``` -------------------------------- ### Appling module example with expressions Source: https://github.com/alex20465/appling/blob/main/docs/language/expressions.md Complete Appling module demonstrating built-in expression functions such as duration, size, has, sum, min, max, map, filter, exists, all, contains, startsWith, endsWith, matches, and actor.is. Includes entity definitions, invariants, policies, a query, and a projection. The example is checked with the 'appling check' command. ```appling ```appling check module sales { role Clerk actor human Shopper { account: Account } enum OrderStatus { draft placed paid } value Line { product: String amount: Money } entity Account { name: String } tenant Company on Account entity Order { reference: String unique account: Account lines: Line[] status: OrderStatus state default draft created_at: DateTime paid_at: DateTime? total: Money = sum(lines.map(l, l.amount)) big_lines: Int = size(lines.filter(l, l.amount > 100)) age: Duration = now - created_at invariant "has lines" { lines.size() > 0 && lines.all(l, l.amount >= 0) } invariant "reference format" { reference.startsWith("SO") && !reference.contains(" ") } policy read { actor.is(Clerk) || account == actor.account } policy update { account == tenant && status in [draft, placed] } } query Stale from Order { where { status == draft && created_at < now - duration("720h") && !has(paid_at) } } projection OrderRow from Order { reference line_count = lines.size() net = total * 0.8 } } ``` ``` -------------------------------- ### GET /api/snapshot Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Retrieves a snapshot of the current workspace state, including files, graph, dependencies, source locations, and errors. ```APIDOC ## GET /api/snapshot ### Description Retrieves a snapshot of the current workspace state, including files, graph, dependencies, source locations, and errors. ### Method GET ### Endpoint /api/snapshot ### Response #### Success Response (200) - **files** (array) - List of files in the workspace - **graph** (object) - Dependency graph - **dependencies** (array) - List of dependencies - **sourceLocations** (array) - Source locations - **errors** (array) - List of errors #### Response Example { "files": [], "graph": {}, "dependencies": [], "sourceLocations": [], "errors": [] } ``` -------------------------------- ### Simulator example model Source: https://github.com/alex20465/appling/blob/main/docs/tools/simulator.md Defines a shop model with roles, actors, entities, actions, and a state machine. Used to demonstrate the simulator's four questions: reachable states, actors, risks, and effects. ```appling module shop { role Clerk role Buyer actor human Staff roles Clerk actor human Customer roles Buyer { name: String } enum Status { open closed } value Line { amount: Money } entity Cart { owner: String status: Status state default open lines: Line[] discount: Money default 0 total: Money = sum(lines.map(l, l.amount)) - discount invariant "total not negative" { total >= 0 } } action Close on Cart { requires { lines.size() > 0 } else Empty errors Empty policy { actor.is(Clerk) || owner == actor.name } } action Discount on Cart { input { amount: Money } effect { set discount = amount } policy { actor.is(Clerk) } } machine Flow on Cart.status { transition open -> closed via Close } } ``` -------------------------------- ### appling generate --sync examples Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Brings a generated project up to the current model and keeps the work done in it since. Applies pending migration steps first, generates the model afresh in a temporary folder, and merges every file three ways. The target must have been generated with a version of appling that stores the generation baseline in .appling/baseline/. ```sh appling generate --sync examples ``` ```text conflicts: internal/sales/types.go build/shop: synced, 1 file(s) with conflict markers (registry tasks) ``` -------------------------------- ### Run appling check on examples directory Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Parses, links, and validates every file, printing each diagnostic and a summary line. Exits with 1 when there is at least one error. ```sh appling check examples ``` ```text 2 file(s), 0 error(s) ``` -------------------------------- ### appling generate --migrate examples Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Carries the model's migration steps that a generated project has not applied yet into it. The target must have been generated first (needs .appling/tasks.json in out); applied steps are recorded by id in .appling/migrations.json. ```sh appling generate --migrate examples ``` ```text build/shop: 2 migration step(s) applied, 1 task(s) added to the registry ``` -------------------------------- ### Build the landing site Source: https://github.com/alex20465/appling/blob/main/docs/contributing/documentation.md Builds `@appling/lang` and `@appling/model` first, then the site into `packages/landing/dist`. Every push to `main` deploys it. ```sh pnpm --filter @appling/landing... build ``` -------------------------------- ### run_tests Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Runs the test command recorded in the registry for the project. Returns the output (last 4000 characters). ```APIDOC ## run_tests ### Description Runs the test command recorded in the registry for the project. Returns the output (last 4000 characters). ### Method Tool call ### Endpoint `run_tests` ### Parameters #### Query Parameters - **target** (string) - Optional - Output folder of a generate target. ### Response #### Success Response - **out** (string) - The output folder. - **passed** (boolean) - Whether tests passed. - **output** (string) - Last 4000 characters of the test output. #### Response Example ```json { "out": "generated", "passed": true, "output": "..." } ``` ``` -------------------------------- ### Using the Appling Lang API with Langium Source: https://github.com/alex20465/appling/blob/main/packages/lang/README.md Shows how to create Appling services, load and validate a document, and print the parsed model in canonical form. Requires installing `langium` for `URI` and `NodeFileSystem` when using the API directly. ```ts import { URI } from 'langium'; import { NodeFileSystem } from 'langium/node'; import { createApplingServices, print, type Model } from '@appling/lang'; const { shared } = createApplingServices(NodeFileSystem); const document = await shared.workspace.LangiumDocuments.getOrCreateDocument(URI.file('/path/to/sales.appling')); await shared.workspace.DocumentBuilder.build([document], { validation: true }); console.log(document.diagnostics); const model = document.parseResult.value as Model; const canonical = print(model); ``` -------------------------------- ### Run appling fmt on examples directory Source: https://github.com/alex20465/appling/blob/main/docs/tools/cli.md Rewrites every file into canonical form: whitespace, indentation (two spaces) and line breaks are normalized, comments are kept. Prints 'formatted ' for each changed file and stays silent for already canonical files. Skips files with syntax errors, leaving them untouched and reporting them on stderr. ```sh appling fmt examples ``` ```text models/sales.appling: not formatted, fix syntax errors first (run "appling check") ``` -------------------------------- ### Create models/shop.appling with Product entity Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/first-model.md Initial domain model defining a Product entity with a unique name and Money price. Run `npx appling check models` to validate it. ```appling module shop { entity Product { name: String unique price: Money } } ``` -------------------------------- ### Set ANTHROPIC_API_KEY and list models with npx @appling/ide models Source: https://github.com/alex20465/appling/blob/main/docs/tools/ide.md Set the provider's API key in the environment and run the models command to verify the configuration before starting the IDE. ```sh ANTHROPIC_API_KEY=... npx @appling/ide models ``` -------------------------------- ### Simulator usage example Source: https://github.com/alex20465/appling/blob/main/packages/model/README.md Shows how to instantiate Simulator and use its methods to evaluate behavior against sample data and actors. Import from '@appling/model' or '@appling/model/simulator' to avoid language dependencies. Methods include reach, actors, risks, and run. ```typescript const simulator = new Simulator(graph); simulator.reach('sales.OrderFlow', 'paid'); // shortest transition path from the initial state, or undefined simulator.actors('sales.Cancel'); // per actor: 'yes', 'no' or 'depends' (on the data) simulator.risks('sales.Discount'); // invariants that read a field the action changes, also through derived fields simulator.run('sales.Cancel', { status: 'draft' }, { actor: 'sales.Staff' }, { reason: 'late' }); ``` -------------------------------- ### Access control example in Appling Source: https://github.com/alex20465/appling/blob/main/docs/language/access.md Defines roles, actors, entities, actions, queries, and a use case with policies to control access. Policies are local and effective policy is the conjunction along the reference path. ```appling module shop { role Clerk role Customer actor human Shopper roles Customer { account: Account } actor human Employee roles Clerk entity Account { name: String unique policy read { actor.is(Clerk) || actor.account == this } } tenant Company on Account entity Order { account: Account total: Money note: Text? policy read { actor.is(Clerk) || account == actor.account } policy create, update, delete { actor.is(Clerk) } policy read fields note { actor.is(Employee) } } action Refund on Order { input { amount: Money } requires { amount <= total } policy { actor.is(Clerk) && account == tenant } } query MyOrders from Order { where { account == actor.account } policy { actor.is(Customer) } } usecase Close (order: Order) { step Refund(order, order.total) policy { actor.is(Clerk) } } } ``` -------------------------------- ### Doc comment example in .appling file Source: https://github.com/alex20465/appling/blob/main/docs/tools/editors.md Shows a doc comment (/** ... */) directly before an element. The comment is used for hover information in the language server. ```appling module sales { /** An order placed by a customer. */ entity Order { reference: String unique } } ``` -------------------------------- ### Run appling-language-server with npx Source: https://github.com/alex20465/appling/blob/main/docs/tools/editors.md Runs the language server without a global install using npx. The server communicates over stdin and stdout with --stdio. ```sh npx -p @appling/lang appling-language-server --stdio ``` -------------------------------- ### Format the model with npx appling fmt Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/first-model.md Writes the canonical form back to the file. Running it twice changes nothing. ```sh npx appling fmt models ``` -------------------------------- ### Markdown page frontmatter and structure Source: https://github.com/alex20465/appling/blob/main/docs/contributing/documentation.md Template for a documentation page. Starts with frontmatter and has no top-level heading; the site prints the title. Use `##` and `###` sections for the table of contents. ```markdown --- title: Domain layer description: One sentence, used as the subtitle and the meta description. --- An intro paragraph, then `##` sections. The table of contents on the right lists `##` and `###`. ``` -------------------------------- ### Run Django project commands with uv Source: https://github.com/alex20465/appling/blob/main/docs/codegen/django.md Use these commands to migrate the database, start the development server, and run tests. The migrate command creates the SQLite database as configured by startproject. The test command is also stored by the registry and executed by AI tools after each task. ```sh cd build/shop uv run python manage.py migrate uv run python manage.py runserver uv run python manage.py test ``` -------------------------------- ### Start the MCP server (stdio and HTTP) Source: https://github.com/alex20465/appling/blob/main/packages/ai/README.md Run the MCP server in stdio mode for Claude Code/Desktop or with Streamable HTTP on port 4411. The HTTP endpoint is at http://127.0.0.1:4411/mcp. ```sh appling-mcp [folder] # stdio, for Claude Code, Claude Desktop or any MCP client appling-mcp [folder] --http 4411 # Streamable HTTP on http://127.0.0.1:4411/mcp ``` -------------------------------- ### edit operation example Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Example call of the edit tool with a rename operation. The operation object specifies the op, target, and new name. ```json { "operation": { "op": "rename", "target": "sales.Order.total", "name": "amount" } } ``` -------------------------------- ### Base model for edit operations Source: https://github.com/alex20465/appling/blob/main/docs/reference/edit-operations.md Starting model used by all examples on this page, defined in one file. ```appling module crm { export Account entity Account { name: String } } module sales { enum OrderStatus { draft placed } entity Order { customer: crm.Account status: OrderStatus state default draft total: Money invariant "total never negative" { total >= 0 } } } ``` -------------------------------- ### pnpm build Source: https://github.com/alex20465/appling/blob/main/CLAUDE.md Build every package in dependency order: langium generate and tsc for lang, vite for the IDE client, astro for landing. ```sh pnpm build ``` -------------------------------- ### Validated Appling graph example Source: https://github.com/alex20465/appling/blob/main/docs/contributing/documentation.md A complete Appling model in a ` ```appling graph ```` fence. The site build validates it and draws its semantic graph below the code. Fails the build on any error. ```appling module billing { export Invoice entity Invoice { number: String unique total: Money } event InvoiceIssued { invoice: Invoice } action Issue on Invoice { effect { emit InvoiceIssued { invoice = this } } } } ``` -------------------------------- ### Complete Appling behavior example Source: https://github.com/alex20465/appling/blob/main/docs/language/behavior.md A complete Appling behavior module defining roles, enums, entities, events, actions, a state machine, and a scheduled job. Demonstrates the full syntax for behavior modeling, including state transitions, policies, and error handling. ```appling module sales { role Customer enum OrderStatus { draft placed paid cancelled } entity Order { lines: Int status: OrderStatus state default draft created_at: DateTime placed_at: DateTime? paid_at: DateTime? } event OrderPlaced { order: Order } event PaymentReceived { order: Order } entity Notice { order: Order text: String } action PlaceOrder on Order { requires { lines > 0 } else EmptyOrder effect { set placed_at = now create Notice { order = this, text = "placed" } } errors EmptyOrder consistency atomic policy { actor.is(Customer) } } action Cancel on Order { input { reason: String? } } machine OrderFlow on Order.status { transition draft -> placed via PlaceOrder effect { emit OrderPlaced { order = this } } transition placed -> paid on PaymentReceived effect { set paid_at = now } transition draft, placed -> cancelled via Cancel when { !has(paid_at) } } job ExpireDrafts every "0 3 * * *" run Cancel where { status == draft && created_at < now - duration("720h") } } ``` -------------------------------- ### Add query, projection, and REST interface Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/first-model.md Adds a PlacedOrders query, OrderSummary projection, and ShopApi REST interface inside the module. Interfaces reach data only through queries and projections, not entities. ```appling query PlacedOrders from Order { where { status == placed } paginate 20 } projection OrderSummary from Order { quantity status product_name = product.name } interface rest ShopApi { GET "/orders" -> PlacedOrders as OrderSummary POST "/orders/{id}/place" -> PlaceOrder } ``` -------------------------------- ### Start appling-mcp over HTTP and add to Claude Code Source: https://github.com/alex20465/appling/blob/main/docs/tools/ai.md Start the server over HTTP on port 4411 and register it with Claude Code using the HTTP transport. The server listens on 127.0.0.1 only and answers on /mcp. ```sh npx appling-mcp . --http 4411 claude mcp add --transport http appling http://127.0.0.1:4411/mcp ``` -------------------------------- ### Complete example with module, entity, action, query, projection, use case, and interfaces Source: https://github.com/alex20465/appling/blob/main/docs/language/interfaces.md A full `sales` module showing an enum, entity, action, query, projection, use case, and two interfaces (`rest` and `mcp`). The `rest` interface includes auth, rate limit, CORS, and endpoints; the `mcp` interface uses apikey auth and a single endpoint. The `check` keyword indicates validation. ```appling module sales { enum OrderStatus { draft placed } entity Order { reference: String unique status: OrderStatus state default draft total: Money } action PlaceOrder on Order { } query OpenOrders from Order { where { status == placed } } projection OrderSummary from Order { reference status total label = reference + " " + "order" } usecase Checkout (order: Order) { step PlaceOrder(order) } interface rest PublicApi { auth bearer limit 100 per minute cors "https://shop.example.com" GET "/orders" -> OpenOrders as OrderSummary { reference, status, label } POST "/orders/{id}/place" -> PlaceOrder POST "/checkout" -> Checkout } interface mcp Assistant { auth apikey GET "/orders" -> OpenOrders as OrderSummary } } ``` -------------------------------- ### appling.config.json example with generate and ai sections Source: https://github.com/alex20465/appling/blob/main/docs/reference/configuration.md Shows the shape of the optional `generate` and `ai` sections in `appling.config.json`. The `generate` list defines code generation targets; `ai` configures the IDE chat model. Keep the file in the folder you run the CLI from and open in the IDE so all tools agree. ```json { "generate": [ { "extension": "@appling/codegen-django", "out": "build/shop", "options": { "name": "shop" } }, { "extension": "@appling/codegen-ash", "out": "build/shop_ash" } ], "ai": { "provider": "anthropic", "model": "claude-opus-5-5" } } ``` -------------------------------- ### createMcpServer(root) Source: https://github.com/alex20465/appling/blob/main/docs/reference/api.md Creates an MCP server with all tools and the implement_next_task prompt. Useful for exposing the tools via MCP. ```APIDOC ## createMcpServer(root) ### Description Creates an MCP server with all tools and the implement_next_task prompt. Useful for exposing the tools via MCP. ### Function Signature `createMcpServer(root: string): McpServer` ### Parameters - **root** (string) - Required - The workspace root path. ### Returns - An MCP server instance. ``` -------------------------------- ### Check the model with npx appling check Source: https://github.com/alex20465/appling/blob/main/docs/getting-started/first-model.md Validates the model files in the `models` directory. Expected output: `1 file(s), 0 error(s)`. ```sh npx appling check models ``` ```text 1 file(s), 0 error(s) ``` -------------------------------- ### pnpm test Source: https://github.com/alex20465/appling/blob/main/CLAUDE.md Run vitest over packages/*/test. ```sh pnpm test ``` -------------------------------- ### pnpm vitest run -u Source: https://github.com/alex20465/appling/blob/main/CLAUDE.md Update snapshots for model, codegen-django, and codegen-ash. ```sh pnpm vitest run -u ```