wormclaude 1.0.74 → 1.0.75
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.
- package/dist/theme.js +3 -3
- package/package.json +2 -2
- package/skills/build-mcp-app/SKILL.md +393 -0
- package/skills/build-mcp-app/references/abuse-protection.md +60 -0
- package/skills/build-mcp-app/references/apps-sdk-messages.md +227 -0
- package/skills/build-mcp-app/references/directory-checklist.md +18 -0
- package/skills/build-mcp-app/references/iframe-sandbox.md +164 -0
- package/skills/build-mcp-app/references/payload-budgeting.md +54 -0
- package/skills/build-mcp-app/references/widget-templates.md +249 -0
- package/skills/build-mcp-server/SKILL.md +222 -0
- package/skills/build-mcp-server/references/auth.md +108 -0
- package/skills/build-mcp-server/references/deploy-cloudflare-workers.md +106 -0
- package/skills/build-mcp-server/references/elicitation.md +129 -0
- package/skills/build-mcp-server/references/remote-http-scaffold.md +211 -0
- package/skills/build-mcp-server/references/resources-and-prompts.md +122 -0
- package/skills/build-mcp-server/references/server-capabilities.md +164 -0
- package/skills/build-mcp-server/references/tool-design.md +189 -0
- package/skills/build-mcp-server/references/versions.md +25 -0
- package/skills/build-mcpb/SKILL.md +200 -0
- package/skills/build-mcpb/references/local-security.md +149 -0
- package/skills/build-mcpb/references/manifest-schema.md +156 -0
- package/skills/docx/script/__init__.py +1 -0
- package/skills/docx/script/accept_chages.py +135 -0
- package/skills/docx/script/comment.py +318 -0
- package/skills/docx/script/office/helpers/__init__.py +0 -0
- package/skills/docx/script/office/helpers/merge_runs.py +199 -0
- package/skills/docx/script/office/helpers/simplify_redlines.py +197 -0
- package/skills/docx/script/office/pack.py +159 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/script/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/script/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/script/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/script/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/script/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/script/office/schemas/mce/mc.xsd +75 -0
- package/skills/docx/script/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/script/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/script/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/script/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/script/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/script/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/script/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/script/office/soffice.py +183 -0
- package/skills/docx/script/office/unpack.py +132 -0
- package/skills/docx/script/office/validate.py +117 -0
- package/skills/docx/script/office/validators/__init__.py +15 -0
- package/skills/docx/script/office/validators/base.py +851 -0
- package/skills/docx/script/office/validators/docx.py +446 -0
- package/skills/docx/script/office/validators/pptx.py +275 -0
- package/skills/docx/script/office/validators/redlining.py +247 -0
- package/skills/docx/script/templates/comments.xml +3 -0
- package/skills/docx/script/templates/commentsExtended.xml +3 -0
- package/skills/docx/script/templates/commentsExtensible.xml +3 -0
- package/skills/docx/script/templates/commentsIds.xml +3 -0
- package/skills/docx/script/templates/people.xml +3 -0
- package/skills/docx/skill.md +593 -0
- package/skills/frontend-design/SKILL.md +42 -0
- package/skills/pdf/FORMS.md +294 -0
- package/skills/pdf/REFERENCE.md +612 -0
- package/skills/pdf/SKILL.md +314 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +65 -0
- package/skills/pdf/scripts/check_fillable_fields.py +11 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/skills/pdf/scripts/create_validation_image.py +37 -0
- package/skills/pdf/scripts/extract_form_field_info.py +122 -0
- package/skills/pdf/scripts/extract_form_structure.py +115 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +98 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/skills/playground/SKILL.md +77 -0
- package/skills/playground/templates/code-map.md +158 -0
- package/skills/playground/templates/concept-map.md +73 -0
- package/skills/playground/templates/data-explorer.md +67 -0
- package/skills/playground/templates/design-playground.md +67 -0
- package/skills/playground/templates/diff-review.md +179 -0
- package/skills/playground/templates/document-critique.md +171 -0
- package/skills/pptx/SKILL.md +230 -0
- package/skills/pptx/editing.md +205 -0
- package/skills/pptx/pptxgenjs.md +437 -0
- package/skills/pptx/scripts/__init__.py +0 -0
- package/skills/pptx/scripts/add_slide.py +195 -0
- package/skills/pptx/scripts/clean.py +286 -0
- package/skills/pptx/scripts/office/helpers/__init__.py +0 -0
- package/skills/pptx/scripts/office/helpers/merge_runs.py +199 -0
- package/skills/pptx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/skills/pptx/scripts/office/pack.py +159 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/scripts/office/soffice.py +183 -0
- package/skills/pptx/scripts/office/unpack.py +132 -0
- package/skills/pptx/scripts/office/validate.py +117 -0
- package/skills/pptx/scripts/office/validators/__init__.py +15 -0
- package/skills/pptx/scripts/office/validators/base.py +851 -0
- package/skills/pptx/scripts/office/validators/docx.py +446 -0
- package/skills/pptx/scripts/office/validators/pptx.py +275 -0
- package/skills/pptx/scripts/office/validators/redlining.py +247 -0
- package/skills/pptx/scripts/thumbnail.py +289 -0
- package/skills/talent-creator/SKILL.md +486 -0
- package/skills/talent-creator/agents/analyzer.md +274 -0
- package/skills/talent-creator/agents/comparator.md +202 -0
- package/skills/talent-creator/agents/grader.md +223 -0
- package/skills/talent-creator/assets/eval_review.html +146 -0
- package/skills/talent-creator/eval-viewer/generate_review.py +471 -0
- package/skills/talent-creator/eval-viewer/viewer.html +1325 -0
- package/skills/talent-creator/references/schemas.md +430 -0
- package/skills/talent-creator/scripts/__init__.py +0 -0
- package/skills/talent-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/talent-creator/scripts/generate_report.py +326 -0
- package/skills/talent-creator/scripts/improve_description.py +247 -0
- package/skills/talent-creator/scripts/package_skill.py +136 -0
- package/skills/talent-creator/scripts/quick_validate.py +146 -0
- package/skills/talent-creator/scripts/run_eval.py +310 -0
- package/skills/talent-creator/scripts/run_loop.py +328 -0
- package/skills/talent-creator/scripts/utils.py +47 -0
- package/skills/xlsx/SKILL.md +300 -0
- package/skills/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/skills/xlsx/scripts/office/helpers/merge_runs.py +199 -0
- package/skills/xlsx/scripts/office/helpers/simplify_redlines.py +197 -0
- package/skills/xlsx/scripts/office/pack.py +159 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/xlsx/scripts/office/soffice.py +183 -0
- package/skills/xlsx/scripts/office/unpack.py +132 -0
- package/skills/xlsx/scripts/office/validate.py +117 -0
- package/skills/xlsx/scripts/office/validators/__init__.py +15 -0
- package/skills/xlsx/scripts/office/validators/base.py +851 -0
- package/skills/xlsx/scripts/office/validators/docx.py +446 -0
- package/skills/xlsx/scripts/office/validators/pptx.py +275 -0
- package/skills/xlsx/scripts/office/validators/redlining.py +247 -0
- package/skills/xlsx/scripts/recalc.py +184 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from pypdf import PdfReader, PdfWriter
|
|
5
|
+
|
|
6
|
+
from extract_form_field_info import get_field_info
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def fill_pdf_fields(input_pdf_path: str, fields_json_path: str, output_pdf_path: str):
|
|
12
|
+
with open(fields_json_path) as f:
|
|
13
|
+
fields = json.load(f)
|
|
14
|
+
fields_by_page = {}
|
|
15
|
+
for field in fields:
|
|
16
|
+
if "value" in field:
|
|
17
|
+
field_id = field["field_id"]
|
|
18
|
+
page = field["page"]
|
|
19
|
+
if page not in fields_by_page:
|
|
20
|
+
fields_by_page[page] = {}
|
|
21
|
+
fields_by_page[page][field_id] = field["value"]
|
|
22
|
+
|
|
23
|
+
reader = PdfReader(input_pdf_path)
|
|
24
|
+
|
|
25
|
+
has_error = False
|
|
26
|
+
field_info = get_field_info(reader)
|
|
27
|
+
fields_by_ids = {f["field_id"]: f for f in field_info}
|
|
28
|
+
for field in fields:
|
|
29
|
+
existing_field = fields_by_ids.get(field["field_id"])
|
|
30
|
+
if not existing_field:
|
|
31
|
+
has_error = True
|
|
32
|
+
print(f"ERROR: `{field['field_id']}` is not a valid field ID")
|
|
33
|
+
elif field["page"] != existing_field["page"]:
|
|
34
|
+
has_error = True
|
|
35
|
+
print(f"ERROR: Incorrect page number for `{field['field_id']}` (got {field['page']}, expected {existing_field['page']})")
|
|
36
|
+
else:
|
|
37
|
+
if "value" in field:
|
|
38
|
+
err = validation_error_for_field_value(existing_field, field["value"])
|
|
39
|
+
if err:
|
|
40
|
+
print(err)
|
|
41
|
+
has_error = True
|
|
42
|
+
if has_error:
|
|
43
|
+
sys.exit(1)
|
|
44
|
+
|
|
45
|
+
writer = PdfWriter(clone_from=reader)
|
|
46
|
+
for page, field_values in fields_by_page.items():
|
|
47
|
+
writer.update_page_form_field_values(writer.pages[page - 1], field_values, auto_regenerate=False)
|
|
48
|
+
|
|
49
|
+
writer.set_need_appearances_writer(True)
|
|
50
|
+
|
|
51
|
+
with open(output_pdf_path, "wb") as f:
|
|
52
|
+
writer.write(f)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def validation_error_for_field_value(field_info, field_value):
|
|
56
|
+
field_type = field_info["type"]
|
|
57
|
+
field_id = field_info["field_id"]
|
|
58
|
+
if field_type == "checkbox":
|
|
59
|
+
checked_val = field_info["checked_value"]
|
|
60
|
+
unchecked_val = field_info["unchecked_value"]
|
|
61
|
+
if field_value != checked_val and field_value != unchecked_val:
|
|
62
|
+
return f'ERROR: Invalid value "{field_value}" for checkbox field "{field_id}". The checked value is "{checked_val}" and the unchecked value is "{unchecked_val}"'
|
|
63
|
+
elif field_type == "radio_group":
|
|
64
|
+
option_values = [opt["value"] for opt in field_info["radio_options"]]
|
|
65
|
+
if field_value not in option_values:
|
|
66
|
+
return f'ERROR: Invalid value "{field_value}" for radio group field "{field_id}". Valid values are: {option_values}'
|
|
67
|
+
elif field_type == "choice":
|
|
68
|
+
choice_values = [opt["value"] for opt in field_info["choice_options"]]
|
|
69
|
+
if field_value not in choice_values:
|
|
70
|
+
return f'ERROR: Invalid value "{field_value}" for choice field "{field_id}". Valid values are: {choice_values}'
|
|
71
|
+
return None
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def monkeypatch_pydpf_method():
|
|
75
|
+
from pypdf.generic import DictionaryObject
|
|
76
|
+
from pypdf.constants import FieldDictionaryAttributes
|
|
77
|
+
|
|
78
|
+
original_get_inherited = DictionaryObject.get_inherited
|
|
79
|
+
|
|
80
|
+
def patched_get_inherited(self, key: str, default = None):
|
|
81
|
+
result = original_get_inherited(self, key, default)
|
|
82
|
+
if key == FieldDictionaryAttributes.Opt:
|
|
83
|
+
if isinstance(result, list) and all(isinstance(v, list) and len(v) == 2 for v in result):
|
|
84
|
+
result = [r[0] for r in result]
|
|
85
|
+
return result
|
|
86
|
+
|
|
87
|
+
DictionaryObject.get_inherited = patched_get_inherited
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
if len(sys.argv) != 4:
|
|
92
|
+
print("Usage: fill_fillable_fields.py [input pdf] [field_values.json] [output pdf]")
|
|
93
|
+
sys.exit(1)
|
|
94
|
+
monkeypatch_pydpf_method()
|
|
95
|
+
input_pdf = sys.argv[1]
|
|
96
|
+
fields_json = sys.argv[2]
|
|
97
|
+
output_pdf = sys.argv[3]
|
|
98
|
+
fill_pdf_fields(input_pdf, fields_json, output_pdf)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
from pypdf import PdfReader, PdfWriter
|
|
5
|
+
from pypdf.annotations import FreeText
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def transform_from_image_coords(bbox, image_width, image_height, pdf_width, pdf_height):
|
|
11
|
+
x_scale = pdf_width / image_width
|
|
12
|
+
y_scale = pdf_height / image_height
|
|
13
|
+
|
|
14
|
+
left = bbox[0] * x_scale
|
|
15
|
+
right = bbox[2] * x_scale
|
|
16
|
+
|
|
17
|
+
top = pdf_height - (bbox[1] * y_scale)
|
|
18
|
+
bottom = pdf_height - (bbox[3] * y_scale)
|
|
19
|
+
|
|
20
|
+
return left, bottom, right, top
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def transform_from_pdf_coords(bbox, pdf_height):
|
|
24
|
+
left = bbox[0]
|
|
25
|
+
right = bbox[2]
|
|
26
|
+
|
|
27
|
+
pypdf_top = pdf_height - bbox[1]
|
|
28
|
+
pypdf_bottom = pdf_height - bbox[3]
|
|
29
|
+
|
|
30
|
+
return left, pypdf_bottom, right, pypdf_top
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def fill_pdf_form(input_pdf_path, fields_json_path, output_pdf_path):
|
|
34
|
+
|
|
35
|
+
with open(fields_json_path, "r") as f:
|
|
36
|
+
fields_data = json.load(f)
|
|
37
|
+
|
|
38
|
+
reader = PdfReader(input_pdf_path)
|
|
39
|
+
writer = PdfWriter()
|
|
40
|
+
|
|
41
|
+
writer.append(reader)
|
|
42
|
+
|
|
43
|
+
pdf_dimensions = {}
|
|
44
|
+
for i, page in enumerate(reader.pages):
|
|
45
|
+
mediabox = page.mediabox
|
|
46
|
+
pdf_dimensions[i + 1] = [mediabox.width, mediabox.height]
|
|
47
|
+
|
|
48
|
+
annotations = []
|
|
49
|
+
for field in fields_data["form_fields"]:
|
|
50
|
+
page_num = field["page_number"]
|
|
51
|
+
|
|
52
|
+
page_info = next(p for p in fields_data["pages"] if p["page_number"] == page_num)
|
|
53
|
+
pdf_width, pdf_height = pdf_dimensions[page_num]
|
|
54
|
+
|
|
55
|
+
if "pdf_width" in page_info:
|
|
56
|
+
transformed_entry_box = transform_from_pdf_coords(
|
|
57
|
+
field["entry_bounding_box"],
|
|
58
|
+
float(pdf_height)
|
|
59
|
+
)
|
|
60
|
+
else:
|
|
61
|
+
image_width = page_info["image_width"]
|
|
62
|
+
image_height = page_info["image_height"]
|
|
63
|
+
transformed_entry_box = transform_from_image_coords(
|
|
64
|
+
field["entry_bounding_box"],
|
|
65
|
+
image_width, image_height,
|
|
66
|
+
float(pdf_width), float(pdf_height)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
if "entry_text" not in field or "text" not in field["entry_text"]:
|
|
70
|
+
continue
|
|
71
|
+
entry_text = field["entry_text"]
|
|
72
|
+
text = entry_text["text"]
|
|
73
|
+
if not text:
|
|
74
|
+
continue
|
|
75
|
+
|
|
76
|
+
font_name = entry_text.get("font", "Arial")
|
|
77
|
+
font_size = str(entry_text.get("font_size", 14)) + "pt"
|
|
78
|
+
font_color = entry_text.get("font_color", "000000")
|
|
79
|
+
|
|
80
|
+
annotation = FreeText(
|
|
81
|
+
text=text,
|
|
82
|
+
rect=transformed_entry_box,
|
|
83
|
+
font=font_name,
|
|
84
|
+
font_size=font_size,
|
|
85
|
+
font_color=font_color,
|
|
86
|
+
border_color=None,
|
|
87
|
+
background_color=None,
|
|
88
|
+
)
|
|
89
|
+
annotations.append(annotation)
|
|
90
|
+
writer.add_annotation(page_number=page_num - 1, annotation=annotation)
|
|
91
|
+
|
|
92
|
+
with open(output_pdf_path, "wb") as output:
|
|
93
|
+
writer.write(output)
|
|
94
|
+
|
|
95
|
+
print(f"Successfully filled PDF form and saved to {output_pdf_path}")
|
|
96
|
+
print(f"Added {len(annotations)} text annotations")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
if len(sys.argv) != 4:
|
|
101
|
+
print("Usage: fill_pdf_form_with_annotations.py [input pdf] [fields.json] [output pdf]")
|
|
102
|
+
sys.exit(1)
|
|
103
|
+
input_pdf = sys.argv[1]
|
|
104
|
+
fields_json = sys.argv[2]
|
|
105
|
+
output_pdf = sys.argv[3]
|
|
106
|
+
|
|
107
|
+
fill_pdf_form(input_pdf, fields_json, output_pdf)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: playground
|
|
3
|
+
description: Builds interactive HTML playgrounds — standalone single-file explorers where users tune something visually with controls, watch a live preview, and copy out a prompt. Reach for it when someone wants a playground, explorer, or interactive tool around a topic.
|
|
4
|
+
license: WormClaude
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Playground Builder
|
|
8
|
+
|
|
9
|
+
A playground packs everything into one HTML file: interactive controls down one side, a live preview on the other, and a prompt readout at the bottom with a copy button. Users tweak the controls, explore visually, then paste the generated prompt back into WormClaude.
|
|
10
|
+
|
|
11
|
+
## When to use this skill
|
|
12
|
+
|
|
13
|
+
Pick this skill whenever someone wants an interactive playground, explorer, or visual tool for a topic — most useful when the option space is broad, visual, or structural and awkward to capture in plain prose.
|
|
14
|
+
|
|
15
|
+
## How to use this skill
|
|
16
|
+
|
|
17
|
+
1. **Identify the playground type** from the user's request
|
|
18
|
+
2. **Load the matching template** from `templates/`:
|
|
19
|
+
- `templates/design-playground.md` — Visual design decisions (components, layouts, spacing, color, typography)
|
|
20
|
+
- `templates/data-explorer.md` — Data and query building (SQL, APIs, pipelines, regex)
|
|
21
|
+
- `templates/concept-map.md` — Learning and exploration (concept maps, knowledge gaps, scope mapping)
|
|
22
|
+
- `templates/document-critique.md` — Document review (suggestions with approve/reject/comment workflow)
|
|
23
|
+
- `templates/diff-review.md` — Code review (git diffs, commits, PRs with line-by-line commenting)
|
|
24
|
+
- `templates/code-map.md` — Codebase architecture (component relationships, data flow, layer diagrams)
|
|
25
|
+
3. **Follow the template** to build the playground. When the topic doesn't map neatly onto a template, grab the nearest match and adjust it.
|
|
26
|
+
4. **Open in browser.** Once the HTML file is written, run `open <filename>.html` so it launches in the user's default browser.
|
|
27
|
+
|
|
28
|
+
## Core requirements (every playground)
|
|
29
|
+
|
|
30
|
+
- **Single HTML file.** Embed all CSS and JS inline. Zero external dependencies.
|
|
31
|
+
- **Live preview.** Refreshes the moment any control changes — never gate it behind an "Apply" button.
|
|
32
|
+
- **Prompt output.** Phrased as natural language rather than a dump of raw values. Surfaces only the choices that differ from defaults, carries enough context to act on without the playground in front of you, and refreshes live.
|
|
33
|
+
- **Copy button.** One-click clipboard copy with a quick "Copied!" confirmation.
|
|
34
|
+
- **Sensible defaults + presets.** Presentable the instant it loads. Ship 3-5 named presets that snap every control into a coherent combination.
|
|
35
|
+
- **Dark theme.** System font for the interface, monospace for code and values. Keep the chrome sparse.
|
|
36
|
+
|
|
37
|
+
## State management pattern
|
|
38
|
+
|
|
39
|
+
Hold everything in one state object. Each control writes into it; each render reads back out of it.
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
const state = { /* all configurable values */ };
|
|
43
|
+
|
|
44
|
+
function updateAll() {
|
|
45
|
+
renderPreview(); // update the visual
|
|
46
|
+
updatePrompt(); // rebuild the prompt text
|
|
47
|
+
}
|
|
48
|
+
// Every control calls updateAll() on change
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Prompt output pattern
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
function updatePrompt() {
|
|
55
|
+
const parts = [];
|
|
56
|
+
|
|
57
|
+
// Only mention non-default values
|
|
58
|
+
if (state.borderRadius !== DEFAULTS.borderRadius) {
|
|
59
|
+
parts.push(`border-radius of ${state.borderRadius}px`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Use qualitative language alongside numbers
|
|
63
|
+
if (state.shadowBlur > 16) parts.push('a pronounced shadow');
|
|
64
|
+
else if (state.shadowBlur > 0) parts.push('a subtle shadow');
|
|
65
|
+
|
|
66
|
+
prompt.textContent = `Update the card to use ${parts.join(', ')}.`;
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Common mistakes to avoid
|
|
71
|
+
|
|
72
|
+
- Prompt output reads like a value dump → rephrase it as a plain-English instruction
|
|
73
|
+
- Too many controls crammed together → cluster them by concern and tuck advanced ones into a collapsible section
|
|
74
|
+
- Preview lags behind the controls → wire every change to fire an instant re-render
|
|
75
|
+
- Missing defaults or presets → the page opens empty or broken
|
|
76
|
+
- Leaning on external dependencies → one CDN outage and the playground stops working
|
|
77
|
+
- Prompt with no context → include enough that it stands on its own away from the playground
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Code Map Template
|
|
2
|
+
|
|
3
|
+
Reach for this template when the playground is about visualizing codebase architecture: component relationships, data flow, layer diagrams, and system architecture with interactive commenting for feedback.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
+-------------------+----------------------------------+
|
|
9
|
+
| | |
|
|
10
|
+
| Controls: | SVG Canvas |
|
|
11
|
+
| • View presets | (nodes + connections) |
|
|
12
|
+
| • Layer toggles | with zoom controls |
|
|
13
|
+
| • Connection | |
|
|
14
|
+
| type filters | Legend (bottom-left) |
|
|
15
|
+
| | |
|
|
16
|
+
| Comments (n): +----------------------------------+
|
|
17
|
+
| • List of user | Prompt output |
|
|
18
|
+
| comments with | [ Copy Prompt ] |
|
|
19
|
+
| delete buttons | |
|
|
20
|
+
+-------------------+----------------------------------+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Code map playgrounds draw the architecture diagram on an SVG canvas. Users click a component to attach a comment, and those comments roll into the generated prompt. Layer and connection filters let them zero in on specific parts of the system.
|
|
24
|
+
|
|
25
|
+
## Control types for code maps
|
|
26
|
+
|
|
27
|
+
| Decision | Control | Example |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| System view | Preset buttons | Full System, Chat Flow, Data Flow, Agent System |
|
|
30
|
+
| Visible layers | Checkboxes | Client, Server, SDK, Data, External |
|
|
31
|
+
| Connection types | Checkboxes with color indicators | Data Flow (blue), Tool Calls (green), Events (red) |
|
|
32
|
+
| Component feedback | Click-to-comment modal | Opens modal with textarea for feedback |
|
|
33
|
+
| Zoom level | +/−/reset buttons | Scale SVG for detail |
|
|
34
|
+
|
|
35
|
+
## Canvas rendering
|
|
36
|
+
|
|
37
|
+
Build on an `<svg>` element whose nodes and paths are generated on the fly. Key patterns:
|
|
38
|
+
|
|
39
|
+
- **Nodes:** Rounded rectangles carrying a title and a subtitle (the file path)
|
|
40
|
+
- **Connections:** Curved bezier paths with arrow markers, styled per type
|
|
41
|
+
- **Layer organization:** Sort nodes into Y-position bands (for example y: 30-80 = Client, y: 130-180 = Server)
|
|
42
|
+
- **Click-to-comment:** Click a node → open a modal → save the comment → the node picks up a visual indicator
|
|
43
|
+
- **Filtering:** Toggle node visibility by layer and connection visibility by type
|
|
44
|
+
|
|
45
|
+
```javascript
|
|
46
|
+
const nodes = [
|
|
47
|
+
{ id: 'api-client', label: 'API Client', subtitle: 'src/api/client.ts',
|
|
48
|
+
x: 100, y: 50, w: 140, h: 45, layer: 'client', color: '#dbeafe' },
|
|
49
|
+
// ...
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const connections = [
|
|
53
|
+
{ from: 'api-client', to: 'server', type: 'data-flow', label: 'HTTP' },
|
|
54
|
+
{ from: 'server', to: 'db', type: 'data-flow' },
|
|
55
|
+
// ...
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
function renderDiagram() {
|
|
59
|
+
const visibleNodes = nodes.filter(n => state.layers[n.layer]);
|
|
60
|
+
// Draw connections first (under nodes), then nodes
|
|
61
|
+
connections.forEach(c => drawConnection(c));
|
|
62
|
+
visibleNodes.forEach(n => drawNode(n));
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Connection types and styling
|
|
67
|
+
|
|
68
|
+
Set up 3-5 connection types, each with its own visual style:
|
|
69
|
+
|
|
70
|
+
| Type | Color | Style | Use for |
|
|
71
|
+
|---|---|---|---|
|
|
72
|
+
| `data-flow` | Blue (#3b82f6) | Solid line | Request/response, data passing |
|
|
73
|
+
| `tool-call` | Green (#10b981) | Dashed (6,3) | Function calls, API invocations |
|
|
74
|
+
| `event` | Red (#ef4444) | Short dash (4,4) | Async events, pub/sub |
|
|
75
|
+
| `skill-invoke` | Orange (#f97316) | Long dash (8,4) | Plugin/skill activation |
|
|
76
|
+
| `dependency` | Gray (#6b7280) | Dotted | Import/require relationships |
|
|
77
|
+
|
|
78
|
+
Lean on SVG markers for the arrowheads:
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<marker id="arrowhead-blue" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
82
|
+
<polygon points="0 0, 8 3, 0 6" fill="#3b82f6"/>
|
|
83
|
+
</marker>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Comment system
|
|
87
|
+
|
|
88
|
+
What sets code maps apart is the click-to-comment flow:
|
|
89
|
+
|
|
90
|
+
1. **Click node** → Open a modal showing the component name, file path, and a textarea
|
|
91
|
+
2. **Save comment** → Push it onto the comments list and give the node a visual marker (colored border)
|
|
92
|
+
3. **View comments** → A sidebar list with the component name, a comment preview, and a delete button
|
|
93
|
+
4. **Delete comment** → Drop it from the list, reset the node's visual, and rebuild the prompt
|
|
94
|
+
|
|
95
|
+
Each comment should carry the component context with it:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
state.comments.push({
|
|
99
|
+
id: Date.now(),
|
|
100
|
+
target: node.id,
|
|
101
|
+
targetLabel: node.label,
|
|
102
|
+
targetFile: node.subtitle,
|
|
103
|
+
text: userInput
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Prompt output for code maps
|
|
108
|
+
|
|
109
|
+
The prompt weaves the system context together with the user's comments:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
This is the [PROJECT NAME] architecture, focusing on the [visible layers].
|
|
113
|
+
|
|
114
|
+
Feedback on specific components:
|
|
115
|
+
|
|
116
|
+
**API Client** (src/api/client.ts):
|
|
117
|
+
I want to add retry logic with exponential backoff here.
|
|
118
|
+
|
|
119
|
+
**Database Manager** (src/db/manager.ts):
|
|
120
|
+
Can we add connection pooling? Current implementation creates new connections per request.
|
|
121
|
+
|
|
122
|
+
**Auth Middleware** (src/middleware/auth.ts):
|
|
123
|
+
This should validate JWT tokens and extract user context.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Carry over only the comments the user actually wrote. If the full system isn't on screen, note which layers are currently visible.
|
|
127
|
+
|
|
128
|
+
## Pre-populating with real data
|
|
129
|
+
|
|
130
|
+
For a specific codebase, seed the map with:
|
|
131
|
+
|
|
132
|
+
- **Nodes:** 15-25 key components, each with a real file path
|
|
133
|
+
- **Connections:** 20-40 relationships drawn from the real imports and calls
|
|
134
|
+
- **Layers:** Logical groupings (UI, API, Business Logic, Data, External)
|
|
135
|
+
- **Presets:** "Full System", "Frontend Only", "Backend Only", "Data Flow"
|
|
136
|
+
|
|
137
|
+
Arrange the nodes in horizontal bands by layer, keeping the spacing even.
|
|
138
|
+
|
|
139
|
+
## Layer color palette (light theme)
|
|
140
|
+
|
|
141
|
+
| Layer | Node fill | Description |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| Client/UI | #dbeafe (blue-100) | React components, hooks, pages |
|
|
144
|
+
| Server/API | #fef3c7 (amber-100) | Express routes, middleware, handlers |
|
|
145
|
+
| SDK/Core | #f3e8ff (purple-100) | Core libraries, SDK wrappers |
|
|
146
|
+
| Agent/Logic | #dcfce7 (green-100) | Business logic, agents, processors |
|
|
147
|
+
| Data | #fce7f3 (pink-100) | Database, cache, storage |
|
|
148
|
+
| External | #fbcfe8 (pink-200) | Third-party services, APIs |
|
|
149
|
+
|
|
150
|
+
## Example topics
|
|
151
|
+
|
|
152
|
+
- Codebase architecture explorer (modules, imports, data flow)
|
|
153
|
+
- Microservices map (services, queues, databases, API gateways)
|
|
154
|
+
- React component tree (components, hooks, context, state)
|
|
155
|
+
- API architecture (routes, middleware, controllers, models)
|
|
156
|
+
- Agent system (prompts, tools, skills, subagents)
|
|
157
|
+
- Data pipeline (sources, transforms, sinks, scheduling)
|
|
158
|
+
- Plugin/extension architecture (core, plugins, hooks, events)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Concept Map Template
|
|
2
|
+
|
|
3
|
+
Reach for this template when the playground is about learning, exploration, or charting relationships: concept maps, spotting knowledge gaps, scope mapping, and breaking tasks into dependency-linked pieces.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
+--------------------------------------+
|
|
9
|
+
| Canvas (draggable nodes, edges) |
|
|
10
|
+
| with tooltip on hover |
|
|
11
|
+
+-------------------------+------------+
|
|
12
|
+
| | |
|
|
13
|
+
| Sidebar: | Prompt |
|
|
14
|
+
| • Knowledge levels | output |
|
|
15
|
+
| • Connection types | |
|
|
16
|
+
| • Node list | [Copy] |
|
|
17
|
+
| • Actions | |
|
|
18
|
+
+-------------------------+------------+
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Canvas-based playgrounds break from the two-panel split. Here the interactive visual itself is the control — users drag nodes and sketch connections instead of nudging sliders. The sidebar rounds it out with toggles and list controls.
|
|
22
|
+
|
|
23
|
+
## Control types for concept maps
|
|
24
|
+
|
|
25
|
+
| Decision | Control | Example |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Knowledge level per node | Click-to-cycle button in sidebar list | Know → Fuzzy → Unknown |
|
|
28
|
+
| Connection type | Selector before drawing | calls, depends on, contains, reads from |
|
|
29
|
+
| Node arrangement | Drag on canvas | spatial layout reflects mental model |
|
|
30
|
+
| Which nodes to include | Toggle or checkbox per node | hide/show concepts |
|
|
31
|
+
| Actions | Buttons | Auto-layout (force-directed), clear edges, reset |
|
|
32
|
+
|
|
33
|
+
## Canvas rendering
|
|
34
|
+
|
|
35
|
+
Drive a `<canvas>` element with hand-written draw calls. Key patterns:
|
|
36
|
+
|
|
37
|
+
- **Hit testing:** Compare the mouse position against each node's bounding circle during mousedown and mousemove
|
|
38
|
+
- **Drag:** When mousedown lands on a node, capture the offset and reposition the node as the mouse moves
|
|
39
|
+
- **Edge drawing:** Click node A, then node B, and draw an arrow between them tagged with the chosen relationship type
|
|
40
|
+
- **Tooltips:** On hover, float an absolutely-positioned div over the canvas carrying the description text
|
|
41
|
+
- **Force-directed auto-layout:** A lightweight spring model — every pair repels, edges pull their endpoints together, run 100-200 damped iterations
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
function draw() {
|
|
45
|
+
ctx.clearRect(0, 0, W, H);
|
|
46
|
+
edges.forEach(e => drawEdge(e)); // edges first, under nodes
|
|
47
|
+
nodes.forEach(n => drawNode(n)); // nodes on top
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Prompt output for concept maps
|
|
52
|
+
|
|
53
|
+
The prompt should read as a focused learning request, shaped by how the user tagged their own knowledge:
|
|
54
|
+
|
|
55
|
+
> "I'm learning [CODEBASE/DOMAIN]. I already understand: [know nodes]. I'm fuzzy on: [fuzzy nodes]. I have no idea about: [unknown nodes]. Here are the relationships I want to understand: [edge list in natural language]. Please explain the fuzzy and unknown concepts, focusing on these relationships. Build on what I already know. Use concrete code references."
|
|
56
|
+
|
|
57
|
+
Carry over only the edges the user actually drew, and in the explanation request name only the concepts they flagged as fuzzy or unknown.
|
|
58
|
+
|
|
59
|
+
## Pre-populating with real data
|
|
60
|
+
|
|
61
|
+
For codebases or domains, seed the canvas with:
|
|
62
|
+
- **Nodes:** 15-20 key concepts, each with a real file path and a brief description
|
|
63
|
+
- **Edges:** 20-30 relationships drawn ahead of time from the real architecture
|
|
64
|
+
- **Knowledge:** Start everything at "Fuzzy" and let the user tune from there
|
|
65
|
+
- **Presets:** "Zoom out" (collapse internal nodes, keep only top-level ones), "Focus on [layer]" (spotlight nodes in a single area)
|
|
66
|
+
|
|
67
|
+
## Example topics
|
|
68
|
+
|
|
69
|
+
- Codebase architecture map (modules, data flow, state management)
|
|
70
|
+
- Framework learning (how React hooks connect, Next.js data fetching layers)
|
|
71
|
+
- System design (services, databases, queues, caches and how they relate)
|
|
72
|
+
- Task decomposition (goals → sub-tasks with dependency arrows, knowledge tags)
|
|
73
|
+
- API surface map (endpoints grouped by resource, shared middleware, auth layers)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Data Explorer Template
|
|
2
|
+
|
|
3
|
+
Reach for this template when the playground deals with data queries, APIs, pipelines, or structured configuration: SQL builders, API designers, regex builders, pipeline visuals, and cron schedules.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
+-------------------+----------------------+
|
|
9
|
+
| | |
|
|
10
|
+
| Controls | Formatted output |
|
|
11
|
+
| grouped by: | (syntax-highlighted |
|
|
12
|
+
| • Source/tables | code, or a |
|
|
13
|
+
| • Columns/fields | visual diagram) |
|
|
14
|
+
| • Filters | |
|
|
15
|
+
| • Grouping | |
|
|
16
|
+
| • Ordering | |
|
|
17
|
+
| • Limits | |
|
|
18
|
+
| +----------------------+
|
|
19
|
+
| | Prompt output |
|
|
20
|
+
| | [ Copy Prompt ] |
|
|
21
|
+
+-------------------+----------------------+
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Control types by decision
|
|
25
|
+
|
|
26
|
+
| Decision | Control | Example |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Select from available items | Clickable cards/chips | table names, columns, HTTP methods |
|
|
29
|
+
| Add filter/condition rows | Add button → row of dropdowns + input | WHERE column op value |
|
|
30
|
+
| Join type or aggregation | Dropdown per row | INNER/LEFT/RIGHT, COUNT/SUM/AVG |
|
|
31
|
+
| Limit/offset | Slider | result count 1–500 |
|
|
32
|
+
| Ordering | Dropdown + ASC/DESC toggle | order by column |
|
|
33
|
+
| On/off features | Toggle | show descriptions, include header |
|
|
34
|
+
|
|
35
|
+
## Preview rendering
|
|
36
|
+
|
|
37
|
+
Produce syntax-highlighted output by wrapping tokens in `<span>` tags carrying color classes:
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
function renderPreview() {
|
|
41
|
+
const el = document.getElementById('preview');
|
|
42
|
+
// Color-code by token type
|
|
43
|
+
el.innerHTML = sql
|
|
44
|
+
.replace(/\b(SELECT|FROM|WHERE|JOIN|ON|GROUP BY|ORDER BY|LIMIT)\b/g, '<span class="kw">$1</span>')
|
|
45
|
+
.replace(/\b(users|orders|products)\b/g, '<span class="tbl">$1</span>')
|
|
46
|
+
.replace(/'[^']*'/g, '<span class="str">$&</span>');
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For pipeline-style playgrounds, lay out a horizontal or vertical flow diagram from absolutely-positioned divs joined by arrow connectors.
|
|
51
|
+
|
|
52
|
+
## Prompt output for data
|
|
53
|
+
|
|
54
|
+
Phrase it as a spec for what to build rather than the raw query itself:
|
|
55
|
+
|
|
56
|
+
> "Write a SQL query that joins orders to users on user_id, filters for orders after 2024-01-01 with total > $50, groups by user, and returns the top 10 users by order count."
|
|
57
|
+
|
|
58
|
+
Bake in the schema context — table names and column types — so the prompt stands on its own.
|
|
59
|
+
|
|
60
|
+
## Example topics
|
|
61
|
+
|
|
62
|
+
- SQL query builder (tables, joins, filters, group by, order by, limit)
|
|
63
|
+
- API endpoint designer (routes, methods, request/response field builder)
|
|
64
|
+
- Data transformation pipeline (source → filter → map → aggregate → output)
|
|
65
|
+
- Regex builder (sample strings, match groups, live highlight)
|
|
66
|
+
- Cron schedule builder (visual timeline, interval, day toggles)
|
|
67
|
+
- GraphQL query builder (type selection, field picker, nested resolvers)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Design Playground Template
|
|
2
|
+
|
|
3
|
+
Reach for this template whenever the playground centers on visual design choices: components, layouts, spacing, color, typography, animation, and responsive behavior.
|
|
4
|
+
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
+-------------------+----------------------+
|
|
9
|
+
| | |
|
|
10
|
+
| Controls | Live component/ |
|
|
11
|
+
| grouped by: | layout preview |
|
|
12
|
+
| • Spacing | (renders in a |
|
|
13
|
+
| • Color | mock page or |
|
|
14
|
+
| • Typography | isolated card) |
|
|
15
|
+
| • Shadow/Border | |
|
|
16
|
+
| • Interaction | |
|
|
17
|
+
| +----------------------+
|
|
18
|
+
| | Prompt output |
|
|
19
|
+
| | [ Copy Prompt ] |
|
|
20
|
+
+-------------------+----------------------+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Control types by decision
|
|
24
|
+
|
|
25
|
+
| Decision | Control | Example |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Sizes, spacing, radius | Slider | border-radius 0–24px |
|
|
28
|
+
| On/off features | Toggle | show border, hover effect |
|
|
29
|
+
| Choosing from a set | Dropdown | font-family, easing curve |
|
|
30
|
+
| Colors | Hue + saturation + lightness sliders | shadow color, accent |
|
|
31
|
+
| Layout structure | Clickable cards | sidebar-left / top-nav / no-nav |
|
|
32
|
+
| Responsive behavior | Viewport-width slider | watch grid reflow at breakpoints |
|
|
33
|
+
|
|
34
|
+
## Preview rendering
|
|
35
|
+
|
|
36
|
+
Push the state values straight onto a preview element's inline styles:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
function renderPreview() {
|
|
40
|
+
const el = document.getElementById('preview');
|
|
41
|
+
el.style.borderRadius = state.radius + 'px';
|
|
42
|
+
el.style.padding = state.padding + 'px';
|
|
43
|
+
el.style.boxShadow = state.shadow
|
|
44
|
+
? `0 ${state.shadowY}px ${state.shadowBlur}px rgba(0,0,0,${state.shadowOpacity})`
|
|
45
|
+
: 'none';
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Where it matters, render the preview against both light and dark backgrounds and offer a toggle to switch context.
|
|
50
|
+
|
|
51
|
+
## Prompt output for design
|
|
52
|
+
|
|
53
|
+
Write it like guidance handed to a developer, not a sheet of specs:
|
|
54
|
+
|
|
55
|
+
> "Update the card to feel soft and elevated: 12px border-radius, 24px horizontal padding, a medium box-shadow (0 4px 12px rgba(0,0,0,0.1)). On hover, lift it with translateY(-1px) and deepen the shadow slightly."
|
|
56
|
+
|
|
57
|
+
When the user is on Tailwind, offer Tailwind classes; when they're on plain CSS, stick to CSS properties.
|
|
58
|
+
|
|
59
|
+
## Example topics
|
|
60
|
+
|
|
61
|
+
- Button style explorer (radius, padding, weight, hover/active states)
|
|
62
|
+
- Card component (shadow depth, radius, content layout, image)
|
|
63
|
+
- Layout builder (sidebar width, content max-width, header height, grid)
|
|
64
|
+
- Typography scale (base size, ratio, line heights across h1-body-caption)
|
|
65
|
+
- Color palette generator (primary hue, derive secondary/accent/surface)
|
|
66
|
+
- Dashboard density (airy → compact slider that scales everything proportionally)
|
|
67
|
+
- Modal/dialog (width, overlay opacity, entry animation, corner radius)
|