@hasna/configs 0.2.23 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
package/dist/cli/index.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
package/dist/mcp/index.js CHANGED
@@ -1,29 +1,18 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var __create = Object.create;
4
- var __getProtoOf = Object.getPrototypeOf;
5
3
  var __defProp = Object.defineProperty;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __toESM = (mod, isNodeMode, target) => {
9
- target = mod != null ? __create(__getProtoOf(mod)) : {};
10
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
- for (let key of __getOwnPropNames(mod))
12
- if (!__hasOwnProp.call(to, key))
13
- __defProp(to, key, {
14
- get: () => mod[key],
15
- enumerable: true
16
- });
17
- return to;
18
- };
19
4
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
5
+ var __returnValue = (v) => v;
6
+ function __exportSetter(name, newValue) {
7
+ this[name] = __returnValue.bind(null, newValue);
8
+ }
20
9
  var __export = (target, all) => {
21
10
  for (var name in all)
22
11
  __defProp(target, name, {
23
12
  get: all[name],
24
13
  enumerable: true,
25
14
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
15
+ set: __exportSetter.bind(all, name)
27
16
  });
28
17
  };
29
18
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -177,6 +166,16 @@ var init_database = __esm(() => {
177
166
  });
178
167
 
179
168
  // src/db/configs.ts
169
+ var exports_configs = {};
170
+ __export(exports_configs, {
171
+ updateConfig: () => updateConfig,
172
+ listConfigs: () => listConfigs,
173
+ getConfigStats: () => getConfigStats,
174
+ getConfigById: () => getConfigById,
175
+ getConfig: () => getConfig,
176
+ deleteConfig: () => deleteConfig,
177
+ createConfig: () => createConfig
178
+ });
180
179
  function rowToConfig(row) {
181
180
  return {
182
181
  ...row,
@@ -327,6 +326,11 @@ function updateConfig(idOrSlug, input, db) {
327
326
  d.run(`UPDATE configs SET ${updates.join(", ")} WHERE id = ?`, params);
328
327
  return getConfigById(existing.id, d);
329
328
  }
329
+ function deleteConfig(idOrSlug, db) {
330
+ const d = db || getDatabase();
331
+ const existing = getConfig(idOrSlug, d);
332
+ d.run("DELETE FROM configs WHERE id = ?", [existing.id]);
333
+ }
330
334
  function getConfigStats(db) {
331
335
  const d = db || getDatabase();
332
336
  const rows = d.query("SELECT category, COUNT(*) as count FROM configs GROUP BY category").all();
@@ -997,7 +1001,7 @@ var init_sync = __esm(() => {
997
1001
  var require_package = __commonJS((exports, module) => {
998
1002
  module.exports = {
999
1003
  name: "@hasna/configs",
1000
- version: "0.2.23",
1004
+ version: "0.2.25",
1001
1005
  description: "AI coding agent configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + REST API + Dashboard.",
1002
1006
  type: "module",
1003
1007
  main: "dist/index.js",
@@ -1200,6 +1204,7 @@ var ALL_LEAN_TOOLS = [
1200
1204
  { name: "get_config", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" } }, required: ["id_or_slug"] } },
1201
1205
  { name: "create_config", inputSchema: { type: "object", properties: { name: { type: "string" }, content: { type: "string" }, category: { type: "string" }, agent: { type: "string" }, target_path: { type: "string" }, kind: { type: "string" }, format: { type: "string" }, tags: { type: "array", items: { type: "string" } }, description: { type: "string" }, is_template: { type: "boolean" } }, required: ["name", "content", "category"] } },
1202
1206
  { name: "update_config", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" }, content: { type: "string" }, name: { type: "string" }, tags: { type: "array", items: { type: "string" } }, description: { type: "string" }, category: { type: "string" }, agent: { type: "string" }, target_path: { type: "string" } }, required: ["id_or_slug"] } },
1207
+ { name: "delete_config", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" } }, required: ["id_or_slug"] } },
1203
1208
  { name: "apply_config", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" }, dry_run: { type: "boolean" } }, required: ["id_or_slug"] } },
1204
1209
  { name: "sync_directory", inputSchema: { type: "object", properties: { dir: { type: "string" }, direction: { type: "string" } }, required: ["dir"] } },
1205
1210
  { name: "list_profiles", inputSchema: { type: "object", properties: {} } },
@@ -1211,7 +1216,10 @@ var ALL_LEAN_TOOLS = [
1211
1216
  { name: "render_template", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" }, vars: { type: "object" }, use_env: { type: "boolean" } }, required: ["id_or_slug"] } },
1212
1217
  { name: "scan_secrets", inputSchema: { type: "object", properties: { id_or_slug: { type: "string" }, fix: { type: "boolean" } } } },
1213
1218
  { name: "search_tools", inputSchema: { type: "object", properties: { query: { type: "string" } }, required: ["query"] } },
1214
- { name: "describe_tools", inputSchema: { type: "object", properties: { names: { type: "array", items: { type: "string" } } } } }
1219
+ { name: "describe_tools", inputSchema: { type: "object", properties: { names: { type: "array", items: { type: "string" } } } } },
1220
+ { name: "register_agent", description: "Register agent session.", inputSchema: { type: "object", properties: { name: { type: "string" }, session_id: { type: "string" } }, required: ["name"] } },
1221
+ { name: "heartbeat", description: "Update last_seen_at.", inputSchema: { type: "object", properties: { agent_id: { type: "string" } }, required: ["agent_id"] } },
1222
+ { name: "set_focus", description: "Set active project context.", inputSchema: { type: "object", properties: { agent_id: { type: "string" }, project_id: { type: "string" } }, required: ["agent_id"] } }
1215
1223
  ];
1216
1224
  function ok(data) {
1217
1225
  return { content: [{ type: "text", text: JSON.stringify(data) }] };
@@ -1219,6 +1227,7 @@ function ok(data) {
1219
1227
  function err(msg) {
1220
1228
  return { content: [{ type: "text", text: JSON.stringify({ error: msg }) }], isError: true };
1221
1229
  }
1230
+ var _cfgAgents = new Map;
1222
1231
  var server = new Server({ name: "configs", version: require_package().version }, { capabilities: { tools: {} } });
1223
1232
  var LEAN_TOOLS = profileFilter && profileFilter.length > 0 ? ALL_LEAN_TOOLS.filter((t) => profileFilter.includes(t.name)) : ALL_LEAN_TOOLS;
1224
1233
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: LEAN_TOOLS }));
@@ -1266,6 +1275,11 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
1266
1275
  });
1267
1276
  return ok({ id: c.id, slug: c.slug, version: c.version });
1268
1277
  }
1278
+ case "delete_config": {
1279
+ const { deleteConfig: deleteConfig2 } = await Promise.resolve().then(() => (init_configs(), exports_configs));
1280
+ deleteConfig2(args["id_or_slug"]);
1281
+ return ok({ deleted: true });
1282
+ }
1269
1283
  case "apply_config": {
1270
1284
  const config = getConfig(args["id_or_slug"]);
1271
1285
  const result = await applyConfig(config, { dryRun: args["dry_run"] });
@@ -1387,6 +1401,32 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
1387
1401
  }
1388
1402
  return ok(TOOL_DOCS);
1389
1403
  }
1404
+ case "register_agent": {
1405
+ const n = String(args["name"] ?? "");
1406
+ const existing = [..._cfgAgents.values()].find((x) => x.name === n);
1407
+ if (existing) {
1408
+ existing.last_seen_at = new Date().toISOString();
1409
+ return ok(existing);
1410
+ }
1411
+ const id = Math.random().toString(36).slice(2, 10);
1412
+ const ag = { id, name: n, last_seen_at: new Date().toISOString() };
1413
+ _cfgAgents.set(id, ag);
1414
+ return ok(ag);
1415
+ }
1416
+ case "heartbeat": {
1417
+ const ag = _cfgAgents.get(String(args["agent_id"] ?? ""));
1418
+ if (!ag)
1419
+ return err(`Agent not found: ${args["agent_id"]}`);
1420
+ ag.last_seen_at = new Date().toISOString();
1421
+ return ok({ agent_id: ag.id, name: ag.name, last_seen_at: ag.last_seen_at });
1422
+ }
1423
+ case "set_focus": {
1424
+ const ag = _cfgAgents.get(String(args["agent_id"] ?? ""));
1425
+ if (!ag)
1426
+ return err(`Agent not found: ${args["agent_id"]}`);
1427
+ ag["project_id"] = args["project_id"];
1428
+ return ok({ agent_id: ag.id, project_id: args["project_id"] ?? null });
1429
+ }
1390
1430
  default:
1391
1431
  return err(`Unknown tool: ${name}`);
1392
1432
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;AAkSA,wBAAgE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;AAsVA,wBAAgE"}