mirror of
https://github.com/Heretek-AI/Agent-Proof.git
synced 2026-11-07 10:46:10 -10:00
fix(publish): remove unreleased optionalDependencies and dynamically resolve version above NPM registry latest
This commit is contained in:
1 parent
cf6a061a5e
commit
ddff67d9a7
4 files changed
+40
-45
No files matched your search
@@ -64,23 +64,42 @@ jobs:
|
||||
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
|
||||
echo "Publishing tagged release: $TAG_VERSION"
|
||||
npm version "$TAG_VERSION" --no-git-tag-version --allow-same-version
|
||||
elif [ "${{ inputs.bump }}" = "patch" ]; then
|
||||
npm version patch --no-git-tag-version
|
||||
elif [ "${{ inputs.bump }}" = "minor" ]; then
|
||||
npm version minor --no-git-tag-version
|
||||
elif [ "${{ inputs.bump }}" = "major" ]; then
|
||||
npm version major --no-git-tag-version
|
||||
elif [ "${{ inputs.bump }}" = "none" ]; then
|
||||
echo "Skipping version bump as requested"
|
||||
else
|
||||
# Auto-bump: check if current version is already on NPM
|
||||
EXISTS_ON_NPM=$(npm view "@heretek-ai/agent-proof@${CURRENT_PKG}" version 2>/dev/null || echo "")
|
||||
if [ -n "$EXISTS_ON_NPM" ] || [ "$CURRENT_PKG" = "$LATEST_NPM" ]; then
|
||||
echo "Version $CURRENT_PKG is already published to NPM. Auto-bumping patch..."
|
||||
npm version patch --no-git-tag-version
|
||||
else
|
||||
echo "Version $CURRENT_PKG is not yet published on NPM. Proceeding with current version."
|
||||
fi
|
||||
TARGET_VERSION=$(node -e '
|
||||
const currentPkg = process.argv[1];
|
||||
const latestNpm = process.argv[2] || "0.0.0";
|
||||
const bumpType = process.argv[3] || "auto";
|
||||
|
||||
function parse(v) {
|
||||
return v.replace(/^v/, "").split(".").map(n => parseInt(n, 10) || 0);
|
||||
}
|
||||
function isGte(v1, v2) {
|
||||
const [a1, a2, a3] = parse(v1);
|
||||
const [b1, b2, b3] = parse(v2);
|
||||
if (a1 !== b1) return a1 > b1;
|
||||
if (a2 !== b2) return a2 > b2;
|
||||
return a3 >= b3;
|
||||
}
|
||||
|
||||
let targetVersion = currentPkg;
|
||||
if (latestNpm !== "0.0.0" && isGte(latestNpm, currentPkg)) {
|
||||
const [major, minor, patch] = parse(latestNpm);
|
||||
if (bumpType === "major") targetVersion = `${major + 1}.0.0`;
|
||||
else if (bumpType === "minor") targetVersion = `${major}.${minor + 1}.0`;
|
||||
else targetVersion = `${major}.${minor}.${patch + 1}`;
|
||||
} else if (bumpType === "major" || bumpType === "minor" || bumpType === "patch") {
|
||||
const [major, minor, patch] = parse(currentPkg);
|
||||
if (bumpType === "major") targetVersion = `${major + 1}.0.0`;
|
||||
else if (bumpType === "minor") targetVersion = `${major}.${minor + 1}.0`;
|
||||
else targetVersion = `${major}.${minor}.${patch + 1}`;
|
||||
}
|
||||
console.log(targetVersion);
|
||||
' "$CURRENT_PKG" "$LATEST_NPM" "${{ inputs.bump || 'auto' }}")
|
||||
|
||||
echo "Setting package version to: $TARGET_VERSION"
|
||||
npm version "$TARGET_VERSION" --no-git-tag-version --allow-same-version
|
||||
fi
|
||||
|
||||
FINAL_VERSION=$(node -p "require('./package.json').version")
|
||||
|
||||
Generated
+2
-10
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@heretek-ai/agent-proof",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@heretek-ai/agent-proof",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"agent-gate": "bin/agent-gate.js",
|
||||
@@ -23,14 +23,6 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@heretek-ai/binary-darwin-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-darwin-x64": "1.0.0",
|
||||
"@heretek-ai/binary-linux-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-linux-x64": "1.0.0",
|
||||
"@heretek-ai/binary-win32-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-win32-x64": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
|
||||
+1
-9
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@heretek-ai/agent-proof",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"description": "Agent-Proof Mechanical Hard-Gate CLI for deterministic AI code governance",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
@@ -40,14 +40,6 @@
|
||||
"prepublishOnly": "npm run build && npm test && npm run typecheck",
|
||||
"release:dry-run": "npm publish --dry-run"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@heretek-ai/binary-darwin-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-darwin-x64": "1.0.0",
|
||||
"@heretek-ai/binary-linux-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-linux-x64": "1.0.0",
|
||||
"@heretek-ai/binary-win32-arm64": "1.0.0",
|
||||
"@heretek-ai/binary-win32-x64": "1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.13.4",
|
||||
"esbuild": "^0.28.2",
|
||||
|
||||
+4
-12
@@ -3,13 +3,13 @@ import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
describe('Platform-Specific Binary Packaging & Launcher', () => {
|
||||
describe('Platform-Specific Packaging & Launcher', () => {
|
||||
const rootDir = path.resolve(__dirname, '..');
|
||||
const pkgJsonPath = path.join(rootDir, 'package.json');
|
||||
const binScriptPath = path.join(rootDir, 'bin', 'agent-proof.js');
|
||||
const binGateScriptPath = path.join(rootDir, 'bin', 'agent-gate.js');
|
||||
|
||||
it('has package.json configured with complete optionalDependencies matrix pinning', () => {
|
||||
it('has package.json configured with zero runtime dependencies and valid bin entrypoints', () => {
|
||||
const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
||||
|
||||
expect(pkg.name).toBe('@heretek-ai/agent-proof');
|
||||
@@ -19,16 +19,8 @@ describe('Platform-Specific Binary Packaging & Launcher', () => {
|
||||
expect(pkg.bin['agent-gate']).toBe('./bin/agent-gate.js');
|
||||
expect(pkg.bin['create-agent-gate']).toBe('./bin/agent-gate.js');
|
||||
|
||||
const optDeps = pkg.optionalDependencies;
|
||||
expect(optDeps).toBeDefined();
|
||||
|
||||
// Verify Darwin (macOS), Linux, and Windows matrices for both x64 and arm64
|
||||
expect(optDeps['@heretek-ai/binary-darwin-arm64']).toBeDefined();
|
||||
expect(optDeps['@heretek-ai/binary-darwin-x64']).toBeDefined();
|
||||
expect(optDeps['@heretek-ai/binary-linux-arm64']).toBeDefined();
|
||||
expect(optDeps['@heretek-ai/binary-linux-x64']).toBeDefined();
|
||||
expect(optDeps['@heretek-ai/binary-win32-arm64']).toBeDefined();
|
||||
expect(optDeps['@heretek-ai/binary-win32-x64']).toBeDefined();
|
||||
// Confirm zero runtime dependencies for lean distribution
|
||||
expect(pkg.dependencies).toBeUndefined();
|
||||
});
|
||||
|
||||
it('verifies bin/agent-proof.js and bin/agent-gate.js handle CLI options via fallback', () => {
|
||||
|
||||
Reference in new issue
Block a user