Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions scripts/bundle-shared.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const CHANNELS_CJS = [
];

const targets = [
{
entry: path.resolve(__dirname, 'parsers', 'directives.ts'),
out: path.join(outDir, 'parsers.bundle.mjs'),
},
{
entry: require.resolve('@tutorials/core'),
out: path.join(outDir, 'core.bundle.mjs'),
Expand Down
8 changes: 7 additions & 1 deletion srv/lib/freshness-detector.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { extractCodeBlocks, extractTutorialContext } from './freshness-extract.j
import { groundCodeBlock } from './freshness-grounding.js';
import { resolveChatLlmSettings } from './chat-settings-resolver.js';
import { tokensToCents } from './_token-cost.js';
import { renderDirectivesAsText } from '../../scripts/parsers/directives.js';

const LOG = cds.log('freshness-detector');
const TOOL_NAME = 'submit_freshness_findings';
Expand Down Expand Up @@ -286,6 +285,13 @@ export async function detectFreshness({ db, tutorialId }) {

// Strip directive syntax (:::details, :kbd[, etc.) so the model sees
// plain prose rather than raw CommonMark directive fences.
// Workspace-first / bundle fallback: directives.ts is not compiled to .js;
// the CF deploy copies only srv/ (not scripts/parsers/), so we fall back to
// the pre-built bundle at _shared/parsers.bundle.mjs.
let _directivesMod;
try { _directivesMod = await import('../../scripts/parsers/directives.js'); }
catch { _directivesMod = await import('./_shared/parsers.bundle.mjs'); }
const renderDirectivesAsText = _directivesMod.renderDirectivesAsText;
const markdown = renderDirectivesAsText(src.markdown);

// Feed whole-tutorial markdown as ONE pseudo-step so extractCodeBlocks
Expand Down
Loading