cli-jaw 0.1.6 → 0.1.8
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/README.ko.md +68 -71
- package/README.md +123 -92
- package/README.zh-CN.md +68 -73
- package/dist/bin/cli-claw.js +96 -0
- package/dist/bin/cli-claw.js.map +1 -0
- package/dist/bin/cli-jaw.js +0 -0
- package/dist/bin/commands/doctor.js +3 -0
- package/dist/bin/commands/doctor.js.map +1 -1
- package/dist/bin/commands/init.js +36 -19
- package/dist/bin/commands/init.js.map +1 -1
- package/dist/bin/postinstall.js +175 -104
- package/dist/bin/postinstall.js.map +1 -1
- package/dist/lib/mcp-sync.js +43 -4
- package/dist/lib/mcp-sync.js.map +1 -1
- package/dist/server.js +22 -103
- package/dist/server.js.map +1 -1
- package/dist/src/cli/acp-client.js +1 -1
- package/dist/src/cli/command-context.js +73 -0
- package/dist/src/cli/command-context.js.map +1 -0
- package/dist/src/core/db.js +1 -1
- package/dist/src/memory/heartbeat.js +2 -1
- package/dist/src/memory/heartbeat.js.map +1 -1
- package/dist/src/orchestrator/collect.js +53 -0
- package/dist/src/orchestrator/collect.js.map +1 -0
- package/dist/src/orchestrator/gateway.js +49 -0
- package/dist/src/orchestrator/gateway.js.map +1 -0
- package/dist/src/telegram/bot.js +32 -119
- package/dist/src/telegram/bot.js.map +1 -1
- package/package.json +7 -7
- package/public/css/sidebar.css +14 -0
- package/public/dist/bundle.js +21 -21
- package/public/dist/bundle.js.map +3 -3
- package/public/index.html +2 -2
- package/public/js/features/settings.js +1 -2
- package/public/js/main.js +0 -1
- package/scripts/check-copilot-gap.js +57 -0
- package/scripts/check-deps-offline.mjs +75 -0
- package/scripts/check-deps-online.sh +26 -0
- package/scripts/i18n-registry.py +208 -0
- package/scripts/postinstall-guard.cjs +63 -0
- package/scripts/release.sh +30 -0
- package/skills_ref/1password/SKILL.md +0 -70
- package/skills_ref/agents-sdk/SKILL.md +0 -155
- package/skills_ref/agents-sdk/references/callable.md +0 -92
- package/skills_ref/agents-sdk/references/codemode.md +0 -207
- package/skills_ref/agents-sdk/references/email.md +0 -146
- package/skills_ref/agents-sdk/references/mcp.md +0 -154
- package/skills_ref/agents-sdk/references/state-scheduling.md +0 -164
- package/skills_ref/agents-sdk/references/streaming-chat.md +0 -178
- package/skills_ref/agents-sdk/references/workflows.md +0 -132
- package/skills_ref/algorithmic-art/LICENSE.txt +0 -202
- package/skills_ref/algorithmic-art/SKILL.md +0 -405
- package/skills_ref/algorithmic-art/templates/generator_template.js +0 -223
- package/skills_ref/algorithmic-art/templates/viewer.html +0 -599
- package/skills_ref/apple-notes/SKILL.md +0 -77
- package/skills_ref/apple-reminders/SKILL.md +0 -118
- package/skills_ref/atlas/SKILL.md +0 -99
- package/skills_ref/brainstorming/SKILL.md +0 -96
- package/skills_ref/browser/SKILL.md +0 -179
- package/skills_ref/canvas-design/LICENSE.txt +0 -202
- package/skills_ref/canvas-design/SKILL.md +0 -130
- package/skills_ref/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/BigShoulders-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Boldonse-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/DMMono-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/EricaOne-OFL.txt +0 -94
- package/skills_ref/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/GeistMono-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Gloock-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Italiana-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Jura-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Lora-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/NationalPark-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Outfit-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/PixelifySans-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/PoiretOne-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/RedHatMono-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Silkscreen-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/SmoochSans-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/Tektur-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/WorkSans-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/skills_ref/canvas-design/canvas-fonts/YoungSerif-OFL.txt +0 -93
- package/skills_ref/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/skills_ref/changelog-generator/SKILL.md +0 -104
- package/skills_ref/cloudflare-deploy/SKILL.md +0 -207
- package/skills_ref/codebase-orientation/SKILL.md +0 -29
- package/skills_ref/config-file-explainer/SKILL.md +0 -26
- package/skills_ref/context-compression/SKILL.md +0 -265
- package/skills_ref/context-compression/references/evaluation-framework.md +0 -213
- package/skills_ref/context-compression/scripts/compression_evaluator.py +0 -658
- package/skills_ref/data-structure-chooser/SKILL.md +0 -26
- package/skills_ref/debugging-checklist/SKILL.md +0 -26
- package/skills_ref/debugging-helpers/CREATION-LOG.md +0 -119
- package/skills_ref/debugging-helpers/SKILL.md +0 -296
- package/skills_ref/debugging-helpers/condition-based-waiting-example.ts +0 -158
- package/skills_ref/debugging-helpers/condition-based-waiting.md +0 -115
- package/skills_ref/debugging-helpers/defense-in-depth.md +0 -122
- package/skills_ref/debugging-helpers/find-polluter.sh +0 -63
- package/skills_ref/debugging-helpers/root-cause-tracing.md +0 -169
- package/skills_ref/debugging-helpers/test-academic.md +0 -14
- package/skills_ref/debugging-helpers/test-pressure-1.md +0 -58
- package/skills_ref/debugging-helpers/test-pressure-2.md +0 -68
- package/skills_ref/debugging-helpers/test-pressure-3.md +0 -69
- package/skills_ref/deep-research/.env.example +0 -7
- package/skills_ref/deep-research/README.md +0 -246
- package/skills_ref/deep-research/SKILL.md +0 -106
- package/skills_ref/deep-research/requirements.txt +0 -2
- package/skills_ref/deep-research/scripts/research.py +0 -692
- package/skills_ref/dependency-install-helper/SKILL.md +0 -26
- package/skills_ref/dev/SKILL.md +0 -65
- package/skills_ref/dev-backend/SKILL.md +0 -61
- package/skills_ref/dev-data/SKILL.md +0 -76
- package/skills_ref/dev-frontend/LICENSE.txt +0 -177
- package/skills_ref/dev-frontend/SKILL.md +0 -42
- package/skills_ref/dev-testing/LICENSE.txt +0 -202
- package/skills_ref/dev-testing/SKILL.md +0 -96
- package/skills_ref/dev-testing/examples/console_logging.py +0 -35
- package/skills_ref/dev-testing/examples/element_discovery.py +0 -40
- package/skills_ref/dev-testing/examples/static_html_automation.py +0 -33
- package/skills_ref/dev-testing/scripts/with_server.py +0 -106
- package/skills_ref/develop-web-game/SKILL.md +0 -149
- package/skills_ref/differential-review/.claude-plugin/plugin.json +0 -10
- package/skills_ref/differential-review/README.md +0 -109
- package/skills_ref/differential-review/commands/diff-review.md +0 -21
- package/skills_ref/differential-review/skills/differential-review/SKILL.md +0 -220
- package/skills_ref/differential-review/skills/differential-review/adversarial.md +0 -203
- package/skills_ref/differential-review/skills/differential-review/methodology.md +0 -234
- package/skills_ref/differential-review/skills/differential-review/patterns.md +0 -300
- package/skills_ref/differential-review/skills/differential-review/reporting.md +0 -369
- package/skills_ref/dispatching-parallel-agents/SKILL.md +0 -180
- package/skills_ref/doc-coauthoring/SKILL.md +0 -375
- package/skills_ref/docx/LICENSE.txt +0 -30
- package/skills_ref/docx/SKILL.md +0 -481
- package/skills_ref/docx/scripts/__init__.py +0 -1
- package/skills_ref/docx/scripts/accept_changes.py +0 -135
- package/skills_ref/docx/scripts/comment.py +0 -318
- package/skills_ref/docx/scripts/office/helpers/__init__.py +0 -0
- package/skills_ref/docx/scripts/office/helpers/merge_runs.py +0 -199
- package/skills_ref/docx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/skills_ref/docx/scripts/office/pack.py +0 -159
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/skills_ref/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/skills_ref/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/skills_ref/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/skills_ref/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/skills_ref/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/skills_ref/docx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/skills_ref/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/skills_ref/docx/scripts/office/soffice.py +0 -183
- package/skills_ref/docx/scripts/office/unpack.py +0 -132
- package/skills_ref/docx/scripts/office/validate.py +0 -111
- package/skills_ref/docx/scripts/office/validators/__init__.py +0 -15
- package/skills_ref/docx/scripts/office/validators/base.py +0 -847
- package/skills_ref/docx/scripts/office/validators/docx.py +0 -446
- package/skills_ref/docx/scripts/office/validators/pptx.py +0 -275
- package/skills_ref/docx/scripts/office/validators/redlining.py +0 -247
- package/skills_ref/docx/scripts/templates/comments.xml +0 -3
- package/skills_ref/docx/scripts/templates/commentsExtended.xml +0 -3
- package/skills_ref/docx/scripts/templates/commentsExtensible.xml +0 -3
- package/skills_ref/docx/scripts/templates/commentsIds.xml +0 -3
- package/skills_ref/docx/scripts/templates/people.xml +0 -3
- package/skills_ref/durable-objects/SKILL.md +0 -186
- package/skills_ref/durable-objects/references/rules.md +0 -286
- package/skills_ref/durable-objects/references/testing.md +0 -264
- package/skills_ref/durable-objects/references/workers.md +0 -346
- package/skills_ref/email-draft-polish/SKILL.md +0 -24
- package/skills_ref/error-message-explainer/SKILL.md +0 -27
- package/skills_ref/fal-image-edit/SKILL.md +0 -249
- package/skills_ref/fal-image-edit/scripts/edit-image.sh +0 -199
- package/skills_ref/figma-implement-design/SKILL.md +0 -264
- package/skills_ref/git-worktrees/SKILL.md +0 -218
- package/skills_ref/github/SKILL.md +0 -210
- package/skills_ref/gog/SKILL.md +0 -116
- package/skills_ref/goplaces/SKILL.md +0 -52
- package/skills_ref/himalaya/SKILL.md +0 -257
- package/skills_ref/hugging-face-cli/SKILL.md +0 -186
- package/skills_ref/hugging-face-cli/references/commands.md +0 -954
- package/skills_ref/hugging-face-cli/references/examples.md +0 -374
- package/skills_ref/hugging-face-evaluation/SKILL.md +0 -651
- package/skills_ref/hugging-face-evaluation/examples/.env.example +0 -7
- package/skills_ref/hugging-face-evaluation/examples/USAGE_EXAMPLES.md +0 -382
- package/skills_ref/hugging-face-evaluation/examples/artificial_analysis_to_hub.py +0 -141
- package/skills_ref/hugging-face-evaluation/examples/example_readme_tables.md +0 -135
- package/skills_ref/hugging-face-evaluation/examples/metric_mapping.json +0 -50
- package/skills_ref/hugging-face-evaluation/requirements.txt +0 -20
- package/skills_ref/hugging-face-evaluation/scripts/evaluation_manager.py +0 -1374
- package/skills_ref/hugging-face-evaluation/scripts/inspect_eval_uv.py +0 -104
- package/skills_ref/hugging-face-evaluation/scripts/inspect_vllm_uv.py +0 -317
- package/skills_ref/hugging-face-evaluation/scripts/lighteval_vllm_uv.py +0 -303
- package/skills_ref/hugging-face-evaluation/scripts/run_eval_job.py +0 -98
- package/skills_ref/hugging-face-evaluation/scripts/run_vllm_eval_job.py +0 -331
- package/skills_ref/hugging-face-evaluation/scripts/test_extraction.py +0 -206
- package/skills_ref/hugging-face-model-trainer/SKILL.md +0 -718
- package/skills_ref/hugging-face-model-trainer/references/gguf_conversion.md +0 -296
- package/skills_ref/hugging-face-model-trainer/references/hardware_guide.md +0 -283
- package/skills_ref/hugging-face-model-trainer/references/hub_saving.md +0 -364
- package/skills_ref/hugging-face-model-trainer/references/reliability_principles.md +0 -371
- package/skills_ref/hugging-face-model-trainer/references/trackio_guide.md +0 -189
- package/skills_ref/hugging-face-model-trainer/references/training_methods.md +0 -150
- package/skills_ref/hugging-face-model-trainer/references/training_patterns.md +0 -203
- package/skills_ref/hugging-face-model-trainer/references/troubleshooting.md +0 -282
- package/skills_ref/hugging-face-model-trainer/references/unsloth.md +0 -313
- package/skills_ref/hugging-face-model-trainer/scripts/convert_to_gguf.py +0 -424
- package/skills_ref/hugging-face-model-trainer/scripts/dataset_inspector.py +0 -417
- package/skills_ref/hugging-face-model-trainer/scripts/estimate_cost.py +0 -150
- package/skills_ref/hugging-face-model-trainer/scripts/train_dpo_example.py +0 -106
- package/skills_ref/hugging-face-model-trainer/scripts/train_grpo_example.py +0 -89
- package/skills_ref/hugging-face-model-trainer/scripts/train_sft_example.py +0 -122
- package/skills_ref/hugging-face-model-trainer/scripts/unsloth_sft_example.py +0 -512
- package/skills_ref/imagegen/SKILL.md +0 -174
- package/skills_ref/insecure-defaults/.claude-plugin/plugin.json +0 -10
- package/skills_ref/insecure-defaults/README.md +0 -45
- package/skills_ref/insecure-defaults/skills/insecure-defaults/SKILL.md +0 -117
- package/skills_ref/insecure-defaults/skills/insecure-defaults/references/examples.md +0 -409
- package/skills_ref/jupyter-notebook/SKILL.md +0 -107
- package/skills_ref/linear/SKILL.md +0 -87
- package/skills_ref/linter-fix-guide/SKILL.md +0 -27
- package/skills_ref/log-summarizer/SKILL.md +0 -27
- package/skills_ref/mcp-builder/LICENSE.txt +0 -202
- package/skills_ref/mcp-builder/SKILL.md +0 -236
- package/skills_ref/mcp-builder/reference/evaluation.md +0 -602
- package/skills_ref/mcp-builder/reference/mcp_best_practices.md +0 -249
- package/skills_ref/mcp-builder/reference/node_mcp_server.md +0 -970
- package/skills_ref/mcp-builder/reference/python_mcp_server.md +0 -719
- package/skills_ref/mcp-builder/scripts/connections.py +0 -151
- package/skills_ref/mcp-builder/scripts/evaluation.py +0 -373
- package/skills_ref/mcp-builder/scripts/example_evaluation.xml +0 -22
- package/skills_ref/mcp-builder/scripts/requirements.txt +0 -2
- package/skills_ref/memory/SKILL.md +0 -129
- package/skills_ref/modern-python/.claude-plugin/plugin.json +0 -10
- package/skills_ref/modern-python/README.md +0 -66
- package/skills_ref/modern-python/hooks/hooks.json +0 -16
- package/skills_ref/modern-python/hooks/setup-shims.bats +0 -70
- package/skills_ref/modern-python/hooks/setup-shims.sh +0 -24
- package/skills_ref/modern-python/hooks/shims/pip +0 -27
- package/skills_ref/modern-python/hooks/shims/pip-shim.bats +0 -45
- package/skills_ref/modern-python/hooks/shims/pip3 +0 -27
- package/skills_ref/modern-python/hooks/shims/pipx +0 -41
- package/skills_ref/modern-python/hooks/shims/pipx-shim.bats +0 -64
- package/skills_ref/modern-python/hooks/shims/python +0 -26
- package/skills_ref/modern-python/hooks/shims/python-shim.bats +0 -53
- package/skills_ref/modern-python/hooks/shims/python3 +0 -26
- package/skills_ref/modern-python/hooks/shims/uv +0 -27
- package/skills_ref/modern-python/hooks/shims/uv-shim.bats +0 -47
- package/skills_ref/modern-python/skills/modern-python/SKILL.md +0 -333
- package/skills_ref/modern-python/skills/modern-python/references/dependabot.md +0 -43
- package/skills_ref/modern-python/skills/modern-python/references/migration-checklist.md +0 -141
- package/skills_ref/modern-python/skills/modern-python/references/pep723-scripts.md +0 -259
- package/skills_ref/modern-python/skills/modern-python/references/prek.md +0 -211
- package/skills_ref/modern-python/skills/modern-python/references/pyproject.md +0 -254
- package/skills_ref/modern-python/skills/modern-python/references/ruff-config.md +0 -240
- package/skills_ref/modern-python/skills/modern-python/references/security-setup.md +0 -255
- package/skills_ref/modern-python/skills/modern-python/references/testing.md +0 -284
- package/skills_ref/modern-python/skills/modern-python/references/uv-commands.md +0 -200
- package/skills_ref/modern-python/skills/modern-python/templates/dependabot.yml +0 -36
- package/skills_ref/modern-python/skills/modern-python/templates/pre-commit-config.yaml +0 -66
- package/skills_ref/nano-banana-pro/SKILL.md +0 -58
- package/skills_ref/netlify-deploy/SKILL.md +0 -233
- package/skills_ref/notion/SKILL.md +0 -304
- package/skills_ref/notion-knowledge-capture/SKILL.md +0 -56
- package/skills_ref/notion-meeting-intelligence/SKILL.md +0 -60
- package/skills_ref/notion-research-documentation/SKILL.md +0 -59
- package/skills_ref/notion-spec-to-implementation/SKILL.md +0 -58
- package/skills_ref/obsidian/SKILL.md +0 -81
- package/skills_ref/openai-docs/SKILL.md +0 -56
- package/skills_ref/openhue/SKILL.md +0 -112
- package/skills_ref/pdf/SKILL.md +0 -69
- package/skills_ref/postgres/README.md +0 -77
- package/skills_ref/postgres/SKILL.md +0 -129
- package/skills_ref/postgres/connections.example.json +0 -34
- package/skills_ref/postgres/requirements.txt +0 -1
- package/skills_ref/postgres/scripts/query.py +0 -262
- package/skills_ref/pptx/LICENSE.txt +0 -30
- package/skills_ref/pptx/SKILL.md +0 -232
- package/skills_ref/pptx/editing.md +0 -205
- package/skills_ref/pptx/pptxgenjs.md +0 -420
- package/skills_ref/pptx/scripts/__init__.py +0 -0
- package/skills_ref/pptx/scripts/add_slide.py +0 -195
- package/skills_ref/pptx/scripts/clean.py +0 -286
- package/skills_ref/pptx/scripts/office/helpers/__init__.py +0 -0
- package/skills_ref/pptx/scripts/office/helpers/merge_runs.py +0 -199
- package/skills_ref/pptx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/skills_ref/pptx/scripts/office/pack.py +0 -159
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/skills_ref/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/skills_ref/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/skills_ref/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/skills_ref/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/skills_ref/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/skills_ref/pptx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/skills_ref/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/skills_ref/pptx/scripts/office/soffice.py +0 -183
- package/skills_ref/pptx/scripts/office/unpack.py +0 -132
- package/skills_ref/pptx/scripts/office/validate.py +0 -111
- package/skills_ref/pptx/scripts/office/validators/__init__.py +0 -15
- package/skills_ref/pptx/scripts/office/validators/base.py +0 -847
- package/skills_ref/pptx/scripts/office/validators/docx.py +0 -446
- package/skills_ref/pptx/scripts/office/validators/pptx.py +0 -275
- package/skills_ref/pptx/scripts/office/validators/redlining.py +0 -247
- package/skills_ref/pptx/scripts/thumbnail.py +0 -289
- package/skills_ref/property-based-testing/.claude-plugin/plugin.json +0 -9
- package/skills_ref/property-based-testing/README.md +0 -47
- package/skills_ref/property-based-testing/skills/property-based-testing/README.md +0 -88
- package/skills_ref/property-based-testing/skills/property-based-testing/SKILL.md +0 -123
- package/skills_ref/property-based-testing/skills/property-based-testing/references/design.md +0 -191
- package/skills_ref/property-based-testing/skills/property-based-testing/references/generating.md +0 -204
- package/skills_ref/property-based-testing/skills/property-based-testing/references/interpreting-failures.md +0 -239
- package/skills_ref/property-based-testing/skills/property-based-testing/references/libraries.md +0 -130
- package/skills_ref/property-based-testing/skills/property-based-testing/references/refactoring.md +0 -181
- package/skills_ref/property-based-testing/skills/property-based-testing/references/reviewing.md +0 -209
- package/skills_ref/property-based-testing/skills/property-based-testing/references/strategies.md +0 -124
- package/skills_ref/react-best-practices/AGENTS.md +0 -2934
- package/skills_ref/react-best-practices/README.md +0 -123
- package/skills_ref/react-best-practices/SKILL.md +0 -136
- package/skills_ref/react-best-practices/metadata.json +0 -15
- package/skills_ref/react-best-practices/rules/_sections.md +0 -46
- package/skills_ref/react-best-practices/rules/_template.md +0 -28
- package/skills_ref/react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/skills_ref/react-best-practices/rules/advanced-init-once.md +0 -42
- package/skills_ref/react-best-practices/rules/advanced-use-latest.md +0 -39
- package/skills_ref/react-best-practices/rules/async-api-routes.md +0 -38
- package/skills_ref/react-best-practices/rules/async-defer-await.md +0 -80
- package/skills_ref/react-best-practices/rules/async-dependencies.md +0 -51
- package/skills_ref/react-best-practices/rules/async-parallel.md +0 -28
- package/skills_ref/react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/skills_ref/react-best-practices/rules/bundle-barrel-imports.md +0 -59
- package/skills_ref/react-best-practices/rules/bundle-conditional.md +0 -31
- package/skills_ref/react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/skills_ref/react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/skills_ref/react-best-practices/rules/bundle-preload.md +0 -50
- package/skills_ref/react-best-practices/rules/client-event-listeners.md +0 -74
- package/skills_ref/react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/skills_ref/react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/skills_ref/react-best-practices/rules/client-swr-dedup.md +0 -56
- package/skills_ref/react-best-practices/rules/js-batch-dom-css.md +0 -107
- package/skills_ref/react-best-practices/rules/js-cache-function-results.md +0 -80
- package/skills_ref/react-best-practices/rules/js-cache-property-access.md +0 -28
- package/skills_ref/react-best-practices/rules/js-cache-storage.md +0 -70
- package/skills_ref/react-best-practices/rules/js-combine-iterations.md +0 -32
- package/skills_ref/react-best-practices/rules/js-early-exit.md +0 -50
- package/skills_ref/react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/skills_ref/react-best-practices/rules/js-index-maps.md +0 -37
- package/skills_ref/react-best-practices/rules/js-length-check-first.md +0 -49
- package/skills_ref/react-best-practices/rules/js-min-max-loop.md +0 -82
- package/skills_ref/react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/skills_ref/react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/skills_ref/react-best-practices/rules/rendering-activity.md +0 -26
- package/skills_ref/react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/skills_ref/react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/skills_ref/react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/skills_ref/react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/skills_ref/react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/skills_ref/react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
- package/skills_ref/react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/skills_ref/react-best-practices/rules/rendering-usetransition-loading.md +0 -75
- package/skills_ref/react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/skills_ref/react-best-practices/rules/rerender-dependencies.md +0 -45
- package/skills_ref/react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
- package/skills_ref/react-best-practices/rules/rerender-derived-state.md +0 -29
- package/skills_ref/react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/skills_ref/react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/skills_ref/react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
- package/skills_ref/react-best-practices/rules/rerender-memo.md +0 -44
- package/skills_ref/react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
- package/skills_ref/react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
- package/skills_ref/react-best-practices/rules/rerender-transitions.md +0 -40
- package/skills_ref/react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
- package/skills_ref/react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/skills_ref/react-best-practices/rules/server-auth-actions.md +0 -96
- package/skills_ref/react-best-practices/rules/server-cache-lru.md +0 -41
- package/skills_ref/react-best-practices/rules/server-cache-react.md +0 -76
- package/skills_ref/react-best-practices/rules/server-dedup-props.md +0 -65
- package/skills_ref/react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/skills_ref/react-best-practices/rules/server-serialization.md +0 -38
- package/skills_ref/receiving-code-review/SKILL.md +0 -213
- package/skills_ref/registry.json +0 -1493
- package/skills_ref/render-deploy/SKILL.md +0 -462
- package/skills_ref/requesting-code-review/SKILL.md +0 -105
- package/skills_ref/requesting-code-review/code-reviewer.md +0 -146
- package/skills_ref/screen-capture/SKILL.md +0 -162
- package/skills_ref/security-best-practices/LICENSE.txt +0 -201
- package/skills_ref/security-best-practices/SKILL.md +0 -86
- package/skills_ref/security-best-practices/agents/openai.yaml +0 -4
- package/skills_ref/security-best-practices/references/golang-general-backend-security.md +0 -826
- package/skills_ref/security-best-practices/references/javascript-express-web-server-security.md +0 -1158
- package/skills_ref/security-best-practices/references/javascript-general-web-frontend-security.md +0 -747
- package/skills_ref/security-best-practices/references/javascript-jquery-web-frontend-security.md +0 -678
- package/skills_ref/security-best-practices/references/javascript-typescript-nextjs-web-server-security.md +0 -1144
- package/skills_ref/security-best-practices/references/javascript-typescript-react-web-frontend-security.md +0 -990
- package/skills_ref/security-best-practices/references/javascript-typescript-vue-web-frontend-security.md +0 -791
- package/skills_ref/security-best-practices/references/python-django-web-server-security.md +0 -882
- package/skills_ref/security-best-practices/references/python-fastapi-web-server-security.md +0 -1036
- package/skills_ref/security-best-practices/references/python-flask-web-server-security.md +0 -705
- package/skills_ref/security-ownership-map/LICENSE.txt +0 -201
- package/skills_ref/security-ownership-map/SKILL.md +0 -206
- package/skills_ref/security-ownership-map/agents/openai.yaml +0 -4
- package/skills_ref/security-ownership-map/references/neo4j-import.md +0 -60
- package/skills_ref/security-ownership-map/scripts/build_ownership_map.py +0 -956
- package/skills_ref/security-ownership-map/scripts/community_maintainers.py +0 -544
- package/skills_ref/security-ownership-map/scripts/query_ownership.py +0 -483
- package/skills_ref/security-ownership-map/scripts/run_ownership_map.py +0 -200
- package/skills_ref/security-threat-model/LICENSE.txt +0 -201
- package/skills_ref/security-threat-model/SKILL.md +0 -81
- package/skills_ref/security-threat-model/agents/openai.yaml +0 -4
- package/skills_ref/security-threat-model/references/prompt-template.md +0 -255
- package/skills_ref/security-threat-model/references/security-controls-and-assets.md +0 -32
- package/skills_ref/sentry/SKILL.md +0 -123
- package/skills_ref/skill-creator/SKILL.md +0 -372
- package/skills_ref/sora/SKILL.md +0 -153
- package/skills_ref/speech/SKILL.md +0 -144
- package/skills_ref/spotify-player/SKILL.md +0 -64
- package/skills_ref/static-analysis/.claude-plugin/plugin.json +0 -8
- package/skills_ref/static-analysis/README.md +0 -65
- package/skills_ref/static-analysis/agents/semgrep-scanner.md +0 -71
- package/skills_ref/static-analysis/agents/semgrep-triager.md +0 -107
- package/skills_ref/static-analysis/skills/codeql/SKILL.md +0 -119
- package/skills_ref/static-analysis/skills/codeql/references/diagnostic-query-templates.md +0 -339
- package/skills_ref/static-analysis/skills/codeql/references/language-details.md +0 -207
- package/skills_ref/static-analysis/skills/codeql/references/performance-tuning.md +0 -111
- package/skills_ref/static-analysis/skills/codeql/references/ruleset-catalog.md +0 -63
- package/skills_ref/static-analysis/skills/codeql/references/threat-models.md +0 -44
- package/skills_ref/static-analysis/skills/codeql/workflows/build-database.md +0 -669
- package/skills_ref/static-analysis/skills/codeql/workflows/create-data-extensions.md +0 -536
- package/skills_ref/static-analysis/skills/codeql/workflows/run-analysis.md +0 -436
- package/skills_ref/static-analysis/skills/sarif-parsing/SKILL.md +0 -479
- package/skills_ref/static-analysis/skills/sarif-parsing/resources/jq-queries.md +0 -162
- package/skills_ref/static-analysis/skills/sarif-parsing/resources/sarif_helpers.py +0 -331
- package/skills_ref/static-analysis/skills/semgrep/SKILL.md +0 -431
- package/skills_ref/static-analysis/skills/semgrep/references/rulesets.md +0 -162
- package/skills_ref/static-analysis/skills/semgrep/references/scanner-task-prompt.md +0 -102
- package/skills_ref/static-analysis/skills/semgrep/references/triage-task-prompt.md +0 -122
- package/skills_ref/static-analysis/skills/semgrep/scripts/merge_triaged_sarif.py +0 -252
- package/skills_ref/summarize/SKILL.md +0 -87
- package/skills_ref/tdd/SKILL.md +0 -371
- package/skills_ref/tdd/testing-anti-patterns.md +0 -299
- package/skills_ref/telegram-send/SKILL.md +0 -99
- package/skills_ref/terraform/README.md +0 -105
- package/skills_ref/terraform/code-generation/.claude-plugin/plugin.json +0 -30
- package/skills_ref/terraform/code-generation/skills/azure-verified-modules/SKILL.md +0 -613
- package/skills_ref/terraform/code-generation/skills/terraform-style-guide/SKILL.md +0 -353
- package/skills_ref/terraform/code-generation/skills/terraform-test/SKILL.md +0 -1669
- package/skills_ref/terraform/module-generation/.claude-plugin/plugin.json +0 -30
- package/skills_ref/terraform/module-generation/skills/refactor-module/SKILL.md +0 -538
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/SKILL.md +0 -468
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/api-monitoring.md +0 -543
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/component-blocks.md +0 -476
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/deployment-blocks.md +0 -391
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/examples.md +0 -1529
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/linked-stacks.md +0 -187
- package/skills_ref/terraform/module-generation/skills/terraform-stacks/references/troubleshooting.md +0 -671
- package/skills_ref/terraform/provider-development/.claude-plugin/plugin.json +0 -13
- package/skills_ref/terraform/provider-development/skills/new-terraform-provider/SKILL.md +0 -25
- package/skills_ref/terraform/provider-development/skills/new-terraform-provider/assets/main.go +0 -40
- package/skills_ref/terraform/provider-development/skills/provider-actions/SKILL.md +0 -478
- package/skills_ref/terraform/provider-development/skills/provider-resources/SKILL.md +0 -599
- package/skills_ref/terraform/provider-development/skills/run-acceptance-tests/SKILL.md +0 -41
- package/skills_ref/theme-factory/LICENSE.txt +0 -202
- package/skills_ref/theme-factory/SKILL.md +0 -59
- package/skills_ref/theme-factory/theme-showcase.pdf +0 -0
- package/skills_ref/theme-factory/themes/arctic-frost.md +0 -19
- package/skills_ref/theme-factory/themes/botanical-garden.md +0 -19
- package/skills_ref/theme-factory/themes/desert-rose.md +0 -19
- package/skills_ref/theme-factory/themes/forest-canopy.md +0 -19
- package/skills_ref/theme-factory/themes/golden-hour.md +0 -19
- package/skills_ref/theme-factory/themes/midnight-galaxy.md +0 -19
- package/skills_ref/theme-factory/themes/modern-minimalist.md +0 -19
- package/skills_ref/theme-factory/themes/ocean-depths.md +0 -19
- package/skills_ref/theme-factory/themes/sunset-boulevard.md +0 -19
- package/skills_ref/theme-factory/themes/tech-innovation.md +0 -19
- package/skills_ref/things-mac/SKILL.md +0 -86
- package/skills_ref/tmux/SKILL.md +0 -153
- package/skills_ref/transcribe/SKILL.md +0 -81
- package/skills_ref/trello/SKILL.md +0 -95
- package/skills_ref/tts/SKILL.md +0 -99
- package/skills_ref/vercel-deploy/SKILL.md +0 -115
- package/skills_ref/video-downloader/SKILL.md +0 -99
- package/skills_ref/video-downloader/scripts/download_video.py +0 -145
- package/skills_ref/video-frames/SKILL.md +0 -46
- package/skills_ref/vision-click/SKILL.md +0 -128
- package/skills_ref/weather/SKILL.md +0 -112
- package/skills_ref/web-artifacts-builder/LICENSE.txt +0 -202
- package/skills_ref/web-artifacts-builder/SKILL.md +0 -74
- package/skills_ref/web-artifacts-builder/scripts/bundle-artifact.sh +0 -54
- package/skills_ref/web-artifacts-builder/scripts/init-artifact.sh +0 -322
- package/skills_ref/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/skills_ref/web-perf/SKILL.md +0 -193
- package/skills_ref/web-routing/SKILL.md +0 -26
- package/skills_ref/whatsapp/SKILL.md +0 -255
- package/skills_ref/whatsapp/assets/agent-app-integration-example.json +0 -35
- package/skills_ref/whatsapp/assets/databases-example.json +0 -11
- package/skills_ref/whatsapp/assets/function-decide-route-interactive-buttons.json +0 -6
- package/skills_ref/whatsapp/assets/functions-example.json +0 -5
- package/skills_ref/whatsapp/assets/workflow-agent-simple.json +0 -31
- package/skills_ref/whatsapp/assets/workflow-api-template-wait-agent.json +0 -59
- package/skills_ref/whatsapp/assets/workflow-customer-support-intake-agent.json +0 -56
- package/skills_ref/whatsapp/assets/workflow-decision.json +0 -83
- package/skills_ref/whatsapp/assets/workflow-interactive-buttons-decide-ai.json +0 -89
- package/skills_ref/whatsapp/assets/workflow-interactive-buttons-decide-function.json +0 -88
- package/skills_ref/whatsapp/assets/workflow-linear.json +0 -53
- package/skills_ref/whatsapp/package.json +0 -10
- package/skills_ref/whatsapp/references/app-integrations.md +0 -89
- package/skills_ref/whatsapp/references/databases-reference.md +0 -21
- package/skills_ref/whatsapp/references/execution-context.md +0 -42
- package/skills_ref/whatsapp/references/function-contracts.md +0 -55
- package/skills_ref/whatsapp/references/functions-payloads.md +0 -87
- package/skills_ref/whatsapp/references/functions-reference.md +0 -133
- package/skills_ref/whatsapp/references/graph-contract.md +0 -145
- package/skills_ref/whatsapp/references/node-types.md +0 -430
- package/skills_ref/whatsapp/references/triggers.md +0 -20
- package/skills_ref/whatsapp/references/workflow-overview.md +0 -22
- package/skills_ref/whatsapp/references/workflow-reference.md +0 -123
- package/skills_ref/whatsapp/scripts/configure-prop.js +0 -113
- package/skills_ref/whatsapp/scripts/create-connect-token.js +0 -38
- package/skills_ref/whatsapp/scripts/create-function.js +0 -64
- package/skills_ref/whatsapp/scripts/create-integration.js +0 -137
- package/skills_ref/whatsapp/scripts/create-row.js +0 -47
- package/skills_ref/whatsapp/scripts/create-trigger.js +0 -88
- package/skills_ref/whatsapp/scripts/create-workflow.js +0 -85
- package/skills_ref/whatsapp/scripts/delete-integration.js +0 -44
- package/skills_ref/whatsapp/scripts/delete-row.js +0 -49
- package/skills_ref/whatsapp/scripts/delete-trigger.js +0 -44
- package/skills_ref/whatsapp/scripts/deploy-function.js +0 -47
- package/skills_ref/whatsapp/scripts/edit-graph.js +0 -289
- package/skills_ref/whatsapp/scripts/get-action-schema.js +0 -44
- package/skills_ref/whatsapp/scripts/get-context-value.js +0 -80
- package/skills_ref/whatsapp/scripts/get-execution-event.js +0 -55
- package/skills_ref/whatsapp/scripts/get-execution.js +0 -44
- package/skills_ref/whatsapp/scripts/get-function.js +0 -43
- package/skills_ref/whatsapp/scripts/get-graph.js +0 -85
- package/skills_ref/whatsapp/scripts/get-table.js +0 -45
- package/skills_ref/whatsapp/scripts/get-workflow.js +0 -44
- package/skills_ref/whatsapp/scripts/invoke-function.js +0 -60
- package/skills_ref/whatsapp/scripts/lib/databases/args.js +0 -87
- package/skills_ref/whatsapp/scripts/lib/databases/filters.js +0 -30
- package/skills_ref/whatsapp/scripts/lib/databases/kapso-api.js +0 -70
- package/skills_ref/whatsapp/scripts/lib/functions/args.js +0 -55
- package/skills_ref/whatsapp/scripts/lib/functions/kapso-api.js +0 -70
- package/skills_ref/whatsapp/scripts/lib/workflows/args.js +0 -53
- package/skills_ref/whatsapp/scripts/lib/workflows/kapso-api.js +0 -123
- package/skills_ref/whatsapp/scripts/lib/workflows/result.js +0 -16
- package/skills_ref/whatsapp/scripts/list-accounts.js +0 -62
- package/skills_ref/whatsapp/scripts/list-apps.js +0 -42
- package/skills_ref/whatsapp/scripts/list-execution-events.js +0 -61
- package/skills_ref/whatsapp/scripts/list-executions.js +0 -53
- package/skills_ref/whatsapp/scripts/list-function-invocations.js +0 -53
- package/skills_ref/whatsapp/scripts/list-functions.js +0 -41
- package/skills_ref/whatsapp/scripts/list-integrations.js +0 -41
- package/skills_ref/whatsapp/scripts/list-provider-models.js +0 -48
- package/skills_ref/whatsapp/scripts/list-tables.js +0 -41
- package/skills_ref/whatsapp/scripts/list-triggers.js +0 -44
- package/skills_ref/whatsapp/scripts/list-whatsapp-phone-numbers.js +0 -56
- package/skills_ref/whatsapp/scripts/list-workflows.js +0 -44
- package/skills_ref/whatsapp/scripts/openapi-explore.mjs +0 -1273
- package/skills_ref/whatsapp/scripts/query-rows.js +0 -71
- package/skills_ref/whatsapp/scripts/reload-props.js +0 -110
- package/skills_ref/whatsapp/scripts/resume-execution.js +0 -75
- package/skills_ref/whatsapp/scripts/search-actions.js +0 -64
- package/skills_ref/whatsapp/scripts/update-execution-status.js +0 -51
- package/skills_ref/whatsapp/scripts/update-function.js +0 -65
- package/skills_ref/whatsapp/scripts/update-graph.js +0 -154
- package/skills_ref/whatsapp/scripts/update-integration.js +0 -82
- package/skills_ref/whatsapp/scripts/update-row.js +0 -51
- package/skills_ref/whatsapp/scripts/update-trigger.js +0 -60
- package/skills_ref/whatsapp/scripts/update-workflow-settings.js +0 -67
- package/skills_ref/whatsapp/scripts/upsert-row.js +0 -64
- package/skills_ref/whatsapp/scripts/validate-graph.js +0 -293
- package/skills_ref/whatsapp/scripts/variables-delete.js +0 -37
- package/skills_ref/whatsapp/scripts/variables-list.js +0 -55
- package/skills_ref/whatsapp/scripts/variables-set.js +0 -39
- package/skills_ref/writing-plans/SKILL.md +0 -116
- package/skills_ref/xlsx/LICENSE.txt +0 -30
- package/skills_ref/xlsx/SKILL.md +0 -292
- package/skills_ref/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/skills_ref/xlsx/scripts/office/helpers/merge_runs.py +0 -199
- package/skills_ref/xlsx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/skills_ref/xlsx/scripts/office/pack.py +0 -159
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/skills_ref/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/skills_ref/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/skills_ref/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/skills_ref/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/skills_ref/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/skills_ref/xlsx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/skills_ref/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/skills_ref/xlsx/scripts/office/soffice.py +0 -183
- package/skills_ref/xlsx/scripts/office/unpack.py +0 -132
- package/skills_ref/xlsx/scripts/office/validate.py +0 -111
- package/skills_ref/xlsx/scripts/office/validators/__init__.py +0 -15
- package/skills_ref/xlsx/scripts/office/validators/base.py +0 -847
- package/skills_ref/xlsx/scripts/office/validators/docx.py +0 -446
- package/skills_ref/xlsx/scripts/office/validators/pptx.py +0 -275
- package/skills_ref/xlsx/scripts/office/validators/redlining.py +0 -247
- package/skills_ref/xlsx/scripts/recalc.py +0 -184
- package/skills_ref/xurl/SKILL.md +0 -461
|
@@ -1,1273 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { readFileSync, readdirSync, statSync } from 'fs'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import { parse as parseYaml } from 'yaml'
|
|
7
|
-
|
|
8
|
-
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete', 'options', 'head']
|
|
9
|
-
const DEFAULT_PUBLISHED_WHATSAPP_OPENAPI = 'https://docs.kapso.ai/api/meta/whatsapp/openapi-whatsapp.yaml'
|
|
10
|
-
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url))
|
|
11
|
-
|
|
12
|
-
function printHelp(exitCode = 0) {
|
|
13
|
-
const msg = `
|
|
14
|
-
Explore OpenAPI specs (YAML)
|
|
15
|
-
|
|
16
|
-
Usage:
|
|
17
|
-
node openapi-explore.mjs [openapi.yaml ...] <command> [args]
|
|
18
|
-
node openapi-explore.mjs [--file <path> ...] <command> [args]
|
|
19
|
-
node openapi-explore.mjs --all <command> [args]
|
|
20
|
-
|
|
21
|
-
Default (no files passed):
|
|
22
|
-
Loads the published OpenAPI files from docs.kapso.ai:
|
|
23
|
-
- ${DEFAULT_PUBLISHED_WHATSAPP_OPENAPI}
|
|
24
|
-
- (plus platform + workflows, deduced from that URL)
|
|
25
|
-
|
|
26
|
-
Fallback:
|
|
27
|
-
If it can't fetch the published specs (offline, etc.), it falls back to local repo files:
|
|
28
|
-
api/**/openapi-*.yaml
|
|
29
|
-
|
|
30
|
-
Use --all to force local auto-discovery.
|
|
31
|
-
|
|
32
|
-
Commands:
|
|
33
|
-
specs
|
|
34
|
-
tags [--spec <id>]
|
|
35
|
-
ops [--spec <id>] [--tag <tag>] [--q <query>]
|
|
36
|
-
search <query> [--spec <id>]
|
|
37
|
-
op <operationId | specId:operationId | "METHOD /path"> [--spec <id>]
|
|
38
|
-
schema <SchemaName | specId:SchemaName> [--spec <id>]
|
|
39
|
-
where <SchemaName | specId:SchemaName> [--spec <id>]
|
|
40
|
-
|
|
41
|
-
Flags:
|
|
42
|
-
--file, -f <path> Load a spec file (repeatable)
|
|
43
|
-
--all Load all api/**/openapi-*.yaml files
|
|
44
|
-
--spec <id> Filter by spec id (platform, workflows, whatsapp, ...)
|
|
45
|
-
--json Output JSON (search/ops/where)
|
|
46
|
-
--limit <n> Limit results (default 30)
|
|
47
|
-
`
|
|
48
|
-
console.log(msg.trim())
|
|
49
|
-
process.exit(exitCode)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function die(msg, exitCode = 1) {
|
|
53
|
-
console.error(msg)
|
|
54
|
-
process.exit(exitCode)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function parseArgs(argv) {
|
|
58
|
-
const args = [...argv]
|
|
59
|
-
const opts = { files: [], all: false, spec: null, json: false, limit: 30, tag: null, q: null }
|
|
60
|
-
let command = null
|
|
61
|
-
const rest = []
|
|
62
|
-
|
|
63
|
-
for (let i = 0; i < args.length; i++) {
|
|
64
|
-
const a = args[i]
|
|
65
|
-
if (a === '--help' || a === '-h') printHelp(0)
|
|
66
|
-
|
|
67
|
-
if (a === '--all') {
|
|
68
|
-
opts.all = true
|
|
69
|
-
continue
|
|
70
|
-
}
|
|
71
|
-
if (a === '--json') {
|
|
72
|
-
opts.json = true
|
|
73
|
-
continue
|
|
74
|
-
}
|
|
75
|
-
if (a === '--file' || a === '-f') {
|
|
76
|
-
const p = args[++i]
|
|
77
|
-
if (!p) die('Missing value for --file')
|
|
78
|
-
opts.files.push(p)
|
|
79
|
-
continue
|
|
80
|
-
}
|
|
81
|
-
if (a === '--spec') {
|
|
82
|
-
opts.spec = args[++i] || null
|
|
83
|
-
if (!opts.spec) die('Missing value for --spec')
|
|
84
|
-
continue
|
|
85
|
-
}
|
|
86
|
-
if (a === '--limit') {
|
|
87
|
-
const raw = args[++i]
|
|
88
|
-
const n = Number(raw)
|
|
89
|
-
if (!Number.isFinite(n) || n <= 0) die(`Invalid --limit: ${raw}`)
|
|
90
|
-
opts.limit = n
|
|
91
|
-
continue
|
|
92
|
-
}
|
|
93
|
-
if (a === '--tag') {
|
|
94
|
-
opts.tag = args[++i] || null
|
|
95
|
-
if (!opts.tag) die('Missing value for --tag')
|
|
96
|
-
continue
|
|
97
|
-
}
|
|
98
|
-
if (a === '--q') {
|
|
99
|
-
opts.q = args[++i] || null
|
|
100
|
-
if (!opts.q) die('Missing value for --q')
|
|
101
|
-
continue
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (!command && (a.endsWith('.yaml') || a.endsWith('.yml'))) {
|
|
105
|
-
opts.files.push(a)
|
|
106
|
-
continue
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!command) command = a
|
|
110
|
-
else rest.push(a)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return { opts, command, rest }
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function walk(dir, { filePattern, maxDepth = 10 } = {}, depth = 0, out = []) {
|
|
117
|
-
if (depth > maxDepth) return out
|
|
118
|
-
let entries
|
|
119
|
-
try {
|
|
120
|
-
entries = readdirSync(dir)
|
|
121
|
-
} catch {
|
|
122
|
-
return out
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
for (const entry of entries) {
|
|
126
|
-
const full = path.join(dir, entry)
|
|
127
|
-
let st
|
|
128
|
-
try {
|
|
129
|
-
st = statSync(full)
|
|
130
|
-
} catch {
|
|
131
|
-
continue
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (st.isDirectory()) {
|
|
135
|
-
walk(full, { filePattern, maxDepth }, depth + 1, out)
|
|
136
|
-
} else if (!filePattern || filePattern.test(entry)) {
|
|
137
|
-
out.push(full)
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return out
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function findUpDir(startDir, targetDirName, { maxDepth = 12 } = {}) {
|
|
145
|
-
let current = path.resolve(startDir)
|
|
146
|
-
for (let i = 0; i <= maxDepth; i++) {
|
|
147
|
-
const candidate = path.join(current, targetDirName)
|
|
148
|
-
try {
|
|
149
|
-
const st = statSync(candidate)
|
|
150
|
-
if (st.isDirectory()) return candidate
|
|
151
|
-
} catch {
|
|
152
|
-
// ignore
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const parent = path.dirname(current)
|
|
156
|
-
if (parent === current) break
|
|
157
|
-
current = parent
|
|
158
|
-
}
|
|
159
|
-
return null
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function findLocalApiDir() {
|
|
163
|
-
return findUpDir(process.cwd(), 'api') || findUpDir(SCRIPT_DIR, 'api')
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function isUrl(s) {
|
|
167
|
-
return /^https?:\/\//i.test(String(s))
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function deducePublishedOpenApiUrls(whatsappUrl = DEFAULT_PUBLISHED_WHATSAPP_OPENAPI) {
|
|
171
|
-
const u = new URL(whatsappUrl)
|
|
172
|
-
const origin = u.origin
|
|
173
|
-
return [
|
|
174
|
-
whatsappUrl,
|
|
175
|
-
new URL('/api/platform/v1/openapi-platform.yaml', origin).toString(),
|
|
176
|
-
new URL('/api/platform/v1/openapi-workflows.yaml', origin).toString(),
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function inferSpecId(filePath, spec) {
|
|
181
|
-
const base = (isUrl(filePath) ? path.basename(new URL(filePath).pathname) : path.basename(filePath)).toLowerCase()
|
|
182
|
-
if (base.includes('whatsapp')) return 'whatsapp'
|
|
183
|
-
if (base.includes('workflows')) return 'workflows'
|
|
184
|
-
if (base.includes('platform')) return 'platform'
|
|
185
|
-
|
|
186
|
-
const title = (spec?.info?.title || '').toLowerCase()
|
|
187
|
-
if (title.includes('whatsapp')) return 'whatsapp'
|
|
188
|
-
if (title.includes('workflow')) return 'workflows'
|
|
189
|
-
if (title.includes('platform')) return 'platform'
|
|
190
|
-
|
|
191
|
-
return base.replace(/^openapi-/, '').replace(/\.(ya?ml)$/, '') || 'spec'
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function decodeJsonPointerToken(token) {
|
|
195
|
-
return token.replaceAll('~1', '/').replaceAll('~0', '~')
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function getByJsonPointer(doc, pointer) {
|
|
199
|
-
if (!pointer || !pointer.startsWith('#/')) return null
|
|
200
|
-
const parts = pointer.slice(2).split('/').map(decodeJsonPointerToken)
|
|
201
|
-
let cur = doc
|
|
202
|
-
for (const part of parts) {
|
|
203
|
-
if (cur == null) return null
|
|
204
|
-
cur = cur[part]
|
|
205
|
-
}
|
|
206
|
-
return cur ?? null
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function refName(ref) {
|
|
210
|
-
if (!ref) return null
|
|
211
|
-
const parts = String(ref).split('/')
|
|
212
|
-
return parts[parts.length - 1] || null
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function derefObject(obj, doc, stack = new Set()) {
|
|
216
|
-
if (!obj?.$ref) return obj
|
|
217
|
-
const ref = String(obj.$ref)
|
|
218
|
-
if (stack.has(ref)) return obj
|
|
219
|
-
stack.add(ref)
|
|
220
|
-
const resolved = getByJsonPointer(doc, ref)
|
|
221
|
-
if (!resolved) return obj
|
|
222
|
-
return derefObject(resolved, doc, stack)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function schemaTypeString(schema) {
|
|
226
|
-
if (!schema) return 'any'
|
|
227
|
-
if (schema.$ref) return refName(schema.$ref) || 'ref'
|
|
228
|
-
if (schema.const !== undefined) return `const ${JSON.stringify(schema.const)}`
|
|
229
|
-
if (schema.enum?.length) {
|
|
230
|
-
const vals = schema.enum.slice(0, 6).map((v) => JSON.stringify(v)).join(' | ')
|
|
231
|
-
return schema.enum.length > 6 ? `enum(${vals} | ...)` : `enum(${vals})`
|
|
232
|
-
}
|
|
233
|
-
if (schema.type) {
|
|
234
|
-
if (Array.isArray(schema.type)) return schema.type.join('|')
|
|
235
|
-
return schema.type
|
|
236
|
-
}
|
|
237
|
-
if (schema.oneOf) return 'oneOf'
|
|
238
|
-
if (schema.anyOf) return 'anyOf'
|
|
239
|
-
if (schema.allOf) return 'allOf'
|
|
240
|
-
if (schema.properties) return 'object'
|
|
241
|
-
if (schema.items) return 'array'
|
|
242
|
-
return 'any'
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function normalizeType(schema) {
|
|
246
|
-
if (!schema) return null
|
|
247
|
-
const t = schema.type
|
|
248
|
-
if (!t) return null
|
|
249
|
-
if (Array.isArray(t)) {
|
|
250
|
-
const nonNull = t.find((x) => x !== 'null')
|
|
251
|
-
return nonNull || t[0] || null
|
|
252
|
-
}
|
|
253
|
-
return t
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function mergeAllOf(schema, doc, seen = new Set()) {
|
|
257
|
-
if (!schema?.allOf?.length) return schema
|
|
258
|
-
|
|
259
|
-
const out = { ...schema }
|
|
260
|
-
delete out.allOf
|
|
261
|
-
|
|
262
|
-
let merged = { type: 'object', properties: {}, required: [] }
|
|
263
|
-
|
|
264
|
-
for (const part of schema.allOf) {
|
|
265
|
-
let s = part
|
|
266
|
-
if (s?.$ref) {
|
|
267
|
-
const name = refName(s.$ref)
|
|
268
|
-
if (name) {
|
|
269
|
-
if (seen.has(name)) continue
|
|
270
|
-
seen.add(name)
|
|
271
|
-
}
|
|
272
|
-
s = getByJsonPointer(doc, s.$ref) || s
|
|
273
|
-
}
|
|
274
|
-
if (s?.allOf) s = mergeAllOf(s, doc, seen)
|
|
275
|
-
|
|
276
|
-
if (s?.type && normalizeType(s) !== 'object' && s.properties) {
|
|
277
|
-
// some specs omit type: object but still have properties
|
|
278
|
-
} else if (normalizeType(s) && normalizeType(s) !== 'object' && !s.properties) {
|
|
279
|
-
return schema
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (s?.properties) Object.assign(merged.properties, s.properties)
|
|
283
|
-
if (Array.isArray(s?.required)) merged.required.push(...s.required)
|
|
284
|
-
if (s?.description && !merged.description) merged.description = s.description
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
merged.required = [...new Set(merged.required)]
|
|
288
|
-
return { ...merged, ...out }
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function formatSchemaPreview(schema, doc, { depth = 2, maxProps = 12 } = {}, indent = '', refStack = new Set()) {
|
|
292
|
-
if (!schema) return [`${indent}any`]
|
|
293
|
-
|
|
294
|
-
if (schema.$ref) {
|
|
295
|
-
const name = refName(schema.$ref) || schema.$ref
|
|
296
|
-
const resolved = getByJsonPointer(doc, schema.$ref)
|
|
297
|
-
const lines = [`${indent}${name}`]
|
|
298
|
-
const refKey = String(schema.$ref)
|
|
299
|
-
if (refStack.has(refKey)) return lines
|
|
300
|
-
refStack.add(refKey)
|
|
301
|
-
if (resolved && depth > 0) {
|
|
302
|
-
const next = resolved?.allOf ? mergeAllOf(resolved, doc) : resolved
|
|
303
|
-
const childLines = formatSchemaPreview(next, doc, { depth, maxProps }, indent + ' ', refStack)
|
|
304
|
-
// Avoid printing a single redundant "object" line for refs
|
|
305
|
-
if (!(childLines.length === 1 && childLines[0].trim() === 'object')) lines.push(...childLines)
|
|
306
|
-
}
|
|
307
|
-
refStack.delete(refKey)
|
|
308
|
-
return lines
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
const normalized = schema.allOf ? mergeAllOf(schema, doc) : schema
|
|
312
|
-
|
|
313
|
-
const t = normalizeType(normalized) || schemaTypeString(normalized)
|
|
314
|
-
if (t === 'object' || normalized.properties) {
|
|
315
|
-
const props = normalized.properties || {}
|
|
316
|
-
const required = new Set(normalized.required || [])
|
|
317
|
-
const keys = Object.keys(props)
|
|
318
|
-
if (!keys.length) return [`${indent}object`]
|
|
319
|
-
|
|
320
|
-
const lines = []
|
|
321
|
-
for (const key of keys.slice(0, maxProps)) {
|
|
322
|
-
const s = props[key]
|
|
323
|
-
const typeStr = schemaTypeString(s)
|
|
324
|
-
const req = required.has(key) ? ' (required)' : ''
|
|
325
|
-
const desc = s?.description ? ` - ${String(s.description).replaceAll('\n', ' ').slice(0, 80)}` : ''
|
|
326
|
-
lines.push(`${indent}- ${key}: ${typeStr}${req}${desc}`)
|
|
327
|
-
if (depth > 0) {
|
|
328
|
-
const child = s?.$ref ? getByJsonPointer(doc, s.$ref) : s
|
|
329
|
-
const childNorm = child?.allOf ? mergeAllOf(child, doc) : child
|
|
330
|
-
const childType = normalizeType(childNorm)
|
|
331
|
-
if (childType === 'object' || childNorm?.properties || childNorm?.items) {
|
|
332
|
-
const nested = formatSchemaPreview(childNorm, doc, { depth: depth - 1, maxProps }, indent + ' ', refStack)
|
|
333
|
-
// Only include nested if it adds something beyond "object"/"array"
|
|
334
|
-
if (!(nested.length === 1 && ['object', 'array'].includes(nested[0].trim()))) lines.push(...nested)
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
if (keys.length > maxProps) lines.push(`${indent}- ... (${keys.length - maxProps} more)`)
|
|
339
|
-
return lines
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
if (t === 'array' || normalized.items) {
|
|
343
|
-
const itemType = schemaTypeString(normalized.items)
|
|
344
|
-
const lines = [`${indent}array<${itemType}>`]
|
|
345
|
-
if (normalized.items && depth > 0) {
|
|
346
|
-
const next = normalized.items?.$ref ? getByJsonPointer(doc, normalized.items.$ref) : normalized.items
|
|
347
|
-
const nextNorm = next?.allOf ? mergeAllOf(next, doc) : next
|
|
348
|
-
const nested = formatSchemaPreview(nextNorm, doc, { depth: depth - 1, maxProps }, indent + ' ', refStack)
|
|
349
|
-
const nestedTrim = nested.length === 1 ? nested[0].trim() : null
|
|
350
|
-
const redundant =
|
|
351
|
-
nestedTrim === null ? false : ['object', 'array'].includes(nestedTrim) || nestedTrim === itemType
|
|
352
|
-
if (!redundant) lines.push(...nested)
|
|
353
|
-
}
|
|
354
|
-
return lines
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
if (normalized.oneOf?.length) {
|
|
358
|
-
const opts = normalized.oneOf.slice(0, 5).map((s) => schemaTypeString(s)).join(' | ')
|
|
359
|
-
return [`${indent}oneOf(${opts}${normalized.oneOf.length > 5 ? ' | ...' : ''})`]
|
|
360
|
-
}
|
|
361
|
-
if (normalized.anyOf?.length) {
|
|
362
|
-
const opts = normalized.anyOf.slice(0, 5).map((s) => schemaTypeString(s)).join(' | ')
|
|
363
|
-
return [`${indent}anyOf(${opts}${normalized.anyOf.length > 5 ? ' | ...' : ''})`]
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return [`${indent}${schemaTypeString(normalized)}`]
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function placeholderForString(schema) {
|
|
370
|
-
if (schema?.enum?.length) return schema.enum[0]
|
|
371
|
-
if (schema?.const !== undefined) return schema.const
|
|
372
|
-
if (schema?.format === 'uuid') return '00000000-0000-0000-0000-000000000000'
|
|
373
|
-
if (schema?.format === 'date-time') return '2025-01-01T00:00:00Z'
|
|
374
|
-
if (schema?.format === 'date') return '2025-01-01'
|
|
375
|
-
if (schema?.format === 'email') return 'user@example.com'
|
|
376
|
-
if (schema?.format === 'uri' || schema?.format === 'url') return 'https://example.com'
|
|
377
|
-
return 'string'
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
function exampleFromSchema(schema, doc, { depth = 3, includeOptional = false } = {}, stack = new Set()) {
|
|
381
|
-
if (!schema) return null
|
|
382
|
-
|
|
383
|
-
if (schema.$ref) {
|
|
384
|
-
const name = refName(schema.$ref)
|
|
385
|
-
if (name) {
|
|
386
|
-
if (stack.has(name)) return `<circular:${name}>`
|
|
387
|
-
stack.add(name)
|
|
388
|
-
}
|
|
389
|
-
const resolved = getByJsonPointer(doc, schema.$ref)
|
|
390
|
-
const out = exampleFromSchema(resolved || {}, doc, { depth, includeOptional }, stack)
|
|
391
|
-
if (name) stack.delete(name)
|
|
392
|
-
return out
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
const normalized = schema.allOf ? mergeAllOf(schema, doc) : schema
|
|
396
|
-
|
|
397
|
-
if (normalized.const !== undefined) return normalized.const
|
|
398
|
-
if (normalized.enum?.length) return normalized.enum[0]
|
|
399
|
-
|
|
400
|
-
const t = normalizeType(normalized)
|
|
401
|
-
if (t === 'string') return placeholderForString(normalized)
|
|
402
|
-
if (t === 'integer') return 0
|
|
403
|
-
if (t === 'number') return 0
|
|
404
|
-
if (t === 'boolean') return true
|
|
405
|
-
if (t === 'null') return null
|
|
406
|
-
|
|
407
|
-
if ((t === 'array' || normalized.items) && depth > 0) {
|
|
408
|
-
return [exampleFromSchema(normalized.items || {}, doc, { depth: depth - 1, includeOptional }, stack)]
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if ((t === 'object' || normalized.properties || normalized.additionalProperties) && depth > 0) {
|
|
412
|
-
const props = normalized.properties || {}
|
|
413
|
-
const required = new Set(normalized.required || [])
|
|
414
|
-
const out = {}
|
|
415
|
-
|
|
416
|
-
const keys = Object.keys(props)
|
|
417
|
-
for (const key of keys) {
|
|
418
|
-
if (!includeOptional && !required.has(key)) continue
|
|
419
|
-
out[key] = exampleFromSchema(props[key], doc, { depth: depth - 1, includeOptional }, stack)
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// If it is a free-form map, add a placeholder entry.
|
|
423
|
-
if (!keys.length && normalized.additionalProperties) {
|
|
424
|
-
out.key = exampleFromSchema(
|
|
425
|
-
normalized.additionalProperties === true ? {} : normalized.additionalProperties,
|
|
426
|
-
doc,
|
|
427
|
-
{ depth: depth - 1, includeOptional },
|
|
428
|
-
stack,
|
|
429
|
-
)
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
return out
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
if (normalized.oneOf?.length) return exampleFromSchema(normalized.oneOf[0], doc, { depth, includeOptional }, stack)
|
|
436
|
-
if (normalized.anyOf?.length) return exampleFromSchema(normalized.anyOf[0], doc, { depth, includeOptional }, stack)
|
|
437
|
-
|
|
438
|
-
return null
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function collectSchemaRefs(schema, doc, out = new Set(), stack = new Set()) {
|
|
442
|
-
if (!schema) return out
|
|
443
|
-
|
|
444
|
-
if (schema.$ref) {
|
|
445
|
-
const name = refName(schema.$ref)
|
|
446
|
-
if (name) out.add(name)
|
|
447
|
-
if (name) {
|
|
448
|
-
if (stack.has(name)) return out
|
|
449
|
-
stack.add(name)
|
|
450
|
-
}
|
|
451
|
-
const resolved = getByJsonPointer(doc, schema.$ref)
|
|
452
|
-
if (resolved) collectSchemaRefs(resolved, doc, out, stack)
|
|
453
|
-
if (name) stack.delete(name)
|
|
454
|
-
return out
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
const normalized = schema.allOf ? mergeAllOf(schema, doc) : schema
|
|
458
|
-
|
|
459
|
-
for (const key of ['oneOf', 'anyOf', 'allOf']) {
|
|
460
|
-
if (Array.isArray(normalized[key])) {
|
|
461
|
-
for (const s of normalized[key]) collectSchemaRefs(s, doc, out, stack)
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (normalized.properties) {
|
|
466
|
-
for (const s of Object.values(normalized.properties)) collectSchemaRefs(s, doc, out, stack)
|
|
467
|
-
}
|
|
468
|
-
if (normalized.items) collectSchemaRefs(normalized.items, doc, out, stack)
|
|
469
|
-
if (normalized.additionalProperties && normalized.additionalProperties !== true) {
|
|
470
|
-
collectSchemaRefs(normalized.additionalProperties, doc, out, stack)
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return out
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
function collectSchemaFieldNames(schema, doc, out = new Set(), stack = new Set(), depth = 3) {
|
|
477
|
-
if (!schema || depth < 0) return out
|
|
478
|
-
|
|
479
|
-
if (schema.$ref) {
|
|
480
|
-
const ref = String(schema.$ref)
|
|
481
|
-
if (stack.has(ref)) return out
|
|
482
|
-
stack.add(ref)
|
|
483
|
-
const resolved = getByJsonPointer(doc, ref)
|
|
484
|
-
if (resolved) collectSchemaFieldNames(resolved, doc, out, stack, depth)
|
|
485
|
-
stack.delete(ref)
|
|
486
|
-
return out
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
const normalized = schema.allOf ? mergeAllOf(schema, doc) : schema
|
|
490
|
-
|
|
491
|
-
for (const key of ['oneOf', 'anyOf', 'allOf']) {
|
|
492
|
-
if (Array.isArray(normalized[key])) {
|
|
493
|
-
for (const s of normalized[key]) collectSchemaFieldNames(s, doc, out, stack, depth)
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
if (normalized.properties) {
|
|
498
|
-
for (const [k, s] of Object.entries(normalized.properties)) {
|
|
499
|
-
out.add(k)
|
|
500
|
-
collectSchemaFieldNames(s, doc, out, stack, depth - 1)
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (normalized.items) collectSchemaFieldNames(normalized.items, doc, out, stack, depth - 1)
|
|
505
|
-
if (normalized.additionalProperties && normalized.additionalProperties !== true) {
|
|
506
|
-
collectSchemaFieldNames(normalized.additionalProperties, doc, out, stack, depth - 1)
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
return out
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
function normalizeOperationSecurity(op, spec) {
|
|
513
|
-
if (Object.prototype.hasOwnProperty.call(op, 'security')) return op.security
|
|
514
|
-
return spec.security
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
function securityLabel(opSecurity, spec) {
|
|
518
|
-
if (!opSecurity) return null
|
|
519
|
-
if (Array.isArray(opSecurity) && opSecurity.length === 0) return 'none'
|
|
520
|
-
|
|
521
|
-
const schemes = spec?.components?.securitySchemes || {}
|
|
522
|
-
|
|
523
|
-
function schemeLabel(name) {
|
|
524
|
-
const s = schemes[name]
|
|
525
|
-
if (!s) return name
|
|
526
|
-
if (s.type === 'apiKey' && s.in === 'header' && s.name) return `${name} (${s.name} header)`
|
|
527
|
-
if (s.type === 'apiKey' && s.in) return `${name} (apiKey in ${s.in})`
|
|
528
|
-
if (s.type === 'http' && s.scheme === 'bearer') return `${name} (Authorization: Bearer ...)`
|
|
529
|
-
if (s.type === 'http') return `${name} (http ${s.scheme || ''})`.trim()
|
|
530
|
-
return `${name} (${s.type})`
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
const requirementSets = []
|
|
534
|
-
for (const req of opSecurity || []) {
|
|
535
|
-
const keys = Object.keys(req || {})
|
|
536
|
-
if (!keys.length) continue
|
|
537
|
-
requirementSets.push(keys.map(schemeLabel).join(' + '))
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
if (!requirementSets.length) return null
|
|
541
|
-
return requirementSets.join(' OR ')
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
function toShortSpec(s) {
|
|
545
|
-
return {
|
|
546
|
-
id: s.id,
|
|
547
|
-
title: s.title,
|
|
548
|
-
version: s.version,
|
|
549
|
-
file: s.filePath,
|
|
550
|
-
servers: s.servers,
|
|
551
|
-
operations: s.operations.length,
|
|
552
|
-
schemas: Object.keys(s.schemas).length,
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
async function readSpecSource(source) {
|
|
557
|
-
if (isUrl(source)) {
|
|
558
|
-
const res = await fetch(source, {
|
|
559
|
-
// Some CDNs / WAFs behave better with a UA.
|
|
560
|
-
headers: { 'User-Agent': 'kapso-openapi-explore/1.0 (+https://docs.kapso.ai)' },
|
|
561
|
-
})
|
|
562
|
-
if (!res.ok) throw new Error(`HTTP ${res.status} ${res.statusText}`)
|
|
563
|
-
return await res.text()
|
|
564
|
-
}
|
|
565
|
-
return readFileSync(source, 'utf-8')
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
async function loadSpecsAsync({ sources, sourceMode, specFilter }) {
|
|
569
|
-
if (!sources.length) die('No OpenAPI sources provided')
|
|
570
|
-
|
|
571
|
-
const seenIds = new Map()
|
|
572
|
-
const specs = []
|
|
573
|
-
const errors = []
|
|
574
|
-
|
|
575
|
-
for (const filePath of sources) {
|
|
576
|
-
let raw = null
|
|
577
|
-
try {
|
|
578
|
-
raw = await readSpecSource(filePath)
|
|
579
|
-
} catch (e) {
|
|
580
|
-
errors.push({ source: filePath, error: e })
|
|
581
|
-
if (sourceMode === 'explicit') console.error(`Skipping ${filePath}: ${e.message}`)
|
|
582
|
-
continue
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
let doc
|
|
586
|
-
try {
|
|
587
|
-
doc = parseYaml(raw)
|
|
588
|
-
} catch (e) {
|
|
589
|
-
errors.push({ source: filePath, error: e })
|
|
590
|
-
console.error(`Skipping ${filePath}: YAML parse error: ${e.message}`)
|
|
591
|
-
continue
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
const idBase = inferSpecId(filePath, doc)
|
|
595
|
-
const n = (seenIds.get(idBase) || 0) + 1
|
|
596
|
-
seenIds.set(idBase, n)
|
|
597
|
-
const id = n === 1 ? idBase : `${idBase}${n}`
|
|
598
|
-
|
|
599
|
-
if (specFilter && id !== specFilter) continue
|
|
600
|
-
|
|
601
|
-
const title = doc?.info?.title || id
|
|
602
|
-
const version = doc?.info?.version || '?'
|
|
603
|
-
const servers = (doc?.servers || []).map((s) => s?.url).filter(Boolean)
|
|
604
|
-
const tags = doc?.tags || []
|
|
605
|
-
const schemas = doc?.components?.schemas || {}
|
|
606
|
-
const schemaFieldCache = new Map()
|
|
607
|
-
|
|
608
|
-
const getSchemaFields = (schemaName) => {
|
|
609
|
-
if (schemaFieldCache.has(schemaName)) return schemaFieldCache.get(schemaName)
|
|
610
|
-
const schema = schemas?.[schemaName]
|
|
611
|
-
const fields = schema ? [...collectSchemaFieldNames(schema, doc)] : []
|
|
612
|
-
schemaFieldCache.set(schemaName, fields)
|
|
613
|
-
return fields
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
const operations = []
|
|
617
|
-
const paths = doc?.paths || {}
|
|
618
|
-
for (const [p, pathItemRaw] of Object.entries(paths)) {
|
|
619
|
-
const pathItem = pathItemRaw || {}
|
|
620
|
-
const pathParams = Array.isArray(pathItem.parameters) ? pathItem.parameters.map((x) => derefObject(x, doc)) : []
|
|
621
|
-
|
|
622
|
-
for (const method of HTTP_METHODS) {
|
|
623
|
-
const op = pathItem[method]
|
|
624
|
-
if (!op) continue
|
|
625
|
-
|
|
626
|
-
const mergedParams = [...pathParams, ...((op.parameters || []).filter(Boolean))]
|
|
627
|
-
.map((x) => derefObject(x, doc))
|
|
628
|
-
.filter(Boolean)
|
|
629
|
-
const opSecurity = normalizeOperationSecurity(op, doc)
|
|
630
|
-
const opRequestBody = derefObject(op.requestBody || null, doc)
|
|
631
|
-
|
|
632
|
-
const refs = new Set()
|
|
633
|
-
// params
|
|
634
|
-
for (const param of mergedParams) {
|
|
635
|
-
if (param?.schema) collectSchemaRefs(param.schema, doc, refs)
|
|
636
|
-
if (param?.content) {
|
|
637
|
-
for (const media of Object.values(param.content)) {
|
|
638
|
-
if (media?.schema) collectSchemaRefs(media.schema, doc, refs)
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
// body
|
|
643
|
-
if (opRequestBody?.content) {
|
|
644
|
-
for (const media of Object.values(opRequestBody.content)) {
|
|
645
|
-
if (media?.schema) collectSchemaRefs(media.schema, doc, refs)
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
// responses
|
|
649
|
-
if (op?.responses) {
|
|
650
|
-
for (const resp of Object.values(op.responses)) {
|
|
651
|
-
const r = derefObject(resp, doc)
|
|
652
|
-
if (r?.content) {
|
|
653
|
-
for (const media of Object.values(r.content)) {
|
|
654
|
-
if (media?.schema) collectSchemaRefs(media.schema, doc, refs)
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
const fieldsUsed = new Set()
|
|
661
|
-
for (const schemaName of refs) {
|
|
662
|
-
for (const f of getSchemaFields(schemaName)) fieldsUsed.add(f)
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
operations.push({
|
|
666
|
-
specId: id,
|
|
667
|
-
specTitle: title,
|
|
668
|
-
specFile: filePath,
|
|
669
|
-
method,
|
|
670
|
-
path: p,
|
|
671
|
-
operationId: op.operationId || null,
|
|
672
|
-
summary: op.summary || null,
|
|
673
|
-
description: op.description || null,
|
|
674
|
-
tags: op.tags || [],
|
|
675
|
-
deprecated: Boolean(op.deprecated),
|
|
676
|
-
security: opSecurity,
|
|
677
|
-
securityLabel: securityLabel(opSecurity, doc),
|
|
678
|
-
parameters: mergedParams,
|
|
679
|
-
requestBody: opRequestBody,
|
|
680
|
-
responses: op.responses || {},
|
|
681
|
-
refsUsed: refs,
|
|
682
|
-
fieldsUsed,
|
|
683
|
-
})
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
specs.push({
|
|
688
|
-
id,
|
|
689
|
-
filePath,
|
|
690
|
-
title,
|
|
691
|
-
version,
|
|
692
|
-
servers,
|
|
693
|
-
doc,
|
|
694
|
-
tags,
|
|
695
|
-
schemas,
|
|
696
|
-
operations,
|
|
697
|
-
})
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
if (!specs.length) {
|
|
701
|
-
if (sourceMode === 'default_remote' && errors.length) {
|
|
702
|
-
const apiDir = findLocalApiDir()
|
|
703
|
-
const local = apiDir ? walk(apiDir, { filePattern: /^openapi-.*\.ya?ml$/ }) : []
|
|
704
|
-
if (local.length) {
|
|
705
|
-
console.error(`Could not fetch published OpenAPI specs. Falling back to local repo specs (api/**/openapi-*.yaml).`)
|
|
706
|
-
return await loadSpecsAsync({ sources: local, sourceMode: 'explicit', specFilter })
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
if (specFilter) die(`No specs matched --spec ${specFilter}`)
|
|
710
|
-
die('No specs loaded')
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
if (sourceMode === 'default_remote' && errors.length) {
|
|
714
|
-
console.error(`Some published OpenAPI specs could not be fetched:`)
|
|
715
|
-
for (const e of errors) console.error(`- ${e.source}: ${e.error?.message || String(e.error)}`)
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
return specs
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
function findOperation(specs, query, { specHint } = {}) {
|
|
722
|
-
const raw = query.trim()
|
|
723
|
-
const direct = raw.includes(':') ? raw.split(':') : null
|
|
724
|
-
const qSpec = direct?.[0] || specHint
|
|
725
|
-
const qId = direct?.[1] || raw
|
|
726
|
-
|
|
727
|
-
// METHOD /path
|
|
728
|
-
const m = raw.match(/^(get|post|put|patch|delete|options|head)\\s+(.+)$/i)
|
|
729
|
-
if (m) {
|
|
730
|
-
const method = m[1].toLowerCase()
|
|
731
|
-
const p = m[2].trim()
|
|
732
|
-
const matches = []
|
|
733
|
-
for (const s of specs) {
|
|
734
|
-
if (qSpec && s.id !== qSpec) continue
|
|
735
|
-
for (const op of s.operations) {
|
|
736
|
-
if (op.method === method && op.path === p) matches.push(op)
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
return matches
|
|
740
|
-
}
|
|
741
|
-
|
|
742
|
-
// operationId
|
|
743
|
-
const matches = []
|
|
744
|
-
for (const s of specs) {
|
|
745
|
-
if (qSpec && s.id !== qSpec) continue
|
|
746
|
-
for (const op of s.operations) {
|
|
747
|
-
if (op.operationId === qId) matches.push(op)
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
return matches
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
function findSchema(specs, query, { specHint } = {}) {
|
|
754
|
-
const raw = query.trim()
|
|
755
|
-
const direct = raw.includes(':') ? raw.split(':') : null
|
|
756
|
-
const qSpec = direct?.[0] || specHint
|
|
757
|
-
const qName = direct?.[1] || raw
|
|
758
|
-
|
|
759
|
-
const matches = []
|
|
760
|
-
for (const s of specs) {
|
|
761
|
-
if (qSpec && s.id !== qSpec) continue
|
|
762
|
-
if (Object.prototype.hasOwnProperty.call(s.schemas, qName)) {
|
|
763
|
-
matches.push({ spec: s, name: qName, schema: s.schemas[qName] })
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
return matches
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
function scoreText(hay, q) {
|
|
770
|
-
if (!hay) return 0
|
|
771
|
-
const h = hay.toLowerCase()
|
|
772
|
-
if (h === q) return 100
|
|
773
|
-
if (h.startsWith(q)) return 60
|
|
774
|
-
if (h.includes(q)) return 30
|
|
775
|
-
return 0
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
function search(specs, query, { specHint, limit = 30 } = {}) {
|
|
779
|
-
const q = query.toLowerCase().trim()
|
|
780
|
-
if (!q) return { ops: [], schemas: [] }
|
|
781
|
-
|
|
782
|
-
const ops = []
|
|
783
|
-
const schemas = []
|
|
784
|
-
|
|
785
|
-
for (const s of specs) {
|
|
786
|
-
if (specHint && s.id !== specHint) continue
|
|
787
|
-
|
|
788
|
-
for (const op of s.operations) {
|
|
789
|
-
let score = 0
|
|
790
|
-
score += scoreText(op.operationId, q) * 3
|
|
791
|
-
score += scoreText(`${op.method} ${op.path}`, q) * 2
|
|
792
|
-
score += scoreText(op.summary, q) * 2
|
|
793
|
-
score += scoreText(op.description, q)
|
|
794
|
-
for (const t of op.tags || []) score += scoreText(t, q) * 2
|
|
795
|
-
score += scoreText((op.parameters || []).map((p) => p?.name).filter(Boolean).join(' '), q) * 2
|
|
796
|
-
score += scoreText([...op.refsUsed].join(' '), q) * 2
|
|
797
|
-
score += scoreText([...op.fieldsUsed].join(' '), q)
|
|
798
|
-
if (score > 0) ops.push({ score, op })
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
for (const [name, schema] of Object.entries(s.schemas)) {
|
|
802
|
-
let score = 0
|
|
803
|
-
score += scoreText(name, q) * 3
|
|
804
|
-
score += scoreText(schema?.description, q)
|
|
805
|
-
score += scoreText([...collectSchemaFieldNames(schema, s.doc)].join(' '), q) * 2
|
|
806
|
-
if (score > 0) schemas.push({ score, spec: s, name, schema })
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
ops.sort((a, b) => b.score - a.score)
|
|
811
|
-
schemas.sort((a, b) => b.score - a.score)
|
|
812
|
-
|
|
813
|
-
return {
|
|
814
|
-
ops: ops.slice(0, limit).map((x) => x.op),
|
|
815
|
-
schemas: schemas.slice(0, limit).map((x) => ({ specId: x.spec.id, name: x.name })),
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
function printTable(rows, { sep = ' ' } = {}) {
|
|
820
|
-
if (!rows.length) return
|
|
821
|
-
const widths = []
|
|
822
|
-
for (const row of rows) {
|
|
823
|
-
row.forEach((cell, i) => {
|
|
824
|
-
widths[i] = Math.max(widths[i] || 0, String(cell).length)
|
|
825
|
-
})
|
|
826
|
-
}
|
|
827
|
-
for (const row of rows) {
|
|
828
|
-
const line = row
|
|
829
|
-
.map((cell, i) => String(cell).padEnd(widths[i], ' '))
|
|
830
|
-
.join(sep)
|
|
831
|
-
.trimEnd()
|
|
832
|
-
console.log(line)
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
function printSpecs(specs, { json } = {}) {
|
|
837
|
-
if (json) {
|
|
838
|
-
console.log(JSON.stringify(specs.map(toShortSpec), null, 2))
|
|
839
|
-
return
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
const rows = [['id', 'version', 'operations', 'schemas', 'file']]
|
|
843
|
-
for (const s of specs) rows.push([s.id, s.version, String(s.operations.length), String(Object.keys(s.schemas).length), s.filePath])
|
|
844
|
-
printTable(rows)
|
|
845
|
-
}
|
|
846
|
-
|
|
847
|
-
function printTags(specs, { specHint } = {}) {
|
|
848
|
-
const rows = [['spec', 'tag', 'description']]
|
|
849
|
-
for (const s of specs) {
|
|
850
|
-
if (specHint && s.id !== specHint) continue
|
|
851
|
-
for (const t of s.tags || []) rows.push([s.id, t.name, (t.description || '').replaceAll('\n', ' ').slice(0, 80)])
|
|
852
|
-
}
|
|
853
|
-
if (rows.length === 1) die('No tags found')
|
|
854
|
-
printTable(rows)
|
|
855
|
-
}
|
|
856
|
-
|
|
857
|
-
function printOps(specs, { specHint, tag, q, json, limit = 30 } = {}) {
|
|
858
|
-
let ops = []
|
|
859
|
-
for (const s of specs) {
|
|
860
|
-
if (specHint && s.id !== specHint) continue
|
|
861
|
-
ops.push(...s.operations)
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
if (tag) ops = ops.filter((o) => (o.tags || []).includes(tag))
|
|
865
|
-
|
|
866
|
-
if (q) {
|
|
867
|
-
const res = search(specs, q, { specHint, limit: Math.max(limit, 200) })
|
|
868
|
-
const opSet = new Set(res.ops.map((o) => `${o.specId}:${o.operationId || o.method + ' ' + o.path}`))
|
|
869
|
-
ops = ops.filter((o) => opSet.has(`${o.specId}:${o.operationId || o.method + ' ' + o.path}`))
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
ops = ops.slice(0, limit)
|
|
873
|
-
|
|
874
|
-
if (json) {
|
|
875
|
-
console.log(
|
|
876
|
-
JSON.stringify(
|
|
877
|
-
ops.map((o) => ({
|
|
878
|
-
spec: o.specId,
|
|
879
|
-
operationId: o.operationId,
|
|
880
|
-
method: o.method,
|
|
881
|
-
path: o.path,
|
|
882
|
-
summary: o.summary,
|
|
883
|
-
})),
|
|
884
|
-
null,
|
|
885
|
-
2,
|
|
886
|
-
),
|
|
887
|
-
)
|
|
888
|
-
return
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
const rows = [['spec', 'operationId', 'method', 'path', 'summary']]
|
|
892
|
-
for (const o of ops) rows.push([o.specId, o.operationId || '-', o.method.toUpperCase(), o.path, (o.summary || '').slice(0, 80)])
|
|
893
|
-
printTable(rows)
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
function splitParams(params) {
|
|
897
|
-
const out = { path: [], query: [], header: [], cookie: [], other: [] }
|
|
898
|
-
for (const p of params || []) {
|
|
899
|
-
const loc = p?.in
|
|
900
|
-
if (loc === 'path') out.path.push(p)
|
|
901
|
-
else if (loc === 'query') out.query.push(p)
|
|
902
|
-
else if (loc === 'header') out.header.push(p)
|
|
903
|
-
else if (loc === 'cookie') out.cookie.push(p)
|
|
904
|
-
else out.other.push(p)
|
|
905
|
-
}
|
|
906
|
-
return out
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
function paramType(param) {
|
|
910
|
-
const s = param?.schema
|
|
911
|
-
if (s) return schemaTypeString(s)
|
|
912
|
-
if (param?.content) {
|
|
913
|
-
const media = Object.values(param.content)[0]
|
|
914
|
-
if (media?.schema) return schemaTypeString(media.schema)
|
|
915
|
-
}
|
|
916
|
-
return 'any'
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
function printParamsBlock(title, params) {
|
|
920
|
-
if (!params.length) return
|
|
921
|
-
console.log(`\n${title}`)
|
|
922
|
-
const rows = [['name', 'in', 'required', 'type', 'description']]
|
|
923
|
-
for (const p of params) {
|
|
924
|
-
rows.push([
|
|
925
|
-
p.name || '-',
|
|
926
|
-
p.in || '-',
|
|
927
|
-
p.required ? 'yes' : 'no',
|
|
928
|
-
paramType(p),
|
|
929
|
-
(p.description || '').replaceAll('\n', ' ').slice(0, 80),
|
|
930
|
-
])
|
|
931
|
-
}
|
|
932
|
-
printTable(rows)
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
function printOperation(op, spec) {
|
|
936
|
-
const baseUrl = spec.servers?.[0] || ''
|
|
937
|
-
const full = baseUrl ? `${baseUrl}${op.path}` : op.path
|
|
938
|
-
|
|
939
|
-
const id = op.operationId ? `${op.specId}:${op.operationId}` : `${op.specId}:${op.method.toUpperCase()} ${op.path}`
|
|
940
|
-
|
|
941
|
-
console.log(id)
|
|
942
|
-
console.log(`${op.method.toUpperCase()} ${full}`)
|
|
943
|
-
|
|
944
|
-
if (op.summary) console.log(`\n${op.summary}`)
|
|
945
|
-
if (op.deprecated) console.log(`\nDeprecated: yes`)
|
|
946
|
-
|
|
947
|
-
const auth = op.securityLabel
|
|
948
|
-
if (auth) console.log(`\nAuth: ${auth}`)
|
|
949
|
-
|
|
950
|
-
if (op.tags?.length) console.log(`Tags: ${op.tags.join(', ')}`)
|
|
951
|
-
|
|
952
|
-
if (op.description) {
|
|
953
|
-
const desc = String(op.description).trim().replace(/\n{3,}/g, '\n\n')
|
|
954
|
-
const short = desc.length > 800 ? `${desc.slice(0, 800)}\n...` : desc
|
|
955
|
-
console.log(`\n${short}`)
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
const params = splitParams(op.parameters || [])
|
|
959
|
-
printParamsBlock('Path params', params.path)
|
|
960
|
-
printParamsBlock('Query params', params.query)
|
|
961
|
-
printParamsBlock('Header params', params.header)
|
|
962
|
-
|
|
963
|
-
if (op.requestBody?.content) {
|
|
964
|
-
console.log('\nBody')
|
|
965
|
-
const required = op.requestBody.required ? 'required' : 'optional'
|
|
966
|
-
console.log(`required: ${required}`)
|
|
967
|
-
|
|
968
|
-
const contentTypes = Object.keys(op.requestBody.content)
|
|
969
|
-
for (const ct of contentTypes) {
|
|
970
|
-
const schema = op.requestBody.content?.[ct]?.schema
|
|
971
|
-
if (!schema) continue
|
|
972
|
-
console.log(`\n${ct}`)
|
|
973
|
-
const lines = formatSchemaPreview(schema, spec.doc, { depth: 3, maxProps: 12 })
|
|
974
|
-
for (const l of lines) console.log(l)
|
|
975
|
-
|
|
976
|
-
if (ct === 'application/json') {
|
|
977
|
-
const ex = exampleFromSchema(schema, spec.doc, { depth: 3, includeOptional: false })
|
|
978
|
-
if (ex && typeof ex === 'object') {
|
|
979
|
-
console.log('\nexample (required fields)')
|
|
980
|
-
console.log(JSON.stringify(ex, null, 2))
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
if (op.responses && Object.keys(op.responses).length) {
|
|
987
|
-
console.log('\nResponses')
|
|
988
|
-
const codes = Object.keys(op.responses).sort((a, b) => {
|
|
989
|
-
const na = Number(a)
|
|
990
|
-
const nb = Number(b)
|
|
991
|
-
if (Number.isFinite(na) && Number.isFinite(nb)) return na - nb
|
|
992
|
-
if (a === 'default') return 1
|
|
993
|
-
if (b === 'default') return -1
|
|
994
|
-
return a.localeCompare(b)
|
|
995
|
-
})
|
|
996
|
-
|
|
997
|
-
for (const code of codes) {
|
|
998
|
-
const resp = derefObject(op.responses[code], spec.doc)
|
|
999
|
-
const desc = resp?.description ? ` - ${String(resp.description).replaceAll('\n', ' ').slice(0, 80)}` : ''
|
|
1000
|
-
console.log(`\n${code}${desc}`)
|
|
1001
|
-
|
|
1002
|
-
const content = resp?.content || {}
|
|
1003
|
-
for (const [ct, media] of Object.entries(content)) {
|
|
1004
|
-
if (!media?.schema) continue
|
|
1005
|
-
console.log(`${ct}`)
|
|
1006
|
-
const lines = formatSchemaPreview(media.schema, spec.doc, { depth: 3, maxProps: 12 })
|
|
1007
|
-
for (const l of lines) console.log(l)
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
console.log('\ncurl')
|
|
1013
|
-
console.log(formatCurl(op, spec))
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
function replacePathParams(p) {
|
|
1017
|
-
return p.replaceAll(/\{([^}]+)\}/g, '<$1>')
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
function formatCurl(op, spec) {
|
|
1021
|
-
const baseUrl = spec.servers?.[0] || ''
|
|
1022
|
-
let url = baseUrl ? `${baseUrl}${replacePathParams(op.path)}` : replacePathParams(op.path)
|
|
1023
|
-
|
|
1024
|
-
const requiredQuery = (op.parameters || [])
|
|
1025
|
-
.filter((p) => p?.in === 'query' && p?.required && p?.name)
|
|
1026
|
-
.map((p) => `${encodeURIComponent(p.name)}=<${p.name}>`)
|
|
1027
|
-
if (requiredQuery.length) url += `?${requiredQuery.join('&')}`
|
|
1028
|
-
|
|
1029
|
-
const lines = []
|
|
1030
|
-
lines.push(`curl -X ${op.method.toUpperCase()} '${url}' \\`)
|
|
1031
|
-
|
|
1032
|
-
// auth header if we can infer it
|
|
1033
|
-
const schemes = spec?.doc?.components?.securitySchemes || {}
|
|
1034
|
-
const sec = Array.isArray(op.security) ? op.security : null
|
|
1035
|
-
const candidates = (sec || []).filter((x) => x && typeof x === 'object')
|
|
1036
|
-
const preferred =
|
|
1037
|
-
candidates.find((req) =>
|
|
1038
|
-
Object.keys(req).some((name) => schemes[name]?.type === 'apiKey' && schemes[name]?.in === 'header'),
|
|
1039
|
-
) || candidates[0]
|
|
1040
|
-
|
|
1041
|
-
for (const name of Object.keys(preferred || {})) {
|
|
1042
|
-
const s = schemes[name]
|
|
1043
|
-
if (s?.type === 'apiKey' && s.in === 'header' && s.name) {
|
|
1044
|
-
lines.push(` -H '${s.name}: $KAPSO_API_KEY' \\`)
|
|
1045
|
-
} else if (s?.type === 'http' && s.scheme === 'bearer') {
|
|
1046
|
-
lines.push(` -H 'Authorization: Bearer $ACCESS_TOKEN' \\`)
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
// content-type + body for JSON
|
|
1051
|
-
const jsonSchema = op.requestBody?.content?.['application/json']?.schema
|
|
1052
|
-
if (jsonSchema) {
|
|
1053
|
-
const ex = exampleFromSchema(jsonSchema, spec.doc, { depth: 4, includeOptional: false })
|
|
1054
|
-
lines.push(` -H 'Content-Type: application/json' \\`)
|
|
1055
|
-
lines.push(` -d '${JSON.stringify(ex ?? {}, null, 0)}'`)
|
|
1056
|
-
return lines.join('\n')
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
// trim trailing backslash
|
|
1060
|
-
lines[lines.length - 1] = lines[lines.length - 1].replace(/ \\\\$/, '')
|
|
1061
|
-
return lines.join('\n')
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
function printSchemaDetails(match, specs, { includeUsedBy = true } = {}) {
|
|
1065
|
-
const { spec, name, schema } = match
|
|
1066
|
-
console.log(`${spec.id}:${name}`)
|
|
1067
|
-
|
|
1068
|
-
const normalized = schema?.allOf ? mergeAllOf(schema, spec.doc) : schema
|
|
1069
|
-
const typeStr = schemaTypeString(normalized)
|
|
1070
|
-
console.log(typeStr)
|
|
1071
|
-
|
|
1072
|
-
if (normalized?.description) console.log(`\n${String(normalized.description).trim()}`)
|
|
1073
|
-
|
|
1074
|
-
const required = normalized?.required || []
|
|
1075
|
-
if (required.length) console.log(`\nrequired: ${required.join(', ')}`)
|
|
1076
|
-
|
|
1077
|
-
if (normalized?.properties || normalized?.items) {
|
|
1078
|
-
console.log('\nshape')
|
|
1079
|
-
const lines = formatSchemaPreview(normalized, spec.doc, { depth: 3, maxProps: 25 })
|
|
1080
|
-
for (const l of lines) console.log(l)
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
const ex = exampleFromSchema(normalized, spec.doc, { depth: 4, includeOptional: false })
|
|
1084
|
-
if (ex && typeof ex === 'object') {
|
|
1085
|
-
console.log('\nexample (required fields)')
|
|
1086
|
-
console.log(JSON.stringify(ex, null, 2))
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
if (includeUsedBy) {
|
|
1090
|
-
const usedBy = []
|
|
1091
|
-
for (const s of specs) {
|
|
1092
|
-
for (const op of s.operations) {
|
|
1093
|
-
if (op.refsUsed?.has(name)) usedBy.push(op)
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
if (usedBy.length) {
|
|
1098
|
-
console.log('\nused by')
|
|
1099
|
-
const rows = [['spec', 'operationId', 'method', 'path']]
|
|
1100
|
-
for (const op of usedBy.slice(0, 30)) rows.push([op.specId, op.operationId || '-', op.method.toUpperCase(), op.path])
|
|
1101
|
-
printTable(rows)
|
|
1102
|
-
if (usedBy.length > 30) console.log(`... (${usedBy.length - 30} more)`)
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
function printWhere(specs, schemaQuery, { specHint, json, limit = 30 } = {}) {
|
|
1108
|
-
const matches = findSchema(specs, schemaQuery, { specHint })
|
|
1109
|
-
if (!matches.length) die(`Schema not found: ${schemaQuery}`)
|
|
1110
|
-
if (matches.length > 1 && !schemaQuery.includes(':')) {
|
|
1111
|
-
die(`Schema exists in multiple specs. Use specId:SchemaName\n${matches.map((m) => `- ${m.spec.id}:${m.name}`).join('\n')}`)
|
|
1112
|
-
}
|
|
1113
|
-
|
|
1114
|
-
const { name } = matches[0]
|
|
1115
|
-
const usedBy = []
|
|
1116
|
-
for (const s of specs) {
|
|
1117
|
-
if (specHint && s.id !== specHint) continue
|
|
1118
|
-
for (const op of s.operations) {
|
|
1119
|
-
if (op.refsUsed?.has(name)) usedBy.push(op)
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
if (json) {
|
|
1124
|
-
console.log(
|
|
1125
|
-
JSON.stringify(
|
|
1126
|
-
usedBy.slice(0, limit).map((o) => ({
|
|
1127
|
-
spec: o.specId,
|
|
1128
|
-
operationId: o.operationId,
|
|
1129
|
-
method: o.method,
|
|
1130
|
-
path: o.path,
|
|
1131
|
-
summary: o.summary,
|
|
1132
|
-
})),
|
|
1133
|
-
null,
|
|
1134
|
-
2,
|
|
1135
|
-
),
|
|
1136
|
-
)
|
|
1137
|
-
return
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
if (!usedBy.length) {
|
|
1141
|
-
console.log('No operations reference this schema (via $ref).')
|
|
1142
|
-
return
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
const rows = [['spec', 'operationId', 'method', 'path', 'summary']]
|
|
1146
|
-
for (const o of usedBy.slice(0, limit)) rows.push([o.specId, o.operationId || '-', o.method.toUpperCase(), o.path, (o.summary || '').slice(0, 80)])
|
|
1147
|
-
printTable(rows)
|
|
1148
|
-
if (usedBy.length > limit) console.log(`... (${usedBy.length - limit} more)`)
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
async function main() {
|
|
1152
|
-
const { opts, command, rest } = parseArgs(process.argv.slice(2))
|
|
1153
|
-
if (!command) printHelp(1)
|
|
1154
|
-
|
|
1155
|
-
let sources = []
|
|
1156
|
-
let sourceMode = 'explicit'
|
|
1157
|
-
|
|
1158
|
-
if (opts.files.length) {
|
|
1159
|
-
sources = opts.files
|
|
1160
|
-
sourceMode = 'explicit'
|
|
1161
|
-
} else if (opts.all) {
|
|
1162
|
-
const apiDir = findLocalApiDir()
|
|
1163
|
-
sources = apiDir ? walk(apiDir, { filePattern: /^openapi-.*\.ya?ml$/ }) : []
|
|
1164
|
-
sourceMode = 'explicit'
|
|
1165
|
-
} else {
|
|
1166
|
-
sources = deducePublishedOpenApiUrls(DEFAULT_PUBLISHED_WHATSAPP_OPENAPI)
|
|
1167
|
-
sourceMode = 'default_remote'
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
const specs = await loadSpecsAsync({ sources, sourceMode, specFilter: opts.spec })
|
|
1171
|
-
|
|
1172
|
-
if (command === 'specs') return printSpecs(specs, { json: opts.json })
|
|
1173
|
-
if (command === 'tags') return printTags(specs, { specHint: opts.spec })
|
|
1174
|
-
if (command === 'ops') return printOps(specs, { specHint: opts.spec, tag: opts.tag, q: opts.q, json: opts.json, limit: opts.limit })
|
|
1175
|
-
if (command === 'search') {
|
|
1176
|
-
const q = rest.join(' ').trim()
|
|
1177
|
-
if (!q) die('Usage: search <query>')
|
|
1178
|
-
const res = search(specs, q, { specHint: opts.spec, limit: opts.limit })
|
|
1179
|
-
if (opts.json) {
|
|
1180
|
-
return console.log(
|
|
1181
|
-
JSON.stringify(
|
|
1182
|
-
{
|
|
1183
|
-
ops: res.ops.map((o) => ({
|
|
1184
|
-
spec: o.specId,
|
|
1185
|
-
operationId: o.operationId,
|
|
1186
|
-
method: o.method,
|
|
1187
|
-
path: o.path,
|
|
1188
|
-
summary: o.summary,
|
|
1189
|
-
})),
|
|
1190
|
-
schemas: res.schemas,
|
|
1191
|
-
},
|
|
1192
|
-
null,
|
|
1193
|
-
2,
|
|
1194
|
-
),
|
|
1195
|
-
)
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
if (!res.ops.length && !res.schemas.length) {
|
|
1199
|
-
console.log('No matches.')
|
|
1200
|
-
return
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
if (res.ops.length) {
|
|
1204
|
-
console.log('ops')
|
|
1205
|
-
const rows = [['spec', 'operationId', 'method', 'path', 'summary']]
|
|
1206
|
-
for (const o of res.ops) rows.push([o.specId, o.operationId || '-', o.method.toUpperCase(), o.path, (o.summary || '').slice(0, 80)])
|
|
1207
|
-
printTable(rows)
|
|
1208
|
-
}
|
|
1209
|
-
if (res.schemas.length) {
|
|
1210
|
-
console.log('\nschemas')
|
|
1211
|
-
const rows = [['spec', 'name']]
|
|
1212
|
-
for (const s of res.schemas) rows.push([s.specId, s.name])
|
|
1213
|
-
printTable(rows)
|
|
1214
|
-
}
|
|
1215
|
-
return
|
|
1216
|
-
}
|
|
1217
|
-
if (command === 'op') {
|
|
1218
|
-
const q = rest.join(' ').trim()
|
|
1219
|
-
if (!q) die('Usage: op <operationId | specId:operationId | "METHOD /path">')
|
|
1220
|
-
const matches = findOperation(specs, q, { specHint: opts.spec })
|
|
1221
|
-
if (!matches.length) {
|
|
1222
|
-
const res = search(specs, q, { specHint: opts.spec, limit: 10 })
|
|
1223
|
-
if (res.ops.length) {
|
|
1224
|
-
console.log(`Operation not found: ${q}\n`)
|
|
1225
|
-
console.log('closest ops')
|
|
1226
|
-
const rows = [['spec', 'operationId', 'method', 'path', 'summary']]
|
|
1227
|
-
for (const o of res.ops) rows.push([o.specId, o.operationId || '-', o.method.toUpperCase(), o.path, (o.summary || '').slice(0, 80)])
|
|
1228
|
-
printTable(rows)
|
|
1229
|
-
process.exit(1)
|
|
1230
|
-
}
|
|
1231
|
-
die(`Operation not found: ${q}`)
|
|
1232
|
-
}
|
|
1233
|
-
if (matches.length > 1 && !q.includes(':') && !q.match(/^(get|post|put|patch|delete|options|head)\\s+/i)) {
|
|
1234
|
-
die(`OperationId exists in multiple specs. Use specId:operationId\n${matches.map((m) => `- ${m.specId}:${m.operationId}`).join('\n')}`)
|
|
1235
|
-
}
|
|
1236
|
-
const op = matches[0]
|
|
1237
|
-
const spec = specs.find((s) => s.id === op.specId)
|
|
1238
|
-
if (!spec) die(`Internal error: missing spec ${op.specId}`)
|
|
1239
|
-
printOperation(op, spec)
|
|
1240
|
-
return
|
|
1241
|
-
}
|
|
1242
|
-
if (command === 'schema') {
|
|
1243
|
-
const q = rest.join(' ').trim()
|
|
1244
|
-
if (!q) die('Usage: schema <SchemaName | specId:SchemaName>')
|
|
1245
|
-
const matches = findSchema(specs, q, { specHint: opts.spec })
|
|
1246
|
-
if (!matches.length) {
|
|
1247
|
-
const res = search(specs, q, { specHint: opts.spec, limit: 10 })
|
|
1248
|
-
if (res.schemas.length) {
|
|
1249
|
-
console.log(`Schema not found: ${q}\n`)
|
|
1250
|
-
console.log('closest schemas')
|
|
1251
|
-
const rows = [['spec', 'name']]
|
|
1252
|
-
for (const s of res.schemas) rows.push([s.specId, s.name])
|
|
1253
|
-
printTable(rows)
|
|
1254
|
-
process.exit(1)
|
|
1255
|
-
}
|
|
1256
|
-
die(`Schema not found: ${q}`)
|
|
1257
|
-
}
|
|
1258
|
-
if (matches.length > 1 && !q.includes(':')) {
|
|
1259
|
-
die(`Schema exists in multiple specs. Use specId:SchemaName\n${matches.map((m) => `- ${m.spec.id}:${m.name}`).join('\n')}`)
|
|
1260
|
-
}
|
|
1261
|
-
printSchemaDetails(matches[0], specs, { includeUsedBy: true })
|
|
1262
|
-
return
|
|
1263
|
-
}
|
|
1264
|
-
if (command === 'where') {
|
|
1265
|
-
const q = rest.join(' ').trim()
|
|
1266
|
-
if (!q) die('Usage: where <SchemaName | specId:SchemaName>')
|
|
1267
|
-
return printWhere(specs, q, { specHint: opts.spec, json: opts.json, limit: opts.limit })
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
die(`Unknown command: ${command}`)
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
main().catch((e) => die(e?.stack || e?.message || String(e)))
|