- Added data model for AI-assisted renaming including structures for prompts, responses, and policies. - Created implementation plan detailing the integration of Google Genkit into the CLI for renaming tasks. - Developed quickstart guide for setting up and using the new AI rename functionality. - Documented research decisions regarding Genkit orchestration and prompt composition. - Established tasks for phased implementation, including setup, foundational work, and user stories. - Implemented contract tests to ensure AI rename policies and ledger metadata are correctly applied. - Developed integration tests for validating AI rename flows, including preview, apply, and undo functionalities. - Added tooling to pin Genkit dependency for consistent builds.
177 lines
4.4 KiB
YAML
177 lines
4.4 KiB
YAML
openapi: 3.1.0
|
|
info:
|
|
title: Renamer AI Inline Contract
|
|
version: 0.1.0
|
|
description: |
|
|
JSON payload contract exchanged between the Go `renamer ai` command and the embedded Google Genkit workflow.
|
|
servers:
|
|
- url: command://renamer-ai/genkit
|
|
description: CLI-invoked Genkit runner (JSON via stdin/stdout)
|
|
paths:
|
|
/rename-plan:
|
|
post:
|
|
summary: Generate a rename plan for scoped files (invoked inline, not over HTTP)
|
|
operationId: createRenamePlan
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/RenamePrompt'
|
|
responses:
|
|
'200':
|
|
description: Valid rename plan
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/RenameResponse'
|
|
'400':
|
|
description: Invalid prompt payload
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ErrorResponse'
|
|
'422':
|
|
description: Model returned inconsistent plan
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ValidationError'
|
|
'503':
|
|
description: Upstream model unavailable
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '#/components/schemas/ErrorResponse'
|
|
components:
|
|
schemas:
|
|
RenamePrompt:
|
|
type: object
|
|
required: [workingDir, samples, totalCount, sequenceRule, policies]
|
|
properties:
|
|
workingDir:
|
|
type: string
|
|
samples:
|
|
type: array
|
|
minItems: 1
|
|
items:
|
|
$ref: '#/components/schemas/PromptSample'
|
|
totalCount:
|
|
type: integer
|
|
minimum: 1
|
|
sequenceRule:
|
|
$ref: '#/components/schemas/SequenceRule'
|
|
policies:
|
|
$ref: '#/components/schemas/NamingPolicy'
|
|
bannedTerms:
|
|
type: array
|
|
items:
|
|
type: string
|
|
metadata:
|
|
type: object
|
|
additionalProperties:
|
|
type: string
|
|
PromptSample:
|
|
type: object
|
|
required: [originalName, extension, sizeBytes, pathDepth]
|
|
properties:
|
|
originalName:
|
|
type: string
|
|
extension:
|
|
type: string
|
|
sizeBytes:
|
|
type: integer
|
|
minimum: 0
|
|
pathDepth:
|
|
type: integer
|
|
minimum: 0
|
|
SequenceRule:
|
|
type: object
|
|
required: [style, width, start, separator]
|
|
properties:
|
|
style:
|
|
type: string
|
|
enum: [prefix, suffix]
|
|
width:
|
|
type: integer
|
|
minimum: 1
|
|
start:
|
|
type: integer
|
|
minimum: 1
|
|
separator:
|
|
type: string
|
|
NamingPolicy:
|
|
type: object
|
|
required: [casing]
|
|
properties:
|
|
prefix:
|
|
type: string
|
|
casing:
|
|
type: string
|
|
enum: [kebab, snake, camel, pascal, title]
|
|
allowSpaces:
|
|
type: boolean
|
|
default: false
|
|
keepOriginalOrder:
|
|
type: boolean
|
|
default: false
|
|
forbiddenTokens:
|
|
type: array
|
|
items:
|
|
type: string
|
|
RenameResponse:
|
|
type: object
|
|
required: [items]
|
|
properties:
|
|
items:
|
|
type: array
|
|
minItems: 1
|
|
items:
|
|
$ref: '#/components/schemas/RenameItem'
|
|
warnings:
|
|
type: array
|
|
items:
|
|
type: string
|
|
promptHash:
|
|
type: string
|
|
model:
|
|
type: string
|
|
RenameItem:
|
|
type: object
|
|
required: [original, proposed, sequence]
|
|
properties:
|
|
original:
|
|
type: string
|
|
proposed:
|
|
type: string
|
|
sequence:
|
|
type: integer
|
|
minimum: 1
|
|
notes:
|
|
type: string
|
|
ValidationError:
|
|
type: object
|
|
required: [message, conflicts]
|
|
properties:
|
|
message:
|
|
type: string
|
|
conflicts:
|
|
type: array
|
|
items:
|
|
type: object
|
|
properties:
|
|
original:
|
|
type: string
|
|
issue:
|
|
type: string
|
|
detail:
|
|
type: string
|
|
ErrorResponse:
|
|
type: object
|
|
required: [message]
|
|
properties:
|
|
message:
|
|
type: string
|
|
retryable:
|
|
type: boolean
|