Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,19 @@ ClipCase is a local-first TypeScript CLI for turning copied context, terminal ou

## Quick start

ClipCase is not published to the npm registry yet. Until it is, build and
install the package tarball from a clean checkout:

```sh
npm install -g clipcase
git clone https://github.com/rogerchappel/clipcase.git
cd clipcase
npm ci
npm run build
CLIPCASE_TMP="$(mktemp -d)"
CLIPCASE_TARBALL="$(npm pack --pack-destination "$CLIPCASE_TMP")"
npm install --global --prefix "$CLIPCASE_TMP/install" "$CLIPCASE_TMP/$CLIPCASE_TARBALL"
export PATH="$CLIPCASE_TMP/install/bin:$PATH"

clipcase init
clipcase new bug-login --title "Login redirect bug"
pbpaste | clipcase add bug-login --source terminal --tag repro
Expand Down Expand Up @@ -138,3 +149,8 @@ npm run release:check
```

`npm run package:smoke` verifies required package files and the installed `clipcase` CLI help.

Version tags currently build a package tarball and attach it to a GitHub
release. They do not publish ClipCase to the npm registry. The release workflow
and this installation guidance must be updated together when registry
publication is enabled.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"pretest": "npm run build",
"smoke": "npm run build && bash scripts/smoke.sh",
"package:smoke": "node scripts/pack-smoke.mjs",
"release:check": "npm test && npm run check && npm run build && npm run smoke && npm run package:smoke"
"release:contract": "node scripts/release-contract.mjs",
"release:check": "npm test && npm run check && npm run build && npm run smoke && npm run package:smoke && npm run release:contract"
},
"keywords": [
"cli",
Expand Down
38 changes: 38 additions & 0 deletions scripts/release-contract.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env node

import { readFile } from "node:fs/promises";

const readme = await readFile(new URL("../README.md", import.meta.url), "utf8");
const releaseWorkflow = await readFile(
new URL("../.github/workflows/release.yml", import.meta.url),
"utf8"
);

const claimsRegistryInstall = /npm\s+(?:i|install)\s+(?:--global|-g)\s+clipcase(?:@\S+)?(?:\s|$)/m.test(
readme
);
const publishesToRegistry = /(?:^|\s)npm\s+publish(?:\s|$)/m.test(releaseWorkflow);

if (claimsRegistryInstall && !publishesToRegistry) {
console.error(
"release contract failed: README claims a registry install, but the release workflow does not publish to npm"
);
process.exit(1);
}

const documentsTarballRelease =
/attach(?:es|ed|ing)? it to a GitHub\s+release/i.test(readme) &&
/do(?:es)? not publish ClipCase to the npm registry/i.test(readme);

if (!publishesToRegistry && !documentsTarballRelease) {
console.error(
"release contract failed: README must explain that tags create GitHub tarball releases without npm publication"
);
process.exit(1);
}

console.log(
publishesToRegistry
? "release contract passed with npm publication enabled"
: "release contract passed for GitHub tarball releases"
);
1 change: 1 addition & 0 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ npm run check
npm run build
npm run smoke
npm run package:smoke
npm run release:contract
if command -v agent-qc >/dev/null 2>&1; then agent-qc ready; else echo "agent-qc not installed; skipping"; fi
Loading