git-coco 0.13.1 → 0.13.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 gfargo
3
+ Copyright (c) 2024 gfargo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -14,6 +14,8 @@
14
14
 
15
15
  - **`changelog`**: create changelogs for the current branch or a range of commits.
16
16
 
17
+ - **`recap`**: summarize changes from working-tree, or yesterday, or in the last month, or since the last tag!
18
+
17
19
  - **`init`**: step by step wizard to set up `coco` globally or for a project.
18
20
 
19
21
  ## Getting Started
@@ -42,6 +44,24 @@ coco
42
44
  coco commit
43
45
  ```
44
46
 
47
+ #### Useful options
48
+
49
+
50
+ ```bash
51
+ # --append
52
+ # Add content to the end of the generated commit
53
+ coco --append "Resolves #128"
54
+
55
+ # --append-ticket
56
+ # Automatically append Jira/Linear ticket ID from the branch name to the commit message
57
+ coco --append-ticket
58
+
59
+ # --additional
60
+ # Add extra context before generating the commit
61
+ coco --additional "Resolves UX bug with sign up button"
62
+ ```
63
+
64
+
45
65
  ### **`coco changelog`**
46
66
 
47
67
  Creates changelogs.
@@ -52,8 +72,22 @@ coco changelog
52
72
 
53
73
  # For a specific range
54
74
  coco changelog -r HEAD~5:HEAD
75
+
76
+ # For a target branch
77
+ coco changelog -b other-branch
55
78
  ```
56
79
 
80
+ ### **`coco recap`**
81
+
82
+ Summarize the working-tree, or other configured ranges
83
+
84
+ ```bash
85
+ # Summarize all working directory changes
86
+ coco recap
87
+
88
+ # Or these available ranges
89
+ coco recap --yesterday | --last-week | --last-month | --last-tag
90
+ ```
57
91
 
58
92
  ### Stdout vs. Interactive Mode
59
93
 
@@ -87,3 +121,11 @@ You can specify files to be ignored when generating commit messages by adding th
87
121
  ## Contribution
88
122
 
89
123
  We welcome contributions! Check out our [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
124
+
125
+ ## Project Stats
126
+
127
+ ![Alt](https://repobeats.axiom.co/api/embed/ea76b881139f16595a343046d4f2bc9125a47e26.svg "Repobeats analytics image")
128
+
129
+ ## License
130
+
131
+ MIT © [gfargo](https://github.com/gfargo/)
package/dist/index.d.ts CHANGED
@@ -195,9 +195,9 @@ declare const _default$1: {
195
195
 
196
196
  interface RecapOptions extends BaseCommandOptions {
197
197
  yesterday?: boolean;
198
- "last-week"?: boolean;
199
- "last-month"?: boolean;
200
- "last-tag"?: boolean;
198
+ 'last-week'?: boolean;
199
+ 'last-month'?: boolean;
200
+ 'last-tag'?: boolean;
201
201
  }
202
202
  type RecapArgv = Arguments<RecapOptions>;
203
203
 
@@ -4,7 +4,7 @@ import { ConditionalPromptSelector, isChatModel } from '@langchain/core/example_
4
4
  import yargs from 'yargs';
5
5
  import chalk from 'chalk';
6
6
  import * as fs from 'fs';
7
- import fs__default from 'fs';
7
+ import fs__default, { promises } from 'fs';
8
8
  import { confirm, editor, select, password, input } from '@inquirer/prompts';
9
9
  import * as ini from 'ini';
10
10
  import * as os from 'os';
@@ -2457,8 +2457,8 @@ const options$3 = {
2457
2457
  description: 'Toggle interactive mode',
2458
2458
  },
2459
2459
  };
2460
- const builder$3 = (yargsInstance) => {
2461
- return yargsInstance.options(options$3).usage(getCommandUsageHeader(changelog.command));
2460
+ const builder$3 = (yargs) => {
2461
+ return yargs.options(options$3).usage(getCommandUsageHeader(changelog.command));
2462
2462
  };
2463
2463
 
2464
2464
  var changelog = {
@@ -5948,8 +5948,14 @@ async function parseDefaultFileDiff(nodeFile, commit = '--staged', git) {
5948
5948
  return await git.diff([nodeFile.filePath]);
5949
5949
  }
5950
5950
  else if (commit === '--untracked') {
5951
- // For untracked files, return the entire file content
5952
- return await git.show([`:${nodeFile.filePath}`]);
5951
+ // For untracked files, read the file content directly from the filesystem
5952
+ try {
5953
+ const fileContent = await promises.readFile(nodeFile.filePath, 'utf-8');
5954
+ return fileContent;
5955
+ }
5956
+ catch (error) {
5957
+ throw new Error(`Error reading untracked file: ${error?.message || 'Unknown error'}`);
5958
+ }
5953
5959
  }
5954
5960
  return await git.diff([commit, nodeFile.filePath]);
5955
5961
  }
@@ -6362,8 +6368,8 @@ const options$2 = {
6362
6368
  type: 'string',
6363
6369
  },
6364
6370
  };
6365
- const builder$2 = (yargsInstance) => {
6366
- return yargsInstance.options(options$2).usage(getCommandUsageHeader(commit.command));
6371
+ const builder$2 = (yargs) => {
6372
+ return yargs.options(options$2).usage(getCommandUsageHeader(commit.command));
6367
6373
  };
6368
6374
 
6369
6375
  var commit = {
@@ -6984,17 +6990,17 @@ const options = {
6984
6990
  type: 'boolean',
6985
6991
  description: 'Recap for yesterday',
6986
6992
  },
6987
- "last-week": {
6993
+ 'last-week': {
6988
6994
  alias: 'week',
6989
6995
  type: 'boolean',
6990
6996
  description: 'Recap for last week',
6991
6997
  },
6992
- "last-month": {
6998
+ 'last-month': {
6993
6999
  alias: 'month',
6994
7000
  type: 'boolean',
6995
7001
  description: 'Recap for last month',
6996
7002
  },
6997
- "last-tag": {
7003
+ 'last-tag': {
6998
7004
  alias: 'tag',
6999
7005
  type: 'boolean',
7000
7006
  description: 'Recap for last tag',
@@ -7005,8 +7011,8 @@ const options = {
7005
7011
  description: 'Toggle interactive mode',
7006
7012
  },
7007
7013
  };
7008
- const builder = (yargsInstance) => {
7009
- return yargsInstance.options(options).usage(getCommandUsageHeader(recap.command));
7014
+ const builder = (yargs) => {
7015
+ return yargs.options(options).usage(getCommandUsageHeader(recap.command));
7010
7016
  };
7011
7017
 
7012
7018
  var recap = {
package/dist/index.js CHANGED
@@ -2478,8 +2478,8 @@ const options$3 = {
2478
2478
  description: 'Toggle interactive mode',
2479
2479
  },
2480
2480
  };
2481
- const builder$3 = (yargsInstance) => {
2482
- return yargsInstance.options(options$3).usage(getCommandUsageHeader(changelog.command));
2481
+ const builder$3 = (yargs) => {
2482
+ return yargs.options(options$3).usage(getCommandUsageHeader(changelog.command));
2483
2483
  };
2484
2484
 
2485
2485
  var changelog = {
@@ -5969,8 +5969,14 @@ async function parseDefaultFileDiff(nodeFile, commit = '--staged', git) {
5969
5969
  return await git.diff([nodeFile.filePath]);
5970
5970
  }
5971
5971
  else if (commit === '--untracked') {
5972
- // For untracked files, return the entire file content
5973
- return await git.show([`:${nodeFile.filePath}`]);
5972
+ // For untracked files, read the file content directly from the filesystem
5973
+ try {
5974
+ const fileContent = await fs.promises.readFile(nodeFile.filePath, 'utf-8');
5975
+ return fileContent;
5976
+ }
5977
+ catch (error) {
5978
+ throw new Error(`Error reading untracked file: ${error?.message || 'Unknown error'}`);
5979
+ }
5974
5980
  }
5975
5981
  return await git.diff([commit, nodeFile.filePath]);
5976
5982
  }
@@ -6383,8 +6389,8 @@ const options$2 = {
6383
6389
  type: 'string',
6384
6390
  },
6385
6391
  };
6386
- const builder$2 = (yargsInstance) => {
6387
- return yargsInstance.options(options$2).usage(getCommandUsageHeader(commit.command));
6392
+ const builder$2 = (yargs) => {
6393
+ return yargs.options(options$2).usage(getCommandUsageHeader(commit.command));
6388
6394
  };
6389
6395
 
6390
6396
  var commit = {
@@ -7005,17 +7011,17 @@ const options = {
7005
7011
  type: 'boolean',
7006
7012
  description: 'Recap for yesterday',
7007
7013
  },
7008
- "last-week": {
7014
+ 'last-week': {
7009
7015
  alias: 'week',
7010
7016
  type: 'boolean',
7011
7017
  description: 'Recap for last week',
7012
7018
  },
7013
- "last-month": {
7019
+ 'last-month': {
7014
7020
  alias: 'month',
7015
7021
  type: 'boolean',
7016
7022
  description: 'Recap for last month',
7017
7023
  },
7018
- "last-tag": {
7024
+ 'last-tag': {
7019
7025
  alias: 'tag',
7020
7026
  type: 'boolean',
7021
7027
  description: 'Recap for last tag',
@@ -7026,8 +7032,8 @@ const options = {
7026
7032
  description: 'Toggle interactive mode',
7027
7033
  },
7028
7034
  };
7029
- const builder = (yargsInstance) => {
7030
- return yargsInstance.options(options).usage(getCommandUsageHeader(recap.command));
7035
+ const builder = (yargs) => {
7036
+ return yargs.options(options).usage(getCommandUsageHeader(recap.command));
7031
7037
  };
7032
7038
 
7033
7039
  var recap = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-coco",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "zero-effort git commits with coco.",
5
5
  "author": "gfargo <ghfargo@gmail.com>",
6
6
  "license": "MIT",