Repository navigation
modapi link; init links an existing project or creates one (v0.4.0) - #14
Merged
Merged
Conversation
- `modapi link [project]` connects this directory to a project you already
have: it makes a new key for the project (POST /projects/{id}/api-keys,
named after this computer and directory) and writes MODAPI_SECRET_KEY and
MODAPI_WEBHOOK_SECRET to the env file. Without a project it lists them to
pick from. It asks before replacing a key for another project (--force in
scripts) and changes nothing when the key is already for that project.
- `init` no longer always creates a project. When the organization has
projects it asks whether to link one or create a new one. Agents and
scripts choose with --project <id or name> or --new; without either, init
stops and lists the projects.
- The setup skill asks the user which project to use.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
modapi link [project]: connect this directory to a project you already have.POST /projects/{id}/api-keys(moderation-api/api#454). The key is namedCLI · <directory> · <computer>. It writesMODAPI_SECRET_KEYandMODAPI_WEBHOOK_SECRETto the env file (.env.localfor Next.js, else.env) and adds the file to.gitignore.--forcein scripts). If the key is already for that project, it changes nothing.initno longer always creates a project.--project <id or name>or--new. Without either, and with projects to choose from,initexits 2 and lists them, so the agent asks the user instead of guessing.--forceto link or create anyway).checkEnvFileWritable(refuse a committed env file before making anything) andwriteProjectEnv.Setup skill: moved to moderation-api/skills in #13; its link-or-create update goes there separately.
Tests
initwith projects and no flag asks the agent to choose (exit 2, no writes);init --project forumlinks by name, case-insensitive, with key nameCLI · …;--projectand--newtogether are refused; an ambiguous name; replacing another project's key needs--force; linking the same project makes no key.inittests are updated for the project-list call.go test ./...passes.modapi loginsession:projects listuses the login key through the fallback from Find the key from .env or modapi login; clearer doctor output #11, andinit -o jsonlists the organization's 6 projects with the--project/--newhints. I did not create a key in production.Release: this branch is on top of the v0.4.0 regen commit (the new
projects api-keys createcommand). Merging it releases v0.4.0 withlink, the key fallback and the newdoctoroutput, and supersedes #12.🤖 Generated with Claude Code