@usefillo/cli 0.23.0 → 0.23.1

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.
Files changed (2) hide show
  1. package/dist/index.js +47 -22
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,17 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { readFileSync as readFileSync4 } from "fs";
4
+ import { readFileSync as readFileSync5 } from "fs";
5
+
6
+ // src/lib/client-telemetry.ts
7
+ import { readFileSync } from "fs";
8
+ var command;
9
+ var version = "0.0.0";
10
+ try {
11
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
12
+ if (typeof pkg.version === "string") version = pkg.version;
13
+ } catch {
14
+ }
15
+ function setClientCommand(name) {
16
+ command = name;
17
+ }
18
+ function clientTelemetryHeaders() {
19
+ return {
20
+ "X-Fillo-Client": `@usefillo/cli@${version}`,
21
+ ...command ? { "X-Fillo-Command": command } : {}
22
+ };
23
+ }
5
24
 
6
25
  // src/lib/config.ts
7
- import { chmodSync, mkdirSync, readFileSync, writeFileSync } from "fs";
26
+ import { chmodSync, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
8
27
  import { homedir } from "os";
9
28
  import { join } from "path";
10
29
  var CONFIG_DIR = join(homedir(), ".fillo");
11
30
  var CONFIG_PATH = join(CONFIG_DIR, "config.json");
12
31
  function readConfig() {
13
32
  try {
14
- const parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf8"));
33
+ const parsed = JSON.parse(readFileSync2(CONFIG_PATH, "utf8"));
15
34
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
16
35
  const record2 = parsed;
17
36
  return {
@@ -148,6 +167,7 @@ async function api(path, init2 = {}, apiBase = API) {
148
167
  signal: rest.signal ?? AbortSignal.timeout(REQUEST_TIMEOUT_MS),
149
168
  headers: {
150
169
  "Content-Type": "application/json",
170
+ ...clientTelemetryHeaders(),
151
171
  ...token ? { Authorization: `Bearer ${token}` } : {},
152
172
  ...rest.headers
153
173
  }
@@ -232,10 +252,10 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
232
252
  var BOOLISH_FLAGS = /* @__PURE__ */ new Set(["include-abandoned"]);
233
253
  var CONFIRM_FLAGS = /* @__PURE__ */ new Set(["confirm"]);
234
254
  var GLOBAL_FLAGS = /* @__PURE__ */ new Set(["help", "h", "json", "version", "v"]);
235
- function validateFlags(command, flags, commandFlags) {
255
+ function validateFlags(command2, flags, commandFlags) {
236
256
  const allowed = /* @__PURE__ */ new Set([...GLOBAL_FLAGS, ...commandFlags ?? []]);
237
257
  for (const [key, value] of Object.entries(flags)) {
238
- if (!allowed.has(key)) die(`Unknown flag for ${command ?? "fillo"}: --${key}`);
258
+ if (!allowed.has(key)) die(`Unknown flag for ${command2 ?? "fillo"}: --${key}`);
239
259
  if (BOOLEAN_FLAGS.has(key)) {
240
260
  if (value !== true) die(`--${key} does not take a value.`);
241
261
  } else if (BOOLISH_FLAGS.has(key)) {
@@ -1098,7 +1118,7 @@ import {
1098
1118
  lstatSync,
1099
1119
  mkdirSync as mkdirSync2,
1100
1120
  readdirSync,
1101
- readFileSync as readFileSync2,
1121
+ readFileSync as readFileSync3,
1102
1122
  realpathSync,
1103
1123
  renameSync,
1104
1124
  rmSync
@@ -1172,7 +1192,7 @@ function sameSkillBundle(source, target) {
1172
1192
  const targetFiles = skillFiles(target);
1173
1193
  if (sourceFiles.length !== targetFiles.length) return false;
1174
1194
  return sourceFiles.every(
1175
- (file, index) => file === targetFiles[index] && readFileSync2(join3(source, file)).equals(readFileSync2(join3(target, file)))
1195
+ (file, index) => file === targetFiles[index] && readFileSync3(join3(source, file)).equals(readFileSync3(join3(target, file)))
1176
1196
  );
1177
1197
  } catch {
1178
1198
  return false;
@@ -1190,7 +1210,7 @@ function pathEntryExists(path) {
1190
1210
  var MANAGED_SKILL_MARKER = ".fillo-managed.json";
1191
1211
  function isCliManagedFilloSkill(target) {
1192
1212
  try {
1193
- const marker = JSON.parse(readFileSync2(join3(target, MANAGED_SKILL_MARKER), "utf8"));
1213
+ const marker = JSON.parse(readFileSync3(join3(target, MANAGED_SKILL_MARKER), "utf8"));
1194
1214
  return marker.managedBy === "@usefillo/cli" && marker.skill === "build-with-fillo" && marker.format === 1 && marker.allowAutomaticUpdates === true;
1195
1215
  } catch {
1196
1216
  return false;
@@ -1487,6 +1507,7 @@ async function postAgentEvent(apiBase, run, token, body) {
1487
1507
  res = await fetch(`${apiBase}/api/v1/agent-runs/${encodeURIComponent(run)}/events`, {
1488
1508
  method: "POST",
1489
1509
  headers: {
1510
+ ...clientTelemetryHeaders(),
1490
1511
  Authorization: `Bearer ${token}`,
1491
1512
  "Content-Type": "application/json"
1492
1513
  },
@@ -1507,6 +1528,7 @@ async function attachAgentAccount(apiBase, run, progressToken) {
1507
1528
  method: "POST",
1508
1529
  redirect: "error",
1509
1530
  headers: {
1531
+ ...clientTelemetryHeaders(),
1510
1532
  Authorization: `Bearer ${accountToken}`,
1511
1533
  "X-Fillo-Agent-Run-Token": progressToken
1512
1534
  },
@@ -3183,7 +3205,7 @@ var insightsCommand = {
3183
3205
  };
3184
3206
 
3185
3207
  // src/commands/forms.ts
3186
- import { readFileSync as readFileSync3 } from "fs";
3208
+ import { readFileSync as readFileSync4 } from "fs";
3187
3209
  import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
3188
3210
  import { pathToFileURL } from "url";
3189
3211
 
@@ -3640,7 +3662,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
3640
3662
  });
3641
3663
 
3642
3664
  // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
3643
- var version = {
3665
+ var version2 = {
3644
3666
  major: 4,
3645
3667
  minor: 4,
3646
3668
  patch: 3
@@ -3652,7 +3674,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
3652
3674
  inst ?? (inst = {});
3653
3675
  inst._zod.def = def;
3654
3676
  inst._zod.bag = inst._zod.bag || {};
3655
- inst._zod.version = version;
3677
+ inst._zod.version = version2;
3656
3678
  const checks = [...inst._zod.def.checks ?? []];
3657
3679
  if (inst._zod.traits.has("$ZodCheck")) {
3658
3680
  checks.unshift(inst);
@@ -4689,7 +4711,7 @@ var schemaShape = object({
4689
4711
  });
4690
4712
  var MAX_SCHEMA_VERSION = 1;
4691
4713
  var FILLO_SCHEMA_VERSION = 1;
4692
- var FILLO_SDK_VERSION = true ? "0.23.0" : "0.0.0-dev";
4714
+ var FILLO_SDK_VERSION = true ? "0.23.1" : "0.0.0-dev";
4693
4715
  function str(value, max, fallback = "") {
4694
4716
  return typeof value === "string" ? value.trim().slice(0, max) : fallback;
4695
4717
  }
@@ -5664,7 +5686,7 @@ async function loadResponseData(file) {
5664
5686
  die("Test response data must be a .json file (or - for JSON on stdin).");
5665
5687
  }
5666
5688
  try {
5667
- value = JSON.parse(readFileSync3(abs, "utf8"));
5689
+ value = JSON.parse(readFileSync4(abs, "utf8"));
5668
5690
  } catch (error) {
5669
5691
  die(`Couldn't read ${file}: ${error.message}`);
5670
5692
  }
@@ -5746,7 +5768,7 @@ async function loadSchema(file, allowCode) {
5746
5768
  }
5747
5769
  try {
5748
5770
  if (abs.endsWith(".json")) {
5749
- const parsed = JSON.parse(readFileSync3(abs, "utf8"));
5771
+ const parsed = JSON.parse(readFileSync4(abs, "utf8"));
5750
5772
  if (parsed == null) die(`${file} is empty \u2014 it must contain a form schema.`);
5751
5773
  return parsed;
5752
5774
  }
@@ -9157,13 +9179,13 @@ var REGISTRY = [
9157
9179
  deleteCommand
9158
9180
  ];
9159
9181
  var COMMANDS = /* @__PURE__ */ new Map();
9160
- for (const command of REGISTRY) {
9161
- COMMANDS.set(command.name, command);
9162
- for (const alias of command.aliases ?? []) COMMANDS.set(alias, command);
9182
+ for (const command2 of REGISTRY) {
9183
+ COMMANDS.set(command2.name, command2);
9184
+ for (const alias of command2.aliases ?? []) COMMANDS.set(alias, command2);
9163
9185
  }
9164
9186
  function printVersion() {
9165
9187
  try {
9166
- const pkg = JSON.parse(readFileSync4(new URL("../package.json", import.meta.url), "utf8"));
9188
+ const pkg = JSON.parse(readFileSync5(new URL("../package.json", import.meta.url), "utf8"));
9167
9189
  console.log(pkg.version);
9168
9190
  } catch {
9169
9191
  console.log("unknown");
@@ -9266,18 +9288,21 @@ async function main() {
9266
9288
  const [cmd, ...rest] = process.argv.slice(2);
9267
9289
  const { positional, flags } = parseFlags(rest);
9268
9290
  if (flags.json === true) enableJsonOutput();
9269
- const command = cmd ? COMMANDS.get(cmd) : void 0;
9270
- validateFlags(cmd, flags, command?.flags);
9291
+ const command2 = cmd ? COMMANDS.get(cmd) : void 0;
9292
+ validateFlags(cmd, flags, command2?.flags);
9271
9293
  if (cmd === "version" || cmd === "--version" || cmd === "-v" || flags.version === true || flags.v === true) {
9272
9294
  return printVersion();
9273
9295
  }
9274
9296
  if (flags.help === true || flags.h === true) {
9275
- return (command?.help ?? help)();
9297
+ return (command2?.help ?? help)();
9276
9298
  }
9277
9299
  if (cmd === void 0 || cmd === "help" || cmd === "--help" || cmd === "-h") {
9278
9300
  return help();
9279
9301
  }
9280
- if (command) return command.run(positional, flags);
9302
+ if (command2) {
9303
+ setClientCommand(command2.name);
9304
+ return command2.run(positional, flags);
9305
+ }
9281
9306
  console.error(`Unknown command: ${terminalText(cmd)}`);
9282
9307
  help();
9283
9308
  return process.exit(2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usefillo/cli",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "description": "Create and publish Fillo forms, and install the Fillo Agent Skill.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  "@types/node": "^22.10.0",
35
35
  "tsup": "^8.4.0",
36
36
  "typescript": "^5.8.3",
37
- "@usefillo/core": "0.23.0"
37
+ "@usefillo/core": "0.23.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsup && node scripts/copy-skill.mjs",