Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6bfd24d
fix: infer destructive intent for cloud DELETE and known destructive …
margaretjgu Aug 11, 2026
e3951f8
fix: mark extension remove as destructive
margaretjgu Aug 11, 2026
5f1480c
feat: add --yes confirmation guard for destructive commands
margaretjgu Aug 11, 2026
c794af5
chore: regenerate cli schema with --yes flag
margaretjgu Aug 12, 2026
cdc3e10
fix: use schema destructive flag for cloud commands
margaretjgu Aug 14, 2026
f113cbd
fix: lowercase yes flag help text
margaretjgu Aug 14, 2026
de1821e
test: add cloud destructive intent guard tests
margaretjgu Aug 14, 2026
952aad0
chore: regenerate cli schema
margaretjgu Aug 14, 2026
1412438
fix: pass yes flag in generated es delete tests
margaretjgu Aug 14, 2026
606437a
fix: pass yes flag in kb functional delete calls
margaretjgu Aug 14, 2026
bcbadf6
ci: cap test node job at 10 minutes
margaretjgu Aug 14, 2026
89b9267
test: fail individual tests after 20s not the job
margaretjgu Aug 14, 2026
08eb210
test: drop dynamic import causing windows test hang
margaretjgu Aug 14, 2026
3a4fc4b
test: raise per test timeout to 60s
margaretjgu Aug 14, 2026
af9e1f7
test: drop coverage flags to isolate windows hang
margaretjgu Aug 14, 2026
2879832
test: rename confirmation test to check position dependence
margaretjgu Aug 14, 2026
cc35e86
test: revert to dynamic commander import, restore filename
margaretjgu Aug 14, 2026
b27b223
test: merge tty prompt cases back into one test
margaretjgu Aug 14, 2026
b8d0380
test: add diagnostic marker for real readline fallback
margaretjgu Aug 14, 2026
a873792
test: revert failed hang fixes, keep timeout diagnostics
margaretjgu Aug 14, 2026
cf5d16a
test: add isolated tty hang repro file
margaretjgu Aug 14, 2026
5cb43ae
fix: stop mutating process.stderr.isTTY directly in tests
margaretjgu Aug 14, 2026
9238e13
test: add diagnostics to isolate windows hang
margaretjgu Aug 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [22.x, 24.x, 25.x]
runs-on: ${{ matrix.os }}
# Baseline job time is 1-3 min; cap at 15 to fail fast on a hang instead
# of burning hours and losing logs to blob storage expiry.
timeout-minutes: 15
# Per-endpoint Zod schemas (#171) that once bloated .d.ts emit are gone,
# but tsc build still peaks around 3.7 GB locally; keep headroom above
# the 2 GB Node default for slower/smaller CI runners.
Expand Down
7 changes: 7 additions & 0 deletions codegen/functional/mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { EsApiDefinition } from '../../src/es/types.ts'
import { extractSchemaArgs } from '../../src/lib/json-schema-args.ts'
import type { SchemaArgDefinition } from '../../src/lib/json-schema-args.ts'
import { inferIntentFromHttp } from '@cli-schema/spec'

/**
* Result of mapping a YAML dot-notation action to a CLI command.
Expand Down Expand Up @@ -62,6 +63,12 @@ export function mapAction (
if (def.namespace != null) args.push(def.namespace)
args.push(def.name)

// Destructive commands prompt for confirmation; test scripts run non-interactively.
const intent = def.intent ?? inferIntentFromHttp(def.method)
if (intent?.destructive === true || intent?.requiresConfirmation === true) {
args.push('--yes')
}

const schemaArgs = def.input != null ? extractSchemaArgs(def.input) : []

const bodyFields = new Set(
Expand Down
26 changes: 26 additions & 0 deletions codegen/functional/test/mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ const testDefs: EsApiDefinition[] = [
description: 'Get cluster info',
method: 'GET',
path: '/'
},
{
name: 'delete',
namespace: 'indices',
description: 'Delete an index',
method: 'DELETE',
path: '/{index}',
input: {
type: 'object',
properties: {
index: { type: 'string', 'x-found-in': 'path' },
},
required: ['index'],
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add another test here that uses destructive: true rather than just trusting the @cli-schema/spec library to get intent right based on HTTP method?

}
]

Expand Down Expand Up @@ -107,4 +121,16 @@ describe('mapAction', () => {
assert.ok(result)
assert.ok(result.cliArgs.includes('--wait-for-active-shards'))
})

it('appends --yes for a DELETE action so non-interactive test runs do not prompt', () => {
const result = mapAction('indices.delete', { index: 'test' }, actionMap)
assert.ok(result)
assert.deepStrictEqual(result.cliArgs, ['stack', 'es', 'indices', 'delete', '--yes', '--index', 'test'])
})

it('does not append --yes for a non-destructive action', () => {
const result = mapAction('indices.create', { index: 'test' }, actionMap)
assert.ok(result)
assert.ok(!result.cliArgs.includes('--yes'))
})
})
Loading
Loading