@decohere/ci-tools 0.0.1-dev.129 → 0.0.1-dev.130

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": "@decohere/ci-tools",
3
- "version": "0.0.1-dev.129",
3
+ "version": "0.0.1-dev.130",
4
4
  "description": "CI utility scripts for badge generation, coverage reporting, pages artifact assembly, and GitHub API tooling",
5
5
  "keywords": [
6
6
  "typescript",
package/src/lib/lcov.mjs CHANGED
@@ -13,7 +13,7 @@ function normalizePath(filePath) {
13
13
 
14
14
  /**
15
15
  * Extracts the top-level project name from a source path like
16
- * `/workspace/projects/hearth/src/foo.ts` → `"hearth"`.
16
+ * `/workspace/projects/core/src/foo.ts` → `"core"`.
17
17
  * @param {string} sourcePath
18
18
  * @returns {string | undefined}
19
19
  */
@@ -3,9 +3,9 @@
3
3
  // Restore the badges on the live Pages site into dist, so a deploy that does not regenerate
4
4
  // them (the nightly bench) keeps them. Pages replaces the whole site on every deploy.
5
5
  //
6
- // The site lists its badges in badges/manifest.json (artifact.mjs). Sites deployed before the
7
- // manifest existed are read with a fixed list instead. A badge the site does not have (404) is
8
- // skipped; any other failure stops the job.
6
+ // The site lists its badges in badges/manifest.json (artifact.mjs). A site with no manifest yet
7
+ // has no badges to keep. A badge the site does not have (404) is skipped; any other failure
8
+ // stops the job.
9
9
 
10
10
  import { mkdir, writeFile } from "node:fs/promises";
11
11
  import path from "node:path";
@@ -13,27 +13,6 @@ import path from "node:path";
13
13
  const BADGES_DIR = "projects/ci-tools/dist/ci/badges";
14
14
  const PAGES_URL = process.env.PAGES_URL ?? "https://typesmiths.github.io/decohere";
15
15
 
16
- const LEGACY_BADGES = [
17
- "ci-main.svg",
18
- "ci-release.svg",
19
- "coverage.svg",
20
- ...[
21
- "ci-tools",
22
- "cli",
23
- "codex",
24
- "cortex",
25
- "create",
26
- "crucible",
27
- "flux",
28
- "forge",
29
- "mesh",
30
- "nexus",
31
- "protocol",
32
- "scribe",
33
- "terminal",
34
- ].map((project) => `projects/${project}.svg`),
35
- ];
36
-
37
16
  async function fetchOrNull(url) {
38
17
  const response = await fetch(url);
39
18
  if (response.status === 404) return null;
@@ -42,7 +21,7 @@ async function fetchOrNull(url) {
42
21
  }
43
22
 
44
23
  const manifest = await fetchOrNull(`${PAGES_URL}/badges/manifest.json`);
45
- const badges = manifest != null ? (await manifest.json()).badges : LEGACY_BADGES;
24
+ const badges = manifest != null ? (await manifest.json()).badges : [];
46
25
 
47
26
  let restored = 0;
48
27
  for (const badge of badges) {
@@ -53,6 +32,4 @@ for (const badge of badges) {
53
32
  await writeFile(file, await response.text());
54
33
  restored += 1;
55
34
  }
56
- console.log(
57
- `✓ Restored ${restored} badge(s) from Pages (${manifest != null ? "manifest" : "legacy list"})`,
58
- );
35
+ console.log(`✓ Restored ${restored} badge(s) from Pages`);
@@ -19,7 +19,7 @@ LH:5
19
19
  end_of_record
20
20
  `;
21
21
 
22
- const sampleLcovWithLines = `SF:projects/anvil/src/index.ts
22
+ const sampleLcovWithLines = `SF:projects/http/src/index.ts
23
23
  DA:1,1
24
24
  DA:2,1
25
25
  DA:3,0
@@ -61,7 +61,7 @@ describe("parseLcovByProject", () => {
61
61
  describe("parseLcovFiles", () => {
62
62
  it("returns per-file coverage with uncovered line numbers", () => {
63
63
  const result = parseLcovFiles(sampleLcovWithLines);
64
- const file = result.find((f) => f.sourcePath === "projects/anvil/src/index.ts");
64
+ const file = result.find((f) => f.sourcePath === "projects/http/src/index.ts");
65
65
  expect(file).toBeDefined();
66
66
  expect(file.totalLines).toBe(5);
67
67
  expect(file.coveredLines).toBe(3);
@@ -70,14 +70,14 @@ describe("parseLcovFiles", () => {
70
70
  });
71
71
 
72
72
  it("includes files with 100% coverage", () => {
73
- const lcov = `SF:projects/anvil/src/full.ts\nDA:1,1\nDA:2,1\nLF:2\nLH:2\nend_of_record\n`;
73
+ const lcov = `SF:projects/http/src/full.ts\nDA:1,1\nDA:2,1\nLF:2\nLH:2\nend_of_record\n`;
74
74
  const result = parseLcovFiles(lcov);
75
75
  expect(result).toHaveLength(1);
76
76
  expect(result[0].uncoveredLineNumbers).toEqual([]);
77
77
  });
78
78
 
79
79
  it("excludes files with LF:0", () => {
80
- const lcov = `SF:projects/anvil/src/empty.ts\nLF:0\nLH:0\nend_of_record\n`;
80
+ const lcov = `SF:projects/http/src/empty.ts\nLF:0\nLH:0\nend_of_record\n`;
81
81
  const result = parseLcovFiles(lcov);
82
82
  expect(result).toHaveLength(0);
83
83
  });