newo-dsl-core
v1.0.0
Published
Pure type definitions and the stable plugin contract for the Newo DSL toolchain. Zero runtime dependencies. Depend on this package when authoring a plugin; depend on newo-dsl-analyzer when you need the engine.
Downloads
71
Maintainers
Readme
newo-dsl-core
Pure type definitions and the stable plugin contract for the Newo DSL toolchain. Zero runtime dependencies.
When to use this package
| If you are... | Depend on |
|---------------|-----------|
| Authoring a lint / format plugin | newo-dsl-core (this package) |
| Running the analyzer in-process | newo-dsl-analyzer |
| Embedding the LSP server | newo-dsl-lsp |
| Using the CLI | newo (via newo lint/format/check) |
Install
npm install newo-dsl-coreExports
Diagnostic,DiagnosticSeverity,Range,Position- LSP-shaped diagnostic typesPlugin,Rule,RuleMeta,RuleContext,RuleVisitor,RuleSeverity,RuleType,RuleFix- plugin contractASTNode,ASTKind,FunctionCall,Parameter,Variable,Block,ParseResult- AST node typesLanguageId,FileExtension- language identifiers
All exports are export type - the package ships no runtime code.
Minimal plugin example
import type { Plugin, Rule } from 'newo-dsl-core';
const banTodo: Rule = {
meta: {
id: 'acme/ban-todo',
title: 'Disallow TODO comments in prompts',
defaultSeverity: 'warning',
docsUrl: 'https://example.com/docs/rules/ban-todo',
},
create(ctx) {
return {
onFile(ctx) {
if (ctx.sourceText.includes('TODO')) {
ctx.report({
message: 'TODO comments are not allowed in production prompts',
range: { start: { line: 1, column: 1 }, end: { line: 1, column: 1 } },
code: 'acme/ban-todo',
severity: 'warning',
});
}
},
};
},
};
const plugin: Plugin = {
name: 'acme',
version: '1.0.0',
rules: {
'ban-todo': banTodo,
},
};
export default plugin;Register the plugin by adding it to .neworc.yaml:
plugins:
- ./my-plugin
rules:
acme/ban-todo: warningStability
Breaking changes to the interfaces in this package require a major version bump. The intent is that plugins compiled against [email protected] keep working against any [email protected].
License
Proprietary - Newo AI. All rights reserved.
