laporan-generator 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,132 +1,122 @@
1
1
  ---
2
2
  name: laporan-generator
3
3
  description: >-
4
- Universal Academic Report & Thesis Generator for AI Agents. Use when the user wants
5
- to create, draft, format, or compile academic reports, thesis (skripsi/TA), internship reports (PKL),
6
- or scientific papers adhering to Indonesian & international campus standards.
4
+ Universal Academic Report & Thesis Generator with native MCP Tools for AI Agents.
5
+ Use when the user wants to scaffold, draft, write, format, audit, or compile academic documents:
6
+ skripsi, tesis, tugas akhir (TA), laporan PKL / magang, makalah kuliah, scientific papers,
7
+ research proposals, or graduation reports adhering to Indonesian university standards
8
+ (UI, ITB, UGM, ITS, Unpad, standard 4-4-3-3).
7
9
  ---
8
10
 
9
- # Laporan Generator AI Agent Skill
11
+ # Laporan Generator: World-Class Academic Document Engine for AI Agents
10
12
 
11
- This skill empowers AI coding agents to autonomously scaffold, draft, format, audit, and compile publication-grade academic documents using the bundled Typst and Pandoc engines.
13
+ This skill empowers AI agents (Antigravity, Claude Code, Cursor, OpenCode, Kiro) to autonomously scaffold, author, audit, and compile publication-grade academic documents and theses using the bundled **Typst (PDF)** and **Pandoc + OpenXML (Word DOCX)** dual engines with **Native Model Context Protocol (MCP)** tools.
12
14
 
13
15
  > [!CRITICAL]
14
- > **DO NOT WRITE RAW TYPST FILES FROM SCRATCH (e.g. `laporan.typ` or importing `@preview/ieee`).**
15
- > Never attempt to craft a monolithic `.typ` file or manually configure Typst margins and headers.
16
- > The engine uses a battle-tested **Modular Markdown Architecture**:
17
- > 1. Document metadata is defined in `metadata.yml`.
18
- > 2. Cover, preface, and outline are in `cover.md`.
19
- > 3. Document body is written in **pure standard Markdown** inside `chapters/bab*.md`.
20
- > 4. Bibliography is stored in BibTeX format in `references.bib`.
21
- > 5. Compilation to PDF (via Typst) and Word DOCX (via OpenXML) is handled automatically by `./laporan build` or `bash build.sh && make docx`.
16
+ > **MODULAR MARKDOWN ARCHITECTURE MANDATE**:
17
+ > - **DO NOT write raw Typst code from scratch (e.g. `laporan.typ` or importing `@preview/ieee`).**
18
+ > - **DO NOT create monolithic single-file documents.**
19
+ > The engine is strictly designed around clean modular components:
20
+ > 1. `metadata.yml`: Academic metadata (title, author, institution, faculty, year, campus preset).
21
+ > 2. `cover.md`: Cover page text, approval sheet, preface (kata pengantar), and abstract.
22
+ > 3. `chapters/`: Modular chapter files in standard Markdown (`bab1-pendahuluan.md`, `bab2-tinjauan-pustaka.md`, etc.).
23
+ > 4. `references.bib`: Standard BibTeX citation database.
24
+ > 5. `template.typ` & `docx.lua`: Bundled dual compilation engines.
22
25
 
23
26
  --------------------------------------------------------------------------------
24
27
 
25
- ## 1. Resource Locations & Scaffolding
26
-
27
- The full engine and templates are bundled in `resources/` inside this skill:
28
- - Location: `<skill_dir>/resources/` or `~/.agents/skills/laporan-generator/resources/`
29
-
30
- ### Starter & Template Files Included:
31
- - `metadata.yml`: Official academic metadata (title, author, institution, faculty, department, year, preset, fonts).
32
- - `cover.md`: Official academic cover page & abstract/kata pengantar.
33
- - `references.bib`: Standard academic citation database (BibTeX APA 7th).
34
- - `apa.csl`: APA 7th edition citation style file for Pandoc citeproc.
35
- - `logo.jpg`: Institution logo placeholder.
36
- - `chapters/`: Modular chapter templates:
37
- - `chapters/bab1-pendahuluan.md`: Background, problem formulation, objectives, scope.
38
- - `chapters/bab2-tinjauan-pustaka.md`: Theoretical framework, literature review.
39
- - `chapters/bab3-metodologi.md`: Research design, workflow, data collection.
40
- - `chapters/bab4-hasil-dan-pembahasan.md`: Implementation, experimental results, discussion.
41
- - `chapters/bab5-penutup.md`: Conclusions and future work recommendations.
42
- - `presets/`: Campus presets:
43
- - `standard.yml`: Standard university margins (2.5/2.5/2/3 cm)
44
- - `skripsi-4433.yml`: National standard skripsi/thesis (4/4/3/3 cm)
45
- - `ui-skripsi.yml`: Universitas Indonesia
46
- - `itb-ta.yml`: Institut Teknologi Bandung
47
- - `ugm-skripsi.yml`: Universitas Gadjah Mada
48
- - `its-skripsi.yml`: Institut Teknologi Sepuluh Nopember
49
- - `template.typ`: Typst typesetting engine (dual roman/arabic pagination, inverted pyramid title).
50
- - `reference.docx` & `docx.lua`: Pandoc OpenXML Word engine with page breaks & table formatting.
51
- - `build.sh`, `laporan`, `laporan.ps1`, `Makefile`: One-click compilation scripts.
52
-
53
- ### How to Scaffold a Project in Current Directory:
54
- If the workspace does not yet have `metadata.yml` or `chapters/`, run:
55
- ```bash
56
- # Copy all templates directly from bundled resources:
57
- cp -r ~/.agents/skills/laporan-generator/resources/* .
58
- # Or if npx is available:
59
- npx laporan-generator init
60
- ```
28
+ ## 1. Native MCP Tools & CLI Commands
61
29
 
62
- --------------------------------------------------------------------------------
30
+ When available in your environment, **always prefer calling the native MCP tools** for structured, deterministic execution:
63
31
 
64
- ## 2. Multi-Stage Interactive Protocol (Wajib)
65
-
66
- When the user requests an academic report or thesis, execute these 3 stages:
67
-
68
- ### Stage 1: Identification & Genre Selection
69
- Identify document type & campus target:
70
- 1. **Laporan Proyek / Praktikum / Tugas Besar**: Standard 5 chapters (`bab1` to `bab5`).
71
- 2. **Laporan Magang / PKL / KKN**: Executive summary, company profile, activity log, system analysis.
72
- 3. **Tugas Akhir / Skripsi**: Formal approval sheet, bilingual abstract, TOC, list of figures/tables, standard academic bibliography.
73
- 4. **Makalah Kuliah / Paper Akademik**: Makalah tugas kuliah di Indonesia tetap menggunakan format penomoran bab standar kampus (`BAB I`, `BAB II`, dst.) dengan angka Romawi secara default. HANYA gunakan `heading_chapter_prefix: ""` jika pengguna secara eksplisit meminta format artikel jurnal ilmiah internasional/manuskrip tanpa bab.
74
-
75
- ### Stage 2: Workspace Setup & Metadata Configuration
76
- 1. Scaffold workspace using `cp -r ~/.agents/skills/laporan-generator/resources/* .`
77
- 2. Edit `metadata.yml` with the user's specific details:
78
- - `title`: Inverted pyramid title
79
- - `author`: Array of authors with name and NIM/ID
80
- - `institution`, `faculty`, `department`, `year`
81
- - `preset`: Select appropriate campus preset (e.g. `skripsi-4433`, `itb-ta`, `ui-skripsi`, etc.)
82
- 3. Edit `cover.md` with appropriate preface, acknowledgments, or abstract.
83
-
84
- ### Stage 3: Drafting Chapters in Pure Markdown
85
- Write high quality content into separate files in `chapters/`:
86
- - `chapters/bab1-pendahuluan.md`
87
- - `chapters/bab2-tinjauan-pustaka.md`
88
- - `chapters/bab3-metodologi.md`
89
- - `chapters/bab4-hasil-dan-pembahasan.md`
90
- - `chapters/bab5-penutup.md`
91
-
92
- #### Formatting Rules for Chapters:
93
- - **Headings**: Use `# Judul Bab` for chapter level (e.g. `# Pendahuluan`), `## Sub-bab` for section level.
94
- - **Citations**: Use Pandoc syntax `[@citekey]` matching keys in `references.bib`.
95
- - **Formulas**: Inline `$E = m c^2$`, block `$$\sum_{i=1}^n x_i$$`.
96
- - **Currencies & Special Symbols**: Escape dollar signs in body text as `\$100` or write `100 USD` so Pandoc does not parse it as LaTeX math.
97
- - **Images**: Store images in `gambar/` and reference them as `![Caption](gambar/file.png)`. Never reference non-existent images.
32
+ | Action | Native MCP Tool | CLI Fallback |
33
+ | :--- | :--- | :--- |
34
+ | **Initialize Project** | `laporan_init({ preset, title, author_name, institution })` | `npx laporan-generator init` |
35
+ | **Audit & Health Check** | `laporan_doctor({ target_dir })` | `./laporan doctor` or `npx laporan-generator doctor --json` |
36
+ | **Document Stats & Metrics** | `laporan_stats({ target_dir })` | `./laporan stats` or `npx laporan-generator stats --json` |
37
+ | **Inspect Campus Presets** | `laporan_presets({ action: "list" \| "get", preset_name })` | `./laporan preset list` |
38
+ | **Search & Add Citations** | `laporan_citations({ action: "search_doi" \| "add_citation", query, doi })` | Manual edit `references.bib` |
39
+ | **Compile PDF & DOCX** | `laporan_build({ format: "all" \| "pdf" \| "docx" })` | `./laporan build` or `bash build.sh && make docx` |
98
40
 
99
41
  --------------------------------------------------------------------------------
100
42
 
101
- ## 3. Compilation & Verification Commands
43
+ ## 2. Multi-Stage Interactive Protocol (The 5-Stage Academic Production Protocol)
44
+
45
+ Always guide the user through these 5 structured stages:
46
+
47
+ ### Stage 1: Context Discovery & Genre Selection
48
+ Identify the document type and target university:
49
+ 1. **Tugas Akhir / Skripsi / Tesis**: Formal 5-chapter structure (BAB I - BAB V), bilingual abstract, approval sheet, standard university margins.
50
+ 2. **Laporan Magang / PKL / KKN**: Company profile, department scope, implemented system/project, troubleshooting analysis, recommendations.
51
+ 3. **Makalah Kuliah / Paper Ilmiah**: Focus on research problem, methodology, findings, and discussion. (In Indonesia, course papers use standard Roman Bab headings: `BAB I`, `BAB II`, etc.).
52
+ 4. **Target University Preset**:
53
+ - `skripsi-4433`: National Standard (Top 4cm, Left 4cm, Bottom 3cm, Right 3cm).
54
+ - `ui-skripsi`: Universitas Indonesia (Buku Panduan UI).
55
+ - `itb-ta`: Institut Teknologi Bandung (Pedoman TA ITB).
56
+ - `ugm-skripsi`: Universitas Gadjah Mada (Format Skripsi UGM).
57
+ - `its-skripsi`: Institut Teknologi Sepuluh Nopember.
58
+ - `unpad-skripsi`: Universitas Padjadjaran.
59
+ - `standard`: General University (2.5cm / 2cm).
60
+
61
+ ### Stage 2: Scaffolding & Metadata Configuration
62
+ 1. Initialize the workspace:
63
+ - Call MCP tool `laporan_init` or run `npx laporan-generator init`.
64
+ 2. Configure `metadata.yml`:
65
+ - `title`: Clear, concise, capitalized (rendered as inverted pyramid).
66
+ - `author`: Author array with `name` and `nim` (Student ID).
67
+ - `preset`: Selected university preset (e.g. `skripsi-4433`, `itb-ta`).
68
+ - `institution`, `faculty`, `department`, `year`.
69
+ 3. Configure `cover.md`: Set formal title, institutional affiliations, and kata pengantar.
70
+
71
+ ### Stage 3: Rigorous Academic Writing Standard
72
+ When authoring content into `chapters/bab*.md`, strictly enforce **Indonesian Standard Academic Tone**:
73
+ - **Objective & Impersonal**: Use passive constructions (*"Penelitian ini merancang sistem..."* instead of *"Saya merancang sistem..."*; *"Data diperoleh melalui pengujian..."* instead of *"Kami mengambil data..."*).
74
+ - **Zero AI Buzzwords / Clichés**:
75
+ - ❌ NEVER use: *"Dalam era globalisasi dan revolusi industri 4.0 yang serba cepat...", "Hal ini tentu sangat penting dan krusial...", "Tak dapat dipungkiri bahwa..."*
76
+ - ✔ INSTEAD: State facts, empirical evidence, concrete problem statements, and causal relationships immediately.
77
+ - **Heading Hygiene**:
78
+ - `# Judul Bab` for chapter level (e.g. `# Pendahuluan`, `# Tinjauan Pustaka`).
79
+ - `## Sub-bab` for section level (e.g. `## Latar Belakang Masalah`).
80
+ - ❌ NEVER write manual numbers in headings (e.g. NEVER `## 1.1 Latar Belakang` or `### 2.1.3 Analisis`). The engine automatically computes chapter and sub-chapter numbering based on the active university preset!
81
+
82
+ ### Stage 4: Citation Hygiene & Anti-Hallucination
83
+ - **NO FAKE CITATIONS**: Never invent fake paper titles, authors, or DOIs.
84
+ - Use MCP tool `laporan_citations` with `action: "search_doi"` to search real papers on Crossref.
85
+ - Add verified BibTeX to `references.bib` via `laporan_citations` (`action: "add_citation"`).
86
+ - Reference citations in markdown body using Pandoc syntax:
87
+ - Single citation: `[@citekey]`
88
+ - Narrative citation: `@citekey menyatakan bahwa...`
89
+ - Multiple citations: `[@citekey1; @citekey2]`
90
+
91
+ ### Stage 5: Pre-Flight Audit & Dual-Compilation
92
+ 1. Run pre-flight health audit:
93
+ - Call MCP tool `laporan_doctor` or run `./laporan doctor`.
94
+ - Ensure `missing_keys` is 0 and `broken_images` is 0.
95
+ 2. Compile both outputs:
96
+ - Call MCP tool `laporan_build` or run `./laporan build`.
97
+ - Produces:
98
+ - `Laporan.pdf`: Pixel-perfect publication PDF rendered by Typst.
99
+ - `Laporan.docx`: Fully formatted Word document with dual page numbering (Roman `i, ii, iii` for front-matter, Arabic `1, 2, 3` for chapters) and native Word Table of Contents.
102
100
 
103
- Compile both PDF & Word DOCX:
104
- ```bash
105
- ./laporan build
106
- # Atau manual:
107
- bash build.sh && make docx
108
- ```
101
+ --------------------------------------------------------------------------------
109
102
 
110
- Audit document health & check for broken images or missing citation keys:
111
- ```bash
112
- ./laporan doctor
113
- # Atau:
114
- python3 scripts/report-doctor.py
115
- ```
103
+ ## 3. Formatting Rules & Syntax Guardrails
116
104
 
117
- Analyze word count, statistics & distribution:
118
- ```bash
119
- ./laporan stats
120
- ```
105
+ | Element | Correct Syntax | Common Pitfall to Avoid |
106
+ | :--- | :--- | :--- |
107
+ | **Currencies & Special Symbols** | `\$100` or `100 USD` | Unescaped `$100` triggers math mode parsing failure |
108
+ | **Mathematical Formulas** | Inline: `$E = m c^2$`<br/>Block: `$$\\sum_{i=1}^n x_i$$` | Multiple unescaped `$` on the same page |
109
+ | **Images & Figures** | `![Diagram Arsitektur](gambar/arsitektur.png)` | Referencing non-existent files or absolute paths |
110
+ | **Tables** | Standard Markdown pipe tables with headers | Box-drawing characters (┌, ─, └, │) in markdown |
111
+ | **Code Blocks** | Standard triple backticks with language specifier | Monolithic raw typst code |
121
112
 
122
113
  --------------------------------------------------------------------------------
123
114
 
124
- ## 4. Common AI Pitfalls to Avoid
115
+ ## 4. Troubleshooting & Self-Correction Runbook
125
116
 
126
- | Pitfall | Why It Fails | Correct Solution |
127
- | :--- | :--- | :--- |
128
- | **Writing `.typ` files manually** | Creates syntax errors, breaks DOCX export, loses presets | Always write Markdown in `chapters/bab*.md` and let the engine compile. |
129
- | **`#import "@preview/ieee"`** | Offline environments fail with package not found | Use the bundled self-contained `template.typ`. |
130
- | **Unescaped `$` in text** | Treated as math mode delimiter causing syntax errors | Use `\$10,000` or text `10,000 USD`. |
131
- | **Missing images** | Referenced images not present cause build failure | Ensure images exist in `gambar/` before referencing. |
132
- | **Monolithic single file** | Incompatible with multi-pass DOCX and chapter numbering | Keep chapters strictly split into `chapters/bab*.md`. |
117
+ - **Missing Pandoc or Typst**:
118
+ - Run `npx laporan-generator setup` to automatically install dependencies for Ubuntu/Debian, Arch Linux, macOS, Nix, or Windows.
119
+ - **Citation "@key" not found**:
120
+ - Call `laporan_citations({ action: "validate" })` to check all existing keys in `references.bib`.
121
+ - **Word DOCX Table of Contents alignment**:
122
+ - Built-in `finalize-docx.py` automatically computes page width and right-aligns tab leader dots for Heading 1, Heading 2, and Heading 3.
@@ -27,7 +27,7 @@ export PYTHONUTF8=1
27
27
  show_banner() {
28
28
  echo -e "${CYAN}${BOLD}"
29
29
  echo " ========================================================"
30
- echo " LAPORAN GENERATOR CLI v2.6.0 "
30
+ echo " LAPORAN GENERATOR CLI v2.7.0 "
31
31
  echo " Otomatisasi Dokumen Akademik (Typst + DOCX Engine) "
32
32
  echo " ========================================================"
33
33
  echo -e "${NC}"
@@ -38,6 +38,7 @@ show_help() {
38
38
  echo -e "${BOLD}Penggunaan:${NC} ./laporan <perintah>"
39
39
  echo ""
40
40
  echo -e "${BOLD}Perintah yang Tersedia:${NC}"
41
+ echo -e " ${GREEN}mcp${NC} Jalankan Model Context Protocol (MCP) Server untuk AI Agent"
41
42
  echo -e " ${GREEN}build${NC} Kompilasi PDF dan DOCX sekaligus"
42
43
  echo -e " ${GREEN}pdf${NC} Kompilasi dokumen PDF (via Typst)"
43
44
  echo -e " ${GREEN}docx${NC} Kompilasi dokumen Microsoft Word (.docx)"
@@ -47,7 +48,7 @@ show_help() {
47
48
  echo -e " ${GREEN}doctor${NC} Audit kesehatan proyek (broken images, sitasi hilang, dll.)"
48
49
  echo -e " ${GREEN}bundle${NC} Kemas seluruh laporan (PDF, DOCX, MD) menjadi arsip zip"
49
50
  echo -e " ${GREEN}setup${NC} Pasang dependensi sistem otomatis (Linux, macOS, Nix, Docker)"
50
- echo -e " ${GREEN}sync-skills${NC} Sinkronkan skill AI agent ke Antigravity, Claude, Gemini, Grok"
51
+ echo -e " ${GREEN}sync-skills${NC} Sinkronkan skill AI agent & MCP ke Antigravity, Claude, OpenCode"
51
52
  echo -e " ${GREEN}uninstall${NC} Hapus integrasi skill dan perintah AI agent dari seluruh sistem"
52
53
  echo -e " ${GREEN}check${NC} Audit dependensi sistem dan struktur proyek"
53
54
  echo -e " ${GREEN}test${NC} Jalankan suite pengujian otomatis (test.sh)"
@@ -424,16 +425,48 @@ case "${1:-help}" in
424
425
  setup)
425
426
  bash scripts/setup-deps.sh
426
427
  ;;
428
+ mcp|server)
429
+ shift
430
+ if command -v node >/dev/null 2>&1; then
431
+ if [ -f "bin/mcp-server.js" ]; then
432
+ node bin/mcp-server.js "$@"
433
+ elif command -v npx >/dev/null 2>&1; then
434
+ npx -y laporan-generator mcp "$@"
435
+ else
436
+ echo "Berkas bin/mcp-server.js tidak ditemukan dan npx tidak tersedia."
437
+ exit 1
438
+ fi
439
+ else
440
+ echo "Node.js diperlukan untuk menjalankan MCP Server."
441
+ exit 1
442
+ fi
443
+ ;;
427
444
  sync-skills|sync-hosts)
445
+ shift
428
446
  if command -v node >/dev/null 2>&1; then
429
- node bin/laporan-generator.js sync-hosts
447
+ if [ -f "bin/laporan-generator.js" ]; then
448
+ node bin/laporan-generator.js sync-hosts "$@"
449
+ elif command -v npx >/dev/null 2>&1; then
450
+ npx -y laporan-generator sync-hosts "$@"
451
+ else
452
+ echo "Berkas bin/laporan-generator.js tidak ditemukan dan npx tidak tersedia."
453
+ exit 1
454
+ fi
430
455
  else
431
456
  echo "Node.js diperlukan untuk sinkronisasi multi-host AI agent."
432
457
  fi
433
458
  ;;
434
459
  uninstall|clean-skills)
460
+ shift
435
461
  if command -v node >/dev/null 2>&1; then
436
- node bin/laporan-generator.js uninstall
462
+ if [ -f "bin/laporan-generator.js" ]; then
463
+ node bin/laporan-generator.js uninstall "$@"
464
+ elif command -v npx >/dev/null 2>&1; then
465
+ npx -y laporan-generator uninstall "$@"
466
+ else
467
+ echo "Berkas bin/laporan-generator.js tidak ditemukan dan npx tidak tersedia."
468
+ exit 1
469
+ fi
437
470
  else
438
471
  echo "Node.js diperlukan untuk membersihkan integrasi AI agent."
439
472
  fi
@@ -9,7 +9,9 @@ param (
9
9
  [Parameter(Position=2)]
10
10
  [string]$Arg1 = "",
11
11
  [Parameter(Position=3)]
12
- [string]$Arg2 = ""
12
+ [string]$Arg2 = "",
13
+ [Parameter(ValueFromRemainingArguments=$true)]
14
+ [string[]]$RemainingArgs
13
15
  )
14
16
 
15
17
  $ErrorActionPreference = "Stop"
@@ -38,7 +40,7 @@ function Get-PythonCommand {
38
40
 
39
41
  function Show-Banner {
40
42
  Write-Host " ========================================================" -ForegroundColor Cyan
41
- Write-Host " LAPORAN GENERATOR CLI v2.6.0 " -ForegroundColor Cyan
43
+ Write-Host " LAPORAN GENERATOR CLI v2.7.0 " -ForegroundColor Cyan
42
44
  Write-Host " Otomatisasi Dokumen Akademik (Typst + DOCX Engine) " -ForegroundColor Cyan
43
45
  Write-Host " ========================================================" -ForegroundColor Cyan
44
46
  Write-Host ""
@@ -58,7 +60,7 @@ function Show-Help {
58
60
  Write-Host " doctor Audit kesehatan proyek (broken images, sitasi hilang, dll.)" -ForegroundColor Green
59
61
  Write-Host " bundle Kemas seluruh laporan (PDF, DOCX, MD) menjadi arsip zip" -ForegroundColor Green
60
62
  Write-Host " setup Pasang dependensi sistem otomatis Windows (Typst, Pandoc, Magick)" -ForegroundColor Green
61
- Write-Host " sync-skills Sinkronkan skill AI agent ke Antigravity, Claude, Gemini, Grok" -ForegroundColor Green
63
+ Write-Host " sync-skills Sinkronkan skill AI agent ke Antigravity, Claude, Grok" -ForegroundColor Green
62
64
  Write-Host " check Audit dependensi sistem dan struktur proyek" -ForegroundColor Green
63
65
  Write-Host " test Jalankan suite pengujian otomatis" -ForegroundColor Green
64
66
  Write-Host " view Buka dokumen Laporan.pdf di PDF viewer" -ForegroundColor Green
@@ -334,22 +336,29 @@ preset: "$escPreset"
334
336
  Write-Host "Jalankan '.\laporan.ps1 build' untuk mulai menghasilkan laporan." -ForegroundColor Cyan
335
337
  }
336
338
 
337
- function Cmd-Test {
338
- Show-Banner
339
- Write-Host "Menjalankan Test Suite..." -ForegroundColor Blue
340
- $gitBash = "C:\Program Files\Git\bin\bash.exe"
341
- $bashCmd = if (Test-Path $gitBash) { $gitBash } elseif ((Get-Command "bash" -ErrorAction SilentlyContinue) -and (Get-Command "bash").Source -notmatch "system32\\bash\.exe") { "bash" } else { "" }
342
- if ($bashCmd) {
343
- & $bashCmd test.sh
344
- } else {
345
- $pyCmd = Get-PythonCommand
346
- if ($pyCmd) {
347
- Write-Host "Menjalankan validasi skema preset..." -ForegroundColor Blue
348
- & $pyCmd scripts/validate-preset.py --all
349
- } else {
350
- Write-Host "Test suite membutuhkan bash atau python3." -ForegroundColor Yellow
351
- }
352
- }
339
+ function Cmd-Test {
340
+ Show-Banner
341
+ Write-Host "Menjalankan Test Suite..." -ForegroundColor Blue
342
+ $gitBash = "C:\Program Files\Git\bin\bash.exe"
343
+ $bashCmd = if (Test-Path $gitBash) { $gitBash } elseif ((Get-Command "bash" -ErrorAction SilentlyContinue) -and (Get-Command "bash").Source -notmatch "system32\\bash\.exe") { "bash" } else { "" }
344
+ if ($bashCmd -and (Test-Path "test.sh")) {
345
+ & $bashCmd test.sh
346
+ } else {
347
+ $pyCmd = Get-PythonCommand
348
+ if ($pyCmd) {
349
+ Write-Host "Menjalankan validasi skema preset..." -ForegroundColor Blue
350
+ if (Test-Path "scripts/validate-preset.py") {
351
+ & $pyCmd scripts/validate-preset.py --all
352
+ }
353
+ if (Test-Path "scripts/test_scripts.py") {
354
+ Write-Host ""
355
+ Write-Host "Menjalankan unit test skrip Python..." -ForegroundColor Blue
356
+ & $pyCmd scripts/test_scripts.py
357
+ }
358
+ } else {
359
+ Write-Host "Test suite membutuhkan bash atau python3." -ForegroundColor Yellow
360
+ }
361
+ }
353
362
  }
354
363
 
355
364
  function Cmd-Preset {
@@ -446,27 +455,30 @@ function Cmd-Clean {
446
455
  }
447
456
 
448
457
  function Cmd-Stats {
458
+ param([string[]]$ArgsList)
449
459
  $pyCmd = Get-PythonCommand
450
460
  if ($pyCmd) {
451
- & $pyCmd scripts/report-stats.py
461
+ & $pyCmd scripts/report-stats.py @ArgsList
452
462
  } else {
453
463
  Write-Host "Error: Python 3 tidak ditemukan." -ForegroundColor Red
454
464
  }
455
465
  }
456
466
 
457
467
  function Cmd-Doctor {
468
+ param([string[]]$ArgsList)
458
469
  $pyCmd = Get-PythonCommand
459
470
  if ($pyCmd) {
460
- & $pyCmd scripts/report-doctor.py
471
+ & $pyCmd scripts/report-doctor.py @ArgsList
461
472
  } else {
462
473
  Write-Host "Error: Python 3 tidak ditemukan." -ForegroundColor Red
463
474
  }
464
475
  }
465
476
 
466
477
  function Cmd-Bundle {
478
+ param([string[]]$ArgsList)
467
479
  $pyCmd = Get-PythonCommand
468
480
  if ($pyCmd) {
469
- & $pyCmd scripts/bundle.py
481
+ & $pyCmd scripts/bundle.py @ArgsList
470
482
  } else {
471
483
  Write-Host "Error: Python 3 tidak ditemukan." -ForegroundColor Red
472
484
  }
@@ -518,25 +530,59 @@ function Cmd-Watch {
518
530
  }
519
531
  }
520
532
 
533
+ $extraArgs = @()
534
+ if ($SubCommand) { $extraArgs += $SubCommand }
535
+ if ($Arg1) { $extraArgs += $Arg1 }
536
+ if ($Arg2) { $extraArgs += $Arg2 }
537
+ if ($RemainingArgs) { $extraArgs += $RemainingArgs }
538
+
521
539
  switch ($Command.ToLower()) {
522
540
  "build" { Cmd-Build }
523
541
  "pdf" { Cmd-Build-PDF }
524
542
  "docx" { Cmd-Build-DOCX }
525
543
  "init" { Cmd-Init }
526
- "stats" { Cmd-Stats }
527
- "doctor" { Cmd-Doctor }
528
- "bundle" { Cmd-Bundle }
529
- "setup" { & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "scripts\setup-deps.ps1") }
544
+ "stats" { Cmd-Stats $extraArgs }
545
+ "doctor" { Cmd-Doctor $extraArgs }
546
+ "bundle" { Cmd-Bundle $extraArgs }
547
+ "setup" { & powershell -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot "scripts\setup-deps.ps1") }
548
+ "mcp" {
549
+ if (Get-Command "node" -ErrorAction SilentlyContinue) {
550
+ $mcpPath = Join-Path $PSScriptRoot "bin\mcp-server.js"
551
+ if (Test-Path $mcpPath) {
552
+ node $mcpPath @extraArgs
553
+ } elseif (Get-Command "npx" -ErrorAction SilentlyContinue) {
554
+ npx -y laporan-generator mcp @extraArgs
555
+ } else {
556
+ Write-Host "bin\mcp-server.js tidak ditemukan dan npx tidak tersedia." -ForegroundColor Red
557
+ }
558
+ } else {
559
+ Write-Host "Node.js diperlukan untuk menjalankan MCP Server." -ForegroundColor Yellow
560
+ }
561
+ }
530
562
  "sync-skills" {
531
563
  if (Get-Command "node" -ErrorAction SilentlyContinue) {
532
- node (Join-Path $PSScriptRoot "bin\laporan-generator.js") sync-hosts
564
+ $genPath = Join-Path $PSScriptRoot "bin\laporan-generator.js"
565
+ if (Test-Path $genPath) {
566
+ node $genPath sync-hosts @extraArgs
567
+ } elseif (Get-Command "npx" -ErrorAction SilentlyContinue) {
568
+ npx -y laporan-generator sync-hosts @extraArgs
569
+ } else {
570
+ Write-Host "bin\laporan-generator.js tidak ditemukan dan npx tidak tersedia." -ForegroundColor Red
571
+ }
533
572
  } else {
534
573
  Write-Host "Node.js diperlukan untuk sinkronisasi multi-host AI agent." -ForegroundColor Yellow
535
574
  }
536
575
  }
537
576
  "sync-hosts" {
538
577
  if (Get-Command "node" -ErrorAction SilentlyContinue) {
539
- node (Join-Path $PSScriptRoot "bin\laporan-generator.js") sync-hosts
578
+ $genPath = Join-Path $PSScriptRoot "bin\laporan-generator.js"
579
+ if (Test-Path $genPath) {
580
+ node $genPath sync-hosts @extraArgs
581
+ } elseif (Get-Command "npx" -ErrorAction SilentlyContinue) {
582
+ npx -y laporan-generator sync-hosts @extraArgs
583
+ } else {
584
+ Write-Host "bin\laporan-generator.js tidak ditemukan dan npx tidak tersedia." -ForegroundColor Red
585
+ }
540
586
  } else {
541
587
  Write-Host "Node.js diperlukan untuk sinkronisasi multi-host AI agent." -ForegroundColor Yellow
542
588
  }
@@ -15,8 +15,17 @@ NC = "\033[0m"
15
15
 
16
16
 
17
17
  def main():
18
- root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
19
- os.chdir(root)
18
+ pos_args = [a for a in sys.argv[1:] if not a.startswith("-")]
19
+
20
+ target_dir = os.getcwd()
21
+ if pos_args:
22
+ target_dir = os.path.abspath(pos_args[0])
23
+ elif not (os.path.isfile(os.path.join(target_dir, "metadata.yml")) or os.path.isdir(os.path.join(target_dir, "chapters"))):
24
+ pkg_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
25
+ if os.path.isfile(os.path.join(pkg_root, "metadata.yml")):
26
+ target_dir = pkg_root
27
+
28
+ os.chdir(target_dir)
20
29
 
21
30
  print(f"{CYAN}{BOLD}")
22
31
  print(" ========================================================")