flypod 0.18.0 → 0.18.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.
package/README.md CHANGED
@@ -691,7 +691,7 @@ Targeting flags, on `update` / `versions` / `rollback` / `forget` / `token`:
691
691
  | `FLYPOD_SHOW_TOKEN` | Set to `1` to print the site's manage token inline on deploy (off by default) |
692
692
  | `NO_COLOR` | Disable ANSI colors |
693
693
  | `FORCE_COLOR` | Force colors even when stderr is not a TTY |
694
- | `DO_NOT_TRACK` | Set (to anything but `0` or `false`) to turn off the install id, the agent and CI words, and failure reports. See [Telemetry](#telemetry) |
694
+ | `DO_NOT_TRACK` | Set (to anything but `0` or `false`) to turn off the install id, the agent, CI, launch and agent-instructions words, and failure reports. See [Telemetry](#telemetry) |
695
695
  | `FLYPOD_TELEMETRY` | `0`, `false`, `off` or `no` turns off the same, for flypod alone |
696
696
 
697
697
  `FLYPOD_API_KEY` is still read as a last-resort fallback for older setups; new
@@ -855,6 +855,20 @@ person's tenth deploy from ten people's first. What it sends:
855
855
  `none`) as `x-flypod-agent`, and `x-flypod-ci: 1` or `0`. The CLI picks the
856
856
  word from environment variables the agents set for the commands they run
857
857
  (`AI_AGENT`, `CLAUDECODE`, `CLAUDE_CODE_ENTRYPOINT`, `CURSOR_AGENT`, `GEMINI_CLI`, `CODEX_SANDBOX`, `CODEX_SANDBOX_NETWORK_DISABLED`, `CODEX_THREAD_ID`, `CODEX_MANAGED_BY_NPM`) and from `CI` / `GITHUB_ACTIONS`; the variables' values are never sent.
858
+ - **How it was launched**: one word (`npx`, `bunx`, `pnpm_dlx`, `yarn_dlx`,
859
+ `script`, `local`, `global` or `other`) as `x-flypod-invoked-via`, from the
860
+ shape of the CLI's own script path (a package manager's cache, a
861
+ `node_modules`, a global prefix) and the variables package managers set
862
+ (`npm_lifecycle_event`, `npm_command`, `npm_config_user_agent`,
863
+ `npm_execpath`). Never the path or the values.
864
+ - **Whether the project's agent instructions name flypod**: one word
865
+ (`skill`, `agents_md`, `claude_md`, `cursor_rules`, `copilot`, `gemini_md`
866
+ or `none`) as `x-flypod-agent-guide`. The CLI reads the start (32 KB) of
867
+ `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, `.cursor/rules/*`,
868
+ `.github/copilot-instructions.md` and `GEMINI.md` in the folder it runs in
869
+ and its parents up to the repository root, never the home directory, and
870
+ sends only which kind of file contains the word `flypod`. Never a file's
871
+ content, name or path.
858
872
  - **Failure reports**: when a command fails against flypod.dev, one small
859
873
  request to `/telemetry/cli` with the error `code`, the verb, the OS,
860
874
  runtime and its major version, and whether a script or agent ran it. For
@@ -862,14 +876,16 @@ person's tenth deploy from ten people's first. What it sends:
862
876
  file count, kilobytes per kind of file (HTML, scripts, images, source
863
877
  maps, …), and whether the folder has a `package.json`, a `src/` or a build
864
878
  folder (`dist`, `build`, …). For `no_site` it adds which kind (`reason`),
865
- and for `unauthorized` which kind of credential was refused. Never file
879
+ and for `unauthorized` which kind of credential was refused, whether this
880
+ machine knew the site, and whether it was named by the folder's link or
881
+ `--site`. Never file
866
882
  names, paths, contents or the error text. A report is never printed, gives up after 1.5 s, and is never
867
883
  sent to a self-hosted server.
868
884
 
869
885
  The first time an id is made, a terminal run says so in one line.
870
886
 
871
887
  Turn all of it off with `DO_NOT_TRACK=1` (or `FLYPOD_TELEMETRY=0`): no id is
872
- made or sent, no agent or CI word is sent, and no failure reports go out. The library (`deploySite()`)
888
+ made or sent, no agent, CI, launch or agent-instructions word is sent, and no failure reports go out. The library (`deploySite()`)
873
889
  sends none of this and writes nothing to your home directory.
874
890
 
875
891
  ## Library API
@@ -45,7 +45,7 @@ import {
45
45
  unauthorizedFor,
46
46
  unexpectedError,
47
47
  uploadLimitsFor
48
- } from "../cli-4d5fkx95.js";
48
+ } from "../cli-tydvmnwj.js";
49
49
 
50
50
  // bin/deploy.ts
51
51
  import { readFile as readFile3, stat as stat4 } from "node:fs/promises";
@@ -1398,11 +1398,11 @@ async function resolveTarget(args, io) {
1398
1398
  const env = io.env ?? process.env;
1399
1399
  if (args.site) {
1400
1400
  const known = await projectForSite(args.site, env).catch(() => null);
1401
- return { site_id: args.site, rec: known, dir: null };
1401
+ return { site_id: args.site, rec: known, dir: null, named: "flag" };
1402
1402
  }
1403
1403
  const cwd = io.cwd ?? process.cwd();
1404
1404
  const rec = await projectForDir(cwd, env);
1405
- return rec ? { site_id: rec.site_id, rec, dir: cwd } : null;
1405
+ return rec ? { site_id: rec.site_id, rec, dir: cwd, named: "link" } : null;
1406
1406
  }
1407
1407
  async function withTarget(name, args, io) {
1408
1408
  if (args.help)
@@ -1450,6 +1450,7 @@ async function failSiteRequest(verb, res, target, args, io, env, opts = {}) {
1450
1450
  siteId: target.site_id,
1451
1451
  sent: credentialSent(target, args, opts.client),
1452
1452
  known: target.rec !== null,
1453
+ target: target.named,
1453
1454
  status: err.status
1454
1455
  });
1455
1456
  }
@@ -1,7 +1,7 @@
1
1
  // src/cli.ts
2
- import { readdir, readFile as readFile4, realpath, stat as stat2 } from "node:fs/promises";
3
- import { homedir as homedir3 } from "node:os";
4
- import { join as join4, parse, relative, resolve, sep } from "node:path";
2
+ import { readdir as readdir2, readFile as readFile4, realpath, stat as stat3 } from "node:fs/promises";
3
+ import { homedir as homedir4 } from "node:os";
4
+ import { join as join5, parse, relative, resolve as resolve2, sep } from "node:path";
5
5
 
6
6
  // src/deploy-source.ts
7
7
  var SOURCE_HEADER = "x-flypod-source";
@@ -21,8 +21,8 @@ function coerceSource(value) {
21
21
 
22
22
  // src/cli/install-id.ts
23
23
  import { randomBytes } from "node:crypto";
24
- import { readFile } from "node:fs/promises";
25
- import { join as join2 } from "node:path";
24
+ import { readFile as readFile3 } from "node:fs/promises";
25
+ import { join as join4 } from "node:path";
26
26
 
27
27
  // src/cli/agent-env.ts
28
28
  var set = (v) => v !== undefined && v.trim() !== "" && v.trim() !== "0";
@@ -61,145 +61,15 @@ function detectCi(env) {
61
61
  return env.GITHUB_ACTIONS === "true";
62
62
  }
63
63
 
64
- // src/cli/paths.ts
65
- import { mkdir, rename, writeFile } from "node:fs/promises";
66
- import { homedir, platform } from "node:os";
67
- import { dirname, join } from "node:path";
68
- function configDir(env = process.env) {
69
- if (env.FLYPOD_CONFIG_DIR)
70
- return env.FLYPOD_CONFIG_DIR;
71
- const os = platform();
72
- if (os === "darwin") {
73
- return join(homedir(), "Library", "Application Support", "flypod");
74
- }
75
- if (os === "win32") {
76
- const appData = env.APPDATA ?? join(homedir(), "AppData", "Roaming");
77
- return join(appData, "flypod");
78
- }
79
- const xdg = env.XDG_CONFIG_HOME ?? join(homedir(), ".config");
80
- return join(xdg, "flypod");
81
- }
82
- function sessionFilePath(env = process.env) {
83
- return join(configDir(env), "session.json");
84
- }
85
- function projectsFilePath(env = process.env) {
86
- return join(configDir(env), "projects.json");
87
- }
88
- async function atomicWriteFile(path, content) {
89
- await mkdir(dirname(path), { recursive: true });
90
- const tmp = `${path}.tmp`;
91
- await writeFile(tmp, content, { mode: 384 });
92
- await rename(tmp, path);
93
- }
94
-
95
- // src/cli/install-id.ts
96
- var ID_RE = /^[A-Za-z0-9_-]{16,64}$/;
97
- var VERSION_RE = /^\d{1,3}\.\d{1,3}\.\d{1,3}(?:-[0-9A-Za-z.-]{1,20})?$/;
98
- var INSTALL_HEADER = "x-flypod-install";
99
- var INSTALL_NEW_HEADER = "x-flypod-install-new";
100
- var VERSION_HEADER = "x-flypod-version";
101
- var RELINK_HEADER = "x-flypod-relink";
102
- var AGENT_HEADER = "x-flypod-agent";
103
- var CI_HEADER = "x-flypod-ci";
104
- function telemetryOptedOut(env) {
105
- const dnt = env.DO_NOT_TRACK;
106
- if (dnt !== undefined && !["", "0", "false"].includes(dnt.trim().toLowerCase()))
107
- return true;
108
- const own = env.FLYPOD_TELEMETRY;
109
- return own !== undefined && ["0", "false", "off", "no"].includes(own.trim().toLowerCase());
110
- }
111
- function installFilePath(env = process.env) {
112
- return join2(configDir(env), "install.json");
113
- }
114
- var cache = new Map;
115
- function installId(env = process.env) {
116
- if (telemetryOptedOut(env))
117
- return Promise.resolve(null);
118
- let path;
119
- try {
120
- path = installFilePath(env);
121
- } catch {
122
- return Promise.resolve(null);
123
- }
124
- let pending = cache.get(path);
125
- if (!pending) {
126
- pending = loadOrCreate(path);
127
- cache.set(path, pending);
128
- }
129
- return pending;
130
- }
131
- async function loadOrCreate(path) {
132
- try {
133
- const saved = JSON.parse(await readFile(path, "utf8"));
134
- if (typeof saved.install_id === "string" && ID_RE.test(saved.install_id)) {
135
- return { id: saved.install_id, isNew: false };
136
- }
137
- } catch {}
138
- const id = randomBytes(16).toString("base64url");
139
- try {
140
- await atomicWriteFile(path, `${JSON.stringify({ install_id: id, created_at: new Date().toISOString() }, null, 2)}
141
- `);
142
- } catch {
143
- return null;
144
- }
145
- return { id, isNew: true };
146
- }
147
- var version;
148
- function setCliVersion(v) {
149
- version = VERSION_RE.test(v) ? v : undefined;
150
- }
151
- async function identityHeaders(env) {
152
- const headers = {};
153
- if (version)
154
- headers[VERSION_HEADER] = version;
155
- const install = await installId(env);
156
- if (install) {
157
- headers[INSTALL_HEADER] = install.id;
158
- if (install.isNew)
159
- headers[INSTALL_NEW_HEADER] = "1";
160
- }
161
- if (!telemetryOptedOut(env)) {
162
- headers[AGENT_HEADER] = detectCodingAgent(env);
163
- headers[CI_HEADER] = detectCi(env) ? "1" : "0";
164
- }
165
- return headers;
166
- }
167
- var FIRST_RUN_NOTICE = "flypod counts deploys with a random id. DO_NOT_TRACK=1 stops it.";
168
-
169
- // src/cli/session.ts
170
- import { readFile as readFile2, unlink } from "node:fs/promises";
171
- async function loadSession(env) {
172
- try {
173
- const path = sessionFilePath(env);
174
- const text = await readFile2(path, "utf8");
175
- const parsed = JSON.parse(text);
176
- if (typeof parsed?.session_token === "string" && typeof parsed?.base_url === "string" && typeof parsed?.created_at === "number") {
177
- return parsed;
178
- }
179
- return null;
180
- } catch {
181
- return null;
182
- }
183
- }
184
- async function saveSession(session, env) {
185
- const path = sessionFilePath(env);
186
- await atomicWriteFile(path, `${JSON.stringify(session, null, 2)}
187
- `);
188
- return path;
189
- }
190
- async function clearSession(env) {
191
- try {
192
- await unlink(sessionFilePath(env));
193
- return true;
194
- } catch {
195
- return false;
196
- }
197
- }
64
+ // src/cli/agent-guide.ts
65
+ import { open, readdir, stat as stat2 } from "node:fs/promises";
66
+ import { homedir as homedir3 } from "node:os";
67
+ import { dirname as dirname3, join as join3, resolve } from "node:path";
198
68
 
199
69
  // src/cli/skill.ts
200
- import { mkdir as mkdir2, readFile as readFile3, stat, writeFile as writeFile2 } from "node:fs/promises";
70
+ import { mkdir as mkdir2, readFile as readFile2, stat, writeFile as writeFile2 } from "node:fs/promises";
201
71
  import { homedir as homedir2 } from "node:os";
202
- import { dirname as dirname2, join as join3 } from "node:path";
72
+ import { dirname as dirname2, join as join2 } from "node:path";
203
73
 
204
74
  // src/cli/screen.ts
205
75
  var WIDTH = 66;
@@ -282,6 +152,85 @@ function storedZipBytes(files) {
282
152
  return total;
283
153
  }
284
154
 
155
+ // src/cli/session.ts
156
+ import { readFile, unlink } from "node:fs/promises";
157
+
158
+ // src/cli/paths.ts
159
+ import { mkdir, rename, writeFile } from "node:fs/promises";
160
+ import { homedir, platform } from "node:os";
161
+ import { dirname, join } from "node:path";
162
+ function configDir(env = process.env) {
163
+ if (env.FLYPOD_CONFIG_DIR)
164
+ return env.FLYPOD_CONFIG_DIR;
165
+ const os = platform();
166
+ if (os === "darwin") {
167
+ return join(homedir(), "Library", "Application Support", "flypod");
168
+ }
169
+ if (os === "win32") {
170
+ const appData = env.APPDATA ?? join(homedir(), "AppData", "Roaming");
171
+ return join(appData, "flypod");
172
+ }
173
+ const xdg = env.XDG_CONFIG_HOME ?? join(homedir(), ".config");
174
+ return join(xdg, "flypod");
175
+ }
176
+ function sessionFilePath(env = process.env) {
177
+ return join(configDir(env), "session.json");
178
+ }
179
+ function projectsFilePath(env = process.env) {
180
+ return join(configDir(env), "projects.json");
181
+ }
182
+ async function atomicWriteFile(path, content) {
183
+ await mkdir(dirname(path), { recursive: true });
184
+ const tmp = `${path}.tmp`;
185
+ await writeFile(tmp, content, { mode: 384 });
186
+ await rename(tmp, path);
187
+ }
188
+
189
+ // src/cli/session.ts
190
+ async function loadSession(env) {
191
+ try {
192
+ const path = sessionFilePath(env);
193
+ const text = await readFile(path, "utf8");
194
+ const parsed = JSON.parse(text);
195
+ if (typeof parsed?.session_token === "string" && typeof parsed?.base_url === "string" && typeof parsed?.created_at === "number") {
196
+ return parsed;
197
+ }
198
+ return null;
199
+ } catch {
200
+ return null;
201
+ }
202
+ }
203
+ async function saveSession(session, env) {
204
+ const path = sessionFilePath(env);
205
+ await atomicWriteFile(path, `${JSON.stringify(session, null, 2)}
206
+ `);
207
+ return path;
208
+ }
209
+ async function clearSession(env) {
210
+ try {
211
+ await unlink(sessionFilePath(env));
212
+ return true;
213
+ } catch {
214
+ return false;
215
+ }
216
+ }
217
+
218
+ // src/cli/source.ts
219
+ async function resolveCliSource(env, cwd, opts = {}) {
220
+ const explicit = env.FLYPOD_SOURCE;
221
+ if (explicit)
222
+ return coerceSource(explicit);
223
+ try {
224
+ if (await skillInstalledIn(cwd))
225
+ return "skill";
226
+ const tty = opts.stdoutIsTTY ?? Boolean(process.stdout.isTTY);
227
+ const agentRun = detectCodingAgent(env) !== "none" || !tty;
228
+ return agentRun && await skillInstalledGlobally(env) ? "skill" : "cli";
229
+ } catch {
230
+ return "cli";
231
+ }
232
+ }
233
+
285
234
  // src/cli/telemetry.ts
286
235
  var REPORT_TIMEOUT_MS = 1500;
287
236
  var TELEMETRY_PATH = "/telemetry/cli";
@@ -333,7 +282,7 @@ async function send(r, body) {
333
282
  if (!uploadLimitsFor(baseUrl))
334
283
  return;
335
284
  const headers = {
336
- ...await identityHeaders(r.env),
285
+ ...await identityHeaders(r.env, { cwd: r.cwd }),
337
286
  [SOURCE_HEADER]: await resolveCliSource(r.env, r.cwd, { stdoutIsTTY: !r.stdoutPiped }),
338
287
  "content-type": "application/json"
339
288
  };
@@ -631,7 +580,7 @@ function unauthorizedFor(ctx) {
631
580
  const base = {
632
581
  code: "unauthorized",
633
582
  status: ctx.status,
634
- telemetry: { credential: ctx.sent }
583
+ telemetry: { credential: ctx.sent, known: ctx.known, target: ctx.target }
635
584
  };
636
585
  const id2 = ctx.siteId;
637
586
  switch (ctx.sent) {
@@ -1021,7 +970,7 @@ it would otherwise outlive.
1021
970
  | \`FLYPOD_TOKEN\` | Deploy as your account without logging in (agents / CI) |
1022
971
  | \`DEPLOY_URL\` | Point at a different flypod server (default \`https://flypod.dev\`) |
1023
972
  | \`FLYPOD_CONFIG_DIR\` | Relocate the session + folder→site memory |
1024
- | \`DO_NOT_TRACK\` | \`1\` turns off the CLI's random install id, the one word naming which agent ran it, and its failure reports (codes and counts, never file names) |
973
+ | \`DO_NOT_TRACK\` | \`1\` turns off the CLI's random install id, the fixed words naming which agent ran it, how it was launched and whether this project's agent instructions mention flypod, and its failure reports (codes and counts, never file names or contents) |
1025
974
 
1026
975
  \`FLYPOD_TOKEN\` wins over a saved \`flypod login\` session; \`--token\` and a site's own
1027
976
  stored manage token win over both. \`FLYPOD_API_KEY\` is read only as a last-resort
@@ -1260,30 +1209,30 @@ var TARGETS = [
1260
1209
  id: "claude",
1261
1210
  label: "Claude Code",
1262
1211
  detail: ".claude/skills/flypod/ — loaded on demand",
1263
- projectDir: (root) => join3(root, ".claude", "skills", SKILL_NAME),
1264
- globalDir: (env) => join3(home(env), ".claude", "skills", SKILL_NAME)
1212
+ projectDir: (root) => join2(root, ".claude", "skills", SKILL_NAME),
1213
+ globalDir: (env) => join2(home(env), ".claude", "skills", SKILL_NAME)
1265
1214
  },
1266
1215
  {
1267
1216
  id: "agents",
1268
1217
  label: "Agent Skills (shared)",
1269
1218
  detail: ".agents/skills/flypod/ — Codex, Cursor, Gemini CLI, Copilot",
1270
- projectDir: (root) => join3(root, ".agents", "skills", SKILL_NAME),
1271
- globalDir: (env) => join3(home(env), ".agents", "skills", SKILL_NAME)
1219
+ projectDir: (root) => join2(root, ".agents", "skills", SKILL_NAME),
1220
+ globalDir: (env) => join2(home(env), ".agents", "skills", SKILL_NAME)
1272
1221
  }
1273
1222
  ];
1274
1223
  var LEGACY_PATHS = [
1275
1224
  "AGENTS.md",
1276
1225
  "GEMINI.md",
1277
- join3(".github", "copilot-instructions.md"),
1278
- join3(".cursor", "rules", `${SKILL_NAME}.mdc`),
1279
- join3(".windsurf", "rules", `${SKILL_NAME}.md`),
1280
- join3(".clinerules", `${SKILL_NAME}.md`),
1281
- join3(".roo", "rules", `${SKILL_NAME}.md`)
1226
+ join2(".github", "copilot-instructions.md"),
1227
+ join2(".cursor", "rules", `${SKILL_NAME}.mdc`),
1228
+ join2(".windsurf", "rules", `${SKILL_NAME}.md`),
1229
+ join2(".clinerules", `${SKILL_NAME}.md`),
1230
+ join2(".roo", "rules", `${SKILL_NAME}.md`)
1282
1231
  ];
1283
1232
  var LEGACY_SHARED = new Set([
1284
1233
  "AGENTS.md",
1285
1234
  "GEMINI.md",
1286
- join3(".github", "copilot-instructions.md")
1235
+ join2(".github", "copilot-instructions.md")
1287
1236
  ]);
1288
1237
  var LEGACY_MARK = `<!-- ${SKILL_NAME}:begin -->`;
1289
1238
  async function exists(path) {
@@ -1297,7 +1246,7 @@ async function exists(path) {
1297
1246
  async function legacyArtifacts(root) {
1298
1247
  const found = [];
1299
1248
  for (const rel of LEGACY_PATHS) {
1300
- const path = join3(root, rel);
1249
+ const path = join2(root, rel);
1301
1250
  if (!await exists(path))
1302
1251
  continue;
1303
1252
  if (!LEGACY_SHARED.has(rel)) {
@@ -1305,7 +1254,7 @@ async function legacyArtifacts(root) {
1305
1254
  continue;
1306
1255
  }
1307
1256
  try {
1308
- if ((await readFile3(path, "utf8")).includes(LEGACY_MARK))
1257
+ if ((await readFile2(path, "utf8")).includes(LEGACY_MARK))
1309
1258
  found.push(rel);
1310
1259
  } catch {}
1311
1260
  }
@@ -1313,7 +1262,7 @@ async function legacyArtifacts(root) {
1313
1262
  }
1314
1263
  async function skillInstalledIn(root) {
1315
1264
  for (const target of TARGETS) {
1316
- if (await exists(join3(target.projectDir(root), "SKILL.md")))
1265
+ if (await exists(join2(target.projectDir(root), "SKILL.md")))
1317
1266
  return true;
1318
1267
  }
1319
1268
  return (await legacyArtifacts(root)).length > 0;
@@ -1322,16 +1271,16 @@ function globalSkillDirs(env) {
1322
1271
  const h = home(env);
1323
1272
  return [
1324
1273
  ...TARGETS.map((t) => t.globalDir(env)),
1325
- join3(h, ".codex", "skills", SKILL_NAME),
1326
- join3(h, ".cursor", "skills", SKILL_NAME),
1327
- join3(h, ".gemini", "skills", SKILL_NAME),
1328
- join3(h, ".copilot", "skills", SKILL_NAME),
1329
- join3(h, ".config", "opencode", "skills", SKILL_NAME)
1274
+ join2(h, ".codex", "skills", SKILL_NAME),
1275
+ join2(h, ".cursor", "skills", SKILL_NAME),
1276
+ join2(h, ".gemini", "skills", SKILL_NAME),
1277
+ join2(h, ".copilot", "skills", SKILL_NAME),
1278
+ join2(h, ".config", "opencode", "skills", SKILL_NAME)
1330
1279
  ];
1331
1280
  }
1332
1281
  async function skillInstalledGlobally(env) {
1333
1282
  for (const dir of globalSkillDirs(env)) {
1334
- if (await exists(join3(dir, "SKILL.md")))
1283
+ if (await exists(join2(dir, "SKILL.md")))
1335
1284
  return true;
1336
1285
  }
1337
1286
  return false;
@@ -1339,9 +1288,9 @@ async function skillInstalledGlobally(env) {
1339
1288
  async function writeTarget(target, dir) {
1340
1289
  const results = [];
1341
1290
  for (const [rel, content] of Object.entries(skillFiles())) {
1342
- const path = join3(dir, rel);
1291
+ const path = join2(dir, rel);
1343
1292
  const had = await exists(path);
1344
- if (had && await readFile3(path, "utf8") === content) {
1293
+ if (had && await readFile2(path, "utf8") === content) {
1345
1294
  results.push({ target, path, status: "unchanged" });
1346
1295
  continue;
1347
1296
  }
@@ -1414,14 +1363,14 @@ async function installSkill(args, callerIo) {
1414
1363
  emit({
1415
1364
  ok: true,
1416
1365
  dry_run: true,
1417
- files: selected.flatMap((e) => Object.keys(skillFiles()).map((rel) => join3(e.dir, rel)))
1366
+ files: selected.flatMap((e) => Object.keys(skillFiles()).map((rel) => join2(e.dir, rel)))
1418
1367
  });
1419
1368
  return 0;
1420
1369
  }
1421
1370
  io.err("Would write:");
1422
1371
  for (const e of selected) {
1423
1372
  for (const rel of Object.keys(skillFiles()))
1424
- io.out(join3(e.dir, rel));
1373
+ io.out(join2(e.dir, rel));
1425
1374
  }
1426
1375
  return 0;
1427
1376
  }
@@ -1468,21 +1417,254 @@ async function installSkill(args, callerIo) {
1468
1417
  return 0;
1469
1418
  }
1470
1419
 
1471
- // src/cli/source.ts
1472
- async function resolveCliSource(env, cwd, opts = {}) {
1473
- const explicit = env.FLYPOD_SOURCE;
1474
- if (explicit)
1475
- return coerceSource(explicit);
1420
+ // src/cli/agent-guide.ts
1421
+ var MAX_LEVELS = 4;
1422
+ var MAX_BYTES = 32 * 1024;
1423
+ var MAX_RULES = 20;
1424
+ var NEEDLE = "flypod";
1425
+ var FILES = [
1426
+ ["agents_md", "AGENTS.md"],
1427
+ ["claude_md", "CLAUDE.md"],
1428
+ ["claude_md", join3(".claude", "CLAUDE.md")],
1429
+ ["cursor_rules", ".cursorrules"],
1430
+ ["copilot", join3(".github", "copilot-instructions.md")],
1431
+ ["gemini_md", "GEMINI.md"]
1432
+ ];
1433
+ async function mentions(path) {
1434
+ let fh;
1476
1435
  try {
1477
- if (await skillInstalledIn(cwd))
1478
- return "skill";
1479
- const tty = opts.stdoutIsTTY ?? Boolean(process.stdout.isTTY);
1480
- const agentRun = detectCodingAgent(env) !== "none" || !tty;
1481
- return agentRun && await skillInstalledGlobally(env) ? "skill" : "cli";
1436
+ fh = await open(path, "r");
1437
+ const buf = new Uint8Array(MAX_BYTES);
1438
+ const { bytesRead } = await fh.read(buf, 0, MAX_BYTES, 0);
1439
+ return new TextDecoder().decode(buf.subarray(0, bytesRead)).toLowerCase().includes(NEEDLE);
1482
1440
  } catch {
1483
- return "cli";
1441
+ return false;
1442
+ } finally {
1443
+ await fh?.close().catch(() => {});
1484
1444
  }
1485
1445
  }
1446
+ async function cursorRulesMention(dir) {
1447
+ let names;
1448
+ try {
1449
+ names = await readdir(join3(dir, ".cursor", "rules"));
1450
+ } catch {
1451
+ return false;
1452
+ }
1453
+ const rules = names.filter((n) => /\.mdc?$/i.test(n)).slice(0, MAX_RULES);
1454
+ for (const name of rules) {
1455
+ if (await mentions(join3(dir, ".cursor", "rules", name)))
1456
+ return true;
1457
+ }
1458
+ return false;
1459
+ }
1460
+ async function guideIn(dir) {
1461
+ if (await skillInstalledIn(dir).catch(() => false))
1462
+ return "skill";
1463
+ for (const [kind, rel] of FILES) {
1464
+ if (await mentions(join3(dir, rel)))
1465
+ return kind;
1466
+ if (rel === ".cursorrules" && await cursorRulesMention(dir))
1467
+ return "cursor_rules";
1468
+ }
1469
+ return null;
1470
+ }
1471
+ async function isRepoRoot(dir) {
1472
+ try {
1473
+ await stat2(join3(dir, ".git"));
1474
+ return true;
1475
+ } catch {
1476
+ return false;
1477
+ }
1478
+ }
1479
+ async function detectAgentGuide(cwd, opts = {}) {
1480
+ try {
1481
+ const home2 = resolve(opts.home ?? homedir3());
1482
+ let dir = resolve(cwd);
1483
+ for (let level = 0;level < MAX_LEVELS + 1; level++) {
1484
+ if (dir === home2)
1485
+ break;
1486
+ const found = await guideIn(dir);
1487
+ if (found)
1488
+ return found;
1489
+ if (await isRepoRoot(dir))
1490
+ break;
1491
+ const parent = dirname3(dir);
1492
+ if (parent === dir)
1493
+ break;
1494
+ dir = parent;
1495
+ }
1496
+ return "none";
1497
+ } catch {
1498
+ return "none";
1499
+ }
1500
+ }
1501
+ var cache = new Map;
1502
+ function agentGuideFor(cwd, opts = {}) {
1503
+ const key = `${resolve(cwd)}\x00${opts.home ?? ""}`;
1504
+ let pending2 = cache.get(key);
1505
+ if (!pending2) {
1506
+ pending2 = detectAgentGuide(cwd, opts);
1507
+ cache.set(key, pending2);
1508
+ }
1509
+ return pending2;
1510
+ }
1511
+
1512
+ // src/cli/invoked-via.ts
1513
+ import { realpathSync } from "node:fs";
1514
+ function norm(p) {
1515
+ return p.replace(/\\/g, "/").toLowerCase();
1516
+ }
1517
+ function real(p) {
1518
+ try {
1519
+ return realpathSync(p);
1520
+ } catch {
1521
+ return p;
1522
+ }
1523
+ }
1524
+ function manager(env) {
1525
+ const ua = (env.npm_config_user_agent ?? "").trim().toLowerCase();
1526
+ const name = ua.split("/")[0] ?? "";
1527
+ if (name)
1528
+ return name;
1529
+ const exec = norm(env.npm_execpath ?? "");
1530
+ if (exec.includes("pnpm"))
1531
+ return "pnpm";
1532
+ if (exec.includes("yarn"))
1533
+ return "yarn";
1534
+ if (exec.includes("bun"))
1535
+ return "bun";
1536
+ return exec ? "npm" : "";
1537
+ }
1538
+ function fetched(path, env) {
1539
+ if (path.includes("/_npx/"))
1540
+ return "npx";
1541
+ if (/\/bunx-[^/]*\//.test(path))
1542
+ return "bunx";
1543
+ if (/\/pnpm(-cache)?\/dlx\//.test(path))
1544
+ return "pnpm_dlx";
1545
+ if (/\/dlx-[^/]*\//.test(path)) {
1546
+ const by = manager(env);
1547
+ if (by === "yarn" || /\/xfs-[^/]*\//.test(path))
1548
+ return "yarn_dlx";
1549
+ if (by === "pnpm")
1550
+ return "pnpm_dlx";
1551
+ }
1552
+ return null;
1553
+ }
1554
+ var GLOBAL_PATTERNS = [
1555
+ /\/lib\/node_modules\//,
1556
+ /\/npm\/node_modules\//,
1557
+ /\/\.bun\/install\/global\//,
1558
+ /\/pnpm\/global\//,
1559
+ /\/yarn\/global\//,
1560
+ /\/\.volta\/tools\//
1561
+ ];
1562
+ function detectInvokedVia(env, script, cwd) {
1563
+ try {
1564
+ const path = script ? norm(real(script)) : "";
1565
+ const viaPath = path ? fetched(path, env) : null;
1566
+ if (viaPath)
1567
+ return viaPath;
1568
+ const lifecycle = (env.npm_lifecycle_event ?? "").trim();
1569
+ if (lifecycle && lifecycle !== "npx" && lifecycle !== "bunx")
1570
+ return "script";
1571
+ const at = path.indexOf("/node_modules/");
1572
+ if (at > 0) {
1573
+ const root = path.slice(0, at);
1574
+ const here = norm(real(cwd)).replace(/\/+$/, "");
1575
+ if (here === root || here.startsWith(`${root}/`))
1576
+ return "local";
1577
+ if (GLOBAL_PATTERNS.some((re) => re.test(path)))
1578
+ return "global";
1579
+ }
1580
+ if (env.npm_command === "exec" || lifecycle === "npx")
1581
+ return "npx";
1582
+ if (lifecycle === "bunx")
1583
+ return "bunx";
1584
+ return "other";
1585
+ } catch {
1586
+ return "other";
1587
+ }
1588
+ }
1589
+
1590
+ // src/cli/install-id.ts
1591
+ var ID_RE = /^[A-Za-z0-9_-]{16,64}$/;
1592
+ var VERSION_RE = /^\d{1,3}\.\d{1,3}\.\d{1,3}(?:-[0-9A-Za-z.-]{1,20})?$/;
1593
+ var INSTALL_HEADER = "x-flypod-install";
1594
+ var INSTALL_NEW_HEADER = "x-flypod-install-new";
1595
+ var VERSION_HEADER = "x-flypod-version";
1596
+ var RELINK_HEADER = "x-flypod-relink";
1597
+ var AGENT_HEADER = "x-flypod-agent";
1598
+ var CI_HEADER = "x-flypod-ci";
1599
+ var INVOKED_VIA_HEADER = "x-flypod-invoked-via";
1600
+ var AGENT_GUIDE_HEADER = "x-flypod-agent-guide";
1601
+ function telemetryOptedOut(env) {
1602
+ const dnt = env.DO_NOT_TRACK;
1603
+ if (dnt !== undefined && !["", "0", "false"].includes(dnt.trim().toLowerCase()))
1604
+ return true;
1605
+ const own = env.FLYPOD_TELEMETRY;
1606
+ return own !== undefined && ["0", "false", "off", "no"].includes(own.trim().toLowerCase());
1607
+ }
1608
+ function installFilePath(env = process.env) {
1609
+ return join4(configDir(env), "install.json");
1610
+ }
1611
+ var cache2 = new Map;
1612
+ function installId(env = process.env) {
1613
+ if (telemetryOptedOut(env))
1614
+ return Promise.resolve(null);
1615
+ let path;
1616
+ try {
1617
+ path = installFilePath(env);
1618
+ } catch {
1619
+ return Promise.resolve(null);
1620
+ }
1621
+ let pending2 = cache2.get(path);
1622
+ if (!pending2) {
1623
+ pending2 = loadOrCreate(path);
1624
+ cache2.set(path, pending2);
1625
+ }
1626
+ return pending2;
1627
+ }
1628
+ async function loadOrCreate(path) {
1629
+ try {
1630
+ const saved = JSON.parse(await readFile3(path, "utf8"));
1631
+ if (typeof saved.install_id === "string" && ID_RE.test(saved.install_id)) {
1632
+ return { id: saved.install_id, isNew: false };
1633
+ }
1634
+ } catch {}
1635
+ const id2 = randomBytes(16).toString("base64url");
1636
+ try {
1637
+ await atomicWriteFile(path, `${JSON.stringify({ install_id: id2, created_at: new Date().toISOString() }, null, 2)}
1638
+ `);
1639
+ } catch {
1640
+ return null;
1641
+ }
1642
+ return { id: id2, isNew: true };
1643
+ }
1644
+ var version;
1645
+ function setCliVersion(v) {
1646
+ version = VERSION_RE.test(v) ? v : undefined;
1647
+ }
1648
+ async function identityHeaders(env, opts = {}) {
1649
+ const headers = {};
1650
+ if (version)
1651
+ headers[VERSION_HEADER] = version;
1652
+ const install = await installId(env);
1653
+ if (install) {
1654
+ headers[INSTALL_HEADER] = install.id;
1655
+ if (install.isNew)
1656
+ headers[INSTALL_NEW_HEADER] = "1";
1657
+ }
1658
+ if (!telemetryOptedOut(env)) {
1659
+ headers[AGENT_HEADER] = detectCodingAgent(env);
1660
+ headers[CI_HEADER] = detectCi(env) ? "1" : "0";
1661
+ const cwd = opts.cwd ?? process.cwd();
1662
+ headers[INVOKED_VIA_HEADER] = detectInvokedVia(env, opts.script ?? process.argv[1], cwd);
1663
+ headers[AGENT_GUIDE_HEADER] = await agentGuideFor(cwd, { home: env.HOME });
1664
+ }
1665
+ return headers;
1666
+ }
1667
+ var FIRST_RUN_NOTICE = "flypod counts deploys with a random id. DO_NOT_TRACK=1 stops it.";
1486
1668
 
1487
1669
  // src/cli/client.ts
1488
1670
  var DEVICE_CLIENT_ID = "flypod-cli";
@@ -1548,8 +1730,9 @@ async function createClient(opts) {
1548
1730
  const fetchImpl = opts.fetch ?? fetch;
1549
1731
  const session = await loadSession(env);
1550
1732
  const { token, baseUrl } = resolveCredentials(env, session, opts.overrides);
1551
- const source = await resolveCliSource(env, opts.cwd ?? process.cwd());
1552
- const identity = await identityHeaders(env).catch(() => ({}));
1733
+ const cwd = opts.cwd ?? process.cwd();
1734
+ const source = await resolveCliSource(env, cwd);
1735
+ const identity = await identityHeaders(env, { cwd }).catch(() => ({}));
1553
1736
  return buildClient(token, baseUrl, fetchImpl, source, identity);
1554
1737
  }
1555
1738
 
@@ -2226,14 +2409,14 @@ var SOURCE_MARKERS = [
2226
2409
  ];
2227
2410
  async function isFile(path) {
2228
2411
  try {
2229
- return (await stat2(path)).isFile();
2412
+ return (await stat3(path)).isFile();
2230
2413
  } catch {
2231
2414
  return false;
2232
2415
  }
2233
2416
  }
2234
2417
  async function isDir(path) {
2235
2418
  try {
2236
- return (await stat2(path)).isDirectory();
2419
+ return (await stat3(path)).isDirectory();
2237
2420
  } catch {
2238
2421
  return false;
2239
2422
  }
@@ -2241,30 +2424,30 @@ async function isDir(path) {
2241
2424
  async function nestedSite(dir) {
2242
2425
  let names;
2243
2426
  try {
2244
- names = (await readdir(dir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
2427
+ names = (await readdir2(dir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
2245
2428
  } catch {
2246
2429
  return null;
2247
2430
  }
2248
2431
  const found = [];
2249
2432
  for (const name of names) {
2250
- const sub = join4(dir, name);
2251
- if (await isFile(join4(sub, "index.html")))
2433
+ const sub = join5(dir, name);
2434
+ if (await isFile(join5(sub, "index.html")))
2252
2435
  found.push(sub);
2253
- else if (await isFile(join4(sub, "browser", "index.html")))
2254
- found.push(join4(sub, "browser"));
2436
+ else if (await isFile(join5(sub, "browser", "index.html")))
2437
+ found.push(join5(sub, "browser"));
2255
2438
  if (found.length > 1)
2256
2439
  return null;
2257
2440
  }
2258
2441
  return found[0] ?? null;
2259
2442
  }
2260
2443
  async function deployableAsIs(dir) {
2261
- const at = resolve(dir);
2262
- if (at === resolve(homedir3()) || at === parse(at).root)
2444
+ const at = resolve2(dir);
2445
+ if (at === resolve2(homedir4()) || at === parse(at).root)
2263
2446
  return false;
2264
- if (!await isFile(join4(at, "index.html")))
2447
+ if (!await isFile(join5(at, "index.html")))
2265
2448
  return false;
2266
2449
  for (const marker of SOURCE_MARKERS) {
2267
- if (await isFile(join4(at, marker)))
2450
+ if (await isFile(join5(at, marker)))
2268
2451
  return false;
2269
2452
  }
2270
2453
  return true;
@@ -2274,12 +2457,12 @@ async function resolveDeployDir(opts = {}) {
2274
2457
  return opts.explicit;
2275
2458
  const cwd = opts.cwd ?? process.cwd();
2276
2459
  for (const candidate of BUILD_DIR_CANDIDATES) {
2277
- const dir = join4(cwd, candidate);
2278
- if (await isDir(dir) && await isFile(join4(dir, "index.html")))
2460
+ const dir = join5(cwd, candidate);
2461
+ if (await isDir(dir) && await isFile(join5(dir, "index.html")))
2279
2462
  return dir;
2280
2463
  }
2281
2464
  for (const candidate of BUILD_DIR_CANDIDATES) {
2282
- const dir = join4(cwd, candidate);
2465
+ const dir = join5(cwd, candidate);
2283
2466
  const nested = await isDir(dir) ? await nestedSite(dir) : null;
2284
2467
  if (nested)
2285
2468
  return nested;
@@ -2346,14 +2529,14 @@ function ignoredBy(rules, rel, isDir2) {
2346
2529
  return verdict;
2347
2530
  }
2348
2531
  async function collectFiles(path) {
2349
- const info = await stat2(path);
2532
+ const info = await stat3(path);
2350
2533
  if (info.isFile()) {
2351
2534
  const name = path.split("/").pop() ?? "index.html";
2352
2535
  return { files: { [name]: await readFile4(path) }, skipped: [] };
2353
2536
  }
2354
2537
  const rules = DEFAULT_IGNORES.map((p) => compileRule(p, "default"));
2355
2538
  try {
2356
- const text = await readFile4(join4(path, IGNORE_FILE), "utf8");
2539
+ const text = await readFile4(join5(path, IGNORE_FILE), "utf8");
2357
2540
  for (const line of text.split(/\r?\n/)) {
2358
2541
  const rule = compileRule(line, "flypodignore");
2359
2542
  if (rule)
@@ -2365,17 +2548,17 @@ async function collectFiles(path) {
2365
2548
  const skipped = [];
2366
2549
  const active = new Set([root]);
2367
2550
  async function walk(current, currentReal) {
2368
- for (const entry of await readdir(current, { withFileTypes: true })) {
2369
- const full = join4(current, entry.name);
2551
+ for (const entry of await readdir2(current, { withFileTypes: true })) {
2552
+ const full = join5(current, entry.name);
2370
2553
  const rel = relative(path, full).split("\\").join("/");
2371
2554
  if (rel === IGNORE_FILE)
2372
2555
  continue;
2373
2556
  let isDir2 = entry.isDirectory();
2374
- let real;
2557
+ let real2;
2375
2558
  if (entry.isSymbolicLink()) {
2376
2559
  try {
2377
- real = await realpath(full);
2378
- isDir2 = (await stat2(real)).isDirectory();
2560
+ real2 = await realpath(full);
2561
+ isDir2 = (await stat3(real2)).isDirectory();
2379
2562
  } catch {
2380
2563
  skipped.push({ path: rel, reason: "broken_symlink" });
2381
2564
  continue;
@@ -2387,14 +2570,14 @@ async function collectFiles(path) {
2387
2570
  continue;
2388
2571
  }
2389
2572
  if (isDir2) {
2390
- const childReal = real ?? join4(currentReal, entry.name);
2391
- if (real !== undefined) {
2392
- const inside = real === root || real.startsWith(`${root}${sep}`);
2573
+ const childReal = real2 ?? join5(currentReal, entry.name);
2574
+ if (real2 !== undefined) {
2575
+ const inside = real2 === root || real2.startsWith(`${root}${sep}`);
2393
2576
  if (!inside) {
2394
2577
  skipped.push({ path: `${rel}/`, reason: "symlink_outside" });
2395
2578
  continue;
2396
2579
  }
2397
- if (active.has(real)) {
2580
+ if (active.has(real2)) {
2398
2581
  skipped.push({ path: `${rel}/`, reason: "symlink_loop" });
2399
2582
  continue;
2400
2583
  }
@@ -2458,4 +2641,4 @@ class DeployError extends Error {
2458
2641
  }
2459
2642
  }
2460
2643
 
2461
- export { projectsFilePath, atomicWriteFile, installId, setCliVersion, FIRST_RUN_NOTICE, loadSession, saveSession, clearSession, PLAIN, headline, hero, field, notice, failure, shortVersion, HOSTED_UPLOAD_LIMITS, uploadLimitsFor, storedZipBytes, startFailureReports, reportFailure, flushFailureReports, exitCodeFor, errorEnvelope, emitError, fail, readServerMessage, classifyResponse, UNAUTHORIZED_FIX, serverError, noBuildDir, networkError, NO_SITE, noSite, unauthorizedFor, NOT_SIGNED_IN, unexpectedError, installSkill, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, DEFAULT_IGNORES, IGNORE_FILE, collectFiles, collectDist, deploySite, DeployError };
2644
+ export { PLAIN, headline, hero, field, notice, failure, shortVersion, HOSTED_UPLOAD_LIMITS, uploadLimitsFor, storedZipBytes, projectsFilePath, atomicWriteFile, loadSession, saveSession, clearSession, startFailureReports, reportFailure, flushFailureReports, exitCodeFor, errorEnvelope, emitError, fail, readServerMessage, classifyResponse, UNAUTHORIZED_FIX, serverError, noBuildDir, networkError, NO_SITE, noSite, unauthorizedFor, NOT_SIGNED_IN, unexpectedError, installSkill, installId, setCliVersion, FIRST_RUN_NOTICE, resolveCredentials, createClient, packDeploy, BUILD_DIR_CANDIDATES, resolveDeployDir, DEFAULT_IGNORES, IGNORE_FILE, collectFiles, collectDist, deploySite, DeployError };
@@ -0,0 +1,16 @@
1
+ import type { AgentGuide } from "../client-meta";
2
+ /** The folder the command runs in plus this many parents, at most. */
3
+ export declare const MAX_LEVELS = 4;
4
+ /** Bytes read from the start of each file. */
5
+ export declare const MAX_BYTES: number;
6
+ /**
7
+ * The nearest instruction file naming flypod, from `cwd` up to its repository
8
+ * root. `home` is the home directory, which is never read; tests inject it.
9
+ */
10
+ export declare function detectAgentGuide(cwd: string, opts?: {
11
+ home?: string;
12
+ }): Promise<AgentGuide>;
13
+ /** `detectAgentGuide`, once per folder per process. */
14
+ export declare function agentGuideFor(cwd: string, opts?: {
15
+ home?: string;
16
+ }): Promise<AgentGuide>;
@@ -1,4 +1,4 @@
1
- import type { CLI_ERROR_CODES, NO_SITE_REASONS, SENT_CREDENTIALS, SERVER_ERROR_ORIGINS } from "../cli-error-codes";
1
+ import type { CLI_ERROR_CODES, NO_SITE_REASONS, SENT_CREDENTIALS, SERVER_ERROR_ORIGINS, SITE_TARGETS } from "../cli-error-codes";
2
2
  import type { CommandIO } from "./commands";
3
3
  export { CLI_ERROR_CODES, NO_SITE_REASONS } from "../cli-error-codes";
4
4
  /**
@@ -134,6 +134,7 @@ export declare const NO_SITE: CliError;
134
134
  /** Why a folder has no site, as `reason` in the `no_site` envelope. */
135
135
  export type NoSiteReason = (typeof NO_SITE_REASONS)[number];
136
136
  type SentCredential = (typeof SENT_CREDENTIALS)[number];
137
+ export type SiteTarget = (typeof SITE_TARGETS)[number];
137
138
  /**
138
139
  * `no_site` for the version verbs (`update`, `versions`, `rollback`), told
139
140
  * apart by what this machine remembers about the folder. It was one sentence
@@ -172,6 +173,8 @@ export declare function unauthorizedFor(ctx: {
172
173
  sent: SentCredential;
173
174
  /** Whether this machine has any record of the site. */
174
175
  known: boolean;
176
+ /** How the command named the site. */
177
+ target: SiteTarget;
175
178
  status?: number;
176
179
  }): CliError;
177
180
  export declare const NOT_SIGNED_IN: CliError;
@@ -4,6 +4,8 @@ export declare const VERSION_HEADER = "x-flypod-version";
4
4
  export declare const RELINK_HEADER = "x-flypod-relink";
5
5
  export declare const AGENT_HEADER = "x-flypod-agent";
6
6
  export declare const CI_HEADER = "x-flypod-ci";
7
+ export declare const INVOKED_VIA_HEADER = "x-flypod-invoked-via";
8
+ export declare const AGENT_GUIDE_HEADER = "x-flypod-agent-guide";
7
9
  /**
8
10
  * True when the user asked not to be counted. `DO_NOT_TRACK` counts when set
9
11
  * to anything but an explicit "no" (`""`, `0`, `false`), because the
@@ -27,13 +29,21 @@ export declare function installId(env?: NodeJS.ProcessEnv): Promise<InstallId |
27
29
  export declare function setCliVersion(v: string): void;
28
30
  export declare function cliVersion(): string | undefined;
29
31
  /**
30
- * The headers that say which install and which CLI version is calling, and
31
- * whether a coding agent or a CI system is running it (./agent-env.ts). The
32
- * version is not identifying and is always sent (when known); everything else
33
- * follows the opt-out, because "which agent does this person use" is a fact
34
- * about them, not about the CLI.
32
+ * The headers that say which install and which CLI version is calling,
33
+ * whether a coding agent or a CI system is running it (./agent-env.ts), how
34
+ * the CLI was launched (./invoked-via.ts) and whether the project's agent
35
+ * instructions name flypod (./agent-guide.ts). The version is not identifying
36
+ * and is always sent (when known); everything else follows the opt-out,
37
+ * because "which agent does this person use" is a fact about them, not about
38
+ * the CLI.
39
+ *
40
+ * `cwd` is the folder the command runs in (the project), `script` the path
41
+ * the runtime was started with; both default to this process's own.
35
42
  */
36
- export declare function identityHeaders(env: NodeJS.ProcessEnv): Promise<Record<string, string>>;
43
+ export declare function identityHeaders(env: NodeJS.ProcessEnv, opts?: {
44
+ cwd?: string;
45
+ script?: string;
46
+ }): Promise<Record<string, string>>;
37
47
  /**
38
48
  * The one line a person sees the first time an id is made, so being counted
39
49
  * is never a surprise. One line because the default output is short, and it
@@ -0,0 +1,6 @@
1
+ import type { InvokedVia } from "../client-meta";
2
+ /**
3
+ * The launch, as one word. `script` is the script path the runtime was given
4
+ * (`process.argv[1]`), `cwd` the folder the command was run in. Never throws.
5
+ */
6
+ export declare function detectInvokedVia(env: NodeJS.ProcessEnv, script: string | undefined, cwd: string): InvokedVia;
@@ -26,3 +26,11 @@ export declare const NO_SITE_REASONS: readonly ["never_linked", "expired", "gone
26
26
  * failure report): `--token`, the folder's manage token, an account, or none.
27
27
  */
28
28
  export declare const SENT_CREDENTIALS: readonly ["flag", "manage_token", "account", "none"];
29
+ /**
30
+ * How an `unauthorized` site request named its site (`target` in the failure
31
+ * report, beside the `known` flag): this folder's link (`link`), or
32
+ * `--site <id>` (`flag`). The week of 2026-10-26 had 30 `unauthorized` on
33
+ * `update` with `credential: none`, all from Cursor installs, and nothing said
34
+ * whether those machines had ever held the site or were handed its id.
35
+ */
36
+ export declare const SITE_TARGETS: readonly ["link", "flag"];
package/dist/src/cli.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  collectFiles,
8
8
  deploySite,
9
9
  resolveDeployDir
10
- } from "../cli-4d5fkx95.js";
10
+ } from "../cli-tydvmnwj.js";
11
11
  export {
12
12
  BUILD_DIR_CANDIDATES,
13
13
  DEFAULT_IGNORES,
@@ -4,6 +4,8 @@ export declare const VERSION_HEADER = "x-flypod-version";
4
4
  export declare const RELINK_HEADER = "x-flypod-relink";
5
5
  export declare const AGENT_HEADER = "x-flypod-agent";
6
6
  export declare const CI_HEADER = "x-flypod-ci";
7
+ export declare const INVOKED_VIA_HEADER = "x-flypod-invoked-via";
8
+ export declare const AGENT_GUIDE_HEADER = "x-flypod-agent-guide";
7
9
  /**
8
10
  * Which coding agent ran the CLI, as one of these words and nothing else. The
9
11
  * CLI reads it from environment variables the agents themselves set
@@ -20,6 +22,33 @@ export declare const CI_HEADER = "x-flypod-ci";
20
22
  */
21
23
  export declare const CODING_AGENTS: readonly ["claude_code", "codex", "cursor", "gemini", "opencode", "other", "none"];
22
24
  export type CodingAgent = (typeof CODING_AGENTS)[number];
25
+ /**
26
+ * How the CLI was launched, as one of these words and nothing else
27
+ * (src/cli/invoked-via.ts reads it from the package manager's environment and
28
+ * the shape of the script's own path, and sends only the word).
29
+ *
30
+ * Why it exists: on 2026-11-01, 75% of new deployers ran flypod under Cursor
31
+ * while the website saw about 58 visitors a week and `source: skill` read 0,
32
+ * so nobody could say how those people came to have flypod at all. A fetch
33
+ * per run (`npx`, `bunx`, `pnpm_dlx`, `yarn_dlx`) is someone or something
34
+ * typing the documented one-liner; `local` is a project dependency, `script`
35
+ * a package.json script that calls it, `global` an install on the machine.
36
+ * `other` is anything else (a checkout run from source, an unusual layout).
37
+ */
38
+ export declare const INVOKED_VIA: readonly ["npx", "bunx", "pnpm_dlx", "yarn_dlx", "script", "local", "global", "other"];
39
+ export type InvokedVia = (typeof INVOKED_VIA)[number];
40
+ /**
41
+ * Which agent-instruction file in the project names flypod, as one of these
42
+ * words (src/cli/agent-guide.ts; never a file's content or name). `skill` is
43
+ * a flypod skill in the project (the same test as `source: skill`); `none` is
44
+ * a project whose instruction files, if it has any, never say "flypod".
45
+ *
46
+ * Why it exists: the same 2026-11-01 review. An agent that deploys with
47
+ * flypod either was told to by the project (one of these files) or found it
48
+ * on its own; the two need different work from us, and nothing said which.
49
+ */
50
+ export declare const AGENT_GUIDES: readonly ["skill", "agents_md", "claude_md", "cursor_rules", "copilot", "gemini_md", "none"];
51
+ export type AgentGuide = (typeof AGENT_GUIDES)[number];
23
52
  export interface ClientMeta {
24
53
  install_id?: string;
25
54
  /** Only on requests from the process that created the install id. */
@@ -31,6 +60,10 @@ export interface ClientMeta {
31
60
  coding_agent?: CodingAgent;
32
61
  /** The CLI ran under a CI system (`CI`, `GITHUB_ACTIONS`, …); absent from older CLIs. */
33
62
  ci?: boolean;
63
+ /** How the CLI was launched (`npx`, `global`, …); absent from older CLIs. */
64
+ invoked_via?: InvokedVia;
65
+ /** Which instruction file in the project names flypod (`none` for none); absent from older CLIs. */
66
+ agent_guide?: AgentGuide;
34
67
  }
35
68
  /**
36
69
  * The valid subset of the CLI's headers. Each is checked on its own and an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flypod",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Zero-auth deploy primitive. Turns any folder into a live URL in one command. For AI agents and humans.",
5
5
  "module": "./dist/src/cli.js",
6
6
  "types": "./dist/src/cli.d.ts",