Skip to content

About

Crossly for Neovim: automation recipe schemas for jsonls, did-you-mean fixes, docs under K, snippets and the Crossly MCP server config.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

crossly.nvim

ci release license Neovim 0.10+

Crossly

Write Crossly automation recipes and workflow files in Neovim with the editor checking them as you type. It is the Neovim counterpart of crossly-vscode and crossly-jetbrains.

Crossly is the crosslisting platform for resellers: list once, then crosspost, reprice, relist and delist across eBay, Poshmark, Mercari, Depop, Grailed, Facebook Marketplace, Vinted, Whatnot, Shopify and more. A recipe is a JSON automation rule (a trigger, an optional condition, an action) that you import into Crossly or share in crossly-recipes.

New to Crossly? Create a free account, then read the developer docs.

Features

  • JSON Schema validation and completion, offline, through jsonls: require('crossly').json_schemas() hands it the bundled schemas (all 29 triggers, 7 conditions, 42 actions, and the workflow format) with the same file patterns as the VS Code extension.
  • Did you mean: a mistyped trigger, condition or action type, config key or recipe key gets a diagnostic with the closest valid name (listing.sol → listing.sold), fixed with vim.lsp.buf.code_action() (gra) or :CrosslyFix.
  • Docs under K: in a recipe buffer, K (or :CrosslyDoc) on a type or key shows its description and config keys, straight from the schema. Elsewhere K is the usual LSP hover.
  • Snippets: crossly-recipe, crossly-recipe-condition, crossly-bundle, and crossly-trigger / crossly-condition / crossly-action with a pick list of every type. VS Code format, so LuaSnip and blink.cmp load them; they also come through LSP completion and vim.snippet with no snippet plugin at all.
  • Commands: :CrosslyDocs (the API docs), :CrosslyToken (create an API token), :CrosslyMcp (show, copy or install the Crossly MCP server for mcphub.nvim, CodeCompanion, Avante and other MCP hosts).
  • :checkhealth crossly and :help crossly.

Validation, diagnostics, docs and snippets never touch the network or your account.

Install

Neovim 0.10 or later. For validation and completion, vscode-json-language-server (jsonls, e.g. from mason.nvim or npm i -g vscode-langservers-extracted).

lazy.nvim:

{
  'crossly-dev/crossly.nvim',
  ft = { 'json', 'jsonc' },
  cmd = { 'CrosslyDocs', 'CrosslyToken', 'CrosslyMcp' },
  opts = {},
}

rocks.nvim: :Rocks install crossly.nvim (once it is on LuaRocks). vim-plug: Plug 'crossly-dev/crossly.nvim'. Native packages (:help packages):

git clone https://github.com/crossly-dev/crossly.nvim ~/.local/share/nvim/site/pack/crossly/start/crossly.nvim

setup() is optional; call it only to change the defaults (see below).

Hook up jsonls

nvim-lspconfig:

require('lspconfig').jsonls.setup({
  settings = {
    json = {
      schemas = require('crossly').json_schemas(),
      validate = { enable = true },
    },
  },
})

Neovim 0.11+ with vim.lsp.config (nvim-lspconfig still provides lsp/jsonls.lua):

vim.lsp.config('jsonls', {
  settings = { json = { schemas = require('crossly').json_schemas(), validate = { enable = true } } },
})
vim.lsp.enable('jsonls')

With SchemaStore.nvim, pass the entries as extra (they carry name and description):

settings = {
  json = {
    schemas = require('schemastore').json.schemas({ extra = require('crossly').json_schemas() }),
    validate = { enable = true },
  },
},

json_schemas() returns entries like:

{
  name = 'Crossly automation recipe',
  description = 'A Crossly automation recipe: a trigger, an optional condition and an action',
  fileMatch = { '*.crossly-recipe.json', '**/crossly-recipes/recipes/**/*.json', '!**/crossly-recipes/recipes/all.json' },
  url = 'file:///home/you/.local/share/nvim/lazy/crossly.nvim/schemas/automation-recipe-v1.json',
}

Files it recognises

File Schema
*.crossly-recipe.json, crossly-recipes/recipes/**/*.json automation-recipe-v1.json
*.crossly-recipes.json, crossly-recipes/recipes/all.json automation-recipe-bundle-v1.json
*.crossly-workflow.json workflow-v1.json (bundled)

Did-you-mean and docs also turn on in any JSON buffer whose "$schema" is a Crossly schema URL.

Configuration

The defaults:

require('crossly').setup({
  diagnostics = {
    enabled = true, -- did-you-mean diagnostics in the "crossly" namespace
    severity = vim.diagnostic.severity.WARN,
    debounce = 150, -- ms after the last change
  },
  code_actions = true, -- fixes through vim.lsp.buf.code_action() (in-process client, no external process)
  snippets = true, -- snippets through LSP completion in Crossly buffers
  keymaps = { hover = 'K' }, -- buffer-local in recipe buffers; false to skip
  hover = { border = 'rounded' },
  mcp = { path = nil }, -- :CrosslyMcp install target; nil = mcphub.nvim's servers.json
})

Snippets with a snippet engine

The snippets are snippets/crossly.json, declared in the plugin's package.json like friendly-snippets. LuaSnip:

require('luasnip.loaders.from_vscode').lazy_load({ paths = { require('crossly').root() } })

blink.cmp, nvim-cmp snippet sources and other loaders of VS Code snippet packages: add require('crossly').root() to their search paths. Without any of them, the snippets show up in LSP completion in Crossly buffers, or insert one with :CrosslySnippet crossly-recipe.

Commands

Command
:CrosslyDocs Open crossly.net/docs
:CrosslyToken Create an API token at crossly.net/settings/api/tokens/new
:CrosslyMcp [show|copy|install [path]] The Crossly MCP server config (see below)
:CrosslyDoc Docs for the type or key under the cursor
:CrosslyFix / :CrosslyFix! Apply the did-you-mean fix under the cursor / every one in the buffer
:CrosslySnippet {prefix} Insert a snippet with vim.snippet

Crossly MCP server

The Crossly MCP server lets an AI assistant manage your listings, orders and automations. :CrosslyMcp install adds it to mcphub.nvim's servers.json (asking for your token, hidden; leave it empty for a placeholder), which CodeCompanion, Avante and CopilotChat use. :CrosslyMcp shows and copies the config for any other host:

{
  "mcpServers": {
    "crossly": {
      "command": "npx",
      "args": ["-y", "@crossly/mcp"],
      "env": { "CROSSLY_PAT": "<your Crossly API token>" }
    }
  }
}

Node.js 20+ is required.

Development

CI (.github/workflows/ci.yml) runs StyLua, luacheck, the snippet check and the test suite in headless Neovim 0.10, 0.11 and stable with plenary.nvim's busted runner. Locally:

git clone --depth 1 https://github.com/nvim-lua/plenary.nvim .tests/plenary.nvim
nvim --headless --noplugin -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/spec { minimal_init = 'tests/minimal_init.lua', sequential = true }"
nvim -l scripts/gen_snippets.lua          # regenerate snippets/crossly.json after a schema update (--check in CI)
stylua --check lua plugin scripts tests && luacheck lua plugin scripts tests

Releases: bump lua/crossly/version.lua, add a CHANGELOG.md section, push a v<version> tag. The release workflow tests, builds the source archives with SHA256SUMS and build provenance, and attaches them to a GitHub Release. LuaRocks publishing (luarocks.yml) runs when the PUBLISH_LUAROCKS variable is true and the LUAROCKS_API_KEY secret is set.

Related

Links

License

MIT

About

Crossly for Neovim: automation recipe schemas for jsonls, did-you-mean fixes, docs under K, snippets and the Crossly MCP server config.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages