Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

refactor(skills): merge check_fillable_fields into extract_form_field_info

Jiayuan Zhang1140f096324c
diff --git a/skills/pdf/forms.md b/skills/pdf/forms.md
index 6e7e1e0d9e..2dece27cea 100644
--- a/skills/pdf/forms.md
+++ b/skills/pdf/forms.md
@@ -1,7 +1,7 @@
**CRITICAL: You MUST complete these steps in order. Do not skip ahead to writing code.**
If you need to fill out a PDF form, first check to see if the PDF has fillable form fields. Run this script from this file's directory:
- `python scripts/check_fillable_fields <file.pdf>`, and depending on the result go to either the "Fillable fields" or "Non-fillable fields" and follow those instructions.
+ `python scripts/extract_form_field_info.py --check <file.pdf>`, and depending on the result go to either the "Fillable fields" or "Non-fillable fields" and follow those instructions.
# Fillable fields
If the PDF has fillable form fields:
diff --git a/skills/pdf/scripts/check_fillable_fields.py b/skills/pdf/scripts/check_fillable_fields.py
deleted file mode 100644
index 36dfb9513e..0000000000
--- a/skills/pdf/scripts/check_fillable_fields.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import sys
-from pypdf import PdfReader
-
-
-
-
-reader = PdfReader(sys.argv[1])
-if (reader.get_fields()):
- print("This PDF has fillable form fields")
-else:
- print("This PDF does not have fillable form fields; you will need to visually determine where to enter data")
diff --git a/skills/pdf/scripts/extract_form_field_info.py b/skills/pdf/scripts/extract_form_field_info.py
index 64cd4703a4..1a07842d59 100644
--- a/skills/pdf/scripts/extract_form_field_info.py
+++ b/skills/pdf/scripts/extract_form_field_info.py
@@ -116,7 +116,18 @@ def write_field_info(pdf_path: str, json_output_path: str):
if __name__ == "__main__":
- if len(sys.argv) != 3:
+ if len(sys.argv) >= 2 and sys.argv[1] == "--check":
+ if len(sys.argv) != 3:
+ print("Usage: extract_form_field_info.py --check <input.pdf>")
+ sys.exit(1)
+ reader = PdfReader(sys.argv[2])
+ if reader.get_fields():
+ print("This PDF has fillable form fields")
+ else:
+ print("This PDF does not have fillable form fields; you will need to visually determine where to enter data")
+ elif len(sys.argv) == 3:
+ write_field_info(sys.argv[1], sys.argv[2])
+ else:
print("Usage: extract_form_field_info.py [input pdf] [output json]")
+ print(" extract_form_field_info.py --check <input.pdf>")
sys.exit(1)
- write_field_info(sys.argv[1], sys.argv[2])