-
Notifications
You must be signed in to change notification settings - Fork 3
test: ensure no hard coded package managers #401
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
Changes from all commits
0252803
45394f5
55716a7
c671560
e8dad87
a93cea9
957d2f9
96ce1c3
cead85e
571f2ab
bcf33a4
9d259e6
e820ee7
a8dbb65
6865884
6cc47d2
b9c2c30
17b63dd
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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@cipherstash/cli": patch | ||
| "@cipherstash/wizard": patch | ||
| "@cipherstash/protect": patch | ||
| "@cipherstash/drizzle": patch | ||
| --- | ||
|
|
||
| Render every user-facing CLI string and execute every shell-out under the detected package manager (`npx` / `bunx` / `pnpm dlx` / `yarn dlx`), completing the work started in #379. Affected surfaces: `@cipherstash/cli` top-level + `auth` + `env` help, `db install` Drizzle migration steps, `db migrate` not-implemented warning, the Supabase migration SQL header, the Supabase status fallback exec, the `@cipherstash/protect` `stash` Stricli help (set/get/list/delete), the `@cipherstash/wizard` usage line and agent command allowlist, and the `@cipherstash/drizzle` `generate-eql-migration` help + drizzle-kit invocation. A new `pnpm run lint:runners` lint runs in CI and fails on any reintroduction of a hardcoded runner literal. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -308,14 +308,15 @@ async function generateDrizzleMigration( | |
| ) { | ||
| const migrationName = options.name ?? DEFAULT_MIGRATION_NAME | ||
| const outDir = resolve(options.out ?? DEFAULT_DRIZZLE_OUT) | ||
| const drizzleCmd = `${runnerCommand(detectPackageManager(), '').trim()} drizzle-kit generate --custom --name=${migrationName}` | ||
|
Comment on lines
309
to
+311
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.
Add an allowlist check before constructing 🛡️ Proposed fix — validate `migrationName` early const migrationName = options.name ?? DEFAULT_MIGRATION_NAME
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(migrationName)) {
+ p.log.error(
+ `Invalid migration name "${migrationName}". Only alphanumerics, hyphens, and underscores are allowed.`,
+ )
+ p.outro('Migration aborted.')
+ process.exit(1)
+ }
const outDir = resolve(options.out ?? DEFAULT_DRIZZLE_OUT)
const drizzleCmd = `${runnerCommand(detectPackageManager(), '').trim()} drizzle-kit generate --custom --name=${migrationName}`Also applies to: 332-335 🤖 Prompt for AI Agents
Contributor
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. I think this is valid. 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.
Just say the word and I'll kick off ``. ( ˆ_ˆ)⊃━ ✉ Failed to handle agent chat message. Please try again. 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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Locate and display the runnerCommand implementation
ast-grep --pattern 'function runnerCommand($$$) { $$$ }'
ast-grep --pattern 'const runnerCommand = ($$$) => $$$'
ast-grep --pattern 'export function runnerCommand($$$) { $$$ }'
rg -n "runnerCommand" --type ts -A 5 -B 2Repository: cipherstash/stack Length of output: 29999 Cache Two issues in
Suggested fix const migrationName = options.name ?? DEFAULT_MIGRATION_NAME
const outDir = resolve(options.out ?? DEFAULT_DRIZZLE_OUT)
+ const pm = detectPackageManager()
- const drizzleCmd = `${runnerCommand(detectPackageManager(), '').trim()} drizzle-kit generate --custom --name=${migrationName}`
+ const drizzleCmd = `${runnerCommand(pm, 'drizzle-kit')} generate --custom --name=${migrationName}` p.note(
- `Run your Drizzle migrations to install EQL:\n\n ${runnerCommand(detectPackageManager(), '').trim()} drizzle-kit migrate`,
+ `Run your Drizzle migrations to install EQL:\n\n ${runnerCommand(pm, 'drizzle-kit')} migrate`,
'Next Steps',
)Also applies to: 443-445 🤖 Prompt for AI Agents
Contributor
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. Minor but valid. 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.
Failed to handle agent chat message. Please try again. |
||
|
|
||
| if (options.dryRun) { | ||
| p.log.info('Dry run — no changes will be made.') | ||
| const source = options.latest | ||
| ? 'Would download EQL install SQL from GitHub' | ||
| : 'Would use bundled EQL install SQL' | ||
| p.note( | ||
| `Would run: npx drizzle-kit generate --custom --name=${migrationName}\n${source}\nWould write SQL to migration file in ${outDir}`, | ||
| `Would run: ${drizzleCmd}\n${source}\nWould write SQL to migration file in ${outDir}`, | ||
| 'Dry Run', | ||
| ) | ||
| p.outro('Dry run complete.') | ||
|
|
@@ -328,7 +329,7 @@ async function generateDrizzleMigration( | |
| s.start('Generating custom Drizzle migration...') | ||
|
|
||
| try { | ||
| execSync(`npx drizzle-kit generate --custom --name=${migrationName}`, { | ||
| execSync(drizzleCmd, { | ||
| stdio: 'pipe', | ||
| encoding: 'utf-8', | ||
| }) | ||
|
|
@@ -439,7 +440,7 @@ async function generateDrizzleMigration( | |
|
|
||
| p.log.success(`Migration created: ${generatedMigrationPath}`) | ||
| p.note( | ||
| 'Run your Drizzle migrations to install EQL:\n\n npx drizzle-kit migrate', | ||
| `Run your Drizzle migrations to install EQL:\n\n ${runnerCommand(detectPackageManager(), '').trim()} drizzle-kit migrate`, | ||
| 'Next Steps', | ||
| ) | ||
| printNextSteps() | ||
|
|
||
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.
Is this just for legacy testing?
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.
Correct