Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5ce6d60
feat(translate): add no-overwrite strategy for human-reviewed transla…
luandro Apr 7, 2026
781a8f2
test(translate): add live Notion API integration test for no-overwrit…
luandro Apr 7, 2026
bedf64a
fix(translate): strip null icon and object fields from blocks before …
luandro Apr 7, 2026
c10688d
test(translate): add three-level hierarchy validation tests (Issue #171)
Apr 7, 2026
7e796cd
feat(translate): validate automated language options and harden autom…
luandro Apr 10, 2026
338542c
fix(translate): type-safe error handling and falsy-zero guards in sid…
luandro Apr 12, 2026
93922d5
test(translate): add three-level hierarchy validation tests
luandro Apr 12, 2026
b919d94
feat(translate): derive automated language validation from LANGUAGES …
luandro Apr 12, 2026
86ca417
test(constants): comprehensive coverage for automated-language export…
luandro Apr 12, 2026
edb4bfb
fix(scripts): check for S3 URL leaks during automated translation
luandro Apr 12, 2026
93173d4
refactor(scripts): use ms precision for timestamps and update tests
luandro Apr 12, 2026
429202e
refactor(scripts): export run() with import.meta.main guard and impro…
luandro Apr 13, 2026
544b166
fix(translate): require parent metadata for replay sidecars
luandro Apr 13, 2026
6fa2669
fix(translate): reuse parent relation property constant
luandro Apr 13, 2026
d46d423
fix(push-translation): parse frontmatter closing delimiter as a full …
luandro Apr 14, 2026
1e77693
fix(notion-translate): address PR review regressions
luandro Apr 14, 2026
0487e24
test(translate): mock data source schema retrieval
luandro Apr 14, 2026
6d167fa
fix: address pre/post-merge review feedback
luandro Apr 15, 2026
9f4fd69
test(no-overwrite): fix Scenario 11 stale warnSpy assertion
luandro Apr 15, 2026
f0888e2
fix(translate): prevent automated locales from outranking human-revie…
luandro Apr 15, 2026
34c578e
test(no-overwrite): de-duplicate page IDs across Scenarios 12 and 13
luandro Apr 15, 2026
218849f
fix(fetchNotionData): cast dataSourceId as string to satisfy TS narro…
luandro Apr 15, 2026
bc894fd
fix(translate): reset validation flag per main() call, throw on missi…
luandro Apr 15, 2026
46c2113
fix(workflow): include automatedTranslations in Notion status update …
luandro Apr 15, 2026
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@ telemetry-id
*.log
*.skill
api-server/flaky-test-counts.txt

# Automated translation output (never commit generated translations)
automated-translations/
10 changes: 10 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,13 @@ See `context/workflows/PRODUCTION_DEPLOYMENT.md` for complete workflow.
- Architecture & Lessons: `./NOTION_FETCH_ARCHITECTURE.md`
- Workflows: `./context/workflows/` (commands, lifecycle, translations, production deployment)
- Quick Lookups: `./context/quick-ref/` (mappings, status, examples)

## Approach
- Think before acting. Read existing files before writing code.
- Be concise in output but thorough in reasoning.
- Prefer editing over rewriting whole files.
- Do not re-read files you have already read unless the file may have changed.
- Test your code before declaring done.
- No sycophantic openers or closing fluff.
- Keep solutions simple and direct.
- User instructions always override this file.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"notion:export": "bun scripts/notion-fetch/exportDatabase.ts",
"notion:gen-placeholders": "bun scripts/notion-placeholders",
"notion:fetch-all": "bun scripts/notion-fetch-all",
"notion:push-translation": "bun scripts/push-new-translation-to-notion.ts",
"notion:translate-test": "bun scripts/run-single-page-translation.ts",
"api:server": "bun api-server",
"api:server:dev": "bun --watch api-server",
"clean:generated": "bun scripts/cleanup-generated-content.ts",
Expand Down
33 changes: 33 additions & 0 deletions scripts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,39 @@ export const LANGUAGES: TranslationConfig[] = [
},
];

export const AUTOMATED_OUTPUT_DIRS: Record<string, string> = {
"pt-BR": "./automated-translations/pt",
es: "./automated-translations/es",
};

/** Maps base Notion language names to their automated select option values. */
export const AUTOMATED_LANGUAGE_MAP: Record<string, string> = {
Portuguese: "PT - automated",
Spanish: "ES - automated",
};

export function isAutomatedLanguageCode(code: string): boolean {
return Object.values(AUTOMATED_LANGUAGE_MAP).includes(code);
}

export function getBaseLanguageCode(code: string): string {
for (const [base, automated] of Object.entries(AUTOMATED_LANGUAGE_MAP)) {
if (automated === code) return base;
}
return code;
}

export function getAutomatedLanguageCode(code: string): string {
if (isAutomatedLanguageCode(code)) return code; // already automated
// eslint-disable-next-line security/detect-object-injection -- code is a known language name from the AUTOMATED_LANGUAGE_MAP keys
return AUTOMATED_LANGUAGE_MAP[code] ?? `${code}-automated`;
}

export function getAutomatedOutputDir(language: string): string | undefined {
// eslint-disable-next-line security/detect-object-injection -- language is validated against known locale keys from AUTOMATED_OUTPUT_DIRS
return AUTOMATED_OUTPUT_DIRS[language];
}

// Maximum number of retries for API calls
export const MAX_RETRIES = 3;

Expand Down
2 changes: 2 additions & 0 deletions scripts/notion-fetch/generateBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ const LANGUAGE_NAME_TO_LOCALE: Record<string, string> = {
English: "en",
Spanish: "es",
Portuguese: "pt",
"PT - automated": "pt",
"ES - automated": "es",
};

const FALLBACK_TITLE_PREFIX = "untitled";
Expand Down
2 changes: 2 additions & 0 deletions scripts/notion-fetch/pageGrouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const LANGUAGE_NAME_TO_LOCALE: Record<string, string> = {
english: "en",
spanish: "es",
portuguese: "pt",
"pt - automated": "pt",
"es - automated": "es",
Comment thread
luandro marked this conversation as resolved.
en: "en",
es: "es",
pt: "pt",
Expand Down
Loading
Loading