Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
db06cd7
feat(askai): add Kapa.ai source group filtering for InfluxDB v3
jstirnaman Nov 10, 2025
813f83f
refactor(ask-ai): change version format to 'My version: <product name>'
jstirnaman Nov 12, 2025
e406af3
fix(ask-ai): restore working Kapa.open() pre-fill implementation
jstirnaman Nov 12, 2025
75b7f82
fix(ask-ai): remove parentheses from example questions for consistency
jstirnaman Nov 12, 2025
9c89863
fix(askai): add Explorer product mapping for Ask AI widget
jstirnaman Nov 12, 2025
4c0779c
test(page-context): add comprehensive e2e tests for product mappings
jstirnaman Nov 12, 2025
eb0aa9c
feat(test): add --no-mapping flag to e2e test runner
jstirnaman Nov 12, 2025
ca9440c
deps: update caniuse and related hook files
jstirnaman Nov 12, 2025
0185385
test: Add a `--no-mapping` flag to run tests without specific content…
jstirnaman Nov 12, 2025
0ad2b75
chore(ask-ai): Format example questions
jstirnaman Nov 12, 2025
b81bf84
test(page-context): add comprehensive e2e tests for all products in p…
jstirnaman Nov 12, 2025
c2a49b1
fix(page-context): correct enterprise_influxdb URL pattern matching
jstirnaman Nov 12, 2025
d675e82
test(page-context): add UI validation for Ask AI widget configuration
jstirnaman Nov 12, 2025
2d3f0e4
Merge branch 'master' into jts-askai-group-filters
jstirnaman Nov 12, 2025
3289052
feat(ask-ai): add help in Ask AI widget placeholder
jstirnaman Nov 12, 2025
90fc81b
feat(ask-ai): Tailors placeholder for each version/product. Disables …
jstirnaman Nov 17, 2025
40edd44
Merge branch 'master' into jts-askai-group-filters
jstirnaman Nov 17, 2025
34e5985
Merge branch 'master' into jts-askai-group-filters
jstirnaman Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions .github/instructions/layouts.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ applyTo: "layouts/**/*.html"

When creating or modifying Hugo layouts and shortcodes:

1. Use Hugo template syntax and functions
2. Follow existing patterns in `/layouts/shortcodes/`
3. Test in [content/example.md](../../content/example.md)
4. Document new shortcodes in [DOCS-SHORTCODES.md](../../DOCS-SHORTCODES.md)
1. Use test-driven development using `/cypress/`
2. Use Hugo template syntax and functions
3. Follow existing patterns in `/layouts/shortcodes/`
4. Test in [content/example.md](../../content/example.md)
5. Document new shortcodes in [DOCS-SHORTCODES.md](../../DOCS-SHORTCODES.md)

## Shortcode Pattern

Expand All @@ -30,9 +31,32 @@ When creating or modifying Hugo layouts and shortcodes:

## Testing

Add usage examples to `content/example.md` to verify:
**IMPORTANT:** Use test-driven development with Cypress.

Add shortcode usage examples to `content/example.md` to verify:

- Rendering in browser
- Hugo build succeeds
- No console errors
- JavaScript functionality works as expected (check browser console for errors)
- Interactive elements behave correctly (click links, buttons, etc.)

### TDD Workflow

1. Add Cypress tests (high-level to start).
2. Run tests and make sure they fail.
3. Implement code changes
4. Run tests and make sure they pass.
5. Add and refine tests.
6. Repeat.

### Manual Testing Workflow

1. Make changes to shortcode/layout files
2. Wait for Hugo to rebuild (check terminal output)
3. Get the server URL from the log
4. Open browser DevTools console (F12)
5. Test the functionality and check for JavaScript errors
6. Verify the feature works as intended before marking complete

See [DOCS-SHORTCODES.md](../../DOCS-SHORTCODES.md) for complete shortcode documentation.
16 changes: 14 additions & 2 deletions .husky/_/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ call_lefthook()
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif go tool lefthook -h >/dev/null 2>&1
then
go tool lefthook "$@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
Expand All @@ -42,12 +45,21 @@ call_lefthook()
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
elif swift package lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
swift package --build-path .build/lefthook --disable-sandbox lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
elif uv run lefthook -h >/dev/null 2>&1
then
uv run lefthook "$@"
elif mise exec -- lefthook -h >/dev/null 2>&1
then
mise exec -- lefthook "$@"
elif devbox run lefthook -h >/dev/null 2>&1
then
devbox run lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
Expand Down
16 changes: 14 additions & 2 deletions .husky/_/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ call_lefthook()
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif go tool lefthook -h >/dev/null 2>&1
then
go tool lefthook "$@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
Expand All @@ -42,12 +45,21 @@ call_lefthook()
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
elif swift package lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
swift package --build-path .build/lefthook --disable-sandbox lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
elif uv run lefthook -h >/dev/null 2>&1
then
uv run lefthook "$@"
elif mise exec -- lefthook -h >/dev/null 2>&1
then
mise exec -- lefthook "$@"
elif devbox run lefthook -h >/dev/null 2>&1
then
devbox run lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
Expand Down
16 changes: 14 additions & 2 deletions .husky/_/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ call_lefthook()
then
"$dir/node_modules/lefthook/bin/index.js" "$@"

elif go tool lefthook -h >/dev/null 2>&1
then
go tool lefthook "$@"
elif bundle exec lefthook -h >/dev/null 2>&1
then
bundle exec lefthook "$@"
Expand All @@ -42,12 +45,21 @@ call_lefthook()
elif pnpm lefthook -h >/dev/null 2>&1
then
pnpm lefthook "$@"
elif swift package plugin lefthook >/dev/null 2>&1
elif swift package lefthook >/dev/null 2>&1
then
swift package --disable-sandbox plugin lefthook "$@"
swift package --build-path .build/lefthook --disable-sandbox lefthook "$@"
elif command -v mint >/dev/null 2>&1
then
mint run csjones/lefthook-plugin "$@"
elif uv run lefthook -h >/dev/null 2>&1
then
uv run lefthook "$@"
elif mise exec -- lefthook -h >/dev/null 2>&1
then
mise exec -- lefthook "$@"
elif devbox run lefthook -h >/dev/null 2>&1
then
devbox run lefthook "$@"
else
echo "Can't find lefthook in PATH"
fi
Expand Down
104 changes: 101 additions & 3 deletions assets/js/ask-ai-trigger.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,117 @@
import AskAI from './ask-ai.js';

/**
* Global state for Ask AI initialization
*/
const state = {
kapaInitialized: false,
linksListenerInitialized: false,
};

/**
* Initialize the Kapa widget
*/
function initializeKapa() {
if (!state.kapaInitialized) {
AskAI();
state.kapaInitialized = true;

// Store in global namespace for debugging
window.influxdatadocs = window.influxdatadocs || {};
window.influxdatadocs.kapaInitialized = true;
}
}

/**
* Show the trigger button by removing inline display: none style
* @param {HTMLElement} element - The trigger button element
*/
function showTrigger(element) {
// Remove the inline display: none style
element.removeAttribute('style');
if (element) {
element.removeAttribute('style');
}
}

/**
* Initialize Ask AI trigger button component
* @param {Object} options - Component options
* @param {HTMLElement} options.component - The trigger button element
*/
export default function AskAITrigger({ component }) {
const kapaContainer = document.querySelector('#kapa-widget-container');

if (!component && !kapaContainer) {
return;
}

if (!kapaContainer) {
// Initialize the chat widget
AskAI({ onChatLoad: () => showTrigger(component) });
state.kapaInitialized = true;
window.influxdatadocs = window.influxdatadocs || {};
window.influxdatadocs.kapaInitialized = true;
} else {
showTrigger(component);
}
}
}

/**
* Handle ask-ai-link clicks globally
* This ensures ask-ai-link shortcodes work even without the trigger button
*/
function handleAskAILinks() {
if (state.linksListenerInitialized) {
return;
}

state.linksListenerInitialized = true;

// Store in global namespace for debugging
window.influxdatadocs = window.influxdatadocs || {};
window.influxdatadocs.askAILinksInitialized = true;

// Listen for clicks on ask-ai-link elements
document.addEventListener(
'click',
(event) => {
const link = event.target.closest('.ask-ai-open');
if (!link) return;

const query = link.getAttribute('data-query');

// Initialize Kapa if not already done
if (!state.kapaInitialized) {
initializeKapa();

// Wait for Kapa to be ready, then open with query
if (query && window.Kapa?.open) {
// Give Kapa a moment to initialize
setTimeout(() => {
if (window.Kapa?.open) {
window.Kapa.open({
mode: 'ai',
query: query,
});
}
}, 100);
}
} else {
// Kapa is already initialized - open with query if provided
if (query && window.Kapa?.open) {
window.Kapa.open({
mode: 'ai',
query: query,
});
}
}
},
{ passive: true }
);
}

// Initialize ask-ai-link handling when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', handleAskAILinks);
} else {
handleAskAILinks();
}
108 changes: 0 additions & 108 deletions assets/js/ask-ai.js

This file was deleted.

Loading