-
Notifications
You must be signed in to change notification settings - Fork 0
Devel #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devel #33
Changes from all commits
d2d2b8b
a985c4a
c6d4949
80da15e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,34 @@ export function handleApproval(res: { status: number; body: any }): boolean { | |
| return false | ||
| } | ||
|
|
||
| export type NextAction = { op: string; reason: string; args?: Record<string, unknown>; gated?: boolean } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Prompt for AI agents |
||
|
|
||
| // Neutral op → an `insta` command string. Unknown ops fall back to reason-only (no crash). | ||
| const OP_COMMAND: Record<string, (a: Record<string, unknown>) => string> = { | ||
| 'service.add': (a) => `insta services add ${a.type ?? '<type>'} ${a.name ?? '<name>'}`, | ||
| deploy: (a) => `insta deploy${a.branch ? ` --branch ${a.branch}` : ''}`, | ||
| 'secrets.set': (a) => `insta secrets set ${a.name ?? '<NAME>'} ${a.value ?? '<value>'}`, | ||
| metrics: (a) => `insta metrics ${a.target ?? 'compute'}`, | ||
| logs: (a) => `insta logs ${a.target ?? 'compute'}`, | ||
| 'approvals.approve': (a) => `insta approvals approve ${a.approvalId ?? '<id>'}`, | ||
| } | ||
|
|
||
| // Pure — builds the printable lines (unit-tested). Empty input → []. | ||
| export function nextActionsLines(actions: NextAction[] | undefined): string[] { | ||
| if (!actions || actions.length === 0) return [] | ||
| const lines = ['Next:'] | ||
| for (const a of actions) { | ||
| const cmd = OP_COMMAND[a.op]?.(a.args ?? {}) | ||
| const gated = a.gated ? ' [needs approval]' : '' | ||
| lines.push(cmd ? ` • ${a.reason} → ${cmd}${gated}` : ` • ${a.reason}${gated}`) | ||
| } | ||
| return lines | ||
| } | ||
|
|
||
| export function renderNextActions(actions: NextAction[] | undefined): void { | ||
| for (const line of nextActionsLines(actions)) info(line) | ||
| } | ||
|
|
||
| // Serialize a credential bundle to .env text. All values are double-quoted (connection strings | ||
| // contain special chars); backslashes and quotes are escaped so dotenv parsers read them back exactly. | ||
| export function serializeEnv(bundle: Record<string, string>): string { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3:
insta compute statuswithout[service]prints the opaque service ID even when the sole compute service has a name. Derive the name from the already-fetchedserviceslist so status output stays readable and consistent with lifecycle commands.Prompt for AI agents