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
10 changes: 6 additions & 4 deletions agent-skills/skill-publish/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ test -f "$PUBLISH_HELPER"
printf '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}\n' > "$NPMRC"
secrets exec "$TOKEN_PATH" --as NODE_AUTH_TOKEN -- \
bash "$PUBLISH_HELPER" --userconfig "$NPMRC" --access "$ACCESS"
)

VERIFY_DIR=$(mktemp -d)
PUBLISHED_GIT_HEAD=""
for attempt in 1 2 3 4 5; do
if npm view "$PKG@$NEW_VERSION" gitHead --json \
> "$VERIFY_DIR/githead.out" \
2> "$VERIFY_DIR/githead.err"; then
if secrets exec "$TOKEN_PATH" --as NODE_AUTH_TOKEN -- \
npm view "$PKG@$NEW_VERSION" gitHead --json \
--userconfig "$NPMRC" \
> "$VERIFY_DIR/githead.out" \
2> "$VERIFY_DIR/githead.err"; then
if [ -s "$VERIFY_DIR/githead.out" ]; then
if PUBLISHED_GIT_HEAD=$(node -e '
const fs = require("node:fs");
Expand All @@ -192,6 +193,7 @@ if [ "$PUBLISHED_GIT_HEAD" != "$EXPECTED_GIT_HEAD" ]; then
exit 1
fi
printf 'GITHEAD_VERIFIED: %s\n' "$PUBLISHED_GIT_HEAD"
)
```

### 9. Install locally via bun (NOT npm)
Expand Down
9 changes: 9 additions & 0 deletions src/lib/agent-workflow-skills.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,20 @@ describe("repository-managed agent workflow skills", () => {
const skill = readFileSync(join(AGENT_SKILLS_DIR, "skill-publish", "SKILL.md"), "utf8");
expect(skill).toContain("scripts/publish_with_git_head.sh");
expect(skill).toContain('secrets exec "$TOKEN_PATH" --as NODE_AUTH_TOKEN');
expect(skill).toContain(
"printf '//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}\\n' > \"$NPMRC\"",
);
expect(skill.match(/secrets exec "\$TOKEN_PATH" --as NODE_AUTH_TOKEN/g) ?? []).toHaveLength(2);
expect(skill).toContain(
String.raw`npm view "$PKG@$NEW_VERSION" gitHead --json \
--userconfig "$NPMRC"`,
);
expect(skill).toContain('--userconfig "$NPMRC"');
expect(skill).toContain("GITHEAD_VERIFIED:");
expect(skill).toContain('grep -iE "^\\\\+([^+].*)?($SECRET_PATTERN)"');
expect(skill).not.toContain('grep -iE "^\\\\+[^+].*($SECRET_PATTERN)"');
expect(skill).not.toContain("bun publish --access");
expect(skill).not.toContain("_authToken=[REDACTED_SECRET]");
});

test("skill-publish preserves npm gitHead and restores linked worktrees", () => {
Expand Down