init workspace

Signed-off-by: Magic <magicoflolis@tuta.io>
This commit is contained in:
Magic 2025-05-24 13:26:54 -07:00
parent feba65e8a9
commit 1800cafee7
No known key found for this signature in database
GPG key ID: 96EF8864366F6092
14 changed files with 1390 additions and 0 deletions

12
.editorconfig Normal file
View file

@ -0,0 +1,12 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
[*.{js,json,ts,tsx}]
charset = utf-8

28
.gitignore vendored Normal file
View file

@ -0,0 +1,28 @@
# ignore haters
haters/
build
node_modules
Notes
.history
web-ext
web-ext-artifacts
web-server
*.ini
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
*.tsbuildinfo
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

9
.vscode/extensions.json vendored Normal file
View file

@ -0,0 +1,9 @@
{
"recommendations": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"usernamehw.errorlens",
"xyz.local-history"
]
}

44
Auto-Cards.code-workspace Normal file
View file

@ -0,0 +1,44 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"search.exclude": {
"**/.vscode/**": true,
"**/build/**": true,
"**/dist/**": true,
"**/node_modules/**": true
},
"explorer.excludeGitIgnore": true,
"eslint.codeActionsOnSave.mode": "problems",
"eslint.run": "onType",
"eslint.validate": [
"javascript",
"typescript"
],
"files.exclude": {
"**/.vscode/**": true,
"**/build/**": true,
"**/dist/**": true,
"**/node_modules/**": true
},
"local-history.daysLimit": 3,
"local-history.maxDisplay": 10,
"local-history.saveDelay": 5,
"local-history.dateLocale": "en-US",
"local-history.exclude": [
"**/.history/**",
"**/.vscode/**",
"**/node_modules/**",
"**/typings/**",
"**/out/**",
"**/Code/User/**",
"**/*.code-workspace",
"**/build/**",
"**/dist/**"
],
"local-history.path": "${workspaceFolder}/.vscode"
}
}

42
eslint.config.js Normal file
View file

@ -0,0 +1,42 @@
// @ts-check
import globals from "globals";
import eslint from "@eslint/js";
import eslintConfigPrettier from "eslint-config-prettier/flat";
import tseslint from "typescript-eslint";
export default tseslint.config([
eslint.configs.recommended,
tseslint.configs.recommended,
eslintConfigPrettier,
{
rules: {
"no-undef": "off",
"no-var": "error",
"no-useless-escape": "off",
"prefer-const": ["error", { destructuring: "all" }],
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
quotes: ["error", "double", { avoidEscape: true, allowTemplateLiterals: false }],
"space-before-blocks": ["error", "always"]
}
},
{
files: ["context.js", "input.js", "library.js", "output.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "script",
globals: globals.es2024
}
},
{
files: ["tools/*.js", "utils/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.es2024,
...globals.node
}
}
}
]);

39
package.json Normal file
View file

@ -0,0 +1,39 @@
{
"name": "auto-cards",
"description": "Auto-Cards is an AI Dungeon script ",
"author": "LewdLeah & contributors",
"version": "1.0.0",
"license": "MIT",
"homepage": "https://github.com/LewdLeah/Auto-Cards",
"bugs": {
"url": "https://github.com/LewdLeah/Auto-Cards/issues"
},
"type": "module",
"scripts": {
"minify": "terser ./src/library.js -c -o library.min.js"
},
"devDependencies": {
"@eslint/js": "^9.27.0",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"globals": "^16.1.0",
"prettier": "^3.5.3",
"terser": "^5.39.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.32.1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/LewdLeah/Auto-Cards.git"
},
"private": true,
"keywords": [
"autocards",
"aidungeon",
"aid"
],
"engines": {
"node": ">=20",
"pnpm": ">=10"
}
}

1110
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

6
prettier.config.js Normal file
View file

@ -0,0 +1,6 @@
export default {
singleQuote: false,
tabWidth: 2,
printWidth: 100,
trailingComma: "none"
};

10
src/context.js Normal file
View file

@ -0,0 +1,10 @@
// Your "Context" tab should look like this
const modifier = (text) => {
//
// Ideally, your other context code goes above this line
[text, stop] = AutoCards("context", text, stop);
// Alternatively, you may also put it below this line
//
return {text, stop};
};
modifier(text);

10
src/input.js Normal file
View file

@ -0,0 +1,10 @@
// Your "Input" tab should look like this
const modifier = (text) => {
//
// Ideally, your other input code goes above this line
text = AutoCards("input", text);
// Alternatively, you may also put it below this line
//
return {text};
};
modifier(text);

5
src/library.js Normal file
View file

@ -0,0 +1,5 @@
/// <reference types="./types/global.d.ts" />
// Your "Library" tab should look like this
// [source code not public yet]
// Estimated release date is May 26, 2025 (but no promises)

10
src/output.js Normal file
View file

@ -0,0 +1,10 @@
// Your "Output" tab should look like this
const modifier = (text) => {
//
// Ideally, your other output code goes above this line
text = AutoCards("output", text);
// Alternatively, you may also put it below this line
//
return {text};
};
modifier(text);

50
src/types/global.d.ts vendored Normal file
View file

@ -0,0 +1,50 @@
/// <reference no-default-lib="true"/>
/// <reference lib="es2022"/>
export interface History {
text: string;
type: "continue" | "say" | "do" | "story" | "see" | "repeat" | "start" | "unknown";
rawText: string;
}
export interface StoryCard {
id: string;
title: string;
keys: string;
type: string;
/**
* This is `value` when exported
*/
entry: string;
description: string;
}
export interface State {
key: string;
memory: Memory;
message: string;
[key: string]: unknown;
}
export interface Memory {
context: string;
authorsNote: string;
}
export interface Info {
actionCount: number;
characters: string[];
[key: string]: unknown;
}
declare global {
let stop: boolean;
let text: unknown;
function AutoCards(): unknown;
function addStoryCard(): unknown;
function removeStoryCard(): unknown;
function log(): void;
const history: History[];
const storyCards: StoryCard[];
const state: State;
const memory: Memory;
const info: Info;
}

15
tsconfig.json Normal file
View file

@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"compilerOptions": {
"strict": true,
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"declaration": true,
"allowSyntheticDefaultImports": true
},
"include": [
"**/*.d.ts"
],
"exclude": ["node_modules"]
}