@zaip-ai/cli 2.2.0 → 2.6.0
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/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +23 -9
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/agent-adapters.js +25 -9
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-discovery.d.ts +27 -0
- package/dist/services/agent-discovery.d.ts.map +1 -0
- package/dist/services/agent-discovery.js +73 -0
- package/dist/services/agent-discovery.js.map +1 -0
- package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
- package/dist/services/codex-conversation-lifecycle-hook.js +153 -24
- package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.js +146 -72
- package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
- package/dist/services/codex-rules.d.ts +1 -1
- package/dist/services/codex-rules.d.ts.map +1 -1
- package/dist/services/codex-rules.js +3 -3
- package/dist/services/codex-subagent-hook-template.d.ts +1 -1
- package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
- package/dist/services/codex-subagent-hook-template.js +117 -66
- package/dist/services/codex-subagent-hook-template.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +56 -6
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.js +1 -1
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +22 -1
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/runtime-template.test.js +129 -0
- package/dist/services/runtime-template.test.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/.env.example +9 -3
- package/templates/.agents/README-ENG.md +30 -5
- package/templates/.agents/README.md +30 -7
- package/templates/.agents/architecture/software-architecture.md +1 -59
- package/templates/.agents/branding/brandbook.md +3 -0
- package/templates/.agents/config/agents/catalog.yaml +22 -10
- package/templates/.agents/config/agents/discovery.json +319 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +11 -8
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +2 -2
- package/templates/.agents/config/pricing/models.json +9 -5
- package/templates/.agents/config/project.yaml +12 -1
- package/templates/.agents/dashboard/.zaip-managed.json +375 -95
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-CGxeQak4.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-DaSllaJp.js → DashboardHelpDialog-tzS7YxYB.js} +57 -33
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-DEbCi1gP.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-1L7Qw-Gq.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-EInWr641.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-t1Om0Abw.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-B6aZfo5f.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-TPUT2IUt.js → icons-vendor-DiGC-dsJ.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DgTmNHN5.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-Ct48XHGL.js → react-vendor-kPO6yNed.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-Bh1tDfsg.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DQpKX9c1.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +3 -1264
- package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +363 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.dom.test.ts +99 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +62 -6
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +3 -1
- package/templates/.agents/dashboard/apps/frontend/src/__tests__/app-composition-support.ts +7 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +9 -7
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-settings.ts +151 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +28 -153
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-app-shell.tsx +33 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-cost-facts.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-project-overview.ts +7 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-retry.ts +17 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-setup-route.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-view-actions.ts +66 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +3 -2
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.test.ts +48 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +68 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.test.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +2 -5
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +30 -19
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +9 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-task-pagination.ts +77 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.ts +397 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +782 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-snapshot-notice.tsx +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperPanelSlot.tsx +16 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +459 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +27 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +62 -186
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorRunDialog.tsx +20 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-hides-calls-that-have-no-collected.test.ts +80 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +455 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +18 -525
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +32 -508
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-export-sources.ts +74 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-actions.ts +19 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-selectors.ts +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-formatters.ts +115 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test-fixtures.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTableBadges.tsx +34 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +8 -38
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview-keeps-structure-classes-mutually-exclusive.test.ts +243 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +27 -275
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +70 -247
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewCharts.tsx +171 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewPanels.tsx +64 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +4 -3
- package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +6 -2
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +6 -14
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +3 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-format.ts +32 -0
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +1458 -1458
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1425 -1425
- package/templates/.agents/dashboard/packages/local-runtime/package.json +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +7 -3
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1458 -1459
- package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +53 -8
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +79 -24
- package/templates/.agents/dashboard/packages/local-runtime/src/projection-refresh-diagnostics.ts +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-costs-routes.ts +168 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-dual-reads-manifest-summaries-without-losing.test.ts +344 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-http-contracts.ts +31 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +345 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-read-projections.ts +461 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-route-context.ts +13 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +18 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +19 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +22 -21
- package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-view-allowlist.test.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +64 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.test.ts +2 -30
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.ts +6 -23
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +2 -330
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +73 -1060
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-first-fold.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-projections.ts +561 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-runs.ts +600 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-agent-dimension.ts +269 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-context.ts +32 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.ts +244 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts +292 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-financial.ts +547 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-model-dimension.ts +360 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts +169 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +475 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-temporal-dimension.ts +132 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-timing.ts +299 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +692 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +739 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-does-not-convert-delayed-historical-finalizer.test.ts +706 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +748 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +710 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-marks-token-cost-telemetry-unavailable-when.test.ts +618 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +755 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuilds-disposable-snapshot-serves-zaip-records.test.ts +276 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +193 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-types.ts +123 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1 -2805
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +17 -6930
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +385 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +412 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +4 -3
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-build.mjs +195 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-lifecycle.test.mjs +2 -7
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-logging.mjs +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-navigation.mjs +114 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-paths.mjs +90 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +89 -418
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +22 -12
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
- package/templates/.agents/design/.zaip-managed.json +5 -5
- package/templates/.agents/design/DESIGN.md +2 -186
- package/templates/.agents/design/README.md +12 -2
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/growth/strategy.md +3 -0
- package/templates/.agents/marketing/strategy.md +3 -0
- package/templates/.agents/requirements/autonomous-assurance.md +2 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +13 -4
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +4 -2
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +3 -3
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/architecture.md +2 -0
- package/templates/.agents/rules/astra-diagnostic.md +1 -1
- package/templates/.agents/rules/autonomy-decision.md +3 -1
- package/templates/.agents/rules/cloud-hostinger-autonomy.md +2 -0
- package/templates/.agents/rules/context.md +2 -1
- package/templates/.agents/rules/core.md +3 -3
- package/templates/.agents/rules/design-system-central-contract.md +17 -0
- package/templates/.agents/rules/evolution.md +3 -1
- package/templates/.agents/rules/frontend-lite.md +3 -1
- package/templates/.agents/rules/local-sqlite-storage.md +2 -2
- package/templates/.agents/rules/meta-mcp.md +3 -1
- package/templates/.agents/rules/model-orchestration.md +1 -1
- package/templates/.agents/rules/run-lifecycle-closure.md +6 -4
- package/templates/.agents/rules/security.md +3 -1
- package/templates/.agents/rules/specialist-routing.md +3 -1
- package/templates/.agents/rules/text-writing-utf8.md +1 -1
- package/templates/.agents/rules/workflow.md +7 -5
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +519 -247
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/sales/playbook.md +3 -0
- package/templates/.agents/skills/zaip-aios/SKILL.md +5 -3
- package/templates/.agents/skills/zaip-skill-adapt-stack/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-observability/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/references/signal-design.md +3 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/references/evidence-matrix.md +3 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/data-access-paths.md +9 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/worker-scenario.md +5 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/scripts/worker-contract.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-author-skills/references/engineering-skill-index.md +9 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +5 -3
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-backend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-backend/references/deployment-environments.md +75 -0
- package/templates/.agents/skills/zaip-skill-backend/references/supabase-migration-contract.md +23 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-cloud-engineering/SKILL.md +7 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/SKILL.md +37 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workers-static-assets.md +26 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workflow-templates.md +71 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/scripts/cloudflare-github-deploy-contract.test.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-config/SKILL.md +21 -11
- package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-container-runtime/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-container-runtime/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-context/SKILL.md +6 -1
- package/templates/.agents/skills/zaip-skill-context/references/prd-spec-task-handoff.md +10 -0
- package/templates/.agents/skills/zaip-skill-context/references/rule-selection.md +20 -0
- package/templates/.agents/skills/zaip-skill-cqrs/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/SKILL.md +18 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/references/audit-contract.md +94 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.mjs +185 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.test.mjs +101 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/manual-mode.md +15 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/promotion-example.md +5 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.mjs +145 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.test.mjs +178 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/references/runtime-shapes.md +3 -0
- package/templates/.agents/skills/zaip-skill-design-system/SKILL.md +20 -9
- package/templates/.agents/skills/zaip-skill-dev-environment/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/references/inventory-contract.md +7 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/scripts/inventory.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/references/recovery-scope.md +3 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-execution/references/correction-cycle.md +7 -0
- package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +1 -5
- package/templates/.agents/skills/zaip-skill-external-integrations/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-external-integrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/SKILL.md +44 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/SKILL.md +36 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/cloudflare-pages.md +33 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/github.md +63 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/hostinger-vps.md +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/npm.md +30 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/check-skill.mjs +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.mjs +61 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.test.mjs +128 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-ssh.integration.test.mjs +106 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +43 -76
- package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +131 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/github-release-workflow-template.md +31 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-gate-matrix.md +24 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +44 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-notes.md +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.mjs +389 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +25 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness-api.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.mjs +98 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.test.mjs +25 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.mjs +159 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.test.mjs +160 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +149 -12
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.test.mjs +64 -5
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/release-notes-coverage.test.mjs +126 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.mjs +78 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.test.mjs +51 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.mjs +184 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.test.mjs +109 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/SKILL.md +18 -10
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/agents/openai.yaml +3 -4
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/aws-cli-terraform.md +62 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/guia-iniciante-hostinger-vps.md +183 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/references/scaffold-contract.md +9 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/helpers.test.mjs +121 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/scaffold.mjs +169 -0
- package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-performance-engineering/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-performance-engineering/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +26 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +39 -13
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/SKILL.md +66 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/references/behavioral-dry-run.md +23 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +40 -1
- package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +98 -0
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +19 -21
- package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +3 -2
- package/templates/.agents/skills/zaip-skill-storage-uploads/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-storage-uploads/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-task/SKILL.md +16 -7
- package/templates/.agents/skills/zaip-skill-task/references/commit-policy.md +25 -0
- package/templates/.agents/skills/zaip-skill-test-data/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-test-data/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-test-data/scripts/generate.mjs +72 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/references/example-map.md +3 -0
- package/templates/.agents/skills/zaip-skill-website-readiness/SKILL.md +8 -0
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +2 -1
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +5 -3
- package/templates/scripts/validate-cloud-hostinger-contract.mjs +34 -0
- package/templates/template-manifest.json +955 -211
- package/templates/.agents/branding/.gitkeep +0 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-snUCQYTC.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-BPtVUGgs.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-3Awyaovx.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-GgzpZ_PY.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BCvZFMEf.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DbaLbU2q.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-_MEktQNM.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-BDe4_Ubl.js +0 -1
- package/templates/.agents/growth/.gitkeep +0 -0
- package/templates/.agents/marketing/.gitkeep +0 -0
- package/templates/.agents/sales/.gitkeep +0 -0
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import type { OperationsProjection } from "@zaip-ai/dashboard-operations/contracts";
|
|
2
|
+
import { type Dispatch, type RefObject, type SetStateAction, useCallback, useEffect } from "react";
|
|
3
|
+
import { isAbortError, mergeBoardPages } from "./AppRequestGuards.js";
|
|
4
|
+
import {
|
|
5
|
+
type BoardStageState,
|
|
6
|
+
initialWorkBoardStages,
|
|
7
|
+
type OverviewClassification,
|
|
8
|
+
type OverviewClassificationPages,
|
|
9
|
+
type OverviewStatusKind,
|
|
10
|
+
type OverviewStatusPages,
|
|
11
|
+
overviewClassificationPageKey,
|
|
12
|
+
overviewStatusPageKey,
|
|
13
|
+
} from "./AppWorkBoard.js";
|
|
14
|
+
import type {
|
|
15
|
+
DashboardApiClient,
|
|
16
|
+
OperationsBoardPage,
|
|
17
|
+
OperationsPageFilters,
|
|
18
|
+
WorkBoardStage,
|
|
19
|
+
} from "./dashboard-api.js";
|
|
20
|
+
import { type OperationsPeriodState, requestPeriodForOperations } from "./operations-period.js";
|
|
21
|
+
|
|
22
|
+
type StateSetter<T> = Dispatch<SetStateAction<T>>;
|
|
23
|
+
|
|
24
|
+
export function useAppWorkBoard({
|
|
25
|
+
api,
|
|
26
|
+
boardAbortControllersRef,
|
|
27
|
+
boardFilterKeyRef,
|
|
28
|
+
boardFiltersRef,
|
|
29
|
+
boardInFlightRef,
|
|
30
|
+
boardInitialPageRef,
|
|
31
|
+
boardLoadedRef,
|
|
32
|
+
boardRequestVersionRef,
|
|
33
|
+
dashboardView,
|
|
34
|
+
operations,
|
|
35
|
+
operationsPeriod,
|
|
36
|
+
operationsPeriodRef,
|
|
37
|
+
overviewStatusInFlightRef,
|
|
38
|
+
quickOverviewMetricsRef,
|
|
39
|
+
setBoardKindTotals,
|
|
40
|
+
setBoardStates,
|
|
41
|
+
setBoardTotals,
|
|
42
|
+
setOperations,
|
|
43
|
+
setOverviewClassificationPages,
|
|
44
|
+
setOverviewStatusPages,
|
|
45
|
+
}: {
|
|
46
|
+
api: DashboardApiClient;
|
|
47
|
+
boardAbortControllersRef: RefObject<Map<WorkBoardStage, AbortController>>;
|
|
48
|
+
boardFilterKeyRef: RefObject<string>;
|
|
49
|
+
boardFiltersRef: RefObject<OperationsPageFilters>;
|
|
50
|
+
boardInFlightRef: RefObject<Set<WorkBoardStage>>;
|
|
51
|
+
boardInitialPageRef: RefObject<Set<WorkBoardStage>>;
|
|
52
|
+
boardLoadedRef: RefObject<Partial<Record<WorkBoardStage, number>>>;
|
|
53
|
+
boardRequestVersionRef: RefObject<number>;
|
|
54
|
+
dashboardView: "operations" | "cost-monitor" | "traceability" | null;
|
|
55
|
+
operations: OperationsProjection | null;
|
|
56
|
+
operationsPeriod: OperationsPeriodState;
|
|
57
|
+
operationsPeriodRef: RefObject<OperationsPeriodState>;
|
|
58
|
+
overviewStatusInFlightRef: RefObject<Set<string>>;
|
|
59
|
+
quickOverviewMetricsRef: RefObject<OperationsProjection["summary"]["overview_metrics"]>;
|
|
60
|
+
setBoardKindTotals: StateSetter<
|
|
61
|
+
Partial<Record<WorkBoardStage, OperationsBoardPage["totals_by_kind"]>>
|
|
62
|
+
>;
|
|
63
|
+
setBoardStates: StateSetter<Partial<Record<WorkBoardStage, BoardStageState>>>;
|
|
64
|
+
setBoardTotals: StateSetter<Partial<Record<WorkBoardStage, number>>>;
|
|
65
|
+
setOperations: StateSetter<OperationsProjection | null>;
|
|
66
|
+
setOverviewClassificationPages: StateSetter<OverviewClassificationPages>;
|
|
67
|
+
setOverviewStatusPages: StateSetter<OverviewStatusPages>;
|
|
68
|
+
}) {
|
|
69
|
+
const resetBoard = useCallback(() => {
|
|
70
|
+
boardRequestVersionRef.current += 1;
|
|
71
|
+
for (const controller of boardAbortControllersRef.current.values()) controller.abort();
|
|
72
|
+
boardAbortControllersRef.current.clear();
|
|
73
|
+
boardInFlightRef.current.clear();
|
|
74
|
+
boardInitialPageRef.current.clear();
|
|
75
|
+
boardLoadedRef.current = {};
|
|
76
|
+
setBoardTotals({});
|
|
77
|
+
setBoardKindTotals({});
|
|
78
|
+
setBoardStates({});
|
|
79
|
+
setOverviewStatusPages({});
|
|
80
|
+
setOverviewClassificationPages({});
|
|
81
|
+
}, [
|
|
82
|
+
boardAbortControllersRef,
|
|
83
|
+
boardInFlightRef,
|
|
84
|
+
boardInitialPageRef,
|
|
85
|
+
boardLoadedRef,
|
|
86
|
+
boardRequestVersionRef,
|
|
87
|
+
setBoardKindTotals,
|
|
88
|
+
setBoardStates,
|
|
89
|
+
setBoardTotals,
|
|
90
|
+
setOverviewClassificationPages,
|
|
91
|
+
setOverviewStatusPages,
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
const loadMoreBoard = useCallback(
|
|
95
|
+
async (stage: WorkBoardStage) => {
|
|
96
|
+
if (operations === null || boardInFlightRef.current.has(stage)) return;
|
|
97
|
+
boardInFlightRef.current.add(stage);
|
|
98
|
+
boardAbortControllersRef.current.get(stage)?.abort();
|
|
99
|
+
const controller = new AbortController();
|
|
100
|
+
boardAbortControllersRef.current.set(stage, controller);
|
|
101
|
+
const requestVersion = boardRequestVersionRef.current;
|
|
102
|
+
const period = requestPeriodForOperations(operationsPeriod);
|
|
103
|
+
setBoardStates((previous) => ({ ...previous, [stage]: { loading: true, error: null } }));
|
|
104
|
+
const loaded = boardLoadedRef.current[stage] ?? 0;
|
|
105
|
+
try {
|
|
106
|
+
const page = await api.operationsBoard(
|
|
107
|
+
period,
|
|
108
|
+
stage,
|
|
109
|
+
loaded,
|
|
110
|
+
boardFiltersRef.current,
|
|
111
|
+
controller.signal,
|
|
112
|
+
10,
|
|
113
|
+
);
|
|
114
|
+
if (
|
|
115
|
+
controller.signal.aborted ||
|
|
116
|
+
requestVersion !== boardRequestVersionRef.current ||
|
|
117
|
+
period.from !== requestPeriodForOperations(operationsPeriodRef.current).from ||
|
|
118
|
+
period.to !== requestPeriodForOperations(operationsPeriodRef.current).to
|
|
119
|
+
)
|
|
120
|
+
return;
|
|
121
|
+
setOperations((previous) =>
|
|
122
|
+
previous === null
|
|
123
|
+
? previous
|
|
124
|
+
: { ...mergeBoardPages(previous, [page]), summary: previous.summary },
|
|
125
|
+
);
|
|
126
|
+
setBoardTotals((previous) => ({ ...previous, [stage]: page.total }));
|
|
127
|
+
setBoardKindTotals((previous) => ({ ...previous, [stage]: page.totals_by_kind }));
|
|
128
|
+
boardLoadedRef.current = {
|
|
129
|
+
...boardLoadedRef.current,
|
|
130
|
+
[stage]: loaded + page.prds.length + page.specs.length + page.tasks.length,
|
|
131
|
+
};
|
|
132
|
+
} catch (cause) {
|
|
133
|
+
if (
|
|
134
|
+
controller.signal.aborted ||
|
|
135
|
+
requestVersion !== boardRequestVersionRef.current ||
|
|
136
|
+
isAbortError(cause)
|
|
137
|
+
)
|
|
138
|
+
return;
|
|
139
|
+
setBoardStates((previous) => ({
|
|
140
|
+
...previous,
|
|
141
|
+
[stage]: {
|
|
142
|
+
loading: false,
|
|
143
|
+
error: cause instanceof Error ? cause.message : String(cause),
|
|
144
|
+
},
|
|
145
|
+
}));
|
|
146
|
+
} finally {
|
|
147
|
+
if (requestVersion === boardRequestVersionRef.current) {
|
|
148
|
+
boardInFlightRef.current.delete(stage);
|
|
149
|
+
if (boardAbortControllersRef.current.get(stage) === controller)
|
|
150
|
+
boardAbortControllersRef.current.delete(stage);
|
|
151
|
+
setBoardStates((previous) =>
|
|
152
|
+
previous[stage]?.error === null
|
|
153
|
+
? { ...previous, [stage]: { loading: false, error: null } }
|
|
154
|
+
: previous,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
[
|
|
160
|
+
api,
|
|
161
|
+
boardAbortControllersRef,
|
|
162
|
+
boardFiltersRef,
|
|
163
|
+
boardInFlightRef,
|
|
164
|
+
boardLoadedRef,
|
|
165
|
+
boardRequestVersionRef,
|
|
166
|
+
operations,
|
|
167
|
+
operationsPeriod,
|
|
168
|
+
operationsPeriodRef,
|
|
169
|
+
setBoardKindTotals,
|
|
170
|
+
setBoardStates,
|
|
171
|
+
setBoardTotals,
|
|
172
|
+
setOperations,
|
|
173
|
+
],
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const loadFilteredBoard = useCallback(
|
|
177
|
+
(filters: OperationsPageFilters) => {
|
|
178
|
+
const normalizedFilters = {
|
|
179
|
+
...filters,
|
|
180
|
+
kind: filters.kind ?? boardFiltersRef.current.kind ?? "",
|
|
181
|
+
};
|
|
182
|
+
const filterKey = `${normalizedFilters.query}|${normalizedFilters.status}|${normalizedFilters.risk}|${normalizedFilters.origin ?? ""}|${normalizedFilters.kind}`;
|
|
183
|
+
if (filterKey === boardFilterKeyRef.current) return;
|
|
184
|
+
boardFilterKeyRef.current = filterKey;
|
|
185
|
+
boardFiltersRef.current = normalizedFilters;
|
|
186
|
+
resetBoard();
|
|
187
|
+
setOperations((current) =>
|
|
188
|
+
current === null
|
|
189
|
+
? current
|
|
190
|
+
: {
|
|
191
|
+
...current,
|
|
192
|
+
prds: [],
|
|
193
|
+
specs: [],
|
|
194
|
+
tasks: [],
|
|
195
|
+
changes: [],
|
|
196
|
+
summary:
|
|
197
|
+
filterKey === "||||" && quickOverviewMetricsRef.current !== undefined
|
|
198
|
+
? { ...current.summary, overview_metrics: quickOverviewMetricsRef.current }
|
|
199
|
+
: current.summary,
|
|
200
|
+
},
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
[boardFilterKeyRef, boardFiltersRef, quickOverviewMetricsRef, resetBoard, setOperations],
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
const loadOverviewStatusPage = useCallback(
|
|
207
|
+
async (stage: WorkBoardStage, kind: OverviewStatusKind, offset: number) => {
|
|
208
|
+
const key = overviewStatusPageKey(stage, kind);
|
|
209
|
+
const inFlight = overviewStatusInFlightRef.current;
|
|
210
|
+
if (inFlight.has(key)) return;
|
|
211
|
+
inFlight.add(key);
|
|
212
|
+
const requestVersion = boardRequestVersionRef.current;
|
|
213
|
+
const period = requestPeriodForOperations(operationsPeriod);
|
|
214
|
+
setOverviewStatusPages((previous) => ({
|
|
215
|
+
...previous,
|
|
216
|
+
[key]: {
|
|
217
|
+
items: offset === 0 ? [] : (previous[key]?.items ?? []),
|
|
218
|
+
total: previous[key]?.total ?? 0,
|
|
219
|
+
loading: true,
|
|
220
|
+
error: null,
|
|
221
|
+
},
|
|
222
|
+
}));
|
|
223
|
+
try {
|
|
224
|
+
const page = await api.operationsBoard(period, stage, offset, {
|
|
225
|
+
kind: kind === "task" ? "all-tasks" : kind,
|
|
226
|
+
});
|
|
227
|
+
if (
|
|
228
|
+
requestVersion !== boardRequestVersionRef.current ||
|
|
229
|
+
period.from !== requestPeriodForOperations(operationsPeriodRef.current).from ||
|
|
230
|
+
period.to !== requestPeriodForOperations(operationsPeriodRef.current).to
|
|
231
|
+
)
|
|
232
|
+
return;
|
|
233
|
+
const items = kind === "task" ? page.tasks : kind === "spec" ? page.specs : page.prds;
|
|
234
|
+
setOverviewStatusPages((previous) => ({
|
|
235
|
+
...previous,
|
|
236
|
+
[key]: {
|
|
237
|
+
items: offset === 0 ? items : [...(previous[key]?.items ?? []), ...items],
|
|
238
|
+
total: page.total,
|
|
239
|
+
loading: false,
|
|
240
|
+
error: null,
|
|
241
|
+
},
|
|
242
|
+
}));
|
|
243
|
+
} catch (cause) {
|
|
244
|
+
if (requestVersion !== boardRequestVersionRef.current || isAbortError(cause)) return;
|
|
245
|
+
setOverviewStatusPages((previous) => ({
|
|
246
|
+
...previous,
|
|
247
|
+
[key]: {
|
|
248
|
+
items: previous[key]?.items ?? [],
|
|
249
|
+
total: previous[key]?.total ?? 0,
|
|
250
|
+
loading: false,
|
|
251
|
+
error: cause instanceof Error ? cause.message : String(cause),
|
|
252
|
+
},
|
|
253
|
+
}));
|
|
254
|
+
} finally {
|
|
255
|
+
inFlight.delete(key);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
[
|
|
259
|
+
api,
|
|
260
|
+
boardRequestVersionRef,
|
|
261
|
+
operationsPeriod,
|
|
262
|
+
operationsPeriodRef,
|
|
263
|
+
overviewStatusInFlightRef,
|
|
264
|
+
setOverviewStatusPages,
|
|
265
|
+
],
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const loadOverviewClassificationPage = useCallback(
|
|
269
|
+
async (kind: OverviewStatusKind, classification: OverviewClassification, offset: number) => {
|
|
270
|
+
const key = overviewClassificationPageKey(kind, classification);
|
|
271
|
+
const inFlight = overviewStatusInFlightRef.current;
|
|
272
|
+
if (inFlight.has(key)) return;
|
|
273
|
+
inFlight.add(key);
|
|
274
|
+
const requestVersion = boardRequestVersionRef.current;
|
|
275
|
+
const period = requestPeriodForOperations(operationsPeriod);
|
|
276
|
+
setOverviewClassificationPages((previous) => ({
|
|
277
|
+
...previous,
|
|
278
|
+
[key]: {
|
|
279
|
+
items: offset === 0 ? [] : (previous[key]?.items ?? []),
|
|
280
|
+
total: previous[key]?.total ?? 0,
|
|
281
|
+
loading: true,
|
|
282
|
+
error: null,
|
|
283
|
+
},
|
|
284
|
+
}));
|
|
285
|
+
try {
|
|
286
|
+
const page = await api.operationsClassification(period, kind, classification, offset);
|
|
287
|
+
if (
|
|
288
|
+
requestVersion !== boardRequestVersionRef.current ||
|
|
289
|
+
period.from !== requestPeriodForOperations(operationsPeriodRef.current).from ||
|
|
290
|
+
period.to !== requestPeriodForOperations(operationsPeriodRef.current).to
|
|
291
|
+
)
|
|
292
|
+
return;
|
|
293
|
+
const items = kind === "task" ? page.tasks : kind === "spec" ? page.specs : page.prds;
|
|
294
|
+
setOverviewClassificationPages((previous) => ({
|
|
295
|
+
...previous,
|
|
296
|
+
[key]: {
|
|
297
|
+
items: offset === 0 ? items : [...(previous[key]?.items ?? []), ...items],
|
|
298
|
+
total: page.total,
|
|
299
|
+
loading: false,
|
|
300
|
+
error: null,
|
|
301
|
+
},
|
|
302
|
+
}));
|
|
303
|
+
} catch (cause) {
|
|
304
|
+
if (requestVersion !== boardRequestVersionRef.current || isAbortError(cause)) return;
|
|
305
|
+
setOverviewClassificationPages((previous) => ({
|
|
306
|
+
...previous,
|
|
307
|
+
[key]: {
|
|
308
|
+
items: previous[key]?.items ?? [],
|
|
309
|
+
total: previous[key]?.total ?? 0,
|
|
310
|
+
loading: false,
|
|
311
|
+
error: cause instanceof Error ? cause.message : String(cause),
|
|
312
|
+
},
|
|
313
|
+
}));
|
|
314
|
+
} finally {
|
|
315
|
+
inFlight.delete(key);
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
[
|
|
319
|
+
api,
|
|
320
|
+
boardRequestVersionRef,
|
|
321
|
+
operationsPeriod,
|
|
322
|
+
operationsPeriodRef,
|
|
323
|
+
overviewStatusInFlightRef,
|
|
324
|
+
setOverviewClassificationPages,
|
|
325
|
+
],
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
const boardExportSource = useCallback(
|
|
329
|
+
(selectedFilters: { query: string; status: string; risk: string; origin: string }) => {
|
|
330
|
+
const filters = { ...boardFiltersRef.current, ...selectedFilters };
|
|
331
|
+
const period = requestPeriodForOperations(operationsPeriod);
|
|
332
|
+
return {
|
|
333
|
+
prepare: async () => {
|
|
334
|
+
const firstPages = await Promise.all(
|
|
335
|
+
initialWorkBoardStages.map((stage) => api.operationsBoard(period, stage, 0, filters)),
|
|
336
|
+
);
|
|
337
|
+
const rowsFor = (page: OperationsBoardPage) => [
|
|
338
|
+
...page.prds.map(({ kind: _kind, ...row }) => ({ kind: "prd", ...row })),
|
|
339
|
+
...page.specs.map(({ kind: _kind, ...row }) => ({ kind: "spec", ...row })),
|
|
340
|
+
...page.tasks.map((row) => ({ kind: "task", ...row })),
|
|
341
|
+
];
|
|
342
|
+
return {
|
|
343
|
+
totalRows: firstPages.reduce((sum, page) => sum + page.total, 0),
|
|
344
|
+
pages: async function* () {
|
|
345
|
+
for (const firstPage of firstPages) {
|
|
346
|
+
let page = firstPage;
|
|
347
|
+
let offset = 0;
|
|
348
|
+
while (true) {
|
|
349
|
+
const rows = rowsFor(page);
|
|
350
|
+
if (rows.length === 0) break;
|
|
351
|
+
offset += rows.length;
|
|
352
|
+
yield rows;
|
|
353
|
+
if (offset >= page.total) break;
|
|
354
|
+
page = await api.operationsBoard(period, page.stage, offset, filters);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
[api, boardFiltersRef, operationsPeriod],
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (dashboardView !== "operations" || operations === null) return;
|
|
367
|
+
let cancelled = false;
|
|
368
|
+
const hydrateBoard = async () => {
|
|
369
|
+
const pending = initialWorkBoardStages.filter(
|
|
370
|
+
(stage) => !boardInitialPageRef.current.has(stage) && !boardInFlightRef.current.has(stage),
|
|
371
|
+
);
|
|
372
|
+
for (let offset = 0; offset < pending.length && !cancelled; offset += 3) {
|
|
373
|
+
const batch = pending.slice(offset, offset + 3);
|
|
374
|
+
for (const stage of batch) boardInitialPageRef.current.add(stage);
|
|
375
|
+
await Promise.all(batch.map((stage) => loadMoreBoard(stage)));
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
const idle =
|
|
379
|
+
typeof window.requestIdleCallback === "function"
|
|
380
|
+
? { kind: "idle" as const, id: window.requestIdleCallback(() => void hydrateBoard()) }
|
|
381
|
+
: { kind: "timeout" as const, id: window.setTimeout(() => void hydrateBoard(), 0) };
|
|
382
|
+
return () => {
|
|
383
|
+
cancelled = true;
|
|
384
|
+
if (idle.kind === "idle") window.cancelIdleCallback(idle.id);
|
|
385
|
+
else window.clearTimeout(idle.id);
|
|
386
|
+
};
|
|
387
|
+
}, [boardInFlightRef, boardInitialPageRef, dashboardView, loadMoreBoard, operations]);
|
|
388
|
+
|
|
389
|
+
return {
|
|
390
|
+
boardExportSource,
|
|
391
|
+
loadFilteredBoard,
|
|
392
|
+
loadMoreBoard,
|
|
393
|
+
loadOverviewClassificationPage,
|
|
394
|
+
loadOverviewStatusPage,
|
|
395
|
+
resetBoard,
|
|
396
|
+
};
|
|
397
|
+
}
|