diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08eb60d..1c526db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,13 @@ jobs: with: bun-version: 1.3.10 + - name: Configure Celados npm registry + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + printf '%s\n' '@celados:registry=https://npm.celados.com' > .npmrc + printf '%s\n' "//npm.celados.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc + - name: Install dependencies run: bun install --frozen-lockfile diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31c7bb9..89af478 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,14 @@ jobs: fi bun run ./packages/gkit/scripts/release-preflight.ts "${args[@]}" + - name: Configure Celados npm registry + if: steps.preflight.outputs.release == 'true' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + printf '%s\n' '@celados:registry=https://npm.celados.com' > .npmrc + printf '%s\n' "//npm.celados.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc + - name: Install frozen dependencies if: steps.preflight.outputs.release == 'true' run: bun install --frozen-lockfile diff --git a/README.md b/README.md index ba8ce1a..55039bf 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,8 @@ aliases or deprecated binaries. Historical behavior evidence remains under ## Verification +Development dependencies include `@celados/argc` from the private team registry `npm.celados.com`. Before `bun install`, write a gitignored `.npmrc` that maps `@celados` to that registry with the team token (template: `.npmrc.tpl` in `celados/argc`, rendered with `latch render`). CI does the same from the `NPM_TOKEN` secret. The release artifact is a bundle and needs no registry access. + ```bash bun run eval bun run check-types diff --git a/bun.lock b/bun.lock index fa1730b..fa8bd4f 100644 --- a/bun.lock +++ b/bun.lock @@ -14,38 +14,36 @@ }, "packages/gkit": { "name": "gkit", - "version": "0.2.0", + "version": "0.2.1", "bin": { - "gkit": "bin/gkit.js", + "gkit": "dist/gkit.js", }, - "dependencies": { + "devDependencies": { + "@celados/argc": "^7.11.3", "@standard-schema/spec": "^1.0.0", + "@types/bun": "^1.3.10", + "@types/node": "^25.6.0", "@valibot/to-json-schema": "^1.6.0", "ajv": "^8.20.0", - "argc": "github:ethan-huo/argc#v7.11.1", + "bun-types": "^1.3.13", "cheerio": "^1.2.0", "dotenv": "^17.2.2", "google-auth-library": "^10.9.0", "robots-parser": "3.0.1", "saxes": "6.0.0", - "valibot": "^1.2.0", - "yaml": "^2.9.0", - }, - "devDependencies": { - "@types/bun": "^1.3.10", - "@types/node": "^25.6.0", - "bun-types": "^1.3.13", "typescript": "^5", + "valibot": "^1.2.0", "vitest": "^4.0.18", + "yaml": "^2.9.0", }, }, }, "catalog": { + "@celados/argc": "^7.11.3", "@types/bun": "^1.3.10", "@types/node": "^25.6.0", "@valibot/to-json-schema": "^1.6.0", "ajv": "^8.20.0", - "argc": "github:ethan-huo/argc#v7.11.1", "bun-types": "^1.3.13", "dataforseo-client": "^2.0.25", "dotenv": "^17.2.2", @@ -56,6 +54,8 @@ "yaml": "^2.9.0", }, "packages": { + "@celados/argc": ["@celados/argc@7.11.3", "https://npm.celados.com/@celados/argc/-/@celados/argc-7.11.3.tgz", { "dependencies": { "oxc-parser": "0.137.0", "yaml": "2.9.0" }, "peerDependencies": { "@standard-schema/spec": "^1.0.0" } }, "sha512-ZA9mOj6VumqIymQefvnu8thSfGyTsGBLif1Wg5mE6SKI1uYNmtys2wXtPU9GKZk0kw8ioRK5Sx15Z865HaZ5mA=="], + "@emnapi/core": ["@emnapi/core@1.11.1", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ=="], "@emnapi/runtime": ["@emnapi/runtime@1.11.1", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw=="], @@ -172,8 +172,6 @@ "ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], - "argc": ["@celados/argc@github:ethan-huo/argc#5d52bd5", { "dependencies": { "oxc-parser": "0.137.0", "yaml": "2.9.0" }, "peerDependencies": { "@standard-schema/spec": "^1.0.0" } }, "ethan-huo-argc-5d52bd5", "sha512-ezA721dld0eCDsgTKcCDTaAzpBpst/li5SZL9i3s3i/j3wVuCpv8uiOa1+kNZY5FZDc2TJO+R/HD+EKVbjhVYg=="], - "assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="], "base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="], diff --git a/package.json b/package.json index 5051285..629901c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "@types/node": "^25.6.0", "@valibot/to-json-schema": "^1.6.0", "ajv": "^8.20.0", - "argc": "github:ethan-huo/argc#v7.11.1", + "@celados/argc": "^7.11.3", "bun-types": "^1.3.13", "dataforseo-client": "^2.0.25", "dotenv": "^17.2.2", diff --git a/packages/gkit/package.json b/packages/gkit/package.json index 364fd79..3f5c935 100644 --- a/packages/gkit/package.json +++ b/packages/gkit/package.json @@ -1,22 +1,21 @@ { "name": "gkit", - "version": "0.2.1", + "version": "0.2.2", "private": true, "description": "Profile-bound, agent-first growth provider CLI.", "bin": { - "gkit": "bin/gkit.js" + "gkit": "dist/gkit.js" }, "files": [ - "bin", + "dist", "docs", - "generated", - "src", - "!**/*.test.ts" + "generated" ], "type": "module", "sideEffects": false, "scripts": { "cli": "bun run ./src/cli.ts", + "build": "bun build ./bin/gkit.js --target=bun --outfile=dist/gkit.js", "check-types": "tsc --noEmit", "generate:dataforseo": "bun run ./scripts/generate-dataforseo.ts", "generate:dataforseo:check": "bun run ./scripts/generate-dataforseo.ts --check", @@ -35,24 +34,22 @@ "test:once": "vitest run && bun run test:site", "test:site": "bun run ./scripts/test-site-snapshot.ts" }, - "dependencies": { + "devDependencies": { + "@celados/argc": "^7.11.3", "@standard-schema/spec": "^1.0.0", + "@types/bun": "^1.3.10", + "@types/node": "^25.6.0", "@valibot/to-json-schema": "^1.6.0", "ajv": "^8.20.0", - "argc": "github:ethan-huo/argc#v7.11.1", + "bun-types": "^1.3.13", "cheerio": "^1.2.0", "dotenv": "^17.2.2", "google-auth-library": "^10.9.0", "robots-parser": "3.0.1", "saxes": "6.0.0", + "typescript": "^5", "valibot": "^1.2.0", + "vitest": "^4.0.18", "yaml": "^2.9.0" - }, - "devDependencies": { - "@types/bun": "^1.3.10", - "@types/node": "^25.6.0", - "bun-types": "^1.3.13", - "typescript": "^5", - "vitest": "^4.0.18" } } diff --git a/packages/gkit/scripts/verify-package-artifact.ts b/packages/gkit/scripts/verify-package-artifact.ts index 47d24bd..eaa844d 100644 --- a/packages/gkit/scripts/verify-package-artifact.ts +++ b/packages/gkit/scripts/verify-package-artifact.ts @@ -15,7 +15,7 @@ type PackageJson = Readonly<{ private?: unknown; }>; -const allowedTopLevelEntries = new Set(["bin", "docs", "generated", "package.json", "src"]); +const allowedTopLevelEntries = new Set(["dist", "docs", "generated", "package.json"]); const forbiddenPathPattern = /(^|\/)(?:\.env(?:\..*)?|\.npmrc|bunfig\.toml|[^/]*\.test\.[^/]+|__tests__|evals?|scripts?|sources?|policy)(?:\/|$)/i; const secretMaterialPatterns = [ @@ -45,6 +45,9 @@ try { throw new Error("The gkit package must remain private to prevent registry publication."); } + // The artifact ships a Bun bundle: runtime deps (incl. the private @celados/argc) + // are inlined, so public consumers install with no registry auth. + await runCommand(["bun", "run", "build"], packageRoot); const packed = await runCommand( ["npm", "pack", "--json", "--pack-destination", packDirectory, packageRoot], temporaryRoot, @@ -154,7 +157,7 @@ function parseOutputDirectory(arguments_: readonly string[]): string | undefined } async function verifyPackageContents(paths: readonly string[]): Promise { - if (!paths.includes("bin/gkit.js") || !paths.includes("package.json")) { + if (!paths.includes("dist/gkit.js") || !paths.includes("package.json")) { throw new Error("The package is missing its binary or package manifest."); } if (!paths.some((path) => path.startsWith("generated/"))) { diff --git a/packages/gkit/src/cli.ts b/packages/gkit/src/cli.ts index 46d93e9..daef0a4 100644 --- a/packages/gkit/src/cli.ts +++ b/packages/gkit/src/cli.ts @@ -1,6 +1,6 @@ import { fileURLToPath } from "node:url"; -import { ensureTrailingNewline, formatBareSkill } from "argc/skill"; +import { ensureTrailingNewline, formatBareSkill } from "@celados/argc/skill"; import { parseArgs, renderHelp } from "./args"; import { embedSkill } from "./skill.embed"; diff --git a/packages/gkit/src/schema.ts b/packages/gkit/src/schema.ts index 8650d0a..abb2cf7 100644 --- a/packages/gkit/src/schema.ts +++ b/packages/gkit/src/schema.ts @@ -1,6 +1,6 @@ import { siteRouter } from "./site/schema"; import { toStandardJsonSchema } from "@valibot/to-json-schema"; -import { c, generateSchema, group, selectSchema, type Router } from "argc"; +import { c, generateSchema, group, selectSchema, type Router } from "@celados/argc"; import * as v from "valibot"; import { GkitFailure } from "./envelope"; diff --git a/packages/gkit/src/site/schema.ts b/packages/gkit/src/site/schema.ts index c6c5cf3..d7394bc 100644 --- a/packages/gkit/src/site/schema.ts +++ b/packages/gkit/src/site/schema.ts @@ -1,4 +1,4 @@ -import { c, group } from "argc"; +import { c, group } from "@celados/argc"; import { toStandardJsonSchema as s } from "@valibot/to-json-schema"; import * as v from "valibot"; const command = (description: string, input: v.GenericSchema) => diff --git a/packages/gkit/src/skill.embed.ts b/packages/gkit/src/skill.embed.ts index 4948c21..fd735f7 100644 --- a/packages/gkit/src/skill.embed.ts +++ b/packages/gkit/src/skill.embed.ts @@ -1,6 +1,6 @@ -// Runtime read, not a Bun macro: gkit ships as a source tarball installed -// into node_modules, and Bun refuses to run macros from there. +// Text import: inlined into the bundled release artifact, read from disk in dev. +import skill from "./index.md" with { type: "text" }; + export async function embedSkill(): Promise> { - const text = await Bun.file(new URL("./index.md", import.meta.url)).text(); - return { "SKILL.md": text }; + return { "SKILL.md": skill }; } diff --git a/packages/gkit/src/text-modules.d.ts b/packages/gkit/src/text-modules.d.ts new file mode 100644 index 0000000..a46c7c3 --- /dev/null +++ b/packages/gkit/src/text-modules.d.ts @@ -0,0 +1,5 @@ +// Bun text imports (`with { type: "text" }`) resolve markdown to its contents. +declare module "*.md" { + const text: string; + export default text; +}