协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
lov-npm-publisher【开发与工程】为全新或已有 npm 包建立免重复登录的自动发布链,兼容 GitHub Actions OIDC(trusted publishing)与本地 granular NPM_TOKEN(bypass)两种平级方式,处理首次引导、发布审计与线上回读。Use when the user asks to 自动发布 npm 包、publish npm without login、发布 npm 包不用登录。
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
把 npm 包从“每次登录或维护长期 token”迁移到可审计的自动发布链。支持两种平级的认证方式:
npm publish(适合本地快速发布、无 CI 的包)。输出必须区分首次引导、认证配置、发布执行和 registry 回读,不能把工作流生成等同于已经发布。
lov-skill-publisher。lov-release-via-cicd。Read skill.yaml on every invocation. Resolve the current request, project
context, Skill records, shared preferences, and the shared user/brand Profile in
that order. Keep repository names, workflow choices, and credentials out of the
portable source unless the user explicitly asks to persist a non-secret default.
Persist only direct durable statements through scripts/profile_store.py and
report the canonical Profile path. Never persist npm tokens, OTP values, cookies,
OIDC assertions, or secret-like environment values. See
references/user-profile.md for the full contract.
Read references/skill-composition.md before invoking an adjacent Skill. Sibling
Skills are optional artifact-level handoffs, not hidden runtime dependencies.
Follow these steps in order.
SKILL_DIR and the target package directory from the
request or current working directory.references/npm-publishing-contract.md and recheck the linked npm
documentation when authentication behavior, supported runners, or deprecation
dates could have changed.references/skill-composition.md before choosing an optional handoff.package.json, git, npm, and scripts/publish.py exist. Do not
request or print credentials during this read-only phase.Run the planner first:
python3 "$SKILL_DIR/scripts/publish.py" PACKAGE_DIR --dry-run --json
The audit must establish:
private flag, registry, and repository URL;id-token: write, npm publish, and no
long-lived publish secret;bootstrap_required, package_exists, or
registry_unknown.Do not turn a timeout, authorization error, or registry outage into “package does not exist”. Stop before publication when registry state is unknown.
The planner emits auth.mode as oidc or bypass. With --auth-mode auto
(the default), it resolves to oidc when a GitHub repository resolves and
bypass otherwise; pass --auth-mode oidc|bypass to override inference. Both
modes are first-class and equal; prefer oidc for GitHub-repository continuous
releases and bypass for local, CI-less, or new-package publication.
Trusted publishing cannot be registered for a name that does not yet exist. For
bootstrap_required, explain that one interactive identity proof is unavoidable,
then perform it only when the request authorizes publication:
npm login
npm publish --access public
Re-read the exact package and version from the npm registry. A successful command without registry visibility is not completion.
For package_exists, configure or verify the exact repository/workflow binding.
With a current npm CLI, the plan emits a command shaped like:
npm trust github PACKAGE --repo OWNER/REPO --file publish.yml --allow-publish
This management action requires interactive identity proof. If it was already configured, verify the existing binding rather than replacing it blindly.
A granular (Bypass-2FA) npm_ token publishes directly, including new packages.
Detect the token without reading its value; auth.token reports whether
NPM_TOKEN or a ~/.npmrc _authToken is present. When it is missing, warn and
request a granular token before publishing. auth.publish_command carries the
exact command; never echo the token value.
After resolving blocking audit errors, materialize the mode-specific artifact:
python3 "$SKILL_DIR/scripts/publish.py" PACKAGE_DIR --write --json
For oidc, the writer emits the tokenless workflow. It is conservative:
--force
is explicitly justified;NPM_TOKEN, an npm access token, or an OTP;contents: read and id-token: write;npm publish.Review the diff. The package's repository.url must match the GitHub repository
used by the trusted publisher; fix the package metadata before publishing when it
does not match.
For bypass, the writer sets write_state to not-applicable — no workflow is
generated. Use the auth.publish_command from the plan as the release command.
Before triggering the workflow:
npm pack --dry-run --json; reject secrets,
unintended source files, private paths, or missing build output.Only when the user asked to publish, act by mode:
oidc — create/push the intended version tag or run the configured manual
workflow, then follow the GitHub Actions run to a terminal state.bypass — run auth.publish_command from the plan against the granular
NPM_TOKEN.Then verify independently:
npm view PACKAGE@VERSION version --registry https://registry.npmjs.org
For public repositories, also check the npm provenance record when supported.
Report the exact version, workflow run (or local publish), registry result, and
provenance state. queued, in_progress, a generated YAML file, or an accepted
npm publish request is not equivalent to a live package version. A root
endpoint 404 right after publish can be CDN lag; re-read the specific version
endpoint before concluding failure.
Use these states:
audited — repository and registry state classified;bootstrap-required — package name does not yet exist;workflow-written — tokenless OIDC workflow exists locally;trusted-publisher-configured — npm binding was verified;publish-command-ready — bypass mode resolved a publish command and token;publish-triggered — CI accepted the release request;published — publish (CI or local) finished successfully;verified-live — exact package and version were read back from npm;blocked — name the missing identity proof, registry evidence, or failed gate.Exercise both registry branches and both auth modes without external writes:
python3 scripts/publish.py CASE_DIR --registry-state missing --dry-run --json
python3 scripts/publish.py CASE_DIR --registry-state exists --dry-run --json
python3 scripts/publish.py CASE_DIR --auth-mode oidc --dry-run --json
python3 scripts/publish.py CASE_DIR --auth-mode bypass --dry-run --json
python3 scripts/validate_skill.py .
An activation check should route “帮我把这个新 npm 包自动发布,以后不要登录”
and “用 NPM_TOKEN 本地发布这个包” here. “把这个 Agent Skill 上架到
LovStudio” must stay with lov-skill-publisher.
用户在 Skill 驱动任务中提出修改意见时,继续当前产物前必须执行:
task-specific(仅本次)还是 reusable(可跨任务复用)。task-specific 只修改当前任务,不改 Skill。reusable 先确定作用域:领域规则先更新对应 canonical Skill;适用于所有 Skill 的规则先更新共享规范。reusable 修改会使此前的“确认”“继续”“发吧”失效;完成当前产物修改和回读后必须停下,等待用户下一步指示,不自动进入发布、提交或其他外部写入。