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
28 changes: 25 additions & 3 deletions .github/workflows/news-committee-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ This focused approach ensures:
## ⏱️ Time Budget (45 minutes)
- **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
- **Minutes 3–10**: Query MCP tools for committee reports data
- **Minutes 10–35**: Generate articles for all 14 languages
- **Minutes 35–42**: Validate and commit
- **Minutes 42–45**: Create PR with `safeoutputs___create_pull_request`
- **Minutes 10–25**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
- **Minutes 25–35**: Validate and fix any quality issues
- **Minutes 35–40**: Commit and create PR with `safeoutputs___create_pull_request`
- **Minutes 40–45**: Dispatch translation workflow

## ⚠️ CRITICAL: Bash Tool Call Format

Expand All @@ -143,6 +144,27 @@ bash({ command: "..." }) // ← WRONG: missing description

> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string.

## 🚫 CRITICAL: Article Generation Safety

**Articles MUST be generated using `npx tsx scripts/generate-news-enhanced.ts` — NEVER manually.**

The repository provides a complete article generation pipeline. You MUST use it (see Generation Steps below for the full `LANG_ARG` derivation from the `languages` dispatch input; default is `en,sv`):
```bash
source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types=committee-reports --languages="$LANG_ARG" --skip-existing
```

**❌ NEVER do any of the following:**
- NEVER use `python3` or `python3 -c` to build HTML article files
- NEVER create `.py` scripts to generate articles
- NEVER use bash heredoc (`cat > file << 'EOF'`) to write HTML files — it silently truncates large content
- NEVER manually construct HTML articles line-by-line with `echo`, `printf`, or any other method
- NEVER spend more than 5 minutes attempting to manually build article HTML

**If `generate-news-enhanced.ts` fails or returns 0 articles:**
1. Check if MCP data was returned (retry MCP calls if needed)
2. If still no data, use `safeoutputs___noop` with a descriptive message
3. Do NOT attempt to manually create articles as a fallback

## Required Skills

Before generating articles, consult these skills:
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/news-interpellations.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ If **force_generation** is `true`, generate articles even if recent ones exist.
## ⏱️ Time Budget (45 minutes)
- **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
- **Minutes 3–10**: Query MCP tools for interpellation data
- **Minutes 10–40**: Generate articles for all 14 languages
- **Minutes 40–43**: Validate and commit
- **Minutes 43–45**: Create PR with `safeoutputs___create_pull_request`
- **Minutes 10–25**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
- **Minutes 25–35**: Validate and fix any quality issues
- **Minutes 35–40**: Commit and create PR with `safeoutputs___create_pull_request`
- **Minutes 40–45**: Dispatch translation workflow

## ⚠️ CRITICAL: Bash Tool Call Format

Expand All @@ -139,6 +140,27 @@ bash({ command: "..." }) // ← WRONG: missing description

> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string.

## 🚫 CRITICAL: Article Generation Safety

**Articles MUST be generated using `npx tsx scripts/generate-news-enhanced.ts` — NEVER manually.**

The repository provides a complete article generation pipeline. You MUST use it (see Generation Steps below for the full `LANG_ARG` derivation from the `languages` dispatch input; default is `en,sv`):
```bash
source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types=interpellations --languages="$LANG_ARG" --skip-existing
```

**❌ NEVER do any of the following:**
- NEVER use `python3` or `python3 -c` to build HTML article files
- NEVER create `.py` scripts to generate articles (e.g., `build-en-article.py`)
- NEVER use bash heredoc (`cat > file << 'EOF'`) to write HTML files — it silently truncates large content
- NEVER manually construct HTML articles line-by-line with `echo`, `printf`, or any other method
- NEVER spend more than 5 minutes attempting to manually build article HTML

**If `generate-news-enhanced.ts` fails or returns 0 articles:**
1. Check if MCP data was returned (retry MCP calls if needed)
2. If still no data, use `safeoutputs___noop` with a descriptive message
3. Do NOT attempt to manually create articles as a fallback

## Required Skills

1. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/news-motions.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ If **force_generation** is `true`, generate articles even if recent ones exist.
## ⏱️ Time Budget (45 minutes)
- **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
- **Minutes 3–10**: Query MCP tools for motions data
- **Minutes 10–40**: Generate articles for all 14 languages
- **Minutes 40–43**: Validate and commit
- **Minutes 43–45**: Create PR with `safeoutputs___create_pull_request`
- **Minutes 10–25**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
- **Minutes 25–35**: Validate and fix any quality issues
- **Minutes 35–40**: Commit and create PR with `safeoutputs___create_pull_request`
- **Minutes 40–45**: Dispatch translation workflow

## ⚠️ CRITICAL: Bash Tool Call Format

Expand All @@ -139,6 +140,27 @@ bash({ command: "..." }) // ← WRONG: missing description

> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string.

## 🚫 CRITICAL: Article Generation Safety

**Articles MUST be generated using `npx tsx scripts/generate-news-enhanced.ts` — NEVER manually.**

The repository provides a complete article generation pipeline. You MUST use it (see Generation Steps below for the full `LANG_ARG` derivation from the `languages` dispatch input; default is `en,sv`):
```bash
source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types=motions --languages="$LANG_ARG" --skip-existing
```

**❌ NEVER do any of the following:**
- NEVER use `python3` or `python3 -c` to build HTML article files
- NEVER create `.py` scripts to generate articles
- NEVER use bash heredoc (`cat > file << 'EOF'`) to write HTML files — it silently truncates large content
- NEVER manually construct HTML articles line-by-line with `echo`, `printf`, or any other method
- NEVER spend more than 5 minutes attempting to manually build article HTML

**If `generate-news-enhanced.ts` fails or returns 0 articles:**
1. Check if MCP data was returned (retry MCP calls if needed)
2. If still no data, use `safeoutputs___noop` with a descriptive message
3. Do NOT attempt to manually create articles as a fallback

## Required Skills

1. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/news-propositions.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ If **force_generation** is `true`, generate articles even if recent ones exist.
## ⏱️ Time Budget (45 minutes)
- **Minutes 0–3**: Date check, MCP warm-up with `get_sync_status()`
- **Minutes 3–10**: Query MCP tools for propositions data
- **Minutes 10–35**: Generate articles for all 14 languages
- **Minutes 35–42**: Validate and commit
- **Minutes 42–45**: Create PR with `safeoutputs___create_pull_request`
- **Minutes 10–25**: Generate articles for core languages (EN, SV) using `npx tsx scripts/generate-news-enhanced.ts`
- **Minutes 25–35**: Validate and fix any quality issues
- **Minutes 35–40**: Commit and create PR with `safeoutputs___create_pull_request`
- **Minutes 40–45**: Dispatch translation workflow

## ⚠️ CRITICAL: Bash Tool Call Format

Expand All @@ -139,6 +140,27 @@ bash({ command: "..." }) // ← WRONG: missing description

> When you see fenced bash code blocks below (three backticks followed by bash), they show the **command content** to execute. You MUST wrap each in a proper bash tool call with both `command` and `description` parameters. For multi-line scripts, join commands with `&&` or `;` into a single `command` string.

## 🚫 CRITICAL: Article Generation Safety

**Articles MUST be generated using `npx tsx scripts/generate-news-enhanced.ts` — NEVER manually.**

The repository provides a complete article generation pipeline. You MUST use it (see Generation Steps below for the full `LANG_ARG` derivation from the `languages` dispatch input; default is `en,sv`):
```bash
source scripts/mcp-setup.sh && npx tsx scripts/generate-news-enhanced.ts --types=propositions --languages="$LANG_ARG" --skip-existing
```

**❌ NEVER do any of the following:**
- NEVER use `python3` or `python3 -c` to build HTML article files
- NEVER create `.py` scripts to generate articles
- NEVER use bash heredoc (`cat > file << 'EOF'`) to write HTML files — it silently truncates large content
- NEVER manually construct HTML articles line-by-line with `echo`, `printf`, or any other method
- NEVER spend more than 5 minutes attempting to manually build article HTML

**If `generate-news-enhanced.ts` fails or returns 0 articles:**
1. Check if MCP data was returned (retry MCP calls if needed)
2. If still no data, use `safeoutputs___noop` with a descriptive message
3. Do NOT attempt to manually create articles as a fallback

## Required Skills

1. **`.github/skills/swedish-political-system/SKILL.md`** — Parliamentary terminology
Expand Down
45 changes: 45 additions & 0 deletions tests/workflow-architecture.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,3 +806,48 @@ describe('Manual Article Generation Safety', () => {
}
});
});

describe('Script-Based Article Generation Safety', () => {
const SCRIPT_GENERATION_WORKFLOWS = [
'news-interpellations.md',
'news-propositions.md',
'news-motions.md',
'news-committee-reports.md',
];

it('script-based workflows should prohibit python3 article generation', () => {
for (const workflowFile of SCRIPT_GENERATION_WORKFLOWS) {
const filepath = path.join(WORKFLOWS_DIR, workflowFile);
expect(fs.existsSync(filepath), `Workflow file ${filepath} should exist`).toBe(true);
const content = fs.readFileSync(filepath, 'utf-8');
expect(
content.includes('NEVER use `python3`'),
`Workflow ${workflowFile} should prohibit python3 for article generation`
).toBe(true);
}
});

it('script-based workflows should prohibit manual HTML construction', () => {
for (const workflowFile of SCRIPT_GENERATION_WORKFLOWS) {
const filepath = path.join(WORKFLOWS_DIR, workflowFile);
expect(fs.existsSync(filepath), `Workflow file ${filepath} should exist`).toBe(true);
const content = fs.readFileSync(filepath, 'utf-8');
expect(
content.includes('NEVER manually construct HTML'),
`Workflow ${workflowFile} should prohibit manual HTML article construction`
).toBe(true);
}
});

it('script-based workflows should require generate-news-enhanced.ts', () => {
for (const workflowFile of SCRIPT_GENERATION_WORKFLOWS) {
const filepath = path.join(WORKFLOWS_DIR, workflowFile);
expect(fs.existsSync(filepath), `Workflow file ${filepath} should exist`).toBe(true);
const content = fs.readFileSync(filepath, 'utf-8');
expect(
content.includes('generate-news-enhanced.ts') && content.includes('Article Generation Safety'),
`Workflow ${workflowFile} should require generate-news-enhanced.ts in Article Generation Safety section`
).toBe(true);
}
});
});
Loading