refactor: remove unused quest-related schemas and consolidate exports

This commit is contained in:
Justin Lin committed 2025-04-21 21:42:54 +08:00
1 parent d2cdd1304a
commit 1d843f7355
29 files changed
+35 -161

No files matched your search

@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
import { Matcher } from './Matcher.js'
export class CommandMatcher implements Matcher {
+2 -2
View File
@@ -1,8 +1,8 @@
import {
ICommand,
IFileExistenceChecker,
IFileInput,
ICondition,
IFileExistenceInput,
} from '../schema'
import { PwdMatcher } from './PwdMatcher.js'
import { CommandMatcher } from './CommandMatcher.js'
@@ -14,7 +14,7 @@ import { NotMatcher } from './NotMatcher.js'
import { checkFiles } from './FileMatcher.js'
export class Condition {
private files: IFileInput[] = []
private files: IFileExistenceInput[] = []
private matchers: Matcher[] = []
constructor({ command, output, error, pwd, or, not, files }: ICondition) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { Matcher } from './Matcher.js'
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
export class ErrorMatcher implements Matcher {
private matcher?: RegExp
+2 -2
View File
@@ -1,8 +1,8 @@
import { FileExistenceInput, IFileExistenceChecker } from '../types'
import { IFileExistenceInput, IFileExistenceChecker } from '../schema'
export async function checkFiles(
checker: IFileExistenceChecker,
files: FileExistenceInput[]
files: IFileExistenceInput[]
) {
const existences = await Promise.all(
files.map((file) => checker.exists(file))
+1 -1
View File
@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
export interface Matcher {
match(command: ICommand): boolean
+1 -1
View File
@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
import { Matcher } from './Matcher.js'
export class NotMatcher implements Matcher {
+1 -1
View File
@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
import { Matcher } from './Matcher.js'
export class OrMatcher implements Matcher {
+1 -1
View File
@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
import { Matcher } from './Matcher.js'
export class OutputMatcher implements Matcher {
+1 -1
View File
@@ -1,4 +1,4 @@
import { ICommand } from '../types.js'
import { ICommand } from '../schema'
import { Matcher } from './Matcher.js'
export class PwdMatcher implements Matcher {
+6
View File
@@ -0,0 +1,6 @@
export * from './schema'
export * from './Quest'
export * from './Session'
export * from './Event'
export * from './Stage'
export * from './Exception'
+5 -5
View File
@@ -1,9 +1,9 @@
export * from './condition.js'
export { stageSchema, IStage } from './stage.js'
export { requirementsSchema, IRequirements } from './requirements.js'
export { responseSchema, IResponse } from './response.js'
export { questSchema, IQuest } from './quest.js'
export { exceptionSchema, IException } from './exception.js'
export * from './stage.js'
export * from './requirements.js'
export * from './response.js'
export * from './quest.js'
export * from './exception.js'
export interface ICommand {
command?: string
+1
View File
@@ -3,6 +3,7 @@ import { z } from 'zod'
export const responseSchema = z.object({
type: z.enum(['narrative', 'dialogue']),
content: z.string(),
hint: z.string().optional(),
})
export type IResponse = z.infer<typeof responseSchema>
View File
Whitespace-only changes.