Skip to content

Commit 41ef60e

Browse files
feat(cli): iris skills review — approve/reject auto-generated drafts (1.3.25) (#19)
Stage 5 of the skill flywheel surfaces in the CLI as three new subcommands: iris skills review list pending auto-generated drafts (originator-only, scoped via auto_generated_from .originating_user_id on the backend) iris skills review approve N publish + auto-install for the originator iris skills review reject N suspend + record reason (--reason "...") SDK registry additions for raw access via sdk:call: skills.pending → GET /api/v1/skills/auto-generated/pending skills.approve → POST /api/v1/skills/{id}/approve skills.reject → POST /api/v1/skills/{id}/reject Backed by fl-api PR #66 — PendingSkillsController + routes. Closes the loop: trajectory → cluster → draft → review → installed skill. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent ad729fe commit 41ef60e

3 files changed

Lines changed: 105 additions & 1 deletion

File tree

‎packages/opencode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
3-
"version": "1.3.24",
3+
"version": "1.3.25",
44
"name": "opencode",
55
"displayName": "iris-agent-cli",
66
"type": "module",

‎packages/opencode/src/cli/cmd/platform-sdk-call.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ const ROUTES: Record<string, RouteDescriptor> = {
126126
// Cross-source recall (iris-api)
127127
"recall.search": { method: "GET", path: "/api/v6/recall", base: "iris" },
128128

129+
// Skill flywheel review queue (fl-api)
130+
"skills.pending": { method: "GET", path: "/api/v1/skills/auto-generated/pending" },
131+
"skills.approve": { method: "POST", path: "/api/v1/skills/{id}/approve" },
132+
"skills.reject": { method: "POST", path: "/api/v1/skills/{id}/reject" },
133+
129134
// Bloq ingestion
130135
"bloqs.ingestFolder": { method: "POST", path: "/api/v1/bloqs/{bloqId}/ingest-folder" },
131136
"bloqs.ingestionJobs": { method: "GET", path: "/api/v1/bloqs/{bloqId}/ingestion-jobs" },

‎packages/opencode/src/cli/cmd/platform-skills.ts‎

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,104 @@ const SkillsDeleteCommand = cmd({
117117
},
118118
})
119119

120+
// Skill flywheel — Stage 5 review queue. Auto-generated drafts from the
121+
// trajectory→pattern→synthesis pipeline land in pending_review status; this
122+
// subcommand lets the originator approve (publish + auto-install) or reject.
123+
124+
const SkillsReviewListCommand = cmd({
125+
command: "list",
126+
aliases: ["ls"],
127+
describe: "list auto-generated skill drafts pending review (originator-only)",
128+
builder: (yargs) => yargs.option("json", { type: "boolean", default: false }),
129+
async handler(args) {
130+
UI.empty()
131+
prompts.intro("◈ Skill Drafts — Pending Review")
132+
const token = await requireAuth(); if (!token) { prompts.outro("Done"); return }
133+
const res = await irisFetch(`/api/v1/skills/auto-generated/pending`)
134+
const ok = await handleApiError(res, "List pending drafts"); if (!ok) { prompts.outro("Done"); return }
135+
const data = (await res.json()) as any
136+
const drafts: any[] = data?.data ?? []
137+
if (args.json) { console.log(JSON.stringify(drafts, null, 2)); prompts.outro("Done"); return }
138+
if (drafts.length === 0) {
139+
printDivider()
140+
console.log(` ${dim("No drafts pending review.")}`)
141+
printDivider()
142+
prompts.outro("Done")
143+
return
144+
}
145+
printDivider()
146+
for (const d of drafts) {
147+
console.log(` ${bold(`#${d.id}`)} ${d.display_name}`)
148+
console.log(` ${dim(`tools: ${(d.tool_sequence ?? []).join(" → ") || "(none)"}`)}`)
149+
console.log(` ${dim(`confidence: ${d.confidence?.toFixed?.(2) ?? d.confidence}, bloq: ${d.originating_bloq_id ?? "(any)"}, examples: ${(d.trajectory_ids ?? []).length}`)}`)
150+
console.log(` ${dim(d.description ?? "")}`)
151+
console.log()
152+
}
153+
printDivider()
154+
prompts.outro(`${drafts.length} draft(s) — approve with: iris skills review approve <id>`)
155+
},
156+
})
157+
158+
const SkillsReviewApproveCommand = cmd({
159+
command: "approve <id>",
160+
describe: "approve an auto-generated skill draft (publishes + auto-installs)",
161+
builder: (yargs) =>
162+
yargs
163+
.positional("id", { type: "number", demandOption: true })
164+
.option("json", { type: "boolean", default: false }),
165+
async handler(args) {
166+
UI.empty()
167+
prompts.intro(`◈ Approve Skill Draft #${args.id}`)
168+
const token = await requireAuth(); if (!token) { prompts.outro("Done"); return }
169+
const res = await irisFetch(`/api/v1/skills/${args.id}/approve`, { method: "POST", body: JSON.stringify({}) })
170+
const ok = await handleApiError(res, "Approve skill"); if (!ok) { prompts.outro("Done"); return }
171+
const data = (await res.json()) as any
172+
if (args.json) { console.log(JSON.stringify(data, null, 2)); prompts.outro("Done"); return }
173+
printDivider()
174+
console.log(` ${success("✓")} ${data?.message ?? "Approved"}`)
175+
if (data?.data?.installation_id) console.log(` ${dim(`Installation ID: ${data.data.installation_id}`)}`)
176+
printDivider()
177+
prompts.outro("Done")
178+
},
179+
})
180+
181+
const SkillsReviewRejectCommand = cmd({
182+
command: "reject <id>",
183+
describe: "reject an auto-generated skill draft",
184+
builder: (yargs) =>
185+
yargs
186+
.positional("id", { type: "number", demandOption: true })
187+
.option("reason", { type: "string", describe: "optional rejection reason" })
188+
.option("json", { type: "boolean", default: false }),
189+
async handler(args) {
190+
UI.empty()
191+
prompts.intro(`◈ Reject Skill Draft #${args.id}`)
192+
const token = await requireAuth(); if (!token) { prompts.outro("Done"); return }
193+
const body: Record<string, unknown> = {}
194+
if (args.reason) body.reason = String(args.reason)
195+
const res = await irisFetch(`/api/v1/skills/${args.id}/reject`, { method: "POST", body: JSON.stringify(body) })
196+
const ok = await handleApiError(res, "Reject skill"); if (!ok) { prompts.outro("Done"); return }
197+
const data = (await res.json()) as any
198+
if (args.json) { console.log(JSON.stringify(data, null, 2)); prompts.outro("Done"); return }
199+
printDivider()
200+
console.log(` ${success("✓")} ${data?.message ?? "Rejected"}`)
201+
printDivider()
202+
prompts.outro("Done")
203+
},
204+
})
205+
206+
const SkillsReviewCommand = cmd({
207+
command: "review <command>",
208+
describe: "review auto-generated skill drafts — list, approve, reject",
209+
builder: (yargs) =>
210+
yargs
211+
.command(SkillsReviewListCommand)
212+
.command(SkillsReviewApproveCommand)
213+
.command(SkillsReviewRejectCommand)
214+
.demandCommand(1, "specify a subcommand: list | approve <id> | reject <id>"),
215+
handler: () => {},
216+
})
217+
120218
export const PlatformSkillsCommand = cmd({
121219
command: "skills",
122220
describe: "manage agent skills (V6)",
@@ -126,6 +224,7 @@ export const PlatformSkillsCommand = cmd({
126224
.command(SkillsShowCommand)
127225
.command(SkillsCreateCommand)
128226
.command(SkillsDeleteCommand)
227+
.command(SkillsReviewCommand)
129228
.demandCommand(),
130229
async handler() {},
131230
})

0 commit comments

Comments
 (0)