@pc360/chlog 0.1.6 → 0.1.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/CHANGELOG.md CHANGED
@@ -7,32 +7,50 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
7
7
  ## [Unreleased]
8
8
 
9
9
  ### Changed
10
+
10
11
  - Removed Ink card border lines so help and status output no longer render inside a box.
11
12
  - Added blank lines before and after help and error output to improve readability.
12
13
 
14
+ ## [0.1.8] - 2026-02-14
15
+
16
+ ### Changed
17
+
18
+ - Update docs
19
+
20
+ ## [0.1.7] - 2026-02-14
21
+
22
+ ### Changed
23
+
24
+ - Bumped package version to `0.1.7`.
25
+
13
26
  ## [0.1.6] - 2026-02-14
14
27
 
15
28
  ### Changed
29
+
16
30
  - Bumped package version to `0.1.6`.
17
31
 
18
32
  ## [0.1.5] - 2026-02-14
19
33
 
20
34
  ### Changed
35
+
21
36
  - Bumped package version to `0.1.5`.
22
37
 
23
38
  ## [0.1.4] - 2026-02-14
24
39
 
25
40
  ### Changed
41
+
26
42
  - Cleaned project files and repository content.
27
43
 
28
44
  ## [0.1.3] - 2026-02-14
29
45
 
30
46
  ### Added
47
+
31
48
  - Improved help-menu text styling for better readability.
32
49
 
33
50
  ## [0.1.2] - 2026-02-14
34
51
 
35
52
  ### Added
53
+
36
54
  - Added short CLI flags:
37
55
  - `-t` for `--type`
38
56
  - `-s` for `--scope`
@@ -42,17 +60,20 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
42
60
  - Expanded unit and integration test coverage for short flag handling.
43
61
 
44
62
  ### Changed
63
+
45
64
  - Enhanced `chlog --help` content with clearer tool description and usage details.
46
65
 
47
66
  ## [0.1.1] - 2026-02-14
48
67
 
49
68
  ### Changed
69
+
50
70
  - Refactored CLI terminal rendering to use `ink` with styled output cards.
51
71
 
52
72
  ## [0.1.0] - 2026-02-13
53
73
 
54
74
  ### Added
55
- - Initial release of `pc360-changelog-cli`.
75
+
76
+ - Initial release of `@pc360/chlog`.
56
77
  - Core CLI flow for creating changelog entry files under:
57
78
  - `changelog/unreleased/added`
58
79
  - `changelog/unreleased/changed`
@@ -64,4 +85,5 @@ The format is based on Keep a Changelog, and this project follows Semantic Versi
64
85
  - Unit test coverage for parser, validation, timestamp, and output line formatting.
65
86
 
66
87
  ### Changed
88
+
67
89
  - Standardized output path naming from `changelogs/` to `changelog/`.
package/README.md CHANGED
@@ -17,34 +17,16 @@ Each entry file is automatically:
17
17
 
18
18
  ---
19
19
 
20
- ## 📦 Installation
21
-
22
- ### Option 1 — Install from `.tgz` package
23
-
24
- ```
25
- npm install -g pc360-changelog-cli-0.1.6.tgz
26
- ```
27
-
28
- ### Option 2 — Install from project folder
29
-
30
- ```
31
- npm install -g .
32
- ```
33
-
34
- After installation, the `chlog` command will be globally available.
35
-
36
- ---
37
-
38
20
  ## 🚀 Usage
39
21
 
40
22
  ```
41
- chlog --type <added|changed|fixed|removed> \
42
- --scope <scope> \
43
- --message "<description>" \
44
- [--frontend]
23
+ npx @pc360/chlog --type <added|changed|fixed|removed> \
24
+ --scope <scope> \
25
+ --message "<description>" \
26
+ [--frontend]
45
27
 
46
28
  # Short form
47
- chlog -t <added|changed|fixed|removed> -s <scope> -m "<description>" [-f]
29
+ npx @pc360/chlog -t <added|changed|fixed|removed> -s <scope> -m "<description>" [-f]
48
30
  ```
49
31
 
50
32
  ---
@@ -67,7 +49,7 @@ chlog -t <added|changed|fixed|removed> -s <scope> -m "<description>" [-f]
67
49
  ### Back-End Change (Default)
68
50
 
69
51
  ```
70
- chlog --type added --scope JES-33 --message "Add daily consolidated JE job"
52
+ npx @pc360/chlog --type added --scope JES-33 --message "Add daily consolidated JE job"
71
53
  ```
72
54
 
73
55
  Creates:
@@ -87,7 +69,7 @@ File content:
87
69
  ### Front-End Change
88
70
 
89
71
  ```
90
- chlog --type fixed --scope JES-45 --frontend --message "Fix table pagination issue"
72
+ npx @pc360/chlog --type fixed --scope JES-45 --frontend --message "Fix table pagination issue"
91
73
  ```
92
74
 
93
75
  File content:
@@ -101,7 +83,7 @@ File content:
101
83
  ### Module-Based Scope
102
84
 
103
85
  ```
104
- chlog --type changed --scope "Credit Validation" --message "Improve credit limit computation"
86
+ npx @pc360/chlog --type changed --scope "Credit Validation" --message "Improve credit limit computation"
105
87
  ```
106
88
 
107
89
  File content:
@@ -171,7 +153,7 @@ Fix FR status blocking issue
171
153
  Preview without creating file:
172
154
 
173
155
  ```
174
- chlog --type added --scope JES-99 --message "Test entry" --dry-run
156
+ npx @pc360/chlog --type added --scope JES-99 --message "Test entry" --dry-run
175
157
  ```
176
158
 
177
159
  ---
package/lib/chlog-ui.js CHANGED
@@ -136,7 +136,7 @@ async function renderHelp(helpText) {
136
136
 
137
137
  const rendered = await renderInkCard(
138
138
  {
139
- title: "PC360 Changelog CLI - v0.1.6",
139
+ title: "PC360 Changelog CLI - v0.1.8",
140
140
  subtitle: "Usage & options",
141
141
  lines: styledLines,
142
142
  tone: "info",
package/package.json CHANGED
@@ -1,16 +1,26 @@
1
1
  {
2
2
  "name": "@pc360/chlog",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "PC360 Changelog CLI Tool",
5
5
  "author": "aalmazan@pcdsi.ph",
6
6
  "bin": {
7
7
  "chlog": "bin/chlog.js"
8
8
  },
9
+ "files": [
10
+ "bin",
11
+ "lib",
12
+ "README.md",
13
+ "CHANGELOG.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
9
18
  "license": "UNLICENSED",
10
19
  "engines": {
11
20
  "node": ">=18"
12
21
  },
13
22
  "dependencies": {
23
+ "@pc360/chlog": "^0.1.7",
14
24
  "ink": "^4.4.1",
15
25
  "react": "^18.3.1"
16
26
  },
@@ -1,161 +0,0 @@
1
- "use strict";
2
-
3
- const test = require("node:test");
4
- const assert = require("node:assert/strict");
5
- const fs = require("fs");
6
- const os = require("os");
7
- const path = require("path");
8
- const { spawnSync } = require("child_process");
9
-
10
- const { generateTimestamp } = require("../lib/chlog-lib");
11
-
12
- const BIN_PATH = path.resolve(__dirname, "../bin/chlog.js");
13
-
14
- function createTempDir() {
15
- return fs.mkdtempSync(path.join(os.tmpdir(), "chlog-cli-"));
16
- }
17
-
18
- function runCli(args, cwd) {
19
- return spawnSync(process.execPath, [BIN_PATH, ...args], {
20
- cwd,
21
- encoding: "utf8",
22
- });
23
- }
24
-
25
- function cleanup(dir) {
26
- fs.rmSync(dir, { recursive: true, force: true });
27
- }
28
-
29
- test("CLI dry-run previews target path/content and exits 0", () => {
30
- const cwd = createTempDir();
31
-
32
- try {
33
- const res = runCli(
34
- [
35
- "--type",
36
- "added",
37
- "--scope",
38
- "JES-99",
39
- "--message",
40
- "Test entry",
41
- "--dry-run",
42
- ],
43
- cwd,
44
- );
45
-
46
- assert.equal(res.status, 0);
47
- assert.match(res.stdout, /\[Dry Run\]/);
48
- assert.match(
49
- res.stdout,
50
- /Would create: .*changelog[\/\\]unreleased[\/\\]added[\/\\]\d{14}/,
51
- );
52
- assert.match(res.stdout, /\[JES-99\] \[Back-End\] Test entry/);
53
- assert.equal(fs.existsSync(path.join(cwd, "changelog")), false);
54
- } finally {
55
- cleanup(cwd);
56
- }
57
- });
58
-
59
- test("CLI supports short flags for required values and toggles", () => {
60
- const cwd = createTempDir();
61
-
62
- try {
63
- const res = runCli(
64
- ["-t", "added", "-s", "JES-100", "-m", "Use short options", "-f", "-d"],
65
- cwd,
66
- );
67
-
68
- assert.equal(res.status, 0);
69
- assert.match(res.stdout, /\[Dry Run\]/);
70
- assert.match(
71
- res.stdout,
72
- /Would create: .*changelog[\/\\]unreleased[\/\\]added[\/\\]\d{14}/,
73
- );
74
- assert.match(res.stdout, /\[JES-100\] \[Front-End\] Use short options/);
75
- assert.equal(fs.existsSync(path.join(cwd, "changelog")), false);
76
- } finally {
77
- cleanup(cwd);
78
- }
79
- });
80
-
81
- test("CLI creates changelog file with expected content and exits 0", () => {
82
- const cwd = createTempDir();
83
-
84
- try {
85
- const res = runCli(
86
- [
87
- "--type",
88
- "fixed",
89
- "--scope",
90
- "JES-45",
91
- "--message",
92
- "Fix pagination",
93
- "--frontend",
94
- ],
95
- cwd,
96
- );
97
-
98
- assert.equal(res.status, 0);
99
- assert.match(
100
- res.stdout,
101
- /Created: changelog[\/\\]unreleased[\/\\]fixed[\/\\]\d{14}/,
102
- );
103
-
104
- const entryDir = path.join(cwd, "changelog", "unreleased", "fixed");
105
- const files = fs.readdirSync(entryDir);
106
- assert.equal(files.length, 1);
107
- assert.match(files[0], /^\d{14}$/);
108
-
109
- const content = fs.readFileSync(path.join(entryDir, files[0]), "utf8");
110
- assert.equal(content, "[JES-45] [Front-End] Fix pagination\n");
111
- } finally {
112
- cleanup(cwd);
113
- }
114
- });
115
-
116
- test("CLI returns exit code 1 for missing required flags", () => {
117
- const cwd = createTempDir();
118
-
119
- try {
120
- const res = runCli(["--type", "added", "--scope", "JES-1"], cwd);
121
-
122
- assert.equal(res.status, 1);
123
- assert.match(res.stderr, /--message is required/);
124
- assert.match(res.stderr, /Run: chlog --help/);
125
- } finally {
126
- cleanup(cwd);
127
- }
128
- });
129
-
130
- test("CLI surfaces timestamp collision errors and exits 1", () => {
131
- const cwd = createTempDir();
132
-
133
- try {
134
- const entryDir = path.join(cwd, "changelog", "unreleased", "changed");
135
- fs.mkdirSync(entryDir, { recursive: true });
136
-
137
- const now = Date.now();
138
- for (let offset = -5; offset <= 5; offset++) {
139
- const ts = generateTimestamp(new Date(now + offset * 1000), "Asia/Manila");
140
- fs.writeFileSync(path.join(entryDir, ts), "existing\n", "utf8");
141
- }
142
-
143
- const res = runCli(
144
- [
145
- "--type",
146
- "changed",
147
- "--scope",
148
- "JES-77",
149
- "--message",
150
- "Update report formatting",
151
- ],
152
- cwd,
153
- );
154
-
155
- assert.equal(res.status, 1);
156
- assert.match(res.stderr, /EEXIST|file already exists/i);
157
- assert.match(res.stderr, /Run: chlog --help/);
158
- } finally {
159
- cleanup(cwd);
160
- }
161
- });
@@ -1,170 +0,0 @@
1
- "use strict";
2
-
3
- const test = require("node:test");
4
- const assert = require("node:assert/strict");
5
-
6
- const {
7
- parseArgs,
8
- validateArgs,
9
- generateTimestamp,
10
- buildLine,
11
- } = require("../lib/chlog-lib");
12
-
13
- test("parseArgs parses required flags and defaults", () => {
14
- const args = parseArgs([
15
- "node",
16
- "chlog",
17
- "--type",
18
- "added",
19
- "--scope",
20
- "JES-33",
21
- "--message",
22
- "Hello",
23
- ]);
24
-
25
- assert.equal(args.type, "added");
26
- assert.equal(args.scope, "JES-33");
27
- assert.equal(args.message, "Hello");
28
- assert.equal(args.tz, "Asia/Manila");
29
- assert.equal(args.frontend, false);
30
- assert.equal(args.dryRun, false);
31
- assert.equal(args.help, false);
32
- });
33
-
34
- test("parseArgs supports --frontend and --dry-run", () => {
35
- const args = parseArgs([
36
- "node",
37
- "chlog",
38
- "--type",
39
- "fixed",
40
- "--scope",
41
- "JES-45",
42
- "--message",
43
- "Fix thing",
44
- "--frontend",
45
- "--dry-run",
46
- ]);
47
-
48
- assert.equal(args.frontend, true);
49
- assert.equal(args.dryRun, true);
50
- });
51
-
52
- test("parseArgs supports short flags", () => {
53
- const args = parseArgs([
54
- "node",
55
- "chlog",
56
- "-t",
57
- "changed",
58
- "-s",
59
- "JES-50",
60
- "-m",
61
- "Update validation flow",
62
- "-f",
63
- "-d",
64
- ]);
65
-
66
- assert.equal(args.type, "changed");
67
- assert.equal(args.scope, "JES-50");
68
- assert.equal(args.message, "Update validation flow");
69
- assert.equal(args.frontend, true);
70
- assert.equal(args.dryRun, true);
71
- });
72
-
73
- test("parseArgs supports mixed long/short flags", () => {
74
- const args = parseArgs([
75
- "node",
76
- "chlog",
77
- "--type",
78
- "fixed",
79
- "-s",
80
- "JES-88",
81
- "--message",
82
- "Mixed flags",
83
- "-d",
84
- ]);
85
-
86
- assert.equal(args.type, "fixed");
87
- assert.equal(args.scope, "JES-88");
88
- assert.equal(args.message, "Mixed flags");
89
- assert.equal(args.dryRun, true);
90
- assert.equal(args.frontend, false);
91
- });
92
-
93
- test("parseArgs supports -h short help flag", () => {
94
- const args = parseArgs(["node", "chlog", "-h"]);
95
- assert.equal(args.help, true);
96
- });
97
-
98
- test("validateArgs throws if missing scope", () => {
99
- assert.throws(
100
- () =>
101
- validateArgs({
102
- type: "added",
103
- scope: null,
104
- message: "x",
105
- tz: "Asia/Manila",
106
- }),
107
- /--scope is required/,
108
- );
109
- });
110
-
111
- test("validateArgs throws if invalid type", () => {
112
- assert.throws(
113
- () =>
114
- validateArgs({
115
- type: "nope",
116
- scope: "JES-1",
117
- message: "x",
118
- tz: "Asia/Manila",
119
- }),
120
- /--type must be one of/,
121
- );
122
- });
123
-
124
- test("validateArgs throws if invalid timezone", () => {
125
- assert.throws(
126
- () =>
127
- validateArgs({
128
- type: "added",
129
- scope: "JES-1",
130
- message: "x",
131
- tz: "Not/A_Timezone",
132
- }),
133
- /Invalid time zone|timeZone/i,
134
- );
135
- });
136
-
137
- test("generateTimestamp returns 14 digits", () => {
138
- const ts = generateTimestamp(new Date("2026-02-13T00:00:00Z"), "Asia/Manila");
139
- assert.match(ts, /^\d{14}$/);
140
- });
141
-
142
- test("buildLine defaults to [Back-End] prefix and includes scope", () => {
143
- const line = buildLine({
144
- scope: "JES-33",
145
- message: "Add daily consolidated JE job",
146
- frontend: false,
147
- });
148
-
149
- assert.equal(line, "[JES-33] [Back-End] Add daily consolidated JE job\n");
150
- });
151
-
152
- test("buildLine uses [Front-End] when frontend=true", () => {
153
- const line = buildLine({
154
- scope: "JES-45",
155
- message: "Fix pagination",
156
- frontend: true,
157
- });
158
-
159
- assert.equal(line, "[JES-45] [Front-End] Fix pagination\n");
160
- });
161
-
162
- test("buildLine does not double-prefix if message already starts with label", () => {
163
- const line = buildLine({
164
- scope: "JES-99",
165
- message: "[Back-End] Already prefixed",
166
- frontend: false,
167
- });
168
-
169
- assert.equal(line, "[JES-99] [Back-End] Already prefixed\n");
170
- });