@bevel-software/platform-core-frontend 0.26.0 → 0.28.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/package.json +2 -2
- package/src/core/CoreAppShell.tsx +87 -25
- package/src/core/ProductName.tsx +49 -0
- package/src/core/__tests__/ProductName.test.tsx +46 -0
- package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
- package/src/core/__tests__/core-contributions.test.ts +16 -0
- package/src/core/core-contributions.ts +17 -0
- package/src/core/maker-url.ts +30 -0
- package/src/core/registry.ts +78 -1
- package/src/index.css +23 -5
- package/src/index.ts +5 -0
- package/src/lib/__tests__/latest-request.test.ts +48 -0
- package/src/lib/latest-request.ts +45 -0
- package/src/modules/access/__tests__/ManageAccessDialog.no-sso-invite.test.tsx +222 -0
- package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
- package/src/modules/access/api.ts +19 -3
- package/src/modules/access/components/ManageAccessDialog.tsx +61 -8
- package/src/modules/admin/__tests__/AdminRolesPage.fixed-admin.test.tsx +16 -1
- package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
- package/src/modules/admin/__tests__/UserAccountsPage.test.tsx +284 -39
- package/src/modules/admin/components/AdminRolesPage.tsx +13 -14
- package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
- package/src/modules/admin/components/UserAccountsPage.tsx +91 -107
- package/src/modules/admin/services/roles.api.ts +14 -1
- package/src/modules/auth/__tests__/LoginScreen.test.tsx +80 -5
- package/src/modules/auth/__tests__/sso-strict-probe.test.ts +66 -0
- package/src/modules/auth/components/LoginScreen.tsx +101 -73
- package/src/modules/auth/services/account.api.ts +59 -3
- package/src/modules/auth/services/sso.ts +30 -10
- package/src/modules/auth/state/use-sign-in-methods.ts +41 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
- package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
- package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
- package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
- package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
- package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
- package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
- package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
- package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
- package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
- package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
- package/src/modules/change-requests/services/change-requests.api.ts +15 -2
- package/src/modules/change-requests/utils/readFailure.ts +22 -0
- package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
- package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
- package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
- package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
- package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
- package/src/modules/embed/__tests__/mount.test.tsx +157 -0
- package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
- package/src/modules/embed/components/EmbedView.tsx +545 -0
- package/src/modules/embed/embed-config.ts +132 -0
- package/src/modules/embed/embed-host.ts +120 -0
- package/src/modules/embed/mount.tsx +80 -0
- package/src/modules/embed/services/embed-token.ts +22 -0
- package/src/modules/embed/services/embed.api.ts +158 -0
- package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
- package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
- package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
- package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
- package/src/modules/git/branch-delete-menu-item.tsx +24 -0
- package/src/modules/git/components/BranchSwitcher.tsx +29 -5
- package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
- package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
- package/src/modules/git/components/PullNeededBanner.tsx +15 -49
- package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
- package/src/modules/git/index.ts +15 -0
- package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
- package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
- package/src/modules/git/services/error-messages.ts +58 -1
- package/src/modules/git/services/pull-failure.ts +68 -0
- package/src/modules/git/state/branch-delete-confirm.ts +46 -0
- package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
- package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
- package/src/modules/layout/breakpoints.ts +8 -0
- package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
- package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
- package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
- package/src/modules/library/components/LibraryPage.tsx +22 -0
- package/src/modules/library/components/PluginExtras.tsx +23 -6
- package/src/modules/library/components/PluginPage.tsx +6 -1
- package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
- package/src/modules/library/services/plugins.api.ts +4 -1
- package/src/modules/library/state/plugins-revision.ts +28 -0
- package/src/modules/onboarding/__tests__/InviteButton.test.tsx +214 -0
- package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
- package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
- package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +164 -0
- package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1458 -0
- package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +811 -0
- package/src/modules/onboarding/__tests__/invite-emails.test.ts +247 -0
- package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
- package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
- package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
- package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
- package/src/modules/onboarding/components/GetStartedColumn.tsx +670 -0
- package/src/modules/onboarding/components/InviteButton.tsx +139 -0
- package/src/modules/onboarding/components/InviteDialog.tsx +741 -0
- package/src/modules/onboarding/components/RootLanding.tsx +8 -24
- package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
- package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
- package/src/modules/onboarding/first-page-prompt.ts +123 -0
- package/src/modules/onboarding/invite-emails.ts +313 -0
- package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
- package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
- package/src/modules/onboarding/state/agent-connection.ts +167 -0
- package/src/modules/onboarding/state/invite-dialog.context.ts +35 -0
- package/src/modules/onboarding/state/invite-dialog.tsx +39 -0
- package/src/modules/onboarding/state/onboarding.ts +133 -59
- package/src/modules/onboarding/state/starter-packs.ts +169 -0
- package/src/modules/settings/settings-nav-items.tsx +8 -3
- package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
- package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
- package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
- package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
- package/src/modules/setup/__tests__/setup.test.tsx +56 -15
- package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
- package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
- package/src/modules/setup/components/SetupGate.tsx +46 -1
- package/src/modules/setup/components/SetupScreen.tsx +81 -84
- package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
- package/src/modules/setup/services/setup.api.ts +3 -3
- package/src/modules/setup/utils/suggested-branch.ts +27 -0
- package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
- package/src/modules/toolbar/commands/actions.tsx +330 -0
- package/src/modules/toolbar/commands/command-menu.ts +44 -0
- package/src/modules/toolbar/commands/useCommandActions.ts +71 -0
- package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
- package/src/modules/toolbar/components/AppSwitcher.tsx +125 -22
- package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
- package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
- package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
- package/src/modules/toolbar/components/Toolbar.tsx +10 -0
- package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +230 -52
- package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
- package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +864 -0
- package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
- package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
- package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
- package/src/modules/toolbar/search/rank.ts +111 -0
- package/src/modules/toolbar/search/sources.ts +169 -0
- package/src/modules/workflow/hooks/useFileLock.ts +10 -7
- package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
- package/src/modules/workflow/services/lock.api.ts +17 -2
- package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
- package/src/modules/workspace/components/EditorTabs.tsx +39 -15
- package/src/modules/workspace/components/FileExplorer.tsx +39 -6
- package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
- package/src/modules/workspace/components/FileRoute.tsx +12 -7
- package/src/modules/workspace/components/FileViewer.tsx +271 -74
- package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
- package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
- package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +92 -4
- package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
- package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
- package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
- package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
- package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
- package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
- package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
- package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
- package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
- package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
- package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
- package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
- package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
- package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
- package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
- package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
- package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
- package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
- package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
- package/src/modules/workspace/components/renderers/index.ts +26 -0
- package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
- package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
- package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
- package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
- package/src/modules/workspace/hooks/__tests__/useCreatePage.test.ts +137 -0
- package/src/modules/workspace/hooks/__tests__/useKnowledgeWriteTarget.test.ts +302 -0
- package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
- package/src/modules/workspace/hooks/useCreatePage.ts +206 -0
- package/src/modules/workspace/hooks/useKnowledgeWriteTarget.ts +238 -0
- package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
- package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
- package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
- package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
- package/src/modules/workspace/routing/kb-routes.ts +66 -12
- package/src/modules/workspace/state/editable-page.ts +42 -0
- package/src/modules/workspace/state/workspace.context.ts +13 -4
- package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
- package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
- package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +16 -0
- package/src/modules/workspace/utils/display-file-name.ts +102 -0
- package/src/modules/workspace/utils/fileTree.ts +49 -14
- package/src/modules/workspace/utils/treeConfirm.ts +15 -0
- package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
- package/src/shared/components/ConfirmProvider.tsx +156 -0
- package/src/shared/components/Dialog.tsx +7 -0
- package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
- package/src/shared/components/confirm-context.ts +94 -0
- package/src/shared/components/index.ts +3 -0
- package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
- package/src/modules/onboarding/welcome-state.ts +0 -36
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
FIRST_PAGE_PROMPT,
|
|
4
|
+
chatGptPromptUrl,
|
|
5
|
+
claudePromptUrl,
|
|
6
|
+
firstPagePromptFor,
|
|
7
|
+
firstPagePromptInFolder,
|
|
8
|
+
firstPageRoute,
|
|
9
|
+
} from '../first-page-prompt';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The first-page prompt links: the prompt must arrive in the chat exactly as
|
|
13
|
+
* written — every space, colon, comma and apostrophe — and stay short enough
|
|
14
|
+
* to travel in a URL.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
describe('first-page prompt links', () => {
|
|
18
|
+
it('opens a new Claude chat with the prompt as its q parameter, round-tripping exactly', () => {
|
|
19
|
+
const url = new URL(claudePromptUrl(FIRST_PAGE_PROMPT));
|
|
20
|
+
expect(url.origin).toBe('https://claude.ai');
|
|
21
|
+
expect(url.pathname).toBe('/new');
|
|
22
|
+
expect(url.searchParams.get('q')).toBe(FIRST_PAGE_PROMPT);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('opens a new ChatGPT chat the same way', () => {
|
|
26
|
+
const url = new URL(chatGptPromptUrl(FIRST_PAGE_PROMPT));
|
|
27
|
+
expect(url.origin).toBe('https://chatgpt.com');
|
|
28
|
+
expect(url.pathname).toBe('/');
|
|
29
|
+
expect(url.searchParams.get('q')).toBe(FIRST_PAGE_PROMPT);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('percent-encodes everything a query string would otherwise read as structure', () => {
|
|
33
|
+
const tricky = "a & b = c? #1 + 100% it's";
|
|
34
|
+
const claude = claudePromptUrl(tricky);
|
|
35
|
+
expect(claude).toBe(
|
|
36
|
+
'https://claude.ai/new?q=a%20%26%20b%20%3D%20c%3F%20%231%20%2B%20100%25%20it\'s',
|
|
37
|
+
);
|
|
38
|
+
expect(claude).not.toContain(' ');
|
|
39
|
+
expect(new URL(claude).searchParams.get('q')).toBe(tricky);
|
|
40
|
+
expect(new URL(chatGptPromptUrl(tricky)).searchParams.get('q')).toBe(tricky);
|
|
41
|
+
// Nothing after a `#` would ever reach the chat — the fragment stays in the prompt.
|
|
42
|
+
expect(new URL(claude).hash).toBe('');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('keeps the prompt short enough for a link', () => {
|
|
46
|
+
expect(claudePromptUrl(FIRST_PAGE_PROMPT).length).toBeLessThan(400);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Which way in leads is read off the connected agent's name: a link only
|
|
52
|
+
* where the web chat it opens can actually reach the knowledge base.
|
|
53
|
+
*/
|
|
54
|
+
describe('firstPageRoute', () => {
|
|
55
|
+
it.each(['Claude', 'claude', ' CLAUDE ', 'claude.ai', 'Claude Desktop', 'claude-desktop'])(
|
|
56
|
+
'leads with Claude for %j',
|
|
57
|
+
(client) => {
|
|
58
|
+
expect(firstPageRoute(client, 'agent').primary).toBe('claude');
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
it.each(['ChatGPT', 'chatgpt', 'ChatGPT Connector'])('leads with ChatGPT for %j', (client) => {
|
|
63
|
+
expect(firstPageRoute(client, 'agent').primary).toBe('chatgpt');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it.each(['Claude Code', 'claude code', 'Cursor', 'Windsurf', 'Codex', 'My laptop key', 'Claudette'])(
|
|
67
|
+
'leads with Copy prompt for %j',
|
|
68
|
+
(client) => {
|
|
69
|
+
expect(firstPageRoute(client, 'agent')).toEqual({ primary: 'copy', agentName: client });
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
it('leads with Copy prompt for any agent on the local server, Claude included, naming the agent alone', () => {
|
|
74
|
+
expect(firstPageRoute('Claude Code · local server on LAPTOP-1', 'agent')).toEqual({
|
|
75
|
+
primary: 'copy',
|
|
76
|
+
agentName: 'Claude Code',
|
|
77
|
+
});
|
|
78
|
+
expect(firstPageRoute('Claude Desktop · local server on LAPTOP-1', 'agent')).toEqual({
|
|
79
|
+
primary: 'copy',
|
|
80
|
+
agentName: 'Claude Desktop',
|
|
81
|
+
});
|
|
82
|
+
expect(firstPageRoute('Claude · LOCAL SERVER ON mac.local', 'agent')).toEqual({ primary: 'copy', agentName: 'Claude' });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('has no name to offer for an unnamed or unknown agent, or none at all', () => {
|
|
86
|
+
expect(firstPageRoute('Unnamed agent', 'agent')).toEqual({ primary: 'copy', agentName: null });
|
|
87
|
+
expect(firstPageRoute('Unknown agent · local server on LAPTOP-1', 'agent')).toEqual({ primary: 'copy', agentName: null });
|
|
88
|
+
expect(firstPageRoute(undefined, 'agent')).toEqual({ primary: 'copy', agentName: null });
|
|
89
|
+
expect(firstPageRoute(null, 'agent')).toEqual({ primary: 'copy', agentName: null });
|
|
90
|
+
expect(firstPageRoute(' ', 'agent')).toEqual({ primary: 'copy', agentName: null });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it.each(['Claude', 'ChatGPT', 'ChatGPT CLI', 'Claude Desktop', 'My laptop key'])(
|
|
94
|
+
'leads with Copy prompt, naming no agent, for a connection key labelled %j',
|
|
95
|
+
(label) => {
|
|
96
|
+
// A key's label is free text: it names the key, not the app holding it.
|
|
97
|
+
expect(firstPageRoute(label, 'key')).toEqual({ primary: 'copy', agentName: null });
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
it('leads with Copy prompt when the answer does not say which kind of connection it is', () => {
|
|
102
|
+
expect(firstPageRoute('Claude', undefined)).toEqual({ primary: 'copy', agentName: null });
|
|
103
|
+
expect(firstPageRoute('ChatGPT', null)).toEqual({ primary: 'copy', agentName: null });
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
describe('firstPagePromptFor', () => {
|
|
108
|
+
it("is the chosen starter pack's own request, without the YAML block's trailing newline", () => {
|
|
109
|
+
expect(firstPagePromptFor({ firstPagePrompt: 'Fill in the Customers page.\n' })).toBe('Fill in the Customers page.');
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('is the generic request without a pack, or with one that has none to give', () => {
|
|
113
|
+
expect(firstPagePromptFor(null)).toBe(FIRST_PAGE_PROMPT);
|
|
114
|
+
expect(firstPagePromptFor({ firstPagePrompt: ' ' })).toBe(FIRST_PAGE_PROMPT);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The request, pointed at the folder New page would write in when that is
|
|
120
|
+
* below the top of Knowledge: an agent writing as the person must try where
|
|
121
|
+
* they may write.
|
|
122
|
+
*/
|
|
123
|
+
describe('the first-page request in a folder', () => {
|
|
124
|
+
it('names the folder in the generic request', () => {
|
|
125
|
+
expect(firstPagePromptInFolder(FIRST_PAGE_PROMPT, 'Sales')).toBe(
|
|
126
|
+
"Using our Hexis knowledge base, write a page in Knowledge/Sales about our company: what we do, who we work with, and our main products. Ask me for anything you don't know, then save it.",
|
|
127
|
+
);
|
|
128
|
+
expect(firstPagePromptInFolder(FIRST_PAGE_PROMPT, 'Sales/Team')).toContain('write a page in Knowledge/Sales/Team about');
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('leaves the request as it is at the top of Knowledge', () => {
|
|
132
|
+
expect(firstPagePromptInFolder(FIRST_PAGE_PROMPT, null)).toBe(FIRST_PAGE_PROMPT);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('adds the place to a starter pack’s request that does not say it', () => {
|
|
136
|
+
expect(firstPagePromptInFolder('Using our Hexis knowledge base, fill in the Customers page.', 'Sales')).toBe(
|
|
137
|
+
'Using our Hexis knowledge base, fill in the Customers page. Save it in Knowledge/Sales.',
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('points a built-in pack’s "page in Knowledge" at the folder, naming one place', () => {
|
|
142
|
+
const sales =
|
|
143
|
+
"Using our Hexis knowledge base, fill in the Customers page in Knowledge for our sales team: who buys from us. Ask me for anything you don't know, then save it.";
|
|
144
|
+
const out = firstPagePromptInFolder(sales, 'Sales');
|
|
145
|
+
expect(out).toBe(sales.replace('page in Knowledge for', 'page in Knowledge/Sales for'));
|
|
146
|
+
expect(out).not.toContain('Save it in');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('matches "in Knowledge" in any case, keeping the request’s own casing', () => {
|
|
150
|
+
expect(firstPagePromptInFolder('Write a page IN KNOWLEDGE about us.', 'Sales')).toBe(
|
|
151
|
+
'Write a page IN KNOWLEDGE/Sales about us.',
|
|
152
|
+
);
|
|
153
|
+
expect(firstPagePromptInFolder('Write a page in knowledge.', 'Sales')).toBe('Write a page in knowledge/Sales.');
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('does not mistake "knowledge base" or a name starting with Knowledge for the folder', () => {
|
|
157
|
+
expect(firstPagePromptInFolder('Write a page in Knowledge Management.', 'Sales')).toBe(
|
|
158
|
+
'Write a page in Knowledge Management. Save it in Knowledge/Sales.',
|
|
159
|
+
);
|
|
160
|
+
expect(firstPagePromptInFolder('Look in knowledge base, then write it in Knowledge.', 'Sales')).toBe(
|
|
161
|
+
'Look in knowledge base, then write it in Knowledge/Sales.',
|
|
162
|
+
);
|
|
163
|
+
});
|
|
164
|
+
});
|