@wanasapps/deluge-core
v1.3.1
Published
Deluge language tooling for every Zoho product: formatter, source transforms, TextMate grammar, snippets, an editor-agnostic linter, and AI-agent skills — a guide with runtime traps verified on a live org, plus a complete reference of every statement, dat
Readme
@wanasapps/deluge-core
Deluge language tooling for every Zoho product — not just CRM.
Deluge runs in Zoho CRM, Creator, Books, Inventory, Projects, Sprints, Qntrl, Catalyst and People. This package holds everything that is true about the language, so a CLI, a VS Code extension and a browser editor can share one implementation instead of copying it three times.
Hard rule: no I/O, no HTTP, no editor APIs. Pure functions over source text plus portable data assets. Anything that talks to Zoho belongs in an API layer; anything that talks to an editor belongs in that editor's adapter.
npm install @wanasapps/deluge-coreFormatting and source transforms
const deluge = require('@wanasapps/deluge-core');
deluge.format(source); // canonical indentation
deluge.stripLeadingComments(source); // see below — required before a push
deluge.parseSignature(source); // name, arguments, return typestripLeadingComments — the one that costs people an afternoon
Zoho's raw function-code endpoints parse everything before the first ( as the package declaration without skipping comments. A script that opens with a // documentation header is rejected with a bodyless, misleading 400 — while the same script pastes into the web editor fine. Only these endpoints choke.
So the leading comment lines are blanked, not deleted: blank lines are tolerated, and keeping them means the line numbers in any COMPILATION_ERROR Zoho returns still match the developer's local file. Interior comments are untouched.
Any tool pushing Deluge to any Zoho product needs this.
On-disk conventions
deluge.namespaceForCategory('Related List'); // 'related_list'
deluge.dsPath('sendInvoice', 'Standalone'); // 'standalone/sendInvoice.ds'
deluge.apiNameFromDsPath('ns.sendInvoice.ds'); // 'sendInvoice'
deluge.DELUGE_RUNTIME; // 'Deluge 1.0'Zoho names categories in prose ("Related List"); on disk they become lowercase, underscored folders. Sharing this means every tool writes the same functions/<namespace>/ layout.
Language assets
The same JSON files VS Code consumes, exposed as data so Monaco, Shiki, a docs site or a web editor can load them without depending on an extension.
deluge.language.grammar(); // TextMate grammar
deluge.language.configuration(); // brackets, comments, auto-closing pairs
deluge.language.snippets(); // VS Code snippet format
deluge.language.EXTENSIONS; // ['.ds', '.dg', '.deluge']
deluge.language.assetPaths; // absolute paths to the raw filesAgent skills
Two generated documents, both from assets/deluge-reference.json (scraped from Zoho's Deluge help) via scripts/gen-skill.js:
deluge.language.skill(); // the guide an agent loads while writing Deluge
deluge.language.reference(); // every statement, data type, function and task, with syntaxskill() is the one that ships as SKILL.md, so it has a budget: the Agent Skills specification recommends a body under 5,000 tokens, because it is loaded in full whenever the skill triggers.
It used to be 6,476, because it inlined a name index of all 337 built-in functions and integration tasks — every one of which already appears in reference(), with its exact syntax, parameters and return type. That index cost ~1,800 tokens on every trigger and bought nothing.
It is now category counts plus a pointer, and the guide is 4,911 tokens. The guarantee an agent actually needs is unchanged, just relocated: if a name is not in the reference, it does not exist in Deluge — do not invent one. A test fails if the body drifts back over the limit.
Hosts should install reference() beside the skill (zone writes it to references/REFERENCE.md) so the third disclosure stage — load a resource only when needed — actually works.
Analysis
Editor-agnostic: returns plain objects, so the same engine can back a vscode.Diagnostic, a CLI check, or a CI gate.
deluge.analyze.lint(source);
// [{ line, column, message, severity: 'error'|'warning'|'info', code }]
deluge.analyze.isValid(source); // false only on errors, warnings ignoredChecks balanced delimiters (ignoring braces inside strings and comments) and flags the leading-comment header described above.
License
MIT © Wanas Apps FZ-LLC
