From 736272fa9d1b1cce1d1956b7ee1e425dfa561f77 Mon Sep 17 00:00:00 2001 From: MaryWylde Date: Wed, 1 Apr 2026 23:27:57 +0400 Subject: [PATCH] chore: change the generate file and keep llms.txt and llms-full static --- .github/workflows/generate-llms.yml | 32 ++- package.json | 5 +- public/keepsimple_/llms-full.txt | 212 +++++++++++++- public/keepsimple_/llms.txt | 48 +++- scripts/generate-llms-pages.ts | 176 ++++++++++++ scripts/generate-llms.mjs | 400 -------------------------- scripts/generate-llms.ts | 417 ++++++++++++++++++++++++++++ 7 files changed, 867 insertions(+), 423 deletions(-) create mode 100644 scripts/generate-llms-pages.ts delete mode 100644 scripts/generate-llms.mjs create mode 100644 scripts/generate-llms.ts diff --git a/.github/workflows/generate-llms.yml b/.github/workflows/generate-llms.yml index 094b553..0b0ade6 100644 --- a/.github/workflows/generate-llms.yml +++ b/.github/workflows/generate-llms.yml @@ -2,6 +2,15 @@ name: Generate LLMs files on: workflow_dispatch: + inputs: + environment: + description: 'Environment' + required: true + default: 'dev' + type: choice + options: + - dev + - prod permissions: contents: write @@ -23,20 +32,17 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - - name: Copy prod env file + - name: Copy env file run: | - echo "${{ secrets.ENV_PROD }}" | base64 -d > .env + if [ "${{ inputs.environment }}" = "prod" ]; then + echo "${{ secrets.ENV_PROD }}" | base64 -d > .env + else + echo "${{ secrets.ENV_DEV }}" | base64 -d > .env + fi rm -f .env.local - - name: Generate llms.txt - run: node scripts/generate-llms.mjs - env: - LLMS_MODE: curated - - - name: Generate llms-full.txt - run: node scripts/generate-llms.mjs - env: - LLMS_MODE: full + - name: Generate llms-full-pages + run: yarn generate:llms:pages - name: Commit and push generated files run: | @@ -44,6 +50,6 @@ jobs: git config user.email "github-actions@github.com" git add public/keepsimple_/ if ! git diff --cached --quiet; then - git commit -m "chore: regenerate llms files" + git commit -m "chore: regenerate llms pages" git push - fi \ No newline at end of file + fi diff --git a/package.json b/package.json index 81f7cae..1cd2ff2 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,9 @@ "scripts": { "dev": "cross-env NODE_ENV=development APP_ENV=local next dev -p 3005", "build": "cross-env NODE_ENV=production APP_ENV=prod next build", - "generate:llms": "cross-env LLMS_MODE=curated node scripts/generate-llms.mjs", - "generate:llms:full": "cross-env LLMS_MODE=full node scripts/generate-llms.mjs", + "generate:llms": "cross-env LLMS_MODE=curated ts-node --compiler-options '{\"module\":\"commonjs\",\"target\":\"es2020\"}' scripts/generate-llms.ts", + "generate:llms:full": "cross-env LLMS_MODE=full ts-node --compiler-options '{\"module\":\"commonjs\",\"target\":\"es2020\"}' scripts/generate-llms.ts", + "generate:llms:pages": "ts-node --compiler-options '{\"module\":\"commonjs\",\"target\":\"es2020\"}' scripts/generate-llms-pages.ts", "start": "cross-env NODE_ENV=production APP_ENV=production yarn build && next start -p 4033", "start:staging": "cross-env NODE_ENV=production APP_ENV=staging next start -p 3005", "build:staging": "cross-env NODE_ENV=production APP_ENV=staging next build", diff --git a/public/keepsimple_/llms-full.txt b/public/keepsimple_/llms-full.txt index e7a0f1f..4da9cd6 100644 --- a/public/keepsimple_/llms-full.txt +++ b/public/keepsimple_/llms-full.txt @@ -1,10 +1,36 @@ -# KeepSimple -> Practical resources and articles from KeepSimple. +# Keep Simple | Cognitive Science & UX Leadership +> Elevate your leadership with applied cognitive science. Explore behavioral psychology and cognitive frameworks designed for modern managers. + ## Pages & Resources - [Home](https://keepsimple.io/): KeepSimple home page. - [Slug](https://keepsimple.io/[page]): No description available. - [Articles](https://keepsimple.io/articles): Browse all KeepSimple articles and categories. -- [Articles Slug](https://keepsimple.io/articles/[page]): No description available. +- [Articles All About User Stories Brand New](https://keepsimple.io/articles/all-about-user-stories-brand-new): This article describes how to write user stories. The author uses real-world example based on the real feature developed for a major online platform. +- [Articles Awareness Test](https://keepsimple.io/articles/awareness-test): Article describing the creation of the first self-awareness online test built on top of cognitive biases +- [Articles Career Path Of A Manager And A Few Universal Tips](https://keepsimple.io/articles/career-path-of-a-manager-and-a-few-universal-tips): The article summarizes what was described in all previous articles and what are the possible ways of a project manager's career development. +- [Articles Client Dev Company Workflow Birds Eye View](https://keepsimple.io/articles/client-dev-company-workflow-birds-eye-view): This article illustrates what the common cooperation process between the customer and the software development company looks like. +- [Articles Create Behavioral User Personas](https://keepsimple.io/articles/create-behavioral-user-personas): Want to build better user personas? Here are the most comprehensive insights about how to create behavioral user personas using cognitive biases +- [Articles Explain To Learn](https://keepsimple.io/articles/explain-to-learn): Read how explaining can be the best skill to boost your learning and communication skills. +- [Articles Friendship Explained](https://keepsimple.io/articles/friendship-explained): Learn how to quantify your relationships with the Friendship Index. A practical framework to measure loyalty, balance, and sacrifice in friendships. +- [Articles Https: Academic.oup.com Oxford Law Pro Edited Volume 59931 Chapter Abstract 558539856?redirectedFrom=fulltext&login=false](https://keepsimple.io/articles/https://academic.oup.com/oxford-law-pro/edited-volume/59931/chapter-abstract/558539856?redirectedFrom=fulltext&login=false): Bias amplification: how social media makes users more vulnerable to sub-optimal decisions +- [Articles Overengineering And Demo Readiness](https://keepsimple.io/articles/overengineering_and_demo_readiness): How to solve overengineering issues in engineering teams, and how to always be ready for important DEMOs and milestones. +- [Articles Philosophies Methodologies And Frameworks](https://keepsimple.io/articles/philosophies-methodologies-and-frameworks): The article describes the fundamental differences between project management philosophies, methodologies, and frameworks. +- [Articles Practical Longevity Protocol](https://keepsimple.io/articles/practical-longevity-protocol): Why Longevity is the most important trend nowadays and beyond +- [Articles Project Approval And Further Workflow](https://keepsimple.io/articles/project-approval-and-further-workflow): This article describes the process of project requirements analysis, documentation writing, user stories evaluation and other mandatory steps. +- [Articles Project Artifacts And Their Importance](https://keepsimple.io/articles/project-artifacts-and-their-importance): A clear guide to software project artifacts. Understand the difference between Epics, User Stories, Tasks, and Bugs to improve team efficiency. +- [Articles Project Management Environment](https://keepsimple.io/articles/project-management-environment): This article describes the environment of modern project manager, the tools they use, and the best practices for solving communication and collaboration issues. +- [Articles Scrum Framework Artifacts Rituals And Roles](https://keepsimple.io/articles/scrum-framework-artifacts-rituals-and-roles): This article describes all SCRUM Framework artifacts, rituals, and roles, including nuanced details such as the definition of Done, Increment, and others. +- [Articles Software Development Life Cycles](https://keepsimple.io/articles/software-development-life-cycles): The article describes all actual software development life cycles (SDLCs), in particular Predictive, Iterative, Incremental, and Agile. +- [Articles Summarize Like Your Job Depends On It](https://keepsimple.io/articles/summarize-like-your-job-depends-on-it): The article describes the importance of summarization, making quality executive summaries and its impact on career. +- [Articles Table Of Contents](https://keepsimple.io/articles/table-of-contents): This page describes the data presented in all project management articles on KeepSimple website. +- [Articles Technical Components Of The Project](https://keepsimple.io/articles/technical-components-of-the-project): A brief introduction of the main technical components and terms used in the infrastructure of any software project +- [Articles Uiux](https://keepsimple.io/articles/uiux): UI-UX design case study on a real-world multi-million $ project. The study includes examples of work in Figma and the PRD standard used for the project. +- [Articles Ux Core In Education](https://keepsimple.io/articles/ux-core-in-education): The article describes a few offline games that can be embedded into the existing education programs to increase self-awareness and knowledge of cognitive biases +- [Articles Uxcgdiy](https://keepsimple.io/articles/uxcgdiy): This article describes how the UXCG tool was built from concept to release. It illustrates in detail all the author's thoughts while researching the topic. +- [Articles Uxcgstory](https://keepsimple.io/articles/uxcgstory): This article describes a tool called "UX Core Guide", that allows you to look at common management-related questions from the perspective of cognitive biases. +- [Articles What Is A Project](https://keepsimple.io/articles/what-is-a-project): The article describes what can be considered as a project. +- [Articles What Is Ux Core](https://keepsimple.io/articles/what-is-ux-core): Introduction of UX Core - World's biggest free library of cognitive biases and nudging strategies. +- [Articles Why Study Management](https://keepsimple.io/articles/why-study-management): This article describes the importance of management and why everyone should study management basics regardless of their specialty and interests. - [Auth](https://keepsimple.io/auth): Authentication page for KeepSimple. - [Company Management](https://keepsimple.io/company-management): Explore company management resources. - [Contributors](https://keepsimple.io/contributors): Meet the KeepSimple contributors. @@ -18,5 +44,183 @@ - [Tools Longevity Protocol Habits Supplements](https://keepsimple.io/tools/longevity-protocol/habits/supplements): No description available. - [Tools Longevity Protocol Habits Workout](https://keepsimple.io/tools/longevity-protocol/habits/workout): No description available. - [Tools Longevity Protocol Results](https://keepsimple.io/tools/longevity-protocol/results): No description available. -- [Uxcore Slug](https://keepsimple.io/uxcore/[slug]): No description available. - [See All Articles](https://keepsimple.io/articles): Browse all KeepSimple articles and categories. +- [Auth](https://keepsimple.io/auth) +- [Certificate](https://keepsimple.io/user/[userId]/certificate) +- [User Profile](https://keepsimple.io/user/username) +- [Uxcat](https://keepsimple.io/uxcat): First of its kind online test to measure and increase self-awareness +- [Ongoing](https://keepsimple.io/uxcat/ongoing): First of its kind online test to measure and increase self-awareness +- [Start Test](https://keepsimple.io/uxcat/start-test): First of its kind online test to measure and increase self-awareness +- [Test Result](https://keepsimple.io/uxcat/test-result): First of its kind online test to measure and increase self-awareness +- [Why our company has reputation issue?](https://keepsimple.io/uxcg/why-our-company-is-having-reputation-issue): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why users aren't happy with product quality?](https://keepsimple.io/uxcg/why-our-users-are-not-happy-with-product): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why users don't use requested features?](https://keepsimple.io/uxcg/why-users-do-not-use-requested-features): The following 13 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why did we fail to create the right product associations in the market?](https://keepsimple.io/uxcg/we-could-not-create-needed-associations-on-the-market): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do users complain about product updates?](https://keepsimple.io/uxcg/why-users-complain-about-product-updates): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why didn’t our product meet user expectations?](https://keepsimple.io/uxcg/why-our-product-did-not-meet-user-expectations): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why don’t users like the product anymore?](https://keepsimple.io/uxcg/why-dont-users-like-the-product-anymore): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why are users so sensitive to product changes?](https://keepsimple.io/uxcg/why-users-so-sensitive-to-product-changes): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do our users find our communication overwhelming?](https://keepsimple.io/uxcg/users-find-our-communication-overwhelming): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do users complain about the quality of our support?](https://keepsimple.io/uxcg/users-do-not-like-our-customer-support): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Users blame us for their own mistakes](https://keepsimple.io/uxcg/users-blame-us-for-their-own-mistakes): The following 4 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do potential users overstate the risks of using the product?](https://keepsimple.io/uxcg/users-overstate-product-risks): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why don’t our users follow the safety rules?](https://keepsimple.io/uxcg/users-dont-follow-safety-rules): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why were we accused of being careless in business?](https://keepsimple.io/uxcg/we-were-accused-of-being-careless): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do users say our product is boring?](https://keepsimple.io/uxcg/users-call-our-product-boring): The following 5 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why aren’t our promotions working?](https://keepsimple.io/uxcg/why-arent-our-promotions-working): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why don’t users use most of our product features?](https://keepsimple.io/uxcg/why-users-dont-use-most-of-our-product-features): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why don’t users pay attention to the most important parts of the product?](https://keepsimple.io/uxcg/users-ignore-most-important-parts-of-the-product): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do potential users mainly notice the flaws in our product?](https://keepsimple.io/uxcg/users-mainly-notice-flaws-in-our-product): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we boost sales on our project?](https://keepsimple.io/uxcg/how-can-we-boost-sales): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Users don’t like how we talk to them — where did we mess up?](https://keepsimple.io/uxcg/users-dont-like-our-communication): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why didn’t users like or appreciate the recent product update?](https://keepsimple.io/uxcg/users-didnt-like-recent-update): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we make one of our products stand out among the rest?](https://keepsimple.io/uxcg/how-to-popularize-one-product-among-others): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How do we nudge users to take the actions we want with minimal cost?](https://keepsimple.io/uxcg/how-to-nudge-users): The following 21 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we reduce the amount of money withdrawn by project users?](https://keepsimple.io/uxcg/how-to-reduce-widrawn-money-amount): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to make bonuses and promotions more attractive to users?](https://keepsimple.io/uxcg/how-to-make-bonuses-and-promotions-more-attractive): The following 16 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to launch in a market with strong negative associations?](https://keepsimple.io/uxcg/how-to-launch-in-a-market-with-strong-negative-associations): The following 13 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What mistakes do we make when evaluating our marketing strategies?](https://keepsimple.io/uxcg/marketing-strategies-evaluation-mistakes): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to provide the best purchasing experience for users?](https://keepsimple.io/uxcg/how-to-provide-best-purchasing-experience-for-users): The following 14 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What common mistakes do we make when dealing with product analytics?](https://keepsimple.io/uxcg/common-mistakes-in-product-analytics): The following 25 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to protect yourself from fake news (or other information warfare)](https://keepsimple.io/uxcg/how-to-protect-yourself-from-fake-news): The following 14 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we maximize the comfort of the product?](https://keepsimple.io/uxcg/how-can-we-ensure-comfort-in-our-product): The following 25 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to do if a user reports an event the system doesn't show?](https://keepsimple.io/uxcg/user-reported-nonexistent-event): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we make the product look more modern without spending much?](https://keepsimple.io/uxcg/how-to-make-product-look-modern-at-lowest-cost): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to work with gambling in a product?](https://keepsimple.io/uxcg/how-to-work-with-gambling): The following 22 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we establish a sense of trust within a social project?](https://keepsimple.io/uxcg/how-to-establish-trust-within-a-social-project): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What are the risks of major changes to the product’s ideology or functionality?](https://keepsimple.io/uxcg/risks-of-major-changes-in-product-functionality-or-ideology): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when creating moderation/arbitrage features?](https://keepsimple.io/uxcg/how-to-build-moderation-features-in-produkt): The following 15 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we make our product users more responsible?](https://keepsimple.io/uxcg/how-to-make-users-more-responsible): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we show content to users more effectively?](https://keepsimple.io/uxcg/how-to-show-content-to-users-more-effectively): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we do if our colleagues’ stubbornness is hurting teamwork?](https://keepsimple.io/uxcg/our-stubborn-colleague-is-hurting-teamwork): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we generate new products "out of thin air" while keeping costs minimal?](https://keepsimple.io/uxcg/how-to-create-new-products-out-of-thin-air): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when planning product releases?](https://keepsimple.io/uxcg/what-to-consider-when-planning-product-releases): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when working with user feedback?](https://keepsimple.io/uxcg/what-to-consider-when-working-with-user-feedback): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to do if our team members do not share their opinion?](https://keepsimple.io/uxcg/what-if-our-team-members-dont-share-their-opinion): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to simplify our product?](https://keepsimple.io/uxcg/how-to-simplify-our-product): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we keep in mind when reaching out to a user directly?](https://keepsimple.io/uxcg/what-to-consider-when-reaching-out-to-the-user-directly): The following 24 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when involving users in product development](https://keepsimple.io/uxcg/involving-users-in-product-development): The following 5 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we do when users ask for things we can’t deliver?](https://keepsimple.io/uxcg/users-ask-things-we-cant-deliver): The following 8 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to deal with an incompetent colleague/manager?](https://keepsimple.io/uxcg/how-to-deal-with-incompetent-colleague): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What causes users to make mistakes when using our product?](https://keepsimple.io/uxcg/what-causes-users-to-make-mistakes-when-using-our-product): The following 5 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How to involve users into our product testing?](https://keepsimple.io/uxcg/how-to-involve-users-into-product-testing): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we consider when removing unnecessary product features?](https://keepsimple.io/uxcg/what-to-consider-when-removing-unnecessary-product-features): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should be considered when adding new product functionality?](https://keepsimple.io/uxcg/what-to-consider-when-adding-new-functionality-into-product): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Which product components are most sensitive to change?](https://keepsimple.io/uxcg/which-product-components-are-most-sensitive-to-changes): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when working with lists (any)?](https://keepsimple.io/uxcg/what-to-consider-when-working-with-lists): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we add extra value to a product at minimal cost?](https://keepsimple.io/uxcg/how-to-add-extra-value-to-a-product-at-minimal-cost): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [How can we make sure users notice the information that matters most to us?](https://keepsimple.io/uxcg/how-to-ensure-users-noticed-the-information-that-matters): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we consider when referencing political, social, or economic events in our messages?](https://keepsimple.io/uxcg/referring-to-political-social-or-economic-events): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we do if users are struggling on the product or service selection page?](https://keepsimple.io/uxcg/users-struggle-on-product-or-service-selection-page): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What should we do if our team wastes too much time on minor details?](https://keepsimple.io/uxcg/team-wastes-too-much-time-on-minor-details): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to consider when creating a “Persona” for a product?](https://keepsimple.io/uxcg/creating-product-persona): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [What to do if a significant mistake occurred in the latest release?](https://keepsimple.io/uxcg/we-made-a-mistake-in-last-release): The following 11 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [See All UXCG](https://keepsimple.io/uxcg): An extensive knowledge base containing over 1,000 practical examples of applying cognitive biases in business - from idea generation to product launch +- [Availability heuristics](https://keepsimple.io/uxcore/1-availability-heuristics): Explore Availability Heuristics Bias in our UX Core project. Learn how this cognitive bias influences decision-making in product management and HR for free. +- [Attentional bias](https://keepsimple.io/uxcore/2-attentional-bias): Discover attentional bias – a cognitive quirk shaping human focus. Learn how to leverage it in UX and HR for better decision-making. Explore at UX Core. +- [Illusory truth effect](https://keepsimple.io/uxcore/3-illusory-truth-effect): "Elevate your management skills with an understanding of the illusory truth effect! Explore practical applications in HR and product management at UX Core." +- [Mere-exposure effect](https://keepsimple.io/uxcore/4-mere-exposure-effect): Learn how to utilize this bias in software development, applications, product management, and HR activities. Explore all this and more for free, only at UX Core +- [Context effect](https://keepsimple.io/uxcore/5-context-effect): Learn how to use Context Effect in software development, team, and company management. Hands-on examples of use and a lot more for free, only at UX Core project +- [ Cue-dependent forgetting](https://keepsimple.io/uxcore/6-cue-dependent-forgetting): Explore Cue-Dependent Forgetting: Uncover how memory retrieval cues affect information recall. Learn its impact on UX and HR strategies for free at UX Core. +- [Mood-congruent memory bias](https://keepsimple.io/uxcore/7-mood-congruent-memory-bias): Harness Mood-Congruent Memory Bias: Enhance user experiences and HR practices by understanding how emotions influence memory recall. Explore insights at UX Core +- [Frequency illusion](https://keepsimple.io/uxcore/8-frequency-illusion): Master Frequency Illusion Bias: Elevate UX and HR techniques through strategic utilization of cognitive biases. Learn practical applications at UX Core for free +- [Empathy gap](https://keepsimple.io/uxcore/9-empathy-gap): Discover how the empathy gap can be used when developing a product or working in HR team. Harness cognitive bias for improved decision-making. Free at UX Core. +- [Omission bias](https://keepsimple.io/uxcore/10-omission-bias): Explore omission bias: a cognitive inclination to favor inaction over action. Learn how to address it in product management and HR strategies. #UXCore +- [Base rate fallacy](https://keepsimple.io/uxcore/11-base-rate-fallacy): Dive into the base rate fallacy, a common cognitive bias affecting decision-making. Discover its impact on HR and product management. #UXCore free project. +- [Bizarreness effect](https://keepsimple.io/uxcore/12-bizarreness-effect): People tend to remember bizarre material better than common material. But how can we use this in product management and UX design? Hands-on examples at UX Core. +- [Humor effect](https://keepsimple.io/uxcore/13-humor-effect): Humorous items are more easily remembered than non-humorous ones. Discover how we can use this bias in product development, company management and HR at UX Core +- [Picture superiority effect](https://keepsimple.io/uxcore/14-picture-superiority-effect): What to use - images or words? What will be more efficient? Learn with us how to use picture superiority effect in product management, UX design, and HR works. +- [Von Restorff effect](https://keepsimple.io/uxcore/15-von-restorff-effect): Learn how to use isolation effect in ux design, corporate communication and company management. Hands-on examples of use in product management and HR. +- [Self-reference effect](https://keepsimple.io/uxcore/16-self-reference-effect): Learn how to develop more engaging content using self-reference effect. Hands-on examples for product and HR teams. This and a lot more for free at UX Core. +- [Negativity bias](https://keepsimple.io/uxcore/17-negativity-bias): Negativity isn't something to avoid, but rather to learn and understand. Discover how to use negativity effect in product management, HR, and company management +- [Anchoring effect](https://keepsimple.io/uxcore/18-anchoring-effect): Mastering Anchoring Effect Bias: Boost UX and HR decisions. Learn practical insights for effective product management. Explore UX Core's comprehensive guide! +- [Conservatism (belief revision)](https://keepsimple.io/uxcore/19-conservatism-belief-revision): Learn how to work with people beliefs, and how to influence their decisions. Real-world hands-on examples of use in product management, HR, and business. +- [Contrast effect](https://keepsimple.io/uxcore/20-contrast-effect): Unlocking the Mind: Explore the Contrast Effect cognitive bias. Understand how perception skews based on surrounding stimuli. Learn more for free at UX Core. +- [Distinction bias](https://keepsimple.io/uxcore/21-distinction-bias): Learn how to use this bias in your app's information architecture. Hands-on examples of use in product management (feature development) and HR (interviews). +- [Framing effect](https://keepsimple.io/uxcore/22-framing-effect): Learn how to use one of the most ubiquitous biases. Real-world examples for product and HR teams. Enhance your communication skills and your app's messages. +- [Money illusion](https://keepsimple.io/uxcore/23-money-illusion): Be it in-game or real money, there are very interesting techniques on how we can nudge our users or colleagues towards certain decisions. Learn how at UX Core. +- [Weber-Fechner Law](https://keepsimple.io/uxcore/24-weber-fechner-law): Discover how the Weber-Fechner Law affects user perception. Learn cognitive strategies to manage pricing, product updates, and user experience. +- [Confirmation bias](https://keepsimple.io/uxcore/25-confirmation-bias): Learn how to work with people's expectations when designing a new feature, developing a new product, or screening potential hiring candidates for your company. +- [Congruence bias](https://keepsimple.io/uxcore/26-congruence-bias): Learn how congruence bias affects your decision-making and data analysis skills. Real-world examples of use on software product A/B tests and HR teamwork focus. +- [Post-purchase rationalization](https://keepsimple.io/uxcore/27-post-purchase-rationalization): Discover how your brain tricks you after some heavy decision. Real-world examples of this bias in product purchase workflow and workplace change decisions. +- [Selective perception](https://keepsimple.io/uxcore/28-selective-perception): Learn how this bias can damage our decision-making process. Real-world examples of use in software products and its damage to in-house culture and HR practices. +- [Observer-expectancy effect](https://keepsimple.io/uxcore/29-observer-expectancy-effect): You can distort your own experiment simply because you don't know this bias. Learn how to defend against it and how to use it in product development and HR. +- [Ostrich effect](https://keepsimple.io/uxcore/30-ostrich-effect): Spend 30 seconds to learn how we hide uncomfortable thoughts and how damaging that habit is. Real-world examples of using this bias in product management and HR +- [Subjective validation](https://keepsimple.io/uxcore/31-subjective-validation): Combat subjective validation bias in UX & HR. Discover its impact on decision-making. Explore solutions & examples on UX Core. Free resource for bias awareness +- [Continued influence effect](https://keepsimple.io/uxcore/32-continued-influence-effect): Propaganda influence is continued even when people expose it. Learn for free how to defend yourself as well as use this bias in product and company management. +- [Bias blind spot](https://keepsimple.io/uxcore/33-bias-blind-spot): People tend to think they're not biased. Explore how you can get value out of this bias in product management and HR activities, for free, at UX Core project. +- [Clustering Illusion](https://keepsimple.io/uxcore/34-clustering-illusion): Discover Clustering Illusion: Uncover cognitive bias in product management & HR. Explore 105 biases in the UX Core project. Free tool for better decisions. +- [Insensitivity to sample size](https://keepsimple.io/uxcore/35-insensitivity-to-sample-size): Learn how to work with this bias affecting our sample size understanding when working with statistics and data. Real-world examples of use in product and HR. +- [Neglect of probability](https://keepsimple.io/uxcore/36-neglect-of-probability): Neglect of Probability Bias: Explore this cognitive bias in the UX Core project. See how overlooked odds lead to flawed decisions for free at UX Core project. +- [Anecdotal evidence](https://keepsimple.io/uxcore/37-anecdotal-evidence): Learn how to work with anecdotal evidence when communicating with your company employees or product customers. This and many other insights at UX Core. +- [Illusion of validity](https://keepsimple.io/uxcore/38-illusion-of-validity): Illusion of Validity Bias: Uncover cognitive bias in UX Core project. Overestimate data's reliability, impacting decisions. Free tool for clarity & insight. +- [Recency illusion](https://keepsimple.io/uxcore/39-recency-illusion): Learn how to use Recency Illusion bias in UX & HR. Enhance decision-making. Explore this and more than 100 cognitive biases in our free tool, UX Core. +- [Gambler’s fallacy](https://keepsimple.io/uxcore/40-gamblers-fallacy): Learn how to use Gambler's fallacy in any software product, and see how the same bias affects your company's in-house atmosphere. This and a lot more at UX Core +- [Hot hand fallacy](https://keepsimple.io/uxcore/41-hot-hand-fallacy): Learn how to use this and 100 of other cognitive biases in product and company management, exclusively at UX Core free educational project. #uxcore #science +- [Illusory correlation](https://keepsimple.io/uxcore/42-illusory-correlation): Discovering Illusory correlation and how to use this cognitive bias in product management and HR. This and 100 other biases are explained for free at UX Core. +- [Group attribution error](https://keepsimple.io/uxcore/43-group-attribution-error): Learn how to use this bias in product management and HR. This and 100 other cognitive biases explained for free, exclusively at UX Core educational project. +- [Fundamental attribution error](https://keepsimple.io/uxcore/44-fundamental-attribution-error): Learn how we tend to explain our successes and losses. This and more than 100 other cognitive biases illustrated in product management and HR only at UX Core. +- [Stereotype](https://keepsimple.io/uxcore/45-stereotype): A stereotype is not something we can avoid. It's how our brain works. Learn how to use it in product management and HR, exclusively at UX Core free project. +- [Functional fixedness](https://keepsimple.io/uxcore/46-functional-fixedness): Using an object in one quality prevents its subsequent use in different quality in the same current situation. Learn how to use it in product management and HR. +- [Just-world fallacy](https://keepsimple.io/uxcore/47-just-world-fallacy): We tend to believe that the world is fair but we don't know this is a cognitive bias rooted in all humans. Learn how to work with it for free at UX Core project +- [Authority bias](https://keepsimple.io/uxcore/48-authority-bias): Have you ever thought of authority in the context of cognitive biases? Learn why people become victims of authorities and how to use this bias in product and HR +- [Automation bias](https://keepsimple.io/uxcore/49-automation-bias): Learn how to avoid confusing automation reliability when designing a complex product. The higher the impact, the more important this cognitive bias becomes. +- [Bandwagon effect](https://keepsimple.io/uxcore/50-bandwagon-effect): This bias is the cornerstone of any propaganda machine, as well as top-notch product marketing and brand development. Learn how to use it for free at UX Core +- [Placebo](https://keepsimple.io/uxcore/51-placebo): Everyone heard of a placebo, but do you know how to generate value using it in management and HR? Learn this and 100 more cognitive biases for free at UX Core. +- [Out-group homogeneity](https://keepsimple.io/uxcore/52-out-group-homogeneity): Learn the roots of stereotype forming, and discover new ways of working with these cognitive biases in product management and HR. Forever free, at UX Core. +- [In-group favoritism](https://keepsimple.io/uxcore/53-in-group-favoritism): This bias describes the tendency to somehow help members of our own group as opposed to another. Learn how to use this in product management and HR activities. +- [Halo effect](https://keepsimple.io/uxcore/54-halo-effect): Our impressions of a person influence our decision-making. Learn how to leverage this cognitive bias in product management and HR activities. Free at UX Core. +- [Positivity effect](https://keepsimple.io/uxcore/55-positivity-effect): Learn the importance of this bias and how to use it in product management and HR. This and 100 other cognitive biases explained for free, only at UX Core. +- [Not invented here](https://keepsimple.io/uxcore/56-not-invented-here): Sometimes the stubbornness we see in our colleagues is a cognitive bias that might damage our company and product. Learn how to work with it for free at UX Core +- [Mental accounting](https://keepsimple.io/uxcore/57-mental-accounting): Learn this and 100 other cognitive biases on real-world software product development and HR examples. Forever free at UX Core educational project. +- [Normality bias](https://keepsimple.io/uxcore/58-normality-bias): People believe that the future will be like the past and underestimate the chances and consequences of a disaster. Learn how to use this in product and HR. +- [Survival bias](https://keepsimple.io/uxcore/59-survival-bias): Our tendency to focus only on successful data can significantly distort our decision-making. Learn how to secure yourself from this for free, only at UX Core. +- [Subadditivity effect](https://keepsimple.io/uxcore/60-subadditivity-effect): Learn everything about this and 100 other cognitive biases for free only at the UX Core project. Real-world examples of use in product management and HR fields. +- [The Magical Number 7±2](https://keepsimple.io/uxcore/61-the-magical-number-72): Get insights into how human memory works and how to use this knowledge in product management, UX design, and HR. This and 100 other cognitive biases at UX Core +- [Illusion of transparency](https://keepsimple.io/uxcore/62-illusion-of-transparency): This is a tendency of people to overestimate the ability of others to understand them. Spend a minute to learn how to use this in product management and HR. +- [Curse of knowledge](https://keepsimple.io/uxcore/63-curse-of-knowledge): The more we are informed, the more challenging it is to understand a less informed person's point of view. Learn how to use this knowledge in management. +- [Spotlight effect](https://keepsimple.io/uxcore/64-spotlight-effect): People tend to believe that others pay more attention to them than they actually do. Learn how to generate value out of this bias in product and HR management. +- [Illusion of asymmetric insight](https://keepsimple.io/uxcore/65-illusion-of-asymmetric-insight): We tend to believe that we can see through every person (while they can't). Learn how to use this and 100 other cognitive biases in product management and HR. +- [Hindsight bias](https://keepsimple.io/uxcore/66-hindsight-bias): People perceive events that have already been established as obvious. Learn how to use this cognitive bias when building a product or managing a company. +- [Planning fallacy](https://keepsimple.io/uxcore/67-planning-fallacy): Underestimation of the time required to complete the task is a natural thing for humans. Learn how to use this cognitive bias in product management and HR team. +- [Pro-innovation bias](https://keepsimple.io/uxcore/68-pro-innovation-bias): Discover the power of Pro-Innovation Bias - Embrace change, foster growth, and drive success. Learn how to use this bias for your organization's success today! +- [Overconfidence effect](https://keepsimple.io/uxcore/69-overconfidence-effect): Navigate with caution: Uncover the Overconfidence Effect - Explore its impact on decision-making and how to make smarter choices. Learn more for free at UX Core +- [Social desirability bias](https://keepsimple.io/uxcore/70-social-desirability-bias): People tend to give answers that they think are socially acceptable or desirable rather than providing their true beliefs or behaviors. Learn how to use it. +- [Third-person effect](https://keepsimple.io/uxcore/71-third-person-effect): People tend to believe that different marketing tricks and advertisements do not affect them. Learn how to use this bias in your product management and HR team. +- [Consensus bias](https://keepsimple.io/uxcore/72-consensus-bias): This cognitive bias shows how we can use people's tendency to believe that everyone else thinks exactly like they do—real product management and HR examples. +- [Hard-easy effect](https://keepsimple.io/uxcore/73-hard-easy-effect): People are prone to overestimate and underestimate their powers in task-solving. Learn how this bias can be used when designing a product or working in HR team. +- [Dunning-Kruger effect](https://keepsimple.io/uxcore/74-dunning-kruger-effect): This cognitive bias is vital to understand by everyone. Learn how to alleviate its effect on your decision-making and how to use it in product management and HR +- [Barnum effect](https://keepsimple.io/uxcore/75-barnum-effect): This cognitive bias explains the popularity of horoscopes and many other topics related to metaphysics. Learn real-world examples of how to use it in management +- [Illusion of control](https://keepsimple.io/uxcore/76-illusion-of-control): This bias is about people thinking they can control or significantly impact events that are beyond their control. This knowledge can help us to generate value. +- [Illusory superiority](https://keepsimple.io/uxcore/77-illusory-superiority): Learn how to use this cognitive bias in real-world examples in product management and the HR team. This and 100 other biases are explained for free at UX Core. +- [Risk compensation](https://keepsimple.io/uxcore/78-risk-compensation): The more complex the software you build, the more this bias becomes. Too many protective devices and safety measures increase the risk of accidents. Learn why. +- [Hyperbolic discounting](https://keepsimple.io/uxcore/79-hyperbolic-discounting): We often prefer immediate rewards instead of waiting a bit for more valuable ones. Learn how to use this cognitive bias in product management and HR for free. +- [Appeal to novelty](https://keepsimple.io/uxcore/80-appeal-to-novelty): An important bias when building marketing strategies for your product. A real-world example of this and 100 other cognitive biases for free, only at UX Core. +- [Escalation of commitment](https://keepsimple.io/uxcore/81-escalation-of-commitment): People continue to invest time, money, or resources into a failing decision or course of action, even when it's clear that the situation is not going well. +- [Generation effect](https://keepsimple.io/uxcore/82-generation-effect): If one's mind has made up some "facts", reassuring them of something else doesn't make sense. Learn how to work with this bias and use it in product management. +- [Loss aversion](https://keepsimple.io/uxcore/83-loss-aversion): As one of the most popular cognitive biases, loss aversion can generate a lot of value for us when used properly in product development or HR management. +- [IKEA effect](https://keepsimple.io/uxcore/84-ikea-effect): Explore how to use this and 100 other cognitive biases in product management, design and HR for FREE. No registration is needed. Exclusively at UX Core project. +- [Unit bias](https://keepsimple.io/uxcore/85-unit-bias): This is a tendency for people to want to complete their assigned tasks. Learn how this cognitive bias can be used in product management, UI-UX design and HR. +- [Zero-risk bias](https://keepsimple.io/uxcore/86-zero-risk-bias): This bias helps us to understand how we make decisions when there are risks involved. Learn how to use it in product management and HR for free at UX Core. +- [Processing difficulty effect](https://keepsimple.io/uxcore/87-processing-difficulty-effect): It’s easier for people to remember information that requires more time to read and understand. Learn how to balance cognitive load in product management and HR. +- [Endowment effect](https://keepsimple.io/uxcore/88-endowment-effect): We often place a higher value on things we possess simply because we possess them. This and 100 other cognitive biases with examples of use only at UX Core! +- [Backfire effect](https://keepsimple.io/uxcore/89-backfire-effect): Instead of questioning our beliefs when we encounter challenges, we may become even more steadfast in them. Learn how to use this cognitive bias in management. +- [System justification](https://keepsimple.io/uxcore/90-system-justification): This is a tendency to protect and preserve the current state of things. Learn real-world examples of how to use this bias in product management and HR for free. +- [Reactance](https://keepsimple.io/uxcore/91-reactance): Behavioral bias the primary goal of which is to regain the freedom that has been lost or limited. Learn how to use this in product management and HR for FREE. +- [Decoy effect](https://keepsimple.io/uxcore/92-decoy-effect): Also known as the effect of asymmetric superiority. Learn how to generate value out of this bias when building a product or managing a company. Free at UX Core. +- [Ambiguity effect](https://keepsimple.io/uxcore/93-ambiguity-effect): People naturally prefer things they can understand and predict. Learn how you can use this when building a product or managing a company. Free at UX Core. +- [Information bias](https://keepsimple.io/uxcore/94-information-bias): This is a tendency to seek information when it does not influence actions. Learn how your product and company can benefit from understanding this for free. +- [Law of triviality](https://keepsimple.io/uxcore/95-law-of-triviality): This cognitive bias emphasizes that the members of the organization attach excessive importance to trivial issues. Learn how to deal with this in management. +- [Conjunction fallacy](https://keepsimple.io/uxcore/96-conjunction-fallacy): This bias is associated with giving greater credibility to joint events than to events separately. Learn how to use this in product management and HR for free! +- [Less-is-better effect](https://keepsimple.io/uxcore/97-less-is-better-effect): People prefer small or less expensive items but a little better quality. Learn how to use this and 100 other cognitive biases in product management and HR. +- [Implicit stereotypes](https://keepsimple.io/uxcore/98-implicit-stereotypes): Implicit stereotypes, also known as implicit associations, are when we unconsciously attribute certain qualities to people based on their social group. +- [Prejudice](https://keepsimple.io/uxcore/99-prejudice): Prejudice involves such aspects as stereotypes, superstitions, and biased views. Learn how to lower its impact on our decision-making process in product and HR. +- [Fading affect bias](https://keepsimple.io/uxcore/100-fading-affect-bias): A psychological phenomenon, according to which we tend to forget the memories associated with negative emotions faster than those associated with positive ones. +- [Peak-end rule](https://keepsimple.io/uxcore/101-peak-end-rule): We tend to remember overall experience based on how it felt at its most intense point and how it ended rather than considering the entire duration. Learn more. +- [Serial recall](https://keepsimple.io/uxcore/102-serial-recall): This is the ability to recall elements or events in the order in which they occurred. Learn how to use this when designing a product or managing an HR team. +- [List-length effect](https://keepsimple.io/uxcore/103-list-length-effect): According to this effect, the possibility of serial recall decreases with the increasing list length. Learn real-world use cases from product and HR management. +- [Primacy effect](https://keepsimple.io/uxcore/104-primacy-effect): The primacy effect is a natural tendency in humans to remember things that happen at the start of a process more easily than the rest. Learn how to use it. +- [Serial-position effect](https://keepsimple.io/uxcore/105-serial-position-effect): A person tends to recall the first and last items in a series better than the rest. Learn this and 100 other bias use cases in product and HR management. +- [See All UXCore](https://keepsimple.io/uxcore): Apply UX cognitive biases and behavioral patterns to improve product management and team leadership. +- [Uxcore Api](https://keepsimple.io/uxcore-api): Here is the list of all available API details, including the ability to fetch data about all cognitive biases on the project. +- [Uxcp](https://keepsimple.io/uxcp): This tool helps to create a Persona using cognitive biases for sales, marketing, other business teams, and educational purposes. diff --git a/public/keepsimple_/llms.txt b/public/keepsimple_/llms.txt index e7a0f1f..b2fb9fc 100644 --- a/public/keepsimple_/llms.txt +++ b/public/keepsimple_/llms.txt @@ -1,10 +1,20 @@ -# KeepSimple -> Practical resources and articles from KeepSimple. +# Keep Simple | Cognitive Science & UX Leadership +> Elevate your leadership with applied cognitive science. Explore behavioral psychology and cognitive frameworks designed for modern managers. + ## Pages & Resources - [Home](https://keepsimple.io/): KeepSimple home page. - [Slug](https://keepsimple.io/[page]): No description available. - [Articles](https://keepsimple.io/articles): Browse all KeepSimple articles and categories. -- [Articles Slug](https://keepsimple.io/articles/[page]): No description available. +- [Articles All About User Stories Brand New](https://keepsimple.io/articles/all-about-user-stories-brand-new): This article describes how to write user stories. The author uses real-world example based on the real feature developed for a major online platform. +- [Articles Career Path Of A Manager And A Few Universal Tips](https://keepsimple.io/articles/career-path-of-a-manager-and-a-few-universal-tips): The article summarizes what was described in all previous articles and what are the possible ways of a project manager's career development. +- [Articles Overengineering And Demo Readiness](https://keepsimple.io/articles/overengineering_and_demo_readiness): How to solve overengineering issues in engineering teams, and how to always be ready for important DEMOs and milestones. +- [Articles Philosophies Methodologies And Frameworks](https://keepsimple.io/articles/philosophies-methodologies-and-frameworks): The article describes the fundamental differences between project management philosophies, methodologies, and frameworks. +- [Articles Scrum Framework Artifacts Rituals And Roles](https://keepsimple.io/articles/scrum-framework-artifacts-rituals-and-roles): This article describes all SCRUM Framework artifacts, rituals, and roles, including nuanced details such as the definition of Done, Increment, and others. +- [Articles Software Development Life Cycles](https://keepsimple.io/articles/software-development-life-cycles): The article describes all actual software development life cycles (SDLCs), in particular Predictive, Iterative, Incremental, and Agile. +- [Articles Summarize Like Your Job Depends On It](https://keepsimple.io/articles/summarize-like-your-job-depends-on-it): The article describes the importance of summarization, making quality executive summaries and its impact on career. +- [Articles Technical Components Of The Project](https://keepsimple.io/articles/technical-components-of-the-project): A brief introduction of the main technical components and terms used in the infrastructure of any software project +- [Articles What Is A Project](https://keepsimple.io/articles/what-is-a-project): The article describes what can be considered as a project. +- [Articles Why Study Management](https://keepsimple.io/articles/why-study-management): This article describes the importance of management and why everyone should study management basics regardless of their specialty and interests. - [Auth](https://keepsimple.io/auth): Authentication page for KeepSimple. - [Company Management](https://keepsimple.io/company-management): Explore company management resources. - [Contributors](https://keepsimple.io/contributors): Meet the KeepSimple contributors. @@ -18,5 +28,35 @@ - [Tools Longevity Protocol Habits Supplements](https://keepsimple.io/tools/longevity-protocol/habits/supplements): No description available. - [Tools Longevity Protocol Habits Workout](https://keepsimple.io/tools/longevity-protocol/habits/workout): No description available. - [Tools Longevity Protocol Results](https://keepsimple.io/tools/longevity-protocol/results): No description available. -- [Uxcore Slug](https://keepsimple.io/uxcore/[slug]): No description available. - [See All Articles](https://keepsimple.io/articles): Browse all KeepSimple articles and categories. +- [Auth](https://keepsimple.io/auth) +- [Certificate](https://keepsimple.io/user/[userId]/certificate) +- [User Profile](https://keepsimple.io/user/username) +- [Uxcat](https://keepsimple.io/uxcat): First of its kind online test to measure and increase self-awareness +- [Ongoing](https://keepsimple.io/uxcat/ongoing): First of its kind online test to measure and increase self-awareness +- [Start Test](https://keepsimple.io/uxcat/start-test): First of its kind online test to measure and increase self-awareness +- [Test Result](https://keepsimple.io/uxcat/test-result): First of its kind online test to measure and increase self-awareness +- [Why our company has reputation issue?](https://keepsimple.io/uxcg/why-our-company-is-having-reputation-issue): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why users aren't happy with product quality?](https://keepsimple.io/uxcg/why-our-users-are-not-happy-with-product): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why users don't use requested features?](https://keepsimple.io/uxcg/why-users-do-not-use-requested-features): The following 13 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why did we fail to create the right product associations in the market?](https://keepsimple.io/uxcg/we-could-not-create-needed-associations-on-the-market): The following 12 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do users complain about product updates?](https://keepsimple.io/uxcg/why-users-complain-about-product-updates): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why didn’t our product meet user expectations?](https://keepsimple.io/uxcg/why-our-product-did-not-meet-user-expectations): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why don’t users like the product anymore?](https://keepsimple.io/uxcg/why-dont-users-like-the-product-anymore): The following 9 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why are users so sensitive to product changes?](https://keepsimple.io/uxcg/why-users-so-sensitive-to-product-changes): The following 10 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do our users find our communication overwhelming?](https://keepsimple.io/uxcg/users-find-our-communication-overwhelming): The following 6 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [Why do users complain about the quality of our support?](https://keepsimple.io/uxcg/users-do-not-like-our-customer-support): The following 7 cognitive biases can address this issue. Find the reason and learn how to secure your team's and company's future. Free and only at UX Core. +- [See All UXCG](https://keepsimple.io/uxcg): An extensive knowledge base containing over 1,000 practical examples of applying cognitive biases in business - from idea generation to product launch +- [Availability heuristics](https://keepsimple.io/uxcore/1-availability-heuristics): Explore Availability Heuristics Bias in our UX Core project. Learn how this cognitive bias influences decision-making in product management and HR for free. +- [Attentional bias](https://keepsimple.io/uxcore/2-attentional-bias): Discover attentional bias – a cognitive quirk shaping human focus. Learn how to leverage it in UX and HR for better decision-making. Explore at UX Core. +- [Illusory truth effect](https://keepsimple.io/uxcore/3-illusory-truth-effect): "Elevate your management skills with an understanding of the illusory truth effect! Explore practical applications in HR and product management at UX Core." +- [Mere-exposure effect](https://keepsimple.io/uxcore/4-mere-exposure-effect): Learn how to utilize this bias in software development, applications, product management, and HR activities. Explore all this and more for free, only at UX Core +- [Context effect](https://keepsimple.io/uxcore/5-context-effect): Learn how to use Context Effect in software development, team, and company management. Hands-on examples of use and a lot more for free, only at UX Core project +- [ Cue-dependent forgetting](https://keepsimple.io/uxcore/6-cue-dependent-forgetting): Explore Cue-Dependent Forgetting: Uncover how memory retrieval cues affect information recall. Learn its impact on UX and HR strategies for free at UX Core. +- [Mood-congruent memory bias](https://keepsimple.io/uxcore/7-mood-congruent-memory-bias): Harness Mood-Congruent Memory Bias: Enhance user experiences and HR practices by understanding how emotions influence memory recall. Explore insights at UX Core +- [Frequency illusion](https://keepsimple.io/uxcore/8-frequency-illusion): Master Frequency Illusion Bias: Elevate UX and HR techniques through strategic utilization of cognitive biases. Learn practical applications at UX Core for free +- [Empathy gap](https://keepsimple.io/uxcore/9-empathy-gap): Discover how the empathy gap can be used when developing a product or working in HR team. Harness cognitive bias for improved decision-making. Free at UX Core. +- [Omission bias](https://keepsimple.io/uxcore/10-omission-bias): Explore omission bias: a cognitive inclination to favor inaction over action. Learn how to address it in product management and HR strategies. #UXCore +- [See All UXCore](https://keepsimple.io/uxcore): Apply UX cognitive biases and behavioral patterns to improve product management and team leadership. +- [Uxcore Api](https://keepsimple.io/uxcore-api): Here is the list of all available API details, including the ability to fetch data about all cognitive biases on the project. +- [Uxcp](https://keepsimple.io/uxcp): This tool helps to create a Persona using cognitive biases for sales, marketing, other business teams, and educational purposes. diff --git a/scripts/generate-llms-pages.ts b/scripts/generate-llms-pages.ts new file mode 100644 index 0000000..3ef3bfa --- /dev/null +++ b/scripts/generate-llms-pages.ts @@ -0,0 +1,176 @@ +import * as dotenv from 'dotenv'; +import * as fs from 'fs/promises'; +import * as http from 'http'; +import * as https from 'https'; +import * as path from 'path'; + +dotenv.config({ path: path.join(process.cwd(), '.env'), override: true }); +dotenv.config({ path: path.join(process.cwd(), '.env.local'), override: true }); + +const PUBLIC_DIR = path.join(process.cwd(), 'public'); +const OUTPUT_DIR = path.join( + PUBLIC_DIR, + 'keepsimple_', + 'llms-full-pages', + 'article', +); +const SITE_BASE_URL = ( + process.env.NEXT_PUBLIC_DOMAIN || 'https://keepsimple.io' +).replace(/\/+$/, ''); + +const STRAPI_BASE = + process.env.STRAPI_URL || process.env.NEXT_PUBLIC_STRAPI || ''; + +// ───────────────────────────────────────────── +// Helpers +// ───────────────────────────────────────────── + +const stripHtml = (value: any): string => + String(value || '') + .replace(/<[^>]*>/g, ' ') + .replace(/ /g, ' ') + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/\s+/g, ' ') + .trim(); + +function getJson(url: string): Promise { + return new Promise((resolve, reject) => { + const client = url.startsWith('https://') ? https : http; + const req = client.request(url, { method: 'GET' }, res => { + const status = res.statusCode ?? 0; + let raw = ''; + res.setEncoding('utf8'); + res.on('data', (chunk: string) => { + raw += chunk; + }); + res.on('end', () => { + if (status < 200 || status >= 300) { + reject(new Error(`HTTP ${status} for ${url}`)); + return; + } + try { + resolve(JSON.parse(raw)); + } catch (err) { + reject( + new Error(`Invalid JSON for ${url}: ${(err as Error).message}`), + ); + } + }); + }); + req.on('error', reject); + req.end(); + }); +} + +async function strapiGet(endpoint: string): Promise { + const url = `${STRAPI_BASE}/api/${endpoint}`; + return getJson(url); +} + +// ───────────────────────────────────────────── +// Fetch all articles with content +// ───────────────────────────────────────────── + +async function fetchArticles(): Promise { + try { + const data = await strapiGet( + 'articles?locale=en&pagination[pageSize]=1000&populate=*', + ); + return data?.data || []; + } catch (error: any) { + console.log( + `[strapi] failed to fetch articles: ${error?.message || error}`, + ); + return []; + } +} + +// ───────────────────────────────────────────── +// Build markdown for a single article +// ───────────────────────────────────────────── + +function buildArticleMarkdown(attributes: any, slug: string): string { + const title = attributes?.title || slug; + const description = stripHtml( + attributes?.seoDescription || attributes?.shortDescription || '', + ); + const url = `${SITE_BASE_URL}/articles/${slug}`; + + const lines: string[] = []; + lines.push(`# ${title}`); + lines.push(`- URL: ${url}`); + if (description) { + lines.push(`- Description: ${description}`); + } + lines.push(''); + return lines.join('\n'); +} + +// ───────────────────────────────────────────── +// Main +// ───────────────────────────────────────────── + +async function main(): Promise { + console.log('=== generate-llms-pages.ts ===\n'); + + if (!STRAPI_BASE) { + console.error( + '[error] STRAPI_URL or NEXT_PUBLIC_STRAPI must be set in .env', + ); + process.exit(1); + } + + console.log('[step 1] Fetching articles from Strapi...'); + const records = await fetchArticles(); + console.log(` found ${records.length} articles\n`); + + if (!records.length) { + console.log('[done] no articles to write'); + return; + } + + await fs.mkdir(OUTPUT_DIR, { recursive: true }); + + let written = 0; + let skipped = 0; + + console.log('[step 2] Writing markdown pages...\n'); + for (const record of records) { + const attributes = record?.attributes || {}; + const slug = String(attributes?.newUrl || '') + .replace(/^\/+/, '') + .replace(/\/+$/, ''); + + if (!slug) { + skipped++; + continue; + } + + const markdown = buildArticleMarkdown(attributes, slug); + const filePath = path.join(OUTPUT_DIR, `${slug}.md`); + + try { + await fs.writeFile(filePath, markdown, 'utf8'); + console.log(` ✓ ${slug}`); + written++; + } catch (error: any) { + console.log(` ✗ ${slug}: ${error?.message || error}`); + skipped++; + } + } + + console.log(`\nSuccessfully wrote ${written} article pages to ${OUTPUT_DIR}`); + if (skipped > 0) { + console.log(`Skipped ${skipped} articles (no slug or write error)`); + } +} + +main().catch(error => { + console.error( + `[fatal] generate-llms-pages failed: ${(error as Error).message || error}`, + ); + process.exit(1); +}); diff --git a/scripts/generate-llms.mjs b/scripts/generate-llms.mjs deleted file mode 100644 index 687e311..0000000 --- a/scripts/generate-llms.mjs +++ /dev/null @@ -1,400 +0,0 @@ -import fs from 'node:fs/promises'; -import path from 'node:path'; -import dotenv from 'dotenv'; - -dotenv.config({ path: '.env' }); -dotenv.config({ path: '.env.local', override: true }); - -const ROOT_DIR = process.cwd(); -const PAGES_DIR = path.join(ROOT_DIR, 'src', 'pages'); -const PUBLIC_DIR = path.join(ROOT_DIR, 'public'); -const DEFAULT_TITLE = 'KeepSimple'; -const DEFAULT_DESCRIPTION = 'Practical resources and articles from KeepSimple.'; - -const seoDescriptions = { - '/': 'KeepSimple home page.', - '/articles': 'Browse all KeepSimple articles and categories.', - '/contributors': 'Meet the KeepSimple contributors.', - '/company-management': 'Explore company management resources.', - '/auth': 'Authentication page for KeepSimple.', -}; - -const MODE_CONFIG = { - curated: { - outputFile: path.join(PUBLIC_DIR, 'keepsimple_', 'llms.txt'), - slugLimit: 10, - writeMarkdown: false, - modeLabel: 'curated', - }, - full: { - outputFile: path.join(PUBLIC_DIR, 'keepsimple_', 'llms-full.txt'), - slugLimit: Infinity, - writeMarkdown: true, - markdownRoot: path.join( - PUBLIC_DIR, - 'keepsimple_', - 'llms-full-pages', - 'article', - ), - modeLabel: 'full', - }, -}; - -const appConfig = { - mode: process.env.LLMS_MODE === 'full' ? 'full' : 'curated', -}; - -const stripHtml = value => - String(value || '') - .replace(/<[^>]*>/g, ' ') - .replace(/\s+/g, ' ') - .trim(); - -const formatPageName = route => { - if (route === '/') return 'Home'; - const parts = route.split('/').filter(Boolean); - if (parts.length === 0) return 'Home'; - const words = parts - .join(' ') - .replace(/\[.*?\]/g, 'Slug') - .replace(/[-_]/g, ' ') - .split(/\s+/) - .filter(Boolean) - .map(word => word.charAt(0).toUpperCase() + word.slice(1)); - return words.join(' '); -}; - -const toAbsoluteUrl = (baseUrl, route) => { - const normalizedBase = String(baseUrl || 'https://keepsimple.io').replace( - /\/+$/, - '', - ); - const normalizedRoute = route.startsWith('/') ? route : `/${route}`; - return `${normalizedBase}${normalizedRoute}`; -}; - -const shouldSkipEntry = entryName => entryName.startsWith('_'); - -const isRouteFile = fileName => - /\.(tsx|ts|jsx|js)$/.test(fileName) && - !/^(404|500)\.(tsx|ts|jsx|js)$/.test(fileName); - -const routeFromFilePath = filePath => { - const rel = path.relative(PAGES_DIR, filePath).replace(/\\/g, '/'); - const noExt = rel.replace(/\.(tsx|ts|jsx|js)$/, ''); - const segments = noExt.split('/').filter(Boolean); - if (segments[0] === 'api') return null; - if (segments.length === 0) return null; - if (segments[segments.length - 1] === 'index') segments.pop(); - const route = `/${segments.join('/')}` || '/'; - return route === '' ? '/' : route; -}; - -const scanRoutes = async dir => { - const entries = await fs.readdir(dir, { withFileTypes: true }); - const routeSet = new Set(); - - for (const entry of entries) { - if (shouldSkipEntry(entry.name)) { - console.log(`[scan] skipped ${entry.name} (leading underscore)`); - continue; - } - - const entryPath = path.join(dir, entry.name); - if (entry.isDirectory()) { - if (entry.name === 'api') { - console.log(`[scan] skipped ${entryPath} (api folder)`); - continue; - } - const nested = await scanRoutes(entryPath); - nested.forEach(route => routeSet.add(route)); - continue; - } - - if (!isRouteFile(entry.name)) { - console.log(`[scan] skipped ${entryPath} (not route file)`); - continue; - } - - const route = routeFromFilePath(entryPath); - if (!route) { - console.log(`[scan] skipped ${entryPath} (route normalization)`); - continue; - } - - routeSet.add(route); - console.log(`[scan] found route ${route}`); - } - - return [...routeSet].sort((a, b) => a.localeCompare(b)); -}; - -const getLlmsMeta = async () => { - const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/llms-meta`; - return await fetch(url, { - method: 'GET', - }) - .then(data => data.json()) - .then(data => data?.data?.attributes); -}; - -const getArticleRecords = async () => { - const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/articles?locale=en&pagination[pageSize]=1000&populate=*`; - - try { - return await fetch(url) - .then(resp => resp.json()) - .then(json => json?.data || []); - } catch (error) { - console.log( - `[strapi] failed to fetch articles: ${error?.message || error}`, - ); - return []; - } -}; - -const toArticleSlugRecord = record => { - const attributes = record?.attributes || {}; - const newUrl = String(attributes?.newUrl || '') - .replace(/^\/+/, '') - .replace(/\/+$/, ''); - const oldUrl = String(attributes?.url || '') - .replace(/^\/+/, '') - .replace(/\/+$/, '') - .toLowerCase(); - - if (!newUrl) return null; - - const type = String(attributes?.type || '').toLowerCase(); - const isUxCore = - oldUrl.startsWith('uxcore/') || - oldUrl.startsWith('uxcg/') || - type.includes('uxcore') || - type.includes('uxcg') || - type.includes('thoughts'); - - return { - slug: newUrl, - title: attributes?.title || newUrl, - seoDescription: stripHtml( - attributes?.seoDescription || attributes?.description, - ), - isUxCore, - }; -}; - -const applyDynamicExpansions = async ({ routes, modeConfig }) => { - const records = (await getArticleRecords()) - .map(toArticleSlugRecord) - .filter(Boolean); - - if (!records.length) { - console.log('[expand] skipped all dynamic expansions (no article records)'); - return { - routes, - expandedArticleEntries: [], - expandedUxCoreEntries: [], - }; - } - - const limit = modeConfig.slugLimit; - const articleEntries = records.slice(0, limit).map(record => ({ - route: `/articles/${record.slug}`, - title: record.title, - seoDescription: record.seoDescription, - slug: record.slug, - })); - - const uxCoreEntries = records - .filter(record => record.isUxCore) - .slice(0, limit) - .map(record => ({ - route: `/uxcore/${record.slug}`, - title: record.title, - seoDescription: record.seoDescription, - slug: record.slug, - })); - - const nextRoutes = routes.filter( - route => - route !== '/articles/[slug]' && - route !== '/articles/[page]' && - route !== '/uxcore/[slug]' && - route !== '/uxcore/[page]', - ); - - articleEntries.forEach(item => { - nextRoutes.push(item.route); - console.log(`[expand] found article slug ${item.route}`); - }); - - uxCoreEntries.forEach(item => { - nextRoutes.push(item.route); - console.log(`[expand] found uxcore slug ${item.route}`); - }); - - return { - routes: [...new Set(nextRoutes)].sort((a, b) => a.localeCompare(b)), - expandedArticleEntries: articleEntries, - expandedUxCoreEntries: uxCoreEntries, - }; -}; - -const routeToDescription = (route, dynamicLookup) => { - if (seoDescriptions[route]) return stripHtml(seoDescriptions[route]); - if (dynamicLookup[route]) return stripHtml(dynamicLookup[route]); - return 'No description available.'; -}; - -const buildContent = ({ - title, - description, - routes, - baseUrl, - dynamicLookup, - customEntries = [], -}) => { - const lines = []; - lines.push(`# ${title}`); - lines.push(`> ${description}`); - lines.push('## Pages & Resources'); - - routes.forEach(route => { - const name = formatPageName(route); - const absoluteUrl = toAbsoluteUrl(baseUrl, route); - const seoDescription = routeToDescription(route, dynamicLookup); - lines.push(`- [${name}](${absoluteUrl}): ${seoDescription}`); - }); - - customEntries.forEach(entry => { - lines.push( - `- [${entry.name}](${toAbsoluteUrl(baseUrl, entry.route)}): ${entry.description}`, - ); - }); - - return `${lines.join('\n')}\n`; -}; - -const writeMarkdownPages = async ({ - entries, - baseUrl, - markdownRoot, - sectionName, -}) => { - if (!markdownRoot) return; - - await fs.mkdir(markdownRoot, { recursive: true }); - - for (const entry of entries) { - const filePath = path.join(markdownRoot, `${entry.slug}.md`); - const body = [ - `# ${entry.title}`, - `- URL: ${toAbsoluteUrl(baseUrl, entry.route)}`, - `- Description: ${entry.seoDescription || 'No description available.'}`, - '', - ].join('\n'); - - try { - await fs.writeFile(filePath, body, 'utf8'); - console.log(`[markdown] found ${sectionName} page ${filePath}`); - } catch (error) { - console.log( - `[markdown] skipped ${sectionName} ${entry.slug}: ${error?.message || error}`, - ); - } - } -}; - -const run = async () => { - const modeConfig = MODE_CONFIG[appConfig.mode]; - const baseUrl = process.env.NEXT_PUBLIC_DOMAIN || 'https://keepsimple.io'; - const strapiUrl = process.env.NEXT_PUBLIC_STRAPI; - - if (!strapiUrl) { - console.log( - '[config] NEXT_PUBLIC_STRAPI is missing, dynamic and meta fetches may be skipped.', - ); - } - - let title = DEFAULT_TITLE; - let description = DEFAULT_DESCRIPTION; - - try { - const meta = await getLlmsMeta(); - title = meta?.title || DEFAULT_TITLE; - description = stripHtml(meta?.description || DEFAULT_DESCRIPTION); - console.log('[meta] found llms-meta'); - } catch (error) { - console.log(`[meta] skipped llms-meta: ${error?.message || error}`); - } - - let routes = await scanRoutes(PAGES_DIR); - console.log(`[scan] discovered route count: ${routes.length}`); - - // Preserve placeholder routes if they are not in current pages shape. - if (!routes.includes('/articles/[page]')) { - routes.push('/articles/[slug]'); - } - if (!routes.includes('/uxcore/[slug]')) { - routes.push('/uxcore/[slug]'); - } - - const { - routes: expandedRoutes, - expandedArticleEntries, - expandedUxCoreEntries, - } = await applyDynamicExpansions({ routes, modeConfig }); - - const seeAllArticlesRoute = '/articles'; - if (!expandedRoutes.includes(seeAllArticlesRoute)) { - expandedRoutes.push(seeAllArticlesRoute); - } - console.log('[expand] found See All Articles -> /articles'); - - const dynamicLookup = {}; - [...expandedArticleEntries, ...expandedUxCoreEntries].forEach(entry => { - dynamicLookup[entry.route] = entry.seoDescription; - }); - - const content = buildContent({ - title, - description, - routes: expandedRoutes.sort((a, b) => a.localeCompare(b)), - baseUrl, - dynamicLookup, - customEntries: [ - { - name: 'See All Articles', - route: '/articles', - description: stripHtml( - seoDescriptions['/articles'] || - 'Browse all KeepSimple articles and categories.', - ), - }, - ], - }); - - try { - await fs.mkdir(path.dirname(modeConfig.outputFile), { recursive: true }); - await fs.writeFile(modeConfig.outputFile, content, 'utf8'); - } catch (error) { - console.log(`[write] skipped llms output: ${error?.message || error}`); - } - - if (modeConfig.writeMarkdown) { - await writeMarkdownPages({ - entries: [...expandedArticleEntries, ...expandedUxCoreEntries], - baseUrl, - markdownRoot: modeConfig.markdownRoot, - sectionName: 'article', - }); - } - - console.log( - `Successfully mapped ${expandedRoutes.length} routes to ${modeConfig.outputFile}`, - ); -}; - -run().catch(error => { - console.log(`[fatal] generator failed: ${error?.message || error}`); -}); diff --git a/scripts/generate-llms.ts b/scripts/generate-llms.ts new file mode 100644 index 0000000..31aa1e5 --- /dev/null +++ b/scripts/generate-llms.ts @@ -0,0 +1,417 @@ +import * as dotenv from 'dotenv'; +import * as fs from 'fs/promises'; +import * as http from 'http'; +import * as https from 'https'; +import * as path from 'path'; + +import { getLlmsMeta } from '../src/api/llmsMeta'; + +dotenv.config({ path: path.join(process.cwd(), '.env'), override: true }); +dotenv.config({ path: path.join(process.cwd(), '.env.local'), override: true }); + +const ROOT_DIR = process.cwd(); +const PAGES_DIR = path.join(ROOT_DIR, 'src', 'pages'); +const PUBLIC_DIR = path.join(ROOT_DIR, 'public'); +const DEFAULT_TITLE = 'KeepSimple'; +const DEFAULT_DESCRIPTION = 'Practical resources and articles from KeepSimple.'; + +const STRAPI_BASE = + process.env.STRAPI_URL || process.env.NEXT_PUBLIC_STRAPI || ''; + +const seoDescriptions: Record = { + '/': 'KeepSimple home page.', + '/articles': 'Browse all KeepSimple articles and categories.', + '/contributors': 'Meet the KeepSimple contributors.', + '/company-management': 'Explore company management resources.', + '/auth': 'Authentication page for KeepSimple.', +}; + +const MODE_CONFIG: Record = { + curated: { + outputFile: path.join(PUBLIC_DIR, 'keepsimple_', 'llms.txt'), + slugLimit: 10, + modeLabel: 'curated', + }, + full: { + outputFile: path.join(PUBLIC_DIR, 'keepsimple_', 'llms-full.txt'), + slugLimit: Infinity, + modeLabel: 'full', + }, +}; + +const appConfig = { + mode: process.env.LLMS_MODE === 'full' ? 'full' : 'curated', +}; + +// ───────────────────────────────────────────── +// Helpers +// ───────────────────────────────────────────── + +const stripHtml = (value: any): string => + String(value || '') + .replace(/<[^>]*>/g, ' ') + .replace(/ /g, ' ') + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/\s+/g, ' ') + .trim(); + +function getJson(url: string): Promise { + return new Promise((resolve, reject) => { + const client = url.startsWith('https://') ? https : http; + const req = client.request(url, { method: 'GET' }, res => { + const status = res.statusCode ?? 0; + let raw = ''; + res.setEncoding('utf8'); + res.on('data', (chunk: string) => { + raw += chunk; + }); + res.on('end', () => { + if (status < 200 || status >= 300) { + reject(new Error(`HTTP ${status} for ${url}`)); + return; + } + try { + resolve(JSON.parse(raw)); + } catch (err) { + reject( + new Error(`Invalid JSON for ${url}: ${(err as Error).message}`), + ); + } + }); + }); + req.on('error', reject); + req.end(); + }); +} + +async function strapiGet(endpoint: string): Promise { + const url = `${STRAPI_BASE}/api/${endpoint}`; + return getJson(url); +} + +// ───────────────────────────────────────────── +// Site meta from /api/llms-meta +// ───────────────────────────────────────────── + +async function fetchSiteMeta(): Promise<{ + title: string; + description: string; +}> { + // Try getLlmsMeta (uses fetch) + try { + const attrs = await getLlmsMeta(); + if (attrs?.title) { + console.log('[meta] found llms-meta via getLlmsMeta'); + return { + title: stripHtml(String(attrs?.title)), + description: stripHtml(String(attrs?.description)), + }; + } + } catch (err) { + console.log(`[meta] getLlmsMeta failed: ${(err as Error).message}`); + } + + // Fallback: strapiGet with auth token (uses http/https) + try { + const data = await strapiGet('llms-meta'); + const attrs = data?.data?.attributes ?? data?.data ?? data ?? {}; + if (attrs?.title) { + console.log('[meta] found llms-meta via strapiGet'); + return { + title: stripHtml(String(attrs.title)), + description: stripHtml(String(attrs?.description)), + }; + } + } catch (err) { + console.log(`[meta] strapiGet failed: ${(err as Error).message}`); + } + + console.log('[meta] using defaults'); + return { title: DEFAULT_TITLE, description: DEFAULT_DESCRIPTION }; +} + +// ───────────────────────────────────────────── +// Route scanning +// ───────────────────────────────────────────── + +const formatPageName = (route: string): string => { + if (route === '/') return 'Home'; + const parts = route.split('/').filter(Boolean); + if (parts.length === 0) return 'Home'; + const words = parts + .join(' ') + .replace(/\[.*?\]/g, 'Slug') + .replace(/[-_]/g, ' ') + .split(/\s+/) + .filter(Boolean) + .map(word => word.charAt(0).toUpperCase() + word.slice(1)); + return words.join(' '); +}; + +const toAbsoluteUrl = (baseUrl: string, route: string): string => { + const normalizedBase = String(baseUrl || 'https://keepsimple.io').replace( + /\/+$/, + '', + ); + const normalizedRoute = route.startsWith('/') ? route : `/${route}`; + return `${normalizedBase}${normalizedRoute}`; +}; + +const shouldSkipEntry = (entryName: string): boolean => + entryName.startsWith('_'); + +const isRouteFile = (fileName: string): boolean => + /\.(tsx|ts|jsx|js)$/.test(fileName) && + !/^(404|500)\.(tsx|ts|jsx|js)$/.test(fileName); + +const routeFromFilePath = (filePath: string): string | null => { + const rel = path.relative(PAGES_DIR, filePath).replace(/\\/g, '/'); + const noExt = rel.replace(/\.(tsx|ts|jsx|js)$/, ''); + const segments = noExt.split('/').filter(Boolean); + if (segments[0] === 'api') return null; + if (segments.length === 0) return null; + if (segments[segments.length - 1] === 'index') segments.pop(); + const route = `/${segments.join('/')}` || '/'; + return route === '' ? '/' : route; +}; + +const scanRoutes = async (dir: string): Promise => { + const entries = await fs.readdir(dir, { withFileTypes: true }); + const routeSet = new Set(); + + for (const entry of entries) { + if (shouldSkipEntry(entry.name)) { + console.log(`[scan] skipped ${entry.name} (leading underscore)`); + continue; + } + + const entryPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + if (entry.name === 'api') { + console.log(`[scan] skipped ${entryPath} (api folder)`); + continue; + } + const nested = await scanRoutes(entryPath); + nested.forEach(route => routeSet.add(route)); + continue; + } + + if (!isRouteFile(entry.name)) { + console.log(`[scan] skipped ${entryPath} (not route file)`); + continue; + } + + const route = routeFromFilePath(entryPath); + if (!route) { + console.log(`[scan] skipped ${entryPath} (route normalization)`); + continue; + } + + routeSet.add(route); + console.log(`[scan] found route ${route}`); + } + + return Array.from(routeSet).sort((a, b) => a.localeCompare(b)); +}; + +// ───────────────────────────────────────────── +// Article expansion +// ───────────────────────────────────────────── + +const getArticleRecords = async (): Promise => { + try { + const data = await strapiGet( + 'articles?locale=en&pagination[pageSize]=1000&populate=*', + ); + return data?.data || []; + } catch (error: any) { + console.log( + `[strapi] failed to fetch articles: ${error?.message || error}`, + ); + return []; + } +}; + +const toArticleSlugRecord = (record: any) => { + const attributes = record?.attributes || {}; + const newUrl = String(attributes?.newUrl || '') + .replace(/^\/+/, '') + .replace(/\/+$/, ''); + + if (!newUrl) return null; + + return { + slug: newUrl, + title: attributes?.title || newUrl, + seoDescription: stripHtml( + attributes?.seoDescription || attributes?.shortDescription, + ), + }; +}; + +const applyDynamicExpansions = async ({ routes, modeConfig }: any) => { + const records = (await getArticleRecords()) + .map(toArticleSlugRecord) + .filter(Boolean); + + if (!records.length) { + console.log('[expand] skipped all dynamic expansions (no article records)'); + return { + routes, + expandedArticleEntries: [], + }; + } + + const limit = modeConfig.slugLimit; + const articleEntries = records.slice(0, limit).map((record: any) => ({ + route: `/articles/${record.slug}`, + title: record.title, + seoDescription: record.seoDescription, + slug: record.slug, + })); + + const nextRoutes = routes.filter( + (route: string) => + route !== '/articles/[slug]' && route !== '/articles/[page]', + ); + + articleEntries.forEach((item: any) => { + nextRoutes.push(item.route); + console.log(`[expand] found article slug ${item.route}`); + }); + + return { + routes: Array.from(new Set(nextRoutes)).sort((a, b) => + a.localeCompare(b), + ), + expandedArticleEntries: articleEntries, + }; +}; + +// ───────────────────────────────────────────── +// Build output +// ───────────────────────────────────────────── + +const routeToDescription = ( + route: string, + dynamicLookup: Record, +): string => { + if (seoDescriptions[route]) return stripHtml(seoDescriptions[route]); + if (dynamicLookup[route]) return stripHtml(dynamicLookup[route]); + return 'No description available.'; +}; + +const buildContent = ({ + title, + description, + routes, + baseUrl, + dynamicLookup, + customEntries = [], +}: any): string => { + const lines: string[] = []; + lines.push(`# ${title}`); + lines.push(`> ${description}`); + lines.push('## Pages & Resources'); + + routes.forEach((route: string) => { + const name = formatPageName(route); + const absoluteUrl = toAbsoluteUrl(baseUrl, route); + const seoDescription = routeToDescription(route, dynamicLookup); + lines.push(`- [${name}](${absoluteUrl}): ${seoDescription}`); + }); + + customEntries.forEach((entry: any) => { + lines.push( + `- [${entry.name}](${toAbsoluteUrl(baseUrl, entry.route)}): ${entry.description}`, + ); + }); + + return `${lines.join('\n')}\n`; +}; + +// ───────────────────────────────────────────── +// Main +// ───────────────────────────────────────────── + +const run = async () => { + const modeConfig = MODE_CONFIG[appConfig.mode]; + const baseUrl = process.env.NEXT_PUBLIC_DOMAIN || 'https://keepsimple.io'; + + if (!STRAPI_BASE) { + console.log( + '[config] STRAPI_URL / NEXT_PUBLIC_STRAPI is missing, dynamic and meta fetches may be skipped.', + ); + } + + // Ensure NEXT_PUBLIC_STRAPI is set for getLlmsMeta + process.env.NEXT_PUBLIC_STRAPI = + process.env.NEXT_PUBLIC_STRAPI || STRAPI_BASE; + + console.log('[step 1] Fetching site meta...'); + const { title, description } = await fetchSiteMeta(); + console.log(` title: "${title}"`); + + console.log('[step 2] Scanning src/pages...'); + const routes = await scanRoutes(PAGES_DIR); + console.log(`[scan] discovered route count: ${routes.length}`); + + // Preserve placeholder routes if they are not in current pages shape. + if (!routes.includes('/articles/[page]')) { + routes.push('/articles/[slug]'); + } + + console.log('[step 3] Expanding dynamic routes...'); + const { routes: expandedRoutes, expandedArticleEntries } = + await applyDynamicExpansions({ routes, modeConfig }); + + const seeAllArticlesRoute = '/articles'; + if (!expandedRoutes.includes(seeAllArticlesRoute)) { + expandedRoutes.push(seeAllArticlesRoute); + } + console.log('[expand] found See All Articles -> /articles'); + + const dynamicLookup: Record = {}; + expandedArticleEntries.forEach((entry: any) => { + dynamicLookup[entry.route] = entry.seoDescription; + }); + + const content = buildContent({ + title, + description, + routes: expandedRoutes.sort((a: string, b: string) => a.localeCompare(b)), + baseUrl, + dynamicLookup, + customEntries: [ + { + name: 'See All Articles', + route: '/articles', + description: stripHtml( + seoDescriptions['/articles'] || + 'Browse all KeepSimple articles and categories.', + ), + }, + ], + }); + + try { + await fs.mkdir(path.dirname(modeConfig.outputFile), { recursive: true }); + await fs.writeFile(modeConfig.outputFile, content, 'utf8'); + } catch (error: any) { + console.log(`[write] skipped llms output: ${error?.message || error}`); + } + + console.log( + `\nSuccessfully mapped ${expandedRoutes.length} routes to ${modeConfig.outputFile}`, + ); +}; + +run().catch(error => { + console.error( + `[fatal] generator failed: ${(error as Error).message || error}`, + ); + process.exit(1); +});