Skip to content

[Components] habitica #13284 #17012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025
Merged

[Components] habitica #13284 #17012

merged 2 commits into from
Jun 12, 2025

Conversation

lcaresia
Copy link
Collaborator

@lcaresia lcaresia commented Jun 5, 2025

Summary by CodeRabbit

  • New Features
    • Added actions to create, delete, and retrieve Habitica challenges directly from the integration.
  • Chores
    • Updated Habitica integration to improve API interaction and property definitions.
    • Updated package metadata and dependencies for the Habitica component.
  • Refactor
    • Replaced and improved the Habitica app integration for more robust challenge management.
  • Chores
    • Removed file ignoring JavaScript and distribution files to include them in version control.
    • Added centralized constants for Habitica group types.

@lcaresia lcaresia self-assigned this Jun 5, 2025
Copy link

vercel bot commented Jun 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Jun 9, 2025 7:28pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 9, 2025 7:28pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 9, 2025 7:28pm

Copy link
Contributor

coderabbitai bot commented Jun 5, 2025

Walkthrough

This update introduces a Habitica app integration with methods for creating, retrieving, and deleting challenges via Habitica's API. It adds corresponding action modules, defines property schemas, and implements API interaction logic using axios. The package metadata is updated, and obsolete files, including an old app definition and a .gitignore, are removed.

Changes

File(s) Change Summary
components/habitica/habitica.app.mjs New Habitica app integration with prop definitions and API methods for challenge management.
components/habitica/actions/create-challenge/create-challenge.mjs
components/habitica/actions/delete-challenge/delete-challenge.mjs
components/habitica/actions/get-challenge/get-challenge.mjs
Added new action modules for creating, deleting, and retrieving Habitica challenges.
components/habitica/app/habitica.app.ts Removed old Habitica app definition.
components/habitica/.gitignore Removed .gitignore file, allowing JS, MJS, and dist files to be tracked.
components/habitica/package.json Updated version, entry point, dependencies, and removed "files" field.
components/habitica/common/constants.mjs Added new constants module exporting Habitica group types.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ActionModule
    participant HabiticaApp
    participant HabiticaAPI

    User->>ActionModule: Trigger action (Create/Delete/Get Challenge)
    ActionModule->>HabiticaApp: Call corresponding method (createChallenge, etc.)
    HabiticaApp->>HabiticaAPI: Make HTTP request (POST/DELETE/GET)
    HabiticaAPI-->>HabiticaApp: Respond with challenge data/status
    HabiticaApp-->>ActionModule: Return result
    ActionModule-->>User: Display summary/response
Loading

Suggested labels

ai-assisted

Poem

A hop and a skip, new actions appear,
Habitica’s challenges now crystal clear!
With axios we leap, to fetch and to send,
Create, delete, retrieve—on rabbits depend.
Old files are gone, new flows in sight,
This code garden’s growing, oh what delight!
((\
( -.-)
o_(")(")

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/habitica/actions/get-challenge/get-challenge.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

components/habitica/habitica.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

components/habitica/common/constants.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb3fc32 and adfe540.

📒 Files selected for processing (3)
  • components/habitica/actions/get-challenge/get-challenge.mjs (1 hunks)
  • components/habitica/common/constants.mjs (1 hunks)
  • components/habitica/habitica.app.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • components/habitica/common/constants.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/habitica/actions/get-challenge/get-challenge.mjs
  • components/habitica/habitica.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@lcaresia lcaresia linked an issue Jun 5, 2025 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
components/habitica/actions/get-challenge/get-challenge.mjs (1)

6-6: Improve the action description.

The description contains placeholder text "Description for get-challenge" which should be replaced with a more descriptive explanation of what this action does.

-  description: "Description for get-challenge. [See the documentation](https://habitica.com/apidoc/#api-Challenge-GetChallenge)",
+  description: "Retrieves details of a specific challenge by its ID. [See the documentation](https://habitica.com/apidoc/#api-Challenge-GetChallenge)",
components/habitica/habitica.app.mjs (2)

55-55: Fix typo in prize description.

There's a typo in the description: "winne" should be "winner".

-      description: "Number of gems offered as a prize to challenge winne",
+      description: "Number of gems offered as a prize to challenge winner",

105-111: Consider adding input validation for createChallenge.

The method accepts generic args but could benefit from validation of required fields like name and group.

    async createChallenge(args = {}) {
+      if (!args.data?.name || !args.data?.group) {
+        throw new Error("Challenge name and group are required");
+      }
      return this._makeRequest({
        path: "/challenges",
        method: "post",
        ...args,
      });
    },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27ae00a and eb3fc32.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • components/habitica/.gitignore (0 hunks)
  • components/habitica/actions/create-challenge/create-challenge.mjs (1 hunks)
  • components/habitica/actions/delete-challenge/delete-challenge.mjs (1 hunks)
  • components/habitica/actions/get-challenge/get-challenge.mjs (1 hunks)
  • components/habitica/app/habitica.app.ts (0 hunks)
  • components/habitica/habitica.app.mjs (1 hunks)
  • components/habitica/package.json (1 hunks)
💤 Files with no reviewable changes (2)
  • components/habitica/.gitignore
  • components/habitica/app/habitica.app.ts
🔇 Additional comments (12)
components/habitica/package.json (3)

3-3: LGTM! Appropriate version bump for new features.

The minor version bump from 0.0.2 to 0.1.0 correctly follows semantic versioning for the addition of new challenge management functionality.


5-5: Entry point change reflects structural refactor.

The change from "dist/app/habitica.app.mjs" to "habitica.app.mjs" indicates the app file is now in the component root rather than a dist directory, which aligns with the removal of the "files" field and the new structure described in the AI summary.


15-17: Dependencies section properly added.

The addition of "@pipedream/platform": "^3.1.0" as a dependency is correctly formatted and follows Pipedream component standards.

components/habitica/actions/create-challenge/create-challenge.mjs (3)

1-1: Import path correctly references the new app structure.

The import path "../../habitica.app.mjs" correctly references the new app file location as updated in package.json.


9-62: Well-structured props using propDefinitions.

The props section effectively uses propDefinitions from the app for all challenge properties, ensuring consistency and reusability. The group prop correctly uses a function to pass the type context for dynamic loading.


63-78: Proper API call implementation and response handling.

The run method correctly calls the app's createChallenge method with the required data structure and provides appropriate user feedback through the summary export.

components/habitica/actions/delete-challenge/delete-challenge.mjs (1)

1-26: Consistent and well-implemented delete action.

The action follows the same structural patterns as create-challenge, with appropriate minimal props (only challengeId) for the delete operation. The API call and response handling are correctly implemented.

components/habitica/actions/get-challenge/get-challenge.mjs (1)

18-25: Correct implementation of challenge retrieval.

The run method properly calls the app's getChallenge method and handles the response appropriately with summary export.

components/habitica/habitica.app.mjs (4)

1-5: LGTM! Clean import and app structure.

The axios import and basic app structure follow Pipedream conventions correctly.


87-104: LGTM! Well-structured HTTP request method.

The _makeRequest method correctly handles authentication headers and follows good patterns for axios integration.


129-139: LGTM! Clean implementation for getGroups.

The method correctly handles the type parameter and passes it to the API.


140-146: LGTM! Clean implementation for getChallenges.

The method correctly uses the user-specific challenges endpoint.

Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vunguyenhung vunguyenhung merged commit 6a4420e into master Jun 12, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-13284 branch June 12, 2025 05:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] habitica
3 participants