f18a633185
The plugin required `tea`, Gitea's own CLI, for everything that is not an issue: releases, pull requests, milestones, branches, actions, webhooks. That put a second binary, a second set of logins nothing here could see, and 400 lines documenting somebody else's flags outside anything this repository can test. One command over the transport that already existed removes all three. Transport: `post` — the hand-rolled request the SDK cannot express, written for the dependency endpoint — is generalized to an exported `Do`, and `post` is three lines on top of it. Same http.Client, so the same RoundTripper files the body under .kettle/payload/, the same `token …` header authenticates it, and a non-2xx is the same *APIError. It does not paginate, does not reformat the answer, and names no domain concept, so the layering test is untouched. The endpoint rule is `tea api`'s, so an endpoint table written for that tool still works — with one restriction it did not have: a full URL must be on this instance. Every request carries the project's token in a header, and a URL on another host would hand the token to whatever was typed. Command: `kettle api <endpoint>` in a new `api` group, so the generator writes plugins/kettle/skills/api/SKILL.md — group, directory and /kettle:api are one word. No --repo and no --login, for the reason no sync command has them: a cross-repository address is an address, and another instance is KETTLE_URL. `-X DELETE` needs `--yes`; a flag typed on purpose is an operator's decision. Scopes: a token minted for issues carries write:issue and answers 403 on the first request outside issues, naming no scope. Gitea cannot be asked what a token may do — its own token listing needs a password — so `auth add --scopes` records it, `auth list` and `config` show it, and a 403 says which category it is likely to be. Documentation only; nothing is checked against it. skills/use — the tea reference, 239 lines of it — becomes skills/api: what to ask for, which endpoints paginate, and how to write a body. Every mention of `tea` as a requirement is gone from the manifests, the READMEs, the runner and the four other skills; what survives is the back-compat with the old plugin, which is a decision and not a debt. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
69 lines
2.0 KiB
Go
69 lines
2.0 KiB
Go
package cmd
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"git.noodles.cam/claude-skills/marketplace/cli/internal/config"
|
|
"git.noodles.cam/claude-skills/marketplace/cli/internal/issue"
|
|
"git.noodles.cam/claude-skills/marketplace/cli/internal/project"
|
|
)
|
|
|
|
func init() {
|
|
register(&Command{
|
|
Name: "config",
|
|
Group: GroupProject,
|
|
Short: "show what this project resolved to",
|
|
Long: `Every path and every setting, with the overrides already applied, so a run that
|
|
went somewhere unexpected can be explained without guessing.
|
|
|
|
The token is never printed — only whether one was found.
|
|
|
|
This is the command to reach for when the store looks empty, when a push says
|
|
401, or when two directories disagree about which project they are in.`,
|
|
Examples: []Example{
|
|
{"kettle config", "resolved paths and settings"},
|
|
},
|
|
Setup: func(fs *flag.FlagSet) func([]string) error {
|
|
return func(args []string) error {
|
|
root := project.Root("")
|
|
if root == "" {
|
|
return project.NotFoundError("")
|
|
}
|
|
|
|
fmt.Printf("project %s\n", root)
|
|
fmt.Printf("store %s\n", issue.Root(""))
|
|
fmt.Printf("payload %s\n", project.PayloadRoot(""))
|
|
fmt.Printf("config %s\n", config.ProjectPath(""))
|
|
fmt.Printf("logins %s\n", config.LoginsPath())
|
|
|
|
r, err := config.Resolve("")
|
|
if err != nil {
|
|
fmt.Println()
|
|
return err
|
|
}
|
|
red := r.Redacted()
|
|
fmt.Println()
|
|
fmt.Printf("login %s\n", orNone(red.Login))
|
|
fmt.Printf("url %s\n", orNone(red.URL))
|
|
fmt.Printf("token %s\n", orNone(red.Token))
|
|
// What the login says its token can do, which is a note somebody
|
|
// wrote and not an answer from the instance — a 403 out of
|
|
// `kettle api` is read against this line.
|
|
scopes := "(not recorded)"
|
|
if len(red.Scopes) > 0 {
|
|
scopes = strings.Join(red.Scopes, ", ")
|
|
}
|
|
fmt.Printf("scopes %s\n", scopes)
|
|
if r.Owner != "" {
|
|
fmt.Printf("repo %s\n", r.Slug())
|
|
} else {
|
|
fmt.Printf("repo none\n")
|
|
}
|
|
return nil
|
|
}
|
|
},
|
|
})
|
|
}
|