feat(OBC-001): initialize strict TS plugin project with lint and tests

This commit is contained in:
2026-03-06 08:14:10 -06:00
parent 0c9bcd4057
commit dec39006b1
8 changed files with 8445 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
node_modules
dist
coverage
.DS_Store

26
eslint.config.mjs Normal file
View File

@@ -0,0 +1,26 @@
import js from "@eslint/js";
import tseslint from "typescript-eslint";
export default [
{
ignores: ["dist/**", "coverage/**"],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
},
},
];

29
package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "openclaw-openbrain-context",
"version": "0.0.1",
"description": "OpenBrain-backed ContextEngine plugin for OpenClaw",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"openclaw.plugin.json",
"README.md"
],
"scripts": {
"lint": "eslint . --max-warnings=0",
"build": "tsc -p tsconfig.json",
"test": "vitest run"
},
"peerDependencies": {
"openclaw": ">=2026.3.2"
},
"devDependencies": {
"@eslint/js": "^9.25.1",
"@types/node": "^22.15.3",
"eslint": "^9.25.1",
"typescript": "^5.8.3",
"typescript-eslint": "^8.30.1",
"vitest": "^2.1.8"
}
}

8341
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
src/index.ts Normal file
View File

@@ -0,0 +1 @@
export const OPENBRAIN_CONTEXT_ENGINE_ID = "openbrain";

9
tests/smoke.test.ts Normal file
View File

@@ -0,0 +1,9 @@
import { describe, expect, it } from "vitest";
import { OPENBRAIN_CONTEXT_ENGINE_ID } from "../src/index.js";
describe("project scaffold", () => {
it("exports openbrain context engine id", () => {
expect(OPENBRAIN_CONTEXT_ENGINE_ID).toBe("openbrain");
});
});

27
tsconfig.json Normal file
View File

@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"isolatedModules": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "dist",
"rootDir": ".",
"types": ["node", "vitest/globals"],
"skipLibCheck": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
"paths": {
"openclaw/plugin-sdk": ["../openclaw-fork/src/plugin-sdk/index.ts"]
}
},
"include": ["src/**/*.ts", "tests/**/*.ts"],
"exclude": ["dist", "node_modules"]
}

8
vitest.config.ts Normal file
View File

@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
environment: "node",
include: ["tests/**/*.test.ts"],
},
});