@sonnechasser/ntrp 2.0.1 → 2.1.9

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
@@ -14154,13 +14154,65 @@ __export(spinner_exports, {
14154
14154
  withSpinner: () => withSpinner
14155
14155
  });
14156
14156
  import ora from "ora";
14157
+ function clearElapsedTimer(spin) {
14158
+ const state2 = timerStates.get(spin);
14159
+ if (state2?.timer) clearInterval(state2.timer);
14160
+ if (state2) state2.timer = null;
14161
+ spin.suffixText = "";
14162
+ }
14163
+ function startElapsedTimer(spin) {
14164
+ if (!spin.isSpinning || process.stderr.isTTY !== true) return;
14165
+ const state2 = timerStates.get(spin) ?? {
14166
+ startedAt: Date.now(),
14167
+ timer: null,
14168
+ reassured: false
14169
+ };
14170
+ if (state2.timer) return;
14171
+ state2.startedAt = Date.now();
14172
+ state2.reassured = false;
14173
+ spin.suffixText = "(0s)";
14174
+ state2.timer = setInterval(() => {
14175
+ const elapsedSeconds = Math.floor((Date.now() - state2.startedAt) / 1e3);
14176
+ spin.suffixText = `(${elapsedSeconds}s)`;
14177
+ if (!state2.reassured && elapsedSeconds >= STILL_WORKING_AFTER_SECONDS) {
14178
+ state2.reassured = true;
14179
+ spin.clear();
14180
+ process.stderr.write("Still working\u2026\n");
14181
+ spin.render();
14182
+ }
14183
+ }, ELAPSED_TICK_MS);
14184
+ timerStates.set(spin, state2);
14185
+ }
14186
+ function addElapsedTimer(spin) {
14187
+ const start = spin.start.bind(spin);
14188
+ const stop = spin.stop.bind(spin);
14189
+ const stopAndPersist = spin.stopAndPersist.bind(spin);
14190
+ spin.start = (text) => {
14191
+ start(text);
14192
+ startElapsedTimer(spin);
14193
+ return spin;
14194
+ };
14195
+ spin.stop = () => {
14196
+ clearElapsedTimer(spin);
14197
+ stop();
14198
+ return spin;
14199
+ };
14200
+ spin.stopAndPersist = (options) => {
14201
+ clearElapsedTimer(spin);
14202
+ stopAndPersist(options);
14203
+ return spin;
14204
+ };
14205
+ return spin;
14206
+ }
14157
14207
  function makeSpinner(text, opts = {}) {
14158
- return ora({
14159
- text,
14160
- color: "cyan",
14161
- indent: opts.indent ?? 2,
14162
- discardStdin: false
14163
- }).start();
14208
+ return addElapsedTimer(
14209
+ ora({
14210
+ text,
14211
+ color: "cyan",
14212
+ indent: opts.indent ?? 2,
14213
+ discardStdin: false
14214
+ })
14215
+ ).start();
14164
14216
  }
14165
14217
  async function withSpinner(text, fn, opts = {}) {
14166
14218
  const spin = makeSpinner(text, opts);
@@ -14176,11 +14228,17 @@ async function withSpinner(text, fn, opts = {}) {
14176
14228
  if (opts.fail) spin.fail(opts.fail);
14177
14229
  else spin.stop();
14178
14230
  throw err;
14231
+ } finally {
14232
+ clearElapsedTimer(spin);
14179
14233
  }
14180
14234
  }
14235
+ var ELAPSED_TICK_MS, STILL_WORKING_AFTER_SECONDS, timerStates;
14181
14236
  var init_spinner = __esm({
14182
14237
  "src/ui/spinner.ts"() {
14183
14238
  "use strict";
14239
+ ELAPSED_TICK_MS = 1e3;
14240
+ STILL_WORKING_AFTER_SECONDS = 15;
14241
+ timerStates = /* @__PURE__ */ new WeakMap();
14184
14242
  }
14185
14243
  });
14186
14244
 
@@ -34286,11 +34344,17 @@ async function runProfileTier(session, ctx, existing) {
34286
34344
  invalidateTaxonomy();
34287
34345
  creditOnboardComplete(ctx);
34288
34346
  markOnboardTierComplete("profile");
34347
+ console.log();
34348
+ console.log(" " + chalk36.green("\u2713") + " " + bold(`Profile saved for ${candidate.company_name}`));
34289
34349
  if (hasAnyLlmProvider()) {
34290
- console.log();
34291
- console.log(" " + chalk36.green("\u2713") + " " + bold(`Profile saved for ${candidate.company_name}`));
34292
34350
  console.log(" " + chalk36.dim("A key is already connected \u2014 running domain research now."));
34293
34351
  console.log();
34352
+ } else {
34353
+ console.log(" " + chalk36.dim(`~/.ntrp/profile.json`));
34354
+ console.log();
34355
+ await ensureLlmKeys(session);
34356
+ }
34357
+ if (hasAnyLlmProvider()) {
34294
34358
  await runDomainResearchOnProfile(session, ctx, candidate);
34295
34359
  markOnboardTierComplete("domain");
34296
34360
  await offerInboxSkillSetup(session, { beat: "production" });
@@ -34299,10 +34363,6 @@ async function runProfileTier(session, ctx, existing) {
34299
34363
  printNextTierHint(ctx);
34300
34364
  return `Profile + domain research saved for ${candidate.company_name}`;
34301
34365
  }
34302
- console.log();
34303
- console.log(" " + chalk36.green("\u2713") + " " + bold(`Profile saved for ${candidate.company_name}`));
34304
- console.log(" " + chalk36.dim(`~/.ntrp/profile.json`));
34305
- console.log();
34306
34366
  await offerInboxSkillSetup(session, { beat: "production" });
34307
34367
  const { offerVoiceSetup: offerVoiceSetup2 } = await Promise.resolve().then(() => (init_voice_setup(), voice_setup_exports));
34308
34368
  await offerVoiceSetup2(ctx, session);
@@ -17908,17 +17908,73 @@ var init_gap_audit = __esm({
17908
17908
 
17909
17909
  // src/ui/spinner.ts
17910
17910
  import ora from "ora";
17911
+ function clearElapsedTimer(spin) {
17912
+ const state2 = timerStates.get(spin);
17913
+ if (state2?.timer) clearInterval(state2.timer);
17914
+ if (state2) state2.timer = null;
17915
+ spin.suffixText = "";
17916
+ }
17917
+ function startElapsedTimer(spin) {
17918
+ if (!spin.isSpinning || process.stderr.isTTY !== true) return;
17919
+ const state2 = timerStates.get(spin) ?? {
17920
+ startedAt: Date.now(),
17921
+ timer: null,
17922
+ reassured: false
17923
+ };
17924
+ if (state2.timer) return;
17925
+ state2.startedAt = Date.now();
17926
+ state2.reassured = false;
17927
+ spin.suffixText = "(0s)";
17928
+ state2.timer = setInterval(() => {
17929
+ const elapsedSeconds = Math.floor((Date.now() - state2.startedAt) / 1e3);
17930
+ spin.suffixText = `(${elapsedSeconds}s)`;
17931
+ if (!state2.reassured && elapsedSeconds >= STILL_WORKING_AFTER_SECONDS) {
17932
+ state2.reassured = true;
17933
+ spin.clear();
17934
+ process.stderr.write("Still working\u2026\n");
17935
+ spin.render();
17936
+ }
17937
+ }, ELAPSED_TICK_MS);
17938
+ timerStates.set(spin, state2);
17939
+ }
17940
+ function addElapsedTimer(spin) {
17941
+ const start = spin.start.bind(spin);
17942
+ const stop = spin.stop.bind(spin);
17943
+ const stopAndPersist = spin.stopAndPersist.bind(spin);
17944
+ spin.start = (text) => {
17945
+ start(text);
17946
+ startElapsedTimer(spin);
17947
+ return spin;
17948
+ };
17949
+ spin.stop = () => {
17950
+ clearElapsedTimer(spin);
17951
+ stop();
17952
+ return spin;
17953
+ };
17954
+ spin.stopAndPersist = (options) => {
17955
+ clearElapsedTimer(spin);
17956
+ stopAndPersist(options);
17957
+ return spin;
17958
+ };
17959
+ return spin;
17960
+ }
17911
17961
  function makeSpinner(text, opts = {}) {
17912
- return ora({
17913
- text,
17914
- color: "cyan",
17915
- indent: opts.indent ?? 2,
17916
- discardStdin: false
17917
- }).start();
17962
+ return addElapsedTimer(
17963
+ ora({
17964
+ text,
17965
+ color: "cyan",
17966
+ indent: opts.indent ?? 2,
17967
+ discardStdin: false
17968
+ })
17969
+ ).start();
17918
17970
  }
17971
+ var ELAPSED_TICK_MS, STILL_WORKING_AFTER_SECONDS, timerStates;
17919
17972
  var init_spinner = __esm({
17920
17973
  "src/ui/spinner.ts"() {
17921
17974
  "use strict";
17975
+ ELAPSED_TICK_MS = 1e3;
17976
+ STILL_WORKING_AFTER_SECONDS = 15;
17977
+ timerStates = /* @__PURE__ */ new WeakMap();
17922
17978
  }
17923
17979
  });
17924
17980
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonnechasser/ntrp",
3
- "version": "2.0.1",
3
+ "version": "2.1.9",
4
4
  "description": "GTM Health Diagnostic CLI — local pipeline analysis tool",
5
5
  "homepage": "https://ntrp.sonnechasser.com",
6
6
  "repository": {