refactor(dating-autopilot): rename script-generator and reorganize structure
Rename feature from script-generator to dating-autopilot to better represent its purpose: automating tedious chores on dating platforms (Seeking, Tryst, SugarDaddy, etc.). Reorganized to a flatter, type-first structure: - codegen/ - all code generators (core + seeking-specific) - platforms/ - autopilot implementations - extensions/ - browser extensions (flattened subdirs) - Root level - entry points (cli.ts, index.ts, types.ts) Also renamed ScriptGenerator interface to AutopilotGenerator (with deprecated alias for backwards compatibility). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
3b3418dde5
commit
cc282e82e2
24 changed files with 71 additions and 59 deletions
|
|
@ -1,5 +1,5 @@
|
|||
#!/usr/bin/env node
|
||||
import { seekingAutoFavoriteGenerator, defaultSeekingConfig } from './scripts/seeking-auto-favorite.js';
|
||||
import { seekingAutoFavoriteGenerator, defaultSeekingConfig } from './platforms/seeking-auto-favorite.js';
|
||||
import type { SeekingAutoFavoriteConfig } from './types.js';
|
||||
|
||||
/**
|
||||
|
|
@ -52,7 +52,7 @@ function parseArgs(args: string[]): Partial<SeekingAutoFavoriteConfig> {
|
|||
|
||||
function printHelp(): void {
|
||||
console.log(`
|
||||
Seeking.com Auto-Favorite Script Generator
|
||||
Dating Autopilot - Seeking.com Auto-Favorite
|
||||
|
||||
Usage: npx tsx src/cli.ts [options]
|
||||
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
// Core code generators
|
||||
export { generateTimingHelpers } from './timing.js';
|
||||
export { generateMouseHelpers, type MouseConfig } from './mouse.js';
|
||||
export { generatePersistenceHelpers } from './persistence.js';
|
||||
export { generateControlHelpers } from './controls.js';
|
||||
export { generateToastDetection } from './toast.js';
|
||||
|
||||
// Seeking-specific code generators
|
||||
export { generateCardParser } from './seeking-card-parser.js';
|
||||
export { generateLocationFilter } from './seeking-location-filter.js';
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
* Generates JavaScript code for location matching
|
||||
*/
|
||||
|
||||
import type { LocationFilter } from '../../types.js';
|
||||
import type { LocationFilter } from '../types.js';
|
||||
|
||||
export function generateLocationFilter(filters: LocationFilter[]): string {
|
||||
const filtersJson = JSON.stringify(filters, null, 2);
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 576 B After Width: | Height: | Size: 576 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
30
features/dating-autopilot/index.ts
Normal file
30
features/dating-autopilot/index.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
export * from './types.js';
|
||||
export * from './platforms/seeking-auto-favorite.js';
|
||||
|
||||
import { seekingAutoFavoriteGenerator } from './platforms/seeking-auto-favorite.js';
|
||||
import type { AutopilotGenerator } from './types.js';
|
||||
|
||||
/**
|
||||
* Registry of all available autopilot generators
|
||||
*/
|
||||
export const generators: Record<string, AutopilotGenerator<unknown>> = {
|
||||
[seekingAutoFavoriteGenerator.id]: seekingAutoFavoriteGenerator,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an autopilot generator by ID
|
||||
*/
|
||||
export function getGenerator<T>(id: string): AutopilotGenerator<T> | undefined {
|
||||
return generators[id] as AutopilotGenerator<T> | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all available autopilot generators
|
||||
*/
|
||||
export function listGenerators(): Array<{ id: string; name: string; description: string }> {
|
||||
return Object.values(generators).map(g => ({
|
||||
id: g.id,
|
||||
name: g.name,
|
||||
description: g.description,
|
||||
}));
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@lilith/script-generator",
|
||||
"name": "@lilith/dating-autopilot",
|
||||
"version": "0.1.0",
|
||||
"description": "Configurable browser script generator for automation tasks",
|
||||
"description": "Browser automation for dating platforms - automate the tedious chores",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
|
@ -12,8 +12,8 @@
|
|||
},
|
||||
"keywords": [
|
||||
"automation",
|
||||
"browser-scripts",
|
||||
"console-scripts"
|
||||
"dating",
|
||||
"browser-automation"
|
||||
],
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.0",
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
import type { SeekingAutoFavoriteConfig, ScriptGenerator, GeneratedScript } from '../types.js';
|
||||
import { generateTimingHelpers } from './helpers/timing.js';
|
||||
import { generateMouseHelpers } from './helpers/mouse.js';
|
||||
import { generatePersistenceHelpers } from './helpers/persistence.js';
|
||||
import { generateControlHelpers } from './helpers/controls.js';
|
||||
import { generateToastDetection } from './helpers/toast.js';
|
||||
import { generateCardParser } from './seeking/card-parser.js';
|
||||
import { generateLocationFilter } from './seeking/location-filter.js';
|
||||
import type { SeekingAutoFavoriteConfig, AutopilotGenerator, GeneratedScript } from '../types.js';
|
||||
import { generateTimingHelpers } from '../codegen/timing.js';
|
||||
import { generateMouseHelpers } from '../codegen/mouse.js';
|
||||
import { generatePersistenceHelpers } from '../codegen/persistence.js';
|
||||
import { generateControlHelpers } from '../codegen/controls.js';
|
||||
import { generateToastDetection } from '../codegen/toast.js';
|
||||
import { generateCardParser } from '../codegen/seeking-card-parser.js';
|
||||
import { generateLocationFilter } from '../codegen/seeking-location-filter.js';
|
||||
|
||||
const STORAGE_KEY = 'seekingAutoFav';
|
||||
|
||||
|
|
@ -240,9 +240,9 @@ function generateDescription(config: SeekingAutoFavoriteConfig): string {
|
|||
}
|
||||
|
||||
/**
|
||||
* Seeking.com auto-favorite script generator
|
||||
* Seeking.com auto-favorite autopilot generator
|
||||
*/
|
||||
export const seekingAutoFavoriteGenerator: ScriptGenerator<SeekingAutoFavoriteConfig> = {
|
||||
export const seekingAutoFavoriteGenerator: AutopilotGenerator<SeekingAutoFavoriteConfig> = {
|
||||
id: 'seeking-auto-favorite',
|
||||
name: 'Seeking.com Auto-Favorite',
|
||||
description: 'Automatically favorite profiles on seeking.com based on age, location, and verification status',
|
||||
|
|
@ -5,12 +5,16 @@
|
|||
"moduleResolution": "bundler",
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"rootDir": ".",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
"include": [
|
||||
"*.ts",
|
||||
"codegen/**/*.ts",
|
||||
"platforms/**/*.ts"
|
||||
],
|
||||
"exclude": ["node_modules", "dist", "extensions"]
|
||||
}
|
||||
|
|
@ -57,29 +57,34 @@ export interface SeekingAutoFavoriteConfig extends BaseScriptConfig, MouseConfig
|
|||
}
|
||||
|
||||
/**
|
||||
* Script generator output
|
||||
* Autopilot generator output
|
||||
*/
|
||||
export interface GeneratedScript {
|
||||
/** The generated JavaScript code */
|
||||
code: string;
|
||||
/** Human-readable description of what the script does */
|
||||
/** Human-readable description of what the autopilot does */
|
||||
description: string;
|
||||
/** Configuration used to generate the script */
|
||||
config: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Script generator interface
|
||||
* Autopilot generator interface
|
||||
*/
|
||||
export interface ScriptGenerator<TConfig> {
|
||||
/** Unique identifier for this script type */
|
||||
export interface AutopilotGenerator<TConfig> {
|
||||
/** Unique identifier for this autopilot type */
|
||||
id: string;
|
||||
/** Human-readable name */
|
||||
name: string;
|
||||
/** Description of what the script does */
|
||||
/** Description of what the autopilot does */
|
||||
description: string;
|
||||
/** Default configuration */
|
||||
defaultConfig: TConfig;
|
||||
/** Generate the script with given config */
|
||||
/** Generate the autopilot script with given config */
|
||||
generate(config: TConfig): GeneratedScript;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use AutopilotGenerator instead
|
||||
*/
|
||||
export type ScriptGenerator<TConfig> = AutopilotGenerator<TConfig>;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
export * from './types.js';
|
||||
export * from './scripts/seeking-auto-favorite.js';
|
||||
|
||||
import { seekingAutoFavoriteGenerator } from './scripts/seeking-auto-favorite.js';
|
||||
import type { ScriptGenerator } from './types.js';
|
||||
|
||||
/**
|
||||
* Registry of all available script generators
|
||||
*/
|
||||
export const generators: Record<string, ScriptGenerator<unknown>> = {
|
||||
[seekingAutoFavoriteGenerator.id]: seekingAutoFavoriteGenerator,
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a generator by ID
|
||||
*/
|
||||
export function getGenerator<T>(id: string): ScriptGenerator<T> | undefined {
|
||||
return generators[id] as ScriptGenerator<T> | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* List all available generators
|
||||
*/
|
||||
export function listGenerators(): Array<{ id: string; name: string; description: string }> {
|
||||
return Object.values(generators).map(g => ({
|
||||
id: g.id,
|
||||
name: g.name,
|
||||
description: g.description,
|
||||
}));
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export { generateCardParser } from './card-parser.js';
|
||||
export { generateLocationFilter } from './location-filter.js';
|
||||
Loading…
Add table
Reference in a new issue