@greenarmor/ges 1.1.2 → 1.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greenarmor/ges",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Green Engineering Standard Framework - Compliance-as-Code CLI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,19 +12,19 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@greenarmor/ges-audit-engine": "1.1.1",
16
- "@greenarmor/ges-cicd-generator": "1.1.1",
17
- "@greenarmor/ges-compliance-engine": "1.1.1",
18
- "@greenarmor/ges-core": "1.1.1",
19
- "@greenarmor/ges-doc-generator": "1.1.1",
20
- "@greenarmor/ges-policy-engine": "1.1.1",
21
- "@greenarmor/ges-report-generator": "1.1.1",
22
- "@greenarmor/ges-rules-engine": "1.1.1",
23
- "@greenarmor/ges-scanner-integration": "1.1.1",
24
- "@greenarmor/ges-scoring-engine": "1.1.1",
25
- "@greenarmor/ges-mcp-server": "1.1.1",
26
- "@greenarmor/ges-git-hooks": "1.1.1",
27
- "@greenarmor/ges-web-dashboard": "1.1.1",
15
+ "@greenarmor/ges-audit-engine": "1.1.2",
16
+ "@greenarmor/ges-cicd-generator": "1.1.2",
17
+ "@greenarmor/ges-compliance-engine": "1.1.2",
18
+ "@greenarmor/ges-core": "1.1.2",
19
+ "@greenarmor/ges-doc-generator": "1.1.2",
20
+ "@greenarmor/ges-policy-engine": "1.1.2",
21
+ "@greenarmor/ges-report-generator": "1.1.2",
22
+ "@greenarmor/ges-rules-engine": "1.1.2",
23
+ "@greenarmor/ges-scanner-integration": "1.1.2",
24
+ "@greenarmor/ges-scoring-engine": "1.1.2",
25
+ "@greenarmor/ges-mcp-server": "1.1.2",
26
+ "@greenarmor/ges-git-hooks": "1.1.2",
27
+ "@greenarmor/ges-web-dashboard": "1.1.2",
28
28
  "commander": "^13.0.0"
29
29
  },
30
30
  "devDependencies": {
@@ -1 +0,0 @@
1
- export {};
@@ -1,88 +0,0 @@
1
- import { describe, it, expect, beforeEach, afterEach } from "vitest";
2
- import * as fs from "node:fs";
3
- import * as path from "node:path";
4
- import * as os from "node:os";
5
- import { findProjectRoot, readJsonFile, writeJsonFile, writeFileSync, GES_DIR, } from "./project.js";
6
- let tmpDir;
7
- let origCwd;
8
- beforeEach(() => {
9
- tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "gesf-cli-test-"));
10
- origCwd = process.cwd();
11
- });
12
- afterEach(() => {
13
- process.chdir(origCwd);
14
- fs.rmSync(tmpDir, { recursive: true, force: true });
15
- });
16
- describe("findProjectRoot", () => {
17
- it("finds root with config.json", () => {
18
- fs.mkdirSync(path.join(tmpDir, GES_DIR));
19
- fs.writeFileSync(path.join(tmpDir, GES_DIR, "config.json"), "{}");
20
- expect(findProjectRoot(tmpDir)).toBe(tmpDir);
21
- });
22
- it("finds root with config.yaml (backwards compat)", () => {
23
- fs.mkdirSync(path.join(tmpDir, GES_DIR));
24
- fs.writeFileSync(path.join(tmpDir, GES_DIR, "config.yaml"), "name: test");
25
- expect(findProjectRoot(tmpDir)).toBe(tmpDir);
26
- });
27
- it("returns null when no config found", () => {
28
- expect(findProjectRoot(tmpDir)).toBeNull();
29
- });
30
- it("finds root from nested subdirectory", () => {
31
- fs.mkdirSync(path.join(tmpDir, GES_DIR));
32
- fs.writeFileSync(path.join(tmpDir, GES_DIR, "config.json"), "{}");
33
- const nested = path.join(tmpDir, "src", "deep", "path");
34
- fs.mkdirSync(nested, { recursive: true });
35
- expect(findProjectRoot(nested)).toBe(tmpDir);
36
- });
37
- });
38
- describe("readJsonFile", () => {
39
- it("reads valid JSON", () => {
40
- const filePath = path.join(tmpDir, "test.json");
41
- fs.writeFileSync(filePath, '{"name":"test","value":42}');
42
- const result = readJsonFile(filePath);
43
- expect(result).not.toBeNull();
44
- expect(result.name).toBe("test");
45
- expect(result.value).toBe(42);
46
- });
47
- it("returns null for missing file", () => {
48
- expect(readJsonFile(path.join(tmpDir, "nonexistent.json"))).toBeNull();
49
- });
50
- it("returns null for invalid JSON", () => {
51
- const filePath = path.join(tmpDir, "bad.json");
52
- fs.writeFileSync(filePath, "{not valid json}");
53
- expect(readJsonFile(filePath)).toBeNull();
54
- });
55
- });
56
- describe("writeJsonFile", () => {
57
- it("writes JSON to file", () => {
58
- const filePath = path.join(tmpDir, "output.json");
59
- writeJsonFile(filePath, { name: "test", items: [1, 2, 3] });
60
- const content = fs.readFileSync(filePath, "utf-8");
61
- const parsed = JSON.parse(content);
62
- expect(parsed.name).toBe("test");
63
- expect(parsed.items).toEqual([1, 2, 3]);
64
- });
65
- it("creates parent directories", () => {
66
- const filePath = path.join(tmpDir, "nested", "dir", "output.json");
67
- writeJsonFile(filePath, { ok: true });
68
- expect(fs.existsSync(filePath)).toBe(true);
69
- });
70
- });
71
- describe("writeFileSync", () => {
72
- it("writes content to file", () => {
73
- const filePath = path.join(tmpDir, "test.txt");
74
- writeFileSync(filePath, "hello world");
75
- expect(fs.readFileSync(filePath, "utf-8")).toBe("hello world");
76
- });
77
- it("creates parent directories if needed", () => {
78
- const filePath = path.join(tmpDir, "a", "b", "c", "file.txt");
79
- writeFileSync(filePath, "nested");
80
- expect(fs.existsSync(filePath)).toBe(true);
81
- });
82
- it("overwrites existing file", () => {
83
- const filePath = path.join(tmpDir, "overwrite.txt");
84
- writeFileSync(filePath, "first");
85
- writeFileSync(filePath, "second");
86
- expect(fs.readFileSync(filePath, "utf-8")).toBe("second");
87
- });
88
- });