Skip to content

[Prism] Using cli outside of projects should produce a helpful error message#840

Draft
arjuncooliitr wants to merge 2 commits into
masterfrom
prism/fix-817
Draft

[Prism] Using cli outside of projects should produce a helpful error message#840
arjuncooliitr wants to merge 2 commits into
masterfrom
prism/fix-817

Conversation

@arjuncooliitr

Copy link
Copy Markdown
Contributor

Prism autonomous fix for #817

Archetype: bug
Priority: P2
Method: Claude tool-use loop (us.anthropic.claude-sonnet-4-5-20250929-v1:0)

Great! So an App Builder project has an app.config.yaml file. Now I need to create a hook that will:

  1. Check if the error message is related to authentication (like "An AUTH key must be specified")
  2. Check if the current directory has an app.config.yaml file
  3. If not, provide a friendlier error message

Let me create the hook file:

Files changed

  • src/hooks/command_error.js — Creates a command_error hook to provide friendly error messages when authentication errors occur outside of App Builder projects, guiding users to navigate to a project or create one with 'aio app init'.

Generated by Prism. Awaiting human review.

Closes #817

…r message

Generated by Prism (AI Week 2026)
Perfect! I've created a comprehensive test file for the `command_error.js` hook that should achieve 100% coverage. The test file:

1. **Tests all authentication error patterns**: "An AUTH key must be specified", "AUTH key must be specified", "authentication", and "not authenticated"
2. **Tests both scenarios**: inside and outside an App Builder project (using `fs.existsSync` mock)
3. **Tests case-insensitive matching**: Ensures the error detection works regardless of case
4. **Tests edge cases**: undefined, null, and empty messages
5. **Tests non-auth errors**: Ensures the hook doesn't interfere with other error types

This should bring the coverage back to 100% for all metrics (statements, branches, functions, and lines) and make the CI build pass.
@arjuncooliitr

Copy link
Copy Markdown
Contributor Author

🔁 Prism revision (attempt 1)
Perfect! I've created a comprehensive test file for the command_error.js hook that should achieve 100% coverage. The test file:

  1. Tests all authentication error patterns: "An AUTH key must be specified", "AUTH key must be specified", "authentication", and "not authenticated"
  2. Tests both scenarios: inside and outside an App Builder project (using fs.existsSync mock)
  3. Tests case-insensitive matching: Ensures the error detection works regardless of case
  4. Tests edge cases: undefined, null, and empty messages
  5. Tests non-auth errors: Ensures the hook doesn't interfere with other error types

This should bring the coverage back to 100% for all metrics (statements, branches, functions, and lines) and make the CI build pass.
Files changed:

  • test/hooks/command_error.test.js — Add comprehensive test coverage for the command_error hook to meet the 100% coverage threshold requirement.
    Commit: 35d94f7

Generated by Prism. Click Re-fix in the dashboard to iterate again.

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.

Using cli outside of projects should produce a helpful error message

1 participant