Skip to content

Commit 5d40348

Browse files
Merge pull request #41 from CodeAnt-AI/codex/fix-npm-publish-metadata
fix: restore npm trusted publishing for 0.5.5
2 parents 41809af + 010eef0 commit 5d40348

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ jobs:
2323

2424
- run: npm ci
2525

26+
- run: npm test -- tests/packageMetadata.test.js
27+
2628
- run: npm publish --access public

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
"version": "0.5.5",
44
"description": "Code review CLI tool",
55
"type": "module",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/CodeAnt-AI/codeant-cli.git"
9+
},
610
"bin": {
7-
"codeant": "./src/index.js"
11+
"codeant": "src/index.js"
812
},
913
"scripts": {
1014
"start": "node src/index.js",

tests/docsLinks.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ const forbiddenRepoReferences = [
66
['codeant-ai', 'codeant-cli'].join('/'),
77
['codeantai', 'codeant-cli'].join('/'),
88
];
9+
const requiredMachineMetadataFiles = new Set(['package.json']);
910

1011
describe('public documentation links', () => {
11-
it('does not reference the CodeAnt CLI GitHub repository', () => {
12+
it('does not reference the CodeAnt CLI GitHub repository outside required package metadata', () => {
1213
const trackedFiles = execFileSync('git', ['ls-files', '-z'], { encoding: 'utf8' })
1314
.split('\0')
14-
.filter(Boolean);
15+
.filter((file) => file && !requiredMachineMetadataFiles.has(file));
1516

1617
const matches = trackedFiles.filter((file) => {
1718
const contents = readFileSync(file, 'utf8').toLowerCase();

tests/packageMetadata.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { readFileSync } from 'node:fs';
2+
import { fileURLToPath } from 'node:url';
3+
import { describe, expect, it } from 'vitest';
4+
5+
const packageJsonUrl = new URL('../package.json', import.meta.url);
6+
const packageJson = JSON.parse(readFileSync(packageJsonUrl, 'utf8'));
7+
const expectedRepositoryUrl = ['git+https://github.com', 'CodeAnt-AI', 'codeant-cli.git'].join('/');
8+
9+
describe('npm publish metadata', () => {
10+
it('matches the GitHub repository used for trusted publishing provenance', () => {
11+
expect(packageJson.repository).toEqual({
12+
type: 'git',
13+
url: expectedRepositoryUrl,
14+
});
15+
});
16+
17+
it('keeps the CLI binary in npm-normalized form', () => {
18+
expect(packageJson.bin).toEqual({ codeant: 'src/index.js' });
19+
20+
const binUrl = new URL(`../${packageJson.bin.codeant}`, import.meta.url);
21+
const binContents = readFileSync(fileURLToPath(binUrl), 'utf8');
22+
const firstLine = binContents.split(/\r?\n/, 1)[0];
23+
expect(firstLine).toBe('#!/usr/bin/env node');
24+
});
25+
});

0 commit comments

Comments
 (0)