symphony-forge 1.2.44__py3-none-any.whl
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.
- forge/__init__.py +4 -0
- forge/app_baseline.py +148 -0
- forge/approval.py +298 -0
- forge/autoreview.py +139 -0
- forge/backfill.py +298 -0
- forge/board.py +1197 -0
- forge/board_app/app.js +276 -0
- forge/board_app/assign.css +91 -0
- forge/board_app/assign.js +157 -0
- forge/board_app/insights.js +80 -0
- forge/board_app/item.css +380 -0
- forge/board_app/item.js +594 -0
- forge/board_app/markdown.js +110 -0
- forge/board_app/now.css +417 -0
- forge/board_app/now.js +248 -0
- forge/board_app/pages.css +178 -0
- forge/board_app/releases.js +203 -0
- forge/board_app/shell.html +31 -0
- forge/board_app/tokens.css +220 -0
- forge/board_facts.py +696 -0
- forge/board_graph.py +38 -0
- forge/board_server.py +431 -0
- forge/board_trends.py +105 -0
- forge/box.py +54 -0
- forge/box_ssh.py +209 -0
- forge/checks.py +743 -0
- forge/citime.py +259 -0
- forge/claude_sdk.py +56 -0
- forge/claude_turn.py +62 -0
- forge/cli.py +185 -0
- forge/close.py +1193 -0
- forge/close_remote.py +85 -0
- forge/codex.py +1200 -0
- forge/codex_turn.py +346 -0
- forge/deny.py +253 -0
- forge/design.py +201 -0
- forge/design_skills.py +16 -0
- forge/docskip.py +175 -0
- forge/doctor.py +578 -0
- forge/event_log.py +128 -0
- forge/fasttest.py +846 -0
- forge/feature.py +318 -0
- forge/feature_api.py +593 -0
- forge/feature_python.py +1107 -0
- forge/feature_python_contracts.py +268 -0
- forge/feature_python_tests.py +1134 -0
- forge/feature_python_tools.py +81 -0
- forge/feature_remove.py +189 -0
- forge/feature_schema.py +156 -0
- forge/feature_tests.py +1062 -0
- forge/fullrun.py +166 -0
- forge/gaps.py +109 -0
- forge/githooks.py +251 -0
- forge/github.py +191 -0
- forge/init.py +494 -0
- forge/intake.py +226 -0
- forge/journey.py +126 -0
- forge/known_issues.py +165 -0
- forge/land.py +882 -0
- forge/machine.py +821 -0
- forge/merge.py +530 -0
- forge/merge_review.py +84 -0
- forge/merge_timings.py +46 -0
- forge/migrate.py +673 -0
- forge/migration_warnings.py +108 -0
- forge/mod/.claude-plugin/plugin.json +20 -0
- forge/mod/hooks/hooks.json +3 -0
- forge/mod/hooks/pane.test.ts +608 -0
- forge/mod/hooks/register.ts +413 -0
- forge/mod/tsconfig.json +18 -0
- forge/native.py +306 -0
- forge/nextstep.py +1184 -0
- forge/node_workers.cjs +26 -0
- forge/noise.py +40 -0
- forge/open_decisions.py +205 -0
- forge/owner_choices.py +167 -0
- forge/payback.py +97 -0
- forge/plain_english.py +20 -0
- forge/plan_scope.py +76 -0
- forge/prcheck.py +640 -0
- forge/quicktest.py +198 -0
- forge/records.py +912 -0
- forge/releases.py +100 -0
- forge/repo.py +1154 -0
- forge/review.py +1199 -0
- forge/review_process.py +86 -0
- forge/review_skip.py +116 -0
- forge/roles.py +141 -0
- forge/round_limits.py +7 -0
- forge/score.py +192 -0
- forge/spotted.py +271 -0
- forge/standards.md +318 -0
- forge/story.py +1200 -0
- forge/sync.py +783 -0
- forge/task.py +1082 -0
- forge/templates/adapters/AGENTS.md +98 -0
- forge/templates/brief.md +834 -0
- forge/templates/cold-read.md +324 -0
- forge/templates/conventions/api.md +144 -0
- forge/templates/conventions/backend.md +171 -0
- forge/templates/conventions/database.md +81 -0
- forge/templates/conventions/demo-data.md +61 -0
- forge/templates/conventions/deploy.md +114 -0
- forge/templates/conventions/frontend.md +187 -0
- forge/templates/conventions/python.md +336 -0
- forge/templates/conventions/security.md +44 -0
- forge/templates/conventions/stack.md +96 -0
- forge/templates/conventions/testing.md +165 -0
- forge/templates/delegation.md +3 -0
- forge/templates/design/render-check.d.mts +25 -0
- forge/templates/design/render-check.mjs +113 -0
- forge/templates/design/support.js +159 -0
- forge/templates/design/ui-checks.js +111 -0
- forge/templates/fde.md +218 -0
- forge/templates/feature/kinds.toml +140 -0
- forge/templates/handover.md +26 -0
- forge/templates/migrate-skill.md +87 -0
- forge/templates/records-only-action.yml +16 -0
- forge/templates/review-light.md +48 -0
- forge/templates/review-tests.py +200 -0
- forge/templates/review.md +661 -0
- forge/templates/run-reference.md +328 -0
- forge/templates/skeleton/.dockerignore +18 -0
- forge/templates/skeleton/Dockerfile +10 -0
- forge/templates/skeleton/docs/decisions/README.md +13 -0
- forge/templates/skeleton/docs/product/BRIEF.md +47 -0
- forge/templates/skeleton/docs/product/DISCOVERY.md +46 -0
- forge/templates/skeleton/docs/specs/README.md +41 -0
- forge/templates/skeleton/services.toml +6 -0
- forge/templates/skill.md +2753 -0
- forge/templates/skills/agents/SKILL.md +446 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/README.md +131 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/__init__.py +5 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/chats.py +60 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/cleanup.py +91 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/app/assistant/models.py +57 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/migrations/versions/20261106_assistant.py +90 -0
- forge/templates/skills/agents/assistant-module/python/apps/api/tests/test_assistant_chats.py +173 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/prisma/migrations/20261106000000_assistant/migration.sql +17 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/prisma/schema/assistant.prisma +19 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/test/assistant-api.e2e-spec.ts +185 -0
- forge/templates/skills/agents/assistant-module/typescript/apps/api/test/assistant-chats.e2e-spec.ts +75 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/README.md +107 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/package.json +10 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/src/index.ts +66 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/contracts/tsconfig.json +12 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/package.json +23 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.chats.controller.ts +54 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.chats.service.ts +140 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.cleanup.ts +34 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/assistant.module.ts +20 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/src/index.ts +3 -0
- forge/templates/skills/agents/assistant-module/typescript/libs/assistant/server/tsconfig.json +15 -0
- forge/templates/skills/app-baseline/SKILL.md +241 -0
- forge/templates/skills/database/SKILL.md +155 -0
- forge/templates/skills/emil-design-eng/FORGE-NOTICE.md +9 -0
- forge/templates/skills/emil-design-eng/LICENSE +21 -0
- forge/templates/skills/emil-design-eng/SKILL.md +674 -0
- forge/templates/skills/impeccable/FORGE-NOTICE.md +10 -0
- forge/templates/skills/impeccable/LICENSE +191 -0
- forge/templates/skills/impeccable/NOTICE.md +11 -0
- forge/templates/skills/impeccable/SKILL.md +88 -0
- forge/templates/skills/impeccable/reference/adapt.md +318 -0
- forge/templates/skills/impeccable/reference/adapt.native.md +58 -0
- forge/templates/skills/impeccable/reference/android.md +46 -0
- forge/templates/skills/impeccable/reference/animate.md +89 -0
- forge/templates/skills/impeccable/reference/audit.md +139 -0
- forge/templates/skills/impeccable/reference/audit.native.md +139 -0
- forge/templates/skills/impeccable/reference/bolder.md +33 -0
- forge/templates/skills/impeccable/reference/clarify.md +94 -0
- forge/templates/skills/impeccable/reference/colorize.md +86 -0
- forge/templates/skills/impeccable/reference/component-review.md +63 -0
- forge/templates/skills/impeccable/reference/craft-floor.md +44 -0
- forge/templates/skills/impeccable/reference/craft.md +5 -0
- forge/templates/skills/impeccable/reference/critique.md +819 -0
- forge/templates/skills/impeccable/reference/degraded/asset-producer.md +42 -0
- forge/templates/skills/impeccable/reference/degraded/documenter.md +24 -0
- forge/templates/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- forge/templates/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- forge/templates/skills/impeccable/reference/delight.md +70 -0
- forge/templates/skills/impeccable/reference/distill.md +111 -0
- forge/templates/skills/impeccable/reference/doctor.md +54 -0
- forge/templates/skills/impeccable/reference/document.md +416 -0
- forge/templates/skills/impeccable/reference/extract.md +69 -0
- forge/templates/skills/impeccable/reference/generate.md +101 -0
- forge/templates/skills/impeccable/reference/harden.md +362 -0
- forge/templates/skills/impeccable/reference/hooks.md +114 -0
- forge/templates/skills/impeccable/reference/init.md +131 -0
- forge/templates/skills/impeccable/reference/ios.md +51 -0
- forge/templates/skills/impeccable/reference/layout.md +84 -0
- forge/templates/skills/impeccable/reference/live-setup.md +104 -0
- forge/templates/skills/impeccable/reference/live.md +325 -0
- forge/templates/skills/impeccable/reference/mode-operate.md +21 -0
- forge/templates/skills/impeccable/reference/mode-persuade.md +19 -0
- forge/templates/skills/impeccable/reference/mode-read.md +21 -0
- forge/templates/skills/impeccable/reference/new-work.md +154 -0
- forge/templates/skills/impeccable/reference/onboard.md +234 -0
- forge/templates/skills/impeccable/reference/operate.md +61 -0
- forge/templates/skills/impeccable/reference/optimize.md +257 -0
- forge/templates/skills/impeccable/reference/overdrive.md +127 -0
- forge/templates/skills/impeccable/reference/polish.md +105 -0
- forge/templates/skills/impeccable/reference/quieter.md +99 -0
- forge/templates/skills/impeccable/reference/region-map.md +26 -0
- forge/templates/skills/impeccable/reference/routing.md +24 -0
- forge/templates/skills/impeccable/reference/shape.md +59 -0
- forge/templates/skills/impeccable/reference/typeset.md +90 -0
- forge/templates/skills/impeccable/reference/visualize.md +47 -0
- forge/templates/skills/impeccable/scripts/VERSION +1 -0
- forge/templates/skills/impeccable/scripts/command-metadata.json +98 -0
- forge/templates/skills/impeccable/scripts/data/font-index-failures.json +121 -0
- forge/templates/skills/impeccable/scripts/data/font-index.json +1 -0
- forge/templates/skills/impeccable/scripts/engine-checksums.txt +9 -0
- forge/templates/skills/impeccable/scripts/impeccable +249 -0
- forge/templates/skills/impeccable/scripts/impeccable.cmd +278 -0
- forge/templates/skills/impeccable/scripts/live-browser-dom.js +321 -0
- forge/templates/skills/impeccable/scripts/live-browser-ignores.js +247 -0
- forge/templates/skills/impeccable/scripts/live-browser-session.js +184 -0
- forge/templates/skills/impeccable/scripts/live-browser.js +13646 -0
- forge/templates/skills/impeccable/scripts/modern-screenshot.umd.js +15 -0
- forge/templates/skills/remote-approval/SKILL.md +40 -0
- forge/templates/skills/security-audit/AI-AND-LLM.md +83 -0
- forge/templates/skills/security-audit/ATTACK-CLASSES.md +130 -0
- forge/templates/skills/security-audit/CLIENT-SIDE.md +83 -0
- forge/templates/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
- forge/templates/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
- forge/templates/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
- forge/templates/skills/security-audit/HUNTING.md +251 -0
- forge/templates/skills/security-audit/LICENSE +21 -0
- forge/templates/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
- forge/templates/skills/security-audit/NOTICE.md +6 -0
- forge/templates/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
- forge/templates/skills/security-audit/RECONNAISSANCE.md +156 -0
- forge/templates/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
- forge/templates/skills/security-audit/SKILL.md +192 -0
- forge/templates/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
- forge/templates/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
- forge/templates/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
- forge/templates/skills/security-audit/report-schema.json +461 -0
- forge/templates/skills/security-audit/validate-coverage-ledger.cjs +873 -0
- forge/templates/skills/security-audit/validate-findings.cjs +774 -0
- forge/templates/skills/simplified-technical-english/LICENSE +28 -0
- forge/templates/skills/simplified-technical-english/NOTICE.md +33 -0
- forge/templates/skills/simplified-technical-english/SKILL.md +127 -0
- forge/templates/skills/simplified-technical-english/examples/before-after.md +86 -0
- forge/templates/skills/simplified-technical-english/references/substitutions.md +113 -0
- forge/templates/skills/simplified-technical-english/references/writing-rules.md +209 -0
- forge/templates/skills/simplified-technical-english/scripts/ste_check.py +301 -0
- forge/templates/skills/test-audit/NOTICE.md +25 -0
- forge/templates/skills/test-audit/SKILL.md +182 -0
- forge/templates/start.md +27 -0
- forge/templates/starter/.env.example +14 -0
- forge/templates/starter/.gitignore +7 -0
- forge/templates/starter/.npmrc +1 -0
- forge/templates/starter/Dockerfile +23 -0
- forge/templates/starter/README.md +121 -0
- forge/templates/starter/apps/api/package.json +15 -0
- forge/templates/starter/apps/api/prisma/migrations/20261022000000_initial/migration.sql +68 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000000_organisations/migration.sql +44 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000100_invites/migration.sql +18 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000200_history/migration.sql +13 -0
- forge/templates/starter/apps/api/prisma/migrations/20261025000300_soft_delete_only/migration.sql +10 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000000_extensions/migration.sql +3 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000100_ids_and_updated_at/migration.sql +31 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000150_module_schemas/migration.sql +19 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000200_columns/migration.sql +51 -0
- forge/templates/starter/apps/api/prisma/migrations/20261026000300_history_subjects/migration.sql +11 -0
- forge/templates/starter/apps/api/prisma/migrations/20261027000000_agents/migration.sql +12 -0
- forge/templates/starter/apps/api/prisma/migrations/20261027000100_mcp/migration.sql +20 -0
- forge/templates/starter/apps/api/prisma/migrations/20261028000000_via_agent/migration.sql +7 -0
- forge/templates/starter/apps/api/prisma/migrations/20261102000000_sign_in_attempts/migration.sql +13 -0
- forge/templates/starter/apps/api/prisma/migrations/20261104000000_notifications/migration.sql +23 -0
- forge/templates/starter/apps/api/prisma/migrations/migration_lock.toml +1 -0
- forge/templates/starter/apps/api/prisma/schema/auth.prisma +65 -0
- forge/templates/starter/apps/api/prisma/schema/base.prisma +9 -0
- forge/templates/starter/apps/api/prisma/schema/history.prisma +19 -0
- forge/templates/starter/apps/api/prisma/schema/mcp.prisma +18 -0
- forge/templates/starter/apps/api/prisma/schema/notifications.prisma +20 -0
- forge/templates/starter/apps/api/prisma/schema/organisations.prisma +66 -0
- forge/templates/starter/apps/api/prisma/schema/projects.prisma +23 -0
- forge/templates/starter/apps/api/project.json +35 -0
- forge/templates/starter/apps/api/src/app.module.ts +36 -0
- forge/templates/starter/apps/api/src/health/health.controller.ts +16 -0
- forge/templates/starter/apps/api/src/health/health.module.ts +5 -0
- forge/templates/starter/apps/api/src/main.ts +44 -0
- forge/templates/starter/apps/api/src/setup-company.ts +33 -0
- forge/templates/starter/apps/api/test/agents.e2e-spec.ts +99 -0
- forge/templates/starter/apps/api/test/api.e2e-spec.ts +250 -0
- forge/templates/starter/apps/api/test/auth.e2e-spec.ts +287 -0
- forge/templates/starter/apps/api/test/database.e2e-spec.ts +171 -0
- forge/templates/starter/apps/api/test/environment.e2e-spec.ts +56 -0
- forge/templates/starter/apps/api/test/error-reports.e2e-spec.ts +72 -0
- forge/templates/starter/apps/api/test/exports.e2e-spec.ts +85 -0
- forge/templates/starter/apps/api/test/helpers.ts +103 -0
- forge/templates/starter/apps/api/test/history.e2e-spec.ts +93 -0
- forge/templates/starter/apps/api/test/invites.e2e-spec.ts +262 -0
- forge/templates/starter/apps/api/test/mcp.e2e-spec.ts +269 -0
- forge/templates/starter/apps/api/test/notifications.e2e-spec.ts +117 -0
- forge/templates/starter/apps/api/test/one-company.e2e-spec.ts +154 -0
- forge/templates/starter/apps/api/test/organisations.e2e-spec.ts +210 -0
- forge/templates/starter/apps/api/test/projects.e2e-spec.ts +824 -0
- forge/templates/starter/apps/api/test/soft-delete.e2e-spec.ts +31 -0
- forge/templates/starter/apps/api/tsconfig.json +44 -0
- forge/templates/starter/apps/api/tsconfig.test.json +17 -0
- forge/templates/starter/apps/api/vitest.config.ts +13 -0
- forge/templates/starter/apps/web/e2e/motion.spec.ts +88 -0
- forge/templates/starter/apps/web/e2e/rules/accept-invite.spec.ts +59 -0
- forge/templates/starter/apps/web/e2e/rules/members.spec.ts +212 -0
- forge/templates/starter/apps/web/e2e/rules/reset-password.spec.ts +78 -0
- forge/templates/starter/apps/web/e2e/rules/sign-in.spec.ts +87 -0
- forge/templates/starter/apps/web/e2e/served-app.spec.ts +19 -0
- forge/templates/starter/apps/web/index.html +14 -0
- forge/templates/starter/apps/web/package.json +9 -0
- forge/templates/starter/apps/web/playwright.config.ts +21 -0
- forge/templates/starter/apps/web/project.json +36 -0
- forge/templates/starter/apps/web/src/index.css +166 -0
- forge/templates/starter/apps/web/src/main.tsx +14 -0
- forge/templates/starter/apps/web/src/shared-states.test.tsx +40 -0
- forge/templates/starter/apps/web/tsconfig.json +30 -0
- forge/templates/starter/apps/web/vite.config.ts +19 -0
- forge/templates/starter/apps/web/vitest.config.ts +23 -0
- forge/templates/starter/apps/web/vitest.setup.ts +5 -0
- forge/templates/starter/compose.test.yml +66 -0
- forge/templates/starter/eslint.config.mjs +56 -0
- forge/templates/starter/libs/auth/contracts/package.json +17 -0
- forge/templates/starter/libs/auth/contracts/project.json +15 -0
- forge/templates/starter/libs/auth/contracts/src/index.ts +56 -0
- forge/templates/starter/libs/auth/contracts/tsconfig.json +18 -0
- forge/templates/starter/libs/auth/server/package.json +19 -0
- forge/templates/starter/libs/auth/server/project.json +15 -0
- forge/templates/starter/libs/auth/server/src/agents.controller.ts +24 -0
- forge/templates/starter/libs/auth/server/src/auth.controller.ts +136 -0
- forge/templates/starter/libs/auth/server/src/auth.dto.ts +53 -0
- forge/templates/starter/libs/auth/server/src/auth.module.ts +18 -0
- forge/templates/starter/libs/auth/server/src/auth.service.ts +251 -0
- forge/templates/starter/libs/auth/server/src/index.ts +3 -0
- forge/templates/starter/libs/auth/server/src/invites.controller.ts +37 -0
- forge/templates/starter/libs/auth/server/src/members.controller.ts +47 -0
- forge/templates/starter/libs/auth/server/src/session.guard.ts +52 -0
- forge/templates/starter/libs/auth/server/tsconfig.json +29 -0
- forge/templates/starter/libs/core/server/package.json +17 -0
- forge/templates/starter/libs/core/server/project.json +19 -0
- forge/templates/starter/libs/core/server/src/common/account-principal.ts +8 -0
- forge/templates/starter/libs/core/server/src/common/admin-only.decorator.ts +18 -0
- forge/templates/starter/libs/core/server/src/common/all-exceptions.filter.ts +55 -0
- forge/templates/starter/libs/core/server/src/common/api-envelope.decorator.ts +28 -0
- forge/templates/starter/libs/core/server/src/common/api-response.dto.ts +26 -0
- forge/templates/starter/libs/core/server/src/common/api-zod.decorator.ts +21 -0
- forge/templates/starter/libs/core/server/src/common/authenticated-request.ts +7 -0
- forge/templates/starter/libs/core/server/src/common/common.module.ts +7 -0
- forge/templates/starter/libs/core/server/src/common/correlation.middleware.ts +12 -0
- forge/templates/starter/libs/core/server/src/common/csrf.guard.ts +35 -0
- forge/templates/starter/libs/core/server/src/common/csv.ts +14 -0
- forge/templates/starter/libs/core/server/src/common/current-account.decorator.ts +11 -0
- forge/templates/starter/libs/core/server/src/common/envelope.interceptor.ts +10 -0
- forge/templates/starter/libs/core/server/src/common/error-report.ts +43 -0
- forge/templates/starter/libs/core/server/src/common/json-logger.test.ts +95 -0
- forge/templates/starter/libs/core/server/src/common/json-logger.ts +57 -0
- forge/templates/starter/libs/core/server/src/common/permissions.ts +49 -0
- forge/templates/starter/libs/core/server/src/common/prompts.ts +42 -0
- forge/templates/starter/libs/core/server/src/common/public.decorator.ts +4 -0
- forge/templates/starter/libs/core/server/src/common/request-log.middleware.ts +19 -0
- forge/templates/starter/libs/core/server/src/common/resources.ts +88 -0
- forge/templates/starter/libs/core/server/src/common/retry-keys.ts +31 -0
- forge/templates/starter/libs/core/server/src/common/tools.test.ts +205 -0
- forge/templates/starter/libs/core/server/src/common/tools.ts +266 -0
- forge/templates/starter/libs/core/server/src/common/zod-validation.pipe.ts +22 -0
- forge/templates/starter/libs/core/server/src/config/environment.ts +95 -0
- forge/templates/starter/libs/core/server/src/index.ts +27 -0
- forge/templates/starter/libs/core/server/src/mail/mail.module.ts +19 -0
- forge/templates/starter/libs/core/server/src/mail/mail.provider.ts +22 -0
- forge/templates/starter/libs/core/server/src/prisma/prisma.module.ts +7 -0
- forge/templates/starter/libs/core/server/src/prisma/prisma.service.ts +19 -0
- forge/templates/starter/libs/core/server/tsconfig.json +23 -0
- forge/templates/starter/libs/core/web/package.json +16 -0
- forge/templates/starter/libs/core/web/project.json +15 -0
- forge/templates/starter/libs/core/web/src/api-client.ts +42 -0
- forge/templates/starter/libs/core/web/src/error-report.ts +12 -0
- forge/templates/starter/libs/core/web/src/form-errors.ts +18 -0
- forge/templates/starter/libs/core/web/src/index.ts +4 -0
- forge/templates/starter/libs/core/web/src/permissions.ts +9 -0
- forge/templates/starter/libs/core/web/src/query-client.ts +10 -0
- forge/templates/starter/libs/core/web/tsconfig.json +18 -0
- forge/templates/starter/libs/history/contracts/package.json +14 -0
- forge/templates/starter/libs/history/contracts/project.json +15 -0
- forge/templates/starter/libs/history/contracts/src/index.ts +2 -0
- forge/templates/starter/libs/history/contracts/src/service.ts +21 -0
- forge/templates/starter/libs/history/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/history/server/package.json +19 -0
- forge/templates/starter/libs/history/server/project.json +19 -0
- forge/templates/starter/libs/history/server/src/history.controller.ts +45 -0
- forge/templates/starter/libs/history/server/src/history.dto.ts +22 -0
- forge/templates/starter/libs/history/server/src/history.module.ts +12 -0
- forge/templates/starter/libs/history/server/src/history.service.test.ts +18 -0
- forge/templates/starter/libs/history/server/src/history.service.ts +42 -0
- forge/templates/starter/libs/history/server/src/index.ts +2 -0
- forge/templates/starter/libs/history/server/tsconfig.json +29 -0
- forge/templates/starter/libs/mcp/server/package.json +18 -0
- forge/templates/starter/libs/mcp/server/project.json +15 -0
- forge/templates/starter/libs/mcp/server/src/index.ts +1 -0
- forge/templates/starter/libs/mcp/server/src/mcp.controller.ts +102 -0
- forge/templates/starter/libs/mcp/server/src/mcp.module.ts +5 -0
- forge/templates/starter/libs/mcp/server/tsconfig.json +26 -0
- forge/templates/starter/libs/notifications/contracts/package.json +14 -0
- forge/templates/starter/libs/notifications/contracts/project.json +12 -0
- forge/templates/starter/libs/notifications/contracts/src/index.ts +1 -0
- forge/templates/starter/libs/notifications/contracts/src/service.ts +19 -0
- forge/templates/starter/libs/notifications/contracts/tsconfig.json +12 -0
- forge/templates/starter/libs/notifications/server/package.json +18 -0
- forge/templates/starter/libs/notifications/server/project.json +12 -0
- forge/templates/starter/libs/notifications/server/src/index.ts +1 -0
- forge/templates/starter/libs/notifications/server/src/notifications.controller.ts +21 -0
- forge/templates/starter/libs/notifications/server/src/notifications.dto.ts +28 -0
- forge/templates/starter/libs/notifications/server/src/notifications.module.ts +12 -0
- forge/templates/starter/libs/notifications/server/src/notifications.service.ts +36 -0
- forge/templates/starter/libs/notifications/server/tsconfig.json +18 -0
- forge/templates/starter/libs/organisations/contracts/package.json +14 -0
- forge/templates/starter/libs/organisations/contracts/project.json +15 -0
- forge/templates/starter/libs/organisations/contracts/src/index.ts +54 -0
- forge/templates/starter/libs/organisations/contracts/src/service.ts +29 -0
- forge/templates/starter/libs/organisations/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/organisations/server/package.json +20 -0
- forge/templates/starter/libs/organisations/server/project.json +15 -0
- forge/templates/starter/libs/organisations/server/src/index.ts +2 -0
- forge/templates/starter/libs/organisations/server/src/organisations.controller.ts +101 -0
- forge/templates/starter/libs/organisations/server/src/organisations.dto.ts +46 -0
- forge/templates/starter/libs/organisations/server/src/organisations.module.ts +14 -0
- forge/templates/starter/libs/organisations/server/src/organisations.service.ts +221 -0
- forge/templates/starter/libs/organisations/server/tsconfig.json +32 -0
- forge/templates/starter/libs/projects/contracts/package.json +14 -0
- forge/templates/starter/libs/projects/contracts/project.json +15 -0
- forge/templates/starter/libs/projects/contracts/src/index.ts +87 -0
- forge/templates/starter/libs/projects/contracts/tsconfig.json +14 -0
- forge/templates/starter/libs/projects/server/package.json +21 -0
- forge/templates/starter/libs/projects/server/project.json +15 -0
- forge/templates/starter/libs/projects/server/src/index.ts +2 -0
- forge/templates/starter/libs/projects/server/src/projects.controller.ts +165 -0
- forge/templates/starter/libs/projects/server/src/projects.dto.ts +77 -0
- forge/templates/starter/libs/projects/server/src/projects.module.ts +19 -0
- forge/templates/starter/libs/projects/server/src/projects.permissions.ts +7 -0
- forge/templates/starter/libs/projects/server/src/projects.service.ts +314 -0
- forge/templates/starter/libs/projects/server/src/projects.tools.ts +28 -0
- forge/templates/starter/libs/projects/server/tsconfig.json +29 -0
- forge/templates/starter/libs/shared/ui/components.json +21 -0
- forge/templates/starter/libs/shared/ui/package.json +27 -0
- forge/templates/starter/libs/shared/ui/project.json +15 -0
- forge/templates/starter/libs/shared/ui/src/components/states.tsx +73 -0
- forge/templates/starter/libs/shared/ui/src/components/theme-provider.tsx +39 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/LICENSE +21 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/alert-dialog.tsx +196 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/alert.tsx +65 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/avatar.tsx +108 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/badge.tsx +47 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/breadcrumb.tsx +108 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/button.tsx +63 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/card.tsx +91 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/checkbox.tsx +29 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/collapsible.tsx +33 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/command.tsx +184 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/dialog.tsx +158 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/dropdown-menu.tsx +256 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/empty.tsx +103 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/form.tsx +167 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/input.tsx +20 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/label.tsx +23 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/popover.tsx +88 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/select.tsx +189 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/separator.tsx +27 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sheet.tsx +142 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sidebar.tsx +726 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/skeleton.tsx +13 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/sonner.tsx +40 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/switch.tsx +32 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/table.tsx +115 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/textarea.tsx +17 -0
- forge/templates/starter/libs/shared/ui/src/components/ui/tooltip.tsx +56 -0
- forge/templates/starter/libs/shared/ui/src/hooks/use-mobile.ts +19 -0
- forge/templates/starter/libs/shared/ui/src/lib/utils.ts +6 -0
- forge/templates/starter/libs/shared/ui/tsconfig.json +23 -0
- forge/templates/starter/libs/shared/util/package.json +14 -0
- forge/templates/starter/libs/shared/util/project.json +19 -0
- forge/templates/starter/libs/shared/util/src/csv-field.ts +6 -0
- forge/templates/starter/libs/shared/util/src/envelope.ts +9 -0
- forge/templates/starter/libs/shared/util/src/format.test.ts +33 -0
- forge/templates/starter/libs/shared/util/src/format.ts +43 -0
- forge/templates/starter/libs/shared/util/src/index.ts +12 -0
- forge/templates/starter/libs/shared/util/tsconfig.json +14 -0
- forge/templates/starter/nx.json +7 -0
- forge/templates/starter/package.json +97 -0
- forge/templates/starter/pnpm-lock.yaml +11587 -0
- forge/templates/starter/pnpm-workspace.yaml +4 -0
- forge/templates/starter/prisma.config.ts +13 -0
- forge/templates/starter/scripts/affected.mjs +27 -0
- forge/templates/starter/scripts/test-build.mjs +29 -0
- forge/templates/starter/scripts/test.mjs +107 -0
- forge/templates/starter/services.toml +7 -0
- forge/templates/starter/tsconfig.base.json +15 -0
- forge/templates/starter-python/.env.example +8 -0
- forge/templates/starter-python/.gitignore +13 -0
- forge/templates/starter-python/Dockerfile +30 -0
- forge/templates/starter-python/README.md +101 -0
- forge/templates/starter-python/apps/api/.python-version +1 -0
- forge/templates/starter-python/apps/api/alembic.ini +38 -0
- forge/templates/starter-python/apps/api/app/__init__.py +1 -0
- forge/templates/starter-python/apps/api/app/auth/__init__.py +27 -0
- forge/templates/starter-python/apps/api/app/auth/models.py +111 -0
- forge/templates/starter-python/apps/api/app/auth/routes.py +398 -0
- forge/templates/starter-python/apps/api/app/auth/schema.py +117 -0
- forge/templates/starter-python/apps/api/app/auth/service.py +453 -0
- forge/templates/starter-python/apps/api/app/core/__init__.py +89 -0
- forge/templates/starter-python/apps/api/app/core/admin.py +23 -0
- forge/templates/starter-python/apps/api/app/core/config.py +83 -0
- forge/templates/starter-python/apps/api/app/core/csv.py +40 -0
- forge/templates/starter-python/apps/api/app/core/database.py +21 -0
- forge/templates/starter-python/apps/api/app/core/envelope.py +40 -0
- forge/templates/starter-python/apps/api/app/core/error_report.py +85 -0
- forge/templates/starter-python/apps/api/app/core/errors.py +153 -0
- forge/templates/starter-python/apps/api/app/core/logging.py +66 -0
- forge/templates/starter-python/apps/api/app/core/mail.py +34 -0
- forge/templates/starter-python/apps/api/app/core/permissions.py +59 -0
- forge/templates/starter-python/apps/api/app/core/principal.py +12 -0
- forge/templates/starter-python/apps/api/app/core/prompts.py +96 -0
- forge/templates/starter-python/apps/api/app/core/resources.py +230 -0
- forge/templates/starter-python/apps/api/app/core/retry_keys.py +101 -0
- forge/templates/starter-python/apps/api/app/core/schema.py +13 -0
- forge/templates/starter-python/apps/api/app/core/security.py +197 -0
- forge/templates/starter-python/apps/api/app/core/tools.py +1117 -0
- forge/templates/starter-python/apps/api/app/history/__init__.py +5 -0
- forge/templates/starter-python/apps/api/app/history/models.py +48 -0
- forge/templates/starter-python/apps/api/app/history/routes.py +65 -0
- forge/templates/starter-python/apps/api/app/history/schema.py +29 -0
- forge/templates/starter-python/apps/api/app/history/service.py +77 -0
- forge/templates/starter-python/apps/api/app/main.py +115 -0
- forge/templates/starter-python/apps/api/app/mcp/__init__.py +3 -0
- forge/templates/starter-python/apps/api/app/mcp/server.py +192 -0
- forge/templates/starter-python/apps/api/app/notifications/__init__.py +5 -0
- forge/templates/starter-python/apps/api/app/notifications/models.py +62 -0
- forge/templates/starter-python/apps/api/app/notifications/routes.py +25 -0
- forge/templates/starter-python/apps/api/app/notifications/schema.py +39 -0
- forge/templates/starter-python/apps/api/app/notifications/service.py +70 -0
- forge/templates/starter-python/apps/api/app/openapi.py +17 -0
- forge/templates/starter-python/apps/api/app/organisations/__init__.py +10 -0
- forge/templates/starter-python/apps/api/app/organisations/models.py +128 -0
- forge/templates/starter-python/apps/api/app/organisations/routes.py +176 -0
- forge/templates/starter-python/apps/api/app/organisations/schema.py +76 -0
- forge/templates/starter-python/apps/api/app/organisations/service.py +403 -0
- forge/templates/starter-python/apps/api/app/projects/__init__.py +14 -0
- forge/templates/starter-python/apps/api/app/projects/models.py +67 -0
- forge/templates/starter-python/apps/api/app/projects/permissions.py +13 -0
- forge/templates/starter-python/apps/api/app/projects/routes.py +246 -0
- forge/templates/starter-python/apps/api/app/projects/schema.py +118 -0
- forge/templates/starter-python/apps/api/app/projects/service.py +359 -0
- forge/templates/starter-python/apps/api/app/projects/tools.py +28 -0
- forge/templates/starter-python/apps/api/app/setup_company.py +56 -0
- forge/templates/starter-python/apps/api/migrations/env.py +51 -0
- forge/templates/starter-python/apps/api/migrations/script.py.mako +25 -0
- forge/templates/starter-python/apps/api/migrations/versions/0001_initial.py +167 -0
- forge/templates/starter-python/apps/api/migrations/versions/0002_soft_delete_only.py +31 -0
- forge/templates/starter-python/apps/api/migrations/versions/0003_organisations.py +115 -0
- forge/templates/starter-python/apps/api/migrations/versions/0004_invites.py +58 -0
- forge/templates/starter-python/apps/api/migrations/versions/0005_history.py +51 -0
- forge/templates/starter-python/apps/api/migrations/versions/0006_extensions.py +22 -0
- forge/templates/starter-python/apps/api/migrations/versions/0007_ids_and_updated_at.py +52 -0
- forge/templates/starter-python/apps/api/migrations/versions/0008_module_schemas.py +42 -0
- forge/templates/starter-python/apps/api/migrations/versions/0009_columns.py +97 -0
- forge/templates/starter-python/apps/api/migrations/versions/0010_history_subjects.py +46 -0
- forge/templates/starter-python/apps/api/migrations/versions/0011_agents.py +44 -0
- forge/templates/starter-python/apps/api/migrations/versions/0012_mcp.py +71 -0
- forge/templates/starter-python/apps/api/migrations/versions/0013_via_agent.py +23 -0
- forge/templates/starter-python/apps/api/migrations/versions/20261103_sign_in_attempts.py +48 -0
- forge/templates/starter-python/apps/api/migrations/versions/20261105_notifications.py +84 -0
- forge/templates/starter-python/apps/api/pyproject.toml +86 -0
- forge/templates/starter-python/apps/api/tests/conftest.py +146 -0
- forge/templates/starter-python/apps/api/tests/test_agents.py +169 -0
- forge/templates/starter-python/apps/api/tests/test_api.py +319 -0
- forge/templates/starter-python/apps/api/tests/test_auth.py +428 -0
- forge/templates/starter-python/apps/api/tests/test_config.py +58 -0
- forge/templates/starter-python/apps/api/tests/test_database.py +204 -0
- forge/templates/starter-python/apps/api/tests/test_error_reports.py +119 -0
- forge/templates/starter-python/apps/api/tests/test_history.py +206 -0
- forge/templates/starter-python/apps/api/tests/test_invites.py +427 -0
- forge/templates/starter-python/apps/api/tests/test_logging.py +56 -0
- forge/templates/starter-python/apps/api/tests/test_mcp.py +556 -0
- forge/templates/starter-python/apps/api/tests/test_module_schemas.py +100 -0
- forge/templates/starter-python/apps/api/tests/test_notifications.py +182 -0
- forge/templates/starter-python/apps/api/tests/test_one_company.py +188 -0
- forge/templates/starter-python/apps/api/tests/test_organisations.py +231 -0
- forge/templates/starter-python/apps/api/tests/test_projects.py +874 -0
- forge/templates/starter-python/apps/api/tests/test_soft_delete.py +80 -0
- forge/templates/starter-python/apps/api/tests/test_tools.py +395 -0
- forge/templates/starter-python/apps/api/uv.lock +1277 -0
- forge/templates/starter-python/compose.test.yml +63 -0
- forge/templates/starter-python/eslint.config.mjs +49 -0
- forge/templates/starter-python/libs/auth/contracts/package.json +17 -0
- forge/templates/starter-python/libs/auth/contracts/src/index.ts +51 -0
- forge/templates/starter-python/libs/auth/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/history/contracts/package.json +17 -0
- forge/templates/starter-python/libs/history/contracts/src/index.ts +3 -0
- forge/templates/starter-python/libs/history/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/organisations/contracts/package.json +17 -0
- forge/templates/starter-python/libs/organisations/contracts/src/index.ts +30 -0
- forge/templates/starter-python/libs/organisations/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/projects/contracts/package.json +17 -0
- forge/templates/starter-python/libs/projects/contracts/src/index.ts +65 -0
- forge/templates/starter-python/libs/projects/contracts/tsconfig.json +16 -0
- forge/templates/starter-python/libs/shared/api-types/package.json +14 -0
- forge/templates/starter-python/libs/shared/api-types/tsconfig.json +14 -0
- forge/templates/starter-python/package.json +71 -0
- forge/templates/starter-python/pnpm-lock.yaml +7574 -0
- forge/templates/starter-python/pnpm-workspace.yaml +4 -0
- forge/templates/starter-python/scripts/affected.mjs +20 -0
- forge/templates/starter-python/scripts/test-browser.mjs +39 -0
- forge/templates/starter-python/scripts/test.mjs +86 -0
- forge/templates/starter-python/services.toml +7 -0
- forge/templates/story.md +89 -0
- forge/time_records.py +1022 -0
- forge/ui_checks.py +97 -0
- forge/upgrade.py +368 -0
- forge/worker.py +876 -0
- symphony_forge-1.2.44.dist-info/METADATA +7 -0
- symphony_forge-1.2.44.dist-info/RECORD +623 -0
- symphony_forge-1.2.44.dist-info/WHEEL +4 -0
- symphony_forge-1.2.44.dist-info/entry_points.txt +2 -0
- symphony_forge-1.2.44.dist-info/licenses/LICENSE +21 -0
forge/board_app/app.js
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
// The board's page shell: it reads the server's snapshot, keeps it fresh, runs the header, and holds
|
|
2
|
+
// the pinned Board interfaces that the screen modules fill in.
|
|
3
|
+
|
|
4
|
+
const TOKEN = location.search; // every request carries this run's token
|
|
5
|
+
const PAGES = ['now', 'releases', 'insights'];
|
|
6
|
+
// Each screen part adds its module here; a module exports install(Board). The import carries the
|
|
7
|
+
// token, because the server checks it on every file.
|
|
8
|
+
const SCREENS = [
|
|
9
|
+
'now',
|
|
10
|
+
'item',
|
|
11
|
+
'releases', 'insights',
|
|
12
|
+
'assign',
|
|
13
|
+
];
|
|
14
|
+
const POLL = 10000; // ms before a page read that failed is asked again
|
|
15
|
+
const listeners = [];
|
|
16
|
+
const main = document.querySelector('main');
|
|
17
|
+
const status = document.querySelector('[role=status]');
|
|
18
|
+
// One quiet line under the header says why the page may be old; it is empty, and so hidden, when data is fresh.
|
|
19
|
+
const stale = document.createElement('p');
|
|
20
|
+
stale.className = 'stale';
|
|
21
|
+
stale.setAttribute('aria-live', 'polite');
|
|
22
|
+
const header = document.querySelector('header');
|
|
23
|
+
header.after(stale);
|
|
24
|
+
// The header is 48 pixels tall until it wraps on a narrow window, and the line adds its own height. The item drawer
|
|
25
|
+
// (fixed at 48px in item.css) and the Releases and Insights pages (the window less 96px) read the excess here.
|
|
26
|
+
const sizes = new ResizeObserver(() => document.documentElement.style.setProperty(
|
|
27
|
+
'--below-bar', `${Math.max(0, header.offsetHeight + stale.offsetHeight - 48)}px`));
|
|
28
|
+
sizes.observe(header);
|
|
29
|
+
sizes.observe(stale);
|
|
30
|
+
const OFFLINE = {
|
|
31
|
+
state: 'offline',
|
|
32
|
+
word: 'Offline',
|
|
33
|
+
line: 'The board has stopped, so this page may be old. Start the board again from the terminal, then open its new link.',
|
|
34
|
+
};
|
|
35
|
+
const failed = new Map(); // read name -> its mark, line and number; the newest failed read is the one shown
|
|
36
|
+
let count = 0; // failures so far: a read that began before a failure cannot clear it
|
|
37
|
+
let retry = null;
|
|
38
|
+
|
|
39
|
+
// A refresh draws a screen again and changes the page only where the drawing differs, so the reader keeps
|
|
40
|
+
// scroll, selection, focus and open sections everywhere else. Each drawn node has a copy of itself as built,
|
|
41
|
+
// because the live node also holds what the reader and other scripts did to it: an open section, a control
|
|
42
|
+
// another script added, and the focus. Only what was built is compared.
|
|
43
|
+
// A click handler is not compared: whatever one uses must show in the drawing, such as a link's address.
|
|
44
|
+
// ponytail: children are matched by position, so a block put in the middle replaces the blocks after it.
|
|
45
|
+
const built = new WeakMap(); // node -> a copy of it without its children, as built, and without `open`
|
|
46
|
+
|
|
47
|
+
function copyOf(node) {
|
|
48
|
+
const copy = node.cloneNode(false);
|
|
49
|
+
copy.removeAttribute?.('open'); // the reader opens and closes sections; a drawing does not decide it
|
|
50
|
+
return copy;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Records a drawing so a later one can be compared with it.
|
|
54
|
+
function keep(node) {
|
|
55
|
+
built.set(node, copyOf(node));
|
|
56
|
+
node.childNodes.forEach(keep);
|
|
57
|
+
return node;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function patch(live, fresh) {
|
|
61
|
+
if (!built.get(live)?.isEqualNode(copyOf(fresh))) {
|
|
62
|
+
live.replaceWith(keep(fresh));
|
|
63
|
+
return fresh;
|
|
64
|
+
}
|
|
65
|
+
const kids = [...live.childNodes].filter((node) => built.has(node)); // not the nodes other scripts added
|
|
66
|
+
const next = [...fresh.childNodes];
|
|
67
|
+
next.forEach((child, at) => (kids[at] ? patch(kids[at], child) : live.append(keep(child))));
|
|
68
|
+
kids.slice(next.length).forEach((node) => node.remove());
|
|
69
|
+
return live;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const Board = {
|
|
73
|
+
page: 'now',
|
|
74
|
+
view: 'team', // 'team' or 'me'
|
|
75
|
+
snapshot: null,
|
|
76
|
+
screens: {}, // page -> render(main, snapshot), set by the screen modules
|
|
77
|
+
onSnapshot(fn) {
|
|
78
|
+
listeners.push(fn);
|
|
79
|
+
if (Board.snapshot) fn(Board.snapshot);
|
|
80
|
+
},
|
|
81
|
+
// Puts a screen on the page. The screen already on it changes only where the new one differs.
|
|
82
|
+
show(screen) {
|
|
83
|
+
const live = main.firstChild;
|
|
84
|
+
if (built.has(live)) patch(live, screen);
|
|
85
|
+
else main.replaceChildren(keep(screen));
|
|
86
|
+
},
|
|
87
|
+
patch,
|
|
88
|
+
keep,
|
|
89
|
+
// ponytail: stubs until the drawer and item page part replaces them
|
|
90
|
+
select(itemId) {},
|
|
91
|
+
openDrawer(itemId) {},
|
|
92
|
+
openItem(itemId) {},
|
|
93
|
+
navigate(page) {
|
|
94
|
+
location.hash = page;
|
|
95
|
+
},
|
|
96
|
+
// Every page's read of the server goes through here, so a failed one shows the line under the header.
|
|
97
|
+
async read(name, url) {
|
|
98
|
+
const began = count;
|
|
99
|
+
const answer = await read(name, url);
|
|
100
|
+
if (answer.status < 500) fresh(name, began);
|
|
101
|
+
return answer;
|
|
102
|
+
},
|
|
103
|
+
api: {
|
|
104
|
+
// ponytail: a stub until the assign part posts to the server
|
|
105
|
+
async assign(key, login) {
|
|
106
|
+
return { ok: false, message: 'Giving a story to a person from the board is not ready yet.' };
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// The same words are not written again: a screen reader says a live region's words each time they are written.
|
|
112
|
+
function mark(state, words) {
|
|
113
|
+
status.dataset.state = state;
|
|
114
|
+
if (status.textContent !== words) status.textContent = words;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function show() {
|
|
118
|
+
const [newest] = [...failed.values()].reverse();
|
|
119
|
+
if (newest) {
|
|
120
|
+
mark(newest.state, newest.word);
|
|
121
|
+
if (stale.textContent !== newest.line) stale.textContent = newest.line;
|
|
122
|
+
} else if (Board.snapshot) {
|
|
123
|
+
const updating = Boolean(Board.snapshot.snapshot.updating);
|
|
124
|
+
mark(updating ? 'updating' : 'live', updating ? 'Updating' : 'Live');
|
|
125
|
+
stale.textContent = '';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function lose(name, why) {
|
|
130
|
+
failed.delete(name); // set again, so the newest failure is last
|
|
131
|
+
failed.set(name, { ...why, number: ++count });
|
|
132
|
+
show();
|
|
133
|
+
// A failed rebuild is told by the events stream. A page read has no such signal, so it is asked again here.
|
|
134
|
+
if (name !== 'now') {
|
|
135
|
+
clearTimeout(retry);
|
|
136
|
+
retry = setTimeout(askAgain, POLL);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function askAgain() {
|
|
141
|
+
if (![...failed.keys()].some((name) => name !== 'now')) return; // it worked, or the person left that page
|
|
142
|
+
if (Board.page === 'now') for (const fn of listeners) fn(Board.snapshot); // the item page and drawer read again
|
|
143
|
+
else render(); // the Releases or Insights page reads again, and changes only when the read works
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function unread(reason) {
|
|
147
|
+
return {
|
|
148
|
+
state: 'stale',
|
|
149
|
+
word: 'Not updating',
|
|
150
|
+
line: `The server could not read the work, so this page may be old. It said: \u201c${reason}\u201d The page tries again.`,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Clears a failure. `began` is the failure count when the read began: a read that began before the failure
|
|
155
|
+
// says nothing about it. With no `began`, the server itself said the failure is over.
|
|
156
|
+
function fresh(name, began = Infinity) {
|
|
157
|
+
if ((failed.get(name)?.number ?? 0) <= began) failed.delete(name);
|
|
158
|
+
show();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Asks the server; a read it could not do or could not answer is remembered under `name` until that read works.
|
|
162
|
+
async function read(name, url) {
|
|
163
|
+
let answer;
|
|
164
|
+
try {
|
|
165
|
+
answer = await fetch(url, { cache: 'no-store' });
|
|
166
|
+
} catch (error) {
|
|
167
|
+
lose(name, OFFLINE);
|
|
168
|
+
throw error;
|
|
169
|
+
}
|
|
170
|
+
if (answer.status >= 500) {
|
|
171
|
+
let reason = await answer.clone().text();
|
|
172
|
+
try {
|
|
173
|
+
reason = JSON.parse(reason).error;
|
|
174
|
+
} catch {}
|
|
175
|
+
lose(name, unread(reason));
|
|
176
|
+
}
|
|
177
|
+
return answer;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function say(className, words) {
|
|
181
|
+
const line = document.createElement('p');
|
|
182
|
+
line.className = className;
|
|
183
|
+
line.textContent = words;
|
|
184
|
+
main.replaceChildren(line);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function render() {
|
|
188
|
+
const asked = location.hash.slice(1);
|
|
189
|
+
Board.page = PAGES.includes(asked) ? asked : 'now';
|
|
190
|
+
for (const link of document.querySelectorAll('.pages a')) {
|
|
191
|
+
if (link.hash === `#${Board.page}`) link.setAttribute('aria-current', 'page');
|
|
192
|
+
else link.removeAttribute('aria-current');
|
|
193
|
+
}
|
|
194
|
+
for (const button of document.querySelectorAll('[data-view]')) {
|
|
195
|
+
button.setAttribute('aria-pressed', String(button.dataset.view === Board.view));
|
|
196
|
+
}
|
|
197
|
+
const snapshot = Board.snapshot;
|
|
198
|
+
if (!snapshot) return;
|
|
199
|
+
const screen = Board.screens[Board.page];
|
|
200
|
+
if (screen) screen(main, snapshot);
|
|
201
|
+
else if (Board.page !== 'now') say('note', 'This page is not on the board yet.');
|
|
202
|
+
else if (!snapshot.items.length) say('note', 'Nothing is in flight. A story or a fix shows here once it starts.');
|
|
203
|
+
else say('note', `${snapshot.items.length} stories and fixes are on the board.`);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async function refresh() {
|
|
207
|
+
const began = count;
|
|
208
|
+
let answer;
|
|
209
|
+
try {
|
|
210
|
+
answer = await read('now', `board.json${TOKEN}`);
|
|
211
|
+
} catch {
|
|
212
|
+
return fail();
|
|
213
|
+
}
|
|
214
|
+
if (!answer.ok) return fail();
|
|
215
|
+
const snapshot = JSON.parse(await answer.text());
|
|
216
|
+
if (Board.snapshot && snapshot.snapshot.version < Board.snapshot.snapshot.version) return; // a slower, older read
|
|
217
|
+
Board.snapshot = snapshot;
|
|
218
|
+
// An answer marked updating is old data while a rebuild runs, so it never clears a failure. A final answer
|
|
219
|
+
// clears one only if its read began after the failure; the stream's "recovered" clears it too.
|
|
220
|
+
if (snapshot.snapshot.updating) show();
|
|
221
|
+
else fresh('now', began);
|
|
222
|
+
document.querySelector('[data-repo]').textContent = snapshot.repo_root.split(/[\\/]/).pop();
|
|
223
|
+
main.setAttribute('aria-busy', 'false');
|
|
224
|
+
render();
|
|
225
|
+
for (const fn of listeners) fn(snapshot);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// The events stream is down or has just opened: ask the small status answer, and read the whole board
|
|
229
|
+
// only when it says there is a new snapshot.
|
|
230
|
+
async function probe() {
|
|
231
|
+
const began = count;
|
|
232
|
+
let answer;
|
|
233
|
+
try {
|
|
234
|
+
answer = await read('now', `board.json${TOKEN}&page=status`);
|
|
235
|
+
} catch {
|
|
236
|
+
return fail();
|
|
237
|
+
}
|
|
238
|
+
if (!answer.ok) return fail();
|
|
239
|
+
const { version, reason } = await answer.json();
|
|
240
|
+
if (reason) lose('now', unread(reason));
|
|
241
|
+
else if (!Board.snapshot || version !== Board.snapshot.snapshot.version) await refresh();
|
|
242
|
+
else fresh('now', began);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function fail() {
|
|
246
|
+
main.setAttribute('aria-busy', 'false');
|
|
247
|
+
if (!Board.snapshot) say('note', 'There is no board to show yet.'); // a board already on screen stays
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function listen() {
|
|
251
|
+
const events = new EventSource(`events${TOKEN}`);
|
|
252
|
+
events.addEventListener('changed', refresh);
|
|
253
|
+
// A rebuild that fails makes no new snapshot, so the stream says it failed, and says when the next one works.
|
|
254
|
+
events.addEventListener('failed', (event) => lose('now', unread(event.data)));
|
|
255
|
+
events.addEventListener('recovered', () => fresh('now'));
|
|
256
|
+
// The stream counts from the snapshot it sees when it connects, so a rebuild that finished before it
|
|
257
|
+
// connected sends no "changed". The browser reconnects a broken stream every few seconds, and each try asks.
|
|
258
|
+
events.addEventListener('open', probe);
|
|
259
|
+
events.addEventListener('error', probe);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
addEventListener('hashchange', () => {
|
|
263
|
+
for (const name of failed.keys()) if (name !== 'now') failed.delete(name); // the page it came from is gone
|
|
264
|
+
show();
|
|
265
|
+
render();
|
|
266
|
+
});
|
|
267
|
+
for (const button of document.querySelectorAll('[data-view]')) {
|
|
268
|
+
button.addEventListener('click', () => {
|
|
269
|
+
Board.view = button.dataset.view;
|
|
270
|
+
render();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
for (const name of SCREENS) (await import(`./${name}.js${TOKEN}`)).install(Board);
|
|
274
|
+
render();
|
|
275
|
+
await refresh(); // the snapshot first, so the page shows the board before anything else asks
|
|
276
|
+
listen();
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* The Assign control, from the approved Drawer and Item artboards (docs/board-design). */
|
|
2
|
+
|
|
3
|
+
/* Scoped so these names never restyle the other screens. */
|
|
4
|
+
@scope (.assign) {
|
|
5
|
+
|
|
6
|
+
:scope {
|
|
7
|
+
position: relative;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
font-size: var(--size-label);
|
|
10
|
+
color: var(--ink);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
button, input {
|
|
14
|
+
font: inherit;
|
|
15
|
+
color: inherit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.assign-open, .assign-give {
|
|
19
|
+
border-radius: var(--radius-card);
|
|
20
|
+
padding: 2px var(--space-2);
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
transition: transform 160ms var(--ease-out);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.assign-open {
|
|
26
|
+
border: 1px solid color-mix(in srgb, var(--ink) 22%, var(--surface));
|
|
27
|
+
background: var(--surface);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.assign-open:active, .assign-give:active { transform: scale(0.97); }
|
|
31
|
+
|
|
32
|
+
@media (hover: hover) and (pointer: fine) {
|
|
33
|
+
.assign-open:hover { background: var(--ground); }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* The form and the result open under their button, over the drawer's content. */
|
|
37
|
+
.assign-layer {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: calc(100% + var(--space-1));
|
|
40
|
+
left: 0;
|
|
41
|
+
z-index: 1;
|
|
42
|
+
width: 280px;
|
|
43
|
+
margin: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: var(--space-2);
|
|
47
|
+
border: 1px solid var(--line);
|
|
48
|
+
border-radius: var(--radius-card);
|
|
49
|
+
padding: var(--space-3);
|
|
50
|
+
background: var(--surface);
|
|
51
|
+
box-shadow: 0 8px 24px rgb(21 23 26 / 0.12);
|
|
52
|
+
color: var(--ink);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
label { color: var(--ink-2); }
|
|
56
|
+
|
|
57
|
+
.assign-row {
|
|
58
|
+
display: flex;
|
|
59
|
+
gap: var(--space-2);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
input {
|
|
63
|
+
flex: 1;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
border: 1px solid color-mix(in srgb, var(--ink) 30%, var(--surface));
|
|
66
|
+
border-radius: var(--radius-card);
|
|
67
|
+
padding: var(--space-1) var(--space-2);
|
|
68
|
+
background: var(--surface);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.assign-give {
|
|
72
|
+
border: 0;
|
|
73
|
+
padding: var(--space-1) var(--space-3);
|
|
74
|
+
background: var(--moving);
|
|
75
|
+
color: var(--surface);
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.assign-give[aria-disabled="true"] { cursor: progress; }
|
|
80
|
+
|
|
81
|
+
.assign-note { margin: 0; }
|
|
82
|
+
|
|
83
|
+
.assign-note.refused {
|
|
84
|
+
border-left: 3px solid var(--stuck);
|
|
85
|
+
padding-left: var(--space-2);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* The full page's owner line is plain text, not a row with gaps like the drawer's. */
|
|
91
|
+
.person > .assign { margin-left: var(--space-2); }
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// The Assign control beside an owner in a story's or part's drawer and full page. It posts to the
|
|
2
|
+
// server's /assign, which runs Forge's assign command, and shows the reason Forge gives beside it.
|
|
3
|
+
|
|
4
|
+
const TOKEN = location.search;
|
|
5
|
+
const ASSIGNABLE = /^[A-Z][A-Z0-9-]*(\/[A-Z0-9-]+)?$/; // story keys and their parts; fixes have no owner to give
|
|
6
|
+
const UNREACHABLE = 'The board cannot reach its server. Start the board again from the terminal.';
|
|
7
|
+
|
|
8
|
+
let Board;
|
|
9
|
+
// Each item's control state survives the redraws a live refresh makes: { open, login, note, ok, busy }.
|
|
10
|
+
const states = new Map();
|
|
11
|
+
let last = null; // { id, part, node }: the control part that had focus last, to keep it across a redraw
|
|
12
|
+
|
|
13
|
+
function el(tag, attrs = {}, ...children) {
|
|
14
|
+
const node = document.createElement(tag);
|
|
15
|
+
for (const [name, value] of Object.entries(attrs)) {
|
|
16
|
+
if (name === 'class') node.className = value;
|
|
17
|
+
else if (name.startsWith('on')) node.addEventListener(name.slice(2), value);
|
|
18
|
+
else if (value !== false) node.setAttribute(name, value === true ? '' : value);
|
|
19
|
+
}
|
|
20
|
+
node.append(...children.filter((child) => child !== null && child !== undefined));
|
|
21
|
+
return node;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function assign(key, login) {
|
|
25
|
+
let answer;
|
|
26
|
+
try {
|
|
27
|
+
answer = await fetch(`assign${TOKEN}`, {
|
|
28
|
+
method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
body: JSON.stringify({ key, login }),
|
|
30
|
+
});
|
|
31
|
+
} catch {
|
|
32
|
+
return { ok: false, message: UNREACHABLE };
|
|
33
|
+
}
|
|
34
|
+
let body = {};
|
|
35
|
+
try {
|
|
36
|
+
body = await answer.json();
|
|
37
|
+
} catch {}
|
|
38
|
+
if (!answer.ok) return { ok: false, message: body.error || 'The board could not give this item. Try again in a moment.' };
|
|
39
|
+
return { ok: Boolean(body.ok), message: body.message || 'Forge gave no reason. The terminal that runs the board shows why.' };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// The people the board already knows, offered as suggestions; any GitHub username is accepted.
|
|
43
|
+
function logins() {
|
|
44
|
+
const found = new Set([Board.snapshot?.viewer]);
|
|
45
|
+
for (const parent of Board.snapshot?.items || []) {
|
|
46
|
+
for (const row of [parent, ...(parent.children || [])]) {
|
|
47
|
+
for (const who of [row.owner, row.developer_login, row.started_by_login]) found.add(who);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return [...found].filter((who) => typeof who === 'string' && who).map((who) => who.replace(/^@/, '')).sort();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function control(id) {
|
|
54
|
+
const state = states.get(id) || {};
|
|
55
|
+
const name = `assign-${id.replace(/\W/g, '-')}`;
|
|
56
|
+
const box = el('span', { class: 'assign', 'data-assign-for': id });
|
|
57
|
+
const remember = (event) => {
|
|
58
|
+
const part = event.target.dataset.part;
|
|
59
|
+
if (part) last = { id, part, node: event.target };
|
|
60
|
+
};
|
|
61
|
+
const shut = (part) => {
|
|
62
|
+
states.set(id, { ...states.get(id), open: false, note: null });
|
|
63
|
+
redraw(box, id, part);
|
|
64
|
+
};
|
|
65
|
+
box.addEventListener('focusin', remember);
|
|
66
|
+
// Leaving the control closes it; a redraw that removed it does not.
|
|
67
|
+
box.addEventListener('focusout', () => setTimeout(() => {
|
|
68
|
+
const now = states.get(id) || {};
|
|
69
|
+
if (box.isConnected && !box.contains(document.activeElement) && !now.busy && (now.open || now.note)) shut();
|
|
70
|
+
}));
|
|
71
|
+
box.addEventListener('keydown', (event) => {
|
|
72
|
+
const now = states.get(id) || {};
|
|
73
|
+
if (event.key !== 'Escape' || !(now.open || now.note)) return;
|
|
74
|
+
event.stopPropagation(); // the first Escape closes this control, not the drawer around it
|
|
75
|
+
shut('open');
|
|
76
|
+
});
|
|
77
|
+
const open = el('button', {
|
|
78
|
+
type: 'button', class: 'assign-open', 'data-part': 'open', 'aria-expanded': String(Boolean(state.open)),
|
|
79
|
+
'aria-controls': `${name}-form`,
|
|
80
|
+
onclick: () => {
|
|
81
|
+
const now = states.get(id) || {};
|
|
82
|
+
states.set(id, { ...now, open: !now.open, note: null });
|
|
83
|
+
redraw(box, id, now.open ? 'open' : 'login');
|
|
84
|
+
},
|
|
85
|
+
}, 'Assign', el('span', { 'aria-hidden': 'true' }, ' ▾'));
|
|
86
|
+
box.append(open);
|
|
87
|
+
if (state.open) {
|
|
88
|
+
const field = el('input', {
|
|
89
|
+
id: `${name}-login`, name: 'login', 'data-part': 'login', type: 'text', required: true, autocomplete: 'off',
|
|
90
|
+
spellcheck: 'false', autocapitalize: 'none', list: `${name}-people`, value: state.login || '',
|
|
91
|
+
'aria-describedby': state.note ? `${name}-note` : false,
|
|
92
|
+
oninput: (event) => states.set(id, { ...states.get(id), login: event.target.value }),
|
|
93
|
+
});
|
|
94
|
+
field.value = state.login || '';
|
|
95
|
+
const form = el('form', { id: `${name}-form`, class: 'assign-layer', 'aria-busy': String(Boolean(state.busy)),
|
|
96
|
+
onsubmit: (event) => give(event, box, id) },
|
|
97
|
+
el('label', { for: field.id }, 'GitHub username'),
|
|
98
|
+
el('span', { class: 'assign-row' }, field,
|
|
99
|
+
el('button', { type: 'submit', class: 'assign-give', 'data-part': 'give', 'aria-disabled': String(Boolean(state.busy)) },
|
|
100
|
+
state.busy ? 'Giving…' : 'Give')),
|
|
101
|
+
el('datalist', { id: `${name}-people` }, ...logins().map((who) => el('option', { value: who }))),
|
|
102
|
+
state.note && !state.ok ? el('p', { id: `${name}-note`, role: 'alert', class: 'assign-note refused' }, state.note) : null);
|
|
103
|
+
box.append(form);
|
|
104
|
+
} else if (state.note) {
|
|
105
|
+
box.append(el('p', { id: `${name}-note`, role: 'status', class: 'assign-layer assign-note' }, state.note));
|
|
106
|
+
}
|
|
107
|
+
return box;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function give(event, box, id) {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
const state = states.get(id) || {};
|
|
113
|
+
if (state.busy) return;
|
|
114
|
+
const login = (state.login || '').trim();
|
|
115
|
+
if (!login) {
|
|
116
|
+
states.set(id, { ...state, note: 'Type the GitHub username of the person who gets this work.', ok: false });
|
|
117
|
+
return redraw(box, id, 'login');
|
|
118
|
+
}
|
|
119
|
+
states.set(id, { ...state, busy: true, note: null });
|
|
120
|
+
redraw(box, id, 'login');
|
|
121
|
+
const result = await Board.api.assign(id, login);
|
|
122
|
+
states.set(id, result.ok ? { open: false, login: '', note: result.message, ok: true }
|
|
123
|
+
: { ...states.get(id), busy: false, note: result.message, ok: false });
|
|
124
|
+
redraw(document.querySelector(`.assign[data-assign-for="${CSS.escape(id)}"]`) || box, id, result.ok ? 'open' : 'login');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Draw the control again in place and put the keyboard on the named part.
|
|
128
|
+
function redraw(box, id, part) {
|
|
129
|
+
if (!box.isConnected) return;
|
|
130
|
+
const fresh = control(id);
|
|
131
|
+
box.replaceWith(fresh);
|
|
132
|
+
if (part) fresh.querySelector(`[data-part=${part}]`)?.focus();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Add the control beside every new slot. A live refresh redraws the drawer and the page, so this
|
|
136
|
+
// runs after each redraw and puts the keyboard back where it was.
|
|
137
|
+
function mount() {
|
|
138
|
+
for (const slot of document.querySelectorAll('[data-assign]:not([data-assign-ready])')) {
|
|
139
|
+
slot.dataset.assignReady = '';
|
|
140
|
+
const id = slot.dataset.assign;
|
|
141
|
+
if (!ASSIGNABLE.test(id)) continue;
|
|
142
|
+
const box = control(id);
|
|
143
|
+
slot.after(box);
|
|
144
|
+
const lost = last && last.id === id && !last.node.isConnected
|
|
145
|
+
&& (document.activeElement === document.body || document.activeElement === null);
|
|
146
|
+
// The focus moves the record to the new part, so the next redraw restores it again.
|
|
147
|
+
if (lost) box.querySelector(`[data-part=${last.part}]`)?.focus();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function install(board) {
|
|
152
|
+
Board = board;
|
|
153
|
+
document.head.append(el('link', { rel: 'stylesheet', href: `assign.css${TOKEN}` }));
|
|
154
|
+
Board.api.assign = assign;
|
|
155
|
+
new MutationObserver(mount).observe(document.body, { childList: true, subtree: true });
|
|
156
|
+
mount();
|
|
157
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// The Insights page: merged work per week, each person's merges through Forge stacked in alphabetical
|
|
2
|
+
// order with the team's merges around Forge on top, and a row per person with open items, stories
|
|
3
|
+
// owned and their share of the team's merged work. People are never ranked: rows stay alphabetical.
|
|
4
|
+
|
|
5
|
+
const { h, day, load, rows } = await import(`./releases.js${location.search}`);
|
|
6
|
+
const FINISHED = ['merged', 'done'];
|
|
7
|
+
const COLOURS = 6; // --person-1 to --person-6 in pages.css, reused in turn
|
|
8
|
+
|
|
9
|
+
const login = (value) => (value || '').replace(/^@/, '').toLowerCase();
|
|
10
|
+
const merged = (week) => (week ? week.through + week.around : 0);
|
|
11
|
+
|
|
12
|
+
function weekly(trends) {
|
|
13
|
+
const body = [];
|
|
14
|
+
if (!trends) {
|
|
15
|
+
body.push(h('p', {}, 'Merged work per week: unknown. The board could not read the merged pull requests.'));
|
|
16
|
+
} else if (trends.team.every((week) => week && !merged(week))) {
|
|
17
|
+
body.push(h('p', {}, 'Nothing merged in the last six weeks. Merged work shows here by week and by person.'));
|
|
18
|
+
} else {
|
|
19
|
+
const colour = (n) => `var(--person-${(n % COLOURS) + 1})`;
|
|
20
|
+
const most = Math.max(1, ...trends.team.map(merged));
|
|
21
|
+
body.push(h('ul', { class: 'legend', 'aria-label': 'People' },
|
|
22
|
+
trends.people.map((person, n) => h('li', { '--swatch': colour(n) }, person.name)),
|
|
23
|
+
h('li', { class: 'around' }, 'around Forge')));
|
|
24
|
+
body.push(h('div', { class: 'chart' },
|
|
25
|
+
h('div', { class: 'bars', '--count': trends.weeks.length }, trends.weeks.map((start, w) => {
|
|
26
|
+
const team = trends.team[w];
|
|
27
|
+
if (!team) {
|
|
28
|
+
return h('div', { role: 'img', 'aria-label': `Week of ${day(start)}: unknown` }, h('span', { class: 'total' }, 'unknown'));
|
|
29
|
+
}
|
|
30
|
+
const parts = trends.people.map((person) => `${person.name} ${person.weeks[w]?.through ?? 'unknown'}`);
|
|
31
|
+
return h('div', { role: 'img', 'aria-label': `Week of ${day(start)}: ${merged(team)} merged (${parts.join(', ')}, around Forge ${team.around})` },
|
|
32
|
+
h('span', { class: 'total', 'aria-hidden': 'true' }, merged(team)),
|
|
33
|
+
h('div', { class: 'stack', 'aria-hidden': 'true', '--h': `${(merged(team) / most) * 100}%` },
|
|
34
|
+
trends.people.map((person, n) => h('span', { '--n': person.weeks[w]?.through || 0, '--swatch': colour(n) })),
|
|
35
|
+
h('span', { class: 'around', '--n': team.around })));
|
|
36
|
+
})),
|
|
37
|
+
h('div', { class: 'weeks', 'aria-hidden': 'true', '--count': trends.weeks.length }, trends.weeks.map((start) => h('span', {}, day(start))))));
|
|
38
|
+
}
|
|
39
|
+
return h('section', { class: 'panel fill', 'aria-labelledby': 'merged-per-week' }, h('h2', { id: 'merged-per-week' }, 'Merged per week'), ...body);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function people(view) {
|
|
43
|
+
const all = rows(view);
|
|
44
|
+
const trends = view.team.trends;
|
|
45
|
+
const found = new Map((trends?.people || []).map((person) => [login(person.login || person.name), { ...person }]));
|
|
46
|
+
for (const row of all) {
|
|
47
|
+
const who = login(row.owner || row.developer_login);
|
|
48
|
+
if (who && !found.has(who)) found.set(who, { name: row.owner || row.developer_login, login: who });
|
|
49
|
+
}
|
|
50
|
+
// A week GitHub could not count in full is unknown, and so is every six-week sum that includes it.
|
|
51
|
+
const counted = (weeks) => (trends && weeks?.length === trends.weeks.length && weeks.every(Boolean)
|
|
52
|
+
? weeks.reduce((sum, week) => sum + merged(week), 0) : null);
|
|
53
|
+
const team = counted(trends?.team);
|
|
54
|
+
const listed = [...found].sort((a, b) => a[1].name.localeCompare(b[1].name, undefined, { sensitivity: 'base' }) || a[0].localeCompare(b[0]));
|
|
55
|
+
if (!listed.length) {
|
|
56
|
+
return h('section', { class: 'panel', 'aria-labelledby': 'people' }, h('h2', { id: 'people' }, 'People'),
|
|
57
|
+
h('p', {}, 'No one has merged or owns work yet. Each person who does shows here with their share of the team\'s work.'));
|
|
58
|
+
}
|
|
59
|
+
const mine = (who, row) => login(row.owner || row.developer_login) === who;
|
|
60
|
+
return h('section', { class: 'panel people', 'aria-labelledby': 'people' }, h('h2', { id: 'people' }, 'People'),
|
|
61
|
+
h('table', {},
|
|
62
|
+
h('thead', {}, h('tr', {}, h('th', { scope: 'col' }, 'Person · alphabetical'), h('th', { scope: 'col', class: 'num' }, 'Open now'),
|
|
63
|
+
h('th', { scope: 'col', class: 'num' }, 'Stories owned'), h('th', { scope: 'col' }, 'Share of the team\'s merged work, last six weeks'))),
|
|
64
|
+
h('tbody', {}, listed.map(([who, person]) => {
|
|
65
|
+
const theirs = person.weeks ? counted(person.weeks) : team === null ? null : 0; // owns work, merged none
|
|
66
|
+
const share = team && theirs !== null ? Math.round((theirs / team) * 100) : team === 0 ? 0 : null;
|
|
67
|
+
return h('tr', {},
|
|
68
|
+
h('th', { scope: 'row', class: 'who' }, person.name, ' ', h('small', {}, `@${person.login || who}`)),
|
|
69
|
+
h('td', { class: 'num' }, all.filter((row) => row.kind !== 'story' && !FINISHED.includes(row.stage) && mine(who, row)).length),
|
|
70
|
+
h('td', { class: 'num' }, all.filter((row) => row.kind === 'story' && row.stage !== 'done' && mine(who, row)).length),
|
|
71
|
+
h('td', {}, h('span', { class: 'share' },
|
|
72
|
+
h('span', { class: 'meter', 'aria-hidden': 'true' }, h('span', { '--w': `${share ?? 0}%` })),
|
|
73
|
+
h('b', {}, share === null ? 'unknown' : `${share}%`))));
|
|
74
|
+
}))));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function install(Board) {
|
|
78
|
+
Board.screens.insights = (main) => load(Board, 'insights', main, (view) =>
|
|
79
|
+
h('div', { class: 'insights' }, h('h1', { class: 'hidden' }, 'Insights'), weekly(view.team.trends), people(view)));
|
|
80
|
+
}
|