This commit is contained in:
babayaga 2025-09-15 22:51:05 +02:00
parent 877498fd00
commit 4a86eb0929
1077 changed files with 54238 additions and 64 deletions

View File

@ -2,4 +2,3 @@ import Keyv from 'keyv';
export declare const store: (storePath: string, ns?: string, opts?: any) => Keyv<any>;
export declare const get: (key: string, storePath: string, ns?: string, opts?: any) => Promise<any>;
export declare const set: (key: string, value: any, storePath: string, ns?: string, opts?: any) => Promise<boolean>;
export declare const list: (key: string, value: any, storePath: string, ns?: string, opts?: any) => Promise<boolean>;

View File

@ -1,10 +1,13 @@
import * as path from 'path';
import Keyv from 'keyv';
import KeyvSqlite from '@keyv/sqlite';
import { KeyvFile } from 'keyv-file';
import { resolve } from '@polymech/commons';
export const store = (storePath, ns = 'ns-unknown', opts = {}) => {
const keyvSqlite = new KeyvSqlite(path.resolve(resolve(storePath)));
return new Keyv({ store: keyvSqlite, ttl: 5000, namespace: ns, ...opts });
const keyvFile = new KeyvFile({
filename: path.resolve(resolve(storePath)),
writeDelay: 100, // ms
});
return new Keyv({ store: keyvFile, namespace: ns, ...opts });
};
export const get = async (key, storePath, ns = 'ns-unknown', opts = {}) => {
const keyv = store(storePath, ns, opts);
@ -14,8 +17,4 @@ export const set = async (key, value, storePath, ns = 'ns-unknown', opts = {}) =
const keyv = store(storePath, ns, opts);
return await keyv.set(key, value);
};
export const list = async (key, value, storePath, ns = 'ns-unknown', opts = {}) => {
const keyv = store(storePath, ns, opts);
return await keyv.set(key, value);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia2V5di5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvdG9vbHMva2V5di50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssSUFBSSxNQUFNLE1BQU0sQ0FBQTtBQUM1QixPQUFPLElBQUksTUFBTSxNQUFNLENBQUE7QUFDdkIsT0FBTyxVQUFVLE1BQ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VBQUUsR0FBRyxFQUFFLEtBQUs7S0FDekIsQ0FBQyxDQUFBO0lBQ0YsT0FBTyxJQUFJLElBQUksQ0FBQyxFQUFFLEtBQUssRUFBRSxRQUFRLEVBQUUsU0FBUyxFQUFFLEVBQUUsRUFBRSxHQUFHLElBQUksRUFBRSxDQUFDLENBQUE7QUFDaEUsQ0FBQyxDQUFBO0FBQ0QsTUFBTSxDQUFDLE1BQU0sR0FBRyxHQUFHLEtBQUssRUFBRSxHQUFXLEVBQUUsU0FBaUIsRUFBRSxLQUFhLFlBQVksRUFBRSxPQUFZLEVBQUUsRUFBRSxFQUFFO0lBQ25HLE1BQU0sSUFBSSxHQUFHLEtBQUssQ0FBQyxTQUFTLEVBQUUsRUFBRSxFQUFFLElBQUksQ0FBQyxDQUFBO0lBQ3ZDLE9BQU8sTUFBTSxJQUFJLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0FBQzlCLENBQUMsQ0FBQTtBQUNELE1BQU0sQ0FBQyxNQUFNLEdBQUcsR0FBRyxLQUFLLEVBQUUsR0FBVyxFQUFFLEtBQVUsRUFBRSxTQUFpQixFQUFFLEtBQWEsWUFBWSxFQUFFLE9BQVksRUFBRSxFQUFFLEVBQUU7SUFDL0csTUFBTSxJQUFJLEdBQUcsS0FBSyxDQUFDLFNBQVMsRUFBRSxFQUFFLEVBQUUsSUFBSSxDQUFDLENBQUE7SUFDdkMsT0FBTyxNQUFNLElBQUksQ0FBQyxHQUFHLENBQUMsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFBO0FBQ3JDLENBQUMsQ0FBQSJ9

File diff suppressed because one or more lines are too long

View File

@ -6,6 +6,5 @@ export declare const tools: {
interact: (target: string, options: import("../../types.js").IKBotTask) => any[];
user: (target: string, options: import("../../types.js").IKBotTask) => any[];
search: (target: string, options: import("../../types.js").IKBotTask) => any[];
web: (target: string, options: import("../../types.js").IKBotTask) => any[];
memory: (target: string, options: import("../../types.js").IKBotTask) => any[];
};

View File

@ -5,7 +5,7 @@ import { tools as terminalTools } from './terminal.js';
import { tools as interactTools } from './interact.js';
import { tools as userTools } from './user.js';
import { tools as search } from './search.js';
import { tools as webTools } from './web.js';
//import { tools as webTools } from './web.js'
import { tools as memoryTools } from './memory.js';
// import { tools as emailTools } from './email'
export const tools = {
@ -16,8 +16,8 @@ export const tools = {
interact: interactTools,
user: userTools,
search: search,
web: webTools,
memory: memoryTools,
// web: webTools,
memory: memoryTools
// email: emailTools
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbGliL3Rvb2xzL3Rvb2xzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxLQUFLLElBQUksT0FBTyxFQUFFLE1BQU0sU0FBUyxDQUFBO0FBQzFDLE9BQU8sRUFBRSxLQUFLLElBQUksUUFBUSxFQUFFLE1BQU0sVUFBVSxDQUFBO0FBQzVDLE9BQU8sRUFBRSxLQUFLLElBQUksUUFBUSxFQUFFLE1BQU0sVUFBVSxDQUFBO0FBQzVDLE9BQU8sRUFBRSxLQUFLLElBQUksYUFBYSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBQ3RELE9BQU8sRUFBRSxLQUFLLElBQUksYUFBYSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBQ3RELE9BQU8sRUFBRSxLQUFLLElBQUksU0FBUyxFQUFFLE1BQU0sV0FBVyxDQUFBO0FBQzlDLE9BQU8sRUFBRSxLQUFLLElBQUksTUFBTSxFQUFFLE1BQU0sYUFBYSxDQUFBO0FBQzdDLE9BQU8sRUFBRSxLQUFLLElBQUksUUFBUSxFQUFFLE1BQU0sVUFBVSxDQUFBO0FBQzVDLE9BQU8sRUFBRSxLQUFLLElBQUksV0FBVyxFQUFFLE1BQU0sYUFBYSxDQUFBO0FBQ2xELCtDQUErQztBQ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sQ0FBQTtBQUNsRCxnREFBZ0Q7QUFFaEQsTUFBTSxDQUFDLE1BQU0sS0FBSyxHQUFHO0lBQ2pCLEVBQUUsRUFBRSxPQUFPO0lBQ1gsR0FBRyxFQUFFLFFBQVE7SUFDYixHQUFHLEVBQUUsUUFBUTtJQUNiLFFBQVEsRUFBRSxhQUFhO0lBQ3ZCLFFBQVEsRUFBRSxhQUFhO0lBQ3ZCLElBQUksRUFBRSxTQUFTO0lBQ2YsTUFBTSxFQUFFLE1BQU07SUFDZCxpQkFBaUI7SUFDakIsTUFBTSxFQUFFLFdBQVc7SUFDbkIsb0JBQW9CO0NBQ3ZCLENBQUEifQ==

View File

@ -33,26 +33,24 @@ export interface IKBotOptions {

agentica-org/deepcoder-14b-preview | paid
agentica-org/deepcoder-14b-preview:free | free
ai21/jamba-large-1.7 | paid
ai21/jamba-mini-1.7 | paid
aion-labs/aion-1.0 | paid
aion-labs/aion-1.0-mini | paid
aion-labs/aion-rp-llama-3.1-8b | paid
alfredpros/codellama-7b-instruct-solidity | paid
allenai/molmo-7b-d | paid
allenai/olmo-2-0325-32b-instruct | paid
amazon/nova-lite-v1 | paid
amazon/nova-micro-v1 | paid
amazon/nova-pro-v1 | paid
anthropic/claude-3-haiku | paid
anthropic/claude-3-haiku:beta | paid
anthropic/claude-3-opus | paid
anthropic/claude-3-opus:beta | paid
anthropic/claude-3.5-haiku | paid
anthropic/claude-3.5-haiku-20241022 | paid
anthropic/claude-3.5-haiku:beta | paid
anthropic/claude-3.5-sonnet | paid
anthropic/claude-3.5-sonnet-20240620 | paid
anthropic/claude-3.5-sonnet-20240620:beta | paid
anthropic/claude-3.5-sonnet:beta | paid
anthropic/claude-3.7-sonnet | paid
anthropic/claude-3.7-sonnet:beta | paid
anthropic/claude-3.7-sonnet:thinking | paid
anthropic/claude-opus-4 | paid
anthropic/claude-opus-4.1 | paid
@ -64,8 +62,13 @@ export interface IKBotOptions {
arliai/qwq-32b-arliai-rpr-v1 | paid
arliai/qwq-32b-arliai-rpr-v1:free | free
openrouter/auto | paid
baidu/ernie-4.5-21b-a3b | paid
baidu/ernie-4.5-300b-a47b | paid
baidu/ernie-4.5-vl-28b-a3b | paid
baidu/ernie-4.5-vl-424b-a47b | paid
bytedance/seed-oss-36b-instruct | paid
bytedance/ui-tars-1.5-7b | paid
deepcogito/cogito-v2-preview-llama-109b-moe | paid
cohere/command | paid
cohere/command-a | paid
cohere/command-r | paid
@ -75,13 +78,16 @@ export interface IKBotOptions {
cohere/command-r-plus-04-2024 | paid
cohere/command-r-plus-08-2024 | paid
cohere/command-r7b-12-2024 | paid
deepcogito/cogito-v2-preview-deepseek-671b | paid
deepseek/deepseek-prover-v2 | paid
deepseek/deepseek-r1-0528-qwen3-8b | paid
deepseek/deepseek-r1-0528-qwen3-8b:free | free
deepseek/deepseek-chat | paid
deepseek/deepseek-chat-v3-0324 | paid
deepseek/deepseek-chat-v3-0324:free | free
deepseek/deepseek-v3-base | paid
deepseek/deepseek-chat-v3.1 | paid
deepseek/deepseek-chat-v3.1:free | free
deepseek/deepseek-v3.1-base | paid
deepseek/deepseek-r1 | paid
deepseek/deepseek-r1:free | free
deepseek/deepseek-r1-0528 | paid
@ -89,11 +95,9 @@ export interface IKBotOptions {
deepseek/deepseek-r1-distill-llama-70b | paid
deepseek/deepseek-r1-distill-llama-70b:free | free
deepseek/deepseek-r1-distill-llama-8b | paid
deepseek/deepseek-r1-distill-qwen-1.5b | paid
deepseek/deepseek-r1-distill-qwen-14b | paid
deepseek/deepseek-r1-distill-qwen-14b:free | free
deepseek/deepseek-r1-distill-qwen-32b | paid
deepseek/deepseek-r1-distill-qwen-7b | paid
cognitivecomputations/dolphin-mixtral-8x22b | paid
cognitivecomputations/dolphin3.0-mistral-24b | paid
cognitivecomputations/dolphin3.0-mistral-24b:free | free
@ -108,10 +112,10 @@ export interface IKBotOptions {
google/gemini-2.0-flash-exp:free | free
google/gemini-2.0-flash-lite-001 | paid
google/gemini-2.5-flash | paid
google/gemini-2.5-flash-image-preview | paid
google/gemini-2.5-flash-lite | paid
google/gemini-2.5-flash-lite-preview-06-17 | paid
google/gemini-2.5-pro | paid
google/gemini-2.5-pro-exp-03-25 | paid
google/gemini-2.5-pro-preview-05-06 | paid
google/gemini-2.5-pro-preview | paid
google/gemma-2-27b-it | paid
@ -128,17 +132,15 @@ export interface IKBotOptions {
google/gemma-3n-e4b-it:free | free
inception/mercury | paid
inception/mercury-coder | paid
infermatic/mn-inferor-12b | paid
inflection/inflection-3-pi | paid
inflection/inflection-3-productivity | paid
moonshotai/kimi-dev-72b:free | free
liquid/lfm-3b | paid
liquid/lfm-40b | paid
liquid/lfm-7b | paid
meta-llama/llama-guard-3-8b | paid
anthracite-org/magnum-v2-72b | paid
anthracite-org/magnum-v4-72b | paid
mancer/weaver | paid
meituan/longcat-flash-chat | paid
meta-llama/llama-3-70b-instruct | paid
meta-llama/llama-3-8b-instruct | paid
meta-llama/llama-3.1-405b | paid
@ -147,15 +149,17 @@ export interface IKBotOptions {
meta-llama/llama-3.1-70b-instruct | paid
meta-llama/llama-3.1-8b-instruct | paid
meta-llama/llama-3.2-11b-vision-instruct | paid
meta-llama/llama-3.2-11b-vision-instruct:free | free
meta-llama/llama-3.2-1b-instruct | paid
meta-llama/llama-3.2-3b-instruct | paid
meta-llama/llama-3.2-3b-instruct:free | free
meta-llama/llama-3.2-90b-vision-instruct | paid
meta-llama/llama-3.3-70b-instruct | paid
meta-llama/llama-3.3-70b-instruct:free | free
meta-llama/llama-3.3-8b-instruct:free | free
meta-llama/llama-4-maverick | paid
meta-llama/llama-4-maverick:free | free
meta-llama/llama-4-scout | paid
meta-llama/llama-4-scout:free | free
meta-llama/llama-guard-4-12b | paid
meta-llama/llama-guard-2-8b | paid
microsoft/mai-ds-r1 | paid
@ -188,9 +192,9 @@ export interface IKBotOptions {
mistralai/mistral-7b-instruct | paid
mistralai/mistral-7b-instruct:free | free
mistralai/mistral-7b-instruct-v0.1 | paid
mistralai/mistral-7b-instruct-v0.2 | paid
mistralai/mistral-7b-instruct-v0.3 | paid
mistralai/mistral-medium-3 | paid
mistralai/mistral-medium-3.1 | paid
mistralai/mistral-nemo | paid
mistralai/mistral-nemo:free | free
mistralai/mistral-small-24b-instruct-2501 | paid
@ -204,10 +208,13 @@ export interface IKBotOptions {
mistralai/pixtral-12b | paid
mistralai/pixtral-large-2411 | paid
mistralai/mistral-saba | paid
moonshotai/kimi-vl-a3b-thinking | paid
moonshotai/kimi-vl-a3b-thinking:free | free
moonshotai/kimi-dev-72b | paid
moonshotai/kimi-dev-72b:free | free
moonshotai/kimi-k2 | paid
moonshotai/kimi-k2:free | free
moonshotai/kimi-k2-0905 | paid
moonshotai/kimi-vl-a3b-thinking | paid
moonshotai/kimi-vl-a3b-thinking:free | free
morph/morph-v3-fast | paid
morph/morph-v3-large | paid
gryphe/mythomax-l2-13b | paid
@ -216,14 +223,16 @@ export interface IKBotOptions {
neversleep/noromaid-20b | paid
nousresearch/deephermes-3-llama-3-8b-preview:free | free
nousresearch/deephermes-3-mistral-24b-preview | paid
nousresearch/nous-hermes-2-mixtral-8x7b-dpo | paid
nousresearch/hermes-3-llama-3.1-405b | paid
nousresearch/hermes-3-llama-3.1-70b | paid
nousresearch/hermes-4-405b | paid
nousresearch/hermes-4-70b | paid
nousresearch/hermes-2-pro-llama-3-8b | paid
nvidia/llama-3.1-nemotron-70b-instruct | paid
nvidia/llama-3.1-nemotron-ultra-253b-v1 | paid
nvidia/llama-3.1-nemotron-ultra-253b-v1:free | free
nvidia/llama-3.3-nemotron-super-49b-v1 | paid
nvidia/nemotron-nano-9b-v2 | paid
nvidia/nemotron-nano-9b-v2:free | free
openai/chatgpt-4o-latest | paid
openai/codex-mini | paid
openai/gpt-3.5-turbo | paid
@ -243,6 +252,7 @@ export interface IKBotOptions {
openai/gpt-4o-2024-08-06 | paid
openai/gpt-4o-2024-11-20 | paid
openai/gpt-4o:extended | paid
openai/gpt-4o-audio-preview | paid
openai/gpt-4o-search-preview | paid
openai/gpt-4o-mini | paid
openai/gpt-4o-mini-2024-07-18 | paid
@ -252,6 +262,7 @@ export interface IKBotOptions {
openai/gpt-5-mini | paid
openai/gpt-5-nano | paid
openai/gpt-oss-120b | paid
openai/gpt-oss-120b:free | free
openai/gpt-oss-20b | paid
openai/gpt-oss-20b:free | free
openai/o1 | paid
@ -264,16 +275,14 @@ export interface IKBotOptions {
openai/o3-pro | paid
openai/o4-mini | paid
openai/o4-mini-high | paid
opengvlab/internvl3-14b | paid
perplexity/r1-1776 | paid
perplexity/sonar | paid
perplexity/sonar-deep-research | paid
perplexity/sonar-pro | paid
perplexity/sonar-reasoning | paid
perplexity/sonar-reasoning-pro | paid
pygmalionai/mythalion-13b | paid
featherless/qwerky-72b:free | free
qwen/qwen-2-72b-instruct | paid
qwen/qwen-plus-2025-07-28 | paid
qwen/qwen-plus-2025-07-28:thinking | paid
qwen/qwen-vl-max | paid
qwen/qwen-vl-plus | paid
qwen/qwen-max | paid
@ -293,11 +302,17 @@ export interface IKBotOptions {
qwen/qwen3-30b-a3b | paid
qwen/qwen3-30b-a3b:free | free
qwen/qwen3-30b-a3b-instruct-2507 | paid
qwen/qwen3-30b-a3b-thinking-2507 | paid
qwen/qwen3-32b | paid
qwen/qwen3-4b:free | free
qwen/qwen3-8b | paid
qwen/qwen3-8b:free | free
qwen/qwen3-coder-30b-a3b-instruct | paid
qwen/qwen3-coder | paid
qwen/qwen3-coder:free | free
qwen/qwen3-max | paid
qwen/qwen3-next-80b-a3b-instruct | paid
qwen/qwen3-next-80b-a3b-thinking | paid
qwen/qwq-32b | paid
qwen/qwq-32b:free | free
qwen/qwq-32b-preview | paid
@ -312,10 +327,12 @@ export interface IKBotOptions {
sao10k/l3-euryale-70b | paid
sao10k/l3.1-euryale-70b | paid
sao10k/l3.3-euryale-70b | paid
sarvamai/sarvam-m:free | free
shisa-ai/shisa-v2-llama3.3-70b | paid
shisa-ai/shisa-v2-llama3.3-70b:free | free
openrouter/sonoma-dusk-alpha | paid
openrouter/sonoma-sky-alpha | paid
raifle/sorcererlm-8x22b | paid
stepfun-ai/step3 | paid
switchpoint/router | paid
tencent/hunyuan-a13b-instruct | paid
tencent/hunyuan-a13b-instruct:free | free
@ -324,14 +341,12 @@ export interface IKBotOptions {
thedrummer/rocinante-12b | paid
thedrummer/skyfall-36b-v2 | paid
thedrummer/unslopnemo-12b | paid
thedrummer/valkyrie-49b-v1 | paid
thudm/glm-4-32b | paid
thudm/glm-4.1v-9b-thinking | paid
thudm/glm-z1-32b:free | free
thudm/glm-z1-32b | paid
tngtech/deepseek-r1t-chimera | paid
tngtech/deepseek-r1t-chimera:free | free
tngtech/deepseek-r1t2-chimera:free | free
scb10x/llama3.1-typhoon2-70b-instruct | paid
cognitivecomputations/dolphin-mistral-24b-venice-edition:free | free
microsoft/wizardlm-2-8x22b | paid
x-ai/grok-2-1212 | paid
@ -341,11 +356,12 @@ export interface IKBotOptions {
x-ai/grok-3-mini | paid
x-ai/grok-3-mini-beta | paid
x-ai/grok-4 | paid
x-ai/grok-vision-beta | paid
x-ai/grok-code-fast-1 | paid
z-ai/glm-4-32b | paid
z-ai/glm-4.5 | paid
z-ai/glm-4.5-air | paid
z-ai/glm-4.5-air:free | free
z-ai/glm-4.5v | paid

 OpenAI models:

@ -406,7 +422,11 @@ export interface IKBotOptions {
gpt-5-mini-2025-08-07
gpt-5-nano
gpt-5-nano-2025-08-07
gpt-audio
gpt-audio-2025-08-28
gpt-image-1
gpt-realtime
gpt-realtime-2025-08-28
o1
o1-2024-12-17
o1-mini

View File

@ -1003,6 +1003,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"yargs": "^17.7.2",
@ -1010,6 +1011,9 @@
"zod-to-json-schema": "^3.24.5",
"zod-to-ts": "^1.2.0"
},
"bin": {
"pm-cli": "dist/main.js"
},
"devDependencies": {
"@types/node": "^22.12.0",
"typescript": "^5.7.3"

View File

@ -30,7 +30,6 @@
"dependencies": {
"@datalust/winston-seq": "^2.0.0",
"@inquirer/prompts": "^7.3.2",
"@keyv/sqlite": "^4.0.5",
"@polymech/commons": "file:../commons",
"@polymech/core": "file:../core",
"@polymech/fs": "file:../fs",

View File

@ -1,12 +1,15 @@
import * as path from 'path'
import Keyv from 'keyv'
import KeyvSqlite from '@keyv/sqlite'
import { KeyvFile } from 'keyv-file'
import { resolve } from '@polymech/commons'
export const store = (storePath: string, ns: string = 'ns-unknown', opts: any = {}) => {
const keyvSqlite = new KeyvSqlite(path.resolve(resolve(storePath)))
return new Keyv({ store: keyvSqlite, ttl: 5000, namespace: ns, ...opts })
const keyvFile = new KeyvFile({
filename: path.resolve(resolve(storePath)),
writeDelay: 100, // ms
})
return new Keyv({ store: keyvFile, namespace: ns, ...opts })
}
export const get = async (key: string, storePath: string, ns: string = 'ns-unknown', opts: any = {}) => {
const keyv = store(storePath, ns, opts)
@ -16,7 +19,3 @@ export const set = async (key: string, value: any, storePath: string, ns: string
const keyv = store(storePath, ns, opts)
return await keyv.set(key, value)
}
export const list = async (key: string, value: any, storePath: string, ns: string = 'ns-unknown', opts: any = {}) => {
const keyv = store(storePath, ns, opts)
return await keyv.set(key, value)
}

View File

@ -10,7 +10,7 @@ import { store, get, set } from './keyv.js'
// Helper function to get storage path
const getStoragePath = (options: IKBotTask): string => {
// For now, use default path. Later this can be configured via options
return path.join(process.cwd(), 'memory.sqlite');
return path.join(process.cwd(), 'memory.json');
};
// Default collection name when none provided

View File

@ -5,7 +5,7 @@ import { tools as terminalTools } from './terminal.js'
import { tools as interactTools } from './interact.js'
import { tools as userTools } from './user.js'
import { tools as search } from './search.js'
import { tools as webTools } from './web.js'
//import { tools as webTools } from './web.js'
import { tools as memoryTools } from './memory.js'
// import { tools as emailTools } from './email'
@ -17,7 +17,7 @@ export const tools = {
interact: interactTools,
user: userTools,
search: search,
web: webTools,
memory: memoryTools,
// web: webTools,
memory: memoryTools
// email: emailTools
}

View File

@ -39,6 +39,8 @@ export interface IKBotOptions {
aion-labs/aion-1.0-mini | paid
aion-labs/aion-rp-llama-3.1-8b | paid
alfredpros/codellama-7b-instruct-solidity | paid
allenai/molmo-7b-d | paid
allenai/olmo-2-0325-32b-instruct | paid
amazon/nova-lite-v1 | paid
amazon/nova-micro-v1 | paid
amazon/nova-pro-v1 | paid
@ -64,6 +66,7 @@ export interface IKBotOptions {
baidu/ernie-4.5-300b-a47b | paid
baidu/ernie-4.5-vl-28b-a3b | paid
baidu/ernie-4.5-vl-424b-a47b | paid
bytedance/seed-oss-36b-instruct | paid
bytedance/ui-tars-1.5-7b | paid
deepcogito/cogito-v2-preview-llama-109b-moe | paid
cohere/command | paid
@ -113,7 +116,6 @@ export interface IKBotOptions {
google/gemini-2.5-flash-lite | paid
google/gemini-2.5-flash-lite-preview-06-17 | paid
google/gemini-2.5-pro | paid
google/gemini-2.5-pro-exp-03-25 | paid
google/gemini-2.5-pro-preview-05-06 | paid
google/gemini-2.5-pro-preview | paid
google/gemma-2-27b-it | paid
@ -130,7 +132,6 @@ export interface IKBotOptions {
google/gemma-3n-e4b-it:free | free
inception/mercury | paid
inception/mercury-coder | paid
infermatic/mn-inferor-12b | paid
inflection/inflection-3-pi | paid
inflection/inflection-3-productivity | paid
liquid/lfm-3b | paid
@ -139,6 +140,7 @@ export interface IKBotOptions {
anthracite-org/magnum-v2-72b | paid
anthracite-org/magnum-v4-72b | paid
mancer/weaver | paid
meituan/longcat-flash-chat | paid
meta-llama/llama-3-70b-instruct | paid
meta-llama/llama-3-8b-instruct | paid
meta-llama/llama-3.1-405b | paid
@ -210,6 +212,7 @@ export interface IKBotOptions {
moonshotai/kimi-dev-72b:free | free
moonshotai/kimi-k2 | paid
moonshotai/kimi-k2:free | free
moonshotai/kimi-k2-0905 | paid
moonshotai/kimi-vl-a3b-thinking | paid
moonshotai/kimi-vl-a3b-thinking:free | free
morph/morph-v3-fast | paid
@ -228,7 +231,8 @@ export interface IKBotOptions {
nvidia/llama-3.1-nemotron-70b-instruct | paid
nvidia/llama-3.1-nemotron-ultra-253b-v1 | paid
nvidia/llama-3.1-nemotron-ultra-253b-v1:free | free
nvidia/llama-3.3-nemotron-super-49b-v1 | paid
nvidia/nemotron-nano-9b-v2 | paid
nvidia/nemotron-nano-9b-v2:free | free
openai/chatgpt-4o-latest | paid
openai/codex-mini | paid
openai/gpt-3.5-turbo | paid
@ -277,7 +281,8 @@ export interface IKBotOptions {
perplexity/sonar-pro | paid
perplexity/sonar-reasoning | paid
perplexity/sonar-reasoning-pro | paid
pygmalionai/mythalion-13b | paid
qwen/qwen-plus-2025-07-28 | paid
qwen/qwen-plus-2025-07-28:thinking | paid
qwen/qwen-vl-max | paid
qwen/qwen-vl-plus | paid
qwen/qwen-max | paid
@ -305,6 +310,9 @@ export interface IKBotOptions {
qwen/qwen3-coder-30b-a3b-instruct | paid
qwen/qwen3-coder | paid
qwen/qwen3-coder:free | free
qwen/qwen3-max | paid
qwen/qwen3-next-80b-a3b-instruct | paid
qwen/qwen3-next-80b-a3b-thinking | paid
qwen/qwq-32b | paid
qwen/qwq-32b:free | free
qwen/qwq-32b-preview | paid
@ -321,7 +329,10 @@ export interface IKBotOptions {
sao10k/l3.3-euryale-70b | paid
shisa-ai/shisa-v2-llama3.3-70b | paid
shisa-ai/shisa-v2-llama3.3-70b:free | free
openrouter/sonoma-dusk-alpha | paid
openrouter/sonoma-sky-alpha | paid
raifle/sorcererlm-8x22b | paid
stepfun-ai/step3 | paid
switchpoint/router | paid
tencent/hunyuan-a13b-instruct | paid
tencent/hunyuan-a13b-instruct:free | free
@ -346,7 +357,6 @@ export interface IKBotOptions {
x-ai/grok-3-mini-beta | paid
x-ai/grok-4 | paid
x-ai/grok-code-fast-1 | paid
x-ai/grok-vision-beta | paid
z-ai/glm-4-32b | paid
z-ai/glm-4.5 | paid
z-ai/glm-4.5-air | paid

View File

@ -83,6 +83,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"yargs": "^17.7.2",
@ -90,6 +91,9 @@
"zod-to-json-schema": "^3.24.5",
"zod-to-ts": "^1.2.0"
},
"bin": {
"pm-cli": "dist/main.js"
},
"devDependencies": {
"@types/node": "^22.12.0",
"typescript": "^5.7.3"
@ -9872,6 +9876,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"typescript": "^5.7.3",

5
packages/cache/package-lock.json generated vendored
View File

@ -40,6 +40,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"yargs": "^17.7.2",
@ -47,6 +48,9 @@
"zod-to-json-schema": "^3.24.5",
"zod-to-ts": "^1.2.0"
},
"bin": {
"pm-cli": "dist/main.js"
},
"devDependencies": {
"@types/node": "^22.12.0",
"typescript": "^5.7.3"
@ -1227,6 +1231,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"typescript": "^5.7.3",

View File

@ -41,7 +41,7 @@
"zod": "^3.24.1"
},
"bin": {
"osr-i18n": "main.js"
"pm-i18n": "dist/main.js"
},
"engines": {
"node": ">= 14.0.0"
@ -83,6 +83,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"yargs": "^17.7.2",
@ -90,6 +91,9 @@
"zod-to-json-schema": "^3.24.5",
"zod-to-ts": "^1.2.0"
},
"bin": {
"pm-cli": "dist/main.js"
},
"devDependencies": {
"@types/node": "^22.12.0",
"typescript": "^5.7.3"
@ -2349,6 +2353,7 @@
"normalize-url": "^8.0.1",
"p-map": "^7.0.3",
"p-throttle": "^4.1.1",
"regedit": "^5.1.4",
"tslog": "^3.3.3",
"tsup": "^2.0.3",
"typescript": "^5.7.3",

View File

@ -0,0 +1,111 @@
---
description: Use Bun instead of Node.js, npm, pnpm, or vite.
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
alwaysApply: false
---
Default to using Bun instead of Node.js.
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
- Use `bun test` instead of `jest` or `vitest`
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
- Bun automatically loads .env, so don't use dotenv.
## APIs
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
- `Bun.redis` for Redis. Don't use `ioredis`.
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
- `WebSocket` is built-in. Don't use `ws`.
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
- Bun.$`ls` instead of execa.
## Testing
Use `bun test` to run tests.
```ts#index.test.ts
import { test, expect } from "bun:test";
test("hello world", () => {
expect(1).toBe(1);
});
```
## Frontend
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
Server:
```ts#index.ts
import index from "./index.html"
Bun.serve({
routes: {
"/": index,
"/api/users/:id": {
GET: (req) => {
return new Response(JSON.stringify({ id: req.params.id }));
},
},
},
// optional websocket support
websocket: {
open: (ws) => {
ws.send("Hello, world!");
},
message: (ws, message) => {
ws.send(message);
},
close: (ws) => {
// handle close
}
},
development: {
hmr: true,
console: true,
}
})
```
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
```html#index.html
<html>
<body>
<h1>Hello, world!</h1>
<script type="module" src="./frontend.tsx"></script>
</body>
</html>
```
With the following `frontend.tsx`:
```tsx#frontend.tsx
import React from "react";
// import .css files directly and it works
import './index.css';
import { createRoot } from "react-dom/client";
const root = createRoot(document.body);
export default function Frontend() {
return <h1>Hello, world!</h1>;
}
root.render(<Frontend />);
```
Then, run index.ts
```sh
bun --hot ./index.ts
```
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.

16
packages/vfs-ex/.gitattributes vendored Normal file
View File

@ -0,0 +1,16 @@
*.pdf filter=lfs diff=lfs merge=lfs -text
*.igs filter=lfs diff=lfs merge=lfs -text
*.iges filter=lfs diff=lfs merge=lfs -text
*.step filter=lfs diff=lfs merge=lfs -text
SLDASM filter=lfs diff=lfs merge=lfs -text
STEP filter=lfs diff=lfs merge=lfs -text
jpg filter=lfs diff=lfs merge=lfs -text
*.SLDASM filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.SLDPRT filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.x_t filter=lfs diff=lfs merge=lfs -text
*.exe filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text

138
packages/vfs-ex/.gitignore vendored Normal file
View File

@ -0,0 +1,138 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
!/docs/openapi.json
!/data/

View File

@ -0,0 +1,28 @@
# Contributing
Thank you for your interest in improving this boilerplate project!
## How to Contribute
- **Suggestions & Feedback:**
If you have ideas to improve the project, please open a discussion or submit a pull request.
- **Code Improvements:**
Feel free to submit pull requests for code enhancements, documentation updates, or new features.
- **Questions:**
If you have questions about the project, open an issue or start a discussion.
## Guidelines
- Keep changes simple and focused.
- Follow the existing code style and structure.
- Add comments where necessary for clarity.
- For major changes, please open a discussion first.
## Getting Started
1. Fork the repository.
2. Create a new branch for your changes.
3. Make your changes and commit them.
4. Open a pull request with a clear description of your changes.
Thank you for helping make this project better!

21
packages/vfs-ex/LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Alexandre Michaud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

464
packages/vfs-ex/README.md Normal file
View File

@ -0,0 +1,464 @@
# Complete boilerplate with Bun and Hono
Since 2014 I've been building several REST API backends with Node.js, mostly
with Express.js. Over the years, I've learned a lot about how to structure a project
and select the right tools to build a solid foundation for a REST API backend.
More recently, I've been exploring Bun and Hono, which are modern alternatives
to Node.js and Express.js, respectively.
Even though one of Bun's best-selling points is its performance, the main reason
it caught my attention is its tooling and its TypeScript support out of the box.
I've been working for several startups and I give a lot of importance
to [TCO](https://en.wikipedia.org/wiki/Total_cost_of_ownership) and I believe that
Bun can be part of the solution to reduce the TCO of a project.
Consequently, I decided to create a boilerplate that combines Bun and Hono, as
well as other tools that I find useful for building a REST API backend. I try to
keep the complexity as low as possible without sacrificing important aspects like
testing, documentation, security and maintainability.
## Table of Contents
- [Why Bun and Hono?](#why-bun-and-hono)
- [Features](#features)
- [Step-by-Step Installation Guide](#step-by-step-installation-guide)
- [Start the API server](#start-the-api-server)
- [Conclusion](#conclusion)
- [License](#license)
- [Contributing](#contributing)
## Why Bun and Hono?
Bun is a modern JavaScript runtime that is fast and efficient.
It is designed to be a drop-in replacement for Node.js, but with a focus on
performance and developer experience.
Hono is a fast and lightweight web framework that is compatible with Bun.
## Features
This boilerplate should provide a solid foundation for building a REST API
backend with the following features:
- [Bun](https://bun.sh/)
- [Hono](https://hono.dev/)
- TypeScript
- [Biome](https://biomejs.dev/) (Linting and formatting)
- OpenAPI/Swagger
- [Prisma](https://www.prisma.io/) (ORM)
- [Better-Auth](https://www.better-auth.com/) (Authentication)
- [hey-api](https://heyapi.dev/) (Client SDK generation)
- MCP (Model-Context-Protocol) server for LLMs
Both hey-api and MCP server leverage the OpenAPI specs document to generate a
client SDK and a server that can be used to interact with LLMs.
Before going further, keep a tab open to the GitHub repository of this
[boilerplate](https://github.com/alex-michaud/bun-hono-boilerplate). I won't copy
the code of every file here, but for each step I will tell you where to look in
the repository to find the code you need to copy or adapt.
## Step-by-Step Installation Guide
To run this project, you will first need to install the [Bun](https://bun.sh/) runtime.
Bun also comes with a package manager and some utilities that I believe will
simplify the project by having fewer packages to install and maintain.
Step-by-step guide to install Bun, Hono and other dependencies:
### 1. Install [Bun](https://bun.sh/docs/installation)
```bash
curl -fsSL https://bun.sh/install | bash
```
To validate the installation, run:
```bash
bun --version
```
To upgrade, run:
```bash
bun upgrade
```
### 2. Initialize a new Bun project
Create a new directory for your project, navigate into it and run the following
command:
```bash
bun init
```
This will create the following files:
- index.ts
- tsconfig.json
- package.json
### 3. Install [Hono](https://hono.dev/)
Hono is the framework that will be used to build the API. To install it, run the
following command:
```bash
bun add hono
```
### 4. Create a .env file
We will use environment variables to configure the API. Create a `.env` file with
the following command:
```bash
touch .env
```
And add the following content:
```
API_PORT=3000
DATABASE_DIR=./data
BETTER_AUTH_SECRET=better-auth-secret
TRUSTED_ORIGINS=http://localhost:3000
```
### 5. Install [Zod](https://zod.dev)
Zod is a TypeScript-first schema declaration and validation library. It will be
used to validate the data sent to the API.
```bash
bun add zod
```
### 6. Create a config file
The configuration file will be used to load the environment variables.
```bash
mkdir src
touch ./src/config.ts
```
**Copy the content of the `config.ts` file** from this boilerplate repository to
your project. This file will load the environment variables from the `.env` file
and provide a type-safe way to access them throughout the application.
### 7. Import the scripts and prisma config from package.json
From the boilerplate repository, open the `package.json` file and copy the `scripts`
and `prisma` sections to your project's `package.json` file.
### 8. Install Swagger-JSDoc
Swagger-JSDoc is a tool that allows you to generate OpenAPI specs document from
comments in your code.
It is useful for many reasons :
- It allows you to document your API in a standard way.
- It allows other developers to understand your API without having to read the code.
- It allows generating a client SDK for your API. (React, Angular, Vue, etc.)
- It allows generating an MCP (Model-Context-Protocol)
```bash
bun add -d swagger-jsdoc @types/swagger-jsdoc
bun add @hono/swagger-ui
```
Create a `scripts` folder in the root of your project:
```bash
mkdir scripts
```
Then **copy the file `generate-openapi.ts`** from this boilerplate repository to
your project. This script will generate the OpenAPI specs document from the comments
in the code. It uses Swagger-JSDoc to parse the comments and generate the OpenAPI
specs document.
To generate the OpenAPI specs document, you can run the following command:
```bash
bun run openapi
```
This will generate the OpenAPI specs document in the `./docs/openapi.json` file.
### 9. Install [Biome](https://biomejs.dev) *(linting and formatting tool)*
Biome is a modern linting and formatting tool that replaces ESLint and Prettier.
It's easier to use and configure than ESLint and Prettier, and it's also a lot
faster. If you currently use ESLint and Prettier, you can replace them with Biome.
```bash
bun add -D -E @biomejs/biome
```
To generate the configuration file, run:
```bash
bunx --bun biome init
```
This will create a `biome.json` file in the root of your project.
### 10. Install [Pino](https://getpino.io)
Pino is a fast and lightweight logging library.
_[Winston](https://github.com/winstonjs/winston) is also a good option, it has a
better documentation and broader support, but it's also a bit heavier_
```bash
bun add pino pino-pretty
bun add -d @types/pino
```
Create a `src/services/` directory:
```bash
mkdir -p src/services
```
**Copy the file `./src/services/logger.ts`** from this boilerplate
repository to your project.
### 11. Install [Prisma](https://www.prisma.io)
Prisma is a modern ORM that allows you to interact with your database in a
type-safe way. It offers a great migration system, a modern query API and good
documentation.
```bash
bun add -d typescript @types/node
bun add prisma
```
### 12.A. Install [PGLite](https://pglite.dev/) and its [adapter](https://github.com/lucasthevenet/pglite-utils/tree/main/packages/prisma-adapter)
PGLite is a lightweight, file-based database. It's suitable for demo projects
like this one, but not for production use. If you're planning to build a
production-ready application, you should consider using a docker service instead.
A docker service is more similar to what you will use in production. You can
refer to the file `docker-compose.yml` in this repository for an example of how
to set up a Postgres database with Docker.
*skip this step if you plan to use a docker service instead of PGLite.*
Run this command to create the data directory:
```bash
mkdir data
```
Then install the PGLite Prisma adapter and the PGLite database:
```bash
bun add pglite-prisma-adapter
bun add @electric-sql/pglite
```
**Copy the file `prisma.config.ts`** from this boilerplate repository to your
project.
*Note: PGLite is used as an example for this boilerplate. You can replace it
with any other database adapter that is compatible with Prisma.*
### 12.B. Use a Docker Postgresql service
If you prefer to use a Docker service instead of PGLite, you can use the
`docker-compose.yml` file in this repository. To start the Docker service, run:
```bash
docker compose up -d
```
### 13. Initialize Prisma
Create a new directory `src/prisma/`:
```bash
mkdir -p src/prisma
```
Then **copy the file `src/prisma/schema.prisma`** from this boilerplate
repository to your project.
Run the following command to generate the Prisma client:
```bash
bun --env-file=.env prisma generate --schema=./src/prisma/schema.prisma
```
Run the following command to create the database and tables:
```bash
bun --env-file=.env prisma db push --schema=./src/prisma/schema.prisma
```
Finally, **copy the file `src/services/database.ts`** from this boilerplate
repository to your project.
### 14. Install [Better-Auth](https://www.better-auth.com)
Better-Auth is a modern authentication library that provides a simple and secure
way to handle user authentication in your application. There are several
authentication strategies available, such as email/password, social logins and
more. It can do a lot, therefore, I recommend you to check the
[documentation](https://www.better-auth.com/docs) to understand how it works and how to configure it.
```bash
bun add better-auth
mkdir -p src/lib
mkdir -p src/services/error
```
**Copy all the files from `src/services/error/`** from this boilerplate repository
to your project.
Then **copy the file `src/lib/auth.ts`** from this boilerplate repository to
your project.
### 15. Create the API routes
Create a new folder `src/api/`:
```bash
mkdir -p src/api
```
Then **copy all the files from the `api` folder** from the boilerplate repository to
your project.
If you open `src/post.ts` you will see that it is a simple Hono route that
handles the `/post` endpoint.
You will also see that it contains Swagger comments that will be used to generate
the OpenAPI specs document.
Also **copy `src/index.ts` and `src/server.ts` files** from this boilerplate
repository to your project.
To generate the OpenAPI specs document, you can run the following command:
```bash
bun run openapi
```
It will generate the OpenAPI specs document in the `./docs/openapi.json` file.
This document can be used to generate a client SDK or to generate an MCP server
for LLMs.
### 16. Set up the tests
To ensure the quality of your code, it's important to write tests.
First, create a tests folder at the root of your project:
```bash
mkdir tests
```
Now **copy the content of the `tests` folder** from this boilerplate repository.
Then add [faker](https://fakerjs.dev/) package to generate fake data for testing:
```bash
bun add -d @faker-js/faker
```
You can run the tests with the following command:
```bash
bun test
```
Or if you want to run the tests with coverage, you can run:
```bash
bun test --coverage
```
If you want to run tests only for a specific section, like the API tests, you can run:
```bash
bun test ./tests/api
```
### 17. Install [Hey-API](https://heyapi.dev/)
Hey-API is a tool that can generate a client SDK from your OpenAPI specs document.
```bash
bun add -d @hey-api/client-fetch
bun add @hey-api/openapi-ts
```
**Copy the file `openapi-ts.config.ts`** from this boilerplate repository to your project.
Then execute the following command to generate the client SDK:
```bash
bun run openapi:client:hey-api
```
This will generate the client SDK in the `./dist/client/hey-api` folder.
If you want to generate the client SDK for Next.js, refer to this [documentation](https://heyapi.dev/openapi-ts/clients/next-js).
I won't go into the details about how to use the client SDK. Check [Hey-API's](https://heyapi.dev/openapi-ts/get-started)
website for the documentation and examples.
### 18. Start an OpenAPI MCP (Model-Context-Protocol) server for LLMs
[MCP-OpenAPI-server](https://github.com/ivo-toby/mcp-openapi-server)
*Only do this step if you want to run the MCP server for LLMs.*
This MCP server is a simple server that can be used to interact with LLMs (Large Language Models).
It is based on the OpenAPI specs document generated by Swagger-JSDoc.
**Copy the file `start-mcp-server.sh`** from this boilerplate repository to your
project.
You don't need to install anything, run the following command:
```bash
./start-mcp-server.sh
```
This will start the MCP server on port 4000.
I won't go into the details about how to use the MCP server; this is a subject
for another article.
## Start the API server
To start the API server, run the following command:
```bash
bun run dev
```
This will start the server on the port defined in the `.env` file (default is 3000).
You can then access the API at `http://localhost:3000`.
You can also access the Swagger UI at `http://localhost:3000/docs` to see the
API documentation and test the endpoints.
## Conclusion
I will continue to improve this boilerplate over time. I'm planning to use it
as a base for my future projects. Feel free to use it as you wish, and if you
have any suggestions or improvements, please open an issue or a pull request on
the [GitHub repository](https://github.com/alex-michaud/bun-hono-boilerplate/issues).
## License
This project is licensed under the MIT License
See the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to this project.

View File

@ -0,0 +1,48 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": [
"dist",
"node_modules",
"data",
"bun.lock"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"bracketSpacing": true
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"complexity": {
"noExcessiveCognitiveComplexity": "warn"
},
"correctness": {
"noUnusedVariables": "warn"
},
"style": {
"noVar": "error",
"useConst": "error"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}

2819
packages/vfs-ex/bun.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
17

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

View File

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

View File

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More