@synapta/skills 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -4
- package/package.json +3 -4
- package/skills/ATTRIBUTION.md +80 -0
- package/skills/accessibility-audit/SKILL.md +325 -0
- package/skills/accessibility-audit/reference/wcag-checklist.md +103 -0
- package/skills/apns-notifier/SKILL.md +86 -0
- package/skills/approval-policy-enforcer/SKILL.md +66 -0
- package/skills/apps-sdk-builder/LICENSE.txt +201 -0
- package/skills/apps-sdk-builder/SKILL.md +328 -0
- package/skills/apps-sdk-builder/agents/openai.yaml +13 -0
- package/skills/apps-sdk-builder/references/app-archetypes.md +132 -0
- package/skills/apps-sdk-builder/references/apps-sdk-docs-workflow.md +135 -0
- package/skills/apps-sdk-builder/references/interactive-state-sync-patterns.md +113 -0
- package/skills/apps-sdk-builder/references/repo-contract-and-validation.md +93 -0
- package/skills/apps-sdk-builder/references/search-fetch-standard.md +67 -0
- package/skills/apps-sdk-builder/references/upstream-example-workflow.md +79 -0
- package/skills/apps-sdk-builder/references/window-openai-patterns.md +79 -0
- package/skills/apps-sdk-builder/scripts/scaffold_node_ext_apps.mjs +606 -0
- package/skills/architecture-selector/SKILL.md +64 -0
- package/skills/backlog-planner/SKILL.md +68 -0
- package/skills/carplay-entitlement-checker/SKILL.md +82 -0
- package/skills/concept-discovery/SKILL.md +517 -0
- package/skills/concept-discovery/assets/sample-analysis.json +81 -0
- package/skills/concept-discovery/expected_outputs/sample-enum-dictionary.md +25 -0
- package/skills/concept-discovery/expected_outputs/sample-page-user-list.md +83 -0
- package/skills/concept-discovery/expected_outputs/sample-prd-readme.md +43 -0
- package/skills/concept-discovery/references/framework-patterns.md +228 -0
- package/skills/concept-discovery/references/prd-quality-checklist.md +65 -0
- package/skills/concept-discovery/scripts/codebase_analyzer.py +732 -0
- package/skills/concept-discovery/scripts/prd_scaffolder.py +435 -0
- package/skills/dast-zap/SKILL.md +453 -0
- package/skills/dast-zap/assets/.gitkeep +9 -0
- package/skills/dast-zap/assets/github_action.yml +207 -0
- package/skills/dast-zap/assets/gitlab_ci.yml +226 -0
- package/skills/dast-zap/assets/zap_automation.yaml +196 -0
- package/skills/dast-zap/assets/zap_context.xml +192 -0
- package/skills/dast-zap/references/EXAMPLE.md +40 -0
- package/skills/dast-zap/references/api_testing_guide.md +475 -0
- package/skills/dast-zap/references/authentication_guide.md +431 -0
- package/skills/dast-zap/references/false_positive_handling.md +427 -0
- package/skills/dast-zap/references/owasp_mapping.md +255 -0
- package/skills/dep-sbom-scan/SKILL.md +466 -0
- package/skills/deploy-cloudflare/SKILL.md +930 -0
- package/skills/deploy-docker/SKILL.md +55 -0
- package/skills/deploy-fly/SKILL.md +228 -0
- package/skills/deploy-k8s/SKILL.md +108 -0
- package/skills/deploy-k8s/assets/logo.png +0 -0
- package/skills/deploy-k8s/docs/README.md +29 -0
- package/skills/deploy-k8s/docs/SUMMARY.md +56 -0
- package/skills/deploy-k8s/docs/advanced/token-efficiency.md +61 -0
- package/skills/deploy-k8s/docs/architecture/multi-tenancy.md +96 -0
- package/skills/deploy-k8s/docs/architecture/storage-and-state.md +102 -0
- package/skills/deploy-k8s/docs/architecture/workload-patterns.md +87 -0
- package/skills/deploy-k8s/docs/book.json +16 -0
- package/skills/deploy-k8s/docs/community/changelog.md +34 -0
- package/skills/deploy-k8s/docs/community/contributing.md +67 -0
- package/skills/deploy-k8s/docs/core-concepts/failure-modes.md +153 -0
- package/skills/deploy-k8s/docs/core-concepts/philosophy.md +83 -0
- package/skills/deploy-k8s/docs/core-concepts/workflow.md +124 -0
- package/skills/deploy-k8s/docs/examples/bad-patterns.md +47 -0
- package/skills/deploy-k8s/docs/examples/do-dont-checklist.md +37 -0
- package/skills/deploy-k8s/docs/examples/good-patterns.md +49 -0
- package/skills/deploy-k8s/docs/failure-modes/api-drift.md +104 -0
- package/skills/deploy-k8s/docs/failure-modes/fragile-rollouts.md +99 -0
- package/skills/deploy-k8s/docs/failure-modes/insecure-workload-defaults.md +80 -0
- package/skills/deploy-k8s/docs/failure-modes/network-exposure.md +98 -0
- package/skills/deploy-k8s/docs/failure-modes/privilege-sprawl.md +91 -0
- package/skills/deploy-k8s/docs/failure-modes/resource-starvation.md +85 -0
- package/skills/deploy-k8s/docs/getting-started/installation.md +152 -0
- package/skills/deploy-k8s/docs/getting-started/quick-start.md +115 -0
- package/skills/deploy-k8s/docs/guides/helm-patterns.md +71 -0
- package/skills/deploy-k8s/docs/guides/kustomize-patterns.md +65 -0
- package/skills/deploy-k8s/docs/guides/observability.md +67 -0
- package/skills/deploy-k8s/docs/guides/security-hardening.md +59 -0
- package/skills/deploy-k8s/docs/guides/validation-and-policy.md +66 -0
- package/skills/deploy-k8s/docs/integrations/mcp-integration.md +52 -0
- package/skills/deploy-k8s/docs/package-lock.json +2892 -0
- package/skills/deploy-k8s/docs/package.json +13 -0
- package/skills/deploy-k8s/references/api-drift.md +298 -0
- package/skills/deploy-k8s/references/conditional/aks-patterns.md +70 -0
- package/skills/deploy-k8s/references/conditional/eks-patterns.md +79 -0
- package/skills/deploy-k8s/references/conditional/gitops-controllers.md +71 -0
- package/skills/deploy-k8s/references/conditional/gke-patterns.md +74 -0
- package/skills/deploy-k8s/references/conditional/observability-stacks.md +80 -0
- package/skills/deploy-k8s/references/conditional/openshift-patterns.md +67 -0
- package/skills/deploy-k8s/references/daemonset-operator-patterns.md +155 -0
- package/skills/deploy-k8s/references/deployment-patterns.md +146 -0
- package/skills/deploy-k8s/references/do-dont-patterns.md +87 -0
- package/skills/deploy-k8s/references/examples-bad.md +282 -0
- package/skills/deploy-k8s/references/examples-good.md +440 -0
- package/skills/deploy-k8s/references/fragile-rollouts.md +303 -0
- package/skills/deploy-k8s/references/helm-patterns.md +203 -0
- package/skills/deploy-k8s/references/insecure-workload-defaults.md +300 -0
- package/skills/deploy-k8s/references/job-patterns.md +120 -0
- package/skills/deploy-k8s/references/kustomize-patterns.md +239 -0
- package/skills/deploy-k8s/references/multi-tenancy.md +343 -0
- package/skills/deploy-k8s/references/network-exposure.md +481 -0
- package/skills/deploy-k8s/references/observability.md +302 -0
- package/skills/deploy-k8s/references/privilege-sprawl.md +273 -0
- package/skills/deploy-k8s/references/resource-starvation.md +374 -0
- package/skills/deploy-k8s/references/security-hardening.md +209 -0
- package/skills/deploy-k8s/references/stateful-patterns.md +130 -0
- package/skills/deploy-k8s/references/storage-and-state.md +330 -0
- package/skills/deploy-k8s/references/validation-and-policy.md +242 -0
- package/skills/deploy-railway/SKILL.md +235 -0
- package/skills/deploy-railway/references/analyze-db-mongo.md +84 -0
- package/skills/deploy-railway/references/analyze-db-mysql.md +254 -0
- package/skills/deploy-railway/references/analyze-db-postgres.md +479 -0
- package/skills/deploy-railway/references/analyze-db-redis.md +208 -0
- package/skills/deploy-railway/references/analyze-db.md +344 -0
- package/skills/deploy-railway/references/configure.md +309 -0
- package/skills/deploy-railway/references/deploy.md +195 -0
- package/skills/deploy-railway/references/operate.md +214 -0
- package/skills/deploy-railway/references/request.md +248 -0
- package/skills/deploy-railway/references/setup.md +312 -0
- package/skills/deploy-railway/scripts/analyze-mongo.py +1549 -0
- package/skills/deploy-railway/scripts/analyze-mysql.py +1195 -0
- package/skills/deploy-railway/scripts/analyze-postgres.py +3058 -0
- package/skills/deploy-railway/scripts/analyze-redis.py +1090 -0
- package/skills/deploy-railway/scripts/dal.py +671 -0
- package/skills/deploy-railway/scripts/enable-pg-stats.py +170 -0
- package/skills/deploy-railway/scripts/pg-extensions.py +370 -0
- package/skills/deploy-railway/scripts/railway-api.sh +52 -0
- package/skills/deploy-ssh/SKILL.md +91 -0
- package/skills/deploy-vercel/SKILL.md +304 -0
- package/skills/deploy-vercel/resources/deploy-codex.sh +301 -0
- package/skills/deploy-vercel/resources/deploy.sh +301 -0
- package/skills/docs-runbooks/SKILL.md +399 -0
- package/skills/drive-status-renderer/SKILL.md +62 -0
- package/skills/iac-scan/SKILL.md +680 -0
- package/skills/iac-scan/assets/.gitkeep +9 -0
- package/skills/iac-scan/assets/checkov_config.yaml +94 -0
- package/skills/iac-scan/assets/github_actions.yml +199 -0
- package/skills/iac-scan/assets/gitlab_ci.yml +218 -0
- package/skills/iac-scan/assets/pre_commit_config.yaml +92 -0
- package/skills/iac-scan/references/EXAMPLE.md +40 -0
- package/skills/iac-scan/references/compliance_mapping.md +237 -0
- package/skills/iac-scan/references/custom_policies.md +460 -0
- package/skills/iac-scan/references/suppression_guide.md +431 -0
- package/skills/incident-briefing/SKILL.md +66 -0
- package/skills/incident-triage/SKILL.md +481 -0
- package/{LICENSE → skills/mcp-builder/LICENSE.txt} +15 -14
- package/skills/mcp-builder/SKILL.md +244 -0
- package/skills/mcp-builder/reference/evaluation.md +602 -0
- package/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/skills/mcp-builder/scripts/connections.py +151 -0
- package/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/skills/mobile-pairing/SKILL.md +52 -0
- package/skills/ops-sre/SKILL.md +297 -0
- package/skills/playwright-qa/LICENSE.txt +201 -0
- package/skills/playwright-qa/NOTICE.txt +14 -0
- package/skills/playwright-qa/SKILL.md +156 -0
- package/skills/playwright-qa/agents/openai.yaml +6 -0
- package/skills/playwright-qa/assets/playwright-small.svg +3 -0
- package/skills/playwright-qa/assets/playwright.png +0 -0
- package/skills/playwright-qa/references/cli.md +116 -0
- package/skills/playwright-qa/references/workflows.md +95 -0
- package/skills/playwright-qa/scripts/playwright_cli.sh +25 -0
- package/skills/release-publish/SKILL.md +85 -0
- package/skills/repo-bootstrap/SKILL.md +92 -0
- package/skills/repo-bootstrap/assets/example-workflows/validate-agents.yml +89 -0
- package/skills/repo-bootstrap/assets/root-thin.md +141 -0
- package/skills/repo-bootstrap/assets/root-verbose.md +149 -0
- package/skills/repo-bootstrap/assets/scoped/backend-go.md +107 -0
- package/skills/repo-bootstrap/assets/scoped/backend-php.md +94 -0
- package/skills/repo-bootstrap/assets/scoped/backend-python.md +84 -0
- package/skills/repo-bootstrap/assets/scoped/backend-typescript.md +89 -0
- package/skills/repo-bootstrap/assets/scoped/claude-code-skill.md +101 -0
- package/skills/repo-bootstrap/assets/scoped/cli.md +83 -0
- package/skills/repo-bootstrap/assets/scoped/concourse.md +196 -0
- package/skills/repo-bootstrap/assets/scoped/ddev.md +68 -0
- package/skills/repo-bootstrap/assets/scoped/docker.md +160 -0
- package/skills/repo-bootstrap/assets/scoped/documentation.md +98 -0
- package/skills/repo-bootstrap/assets/scoped/examples.md +96 -0
- package/skills/repo-bootstrap/assets/scoped/frontend-typescript.md +88 -0
- package/skills/repo-bootstrap/assets/scoped/github-actions.md +174 -0
- package/skills/repo-bootstrap/assets/scoped/gitlab-ci.md +174 -0
- package/skills/repo-bootstrap/assets/scoped/oro-bundle.md +209 -0
- package/skills/repo-bootstrap/assets/scoped/oro-project.md +170 -0
- package/skills/repo-bootstrap/assets/scoped/python-modern.md +170 -0
- package/skills/repo-bootstrap/assets/scoped/resources.md +96 -0
- package/skills/repo-bootstrap/assets/scoped/skill-repo.md +139 -0
- package/skills/repo-bootstrap/assets/scoped/symfony.md +168 -0
- package/skills/repo-bootstrap/assets/scoped/testing.md +87 -0
- package/skills/repo-bootstrap/assets/scoped/typo3-docs.md +103 -0
- package/skills/repo-bootstrap/assets/scoped/typo3-extension.md +133 -0
- package/skills/repo-bootstrap/assets/scoped/typo3-project.md +137 -0
- package/skills/repo-bootstrap/assets/scoped/typo3-testing.md +80 -0
- package/skills/repo-bootstrap/checkpoints.yaml +279 -0
- package/skills/repo-bootstrap/evals/evals.json +385 -0
- package/skills/repo-bootstrap/references/ai-contribution-guidelines.md +63 -0
- package/skills/repo-bootstrap/references/ai-tool-compatibility.md +223 -0
- package/skills/repo-bootstrap/references/directory-coverage.md +82 -0
- package/skills/repo-bootstrap/references/examples/coding-agent-cli/AGENTS.md +70 -0
- package/skills/repo-bootstrap/references/examples/coding-agent-cli/go.mod +3 -0
- package/skills/repo-bootstrap/references/examples/coding-agent-cli/scripts-AGENTS.md +389 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/.env.example +13 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/AGENTS.md +91 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/package.json +33 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/pnpm-lock.yaml +3 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/AGENTS.md +91 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/config.ts +28 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/controllers/userController.ts +74 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/index.ts +26 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/middleware/errorHandler.ts +45 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/middleware/requestLogger.ts +18 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/routes/health.ts +18 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/routes/users.ts +13 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/utils/errors.ts +40 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/src/utils/logger.ts +14 -0
- package/skills/repo-bootstrap/references/examples/express-api-ts/tsconfig.json +24 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/.env.example +19 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/AGENTS.md +92 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/pyproject.toml +88 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/AGENTS.md +85 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/__init__.py +3 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/config.py +49 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/main.py +66 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/models/__init__.py +13 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/models/item.py +43 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/models/user.py +40 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/routes/__init__.py +5 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/routes/health.py +20 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/routes/items.py +61 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/routes/users.py +55 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/services/__init__.py +6 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/services/item_service.py +77 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/src/services/user_service.py +69 -0
- package/skills/repo-bootstrap/references/examples/fastapi-app/uv.lock +4 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/.scopes +3 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/AGENTS.md +86 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/admin/package.json +20 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/admin/src/App.tsx +5 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/cmd/api/main.go +7 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/go.mod +2 -0
- package/skills/repo-bootstrap/references/examples/go-api-with-react-admin/main.go +7 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/.scopes +3 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/AGENTS.md +89 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/go.mod +2 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/AGENTS.md +90 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/package.json +17 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/src/App.tsx +1 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/src/Button.tsx +1 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/src/Footer.tsx +1 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/src/Header.tsx +1 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/internal/web/src/Sidebar.tsx +1 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/main.go +7 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/package-lock.json +0 -0
- package/skills/repo-bootstrap/references/examples/go-with-internal-web-tsx/package.json +12 -0
- package/skills/repo-bootstrap/references/examples/ldap-selfservice/AGENTS.md +70 -0
- package/skills/repo-bootstrap/references/examples/ldap-selfservice/go.mod +3 -0
- package/skills/repo-bootstrap/references/examples/ldap-selfservice/internal-AGENTS.md +371 -0
- package/skills/repo-bootstrap/references/examples/ldap-selfservice/internal-web-AGENTS.md +448 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/.scopes +3 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/AGENTS.md +91 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/composer.json +8 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/package.json +15 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/pnpm-lock.yaml +0 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/src/Controller.php +3 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/AGENTS.md +92 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/package.json +26 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/src/App.tsx +3 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/src/Button.tsx +10 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/src/Footer.tsx +9 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/src/Header.tsx +9 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/src/main.tsx +3 -0
- package/skills/repo-bootstrap/references/examples/php-with-frontend/web/tsconfig.json +13 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/AGENTS.md +75 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/package.json +7 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/packages/web/package.json +11 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/packages/web/src/index.ts +11 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/pnpm-lock.yaml +42 -0
- package/skills/repo-bootstrap/references/examples/pnpm-workspace/pnpm-workspace.yaml +2 -0
- package/skills/repo-bootstrap/references/examples/simple-ldap-go/AGENTS.md +70 -0
- package/skills/repo-bootstrap/references/examples/simple-ldap-go/examples-AGENTS.md +45 -0
- package/skills/repo-bootstrap/references/examples/simple-ldap-go/go.mod +3 -0
- package/skills/repo-bootstrap/references/examples/t3x-rte-ckeditor-image/AGENTS.md +70 -0
- package/skills/repo-bootstrap/references/examples/t3x-rte-ckeditor-image/Classes-AGENTS.md +392 -0
- package/skills/repo-bootstrap/references/examples/t3x-rte-ckeditor-image/composer.json +8 -0
- package/skills/repo-bootstrap/references/feedback-memory-schema.md +135 -0
- package/skills/repo-bootstrap/references/git-hooks-setup.md +79 -0
- package/skills/repo-bootstrap/references/output-structure.md +124 -0
- package/skills/repo-bootstrap/references/scripts-guide.md +175 -0
- package/skills/repo-bootstrap/references/verification-guide.md +137 -0
- package/skills/repo-bootstrap/scripts/analyze-git-history.sh +315 -0
- package/skills/repo-bootstrap/scripts/check-freshness.sh +230 -0
- package/skills/repo-bootstrap/scripts/detect-golden-samples.sh +161 -0
- package/skills/repo-bootstrap/scripts/detect-heuristics.sh +93 -0
- package/skills/repo-bootstrap/scripts/detect-project.sh +486 -0
- package/skills/repo-bootstrap/scripts/detect-scopes.sh +330 -0
- package/skills/repo-bootstrap/scripts/detect-utilities.sh +133 -0
- package/skills/repo-bootstrap/scripts/extract-adrs.sh +194 -0
- package/skills/repo-bootstrap/scripts/extract-agent-configs.sh +331 -0
- package/skills/repo-bootstrap/scripts/extract-architecture-rules.sh +522 -0
- package/skills/repo-bootstrap/scripts/extract-ci-commands.sh +385 -0
- package/skills/repo-bootstrap/scripts/extract-ci-rules.sh +384 -0
- package/skills/repo-bootstrap/scripts/extract-commands.sh +358 -0
- package/skills/repo-bootstrap/scripts/extract-documentation.sh +308 -0
- package/skills/repo-bootstrap/scripts/extract-github-rulesets.sh +96 -0
- package/skills/repo-bootstrap/scripts/extract-github-settings.sh +88 -0
- package/skills/repo-bootstrap/scripts/extract-ide-settings.sh +228 -0
- package/skills/repo-bootstrap/scripts/extract-platform-files.sh +290 -0
- package/skills/repo-bootstrap/scripts/extract-quality-configs.sh +442 -0
- package/skills/repo-bootstrap/scripts/generate-agents.sh +2424 -0
- package/skills/repo-bootstrap/scripts/generate-file-map.sh +153 -0
- package/skills/repo-bootstrap/scripts/lib/config-root.sh +211 -0
- package/skills/repo-bootstrap/scripts/lib/summary.sh +244 -0
- package/skills/repo-bootstrap/scripts/lib/template.sh +397 -0
- package/skills/repo-bootstrap/scripts/validate-structure.sh +324 -0
- package/skills/repo-bootstrap/scripts/verify-commands.sh +615 -0
- package/skills/repo-bootstrap/scripts/verify-content.sh +302 -0
- package/skills/schema-api-contracts/SKILL.md +56 -0
- package/skills/secret-hygiene/SKILL.md +511 -0
- package/skills/secret-hygiene/assets/.gitkeep +9 -0
- package/skills/secret-hygiene/assets/config-balanced.toml +81 -0
- package/skills/secret-hygiene/assets/config-custom.toml +178 -0
- package/skills/secret-hygiene/assets/config-strict.toml +48 -0
- package/skills/secret-hygiene/assets/github-action.yml +181 -0
- package/skills/secret-hygiene/assets/gitlab-ci.yml +257 -0
- package/skills/secret-hygiene/assets/precommit-config.yaml +70 -0
- package/skills/secret-hygiene/references/EXAMPLE.md +40 -0
- package/skills/secret-hygiene/references/compliance_mapping.md +538 -0
- package/skills/secret-hygiene/references/detection_rules.md +276 -0
- package/skills/secret-hygiene/references/false_positives.md +598 -0
- package/skills/secret-hygiene/references/remediation_guide.md +530 -0
- package/skills/stack-selector/SKILL.md +56 -0
- package/skills/telegram-control/SKILL.md +110 -0
- package/skills/telegram-control/references/architecture.md +184 -0
- package/skills/telegram-control/references/convex.md +173 -0
- package/skills/telegram-control/references/error_handling.md +212 -0
- package/skills/telegram-control/references/initial_setup.md +165 -0
- package/skills/telegram-control/references/telegram_api.md +156 -0
- package/skills/telegram-control/scripts/cancel_message.ts +53 -0
- package/skills/telegram-control/scripts/list_scheduled.ts +103 -0
- package/skills/telegram-control/scripts/logger.ts +121 -0
- package/skills/telegram-control/scripts/proxy-util.ts +11 -0
- package/skills/telegram-control/scripts/schedule_message.ts +216 -0
- package/skills/telegram-control/scripts/send_message.ts +115 -0
- package/skills/telegram-control/scripts/setup.ts +185 -0
- package/skills/telegram-control/scripts/types.ts +75 -0
- package/skills/telegram-control/scripts/view_history.ts +74 -0
- package/skills/test-strategy/SKILL.md +352 -0
- package/skills/threat-model/SKILL.md +303 -0
- package/skills/threat-model/examples/example-output.md +196 -0
- package/skills/threat-model/template.md +96 -0
- package/skills/ts-lint/SKILL.md +80 -0
- package/skills/ui-flow/SKILL.md +668 -0
- package/skills/voice-command-router/SKILL.md +51 -0
- package/skills/widget-live-activity-sync/SKILL.md +66 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Extract module boundary rules from architecture test frameworks
|
|
3
|
+
# Supports: phpat, deptrac, Go conventions, ESLint import rules, golangci-lint depguard
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
PROJECT_DIR="${1:-.}"
|
|
7
|
+
cd "$PROJECT_DIR"
|
|
8
|
+
|
|
9
|
+
# Collect results into arrays/objects, then assemble JSON at the end
|
|
10
|
+
FRAMEWORK=""
|
|
11
|
+
RULES="[]"
|
|
12
|
+
INTERNAL_PACKAGES="[]"
|
|
13
|
+
LAYER_DEFINITIONS="{}"
|
|
14
|
+
|
|
15
|
+
# --- phpat (PHP Architecture Tester) ---
|
|
16
|
+
parse_phpat() {
|
|
17
|
+
local found=false
|
|
18
|
+
|
|
19
|
+
# Find phpat test files
|
|
20
|
+
local phpat_files=()
|
|
21
|
+
for dir in tests/Architecture Tests/Architecture tests/architecture; do
|
|
22
|
+
if [ -d "$dir" ]; then
|
|
23
|
+
while IFS= read -r f; do
|
|
24
|
+
phpat_files+=("$f")
|
|
25
|
+
done < <(find "$dir" -name "*.php" -type f 2>/dev/null)
|
|
26
|
+
fi
|
|
27
|
+
done
|
|
28
|
+
|
|
29
|
+
# Also check phpat config files
|
|
30
|
+
local phpat_config=""
|
|
31
|
+
for f in phpat.yaml phpat.neon phpat.yml; do
|
|
32
|
+
[ -f "$f" ] && phpat_config="$f" && break
|
|
33
|
+
done
|
|
34
|
+
|
|
35
|
+
if [ ${#phpat_files[@]} -eq 0 ] && [ -z "$phpat_config" ]; then
|
|
36
|
+
return 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
found=true
|
|
40
|
+
FRAMEWORK="phpat"
|
|
41
|
+
local rules_arr="[]"
|
|
42
|
+
|
|
43
|
+
# Parse PHP test files for rule patterns
|
|
44
|
+
for file in "${phpat_files[@]}"; do
|
|
45
|
+
# Match shouldNotDependOn patterns
|
|
46
|
+
# e.g. classesThat(Selector::haveClassName('*Controller*'))->shouldNotDependOn(Selector::haveClassName('*Repository*'))
|
|
47
|
+
while IFS= read -r line; do
|
|
48
|
+
local source=""
|
|
49
|
+
local target=""
|
|
50
|
+
|
|
51
|
+
# Extract source from classesThat / classesInNamespace / haveClassName
|
|
52
|
+
if [[ "$line" =~ classesThat\(.*haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\) ]]; then
|
|
53
|
+
source="${BASH_REMATCH[1]}"
|
|
54
|
+
elif [[ "$line" =~ classesInNamespace\([\'\"](.*)[\'\"]\) ]]; then
|
|
55
|
+
source="${BASH_REMATCH[1]}"
|
|
56
|
+
elif [[ "$line" =~ classesThat\(.*classesInNamespace\([\'\"](.*)[\'\"]\) ]]; then
|
|
57
|
+
source="${BASH_REMATCH[1]}"
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
# Determine rule type and target
|
|
61
|
+
local rule_type=""
|
|
62
|
+
if [[ "$line" =~ shouldNotDependOn ]]; then
|
|
63
|
+
rule_type="must_not_depend"
|
|
64
|
+
if [[ "$line" =~ shouldNotDependOn\(.*haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\) ]]; then
|
|
65
|
+
target="${BASH_REMATCH[1]}"
|
|
66
|
+
elif [[ "$line" =~ shouldNotDependOn\(.*classesInNamespace\([\'\"](.*)[\'\"]\) ]]; then
|
|
67
|
+
target="${BASH_REMATCH[1]}"
|
|
68
|
+
fi
|
|
69
|
+
elif [[ "$line" =~ shouldOnlyDependOn ]]; then
|
|
70
|
+
rule_type="must_only_depend"
|
|
71
|
+
if [[ "$line" =~ shouldOnlyDependOn\(.*haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\) ]]; then
|
|
72
|
+
target="${BASH_REMATCH[1]}"
|
|
73
|
+
elif [[ "$line" =~ shouldOnlyDependOn\(.*classesInNamespace\([\'\"](.*)[\'\"]\) ]]; then
|
|
74
|
+
target="${BASH_REMATCH[1]}"
|
|
75
|
+
fi
|
|
76
|
+
elif [[ "$line" =~ mustNotDependOn ]]; then
|
|
77
|
+
rule_type="must_not_depend"
|
|
78
|
+
if [[ "$line" =~ mustNotDependOn\(.*haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\) ]]; then
|
|
79
|
+
target="${BASH_REMATCH[1]}"
|
|
80
|
+
fi
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
if [ -n "$source" ] && [ -n "$target" ] && [ -n "$rule_type" ]; then
|
|
84
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
85
|
+
--arg s "$source" --arg t "$target" --arg rt "$rule_type" \
|
|
86
|
+
'. + [{"source": $s, "target": $t, "type": $rt}]')
|
|
87
|
+
fi
|
|
88
|
+
done < <(grep -E 'shouldNotDependOn|shouldOnlyDependOn|mustNotDependOn' "$file" 2>/dev/null || true)
|
|
89
|
+
|
|
90
|
+
# Match canOnlyBeAccessedBy patterns
|
|
91
|
+
while IFS= read -r line; do
|
|
92
|
+
local target=""
|
|
93
|
+
local source=""
|
|
94
|
+
|
|
95
|
+
if [[ "$line" =~ haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\).*canOnlyBeAccessedBy ]]; then
|
|
96
|
+
target="${BASH_REMATCH[1]}"
|
|
97
|
+
fi
|
|
98
|
+
if [[ "$line" =~ canOnlyBeAccessedBy\(.*haveClassName\([\'\"]\*?([A-Za-z]+)\*?[\'\"]\) ]]; then
|
|
99
|
+
source="${BASH_REMATCH[1]}"
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
if [ -n "$source" ] && [ -n "$target" ]; then
|
|
103
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
104
|
+
--arg s "$source" --arg t "$target" \
|
|
105
|
+
'. + [{"source": $s, "target": $t, "type": "can_only_access"}]')
|
|
106
|
+
fi
|
|
107
|
+
done < <(grep -E 'canOnlyBeAccessedBy' "$file" 2>/dev/null || true)
|
|
108
|
+
done
|
|
109
|
+
|
|
110
|
+
# Parse phpat YAML/NEON config
|
|
111
|
+
if [ -n "$phpat_config" ]; then
|
|
112
|
+
# Extract rules from YAML config (simplified parsing)
|
|
113
|
+
while IFS= read -r line; do
|
|
114
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*(.+)[[:space:]]+should_not_depend_on[[:space:]]+(.+) ]]; then
|
|
115
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
116
|
+
--arg s "${BASH_REMATCH[1]}" --arg t "${BASH_REMATCH[2]}" \
|
|
117
|
+
'. + [{"source": $s, "target": $t, "type": "must_not_depend"}]')
|
|
118
|
+
fi
|
|
119
|
+
done < "$phpat_config"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
RULES="$rules_arr"
|
|
123
|
+
return 0
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# --- deptrac (PHP dependency checker) ---
|
|
127
|
+
parse_deptrac() {
|
|
128
|
+
local config_file=""
|
|
129
|
+
for f in deptrac.yaml depfile.yaml deptrac.yml depfile.yml; do
|
|
130
|
+
[ -f "$f" ] && config_file="$f" && break
|
|
131
|
+
done
|
|
132
|
+
|
|
133
|
+
[ -z "$config_file" ] && return 1
|
|
134
|
+
|
|
135
|
+
FRAMEWORK="deptrac"
|
|
136
|
+
local rules_arr="[]"
|
|
137
|
+
local layers_obj="{}"
|
|
138
|
+
|
|
139
|
+
# Parse layer definitions
|
|
140
|
+
local in_layers=false
|
|
141
|
+
local current_layer=""
|
|
142
|
+
local layer_collectors=()
|
|
143
|
+
while IFS= read -r line; do
|
|
144
|
+
# Detect layers section
|
|
145
|
+
if [[ "$line" =~ ^layers: ]]; then
|
|
146
|
+
in_layers=true
|
|
147
|
+
continue
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
# End of layers section (next top-level key)
|
|
151
|
+
if $in_layers && [[ "$line" =~ ^[a-z] && ! "$line" =~ ^[[:space:]] ]]; then
|
|
152
|
+
in_layers=false
|
|
153
|
+
# Save last layer
|
|
154
|
+
if [ -n "$current_layer" ] && [ ${#layer_collectors[@]} -gt 0 ]; then
|
|
155
|
+
local collectors_json
|
|
156
|
+
collectors_json=$(printf '%s\n' "${layer_collectors[@]}" | jq -R . | jq -s .)
|
|
157
|
+
layers_obj=$(echo "$layers_obj" | jq --arg l "$current_layer" --argjson c "$collectors_json" '. + {($l): $c}')
|
|
158
|
+
fi
|
|
159
|
+
continue
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
if $in_layers; then
|
|
163
|
+
# Layer name
|
|
164
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*name:[[:space:]]*(.+) ]]; then
|
|
165
|
+
# Save previous layer
|
|
166
|
+
if [ -n "$current_layer" ] && [ ${#layer_collectors[@]} -gt 0 ]; then
|
|
167
|
+
local collectors_json
|
|
168
|
+
collectors_json=$(printf '%s\n' "${layer_collectors[@]}" | jq -R . | jq -s .)
|
|
169
|
+
layers_obj=$(echo "$layers_obj" | jq --arg l "$current_layer" --argjson c "$collectors_json" '. + {($l): $c}')
|
|
170
|
+
fi
|
|
171
|
+
current_layer=$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
172
|
+
layer_collectors=()
|
|
173
|
+
fi
|
|
174
|
+
# Collector value (directory or className)
|
|
175
|
+
if [[ "$line" =~ value:[[:space:]]*(.+) ]]; then
|
|
176
|
+
layer_collectors+=("$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')")
|
|
177
|
+
fi
|
|
178
|
+
fi
|
|
179
|
+
done < "$config_file"
|
|
180
|
+
|
|
181
|
+
# Save last layer
|
|
182
|
+
if [ -n "$current_layer" ] && [ ${#layer_collectors[@]} -gt 0 ]; then
|
|
183
|
+
local collectors_json
|
|
184
|
+
collectors_json=$(printf '%s\n' "${layer_collectors[@]}" | jq -R . | jq -s .)
|
|
185
|
+
layers_obj=$(echo "$layers_obj" | jq --arg l "$current_layer" --argjson c "$collectors_json" '. + {($l): $c}')
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
LAYER_DEFINITIONS="$layers_obj"
|
|
189
|
+
|
|
190
|
+
# Parse ruleset (which layers can depend on which)
|
|
191
|
+
local in_ruleset=false
|
|
192
|
+
local current_source=""
|
|
193
|
+
while IFS= read -r line; do
|
|
194
|
+
if [[ "$line" =~ ^ruleset: ]]; then
|
|
195
|
+
in_ruleset=true
|
|
196
|
+
continue
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
if $in_ruleset && [[ "$line" =~ ^[a-z] && ! "$line" =~ ^[[:space:]] ]]; then
|
|
200
|
+
in_ruleset=false
|
|
201
|
+
continue
|
|
202
|
+
fi
|
|
203
|
+
|
|
204
|
+
if $in_ruleset; then
|
|
205
|
+
# Source layer
|
|
206
|
+
if [[ "$line" =~ ^[[:space:]]+([A-Za-z_]+): ]]; then
|
|
207
|
+
current_source="${BASH_REMATCH[1]}"
|
|
208
|
+
fi
|
|
209
|
+
# Allowed target
|
|
210
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*([A-Za-z_]+) ]] && [ -n "$current_source" ]; then
|
|
211
|
+
local target="${BASH_REMATCH[1]}"
|
|
212
|
+
if [ "$target" != "$current_source" ]; then
|
|
213
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
214
|
+
--arg s "$current_source" --arg t "$target" \
|
|
215
|
+
'. + [{"source": $s, "target": $t, "type": "may_depend"}]')
|
|
216
|
+
fi
|
|
217
|
+
fi
|
|
218
|
+
fi
|
|
219
|
+
done < "$config_file"
|
|
220
|
+
|
|
221
|
+
RULES="$rules_arr"
|
|
222
|
+
return 0
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
# --- Go architecture conventions ---
|
|
226
|
+
parse_go_architecture() {
|
|
227
|
+
# Only for Go projects
|
|
228
|
+
[ ! -f "go.mod" ] && return 1
|
|
229
|
+
|
|
230
|
+
local found_anything=false
|
|
231
|
+
local internal_pkgs="[]"
|
|
232
|
+
local rules_arr="[]"
|
|
233
|
+
|
|
234
|
+
# Check for internal/ directories (Go compiler-enforced boundaries)
|
|
235
|
+
if [ -d "internal" ]; then
|
|
236
|
+
found_anything=true
|
|
237
|
+
while IFS= read -r dir; do
|
|
238
|
+
local rel_path="${dir#./}"
|
|
239
|
+
internal_pkgs=$(echo "$internal_pkgs" | jq --arg p "$rel_path" '. + [$p]')
|
|
240
|
+
done < <(find ./internal -mindepth 1 -maxdepth 2 -type d 2>/dev/null)
|
|
241
|
+
|
|
242
|
+
# If no subdirs, just list internal itself
|
|
243
|
+
if [ "$(echo "$internal_pkgs" | jq 'length')" = "0" ]; then
|
|
244
|
+
internal_pkgs='["internal"]'
|
|
245
|
+
fi
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
# Check for depguard rules in golangci-lint config
|
|
249
|
+
local golangci_config=""
|
|
250
|
+
for f in .golangci.yml .golangci.yaml; do
|
|
251
|
+
[ -f "$f" ] && golangci_config="$f" && break
|
|
252
|
+
done
|
|
253
|
+
|
|
254
|
+
if [ -n "$golangci_config" ]; then
|
|
255
|
+
# Parse depguard deny rules
|
|
256
|
+
local in_depguard=false
|
|
257
|
+
local in_deny=false
|
|
258
|
+
local current_pkg=""
|
|
259
|
+
local current_desc=""
|
|
260
|
+
while IFS= read -r line; do
|
|
261
|
+
if [[ "$line" =~ ^[[:space:]]*depguard: ]]; then
|
|
262
|
+
in_depguard=true
|
|
263
|
+
continue
|
|
264
|
+
fi
|
|
265
|
+
|
|
266
|
+
# Exit depguard section on next top-level setting
|
|
267
|
+
if $in_depguard && [[ "$line" =~ ^[[:space:]]{4}[a-z] && ! "$line" =~ ^[[:space:]]{6} && ! "$line" =~ deny && ! "$line" =~ rules && ! "$line" =~ main ]]; then
|
|
268
|
+
in_depguard=false
|
|
269
|
+
in_deny=false
|
|
270
|
+
continue
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
if $in_depguard && [[ "$line" =~ deny: ]]; then
|
|
274
|
+
in_deny=true
|
|
275
|
+
continue
|
|
276
|
+
fi
|
|
277
|
+
|
|
278
|
+
if $in_depguard && $in_deny; then
|
|
279
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*pkg:[[:space:]]*(.+) ]]; then
|
|
280
|
+
current_pkg=$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
281
|
+
found_anything=true
|
|
282
|
+
fi
|
|
283
|
+
if [[ "$line" =~ desc:[[:space:]]*(.+) ]]; then
|
|
284
|
+
current_desc=$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
285
|
+
if [ -n "$current_pkg" ]; then
|
|
286
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
287
|
+
--arg s "*" --arg t "$current_pkg" --arg rt "must_not_depend" --arg d "$current_desc" \
|
|
288
|
+
'. + [{"source": $s, "target": $t, "type": $rt, "reason": $d}]')
|
|
289
|
+
current_pkg=""
|
|
290
|
+
current_desc=""
|
|
291
|
+
fi
|
|
292
|
+
fi
|
|
293
|
+
fi
|
|
294
|
+
done < "$golangci_config"
|
|
295
|
+
|
|
296
|
+
# Parse gomodguard if present
|
|
297
|
+
local in_gomodguard=false
|
|
298
|
+
local in_blocked=false
|
|
299
|
+
while IFS= read -r line; do
|
|
300
|
+
if [[ "$line" =~ ^[[:space:]]*gomodguard: ]]; then
|
|
301
|
+
in_gomodguard=true
|
|
302
|
+
continue
|
|
303
|
+
fi
|
|
304
|
+
|
|
305
|
+
if $in_gomodguard && [[ "$line" =~ blocked: ]]; then
|
|
306
|
+
in_blocked=true
|
|
307
|
+
continue
|
|
308
|
+
fi
|
|
309
|
+
|
|
310
|
+
if $in_gomodguard && $in_blocked; then
|
|
311
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]]*pkg:[[:space:]]*(.+) ]]; then
|
|
312
|
+
local blocked_pkg
|
|
313
|
+
blocked_pkg=$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
|
|
314
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
315
|
+
--arg s "*" --arg t "$blocked_pkg" --arg rt "must_not_depend" \
|
|
316
|
+
'. + [{"source": $s, "target": $t, "type": $rt}]')
|
|
317
|
+
found_anything=true
|
|
318
|
+
fi
|
|
319
|
+
fi
|
|
320
|
+
|
|
321
|
+
# Exit gomodguard on next top-level setting
|
|
322
|
+
if $in_gomodguard && [[ "$line" =~ ^[[:space:]]{4}[a-z] && ! "$line" =~ blocked && ! "$line" =~ modules && ! "$line" =~ versions ]]; then
|
|
323
|
+
in_gomodguard=false
|
|
324
|
+
in_blocked=false
|
|
325
|
+
fi
|
|
326
|
+
done < "$golangci_config"
|
|
327
|
+
|
|
328
|
+
# Parse forbidigo patterns (banned function calls)
|
|
329
|
+
local in_forbidigo=false
|
|
330
|
+
local in_forbid=false
|
|
331
|
+
while IFS= read -r line; do
|
|
332
|
+
if [[ "$line" =~ ^[[:space:]]*forbidigo: ]]; then
|
|
333
|
+
in_forbidigo=true
|
|
334
|
+
continue
|
|
335
|
+
fi
|
|
336
|
+
if $in_forbidigo && [[ "$line" =~ forbid: ]]; then
|
|
337
|
+
in_forbid=true
|
|
338
|
+
continue
|
|
339
|
+
fi
|
|
340
|
+
if $in_forbidigo && $in_forbid; then
|
|
341
|
+
if [[ "$line" =~ pattern:[[:space:]]*(.+) ]]; then
|
|
342
|
+
local pattern
|
|
343
|
+
pattern=$(echo "${BASH_REMATCH[1]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[\^$]//g')
|
|
344
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
345
|
+
--arg s "*" --arg t "$pattern" --arg rt "forbidden_call" \
|
|
346
|
+
'. + [{"source": $s, "target": $t, "type": $rt}]')
|
|
347
|
+
found_anything=true
|
|
348
|
+
fi
|
|
349
|
+
fi
|
|
350
|
+
if $in_forbidigo && [[ "$line" =~ ^[[:space:]]{4}[a-z] && ! "$line" =~ forbid && ! "$line" =~ pattern ]]; then
|
|
351
|
+
in_forbidigo=false
|
|
352
|
+
in_forbid=false
|
|
353
|
+
fi
|
|
354
|
+
done < "$golangci_config"
|
|
355
|
+
fi
|
|
356
|
+
|
|
357
|
+
# Detect directory-based architecture patterns
|
|
358
|
+
local arch_pattern=""
|
|
359
|
+
if [ -d "ports" ] && [ -d "adapters" ]; then
|
|
360
|
+
arch_pattern="hexagonal"
|
|
361
|
+
found_anything=true
|
|
362
|
+
elif [ -d "domain" ] && [ -d "infrastructure" ]; then
|
|
363
|
+
arch_pattern="clean-architecture"
|
|
364
|
+
found_anything=true
|
|
365
|
+
elif [ -d "cmd" ] && [ -d "pkg" ]; then
|
|
366
|
+
arch_pattern="go-standard-layout"
|
|
367
|
+
found_anything=true
|
|
368
|
+
fi
|
|
369
|
+
|
|
370
|
+
if [ -n "$arch_pattern" ]; then
|
|
371
|
+
LAYER_DEFINITIONS=$(echo "$LAYER_DEFINITIONS" | jq --arg p "$arch_pattern" '. + {"architecture_pattern": $p}')
|
|
372
|
+
fi
|
|
373
|
+
|
|
374
|
+
$found_anything || return 1
|
|
375
|
+
|
|
376
|
+
[ -z "$FRAMEWORK" ] && FRAMEWORK="go-conventions"
|
|
377
|
+
RULES="$rules_arr"
|
|
378
|
+
INTERNAL_PACKAGES="$internal_pkgs"
|
|
379
|
+
return 0
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
# --- ESLint import restrictions ---
|
|
383
|
+
parse_eslint_imports() {
|
|
384
|
+
local config_file=""
|
|
385
|
+
for f in eslint.config.js eslint.config.mjs .eslintrc.js .eslintrc.cjs .eslintrc.json .eslintrc.yml .eslintrc.yaml .eslintrc; do
|
|
386
|
+
[ -f "$f" ] && config_file="$f" && break
|
|
387
|
+
done
|
|
388
|
+
|
|
389
|
+
[ -z "$config_file" ] && return 1
|
|
390
|
+
|
|
391
|
+
local rules_arr="[]"
|
|
392
|
+
local found=false
|
|
393
|
+
|
|
394
|
+
# For JSON eslint configs, extract import/no-restricted-paths or no-restricted-imports
|
|
395
|
+
if [[ "$config_file" == *.json ]] || [[ "$config_file" == .eslintrc ]]; then
|
|
396
|
+
# Check for no-restricted-imports
|
|
397
|
+
local restricted
|
|
398
|
+
restricted=$(jq -r '.rules["no-restricted-imports"] // .rules["import/no-restricted-paths"] // empty' "$config_file" 2>/dev/null || echo "")
|
|
399
|
+
if [ -n "$restricted" ] && [ "$restricted" != "null" ]; then
|
|
400
|
+
found=true
|
|
401
|
+
# Extract patterns from the restriction config
|
|
402
|
+
local patterns
|
|
403
|
+
patterns=$(echo "$restricted" | jq -r '
|
|
404
|
+
if type == "array" then
|
|
405
|
+
.[1].patterns // .[1].zones // []
|
|
406
|
+
elif type == "object" then
|
|
407
|
+
.patterns // .zones // []
|
|
408
|
+
else [] end | .[] |
|
|
409
|
+
if type == "object" then
|
|
410
|
+
"from=" + (.from // .target // "?") + " import=" + (.import // .message // "restricted")
|
|
411
|
+
elif type == "string" then
|
|
412
|
+
"pattern=" + .
|
|
413
|
+
else empty end
|
|
414
|
+
' 2>/dev/null || echo "")
|
|
415
|
+
|
|
416
|
+
while IFS= read -r pat; do
|
|
417
|
+
[ -z "$pat" ] && continue
|
|
418
|
+
rules_arr=$(echo "$rules_arr" | jq \
|
|
419
|
+
--arg desc "$pat" \
|
|
420
|
+
'. + [{"source": "*", "target": $desc, "type": "import_restriction"}]')
|
|
421
|
+
done <<< "$patterns"
|
|
422
|
+
fi
|
|
423
|
+
fi
|
|
424
|
+
|
|
425
|
+
# For JS configs, do a best-effort grep for no-restricted-imports
|
|
426
|
+
if [[ "$config_file" == *.js ]] || [[ "$config_file" == *.mjs ]] || [[ "$config_file" == *.cjs ]]; then
|
|
427
|
+
if grep -q 'no-restricted-imports\|import/no-restricted-paths' "$config_file" 2>/dev/null; then
|
|
428
|
+
found=true
|
|
429
|
+
# Extract string patterns from the config (simplified)
|
|
430
|
+
while IFS= read -r pattern; do
|
|
431
|
+
[ -z "$pattern" ] && continue
|
|
432
|
+
local clean_pattern
|
|
433
|
+
clean_pattern=$(echo "$pattern" | sed "s/['\"]//g;s/,//g;s/^[[:space:]]*//" | head -c 100)
|
|
434
|
+
[ -n "$clean_pattern" ] && rules_arr=$(echo "$rules_arr" | jq \
|
|
435
|
+
--arg t "$clean_pattern" \
|
|
436
|
+
'. + [{"source": "*", "target": $t, "type": "import_restriction"}]')
|
|
437
|
+
done < <(grep -A1 'no-restricted-imports\|import/no-restricted-paths' "$config_file" 2>/dev/null | grep -oE "'[^']+'" | head -10)
|
|
438
|
+
fi
|
|
439
|
+
fi
|
|
440
|
+
|
|
441
|
+
$found || return 1
|
|
442
|
+
|
|
443
|
+
[ -z "$FRAMEWORK" ] && FRAMEWORK="eslint-imports"
|
|
444
|
+
RULES="$rules_arr"
|
|
445
|
+
return 0
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
# --- Detect architecture from directory conventions ---
|
|
449
|
+
parse_directory_architecture() {
|
|
450
|
+
local rules_arr="[]"
|
|
451
|
+
local layers_obj="{}"
|
|
452
|
+
local found=false
|
|
453
|
+
|
|
454
|
+
# Hexagonal / Ports & Adapters
|
|
455
|
+
if [ -d "ports" ] && [ -d "adapters" ]; then
|
|
456
|
+
found=true
|
|
457
|
+
layers_obj=$(echo "$layers_obj" | jq '. + {"architecture_pattern": "hexagonal"}')
|
|
458
|
+
rules_arr=$(echo "$rules_arr" | jq '. + [
|
|
459
|
+
{"source": "adapters", "target": "ports", "type": "may_depend"},
|
|
460
|
+
{"source": "ports", "target": "adapters", "type": "must_not_depend"}
|
|
461
|
+
]')
|
|
462
|
+
fi
|
|
463
|
+
|
|
464
|
+
# Clean Architecture
|
|
465
|
+
if [ -d "domain" ] && { [ -d "infrastructure" ] || [ -d "application" ]; }; then
|
|
466
|
+
found=true
|
|
467
|
+
layers_obj=$(echo "$layers_obj" | jq '. + {"architecture_pattern": "clean-architecture"}')
|
|
468
|
+
rules_arr=$(echo "$rules_arr" | jq '. + [
|
|
469
|
+
{"source": "domain", "target": "infrastructure", "type": "must_not_depend"},
|
|
470
|
+
{"source": "domain", "target": "application", "type": "must_not_depend"}
|
|
471
|
+
]')
|
|
472
|
+
fi
|
|
473
|
+
|
|
474
|
+
# Onion Architecture
|
|
475
|
+
if [ -d "Domain" ] && [ -d "Application" ] && [ -d "Infrastructure" ]; then
|
|
476
|
+
found=true
|
|
477
|
+
layers_obj=$(echo "$layers_obj" | jq '. + {"architecture_pattern": "onion"}')
|
|
478
|
+
rules_arr=$(echo "$rules_arr" | jq '. + [
|
|
479
|
+
{"source": "Domain", "target": "Infrastructure", "type": "must_not_depend"},
|
|
480
|
+
{"source": "Domain", "target": "Application", "type": "must_not_depend"},
|
|
481
|
+
{"source": "Application", "target": "Infrastructure", "type": "must_not_depend"}
|
|
482
|
+
]')
|
|
483
|
+
fi
|
|
484
|
+
|
|
485
|
+
$found || return 1
|
|
486
|
+
|
|
487
|
+
[ -z "$FRAMEWORK" ] && FRAMEWORK="directory-conventions"
|
|
488
|
+
RULES="$rules_arr"
|
|
489
|
+
LAYER_DEFINITIONS="$layers_obj"
|
|
490
|
+
return 0
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
# --- Main: try each parser in priority order ---
|
|
494
|
+
# Try specific frameworks first, then fall back to conventions
|
|
495
|
+
parse_phpat || true
|
|
496
|
+
if [ "$FRAMEWORK" = "" ]; then
|
|
497
|
+
parse_deptrac || true
|
|
498
|
+
fi
|
|
499
|
+
if [ "$FRAMEWORK" = "" ]; then
|
|
500
|
+
parse_go_architecture || true
|
|
501
|
+
fi
|
|
502
|
+
if [ "$FRAMEWORK" = "" ]; then
|
|
503
|
+
parse_eslint_imports || true
|
|
504
|
+
fi
|
|
505
|
+
if [ "$FRAMEWORK" = "" ]; then
|
|
506
|
+
parse_directory_architecture || true
|
|
507
|
+
fi
|
|
508
|
+
|
|
509
|
+
# Output final JSON
|
|
510
|
+
jq -n \
|
|
511
|
+
--arg framework "$FRAMEWORK" \
|
|
512
|
+
--argjson rules "$RULES" \
|
|
513
|
+
--argjson internal_packages "$INTERNAL_PACKAGES" \
|
|
514
|
+
--argjson layer_definitions "$LAYER_DEFINITIONS" \
|
|
515
|
+
'{
|
|
516
|
+
framework: $framework,
|
|
517
|
+
rules: $rules,
|
|
518
|
+
internal_packages: $internal_packages,
|
|
519
|
+
layer_definitions: $layer_definitions
|
|
520
|
+
} | with_entries(select(
|
|
521
|
+
.value != "" and .value != [] and .value != {} and .value != null
|
|
522
|
+
))'
|