@cognite/cli 0.6.0 → 0.7.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/README.md +6 -31
- package/_templates/app/new/config/vite.config.ts.ejs.t +4 -2
- package/_templates/app/new/root/app.json.ejs.t +3 -5
- package/_templates/app/new/root/manifest.json.ejs.t +9 -0
- package/_templates/app/new/root/package.json.ejs.t +4 -7
- package/_templates/app/new/src/App.test.tsx.ejs.t +1 -1
- package/_templates/app/new/src/App.tsx.ejs.t +1 -32
- package/_templates/app/new/src/main.tsx.ejs.t +0 -9
- package/_vendor/spec-kit/README.md +1 -1
- package/dist/auth/index.d.ts +51 -0
- package/dist/auth/index.js +1 -0
- package/dist/chunk-A5ASLC6T.js +7 -0
- package/dist/chunk-EI7MMDWY.js +1 -0
- package/dist/chunk-QGJ3VKXY.js +1 -0
- package/dist/cli/cli.js +88 -319
- package/dist/deploy/index.d.ts +113 -0
- package/dist/deploy/index.js +9 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/skills-GQ5TZKCM.js +1 -0
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/index.js +1 -0
- package/package.json +76 -5
- package/_templates/app/new/cursor/data-modeling.mdc.ejs.t +0 -1996
- package/_templates/app/new/cursor/mcp.json.ejs.t +0 -10
- package/_templates/app/new/cursor/rules.mdc.ejs.t +0 -10
- package/dist/chunk-GFMJ4MJZ.js +0 -8
- package/dist/skills-4R3OUI44.js +0 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @cognite/cli
|
|
2
2
|
|
|
3
|
-
Build and deploy React apps to [Cognite Data Fusion](https://docs.cognite.com/).
|
|
3
|
+
Build and deploy React apps to [Cognite Data Fusion](https://docs.cognite.com/). Apps built with this CLI run inside Cognite Flows — Cognite's app-hosting platform for embedding custom UIs in CDF.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
|
@@ -12,34 +12,10 @@ npx @cognite/cli apps create
|
|
|
12
12
|
|
|
13
13
|
This prompts for your app name, org, project, and cluster, then generates a fully configured React + TypeScript project.
|
|
14
14
|
|
|
15
|
-
> Top-level commands (`dune create`, `dune deploy`, `dune deploy:interactive`, `dune skills`) still work as deprecated aliases that print a one-line warning. Migrate to `dune apps <verb>`.
|
|
16
|
-
|
|
17
15
|
## Authentication
|
|
18
16
|
|
|
19
17
|
New apps created with `npx @cognite/cli apps create` depend on [`@cognite/app-sdk`](https://www.npmjs.com/package/@cognite/app-sdk) — **not `@cognite/cli`** — for auth and host integration. `@cognite/cli` is the CLI used to scaffold, develop, and deploy the app; the generated app itself talks to the Fusion app host via `@cognite/app-sdk`'s Comlink handshake. The template wires this up for you.
|
|
20
18
|
|
|
21
|
-
### Legacy apps (`--classic`)
|
|
22
|
-
|
|
23
|
-
Apps created with `--classic` use the older Files API path and wrap their root in `DuneAuthProvider` from `@cognite/dune/auth`:
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { DuneAuthProvider, useDune } from '@cognite/dune/auth';
|
|
27
|
-
|
|
28
|
-
function App() {
|
|
29
|
-
const { sdk, isLoading } = useDune();
|
|
30
|
-
if (isLoading) return <div>Loading...</div>;
|
|
31
|
-
return <MyApp sdk={sdk} />;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default function Root() {
|
|
35
|
-
return (
|
|
36
|
-
<DuneAuthProvider>
|
|
37
|
-
<App />
|
|
38
|
-
</DuneAuthProvider>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
19
|
## Deployment
|
|
44
20
|
|
|
45
21
|
Deploy interactively via browser OAuth:
|
|
@@ -58,7 +34,7 @@ Deployment targets are configured in `app.json` at the project root.
|
|
|
58
34
|
|
|
59
35
|
## AI skills
|
|
60
36
|
|
|
61
|
-
Skills guide your AI agent (Claude Code, Cursor, etc.) through
|
|
37
|
+
Skills guide your AI agent (Claude Code, Cursor, etc.) through CDF app-specific tasks like adding auth, building chat UIs, or reviewing code. They are pulled automatically on `npx @cognite/cli apps create` and can be synced later:
|
|
62
38
|
|
|
63
39
|
```bash
|
|
64
40
|
npx @cognite/cli apps skills pull
|
|
@@ -100,14 +76,14 @@ pnpm mock:deploy
|
|
|
100
76
|
|
|
101
77
|
| Env var | Purpose |
|
|
102
78
|
|---|---|
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
79
|
+
| `COGNITE_BASE_URL=http://localhost:9090` | Overrides `baseUrl` from `app.json` — all API calls go to the mock |
|
|
80
|
+
| `COGNITE_TOKEN=test-token` | Skips OAuth entirely — no real client secret needed |
|
|
105
81
|
|
|
106
82
|
To test against your own app instead of the fixture:
|
|
107
83
|
|
|
108
84
|
```bash
|
|
109
85
|
cd apps/my-app
|
|
110
|
-
|
|
86
|
+
COGNITE_TOKEN=test-token COGNITE_BASE_URL=http://localhost:9090 pnpm exec dune apps deploy --skip-build
|
|
111
87
|
```
|
|
112
88
|
|
|
113
89
|
#### Simulating error scenarios
|
|
@@ -132,7 +108,6 @@ MOCK_SCENARIO=403 pnpm mock:server
|
|
|
132
108
|
| `republish` | `ensureApp` recovers (409), then `uploadVersion` fails (409 — version already published) |
|
|
133
109
|
|
|
134
110
|
The mock server and MSW handlers live in `cli/testing/msw/`. The same handlers are used by the Vitest integration tests in `src/deploy/apphosting-deployer.msw.test.ts`.
|
|
135
|
-
|
|
136
111
|
## Maintenance
|
|
137
112
|
|
|
138
113
|
### Updating the spec-kit vendor snapshot
|
|
@@ -140,7 +115,7 @@ The mock server and MSW handlers live in `cli/testing/msw/`. The same handlers a
|
|
|
140
115
|
The AI skill commands under `_vendor/spec-kit/` are generated by [spec-kit](https://github.com/github/spec-kit) and checked in. To update to a new release, pass the target tag (requires [`uv`](https://docs.astral.sh/uv/), which provides `uvx`):
|
|
141
116
|
|
|
142
117
|
```bash
|
|
143
|
-
pnpm --filter @cognite/
|
|
118
|
+
pnpm --filter @cognite/cli refresh-spec-kit v0.9.0
|
|
144
119
|
```
|
|
145
120
|
|
|
146
121
|
The refresh script stages the generated commands, templates, and shell scripts before replacing `_vendor/spec-kit/`. Then review the diff under `_vendor/spec-kit/` and commit it.
|
|
@@ -3,7 +3,7 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>vite.config.ts'
|
|
|
3
3
|
---
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
|
|
6
|
-
import { fusionOpenPlugin } from '@cognite/
|
|
6
|
+
import { fusionOpenPlugin, manifestCspPlugin } from '@cognite/app-sdk/vite';
|
|
7
7
|
import tailwindcss from '@tailwindcss/vite';
|
|
8
8
|
import react from '@vitejs/plugin-react';
|
|
9
9
|
import { defineConfig } from 'vite';
|
|
@@ -11,7 +11,9 @@ import mkcert from 'vite-plugin-mkcert';
|
|
|
11
11
|
|
|
12
12
|
export default defineConfig({
|
|
13
13
|
base: './',
|
|
14
|
-
|
|
14
|
+
// manifestCspPlugin() must stay first — its middleware sets the
|
|
15
|
+
// Content-Security-Policy header before any HTML response is sent.
|
|
16
|
+
plugins: [manifestCspPlugin(), react(), mkcert(), fusionOpenPlugin(), tailwindcss()],
|
|
15
17
|
resolve: {
|
|
16
18
|
alias: {
|
|
17
19
|
'@': path.resolve(__dirname, './src'),
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>app.json'
|
|
3
3
|
---
|
|
4
4
|
{
|
|
5
|
-
"name":
|
|
6
|
-
"description":
|
|
5
|
+
"name": <%- JSON.stringify(displayName) %>,
|
|
6
|
+
"description": <%- JSON.stringify(description) %>,
|
|
7
7
|
"externalId": "<%= name %>",
|
|
8
8
|
"versionTag": "0.0.1",
|
|
9
|
-
<% if (infra === 'appsApi') { -%>
|
|
10
9
|
"infra": "appsApi",
|
|
11
|
-
<% } -%>
|
|
12
10
|
"deployments": [
|
|
13
11
|
{
|
|
14
12
|
"org": "<%= org %>",
|
|
@@ -16,7 +14,7 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>app.json'
|
|
|
16
14
|
"baseUrl": "<%= baseUrl %>",
|
|
17
15
|
"published": false,
|
|
18
16
|
"deployClientId": "",
|
|
19
|
-
"deploySecretName": "<%= org
|
|
17
|
+
"deploySecretName": "<%= (org + '_' + project + '_' + cluster).replace(/-/g, '_').toUpperCase() %>"
|
|
20
18
|
}
|
|
21
19
|
]
|
|
22
20
|
}
|
|
@@ -20,16 +20,13 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>package.json'
|
|
|
20
20
|
"test:ui": "vitest --ui",
|
|
21
21
|
"lint": "eslint . --ext .js,.mjs,.cjs,.ts,.tsx",
|
|
22
22
|
"lint:fix": "eslint . --fix --ext .js,.mjs,.cjs,.ts,.tsx",
|
|
23
|
-
"deploy": "npx @cognite/
|
|
24
|
-
"deploy-preview": "npx @cognite/
|
|
23
|
+
"deploy": "npx @cognite/cli@latest apps deploy --interactive --published",
|
|
24
|
+
"deploy-preview": "npx @cognite/cli@latest apps deploy --interactive"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@cognite/aura": "^0.1.7",
|
|
28
28
|
"@cognite/sdk": "^10.3.0",
|
|
29
|
-
"@cognite/
|
|
30
|
-
<% if (infra === 'appsApi') { -%>
|
|
31
|
-
"@cognite/app-sdk": "^0.3.0",
|
|
32
|
-
<% } -%>
|
|
29
|
+
"@cognite/app-sdk": "^0.4.0",
|
|
33
30
|
"@tabler/icons-react": "^3.35.0",
|
|
34
31
|
"@tanstack/react-query": "^5.90.10",
|
|
35
32
|
"clsx": "^2.1.1",
|
|
@@ -60,7 +57,7 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>package.json'
|
|
|
60
57
|
"tailwindcss": "^4.1.17",
|
|
61
58
|
"typescript": "^5.0.0",
|
|
62
59
|
"typescript-eslint": "^8.46.4",
|
|
63
|
-
"vite": "
|
|
60
|
+
"vite": "7.3.2",
|
|
64
61
|
"vite-plugin-mkcert": "^1.17.9",
|
|
65
62
|
"vitest": "^2.1.8"
|
|
66
63
|
}
|
|
@@ -40,6 +40,6 @@ describe('App', () => {
|
|
|
40
40
|
expect(screen.getByText('<%= org %>')).toBeInTheDocument();
|
|
41
41
|
expect(screen.getByText('<%= project %>')).toBeInTheDocument();
|
|
42
42
|
expect(screen.getAllByText(/SPEC\.md/).length).toBeGreaterThan(0);
|
|
43
|
-
expect(screen.getByText(/deploy
|
|
43
|
+
expect(screen.getByText(/apps deploy --interactive/)).toBeInTheDocument();
|
|
44
44
|
});
|
|
45
45
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/App.tsx'
|
|
3
3
|
---
|
|
4
|
-
<% if (infra === 'appsApi') { -%>
|
|
5
4
|
import { connectToHostApp } from '@cognite/app-sdk';
|
|
6
|
-
<% } -%>
|
|
7
5
|
import {
|
|
8
6
|
Alert,
|
|
9
7
|
AlertDescription,
|
|
@@ -19,13 +17,8 @@ import {
|
|
|
19
17
|
Loader,
|
|
20
18
|
Separator,
|
|
21
19
|
} from '@cognite/aura/components';
|
|
22
|
-
<% if (infra !== 'appsApi') { -%>
|
|
23
|
-
import { useDune } from '@cognite/dune';
|
|
24
|
-
<% } -%>
|
|
25
20
|
import { IconCaretUpDown, IconRocket } from '@tabler/icons-react';
|
|
26
|
-
<% if (infra === 'appsApi') { -%>
|
|
27
21
|
import { useEffect, useState } from 'react';
|
|
28
|
-
<% } -%>
|
|
29
22
|
|
|
30
23
|
import appConfig from '../app.json';
|
|
31
24
|
|
|
@@ -62,7 +55,7 @@ const CHECKLIST_STEPS = [
|
|
|
62
55
|
badge: 'Step 3',
|
|
63
56
|
body: (
|
|
64
57
|
<>
|
|
65
|
-
When ready to deploy, run <code>npx @cognite/
|
|
58
|
+
When ready to deploy, run <code>npx @cognite/cli apps deploy --interactive</code> in the terminal. Your app will
|
|
66
59
|
appear in the Fusion portal under Custom apps. Run the command again to redeploy new changes.
|
|
67
60
|
</>
|
|
68
61
|
),
|
|
@@ -70,7 +63,6 @@ const CHECKLIST_STEPS = [
|
|
|
70
63
|
] as const;
|
|
71
64
|
|
|
72
65
|
function App() {
|
|
73
|
-
<% if (infra === 'appsApi') { -%>
|
|
74
66
|
// Connect to the Fusion host via @cognite/app-sdk. The handshake is
|
|
75
67
|
// asynchronous — `project` is only populated after Comlink finishes
|
|
76
68
|
// exposing the host API, so we render a loader until then.
|
|
@@ -98,9 +90,6 @@ function App() {
|
|
|
98
90
|
cancelled = true;
|
|
99
91
|
};
|
|
100
92
|
}, []);
|
|
101
|
-
<% } else { -%>
|
|
102
|
-
const { sdk, isLoading, error } = useDune();
|
|
103
|
-
<% } -%>
|
|
104
93
|
|
|
105
94
|
if (isLoading) {
|
|
106
95
|
return (
|
|
@@ -121,7 +110,6 @@ function App() {
|
|
|
121
110
|
);
|
|
122
111
|
}
|
|
123
112
|
|
|
124
|
-
<% if (infra === 'appsApi') { -%>
|
|
125
113
|
if (error) {
|
|
126
114
|
return (
|
|
127
115
|
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
@@ -135,29 +123,10 @@ function App() {
|
|
|
135
123
|
</main>
|
|
136
124
|
);
|
|
137
125
|
}
|
|
138
|
-
<% } else { -%>
|
|
139
|
-
if (error) {
|
|
140
|
-
return (
|
|
141
|
-
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
142
|
-
<section className="mx-auto flex min-h-screen w-full max-w-lg flex-col justify-center p-4 sm:p-8">
|
|
143
|
-
<div className="mx-auto w-full max-w-sm">
|
|
144
|
-
<Alert>
|
|
145
|
-
<AlertDescription>{error}</AlertDescription>
|
|
146
|
-
</Alert>
|
|
147
|
-
</div>
|
|
148
|
-
</section>
|
|
149
|
-
</main>
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
<% } -%>
|
|
153
126
|
|
|
154
127
|
const deployment = appConfig.deployments?.[0];
|
|
155
128
|
const orgLabel = deployment?.org ?? '';
|
|
156
|
-
<% if (infra === 'appsApi') { -%>
|
|
157
129
|
const projectLabel = deployment?.project ?? project ?? '';
|
|
158
|
-
<% } else { -%>
|
|
159
|
-
const projectLabel = deployment?.project ?? sdk.project;
|
|
160
|
-
<% } -%>
|
|
161
130
|
|
|
162
131
|
return (
|
|
163
132
|
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/main.tsx'
|
|
3
3
|
---
|
|
4
|
-
<% if (infra !== 'appsApi') { -%>
|
|
5
|
-
import { DuneAuthProvider } from '@cognite/dune';
|
|
6
|
-
<% } -%>
|
|
7
4
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
5
|
import React from 'react';
|
|
9
6
|
import ReactDOM from 'react-dom/client';
|
|
@@ -24,13 +21,7 @@ const queryClient = new QueryClient({
|
|
|
24
21
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
25
22
|
<React.StrictMode>
|
|
26
23
|
<QueryClientProvider client={queryClient}>
|
|
27
|
-
<% if (infra === 'appsApi') { -%>
|
|
28
24
|
<App />
|
|
29
|
-
<% } else { -%>
|
|
30
|
-
<DuneAuthProvider>
|
|
31
|
-
<App />
|
|
32
|
-
</DuneAuthProvider>
|
|
33
|
-
<% } -%>
|
|
34
25
|
</QueryClientProvider>
|
|
35
26
|
</React.StrictMode>
|
|
36
27
|
);
|
|
@@ -13,7 +13,7 @@ Instead, Dune maintainers refresh spec-kit inside this monorepo, commit the sele
|
|
|
13
13
|
The refresh script is for Dune monorepo maintainers only:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
pnpm --filter @cognite/
|
|
16
|
+
pnpm --filter @cognite/cli refresh-spec-kit <tag>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
It requires `uv` locally, which provides `uvx`. That is acceptable for maintainers; it must not become a requirement for generated Dune apps.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { CogniteClient } from '@cognite/sdk';
|
|
5
|
+
|
|
6
|
+
interface AppSdkAuthProviderProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
loadingComponent?: ReactNode;
|
|
9
|
+
errorComponent?: (error: string) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Auth provider for apps running in the new Fusion app host (dune-app-host).
|
|
13
|
+
* Uses @cognite/app-sdk's Comlink handshake to connect to the host and obtain
|
|
14
|
+
* tokens on-demand. Exposes the same DuneContextValue ({ sdk, isLoading,
|
|
15
|
+
* error }) as DuneAuthProvider so useDune() works unchanged.
|
|
16
|
+
*/
|
|
17
|
+
declare const AppSdkAuthProvider: ({ children, loadingComponent, errorComponent, }: AppSdkAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
|
|
19
|
+
interface DuneContextValue {
|
|
20
|
+
sdk: CogniteClient;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
error?: string;
|
|
23
|
+
}
|
|
24
|
+
declare const DuneAuthProviderContext: react.Context<DuneContextValue>;
|
|
25
|
+
interface DuneAuthProviderProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
useIFrameAuthentication?: boolean;
|
|
28
|
+
useLocalConfiguration?: {
|
|
29
|
+
org: string;
|
|
30
|
+
project: string;
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
};
|
|
33
|
+
loadingComponent?: ReactNode;
|
|
34
|
+
errorComponent?: (error: string) => ReactNode;
|
|
35
|
+
}
|
|
36
|
+
declare const DuneAuthProvider: ({ children, loadingComponent, errorComponent, }: DuneAuthProviderProps) => react_jsx_runtime.JSX.Element;
|
|
37
|
+
|
|
38
|
+
declare const useDune: () => DuneContextValue;
|
|
39
|
+
|
|
40
|
+
interface CDFConfig {
|
|
41
|
+
project: string;
|
|
42
|
+
baseUrl: string;
|
|
43
|
+
clientId: string;
|
|
44
|
+
clientSecret: string;
|
|
45
|
+
appId?: string;
|
|
46
|
+
}
|
|
47
|
+
declare const getToken: (clientId: string, clientSecret: string) => Promise<any>;
|
|
48
|
+
declare const createCDFSDK: (config: CDFConfig) => Promise<CogniteClient>;
|
|
49
|
+
declare const EMPTY_SDK: CogniteClient;
|
|
50
|
+
|
|
51
|
+
export { AppSdkAuthProvider, type CDFConfig, DuneAuthProvider, DuneAuthProviderContext, type DuneAuthProviderProps, type DuneContextValue, EMPTY_SDK, createCDFSDK, getToken, useDune };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g}from"../chunk-QGJ3VKXY.js";import"../chunk-EI7MMDWY.js";export{f as AppSdkAuthProvider,e as DuneAuthProvider,d as DuneAuthProviderContext,c as EMPTY_SDK,b as createCDFSDK,a as getToken,g as useDune};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var r=Object.defineProperty;var s=(l,i)=>r(l,"name",{value:i,configurable:!0});import{execFileSync as c}from"child_process";import{createRequire as a}from"module";import{InvalidArgumentError as p}from"commander";var e="cognitedata/builder-skills",o=["claude-code","cursor"],t=o.flatMap(l=>["-a",l]),u=a(import.meta.url).resolve("skills/bin/cli.mjs");function n(l,i={}){c(process.execPath,[u,...l],{stdio:"inherit",cwd:process.cwd(),...i})}s(n,"execSkillsCli");function S(){return["add",e,...t,"--skill","*","-y"]}s(S,"pullAllArgs");function d(l){if(!/^[\w.-]+\/[\w.-]+$/.test(l))throw new p("Expected owner/repo format (e.g., cognitedata/builder-skills)");return l}s(d,"validateSource");function m(l){let i=["add",l.source,...t];return l.skill?i.push("--skill",l.skill):l.interactive||i.push("--skill","*","-y"),l.global&&i.push("--global"),i}s(m,"buildPullArgs");function k(l){console.log(`\u{1F504} Pulling skills from ${l.source}...`),n(m(l)),console.log(`
|
|
2
|
+
\u2705 Skills pulled successfully`)}s(k,"handlePull");function P(l){let i=l.command("skills").summary("Manage AI agent skills for your app").description(`Manage AI agent skills for your app.
|
|
3
|
+
Supports: ${o.join(", ")}`).addHelpText("after",`
|
|
4
|
+
Examples:
|
|
5
|
+
npx @cognite/cli apps skills pull Pull all skills
|
|
6
|
+
npx @cognite/cli apps skills pull --skill create-client-tool Pull a specific skill
|
|
7
|
+
npx @cognite/cli apps skills list List installed skills`);return i.command("pull").description("Pull all skills into your project").option("--source <owner/repo>","Skills repository",d,e).option("--skill <name>","Pull a specific skill by name").option("-i, --interactive","Interactively select which skills to install",!1).option("--global","Install skills globally",!1).action(k),i.command("list").description("List installed skills").action(()=>{n(["list"])}),i}s(P,"registerSkillsCommand");export{s as a,n as b,S as c,m as d,P as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:!0});export{d as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-EI7MMDWY.js";import{connectToHostApp as b}from"@cognite/app-sdk";import{CogniteClient as U}from"@cognite/sdk";import{useEffect as N,useState as v}from"react";import{CogniteClient as R}from"@cognite/sdk";import{createContext as I,useEffect as L,useState as P}from"react";import{CogniteClient as A}from"@cognite/sdk";var D=t(async(n,e)=>{let o=`Basic ${btoa(`${n}:${e}`)}`;return(await(await fetch("https://auth.cognite.com/oauth2/token",{method:"POST",headers:{Authorization:o,"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"client_credentials"})})).json()).access_token},"getToken"),T=t(async n=>{let{project:e,baseUrl:o,clientId:r,clientSecret:d,appId:c="cdf-authentication-package"}=n;if(!e||!o||!r||!d)throw new Error("Missing required configuration. Please provide: project, baseUrl, clientId, clientSecret");let u=new A({appId:c,project:e,baseUrl:o,oidcTokenProvider:t(async()=>await D(r,d),"oidcTokenProvider")});return await u.authenticate(),u},"createCDFSDK"),p=new A({appId:"cdf-authentication-package",project:"",oidcTokenProvider:t(async()=>"","oidcTokenProvider")}),E=t(()=>{console.log("\u{1F511} Requesting credentials from parent..."),window.parent&&window.parent!==window&&window.parent.postMessage({type:"REQUEST_CREDENTIALS"},"*")},"requestCredentials"),S=t(n=>{if(n.data?.type==="PROVIDE_CREDENTIALS"&&n.data?.credentials){let e=n.data.credentials;if(e.token&&e.baseUrl&&e.project)return console.log("\u{1F389} useCredentials received credentials:",{hasToken:!!e.token,tokenLength:e.token?.length||0,project:e.project,baseUrl:e.baseUrl}),e}},"handleCredentialsResponse");import{Fragment as w,jsx as l,jsxs as x}from"react/jsx-runtime";var g=I({sdk:p,isLoading:!1}),y=t(({children:n,loadingComponent:e=l("div",{children:"Loading CDF authentication..."}),errorComponent:o=t(r=>x("div",{children:["Authentication error: ",r]}),"errorComponent")})=>l(_,{loadingComponent:e,errorComponent:o,children:n}),"DuneAuthProvider"),_=t(({children:n,loadingComponent:e=l("div",{children:"Loading CDF authentication..."}),errorComponent:o=t(r=>x("div",{children:["Authentication error: ",r]}),"errorComponent")})=>{let[r,d]=P(!0),[c,u]=P(p),[s]=P();return L(()=>{E();let f=t(async i=>{console.log("\u{1F50D} Handling message from Fusion");let a=S(i);if(!a)return;let h=new R({appId:"dune-app",project:a.project,baseUrl:a.baseUrl,oidcTokenProvider:t(async()=>a.token,"oidcTokenProvider")});await h.authenticate(),u(h),d(!1)},"handleMessage");return console.log("\u{1F50D} Adding message listener"),window.addEventListener("message",f),()=>window.removeEventListener("message",f)},[]),console.log("\u{1F50D} CDFIframeAuthenticationInnerProvider",c,r,s),s&&o?l(w,{children:o(s)}):r&&e?l(w,{children:e}):l(g.Provider,{value:{sdk:c,isLoading:r,error:s},children:n})},"FusionIframeAuthenticationInnerProvider");import{Fragment as k,jsx as C,jsxs as j}from"react/jsx-runtime";var F=t(({children:n,loadingComponent:e=C("div",{children:"Loading CDF authentication..."}),errorComponent:o=t(r=>j("div",{children:["Authentication error: ",r]}),"errorComponent")})=>{let[r,d]=v(p),[c,u]=v(!0),[s,f]=v();return N(()=>{b().then(async({api:i})=>{let[a,h]=await Promise.all([i.getProject(),i.getBaseUrl()]),m=new U({appId:"dune-app",project:a,baseUrl:h,oidcTokenProvider:t(async()=>i.getAccessToken(),"oidcTokenProvider")});await m.authenticate(),d(m),f(void 0)}).catch(i=>{let a=i instanceof Error?i.message:String(i);f(a)}).finally(()=>{u(!1)})},[]),s&&o?C(k,{children:o(s)}):c&&e?C(k,{children:e}):C(g.Provider,{value:{sdk:r,isLoading:c,error:s},children:n})},"AppSdkAuthProvider");import{useContext as M}from"react";var Y=t(()=>{let n=M(g);if(!n)throw new Error("useDune must be used within a DuneAuthProvider");return n},"useDune");export{D as a,T as b,p as c,g as d,y as e,F as f,Y as g};
|