A.I. Category for Wiki

I know AI is controversial in creative circles, but how would we feel about adding a section to the Wiki specifically dedicated to leveraging AI to help with system/module development?
As a relatively novice developer, I've found AI to be absurdly essential to accelerating the speed at which I learn and improve, and I'm often coming across new ways to benefit from this new technology. Pages within this section might include: - Migrating to Cursor --- Cursor is a free fork of Visual Studio Code that is identical to VSC in every way, except with AI integration in virtually every area, including contextual understanding of your entire project workspace, as well as the ability to train it with new API documentation, such as the Foundry API. - Project Setup --- Using AI to assist in the creation of new projects, creating build processes and workflow tasks, as well as installing necessary dependencies. - Prompt Engineering --- A series of prompt templates developers can use, plug-and-play style, either in Cursor or another LLM (like ChatGPT) to perform specific tasks. I just posted an example of the latter over in the main Foundry server ("AI Pro Tip: Analyze Your package.json!"), which is what gave me this idea in the first place. I'll repost that example in the attached thread so as not to spam the channel too much!
4 Replies
Eunomiac
EunomiacOP•9mo ago
AI Pro Tip: Analyze Your package.json! AI is growing more capable of complex project management tasks by the day; here's the latest way AI was a huge help to me: by analyzing all of the dependencies in my package.json, telling me what they're for, what packages they depend on, and things I need to know before removing that package from my project. All you need to do is: 1. Paste the following prompt into ChatGPT 2. Copy the listed property values from package.json and paste their contents where indicated. 3. Delete any unused properties (e.g. "engines" and "peerDependencies", most likely) 3. Replace the two sets of ''''s with backticks appropriate for defining a code block (I couldn't figure out how to properly escape them in Discord, this was the best I could do!)
Your task is to analyze a `.jsonc` file containing a curated subset of properties from the `package.json` file of a project developing a module or system for the Foundry Virtual Tabletop. For each package listed in `"devDependencies"`, `"dependencies"` or `"peerDependencies"`, generate a concise descriptive block comment directly below the entry within the JSONC file. The aim is to provide clear, brief insights into each package's role in the project, aiding in dependency management and informed decision-making.

Each comment should contain three bullet points:
- A brief description of the package's primary functionality and purpose.
- The package's dependency context: If this package supports or is closely tied to one or more other packages, list those packages in a one-line array. If the package operates independently, state "Standalone".
- e.g., for "stylelint-config-prettier-scss", write "['sass', 'stylelint', 'prettier']"
- e.g., for "stylelint", write "Standalone".
- Special considerations or critical information related to uninstalling this package, including compatibility issues, its role in the project's build or test workflows, or any known conflicts.
- e.g., "Removing this package may lead to unstyled content in older browsers."
Keep each comment concise and informative, aiming for no more than three sentences per bullet point. Conclude each comment block with a blank line.

After completing the package-specific comments, add a separate final analysis section. In this section, address the following:
- Errors or issues: Note any errors or other oversights relating to the listed packages, such as missing dependencies, ill-advised version values, etc.
- Version-specific insights: Note any significant issues or benefits associated with specific versions of the packages.
- Potential alternative packages: Suggest alternatives that could enhance functionality or address known issues.

This final analysis section is not limited by length; be as descriptive as necessary to provide a comprehensive overview.

'''jsonc
{
"engines": /* copied from your package.json */,
"scripts": /* copied from your package.json */,
"devDependencies": /* copied from your package.json */,
"dependencies": /* copied from your package.json */,
"peerDependencies": /* copied from your package.json */,
}
'''
Your task is to analyze a `.jsonc` file containing a curated subset of properties from the `package.json` file of a project developing a module or system for the Foundry Virtual Tabletop. For each package listed in `"devDependencies"`, `"dependencies"` or `"peerDependencies"`, generate a concise descriptive block comment directly below the entry within the JSONC file. The aim is to provide clear, brief insights into each package's role in the project, aiding in dependency management and informed decision-making.

Each comment should contain three bullet points:
- A brief description of the package's primary functionality and purpose.
- The package's dependency context: If this package supports or is closely tied to one or more other packages, list those packages in a one-line array. If the package operates independently, state "Standalone".
- e.g., for "stylelint-config-prettier-scss", write "['sass', 'stylelint', 'prettier']"
- e.g., for "stylelint", write "Standalone".
- Special considerations or critical information related to uninstalling this package, including compatibility issues, its role in the project's build or test workflows, or any known conflicts.
- e.g., "Removing this package may lead to unstyled content in older browsers."
Keep each comment concise and informative, aiming for no more than three sentences per bullet point. Conclude each comment block with a blank line.

After completing the package-specific comments, add a separate final analysis section. In this section, address the following:
- Errors or issues: Note any errors or other oversights relating to the listed packages, such as missing dependencies, ill-advised version values, etc.
- Version-specific insights: Note any significant issues or benefits associated with specific versions of the packages.
- Potential alternative packages: Suggest alternatives that could enhance functionality or address known issues.

This final analysis section is not limited by length; be as descriptive as necessary to provide a comprehensive overview.

'''jsonc
{
"engines": /* copied from your package.json */,
"scripts": /* copied from your package.json */,
"devDependencies": /* copied from your package.json */,
"dependencies": /* copied from your package.json */,
"peerDependencies": /* copied from your package.json */,
}
'''
You'll get a nicely formatted code block with entries that look like:
{
"devDependencies": {
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
// - Provides TypeScript definitions for Foundry VTT's API, enhancing development experience with type checking and IntelliSense.
// - Dependency context: ['typescript'].
// - Critical for TypeScript projects targeting Foundry VTT; removing may lead to type errors and loss of auto-completion.

"@sveltejs/vite-plugin-svelte": "^3.0.2",
// - Integrates Svelte with Vite, enabling fast development and bundling of Svelte applications.
// - Dependency context: ['svelte', 'vite'].
// - Essential for projects using Svelte with Vite; ensures optimal build and hot module replacement.
{
"devDependencies": {
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
// - Provides TypeScript definitions for Foundry VTT's API, enhancing development experience with type checking and IntelliSense.
// - Dependency context: ['typescript'].
// - Critical for TypeScript projects targeting Foundry VTT; removing may lead to type errors and loss of auto-completion.

"@sveltejs/vite-plugin-svelte": "^3.0.2",
// - Integrates Svelte with Vite, enabling fast development and bundling of Svelte applications.
// - Dependency context: ['svelte', 'vite'].
// - Essential for projects using Svelte with Vite; ensures optimal build and hot module replacement.
... and so on, followed by a concluding section containing an overall analysis of your dependencies: This example of the AI's final analysis comes from running the above prompt on my own very cluttered package.json file, which was in the process of migrating from gulp to vite after just pasting in all of the dependencies from the system I was building a module for wholesale 🙂
Final Analysis Errors or Issues - No explicit errors or missing dependencies were identified based on the provided JSONC content. However, the presence of both Gulp and Vite as build tools may indicate redundancy or an ongoing migration between build systems. It's advisable to consolidate to a single build system to simplify the project structure and reduce complexity. Version-Specific Insights - The use of "^" in version numbers ensures that minor updates and patches are automatically included. This is generally a good practice for maintaining up-to-date dependencies, but it can occasionally introduce breaking changes if a package does not follow semantic versioning accurately. Regularly updating and testing dependencies is recommended to mitigate this risk. Potential Alternative Packages - For projects heavily relying on TypeScript, replacing gulp-typescript with direct use of the TypeScript compiler (tsc) or integrating TypeScript compilation into Vite's build process could streamline the build system. - If the project is moving towards a more modern stack with Vite and away from Gulp, consider migrating all Gulp tasks to Vite plugins or npm scripts to centralize the build process and reduce dependency on multiple build systems. - For CSS processing, if there are performance issues or specific needs not met by sass and postcss, exploring alternatives like Less or Stylus might offer benefits. However, this would require evaluating the compatibility and features against the project's requirements. - Given the focus on functional programming patterns indicated by the use of fp-ts and io-ts, projects not already doing so might benefit from exploring additional functional programming libraries like ramda or lodash/fp for more general utility functions that are optimized for functional programming.
Moreover, as with all LLMs, you can continue the conversation after reading the analysis to ask for clarifications or for the AI to expand on specific aspects of its reply, for example, here's my follow-up to the AI's final analysis of my package.json:
You're right, I'm migrating from Gulp to Vite. In addition to the packages you've marked as depending on Gulp and that I can safely uninstall, please list any dependencies that may be there because of their use in Gulp tasks and that may not be necessary unless they are also used by my Vite build process.
... and the AI's reply:
Certainly! If you're fully migrating from Gulp to Vite, here's a refined list of dependencies that might have been used in conjunction with Gulp tasks but could be unnecessary for Vite, depending on how you've set up your new workflow. These are the dependencies you should review carefully to determine their necessity in your Vite setup: 1. autoprefixer: Often used in Gulp via PostCSS for adding vendor prefixes to CSS. Vite can handle this with its PostCSS integration. 2. cssnano: A CSS minifier that might have been part of a Gulp-based PostCSS workflow. Vite also supports CSS minification through PostCSS. 3. postcss: A tool for transforming CSS with JavaScript plugins. While used in Gulp for various CSS processing tasks, Vite supports PostCSS natively in its configuration. 4. sass: While gulp-sass was used for compiling SCSS/Sass files in Gulp, Vite has built-in support for these pre-processors without needing a Gulp plugin. 5. yargs: Used for parsing command-line arguments in Gulp tasks. Vite's configuration and command-line interface might eliminate the need for this package. 6. del: Commonly used in Gulp workflows to clean directories before building. Vite's build process might not require a separate package for cleaning, as it handles output directory management internally. 7. browser-sync or similar packages for live-reloading might have been used alongside or within Gulp tasks. Vite provides its own development server with hot module replacement (HMR), making external live-reload tools unnecessary. For each of these dependencies: - Verify whether they were specifically used in your gulpfile.js for tasks that have now been migrated to Vite. - Check your vite.config.js and other configuration files to see if the functionality provided by these packages is either directly supported by Vite or has been integrated through Vite plugins. - Consider the overall architecture of your project and whether any custom scripts or legacy workflows might still rely on these packages before deciding to remove them.
Pretty good, no? Disclaimer AI is not perfect, especially if you use it with GPT3.5. It will make mistakes, and occasionally hallucinate entire fictional text that sounds as persuasive as the real thing. But in the context of this prompt, hallucinations tend to be relatively easy to spot, so I consider it one of the safer tasks for AI. It's definitely a good starting point if you want to better understand what's going on in your package.json.
CussaMitre
CussaMitre•9mo ago
Just check because training AI using Foundry's API is a violation of the license agreement
No description
Bolts
Bolts•9mo ago
No. Your post on the main discord has been deleted by a moderator, for good reason. Foundry staff has pointed out correctly that training LLMs on the foundry api is a violation of their license. Training LLMs on strong-copyleft code is a violation of those licenses. LLMs can be prompted to replicate code verbatim, but stripped of attribution and license info. LLMs output is harder to debug and often confidently incorrect. I don't know if you're just a rube or are getting cheques to constantly boost this stuff, but stop.
Eunomiac
EunomiacOP•9mo ago
Holy crap, sorry! I literally thought I'd discovered something helpful, and came to share it. And I certainly didn't repost after a previous one had been removed, look at the timestamps --- I thought it might be a useful addition to the Wiki after posting in the other server, and came to post it here (I even said as much in my original post). I realize AI is controversial, but showing such hostility for a well-intentioned, if misguided, attempt to help is not the way to go about things.
Additionally, I misused the word "train" in my original post. If I knew this was such a hot topic I would have been more precise. All I meant was that you can provide it with a link to the Foundry API documentation, and it is equipped with the tools to search it for answers. That's all; no training on actual code, only web searching on publically-available API documentation. Moreover, this particular suggestion had very little to do with Foundry at all --- its focus was on helping to explain the nature of dependencies in a package.json file.
In short, I think you've assumed a hell of a lot about my intentions, and overreacted as a result. But no worries, I promise to never, ever mention AI in here ever again.
Want results from more Discord servers?
Add your server