@agent-native/core 0.137.7 → 0.138.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/agent-native.eject.json +2 -0
- package/corpus/README.md +1 -1
- package/corpus/templates/analytics/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +15 -0
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/analytics/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/analytics/AGENTS.md +2 -2
- package/corpus/templates/analytics/actions/get-first-party-analytics-health.ts +65 -0
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +3 -6
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -6
- package/corpus/templates/analytics/actions/provider-api-request.ts +3 -6
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +3 -3
- package/corpus/templates/analytics/agent-native.json +12 -0
- package/corpus/templates/analytics/app/i18n-data.ts +162 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +126 -1
- package/corpus/templates/analytics/changelog/2026-08-05-analytics-now-flags-neon-pressure-and-guides-high-volume-tra.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-05-first-party-analytics-uses-compact-rollups-for-faster-usage-.md +6 -0
- package/corpus/templates/analytics/server/db/schema.ts +52 -0
- package/corpus/templates/analytics/server/lib/credential-keys.ts +3 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-health.ts +397 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics-rollups.ts +182 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +86 -15
- package/corpus/templates/analytics/server/lib/provider-api.ts +20 -1
- package/corpus/templates/analytics/server/lib/replay-storage.ts +1 -1
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/analytics/server/plugins/db.ts +60 -0
- package/corpus/templates/assets/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/assets/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/assets/agent-native.json +12 -0
- package/corpus/templates/assets/server/lib/generation.ts +8 -8
- package/corpus/templates/assets/server/lib/storage.ts +1 -1
- package/corpus/templates/assets/server/plugins/onboarding.ts +1 -1
- package/corpus/templates/brain/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/brain/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/brain/agent-native.json +12 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/calendar/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/calendar/agent-native.json +12 -0
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/chat/AGENTS.md +3 -0
- package/corpus/templates/chat/DESIGN.md +28 -0
- package/corpus/templates/chat/agent-native.json +12 -0
- package/corpus/templates/clips/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/clips/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/clips/actions/cleanup-transcript.ts +2 -2
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +3 -0
- package/corpus/templates/clips/actions/get-playback-position.ts +68 -0
- package/corpus/templates/clips/actions/import-loom-recording.ts +2 -2
- package/corpus/templates/clips/actions/save-playback-position.ts +80 -0
- package/corpus/templates/clips/actions/set-thumbnail.ts +1 -1
- package/corpus/templates/clips/agent-native.json +12 -0
- package/corpus/templates/clips/app/components/player/video-player.tsx +54 -5
- package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +65 -18
- package/corpus/templates/clips/app/hooks/use-playback-position.ts +188 -0
- package/corpus/templates/clips/app/hooks/use-view-tracking.ts +6 -24
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
- package/corpus/templates/clips/app/lib/playback-position.ts +99 -0
- package/corpus/templates/clips/app/lib/viewer-session.ts +29 -0
- package/corpus/templates/clips/changelog/2026-08-05-clip-buffering-now-uses-buffering-copy-after-playback.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-05-clips-remembers-your-playback-position-when-you-reopen-a-cli.md +6 -0
- package/corpus/templates/clips/desktop/package.json +1 -0
- package/corpus/templates/clips/desktop/src/app.tsx +70 -6
- package/corpus/templates/clips/desktop/src/components/AlertDialog.tsx +131 -0
- package/corpus/templates/clips/desktop/src/styles.css +129 -0
- package/corpus/templates/clips/learnings.defaults.md +1 -1
- package/corpus/templates/clips/server/db/schema.ts +18 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +1 -1
- package/corpus/templates/clips/server/lib/video-storage.ts +1 -1
- package/corpus/templates/clips/server/plugins/db.ts +15 -0
- package/corpus/templates/clips/server/routes/api/media/index.post.ts +1 -1
- package/corpus/templates/content/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +13 -0
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/content/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/content/AGENTS.md +1 -0
- package/corpus/templates/content/actions/_content-database-mutation-lock.ts +41 -0
- package/corpus/templates/content/actions/_content-database-row-migration.ts +569 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +82 -36
- package/corpus/templates/content/actions/_database-utils.ts +5 -0
- package/corpus/templates/content/actions/_delete-content-space.ts +25 -11
- package/corpus/templates/content/actions/add-database-item.ts +60 -42
- package/corpus/templates/content/actions/attach-content-database-source.ts +2 -0
- package/corpus/templates/content/actions/configure-document-property.ts +99 -104
- package/corpus/templates/content/actions/delete-content-database.ts +19 -7
- package/corpus/templates/content/actions/delete-document-property.ts +47 -58
- package/corpus/templates/content/actions/delete-document.ts +390 -167
- package/corpus/templates/content/actions/disconnect-content-database-source.ts +41 -24
- package/corpus/templates/content/actions/duplicate-database-item.ts +63 -31
- package/corpus/templates/content/actions/duplicate-database-items.ts +86 -43
- package/corpus/templates/content/actions/duplicate-document-property.ts +37 -14
- package/corpus/templates/content/actions/migrate-content-database-rows.ts +830 -0
- package/corpus/templates/content/actions/move-database-item.ts +14 -0
- package/corpus/templates/content/actions/permanently-delete-document.ts +27 -6
- package/corpus/templates/content/actions/remove-database-items.ts +13 -0
- package/corpus/templates/content/actions/reorder-document-property.ts +45 -46
- package/corpus/templates/content/actions/set-document-property.ts +68 -28
- package/corpus/templates/content/actions/submit-content-database-form.ts +49 -0
- package/corpus/templates/content/actions/transcribe-media.ts +1 -1
- package/corpus/templates/content/agent-native.json +12 -0
- package/corpus/templates/content/app/components/editor/image-upload.ts +2 -2
- package/corpus/templates/content/app/i18n-data.ts +1 -1
- package/corpus/templates/content/changelog/2026-08-01-content-can-reorganize-every-row-in-an-existing-database-as-.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -1
- package/corpus/templates/content/parity/matrix.ts +4 -2
- package/corpus/templates/content/server/db/schema.ts +30 -0
- package/corpus/templates/content/server/plugins/db.ts +24 -0
- package/corpus/templates/content/server/plugins/onboarding.ts +2 -2
- package/corpus/templates/crm/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/crm/agent-native.json +12 -0
- package/corpus/templates/design/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +2 -0
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/design/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/design/CODE_NATIVE_DESIGN_STUDIO_IMPLEMENTATION_PLAN.md +2 -2
- package/corpus/templates/design/DESIGN-STUDIO-PLAN.md +2 -2
- package/corpus/templates/design/actions/apply-design-token-edit.ts +1 -1
- package/corpus/templates/design/actions/capture-design-state.ts +1 -1
- package/corpus/templates/design/actions/connect-builder-app.ts +2 -2
- package/corpus/templates/design/actions/create-design-branch.ts +1 -1
- package/corpus/templates/design/actions/create-fusion-app.ts +3 -3
- package/corpus/templates/design/actions/deploy-design-preview.ts +1 -1
- package/corpus/templates/design/actions/generate-design.ts +3 -2
- package/corpus/templates/design/actions/get-component-details.ts +1 -1
- package/corpus/templates/design/actions/get-design-branch-diff.ts +1 -1
- package/corpus/templates/design/actions/index-components.ts +3 -3
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +1 -1
- package/corpus/templates/design/actions/migrate-inline-design-to-app.ts +3 -3
- package/corpus/templates/design/actions/open-component-source.ts +1 -1
- package/corpus/templates/design/actions/update-design.ts +96 -14
- package/corpus/templates/design/agent-native.json +12 -0
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +7 -2
- package/corpus/templates/design/app/components/design/FigmaHydrationDialog.tsx +11 -2
- package/corpus/templates/design/app/components/design/edit-panel/component-section.tsx +1 -1
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +8 -1
- package/corpus/templates/design/app/i18n-data.ts +53 -22
- package/corpus/templates/design/app/lib/design-file-upload.ts +2 -3
- package/corpus/templates/design/app/lib/upload-limits.ts +4 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +1 -1
- package/corpus/templates/design/changelog/2026-08-05-chat-attachments-now-warn-before-upload-when-they-exceed-the.md +6 -0
- package/corpus/templates/design/changelog/2026-08-05-figma-fig-uploads-now-show-a-clear-4-mb-limit-up-front-inste.md +6 -0
- package/corpus/templates/design/scripts/qa-figma-stress-import.ts +1 -1
- package/corpus/templates/design/server/handlers/import-design-file.ts +9 -5
- package/corpus/templates/design/server/handlers/uploads.ts +13 -9
- package/corpus/templates/design/server/lib/fig-file-limits.ts +2 -1
- package/corpus/templates/design/server/lib/figma-image-hydration.ts +1 -1
- package/corpus/templates/design/server/lib/figma-node-import.ts +1 -1
- package/corpus/templates/design/server/lib/request-body-limits.ts +11 -0
- package/corpus/templates/design/shared/canvas-frames.ts +81 -0
- package/corpus/templates/design/shared/design-source-capabilities.ts +25 -9
- package/corpus/templates/dispatch/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/dispatch/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/dispatch/agent-native.json +12 -0
- package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/factory/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/factory/agent-native.json +12 -0
- package/corpus/templates/forms/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/forms/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/forms/actions/export-responses.ts +1 -1
- package/corpus/templates/forms/agent-native.json +12 -0
- package/corpus/templates/macros/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/macros/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/macros/agent-native.json +12 -0
- package/corpus/templates/mail/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/mail/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/mail/agent-native.json +12 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +1 -1
- package/corpus/templates/mail/server/lib/media-upload.ts +1 -1
- package/corpus/templates/plan/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/plan/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/plan/agent-native.json +12 -0
- package/corpus/templates/plan/server/lib/plan-assets.ts +1 -1
- package/corpus/templates/slides/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/slides/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/slides/actions/generate-image-api.ts +1 -1
- package/corpus/templates/slides/actions/generate-slides-ai.ts +1 -1
- package/corpus/templates/slides/actions/import-file.ts +2 -2
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +1 -1
- package/corpus/templates/slides/agent-native.json +12 -0
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +1 -1
- package/corpus/templates/slides/app/i18n/en-US.ts +2 -2
- package/corpus/templates/slides/app/lib/deck-sorting.ts +19 -0
- package/corpus/templates/slides/app/lib/image-drop-to-agent.ts +1 -1
- package/corpus/templates/slides/app/pages/Index.tsx +7 -2
- package/corpus/templates/slides/changelog/2026-08-05-decks-are-now-sorted-by-most-recently-updated.md +6 -0
- package/corpus/templates/slides/server/handlers/assets.ts +1 -1
- package/corpus/templates/slides/server/handlers/uploads.ts +1 -1
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +23 -2
- package/corpus/templates/tasks/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/tasks/agent-native.json +12 -0
- package/dist/action.d.ts +6 -0
- package/dist/agent/engine/builder-engine.js +2 -2
- package/dist/agent/engine/credential-errors.d.ts +1 -1
- package/dist/agent/engine/credential-errors.js +2 -2
- package/dist/agent/production-agent.js +3 -2
- package/dist/brand-kit/fig/index.js +1 -1
- package/dist/cli/agent.js +45 -3
- package/dist/cli/code-agent-executor.js +2 -1
- package/dist/cli/create.d.ts +9 -1
- package/dist/cli/create.js +94 -1
- package/dist/cli/doctor.d.ts +8 -11
- package/dist/cli/doctor.js +92 -24
- package/dist/cli/index.js +6 -5
- package/dist/client/AgentAskPopover.d.ts +3 -1
- package/dist/client/AgentAskPopover.js +2 -2
- package/dist/client/AgentPanel.js +9 -3
- package/dist/client/AssistantChat.js +54 -33
- package/dist/client/MultiTabAssistantChat.js +1 -1
- package/dist/client/RouteTransitionIndicator.d.ts +7 -0
- package/dist/client/RouteTransitionIndicator.js +31 -0
- package/dist/client/agent-engine-key.js +1 -1
- package/dist/client/app-providers.js +11 -2
- package/dist/client/chat/message-components.js +1 -1
- package/dist/client/chat/run-recovery.js +1 -1
- package/dist/client/chat/tool-call-display.d.ts +3 -1
- package/dist/client/chat/tool-call-display.js +4 -3
- package/dist/client/chat-model-groups.d.ts +6 -0
- package/dist/client/chat-model-groups.js +11 -0
- package/dist/client/error-format.js +1 -1
- package/dist/client/i18n.js +1 -1
- package/dist/client/onboarding/FirstRunOnboarding.d.ts +5 -1
- package/dist/client/onboarding/FirstRunOnboarding.js +29 -13
- package/dist/client/onboarding/first-run-enabled.d.ts +6 -1
- package/dist/client/onboarding/first-run-enabled.js +33 -3
- package/dist/client/onboarding/use-onboarding.js +16 -11
- package/dist/client/require-session.js +13 -4
- package/dist/client/resources/mcp-integration-catalog.js +26 -0
- package/dist/client/resources/mcp-integration-logos.js +4 -0
- package/dist/client/route-warmup.js +56 -10
- package/dist/client/settings/AccountSettingsCard.js +78 -3
- package/dist/client/settings/SettingsPanel.js +1 -1
- package/dist/client/settings/VoiceTranscriptionSection.js +2 -2
- package/dist/client/settings/useBuilderStatus.js +1 -1
- package/dist/client/setup-connections/useBuilderConnectCardController.js +1 -1
- package/dist/client/ui/index.d.ts +1 -0
- package/dist/client/ui/index.js +1 -0
- package/dist/client/uploads/upload-editor-image.js +1 -1
- package/dist/client/use-chat-threads.js +3 -0
- package/dist/client/use-session.d.ts +11 -0
- package/dist/client/use-session.js +34 -6
- package/dist/collab/routes.d.ts +2 -2
- package/dist/config.d.ts +48 -0
- package/dist/config.js +111 -0
- package/dist/db/migrations.js +5 -0
- package/dist/eject/provider-api-definitions.d.ts +1 -1
- package/dist/eject/provider-api-definitions.js +1 -0
- package/dist/eject/remote-mcp-presets.js +1 -0
- package/dist/extensions/web-search-tool.js +2 -2
- package/dist/file-upload/actions/upload-image.js +1 -1
- package/dist/file-upload/registry.js +1 -1
- package/dist/guards/index.d.ts +3 -0
- package/dist/guards/index.js +2 -0
- package/dist/guards/no-empty-migrations.d.ts +14 -0
- package/dist/guards/no-empty-migrations.js +126 -0
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/localization/default-messages.d.ts +24 -0
- package/dist/localization/default-messages.js +26 -2
- package/dist/notifications/routes.d.ts +6 -6
- package/dist/onboarding/app-profile.js +1 -1
- package/dist/onboarding/plugin.d.ts +2 -0
- package/dist/onboarding/plugin.js +29 -2
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +16 -16
- package/dist/provider-api/actions/provider-api.d.ts +13 -13
- package/dist/provider-api/index.d.ts +4 -4
- package/dist/provider-api/index.js +35 -0
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/resources/handlers.js +1 -1
- package/dist/scripts/docs/framework-search.d.ts +9 -0
- package/dist/scripts/docs/framework-search.js +239 -0
- package/dist/scripts/docs/index.js +1 -0
- package/dist/scripts/docs/search.d.ts +10 -0
- package/dist/scripts/docs/search.js +1 -1
- package/dist/scripts/docs/source-search.d.ts +10 -2
- package/dist/scripts/docs/source-search.js +108 -41
- package/dist/search-utils/index.d.ts +11 -0
- package/dist/search-utils/index.js +72 -0
- package/dist/server/action-change.d.ts +6 -0
- package/dist/server/action-change.js +28 -14
- package/dist/server/action-discovery.js +9 -0
- package/dist/server/action-routes.js +1 -0
- package/dist/server/agent-chat/browser-team-tools.js +1 -1
- package/dist/server/agent-chat/script-entries.js +43 -2
- package/dist/server/auth-login-mode.d.ts +8 -0
- package/dist/server/auth-login-mode.js +17 -0
- package/dist/server/auth.js +100 -15
- package/dist/server/better-auth-instance.d.ts +36 -0
- package/dist/server/better-auth-instance.js +25 -3
- package/dist/server/builder-design-systems.js +1 -1
- package/dist/server/core-routes-plugin.js +17 -14
- package/dist/server/credential-provider.js +3 -3
- package/dist/server/email-templates.d.ts +7 -0
- package/dist/server/email-templates.js +24 -0
- package/dist/server/email.d.ts +17 -0
- package/dist/server/email.js +22 -1
- package/dist/server/framework-request-handler.js +6 -0
- package/dist/server/onboarding-html.d.ts +2 -0
- package/dist/server/onboarding-html.js +169 -8
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/realtime-voice.js +1 -1
- package/dist/server/sentry.d.ts +1 -1
- package/dist/server/transcribe-voice.js +3 -3
- package/dist/shared/first-run-onboarding.d.ts +1 -0
- package/dist/shared/first-run-onboarding.js +1 -0
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/chat/AGENTS.md +3 -0
- package/dist/templates/chat/DESIGN.md +28 -0
- package/dist/templates/chat/agent-native.json +12 -0
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/default/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/default/AGENTS.md +4 -0
- package/dist/templates/default/DESIGN.md +30 -0
- package/dist/templates/default/agent-native.json +9 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +2 -2
- package/dist/templates/default/app/i18n/de-DE.ts +2 -2
- package/dist/templates/default/app/i18n/en-US.ts +2 -2
- package/dist/templates/default/app/i18n/es-ES.ts +2 -2
- package/dist/templates/default/app/i18n/fr-FR.ts +2 -2
- package/dist/templates/default/app/i18n/hi-IN.ts +2 -2
- package/dist/templates/default/app/i18n/ja-JP.ts +2 -2
- package/dist/templates/default/app/i18n/ko-KR.ts +2 -2
- package/dist/templates/default/app/i18n/pt-BR.ts +2 -2
- package/dist/templates/default/app/i18n/zh-CN.ts +2 -2
- package/dist/templates/default/app/i18n/zh-TW.ts +1 -1
- package/dist/templates/default/package.json +1 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/headless/agent-native.json +9 -0
- package/dist/templates/headless/package.json +2 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +23 -2
- package/dist/templates/workspace-core/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/dist/templates/workspace-core/AGENTS.md +3 -0
- package/dist/templates/workspace-core/DESIGN.md +35 -0
- package/dist/templates/workspace-root/AGENTS.md +3 -0
- package/dist/templates/workspace-root/DESIGN.md +35 -0
- package/dist/templates/workspace-root/agent-native.json +9 -0
- package/dist/templates/workspace-root/package.json +3 -0
- package/dist/transcription/builder-transcription.js +1 -1
- package/dist/user-profile/actions/change-password.d.ts +8 -0
- package/dist/user-profile/actions/change-password.js +24 -0
- package/dist/user-profile/actions/get-auth-methods.d.ts +6 -0
- package/dist/user-profile/actions/get-auth-methods.js +23 -0
- package/dist/user-profile/actions/set-password.d.ts +7 -0
- package/dist/user-profile/actions/set-password.js +23 -0
- package/dist/vite/client.d.ts +8 -1
- package/dist/vite/client.js +63 -12
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/docs/AGENTS.md +7 -2
- package/docs/SKILL.md +7 -5
- package/docs/content/agent-native-config.mdx +165 -0
- package/docs/content/agent-native-toolkit.mdx +1 -1
- package/docs/content/deployment.mdx +7 -2
- package/docs/content/doctor.mdx +21 -13
- package/docs/content/environment-variables.mdx +158 -0
- package/docs/content/file-uploads.mdx +1 -1
- package/docs/content/getting-started.mdx +1 -1
- package/docs/content/key-concepts.mdx +1 -1
- package/docs/content/multi-app-workspace.mdx +1 -1
- package/docs/content/template-clips-ai-and-editing.mdx +6 -6
- package/docs/content/template-clips-developers.mdx +3 -3
- package/docs/content/toolkit-settings.mdx +1 -1
- package/docs/content/voice-input.mdx +4 -4
- package/package.json +6 -2
- package/src/eject/provider-api-definitions.ts +1 -0
- package/src/eject/remote-mcp-presets.ts +1 -0
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/chat/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/chat/AGENTS.md +3 -0
- package/src/templates/chat/DESIGN.md +28 -0
- package/src/templates/chat/agent-native.json +12 -0
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/default/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/default/AGENTS.md +4 -0
- package/src/templates/default/DESIGN.md +30 -0
- package/src/templates/default/agent-native.json +9 -0
- package/src/templates/default/app/i18n/ar-SA.ts +2 -2
- package/src/templates/default/app/i18n/de-DE.ts +2 -2
- package/src/templates/default/app/i18n/en-US.ts +2 -2
- package/src/templates/default/app/i18n/es-ES.ts +2 -2
- package/src/templates/default/app/i18n/fr-FR.ts +2 -2
- package/src/templates/default/app/i18n/hi-IN.ts +2 -2
- package/src/templates/default/app/i18n/ja-JP.ts +2 -2
- package/src/templates/default/app/i18n/ko-KR.ts +2 -2
- package/src/templates/default/app/i18n/pt-BR.ts +2 -2
- package/src/templates/default/app/i18n/zh-CN.ts +2 -2
- package/src/templates/default/app/i18n/zh-TW.ts +1 -1
- package/src/templates/default/package.json +1 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/headless/agent-native.json +9 -0
- package/src/templates/headless/package.json +2 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +23 -3
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +16 -0
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +23 -2
- package/src/templates/workspace-core/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/src/templates/workspace-core/AGENTS.md +3 -0
- package/src/templates/workspace-core/DESIGN.md +35 -0
- package/src/templates/workspace-root/AGENTS.md +3 -0
- package/src/templates/workspace-root/DESIGN.md +35 -0
- package/src/templates/workspace-root/agent-native.json +9 -0
- package/src/templates/workspace-root/package.json +3 -0
package/dist/cli/agent.js
CHANGED
|
@@ -199,8 +199,8 @@ function buildHeadlessSystemPrompt(actionNames) {
|
|
|
199
199
|
return [
|
|
200
200
|
"You are the app agent for this Agent-Native project.",
|
|
201
201
|
"Use the registered app actions as your source of truth for doing work.",
|
|
202
|
-
"Use
|
|
203
|
-
"Use
|
|
202
|
+
"Use framework-search first for questions that may span the version-matched docs and source; it supports bounded substring, wildcard, SQL-like, and safe-regex matching.",
|
|
203
|
+
"Use docs-search or source-search for a focused page/file read after framework-search identifies the relevant evidence.",
|
|
204
204
|
"Use connected GitHub repository tools for repo context when a repository is configured; do not assume a local clone or sandbox exists.",
|
|
205
205
|
"You are running headlessly from the command line, so reply with the final useful result in plain text.",
|
|
206
206
|
actionList,
|
|
@@ -224,7 +224,49 @@ function cliArgsFromToolArgs(args) {
|
|
|
224
224
|
export async function createHeadlessBuiltinActions() {
|
|
225
225
|
const docsSearch = await import("../scripts/docs/search.js");
|
|
226
226
|
const sourceSearch = await import("../scripts/docs/source-search.js");
|
|
227
|
+
const frameworkSearch = await import("../scripts/docs/framework-search.js");
|
|
227
228
|
return {
|
|
229
|
+
"framework-search": {
|
|
230
|
+
readOnly: true,
|
|
231
|
+
tool: {
|
|
232
|
+
description: "Search version-matched Agent Native docs and readable Core, Toolkit, and first-party template source together. Use this first when a docs answer may require implementation evidence; supports substring, glob, SQL-like, and safe regex modes.",
|
|
233
|
+
parameters: {
|
|
234
|
+
type: "object",
|
|
235
|
+
properties: {
|
|
236
|
+
pattern: {
|
|
237
|
+
type: "string",
|
|
238
|
+
description: "Text pattern to search across docs and source.",
|
|
239
|
+
},
|
|
240
|
+
scope: {
|
|
241
|
+
type: "string",
|
|
242
|
+
description: "Search corpus: all, docs, or source (default: all).",
|
|
243
|
+
enum: ["all", "docs", "source"],
|
|
244
|
+
},
|
|
245
|
+
mode: {
|
|
246
|
+
type: "string",
|
|
247
|
+
description: "Match mode: substring, glob, sql-like, or safe regex (default: substring).",
|
|
248
|
+
enum: ["substring", "glob", "sql-like", "regex"],
|
|
249
|
+
},
|
|
250
|
+
path: {
|
|
251
|
+
type: "string",
|
|
252
|
+
description: "Optional glob path filter.",
|
|
253
|
+
},
|
|
254
|
+
limit: {
|
|
255
|
+
type: "string",
|
|
256
|
+
description: "Maximum matching files to return, from 1 to 50.",
|
|
257
|
+
},
|
|
258
|
+
list: {
|
|
259
|
+
type: "string",
|
|
260
|
+
description: 'Set to "true" to list searchable docs and source roots.',
|
|
261
|
+
enum: ["true"],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
run: async (args) => {
|
|
267
|
+
return captureCliOutput(() => frameworkSearch.default(cliArgsFromToolArgs(args)));
|
|
268
|
+
},
|
|
269
|
+
},
|
|
228
270
|
"docs-search": {
|
|
229
271
|
readOnly: true,
|
|
230
272
|
tool: {
|
|
@@ -255,7 +297,7 @@ export async function createHeadlessBuiltinActions() {
|
|
|
255
297
|
"source-search": {
|
|
256
298
|
readOnly: true,
|
|
257
299
|
tool: {
|
|
258
|
-
description: "Search and read
|
|
300
|
+
description: "Search and read readable version-matched Core, Toolkit, and first-party template source. Use framework-search for one combined docs/source search with glob, SQL-like, or regex matching; use --list, --query, or --path for focused source lookup.",
|
|
259
301
|
parameters: {
|
|
260
302
|
type: "object",
|
|
261
303
|
properties: {
|
|
@@ -1338,7 +1338,8 @@ Current run mode: ${mode} mode (${permissionMode}).
|
|
|
1338
1338
|
# Autonomy and verification
|
|
1339
1339
|
|
|
1340
1340
|
- Stay with the work until the task is handled end to end within this turn whenever feasible. Don't stop at analysis or a proposal — implement the fix, and work through blockers yourself before handing them back. The exception is Plan mode, where you propose only.
|
|
1341
|
-
- Done means verified, not generated.
|
|
1341
|
+
- Done means verified, not generated. Match the check to the change: use the narrowest relevant test, typecheck, formatter, or direct invocation for a localized edit; use \`pnpm run prep\` for shared or cross-cutting changes. Do not restart a dev server or run broad checks as a generic post-edit ritual. Fix failures before you call it done, and keep any repository-required guards or doctor checks that apply.
|
|
1342
|
+
- In an Agent-Native app or workspace, also run \`pnpm agent-native:doctor\` (or \`pnpm doctor\`) after source changes. Treat every finding as a fix-required security issue; do not disable a guard without a reviewer-readable reason.
|
|
1342
1343
|
- Do not claim a change works, tests pass, or a build succeeds unless you actually ran it and saw the result. If you could not verify something, say exactly what is unverified and why.
|
|
1343
1344
|
|
|
1344
1345
|
# Tools beyond the basics
|
package/dist/cli/create.d.ts
CHANGED
|
@@ -131,6 +131,14 @@ declare function communityTemplateTrustMessage(selection: string): string | unde
|
|
|
131
131
|
* templates need it.
|
|
132
132
|
*/
|
|
133
133
|
declare function scaffoldRequiredPackages(templateNames: string[], workspaceRoot: string): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Keep the portable guard contract attached to every app/workspace created by
|
|
136
|
+
* the CLI, including community templates whose package.json was not authored
|
|
137
|
+
* by this repository. The scanners stay versioned in @agent-native/core; a
|
|
138
|
+
* generated project only receives the small command/config/instructions
|
|
139
|
+
* surface needed to run them locally and in hosted builds.
|
|
140
|
+
*/
|
|
141
|
+
declare function ensureGuardedScaffold(appDir: string): void;
|
|
134
142
|
/**
|
|
135
143
|
* Post-process a standalone scaffold: replace placeholders, strip
|
|
136
144
|
* workspace:* deps, set up agent symlinks, etc.
|
|
@@ -147,7 +155,7 @@ export declare function detectWorkspace(startDir: string): {
|
|
|
147
155
|
} | null;
|
|
148
156
|
export { parseWorkspaceScope };
|
|
149
157
|
/** @internal — exported for E2E tests */
|
|
150
|
-
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getCorePackageVersion as _getCorePackageVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, startShapePromptOptions as _startShapePromptOptions, standaloneTemplatePromptOptions as _standaloneTemplatePromptOptions, parseCommunityTemplateSelection as _parseCommunityTemplateSelection, communityTemplateTrustMessage as _communityTemplateTrustMessage, communityTemplateTarballUrl as _communityTemplateTarballUrl, assertCommunityTemplateRoot as _assertCommunityTemplateRoot, assertSafeCommunityArchiveListing as _assertSafeCommunityArchiveListing, validateCommunityArchive as _validateCommunityArchive, resolveCommunityTemplateSource as _resolveCommunityTemplateSource, discoverCommunityWorkspaceApps as _discoverCommunityWorkspaceApps, normalizeCommunityWorkspaceAppDependencies as _normalizeCommunityWorkspaceAppDependencies, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, downloadGitHubSubdir as _downloadGitHubSubdir, findLocalTemplate as _findLocalTemplate, templateSourceName as _templateSourceName, normalizeTemplateName as _normalizeTemplateName, appTitleForScaffold as _appTitleForScaffold, replacePlaceholders as _replacePlaceholders, rewriteTrackingAppId as _rewriteTrackingAppId, rewriteAgentChatAppId as _rewriteAgentChatAppId, applyScaffoldIdentity as _applyScaffoldIdentity, fixWebManifestName as _fixWebManifestName, copyDir as _copyDir, localTemplateSourceKind as _localTemplateSourceKind, REPO as _REPO, TEMPLATES_DIR as _TEMPLATES_DIR, };
|
|
158
|
+
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, ensureGuardedScaffold as _ensureGuardedScaffold, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getCorePackageVersion as _getCorePackageVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, startShapePromptOptions as _startShapePromptOptions, standaloneTemplatePromptOptions as _standaloneTemplatePromptOptions, parseCommunityTemplateSelection as _parseCommunityTemplateSelection, communityTemplateTrustMessage as _communityTemplateTrustMessage, communityTemplateTarballUrl as _communityTemplateTarballUrl, assertCommunityTemplateRoot as _assertCommunityTemplateRoot, assertSafeCommunityArchiveListing as _assertSafeCommunityArchiveListing, validateCommunityArchive as _validateCommunityArchive, resolveCommunityTemplateSource as _resolveCommunityTemplateSource, discoverCommunityWorkspaceApps as _discoverCommunityWorkspaceApps, normalizeCommunityWorkspaceAppDependencies as _normalizeCommunityWorkspaceAppDependencies, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, downloadGitHubSubdir as _downloadGitHubSubdir, findLocalTemplate as _findLocalTemplate, templateSourceName as _templateSourceName, normalizeTemplateName as _normalizeTemplateName, appTitleForScaffold as _appTitleForScaffold, replacePlaceholders as _replacePlaceholders, rewriteTrackingAppId as _rewriteTrackingAppId, rewriteAgentChatAppId as _rewriteAgentChatAppId, applyScaffoldIdentity as _applyScaffoldIdentity, fixWebManifestName as _fixWebManifestName, copyDir as _copyDir, localTemplateSourceKind as _localTemplateSourceKind, REPO as _REPO, TEMPLATES_DIR as _TEMPLATES_DIR, };
|
|
151
159
|
declare function tarExtractArgs(tarPath: string, destDir: string, options?: {
|
|
152
160
|
skipAgentSymlinks?: boolean;
|
|
153
161
|
untrustedCommunityArchive?: boolean;
|
package/dist/cli/create.js
CHANGED
|
@@ -395,6 +395,7 @@ async function createWorkspaceInteractive(name, opts, clack) {
|
|
|
395
395
|
...resolution,
|
|
396
396
|
shape: "workspace",
|
|
397
397
|
});
|
|
398
|
+
ensureGuardedScaffold(appDir);
|
|
398
399
|
fixWebManifestName(appDir, appName, templateName, resolution.sourceIdentity);
|
|
399
400
|
rewriteNetlifyToml(appDir, appName, "workspace");
|
|
400
401
|
renameGitignore(appDir);
|
|
@@ -523,6 +524,7 @@ async function scaffoldWorkspaceRoot(targetDir, name) {
|
|
|
523
524
|
// Root-level agent instructions apply before an agent descends into an app.
|
|
524
525
|
linkWorkspaceRootSkills(targetDir);
|
|
525
526
|
setupAgentSymlinks(targetDir);
|
|
527
|
+
ensureGuardedScaffold(targetDir);
|
|
526
528
|
}
|
|
527
529
|
function linkWorkspaceRootSkills(targetDir) {
|
|
528
530
|
const sharedSkillsDir = path.join(targetDir, "packages", "shared", ".agents", "skills");
|
|
@@ -650,6 +652,7 @@ async function scaffoldOneAppIntoWorkspace(workspace, appName, templateName, cla
|
|
|
650
652
|
...resolution,
|
|
651
653
|
shape: "workspace",
|
|
652
654
|
});
|
|
655
|
+
ensureGuardedScaffold(appDir);
|
|
653
656
|
fixWebManifestName(appDir, appName, templateName, resolution.sourceIdentity);
|
|
654
657
|
rewriteNetlifyToml(appDir, appName, "workspace");
|
|
655
658
|
renameGitignore(appDir);
|
|
@@ -1266,6 +1269,95 @@ async function scaffoldRequiredPackages(templateNames, workspaceRoot) {
|
|
|
1266
1269
|
}
|
|
1267
1270
|
}
|
|
1268
1271
|
}
|
|
1272
|
+
const AGENT_NATIVE_DOCTOR = "agent-native doctor";
|
|
1273
|
+
const AGENT_NATIVE_DOCTOR_STRICT = `${AGENT_NATIVE_DOCTOR} --strict`;
|
|
1274
|
+
const GUARDED_VERIFICATION_MARKER = "Guarded verification";
|
|
1275
|
+
const GUARDED_VERIFICATION_GUIDANCE = "- Guarded verification: run `pnpm agent-native:doctor`; fix findings before done.\n";
|
|
1276
|
+
/**
|
|
1277
|
+
* Keep the portable guard contract attached to every app/workspace created by
|
|
1278
|
+
* the CLI, including community templates whose package.json was not authored
|
|
1279
|
+
* by this repository. The scanners stay versioned in @agent-native/core; a
|
|
1280
|
+
* generated project only receives the small command/config/instructions
|
|
1281
|
+
* surface needed to run them locally and in hosted builds.
|
|
1282
|
+
*/
|
|
1283
|
+
function ensureGuardedScaffold(appDir) {
|
|
1284
|
+
const packagePath = path.join(appDir, "package.json");
|
|
1285
|
+
if (!fs.existsSync(packagePath))
|
|
1286
|
+
return;
|
|
1287
|
+
const parsedPackage = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
|
1288
|
+
if (!parsedPackage ||
|
|
1289
|
+
typeof parsedPackage !== "object" ||
|
|
1290
|
+
Array.isArray(parsedPackage)) {
|
|
1291
|
+
throw new Error(`${packagePath} must contain a JSON object`);
|
|
1292
|
+
}
|
|
1293
|
+
const packageJson = parsedPackage;
|
|
1294
|
+
const existingScripts = packageJson.scripts;
|
|
1295
|
+
if (existingScripts !== undefined &&
|
|
1296
|
+
(!existingScripts ||
|
|
1297
|
+
typeof existingScripts !== "object" ||
|
|
1298
|
+
Array.isArray(existingScripts))) {
|
|
1299
|
+
throw new Error(`${packagePath} has an invalid scripts object`);
|
|
1300
|
+
}
|
|
1301
|
+
const scripts = existingScripts ?? {};
|
|
1302
|
+
// Keep an existing project-specific `doctor` script intact while providing
|
|
1303
|
+
// a collision-free framework entry point that every generated project has.
|
|
1304
|
+
const existingNativeDoctor = scripts["agent-native:doctor"];
|
|
1305
|
+
scripts["agent-native:doctor"] =
|
|
1306
|
+
typeof existingNativeDoctor === "string" &&
|
|
1307
|
+
existingNativeDoctor !== AGENT_NATIVE_DOCTOR &&
|
|
1308
|
+
!existingNativeDoctor.includes(AGENT_NATIVE_DOCTOR)
|
|
1309
|
+
? `${existingNativeDoctor} && ${AGENT_NATIVE_DOCTOR}`
|
|
1310
|
+
: AGENT_NATIVE_DOCTOR;
|
|
1311
|
+
if (typeof scripts.doctor !== "string") {
|
|
1312
|
+
scripts.doctor = AGENT_NATIVE_DOCTOR;
|
|
1313
|
+
}
|
|
1314
|
+
// Community templates may use vite/next/another build command instead of
|
|
1315
|
+
// `agent-native build`, so attach the strict check to the package lifecycle.
|
|
1316
|
+
// Agent-Native builds already run doctor and get strictness from the config.
|
|
1317
|
+
if (typeof scripts.build === "string" &&
|
|
1318
|
+
!/\bagent-native\s+build\b/.test(scripts.build) &&
|
|
1319
|
+
!String(scripts.prebuild ?? "").includes(AGENT_NATIVE_DOCTOR_STRICT)) {
|
|
1320
|
+
const existingPrebuild = typeof scripts.prebuild === "string" ? scripts.prebuild.trim() : "";
|
|
1321
|
+
scripts.prebuild = existingPrebuild
|
|
1322
|
+
? `${existingPrebuild} && ${AGENT_NATIVE_DOCTOR_STRICT}`
|
|
1323
|
+
: AGENT_NATIVE_DOCTOR_STRICT;
|
|
1324
|
+
}
|
|
1325
|
+
packageJson.scripts = scripts;
|
|
1326
|
+
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + "\n");
|
|
1327
|
+
const manifestPath = path.join(appDir, "agent-native.json");
|
|
1328
|
+
let manifest = {};
|
|
1329
|
+
if (fs.existsSync(manifestPath)) {
|
|
1330
|
+
const parsedManifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
1331
|
+
if (!parsedManifest ||
|
|
1332
|
+
typeof parsedManifest !== "object" ||
|
|
1333
|
+
Array.isArray(parsedManifest)) {
|
|
1334
|
+
throw new Error(`${manifestPath} must contain a JSON object`);
|
|
1335
|
+
}
|
|
1336
|
+
manifest = parsedManifest;
|
|
1337
|
+
}
|
|
1338
|
+
const doctor = manifest.doctor &&
|
|
1339
|
+
typeof manifest.doctor === "object" &&
|
|
1340
|
+
!Array.isArray(manifest.doctor)
|
|
1341
|
+
? manifest.doctor
|
|
1342
|
+
: {};
|
|
1343
|
+
// An explicit false remains an intentional, reviewable opt-out. Missing
|
|
1344
|
+
// configuration is strict so a hosted build cannot publish a finding.
|
|
1345
|
+
if (typeof doctor.failOnBuild !== "boolean")
|
|
1346
|
+
doctor.failOnBuild = true;
|
|
1347
|
+
manifest.doctor = doctor;
|
|
1348
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + "\n");
|
|
1349
|
+
const agentsPath = path.join(appDir, "AGENTS.md");
|
|
1350
|
+
if (fs.existsSync(agentsPath)) {
|
|
1351
|
+
const agents = fs.readFileSync(agentsPath, "utf-8");
|
|
1352
|
+
if (!agents.includes(GUARDED_VERIFICATION_MARKER)) {
|
|
1353
|
+
fs.writeFileSync(agentsPath, `${agents.trimEnd()}\n\n${GUARDED_VERIFICATION_GUIDANCE}`);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
else {
|
|
1357
|
+
fs.writeFileSync(agentsPath, `# Agent-Native project instructions\n\n${GUARDED_VERIFICATION_GUIDANCE}`);
|
|
1358
|
+
setupAgentSymlinks(appDir);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1269
1361
|
/**
|
|
1270
1362
|
* Post-process a standalone scaffold: replace placeholders, strip
|
|
1271
1363
|
* workspace:* deps, set up agent symlinks, etc.
|
|
@@ -1278,6 +1370,7 @@ function postProcessStandalone(name, targetDir, templateName, resolution) {
|
|
|
1278
1370
|
...resolution,
|
|
1279
1371
|
shape: "standalone",
|
|
1280
1372
|
});
|
|
1373
|
+
ensureGuardedScaffold(targetDir);
|
|
1281
1374
|
fixWebManifestName(targetDir, name, templateName, resolution?.sourceIdentity);
|
|
1282
1375
|
rewriteNetlifyToml(targetDir, name, "standalone");
|
|
1283
1376
|
for (const base of ["learnings"]) {
|
|
@@ -1562,7 +1655,7 @@ export function detectWorkspace(startDir) {
|
|
|
1562
1655
|
}
|
|
1563
1656
|
export { parseWorkspaceScope };
|
|
1564
1657
|
/** @internal — exported for E2E tests */
|
|
1565
|
-
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getCorePackageVersion as _getCorePackageVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, startShapePromptOptions as _startShapePromptOptions, standaloneTemplatePromptOptions as _standaloneTemplatePromptOptions, parseCommunityTemplateSelection as _parseCommunityTemplateSelection, communityTemplateTrustMessage as _communityTemplateTrustMessage, communityTemplateTarballUrl as _communityTemplateTarballUrl, assertCommunityTemplateRoot as _assertCommunityTemplateRoot, assertSafeCommunityArchiveListing as _assertSafeCommunityArchiveListing, validateCommunityArchive as _validateCommunityArchive, resolveCommunityTemplateSource as _resolveCommunityTemplateSource, discoverCommunityWorkspaceApps as _discoverCommunityWorkspaceApps, normalizeCommunityWorkspaceAppDependencies as _normalizeCommunityWorkspaceAppDependencies, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, downloadGitHubSubdir as _downloadGitHubSubdir, findLocalTemplate as _findLocalTemplate, templateSourceName as _templateSourceName, normalizeTemplateName as _normalizeTemplateName, appTitleForScaffold as _appTitleForScaffold, replacePlaceholders as _replacePlaceholders, rewriteTrackingAppId as _rewriteTrackingAppId, rewriteAgentChatAppId as _rewriteAgentChatAppId, applyScaffoldIdentity as _applyScaffoldIdentity, fixWebManifestName as _fixWebManifestName, copyDir as _copyDir, localTemplateSourceKind as _localTemplateSourceKind, REPO as _REPO, TEMPLATES_DIR as _TEMPLATES_DIR, };
|
|
1658
|
+
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, ensureGuardedScaffold as _ensureGuardedScaffold, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getCorePackageVersion as _getCorePackageVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, startShapePromptOptions as _startShapePromptOptions, standaloneTemplatePromptOptions as _standaloneTemplatePromptOptions, parseCommunityTemplateSelection as _parseCommunityTemplateSelection, communityTemplateTrustMessage as _communityTemplateTrustMessage, communityTemplateTarballUrl as _communityTemplateTarballUrl, assertCommunityTemplateRoot as _assertCommunityTemplateRoot, assertSafeCommunityArchiveListing as _assertSafeCommunityArchiveListing, validateCommunityArchive as _validateCommunityArchive, resolveCommunityTemplateSource as _resolveCommunityTemplateSource, discoverCommunityWorkspaceApps as _discoverCommunityWorkspaceApps, normalizeCommunityWorkspaceAppDependencies as _normalizeCommunityWorkspaceAppDependencies, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, downloadGitHubSubdir as _downloadGitHubSubdir, findLocalTemplate as _findLocalTemplate, templateSourceName as _templateSourceName, normalizeTemplateName as _normalizeTemplateName, appTitleForScaffold as _appTitleForScaffold, replacePlaceholders as _replacePlaceholders, rewriteTrackingAppId as _rewriteTrackingAppId, rewriteAgentChatAppId as _rewriteAgentChatAppId, applyScaffoldIdentity as _applyScaffoldIdentity, fixWebManifestName as _fixWebManifestName, copyDir as _copyDir, localTemplateSourceKind as _localTemplateSourceKind, REPO as _REPO, TEMPLATES_DIR as _TEMPLATES_DIR, };
|
|
1566
1659
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
1567
1660
|
* Download / copy helpers
|
|
1568
1661
|
* ───────────────────────────────────────────────────────────────────────── */
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MigrationManifest } from "../package-lifecycle/index.js";
|
|
2
|
-
export type GuardName = "no-drizzle-push" | "no-unscoped-credentials" | "no-unscoped-queries" | "no-env-credentials" | "db-tool-scoping" | "no-env-mutation" | "no-localhost-fallback" | "explicit-collab-access" | "migration-manifest";
|
|
2
|
+
export type GuardName = "no-drizzle-push" | "no-empty-migrations" | "no-unscoped-credentials" | "no-unscoped-queries" | "no-env-credentials" | "db-tool-scoping" | "no-env-mutation" | "no-localhost-fallback" | "explicit-collab-access" | "migration-manifest";
|
|
3
3
|
export declare const ALL_GUARD_NAMES: GuardName[];
|
|
4
4
|
export interface DoctorConfig {
|
|
5
5
|
disabledGuards: string[];
|
|
@@ -73,8 +73,8 @@ export declare function checkDisk(root: string, { measureReclaimable }?: {
|
|
|
73
73
|
}): DoctorDiskReport;
|
|
74
74
|
/** Pure escalation rule shared by the CLI (`--strict`) and the `build`
|
|
75
75
|
* pre-step (`--strict` / `agent-native.json` `doctor.failOnBuild`). Doctor
|
|
76
|
-
* findings
|
|
77
|
-
*
|
|
76
|
+
* findings fail builds by default; only an explicit `failOnBuild: false`
|
|
77
|
+
* opt-out can keep a build moving, while `strict` always fails. */
|
|
78
78
|
export declare function shouldFailBuild(hasFindings: boolean, opts: {
|
|
79
79
|
strict?: boolean;
|
|
80
80
|
failOnBuild?: boolean;
|
|
@@ -104,19 +104,16 @@ export interface DoctorBuildHookOptions {
|
|
|
104
104
|
strict?: boolean;
|
|
105
105
|
}
|
|
106
106
|
export interface DoctorBuildHookResult {
|
|
107
|
-
/** False
|
|
108
|
-
*
|
|
107
|
+
/** False when findings are present and the project has not explicitly
|
|
108
|
+
* opted out of the build gate. */
|
|
109
109
|
ok: boolean;
|
|
110
110
|
report: DoctorReport;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* `agent-native build`'s doctor pre-step. Always runs every enabled guard
|
|
114
|
-
* and always prints findings
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* "Where it runs" — the v1 doctor has zero field mileage against arbitrary
|
|
118
|
-
* app layouts, so shipping fail-by-default would risk breaking a first
|
|
119
|
-
* deploy on a false positive).
|
|
114
|
+
* and always prints findings to `io.err` — never silent. Findings fail the
|
|
115
|
+
* build by default; only an explicit `doctor.failOnBuild: false` opt-out can
|
|
116
|
+
* keep a build moving, while `--strict` overrides that opt-out.
|
|
120
117
|
*/
|
|
121
118
|
export declare function runDoctorBuildHook(options: DoctorBuildHookOptions, io?: DoctorIo): Promise<DoctorBuildHookResult>;
|
|
122
119
|
//# sourceMappingURL=doctor.d.ts.map
|
package/dist/cli/doctor.js
CHANGED
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import fs from "node:fs";
|
|
24
24
|
import path from "node:path";
|
|
25
|
-
import { scanDbToolScoping, scanDrizzlePush, scanEnvCredentials, scanEnvMutation, scanExplicitCollabAccess, scanLocalhostFallback, scanUnscopedCredentials, scanUnscopedQueries, } from "../guards/index.js";
|
|
25
|
+
import { scanDbToolScoping, scanDrizzlePush, scanEmptyMigrations, scanEnvCredentials, scanEnvMutation, scanExplicitCollabAccess, scanLocalhostFallback, scanUnscopedCredentials, scanUnscopedQueries, } from "../guards/index.js";
|
|
26
26
|
import { AGENT_NATIVE_UPGRADE_CODEMOD_COMMAND, scanDeprecatedImports, } from "../package-lifecycle/index.js";
|
|
27
27
|
import { formatBytes, scanCleanTargets } from "./clean.js";
|
|
28
28
|
export const ALL_GUARD_NAMES = [
|
|
29
29
|
"no-drizzle-push",
|
|
30
|
+
"no-empty-migrations",
|
|
30
31
|
"no-unscoped-credentials",
|
|
31
32
|
"no-unscoped-queries",
|
|
32
33
|
"no-env-credentials",
|
|
@@ -39,7 +40,7 @@ export const ALL_GUARD_NAMES = [
|
|
|
39
40
|
const DEFAULT_DOCTOR_CONFIG = {
|
|
40
41
|
disabledGuards: [],
|
|
41
42
|
dbToolScopingDenylist: {},
|
|
42
|
-
failOnBuild:
|
|
43
|
+
failOnBuild: true,
|
|
43
44
|
};
|
|
44
45
|
/**
|
|
45
46
|
* Reads the optional `"doctor"` key from `<root>/agent-native.json`. All
|
|
@@ -62,17 +63,21 @@ export function readDoctorConfig(root) {
|
|
|
62
63
|
typeof doctor.dbToolScopingDenylist === "object"
|
|
63
64
|
? Object.fromEntries(Object.entries(doctor.dbToolScopingDenylist).filter((entry) => typeof entry[1] === "string"))
|
|
64
65
|
: {};
|
|
65
|
-
const failOnBuild = doctor.failOnBuild ===
|
|
66
|
+
const failOnBuild = typeof doctor.failOnBuild === "boolean"
|
|
67
|
+
? doctor.failOnBuild
|
|
68
|
+
: DEFAULT_DOCTOR_CONFIG.failOnBuild;
|
|
66
69
|
return { disabledGuards, dbToolScopingDenylist, failOnBuild };
|
|
67
70
|
}
|
|
68
|
-
catch {
|
|
69
|
-
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw new Error(`Could not read Doctor configuration from ${manifestPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
75
|
function runGuard(name, root, config, migrationManifests) {
|
|
73
76
|
switch (name) {
|
|
74
77
|
case "no-drizzle-push":
|
|
75
78
|
return scanDrizzlePush({ root });
|
|
79
|
+
case "no-empty-migrations":
|
|
80
|
+
return scanEmptyMigrations({ root });
|
|
76
81
|
case "no-unscoped-credentials":
|
|
77
82
|
return scanUnscopedCredentials({ root });
|
|
78
83
|
case "no-unscoped-queries":
|
|
@@ -157,6 +162,53 @@ export function runDoctorScan(options) {
|
|
|
157
162
|
guardsRun: names,
|
|
158
163
|
};
|
|
159
164
|
}
|
|
165
|
+
function workspaceDoctorRoots(root) {
|
|
166
|
+
const packagePath = path.join(root, "package.json");
|
|
167
|
+
const appsDir = path.join(root, "apps");
|
|
168
|
+
if (!fs.existsSync(packagePath) || !fs.existsSync(appsDir))
|
|
169
|
+
return null;
|
|
170
|
+
try {
|
|
171
|
+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf-8"));
|
|
172
|
+
if (typeof packageJson?.["agent-native"]?.workspaceCore !== "string") {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
throw new Error(`Could not read workspace metadata from ${packagePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
178
|
+
}
|
|
179
|
+
const appRoots = fs
|
|
180
|
+
.readdirSync(appsDir, { withFileTypes: true })
|
|
181
|
+
.filter((entry) => entry.isDirectory())
|
|
182
|
+
.map((entry) => path.join(appsDir, entry.name))
|
|
183
|
+
.filter((appRoot) => fs.existsSync(path.join(appRoot, "package.json")))
|
|
184
|
+
.sort();
|
|
185
|
+
const scanRoots = [...appRoots];
|
|
186
|
+
const sharedRoot = path.join(root, "packages", "shared");
|
|
187
|
+
if (fs.existsSync(path.join(sharedRoot, "package.json"))) {
|
|
188
|
+
scanRoots.push(sharedRoot);
|
|
189
|
+
}
|
|
190
|
+
return { appRoots, scanRoots };
|
|
191
|
+
}
|
|
192
|
+
function prefixWorkspaceFindings(findings, root, appRoot) {
|
|
193
|
+
const prefix = path.relative(root, appRoot).replaceAll("\\", "/");
|
|
194
|
+
return findings.map((finding) => ({
|
|
195
|
+
...finding,
|
|
196
|
+
file: `${prefix}/${finding.file}`,
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
function runWorkspaceDoctorScan(root, scanRoots, only) {
|
|
200
|
+
const reports = scanRoots.map((scanRoot) => ({
|
|
201
|
+
scanRoot,
|
|
202
|
+
report: runDoctorScan({ root: scanRoot, only }),
|
|
203
|
+
}));
|
|
204
|
+
const guardsRun = Array.from(new Set(reports.flatMap(({ report }) => report.guardsRun)));
|
|
205
|
+
return {
|
|
206
|
+
ok: reports.every(({ report }) => report.ok),
|
|
207
|
+
findings: reports.flatMap(({ scanRoot, report }) => prefixWorkspaceFindings(report.findings, root, scanRoot)),
|
|
208
|
+
warnings: reports.flatMap(({ scanRoot, report }) => prefixWorkspaceFindings(report.warnings, root, scanRoot)),
|
|
209
|
+
guardsRun,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
160
212
|
/**
|
|
161
213
|
* Hosted app volumes are ~4.84 GB total, so anything under this is close
|
|
162
214
|
* enough to a stalled build or a failed write to be worth naming.
|
|
@@ -216,8 +268,8 @@ function formatDiskLine(disk) {
|
|
|
216
268
|
}
|
|
217
269
|
/** Pure escalation rule shared by the CLI (`--strict`) and the `build`
|
|
218
270
|
* pre-step (`--strict` / `agent-native.json` `doctor.failOnBuild`). Doctor
|
|
219
|
-
* findings
|
|
220
|
-
*
|
|
271
|
+
* findings fail builds by default; only an explicit `failOnBuild: false`
|
|
272
|
+
* opt-out can keep a build moving, while `strict` always fails. */
|
|
221
273
|
export function shouldFailBuild(hasFindings, opts) {
|
|
222
274
|
return hasFindings && Boolean(opts.strict || opts.failOnBuild);
|
|
223
275
|
}
|
|
@@ -225,9 +277,12 @@ const defaultIo = {
|
|
|
225
277
|
log: (message) => console.log(message),
|
|
226
278
|
err: (message) => console.error(message),
|
|
227
279
|
};
|
|
228
|
-
function formatDoctorHuman(report, root, disk) {
|
|
280
|
+
function formatDoctorHuman(report, root, disk, workspaceApps) {
|
|
229
281
|
const lines = [];
|
|
230
282
|
lines.push(`agent-native doctor: ${root}`);
|
|
283
|
+
if (workspaceApps) {
|
|
284
|
+
lines.push(`Workspace apps scanned: ${workspaceApps.join(", ") || "(none)"}`);
|
|
285
|
+
}
|
|
231
286
|
lines.push(`Guards run: ${report.guardsRun.join(", ") || "(none)"}`);
|
|
232
287
|
lines.push(formatDiskLine(disk));
|
|
233
288
|
if (report.findings.length === 0) {
|
|
@@ -293,7 +348,7 @@ export function printDoctorHelp(io = defaultIo) {
|
|
|
293
348
|
" agent-native doctor Scan app source for security-critical guard violations",
|
|
294
349
|
" agent-native doctor --json Machine-readable report: { ok, findings, warnings, guardsRun, disk, strict }",
|
|
295
350
|
" agent-native doctor --only <guard,guard> Run only the named guard(s)",
|
|
296
|
-
" agent-native doctor --strict
|
|
351
|
+
" agent-native doctor --strict Keep the build gate explicit when invoked by `agent-native build`",
|
|
297
352
|
" agent-native doctor --cwd <dir> Run against a project root other than the current directory",
|
|
298
353
|
" agent-native doctor --disk Also measure what `agent-native clean` would reclaim (scans every build cache)",
|
|
299
354
|
" agent-native doctor --fix Not implemented in this version",
|
|
@@ -307,9 +362,10 @@ export function printDoctorHelp(io = defaultIo) {
|
|
|
307
362
|
"`--disk` adds how much of it `agent-native clean` could give back. Disk",
|
|
308
363
|
"is advisory — it never changes the exit code.",
|
|
309
364
|
"",
|
|
310
|
-
"`agent-native build` runs doctor
|
|
311
|
-
|
|
312
|
-
'
|
|
365
|
+
"`agent-native build` runs doctor before the build and fails on findings",
|
|
366
|
+
'by default. Set `agent-native.json` to `{ "doctor": {',
|
|
367
|
+
'\"failOnBuild\": false } }` only with a reviewed reason; `--strict`',
|
|
368
|
+
"always keeps the gate enabled.",
|
|
313
369
|
"",
|
|
314
370
|
"For dependency-pin health (framework overrides/patches, stale",
|
|
315
371
|
"@agent-native/* pins), run `agent-native upgrade check` instead.",
|
|
@@ -348,7 +404,10 @@ export async function runDoctor(argv, io = defaultIo) {
|
|
|
348
404
|
return 2;
|
|
349
405
|
}
|
|
350
406
|
}
|
|
351
|
-
const
|
|
407
|
+
const workspaceRoots = workspaceDoctorRoots(root);
|
|
408
|
+
const report = workspaceRoots === null
|
|
409
|
+
? runDoctorScan({ root, only: opts.only })
|
|
410
|
+
: runWorkspaceDoctorScan(root, workspaceRoots.scanRoots, opts.only);
|
|
352
411
|
const disk = checkDisk(root, { measureReclaimable: Boolean(opts.disk) });
|
|
353
412
|
if (opts.json) {
|
|
354
413
|
// The machine-readable report always goes to stdout (io.log), whether
|
|
@@ -356,10 +415,19 @@ export async function runDoctor(argv, io = defaultIo) {
|
|
|
356
415
|
// report.json` in CI always captures the report. Only the usage/
|
|
357
416
|
// execution error payloads above (bad --cwd, unknown --only) go to
|
|
358
417
|
// stderr — those are diagnostics for exit code 2, not the report.
|
|
359
|
-
io.log(JSON.stringify({
|
|
418
|
+
io.log(JSON.stringify({
|
|
419
|
+
...report,
|
|
420
|
+
...(workspaceRoots === null
|
|
421
|
+
? {}
|
|
422
|
+
: {
|
|
423
|
+
workspaceApps: workspaceRoots.appRoots.map((appRoot) => path.relative(root, appRoot).replaceAll("\\", "/")),
|
|
424
|
+
}),
|
|
425
|
+
disk,
|
|
426
|
+
strict: Boolean(opts.strict),
|
|
427
|
+
}, null, 2));
|
|
360
428
|
}
|
|
361
429
|
else {
|
|
362
|
-
io.log(formatDoctorHuman(report, root, disk));
|
|
430
|
+
io.log(formatDoctorHuman(report, root, disk, workspaceRoots?.appRoots.map((appRoot) => path.relative(root, appRoot).replaceAll("\\", "/"))));
|
|
363
431
|
if (!report.ok) {
|
|
364
432
|
io.err("");
|
|
365
433
|
io.err("agent-native doctor found issues above. Fix them, or add a `// guard:allow-<check> — reason` opt-out with reviewer approval.");
|
|
@@ -369,19 +437,19 @@ export async function runDoctor(argv, io = defaultIo) {
|
|
|
369
437
|
}
|
|
370
438
|
/**
|
|
371
439
|
* `agent-native build`'s doctor pre-step. Always runs every enabled guard
|
|
372
|
-
* and always prints findings
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
* "Where it runs" — the v1 doctor has zero field mileage against arbitrary
|
|
376
|
-
* app layouts, so shipping fail-by-default would risk breaking a first
|
|
377
|
-
* deploy on a false positive).
|
|
440
|
+
* and always prints findings to `io.err` — never silent. Findings fail the
|
|
441
|
+
* build by default; only an explicit `doctor.failOnBuild: false` opt-out can
|
|
442
|
+
* keep a build moving, while `--strict` overrides that opt-out.
|
|
378
443
|
*/
|
|
379
444
|
export async function runDoctorBuildHook(options, io = defaultIo) {
|
|
380
445
|
const root = path.resolve(options.cwd);
|
|
381
446
|
const config = readDoctorConfig(root);
|
|
382
|
-
const
|
|
447
|
+
const workspaceRoots = workspaceDoctorRoots(root);
|
|
448
|
+
const report = workspaceRoots === null
|
|
449
|
+
? runDoctorScan({ root })
|
|
450
|
+
: runWorkspaceDoctorScan(root, workspaceRoots.scanRoots);
|
|
383
451
|
if (report.findings.length > 0) {
|
|
384
|
-
io.err(`\n[doctor] ${report.findings.length} finding(s) from \`agent-native doctor\` —
|
|
452
|
+
io.err(`\n[doctor] ${report.findings.length} finding(s) from \`agent-native doctor\` — fix them before the build can continue.`);
|
|
385
453
|
for (const f of report.findings) {
|
|
386
454
|
io.err(` [${f.guard}] ${f.file}:${f.line} — ${f.message}`);
|
|
387
455
|
}
|
|
@@ -397,7 +465,7 @@ export async function runDoctorBuildHook(options, io = defaultIo) {
|
|
|
397
465
|
failOnBuild: config.failOnBuild,
|
|
398
466
|
});
|
|
399
467
|
if (fail) {
|
|
400
|
-
io.err(`\n[doctor] Failing build: ${options.strict ? "--strict was passed" : "
|
|
468
|
+
io.err(`\n[doctor] Failing build: ${options.strict ? "--strict was passed" : "the doctor.failOnBuild gate is enabled (default: true)"}.`);
|
|
401
469
|
}
|
|
402
470
|
return { ok: !fail, report };
|
|
403
471
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -587,10 +587,9 @@ switch (command) {
|
|
|
587
587
|
// continuation only runs on success.
|
|
588
588
|
(async () => {
|
|
589
589
|
// Doctor pre-step: scans app source for the security-critical guard
|
|
590
|
-
// invariants (see `agent-native doctor --help`).
|
|
591
|
-
// default
|
|
592
|
-
//
|
|
593
|
-
// `agent-native.json` sets `{ "doctor": { "failOnBuild": true } }`.
|
|
590
|
+
// invariants (see `agent-native doctor --help`). Findings fail by
|
|
591
|
+
// default; only an explicit `doctor.failOnBuild: false` opt-out keeps
|
|
592
|
+
// a build moving, while `agent-native build --strict` always fails.
|
|
594
593
|
try {
|
|
595
594
|
const { runDoctorBuildHook } = await import("./doctor.js");
|
|
596
595
|
const hook = await runDoctorBuildHook({
|
|
@@ -603,7 +602,8 @@ switch (command) {
|
|
|
603
602
|
}
|
|
604
603
|
}
|
|
605
604
|
catch (err) {
|
|
606
|
-
console.
|
|
605
|
+
console.error(`[doctor] pre-build scan failed, so the build is blocked: ${err instanceof Error ? err.message : String(err)}`);
|
|
606
|
+
process.exit(1);
|
|
607
607
|
}
|
|
608
608
|
if (isReactRouterFramework()) {
|
|
609
609
|
clearAgentNativeNitroPresetMarker();
|
|
@@ -1096,6 +1096,7 @@ Usage:
|
|
|
1096
1096
|
Call another agent-native app over A2A
|
|
1097
1097
|
agent-native script <name> Run an action (deprecated alias for 'action')
|
|
1098
1098
|
agent-native typecheck Run TypeScript type checking
|
|
1099
|
+
agent-native doctor Scan app/workspace source for guard violations
|
|
1099
1100
|
agent-native create [name] Scaffold a new agent-native workspace with a
|
|
1100
1101
|
multi-select template picker. Use --standalone
|
|
1101
1102
|
for a single-app scaffold, or choose Community
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
export interface AgentAskPopoverProps {
|
|
2
3
|
prompt: string;
|
|
3
4
|
title?: string;
|
|
@@ -5,7 +6,8 @@ export interface AgentAskPopoverProps {
|
|
|
5
6
|
placeholder?: string;
|
|
6
7
|
context?: string;
|
|
7
8
|
className?: string;
|
|
9
|
+
icon?: ReactNode;
|
|
8
10
|
}
|
|
9
11
|
/** A low-emphasis entry point for asking the agent without losing the current surface. */
|
|
10
|
-
export declare function AgentAskPopover({ prompt, title, label, placeholder, context, className, }: AgentAskPopoverProps): import("react").JSX.Element;
|
|
12
|
+
export declare function AgentAskPopover({ prompt, title, label, placeholder, context, className, icon, }: AgentAskPopoverProps): import("react").JSX.Element;
|
|
11
13
|
//# sourceMappingURL=AgentAskPopover.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { Popover, PopoverContent, PopoverTrigger, } from "./components/ui/popove
|
|
|
6
6
|
import { PromptComposer } from "./composer/index.js";
|
|
7
7
|
import { useT } from "./i18n.js";
|
|
8
8
|
/** A low-emphasis entry point for asking the agent without losing the current surface. */
|
|
9
|
-
export function AgentAskPopover({ prompt, title, label, placeholder, context, className, }) {
|
|
9
|
+
export function AgentAskPopover({ prompt, title, label, placeholder, context, className, icon, }) {
|
|
10
10
|
const t = useT();
|
|
11
11
|
const [open, setOpen] = useState(false);
|
|
12
12
|
const handleSubmit = useCallback((text) => {
|
|
@@ -21,7 +21,7 @@ export function AgentAskPopover({ prompt, title, label, placeholder, context, cl
|
|
|
21
21
|
});
|
|
22
22
|
setOpen(false);
|
|
23
23
|
}, [context]);
|
|
24
|
-
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children:
|
|
24
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { type: "button", variant: "outline", size: "sm", className: className ?? "cursor-pointer", children: [icon, label ?? t("agentPanel.askAgent", { defaultValue: "Ask the agent" })] }) }), _jsxs(PopoverContent, { align: "end", sideOffset: 8, collisionPadding: 12, className: "z-[260] w-[calc(100vw-32px)] max-w-[420px] p-3", children: [_jsx("p", { className: "px-1 pb-2 text-sm font-semibold text-foreground", children: title ??
|
|
25
25
|
t("agentPanel.askAgentTitle", { defaultValue: "Ask the agent" }) }), _jsx(PromptComposer, { autoFocus: true, attachmentsEnabled: false, initialText: prompt, initialTextKey: prompt, layoutVariant: "compact", placeholder: placeholder ??
|
|
26
26
|
t("agentPanel.askAgentPlaceholder", {
|
|
27
27
|
defaultValue: "Tell the agent what you want to do…",
|