fathom-cli 0.2.1 → 0.2.3

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/dist/index.js CHANGED
@@ -15804,7 +15804,7 @@ var VERSION = "0.1.0";
15804
15804
 
15805
15805
  // src/commands/go.ts
15806
15806
  import { Command as Command3 } from "commander";
15807
- import { existsSync as existsSync6 } from "fs";
15807
+ import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
15808
15808
  import { resolve as resolve7, basename as basename2 } from "path";
15809
15809
  import { spawn } from "child_process";
15810
15810
  import chalk4 from "chalk";
@@ -17233,7 +17233,7 @@ async function executeBuildMode(mode, promptPath, state) {
17233
17233
  console.log(chalk4.dim("\n Launching Claude Code..."));
17234
17234
  console.log(chalk4.dim(` Context: ${state.featuresTotal} features, starting with ${state.buildQueue[0] ?? "queue"}`));
17235
17235
  console.log(chalk4.dim(" " + "\u2500".repeat(50)));
17236
- await launchClaude(promptPath);
17236
+ await launchClaude(promptPath, void 0, state.buildQueue[0]);
17237
17237
  console.log(chalk4.dim(" " + "\u2500".repeat(50)));
17238
17238
  console.log(chalk4.dim(" Session complete."));
17239
17239
  updateWorkflowState({ ...state, phase: "review", lastSessionAt: (/* @__PURE__ */ new Date()).toISOString() });
@@ -17262,7 +17262,7 @@ async function executeBuildMode(mode, promptPath, state) {
17262
17262
  const launchDir = existsSync6(worktreePath) ? worktreePath : process.cwd();
17263
17263
  console.log(chalk4.dim(` Launching Claude Code in ${launchDir}...`));
17264
17264
  console.log(chalk4.dim(" " + "\u2500".repeat(50)));
17265
- await launchClaude(promptPath, launchDir);
17265
+ await launchClaude(promptPath, launchDir, state.buildQueue[0]);
17266
17266
  console.log(chalk4.dim(" " + "\u2500".repeat(50)));
17267
17267
  console.log(chalk4.dim(" Session complete."));
17268
17268
  updateWorkflowState({ ...state, phase: "review", lastSessionAt: (/* @__PURE__ */ new Date()).toISOString() });
@@ -17282,9 +17282,11 @@ async function executeBuildMode(mode, promptPath, state) {
17282
17282
  }
17283
17283
  return false;
17284
17284
  }
17285
- function launchClaude(promptPath, cwd) {
17285
+ function launchClaude(promptPath, cwd, firstFeature) {
17286
17286
  return new Promise((resolve18) => {
17287
- const child = spawn("claude", ["--prompt-file", promptPath], {
17287
+ const promptContent = readFileSync6(promptPath, "utf-8");
17288
+ const initialPrompt = firstFeature ? `Read the build context in your system prompt. Start working on feature \`${firstFeature}\` \u2014 read the spec reference, plan the implementation, and begin.` : "Read the build context in your system prompt and start working on the first feature in the priority queue.";
17289
+ const child = spawn("claude", ["--append-system-prompt", promptContent, initialPrompt], {
17288
17290
  stdio: "inherit",
17289
17291
  cwd: cwd ?? process.cwd()
17290
17292
  });
@@ -17323,7 +17325,7 @@ function printStatus(state) {
17323
17325
 
17324
17326
  // src/commands/analyze.ts
17325
17327
  import { Command as Command4 } from "commander";
17326
- import { readFileSync as readFileSync6, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, existsSync as existsSync7 } from "fs";
17328
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, existsSync as existsSync7 } from "fs";
17327
17329
  import { resolve as resolve8 } from "path";
17328
17330
  import chalk5 from "chalk";
17329
17331
  import Table2 from "cli-table3";
@@ -17333,7 +17335,7 @@ var analyzeCommand = new Command4("analyze").description("Analyze a spec and gen
17333
17335
  console.error(chalk5.red(`Spec file not found: ${fullPath}`));
17334
17336
  process.exit(1);
17335
17337
  }
17336
- const content3 = readFileSync6(fullPath, "utf-8");
17338
+ const content3 = readFileSync7(fullPath, "utf-8");
17337
17339
  const data = loadData();
17338
17340
  console.log(chalk5.dim("Parsing spec..."));
17339
17341
  const spec = parseSpec(content3);
@@ -17503,7 +17505,7 @@ var pricingCommand = new Command5("pricing").description("Show current model pri
17503
17505
 
17504
17506
  // src/commands/status.ts
17505
17507
  import { Command as Command6 } from "commander";
17506
- import { readFileSync as readFileSync7, existsSync as existsSync8 } from "fs";
17508
+ import { readFileSync as readFileSync8, existsSync as existsSync8 } from "fs";
17507
17509
  import { resolve as resolve9 } from "path";
17508
17510
  import chalk7 from "chalk";
17509
17511
  import Table4 from "cli-table3";
@@ -17517,7 +17519,7 @@ var statusCommand = new Command6("status").description("Show project status from
17517
17519
  );
17518
17520
  return;
17519
17521
  }
17520
- const registry = JSON.parse(readFileSync7(registryPath, "utf-8"));
17522
+ const registry = JSON.parse(readFileSync8(registryPath, "utf-8"));
17521
17523
  const projectName = options.project ?? registry.project ?? getProjectName();
17522
17524
  const summaryPath = resolve9(
17523
17525
  process.cwd(),
@@ -17529,7 +17531,7 @@ var statusCommand = new Command6("status").description("Show project status from
17529
17531
  const hasTracking = existsSync8(summaryPath);
17530
17532
  const actuals = /* @__PURE__ */ new Map();
17531
17533
  if (hasTracking) {
17532
- const summary = JSON.parse(readFileSync7(summaryPath, "utf-8"));
17534
+ const summary = JSON.parse(readFileSync8(summaryPath, "utf-8"));
17533
17535
  for (const s of summary.sessions) {
17534
17536
  if (!s.featureId || s.status === "untagged") continue;
17535
17537
  const existing = actuals.get(s.featureId) ?? { tokens: 0, sessions: 0 };
@@ -17592,13 +17594,13 @@ Total estimated: ${totalEstimated.toLocaleString()} tokens`));
17592
17594
 
17593
17595
  // src/commands/track.ts
17594
17596
  import { Command as Command7 } from "commander";
17595
- import { readFileSync as readFileSync9, existsSync as existsSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync7 } from "fs";
17597
+ import { readFileSync as readFileSync10, existsSync as existsSync10, writeFileSync as writeFileSync7, mkdirSync as mkdirSync7 } from "fs";
17596
17598
  import { resolve as resolve10 } from "path";
17597
17599
  import chalk8 from "chalk";
17598
17600
  import Table5 from "cli-table3";
17599
17601
 
17600
17602
  // ../tracker/dist/index.js
17601
- import { readFileSync as readFileSync8, readdirSync as readdirSync2, existsSync as existsSync9 } from "fs";
17603
+ import { readFileSync as readFileSync9, readdirSync as readdirSync2, existsSync as existsSync9 } from "fs";
17602
17604
  import { join, basename as basename3 } from "path";
17603
17605
  import { homedir } from "os";
17604
17606
  import { countTokens } from "@anthropic-ai/tokenizer";
@@ -17658,7 +17660,7 @@ var Registry = external_exports.object({
17658
17660
  generatedAt: external_exports.string()
17659
17661
  });
17660
17662
  function parseSessionFile(filePath) {
17661
- const content3 = readFileSync8(filePath, "utf-8");
17663
+ const content3 = readFileSync9(filePath, "utf-8");
17662
17664
  const lines = content3.trim().split("\n").filter(Boolean);
17663
17665
  if (lines.length === 0) return null;
17664
17666
  let inputTokens = 0;
@@ -18007,7 +18009,7 @@ var trackCommand = new Command7("track").description("Import Claude Code session
18007
18009
  return;
18008
18010
  }
18009
18011
  const registry = JSON.parse(
18010
- readFileSync9(registryPath, "utf-8")
18012
+ readFileSync10(registryPath, "utf-8")
18011
18013
  );
18012
18014
  const projectName = options.project ?? registry.project ?? getProjectName();
18013
18015
  console.log(chalk8.dim("Scanning for sessions..."));
@@ -18034,7 +18036,7 @@ var trackCommand = new Command7("track").description("Import Claude Code session
18034
18036
  );
18035
18037
  const trackedIds = /* @__PURE__ */ new Set();
18036
18038
  if (!options.backfill && existsSync10(summaryPath)) {
18037
- const summary = JSON.parse(readFileSync9(summaryPath, "utf-8"));
18039
+ const summary = JSON.parse(readFileSync10(summaryPath, "utf-8"));
18038
18040
  for (const s of summary.sessions ?? []) {
18039
18041
  trackedIds.add(s.sessionId);
18040
18042
  }
@@ -18134,7 +18136,7 @@ Total: ${totalTokens.toLocaleString()} tokens across ${results.length} sessions`
18134
18136
  }));
18135
18137
  let existing = { sessions: [] };
18136
18138
  if (existsSync10(summaryPath)) {
18137
- existing = JSON.parse(readFileSync9(summaryPath, "utf-8"));
18139
+ existing = JSON.parse(readFileSync10(summaryPath, "utf-8"));
18138
18140
  }
18139
18141
  existing.sessions.push(...sessionRecords);
18140
18142
  writeFileSync7(
@@ -18187,7 +18189,7 @@ Tracking saved: ${summaryPath}`));
18187
18189
 
18188
18190
  // src/commands/reconcile.ts
18189
18191
  import { Command as Command8 } from "commander";
18190
- import { readFileSync as readFileSync10, existsSync as existsSync11 } from "fs";
18192
+ import { readFileSync as readFileSync11, existsSync as existsSync11 } from "fs";
18191
18193
  import { resolve as resolve11 } from "path";
18192
18194
  import chalk9 from "chalk";
18193
18195
  import Table6 from "cli-table3";
@@ -18216,8 +18218,8 @@ var reconcileCommand = new Command8("reconcile").description("Compare estimates
18216
18218
  );
18217
18219
  return;
18218
18220
  }
18219
- const registry = JSON.parse(readFileSync10(registryPath, "utf-8"));
18220
- const summary = JSON.parse(readFileSync10(summaryPath, "utf-8"));
18221
+ const registry = JSON.parse(readFileSync11(registryPath, "utf-8"));
18222
+ const summary = JSON.parse(readFileSync11(summaryPath, "utf-8"));
18221
18223
  const projectName = options.project ?? registry.project ?? getProjectName();
18222
18224
  const data = loadData();
18223
18225
  const actuals = /* @__PURE__ */ new Map();
@@ -18392,7 +18394,7 @@ Overall: ${totalActual.toLocaleString()} / ${totalEstimated.toLocaleString()} to
18392
18394
 
18393
18395
  // src/commands/calibrate.ts
18394
18396
  import { Command as Command9 } from "commander";
18395
- import { readFileSync as readFileSync11, existsSync as existsSync12 } from "fs";
18397
+ import { readFileSync as readFileSync12, existsSync as existsSync12 } from "fs";
18396
18398
  import { resolve as resolve12 } from "path";
18397
18399
  import chalk10 from "chalk";
18398
18400
  import Table7 from "cli-table3";
@@ -18413,8 +18415,8 @@ var calibrateCommand = new Command9("calibrate").description("Show calibration d
18413
18415
  );
18414
18416
  return;
18415
18417
  }
18416
- const registry = JSON.parse(readFileSync11(registryPath, "utf-8"));
18417
- const summary = JSON.parse(readFileSync11(summaryPath, "utf-8"));
18418
+ const registry = JSON.parse(readFileSync12(registryPath, "utf-8"));
18419
+ const summary = JSON.parse(readFileSync12(summaryPath, "utf-8"));
18418
18420
  const projectName = options.project ?? registry.project ?? getProjectName();
18419
18421
  const actuals = /* @__PURE__ */ new Map();
18420
18422
  for (const session of summary.sessions) {
@@ -18608,7 +18610,7 @@ var estimateCommand = new Command10("estimate").description("Quick single-featur
18608
18610
 
18609
18611
  // src/commands/validate.ts
18610
18612
  import { Command as Command11 } from "commander";
18611
- import { readFileSync as readFileSync12, existsSync as existsSync13 } from "fs";
18613
+ import { readFileSync as readFileSync13, existsSync as existsSync13 } from "fs";
18612
18614
  import { resolve as resolve13 } from "path";
18613
18615
  import chalk12 from "chalk";
18614
18616
  var validateCommand = new Command11("validate").description("Validate a spec file format without running full analysis").argument("<spec>", "Path to the spec markdown file").action((specPath) => {
@@ -18617,7 +18619,7 @@ var validateCommand = new Command11("validate").description("Validate a spec fil
18617
18619
  console.error(chalk12.red(`Spec file not found: ${fullPath}`));
18618
18620
  process.exit(1);
18619
18621
  }
18620
- const content3 = readFileSync12(fullPath, "utf-8");
18622
+ const content3 = readFileSync13(fullPath, "utf-8");
18621
18623
  console.log(chalk12.bold("\nFathom \u2014 Validate Spec"));
18622
18624
  console.log(chalk12.dim("\u2500".repeat(50)));
18623
18625
  console.log(chalk12.dim(`File: ${fullPath}`));
@@ -18686,7 +18688,7 @@ var validateCommand = new Command11("validate").description("Validate a spec fil
18686
18688
 
18687
18689
  // src/commands/velocity.ts
18688
18690
  import { Command as Command12 } from "commander";
18689
- import { readFileSync as readFileSync13, existsSync as existsSync14 } from "fs";
18691
+ import { readFileSync as readFileSync14, existsSync as existsSync14 } from "fs";
18690
18692
  import { resolve as resolve14 } from "path";
18691
18693
  import chalk13 from "chalk";
18692
18694
  import Table8 from "cli-table3";
@@ -19009,8 +19011,8 @@ var velocityCommand = new Command12("velocity").description("Show velocity metri
19009
19011
  );
19010
19012
  return;
19011
19013
  }
19012
- const registry = JSON.parse(readFileSync13(registryPath, "utf-8"));
19013
- const summary = JSON.parse(readFileSync13(summaryPath, "utf-8"));
19014
+ const registry = JSON.parse(readFileSync14(registryPath, "utf-8"));
19015
+ const summary = JSON.parse(readFileSync14(summaryPath, "utf-8"));
19014
19016
  const projectName = options.project ?? registry.project ?? getProjectName();
19015
19017
  const data = loadData();
19016
19018
  const featureDataMap = /* @__PURE__ */ new Map();
@@ -19197,7 +19199,7 @@ var initCommand = new Command13("init").description("Initialize Fathom global co
19197
19199
 
19198
19200
  // src/commands/rename.ts
19199
19201
  import { Command as Command14 } from "commander";
19200
- import { readFileSync as readFileSync14, writeFileSync as writeFileSync9, existsSync as existsSync16 } from "fs";
19202
+ import { readFileSync as readFileSync15, writeFileSync as writeFileSync9, existsSync as existsSync16 } from "fs";
19201
19203
  import { resolve as resolve16 } from "path";
19202
19204
  import chalk15 from "chalk";
19203
19205
  var renameCommand = new Command14("rename").description("Rename the project in all .claude/te/ config files").argument("<name>", "New project name").action((name) => {
@@ -19218,7 +19220,7 @@ var renameCommand = new Command14("rename").description("Rename the project in a
19218
19220
  let updated = 0;
19219
19221
  for (const filePath of jsonFiles) {
19220
19222
  if (!existsSync16(filePath)) continue;
19221
- const data = JSON.parse(readFileSync14(filePath, "utf-8"));
19223
+ const data = JSON.parse(readFileSync15(filePath, "utf-8"));
19222
19224
  if (data.project) {
19223
19225
  oldName = data.project;
19224
19226
  data.project = name;
@@ -19228,7 +19230,7 @@ var renameCommand = new Command14("rename").description("Rename the project in a
19228
19230
  }
19229
19231
  const skillPath = resolve16(baseDir, ".claude", "skills", "fathom", "SKILL.md");
19230
19232
  if (existsSync16(skillPath)) {
19231
- const content3 = readFileSync14(skillPath, "utf-8");
19233
+ const content3 = readFileSync15(skillPath, "utf-8");
19232
19234
  const newContent = content3.replaceAll(oldName, name);
19233
19235
  if (newContent !== content3) {
19234
19236
  writeFileSync9(skillPath, newContent);
@@ -19237,7 +19239,7 @@ var renameCommand = new Command14("rename").description("Rename the project in a
19237
19239
  }
19238
19240
  const hookPath = resolve16(baseDir, ".claude", "hooks", "te-session-sync.sh");
19239
19241
  if (existsSync16(hookPath)) {
19240
- const content3 = readFileSync14(hookPath, "utf-8");
19242
+ const content3 = readFileSync15(hookPath, "utf-8");
19241
19243
  const newContent = content3.replaceAll(oldName, name);
19242
19244
  if (newContent !== content3) {
19243
19245
  writeFileSync9(hookPath, newContent);