git-coco 0.14.7 → 0.14.8

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.d.ts CHANGED
@@ -239,12 +239,14 @@ interface SpinnerOptions {
239
239
  }
240
240
  interface Config {
241
241
  verbose?: boolean;
242
+ silent?: boolean;
242
243
  }
243
244
  declare class Logger {
244
245
  private config;
245
246
  private timerStart;
246
247
  private spinner;
247
248
  constructor(config: Config);
249
+ setConfig(config: Config): Logger;
248
250
  log(message: string, options?: LoggerOptions): Logger;
249
251
  verbose(message: string, options?: LoggerOptions): Logger;
250
252
  startTimer(): Logger;
@@ -55,7 +55,7 @@ import * as readline from 'readline';
55
55
  /**
56
56
  * Current build version from package.json
57
57
  */
58
- const BUILD_VERSION = "0.14.7";
58
+ const BUILD_VERSION = "0.14.8";
59
59
 
60
60
  const isInteractive = (config) => {
61
61
  return config?.mode === 'interactive' || !!config?.interactive;
@@ -1769,7 +1769,17 @@ class Logger {
1769
1769
  this.config = config;
1770
1770
  this.spinner = null;
1771
1771
  }
1772
+ setConfig(config) {
1773
+ this.config = {
1774
+ ...this.config,
1775
+ ...config,
1776
+ };
1777
+ return this;
1778
+ }
1772
1779
  log(message, options = { color: 'blue' }) {
1780
+ if (this.config?.silent) {
1781
+ return this;
1782
+ }
1773
1783
  let outputMessage = message;
1774
1784
  if (options.color) {
1775
1785
  outputMessage = chalk[options.color](outputMessage);
@@ -1778,7 +1788,7 @@ class Logger {
1778
1788
  return this;
1779
1789
  }
1780
1790
  verbose(message, options = {}) {
1781
- if (!this.config?.verbose) {
1791
+ if (!this.config?.verbose || this.config?.silent) {
1782
1792
  return this;
1783
1793
  }
1784
1794
  this.log(message, options);
@@ -1789,13 +1799,11 @@ class Logger {
1789
1799
  return this;
1790
1800
  }
1791
1801
  stopTimer(message, options = { color: 'yellow' }) {
1792
- if (!this.config?.verbose || !this.timerStart) {
1802
+ if (!this.config?.verbose || !this.timerStart || this.config?.silent) {
1793
1803
  return this;
1794
1804
  }
1795
1805
  const elapsedTime = prettyMilliseconds(now() - this.timerStart);
1796
- let outputMessage = message
1797
- ? `${message} (⏲ ${elapsedTime})`
1798
- : `⏲ ${elapsedTime}`;
1806
+ let outputMessage = message ? `${message} (⏲ ${elapsedTime})` : `⏲ ${elapsedTime}`;
1799
1807
  if (options.color) {
1800
1808
  outputMessage = chalk[options.color](outputMessage);
1801
1809
  }
@@ -1803,11 +1811,17 @@ class Logger {
1803
1811
  return this;
1804
1812
  }
1805
1813
  startSpinner(message, options = { color: 'green' }) {
1814
+ if (this.config?.silent) {
1815
+ return this;
1816
+ }
1806
1817
  const spinnerMessage = options.color ? chalk[options.color](message) : message;
1807
1818
  this.spinner = ora(spinnerMessage).start();
1808
1819
  return this;
1809
1820
  }
1810
1821
  stopSpinner(message = '', options = { mode: 'succeed', color: 'green' }) {
1822
+ if (this.config?.silent) {
1823
+ return this;
1824
+ }
1811
1825
  const spinnerMessage = options?.color ? chalk[options.color](message) : message;
1812
1826
  this.spinner?.[options.mode || 'succeed'](spinnerMessage);
1813
1827
  this.spinner = null;
@@ -6237,10 +6251,13 @@ const handler$3 = async (argv, logger) => {
6237
6251
  }
6238
6252
  const tokenizer = await getTokenCounter(provider === 'openai' ? model : 'gpt-4o');
6239
6253
  const llm = getLlm(provider, model, config);
6240
- const INTERACTIVE = isInteractive(config);
6254
+ const INTERACTIVE = argv.interactive || isInteractive(config);
6241
6255
  if (INTERACTIVE) {
6242
6256
  logger.log(LOGO);
6243
6257
  }
6258
+ else {
6259
+ logger.setConfig({ silent: true });
6260
+ }
6244
6261
  async function factory() {
6245
6262
  const changes = await getChanges({
6246
6263
  git,
package/dist/index.js CHANGED
@@ -77,7 +77,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline$1);
77
77
  /**
78
78
  * Current build version from package.json
79
79
  */
80
- const BUILD_VERSION = "0.14.7";
80
+ const BUILD_VERSION = "0.14.8";
81
81
 
82
82
  const isInteractive = (config) => {
83
83
  return config?.mode === 'interactive' || !!config?.interactive;
@@ -1791,7 +1791,17 @@ class Logger {
1791
1791
  this.config = config;
1792
1792
  this.spinner = null;
1793
1793
  }
1794
+ setConfig(config) {
1795
+ this.config = {
1796
+ ...this.config,
1797
+ ...config,
1798
+ };
1799
+ return this;
1800
+ }
1794
1801
  log(message, options = { color: 'blue' }) {
1802
+ if (this.config?.silent) {
1803
+ return this;
1804
+ }
1795
1805
  let outputMessage = message;
1796
1806
  if (options.color) {
1797
1807
  outputMessage = chalk[options.color](outputMessage);
@@ -1800,7 +1810,7 @@ class Logger {
1800
1810
  return this;
1801
1811
  }
1802
1812
  verbose(message, options = {}) {
1803
- if (!this.config?.verbose) {
1813
+ if (!this.config?.verbose || this.config?.silent) {
1804
1814
  return this;
1805
1815
  }
1806
1816
  this.log(message, options);
@@ -1811,13 +1821,11 @@ class Logger {
1811
1821
  return this;
1812
1822
  }
1813
1823
  stopTimer(message, options = { color: 'yellow' }) {
1814
- if (!this.config?.verbose || !this.timerStart) {
1824
+ if (!this.config?.verbose || !this.timerStart || this.config?.silent) {
1815
1825
  return this;
1816
1826
  }
1817
1827
  const elapsedTime = prettyMilliseconds(now() - this.timerStart);
1818
- let outputMessage = message
1819
- ? `${message} (⏲ ${elapsedTime})`
1820
- : `⏲ ${elapsedTime}`;
1828
+ let outputMessage = message ? `${message} (⏲ ${elapsedTime})` : `⏲ ${elapsedTime}`;
1821
1829
  if (options.color) {
1822
1830
  outputMessage = chalk[options.color](outputMessage);
1823
1831
  }
@@ -1825,11 +1833,17 @@ class Logger {
1825
1833
  return this;
1826
1834
  }
1827
1835
  startSpinner(message, options = { color: 'green' }) {
1836
+ if (this.config?.silent) {
1837
+ return this;
1838
+ }
1828
1839
  const spinnerMessage = options.color ? chalk[options.color](message) : message;
1829
1840
  this.spinner = ora(spinnerMessage).start();
1830
1841
  return this;
1831
1842
  }
1832
1843
  stopSpinner(message = '', options = { mode: 'succeed', color: 'green' }) {
1844
+ if (this.config?.silent) {
1845
+ return this;
1846
+ }
1833
1847
  const spinnerMessage = options?.color ? chalk[options.color](message) : message;
1834
1848
  this.spinner?.[options.mode || 'succeed'](spinnerMessage);
1835
1849
  this.spinner = null;
@@ -6259,10 +6273,13 @@ const handler$3 = async (argv, logger) => {
6259
6273
  }
6260
6274
  const tokenizer = await getTokenCounter(provider === 'openai' ? model : 'gpt-4o');
6261
6275
  const llm = getLlm(provider, model, config);
6262
- const INTERACTIVE = isInteractive(config);
6276
+ const INTERACTIVE = argv.interactive || isInteractive(config);
6263
6277
  if (INTERACTIVE) {
6264
6278
  logger.log(LOGO);
6265
6279
  }
6280
+ else {
6281
+ logger.setConfig({ silent: true });
6282
+ }
6266
6283
  async function factory() {
6267
6284
  const changes = await getChanges({
6268
6285
  git,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-coco",
3
- "version": "0.14.7",
3
+ "version": "0.14.8",
4
4
  "description": "zero-effort git commits with coco.",
5
5
  "author": "gfargo <ghfargo@gmail.com>",
6
6
  "license": "MIT",
@@ -100,7 +100,7 @@
100
100
  "p-queue": "5.0.0",
101
101
  "performance-now": "2.1.0",
102
102
  "pretty-ms": "7.0.1",
103
- "simple-git": "3.25.0",
103
+ "simple-git": "3.27.0",
104
104
  "tiktoken": "^1.0.17",
105
105
  "yargs": "17.7.2"
106
106
  }