@fml-inc/fml 0.2.0 → 0.3.0

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.
@@ -3,8 +3,8 @@ import {
3
3
  handleStop,
4
4
  isSyncRunning,
5
5
  parsePanopticonRunning
6
- } from "./chunk-NFC24I3N.js";
7
- import "./chunk-ZKHH6EYQ.js";
6
+ } from "./chunk-CFPXJT5Q.js";
7
+ import "./chunk-MUKYS4IB.js";
8
8
  import "./chunk-4YEAQJPF.js";
9
9
  import "./chunk-PZ5AY32C.js";
10
10
  export {
@@ -13,4 +13,4 @@ export {
13
13
  isSyncRunning,
14
14
  parsePanopticonRunning
15
15
  };
16
- //# sourceMappingURL=daemon-WXE6FYZD.js.map
16
+ //# sourceMappingURL=daemon-GM3WNS4Z.js.map
@@ -4,7 +4,7 @@ import {
4
4
  isDaemonRunning,
5
5
  panopticonExec,
6
6
  resolvePanopticonBin
7
- } from "./chunk-ZKHH6EYQ.js";
7
+ } from "./chunk-MUKYS4IB.js";
8
8
  import "./chunk-4YEAQJPF.js";
9
9
  import "./chunk-PZ5AY32C.js";
10
10
  export {
@@ -14,4 +14,4 @@ export {
14
14
  panopticonExec,
15
15
  resolvePanopticonBin
16
16
  };
17
- //# sourceMappingURL=daemon-utils-EUOTVCKL.js.map
17
+ //# sourceMappingURL=daemon-utils-CJO4XVJQ.js.map
@@ -14,8 +14,8 @@ import {
14
14
  } from "../chunk-CUBBYHH7.js";
15
15
  import {
16
16
  parsePanopticonRunning
17
- } from "../chunk-NFC24I3N.js";
18
- import "../chunk-ZKHH6EYQ.js";
17
+ } from "../chunk-CFPXJT5Q.js";
18
+ import "../chunk-MUKYS4IB.js";
19
19
  import {
20
20
  FML_DATA_DIR,
21
21
  FML_LOG_DIR
@@ -499,7 +499,7 @@ async function main() {
499
499
  await server.connect(transport);
500
500
  if (!parsePanopticonRunning()) {
501
501
  try {
502
- const { handleStart } = await import("../daemon-WXE6FYZD.js");
502
+ const { handleStart } = await import("../daemon-GM3WNS4Z.js");
503
503
  await handleStart();
504
504
  } catch {
505
505
  console.error(
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
  var __dirname = dirname(fileURLToPath(import.meta.url));
8
8
  var fmlBin = join(__dirname, "..", "bin", "fml");
9
9
  try {
10
- execFileSync("node", [fmlBin, "install"], {
10
+ execFileSync(process.execPath, [fmlBin, "install"], {
11
11
  stdio: "inherit",
12
12
  timeout: 12e4
13
13
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/postinstall.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Lightweight postinstall — runs `fml install` to set up fml-specific\n * config (directories, marketplace, plugin cache, sync target).\n *\n * Panopticon setup is handled by @fml-inc/panopticon's own postinstall\n * which npm runs automatically as a dependency.\n */\nimport { execFileSync } from \"node:child_process\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst fmlBin = join(__dirname, \"..\", \"bin\", \"fml\");\n\ntry {\n execFileSync(\"node\", [fmlBin, \"install\"], {\n stdio: \"inherit\",\n timeout: 120_000,\n });\n} catch {\n // fml install failed — not fatal for postinstall\n}\n"],"mappings":";;;AAQA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,IAAM,SAAS,KAAK,WAAW,MAAM,OAAO,KAAK;AAEjD,IAAI;AACF,eAAa,QAAQ,CAAC,QAAQ,SAAS,GAAG;AAAA,IACxC,OAAO;AAAA,IACP,SAAS;AAAA,EACX,CAAC;AACH,QAAQ;AAER;","names":[]}
1
+ {"version":3,"sources":["../src/postinstall.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Lightweight postinstall — runs `fml install` to set up fml-specific\n * config (directories, marketplace, plugin cache, sync target).\n *\n * Panopticon setup is handled by @fml-inc/panopticon's own postinstall\n * which npm runs automatically as a dependency.\n */\nimport { execFileSync } from \"node:child_process\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst fmlBin = join(__dirname, \"..\", \"bin\", \"fml\");\n\ntry {\n execFileSync(process.execPath, [fmlBin, \"install\"], {\n stdio: \"inherit\",\n timeout: 120_000,\n });\n} catch {\n // fml install failed — not fatal for postinstall\n}\n"],"mappings":";;;AAQA,SAAS,oBAAoB;AAC7B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,IAAM,SAAS,KAAK,WAAW,MAAM,OAAO,KAAK;AAEjD,IAAI;AACF,eAAa,QAAQ,UAAU,CAAC,QAAQ,SAAS,GAAG;AAAA,IAClD,OAAO;AAAA,IACP,SAAS;AAAA,EACX,CAAC;AACH,QAAQ;AAER;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fml-inc/fml",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "FML agent tools for Claude Code",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -22,6 +22,7 @@
22
22
  "files": [
23
23
  "bin/",
24
24
  "dist/",
25
+ "scripts/postinstall.cjs",
25
26
  ".claude-plugin/"
26
27
  ],
27
28
  "scripts": {
@@ -29,7 +30,7 @@
29
30
  "dev": "tsup --watch",
30
31
  "prepack": "node scripts/generate-plugin-manifest.js",
31
32
  "pack:local": "pnpm build && pnpm pack",
32
- "postinstall": "[ ! -d dist ] || (node ./dist/postinstall.js && (claude plugin install fml@local-plugins 2>/dev/null || claude plugin update fml@local-plugins || echo 'warn: claude CLI not found, run claude plugin install fml@local-plugins manually'))",
33
+ "postinstall": "node scripts/postinstall.cjs",
33
34
  "type-check": "tsc --noEmit",
34
35
  "test": "vitest run",
35
36
  "test:watch": "vitest"
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ // Cross-platform npm/pnpm postinstall entry. The bash form
3
+ // `[ ! -d dist ] || (node ./dist/postinstall.js && ...)` doesn't work on
4
+ // Windows cmd.exe, so we do the existence check in Node.
5
+ //
6
+ // dist/postinstall.js → calls `fml install`, which handles claude plugin
7
+ // registration. No need to invoke `claude` again from here.
8
+ const fs = require("node:fs");
9
+ const path = require("node:path");
10
+ const { execFileSync } = require("node:child_process");
11
+
12
+ const distEntry = path.resolve(__dirname, "..", "dist", "postinstall.js");
13
+ if (!fs.existsSync(distEntry)) {
14
+ // Source repo before first build — nothing to do.
15
+ process.exit(0);
16
+ }
17
+
18
+ try {
19
+ execFileSync(process.execPath, [distEntry], {
20
+ stdio: "inherit",
21
+ timeout: 120_000,
22
+ });
23
+ } catch {
24
+ // Best-effort: never fail install over a postinstall hook.
25
+ }
@@ -1,61 +0,0 @@
1
- import {
2
- FML_DATA_DIR,
3
- FML_LOG_DIR
4
- } from "./chunk-4YEAQJPF.js";
5
-
6
- // src/daemon-utils.ts
7
- import fs from "fs";
8
- import path from "path";
9
- import { execFileSync } from "child_process";
10
- var SYNC_PID_FILE = path.join(FML_DATA_DIR, "sync.pid");
11
- var SYNC_LOG_FILE = path.join(FML_LOG_DIR, "sync.log");
12
- function isDaemonRunning(pidFile) {
13
- if (!fs.existsSync(pidFile)) return { running: false, pid: null };
14
- const pid = parseInt(fs.readFileSync(pidFile, "utf-8").trim(), 10);
15
- try {
16
- process.kill(pid, 0);
17
- return { running: true, pid };
18
- } catch {
19
- return { running: false, pid };
20
- }
21
- }
22
- function resolvePanopticonBin() {
23
- try {
24
- const result = execFileSync("which", ["panopticon"], {
25
- encoding: "utf-8",
26
- timeout: 5e3
27
- }).trim();
28
- if (result) return result;
29
- } catch {
30
- }
31
- return null;
32
- }
33
- function panopticonExec(...argsAndOpts) {
34
- let timeout = 1e4;
35
- const args = [];
36
- for (const a of argsAndOpts) {
37
- if (typeof a === "string") args.push(a);
38
- else timeout = a.timeout ?? timeout;
39
- }
40
- const bin = resolvePanopticonBin();
41
- if (!bin) return { ok: false, stdout: "panopticon binary not found" };
42
- try {
43
- const stdout = execFileSync(bin, args, {
44
- encoding: "utf-8",
45
- timeout
46
- });
47
- return { ok: true, stdout };
48
- } catch (err) {
49
- const e = err;
50
- return { ok: false, stdout: (e.stdout ?? "") + (e.stderr ?? "") };
51
- }
52
- }
53
-
54
- export {
55
- SYNC_PID_FILE,
56
- SYNC_LOG_FILE,
57
- isDaemonRunning,
58
- resolvePanopticonBin,
59
- panopticonExec
60
- };
61
- //# sourceMappingURL=chunk-ZKHH6EYQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/daemon-utils.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { execFileSync } from \"node:child_process\";\nimport { FML_DATA_DIR, FML_LOG_DIR } from \"./dirs.js\";\n\nexport const SYNC_PID_FILE = path.join(FML_DATA_DIR, \"sync.pid\");\nexport const SYNC_LOG_FILE = path.join(FML_LOG_DIR, \"sync.log\");\n\nexport function isDaemonRunning(pidFile: string): {\n running: boolean;\n pid: number | null;\n} {\n if (!fs.existsSync(pidFile)) return { running: false, pid: null };\n const pid = parseInt(fs.readFileSync(pidFile, \"utf-8\").trim(), 10);\n try {\n process.kill(pid, 0);\n return { running: true, pid };\n } catch {\n return { running: false, pid };\n }\n}\n\n/** Resolve the panopticon CLI binary from PATH (globally installed). */\nexport function resolvePanopticonBin(): string | null {\n try {\n const result = execFileSync(\"which\", [\"panopticon\"], {\n encoding: \"utf-8\",\n timeout: 5_000,\n }).trim();\n if (result) return result;\n } catch {}\n\n return null;\n}\n\n/** Run a panopticon CLI command and return stdout. */\nexport function panopticonExec(...args: string[]): {\n ok: boolean;\n stdout: string;\n};\nexport function panopticonExec(\n ...argsAndOpts: [...string[], { timeout?: number }]\n): { ok: boolean; stdout: string };\nexport function panopticonExec(\n ...argsAndOpts: Array<string | { timeout?: number }>\n): {\n ok: boolean;\n stdout: string;\n} {\n let timeout = 10_000;\n const args: string[] = [];\n for (const a of argsAndOpts) {\n if (typeof a === \"string\") args.push(a);\n else timeout = a.timeout ?? timeout;\n }\n const bin = resolvePanopticonBin();\n if (!bin) return { ok: false, stdout: \"panopticon binary not found\" };\n try {\n const stdout = execFileSync(bin, args, {\n encoding: \"utf-8\",\n timeout,\n });\n return { ok: true, stdout };\n } catch (err: unknown) {\n const e = err as { stdout?: string; stderr?: string; status?: number };\n return { ok: false, stdout: (e.stdout ?? \"\") + (e.stderr ?? \"\") };\n }\n}\n"],"mappings":";;;;;;AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,oBAAoB;AAGtB,IAAM,gBAAgB,KAAK,KAAK,cAAc,UAAU;AACxD,IAAM,gBAAgB,KAAK,KAAK,aAAa,UAAU;AAEvD,SAAS,gBAAgB,SAG9B;AACA,MAAI,CAAC,GAAG,WAAW,OAAO,EAAG,QAAO,EAAE,SAAS,OAAO,KAAK,KAAK;AAChE,QAAM,MAAM,SAAS,GAAG,aAAa,SAAS,OAAO,EAAE,KAAK,GAAG,EAAE;AACjE,MAAI;AACF,YAAQ,KAAK,KAAK,CAAC;AACnB,WAAO,EAAE,SAAS,MAAM,IAAI;AAAA,EAC9B,QAAQ;AACN,WAAO,EAAE,SAAS,OAAO,IAAI;AAAA,EAC/B;AACF;AAGO,SAAS,uBAAsC;AACpD,MAAI;AACF,UAAM,SAAS,aAAa,SAAS,CAAC,YAAY,GAAG;AAAA,MACnD,UAAU;AAAA,MACV,SAAS;AAAA,IACX,CAAC,EAAE,KAAK;AACR,QAAI,OAAQ,QAAO;AAAA,EACrB,QAAQ;AAAA,EAAC;AAET,SAAO;AACT;AAUO,SAAS,kBACX,aAIH;AACA,MAAI,UAAU;AACd,QAAM,OAAiB,CAAC;AACxB,aAAW,KAAK,aAAa;AAC3B,QAAI,OAAO,MAAM,SAAU,MAAK,KAAK,CAAC;AAAA,QACjC,WAAU,EAAE,WAAW;AAAA,EAC9B;AACA,QAAM,MAAM,qBAAqB;AACjC,MAAI,CAAC,IAAK,QAAO,EAAE,IAAI,OAAO,QAAQ,8BAA8B;AACpE,MAAI;AACF,UAAM,SAAS,aAAa,KAAK,MAAM;AAAA,MACrC,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AACD,WAAO,EAAE,IAAI,MAAM,OAAO;AAAA,EAC5B,SAAS,KAAc;AACrB,UAAM,IAAI;AACV,WAAO,EAAE,IAAI,OAAO,SAAS,EAAE,UAAU,OAAO,EAAE,UAAU,IAAI;AAAA,EAClE;AACF;","names":[]}