Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions cli/src/npm-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const execFileAsync = promisify(execFile)
/**
* Validates an npm package name using the official npm validation package
* @throws Error if the name is invalid
* @internal
*/
export function validatePackageName(name: string): void {
const result = v.safeParse(PackageNameSchema, name)
Expand All @@ -26,6 +27,7 @@ export function validatePackageName(name: string): void {
/**
* Validates an npm username
* @throws Error if the username is invalid
* @internal
*/
export function validateUsername(name: string): void {
const result = v.safeParse(UsernameSchema, name)
Expand All @@ -37,6 +39,7 @@ export function validateUsername(name: string): void {
/**
* Validates an npm org name (without the @ prefix)
* @throws Error if the org name is invalid
* @internal
*/
export function validateOrgName(name: string): void {
const result = v.safeParse(OrgNameSchema, name)
Expand All @@ -48,6 +51,7 @@ export function validateOrgName(name: string): void {
/**
* Validates a scope:team format (e.g., @myorg:developers)
* @throws Error if the scope:team is invalid
* @internal
*/
export function validateScopeTeam(scopeTeam: string): void {
const result = v.safeParse(ScopeTeamSchema, scopeTeam)
Expand Down
9 changes: 9 additions & 0 deletions cli/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const PackageNameSchema = v.pipe(
/**
* Validates an npm package name for new packages only
* Stricter than PackageNameSchema - rejects legacy formats (uppercase, etc.)
* @internal
*/
export const NewPackageNameSchema = v.pipe(
v.string(),
Expand Down Expand Up @@ -76,6 +77,7 @@ export const ScopeTeamSchema = v.pipe(

/**
* Validates org roles
* @internal
*/
export const OrgRoleSchema = v.picklist(
['developer', 'admin', 'owner'],
Expand All @@ -84,6 +86,7 @@ export const OrgRoleSchema = v.picklist(

/**
* Validates access permissions
* @internal
*/
export const PermissionSchema = v.picklist(
['read-only', 'read-write'],
Expand All @@ -110,13 +113,15 @@ export const OperationTypeSchema = v.picklist([

/**
* Validates OTP (6-digit code)
* @internal
*/
export const OtpSchema = v.optional(
v.pipe(v.string(), v.regex(/^\d{6}$/, 'OTP must be a 6-digit code')),
)

/**
* Validates a hex token (like session tokens and operation IDs)
* @internal
*/
export const HexTokenSchema = v.pipe(
v.string(),
Expand All @@ -126,6 +131,7 @@ export const HexTokenSchema = v.pipe(

/**
* Validates operation ID (16-char hex)
* @internal
*/
export const OperationIdSchema = v.pipe(
v.string(),
Expand Down Expand Up @@ -176,6 +182,7 @@ export const BatchOperationsBodySchema = v.array(CreateOperationBodySchema)
// Type-specific Operation Params Schemas
// ============================================================================

/** @internal */
export const OrgAddUserParamsSchema = v.object({
org: OrgNameSchema,
user: UsernameSchema,
Expand Down Expand Up @@ -205,6 +212,7 @@ const TeamRemoveUserParamsSchema = v.object({
user: UsernameSchema,
})

/** @internal */
export const AccessGrantParamsSchema = v.object({
permission: PermissionSchema,
scopeTeam: ScopeTeamSchema,
Expand All @@ -226,6 +234,7 @@ const OwnerRemoveParamsSchema = v.object({
pkg: PackageNameSchema,
})

/** @internal */
export const PackageInitParamsSchema = v.object({
name: NewPackageNameSchema,
author: v.optional(UsernameSchema),
Expand Down
37 changes: 18 additions & 19 deletions knip.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"ignore": ["shared/types/lexicons/**"],
"workspaces": {
".": {
"entry": [
"app/app.vue",
"app/error.vue",
"app/pages/**/*.vue",
"app/components/**/*.vue",
"app/composables/**/*.ts",
"app/middleware/**/*.ts",
"app/plugins/**/*.ts",
"app/utils/**/*.ts",
"server/**/*.ts",
"modules/**/*.ts",
"config/**/*.ts",
"app/app.vue!",
"app/error.vue!",
"app/pages/**/*.vue!",
"app/components/**/*.vue!",
"app/composables/**/*.ts!",
"app/middleware/**/*.ts!",
"app/plugins/**/*.ts!",
"app/utils/**/*.ts!",
"server/**/*.ts!",
"modules/**/*.ts!",
"config/**/*.ts!",
"lunaria/**/*.ts!",
"shared/**/*.ts!",
"i18n/**/*.ts",
"lunaria.config.ts",
"pwa-assets.config.ts",
".lighthouserc.cjs",
"lighthouse-setup.cjs",
"uno-preset-rtl.ts",
"scripts/**/*.ts",
"lunaria/**/*.ts",
"shared/**/*.ts"
"uno-preset-rtl.ts!",
"scripts/**/*.ts"
],
"project": ["**/*.{ts,vue,cjs,mjs}"],
"ignoreDependencies": [
"@iconify-json/*",
"@vercel/kv",
"@voidzero-dev/vite-plus-core",
"vite-plus!",
"h3",
"puppeteer",
"unplugin-vue-router",
Expand All @@ -39,12 +39,11 @@
"ignoreUnresolved": ["#components", "#oauth/config"]
},
"cli": {
"project": ["src/**/*.ts"]
"project": ["src/**/*.ts!"]
},
"docs": {
"entry": ["app/**/*.{ts,vue}"],
"project": ["**/*.{ts,vue}"],
"ignoreDependencies": ["docus", "better-sqlite3"]
"ignoreDependencies": ["docus", "better-sqlite3", "nuxt!"]
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"@vue/test-utils": "2.4.6",
"axe-core": "4.11.1",
"fast-npm-meta": "1.0.0",
"knip": "5.82.1",
"knip": "5.83.0",
"lint-staged": "16.2.7",
"playwright-core": "1.58.0",
"schema-dts": "1.1.5",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading