cwresdev 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/bin/cwgit.js +12 -13
  2. package/package.json +1 -1
package/bin/cwgit.js CHANGED
@@ -15,29 +15,28 @@ async function main() {
15
15
 
16
16
  if (!command || command === "--help" || command === "-h") {
17
17
  process.stdout.write([
18
- "cwgit <command>",
18
+ "cwgit <command> [path]",
19
19
  "",
20
20
  "Commands:",
21
- " init Snapshot the current project as the base version",
22
- " changes Detect and export changed files as CSV",
21
+ " init [path] Snapshot the project as the base version",
22
+ " changes [path] Detect and export changed files as CSV",
23
23
  "",
24
- "Usage:",
25
- " Run from inside a project folder (under the docRoot).",
26
- " The tool locates the workspace root (package.json with cwrespro config)",
27
- " and resolves docRoot from that config.",
24
+ "If [path] is omitted, the current working directory is used.",
28
25
  "",
29
26
  "Examples:",
30
- " cd virtual_env/IC && cwgit init",
31
- " cd virtual_env/IC && cwgit changes",
27
+ " cwgit init",
28
+ " cwgit init ./virtual_env/IC",
29
+ " cwgit changes ./virtual_env/IC",
32
30
  "",
33
31
  ].join("\n"));
34
32
  return;
35
33
  }
36
34
 
37
35
  const cwd = process.cwd();
36
+ const targetPath = args[1] ? path.resolve(cwd, args[1]) : cwd;
38
37
 
39
38
  // Find the workspace root by walking up
40
- const workspaceRoot = findWorkspaceRoot(cwd);
39
+ const workspaceRoot = findWorkspaceRoot(targetPath);
41
40
 
42
41
  if (!workspaceRoot) {
43
42
  throw new Error(
@@ -50,7 +49,7 @@ async function main() {
50
49
  const docRoot = resolveDocRoot(workspaceRoot);
51
50
 
52
51
  if (command === "init") {
53
- const { fileCount, basePath } = await initBase(cwd, docRoot);
52
+ const { fileCount, basePath } = await initBase(targetPath, docRoot);
54
53
  process.stdout.write(`[cwgit] Base snapshot created: ${fileCount} files tracked.\n`);
55
54
  process.stdout.write(`[cwgit] Stored at: ${basePath}\n`);
56
55
  process.stdout.write(`[cwgit] Tip: add .cwgit/ to .gitignore if using Git.\n`);
@@ -58,14 +57,14 @@ async function main() {
58
57
  }
59
58
 
60
59
  if (command === "changes") {
61
- const changes = await detectChanges(cwd, docRoot);
60
+ const changes = await detectChanges(targetPath, docRoot);
62
61
 
63
62
  if (changes.length === 0) {
64
63
  process.stdout.write("[cwgit] No changes detected.\n");
65
64
  return;
66
65
  }
67
66
 
68
- const csvPath = await exportCsv(changes, cwd);
67
+ const csvPath = await exportCsv(changes, targetPath);
69
68
 
70
69
  // Print summary
71
70
  const deleted = changes.filter((c) => c.status === "D").length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cwresdev",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "private": false,