@hasna/configs 0.2.17 → 0.2.19

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;AAsRA,wBAAgE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;;;;AAkSA,wBAAgE"}
@@ -2495,6 +2495,7 @@ function detectFormat(filePath) {
2495
2495
  }
2496
2496
 
2497
2497
  // src/server/index.ts
2498
+ import { createRequire } from "module";
2498
2499
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
2499
2500
  import { join as join4, extname as extname2 } from "path";
2500
2501
  var PORT = Number(process.env["CONFIGS_PORT"] ?? 3457);
@@ -2608,8 +2609,10 @@ app.post("/api/configs/:id/snapshot", async (c) => {
2608
2609
  });
2609
2610
  app.get("/api/configs/:id/snapshots", (c) => {
2610
2611
  try {
2612
+ const { fields } = c.req.query();
2611
2613
  const config = getConfig(c.req.param("id"));
2612
- return c.json(listSnapshots(config.id));
2614
+ const snaps = listSnapshots(config.id);
2615
+ return c.json(fields ? snaps.map((s) => pickFields(s, fields)) : snaps);
2613
2616
  } catch {
2614
2617
  return c.json({ error: "Not found" }, 404);
2615
2618
  }
@@ -2631,7 +2634,11 @@ app.post("/api/sync", async (c) => {
2631
2634
  return c.json({ error: e instanceof Error ? e.message : String(e) }, 422);
2632
2635
  }
2633
2636
  });
2634
- app.get("/api/profiles", (c) => c.json(listProfiles()));
2637
+ app.get("/api/profiles", (c) => {
2638
+ const { fields } = c.req.query();
2639
+ const profiles = listProfiles();
2640
+ return c.json(fields ? profiles.map((p) => pickFields(p, fields)) : profiles);
2641
+ });
2635
2642
  app.post("/api/profiles", async (c) => {
2636
2643
  try {
2637
2644
  const body = await c.req.json();
@@ -2677,7 +2684,11 @@ app.post("/api/profiles/:id/apply", async (c) => {
2677
2684
  return c.json({ error: e instanceof Error ? e.message : String(e) }, 422);
2678
2685
  }
2679
2686
  });
2680
- app.get("/api/machines", (c) => c.json(listMachines()));
2687
+ app.get("/api/machines", (c) => {
2688
+ const { fields } = c.req.query();
2689
+ const machines = listMachines();
2690
+ return c.json(fields ? machines.map((m) => pickFields(m, fields)) : machines);
2691
+ });
2681
2692
  app.post("/api/machines", async (c) => {
2682
2693
  try {
2683
2694
  const body = await c.req.json().catch(() => ({}));
@@ -2687,7 +2698,8 @@ app.post("/api/machines", async (c) => {
2687
2698
  return c.json({ error: e instanceof Error ? e.message : String(e) }, 422);
2688
2699
  }
2689
2700
  });
2690
- app.get("/health", (c) => c.json({ ok: true, version: "0.1.5" }));
2701
+ var serverPkg = createRequire(import.meta.url)("../../package.json");
2702
+ app.get("/health", (c) => c.json({ ok: true, version: serverPkg.version }));
2691
2703
  var MIME = { ".html": "text/html", ".js": "application/javascript", ".css": "text/css", ".json": "application/json", ".svg": "image/svg+xml", ".png": "image/png", ".ico": "image/x-icon" };
2692
2704
  function findDashboardDir() {
2693
2705
  const candidates = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/configs",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "AI coding agent configuration manager — store, version, apply, and share all your AI coding configs. CLI + MCP + REST API + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",