@seeka-labs/cli-apps 3.8.10 → 3.9.2

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.
Files changed (72) hide show
  1. package/README.md +286 -0
  2. package/dist/index.cjs +821 -612
  3. package/dist/init-template.zip +0 -0
  4. package/package.json +5 -3
  5. package/dist/ai-context/common/README.md +0 -110
  6. package/dist/ai-context/common/architecture/overview.md +0 -140
  7. package/dist/ai-context/common/guides/common-patterns.md +0 -471
  8. package/dist/ai-context/common/guides/data-flow.md +0 -455
  9. package/dist/ai-context/common/guides/getting-started.md +0 -349
  10. package/dist/ai-context/common/guides/testing.md +0 -592
  11. package/dist/ai-context/common/reference/cli-commands.md +0 -231
  12. package/dist/ai-context/common/reference/config-schema.md +0 -345
  13. package/dist/ai-context/common/reference/sdk-api.md +0 -445
  14. package/dist/ai-context/public/architecture/app-structure.md +0 -385
  15. package/dist/index.cjs.map +0 -7
  16. package/dist/init-template/.github/workflows/deploy-azurefunc.yml +0 -198
  17. package/dist/init-template/.gitlab-ci.yml +0 -67
  18. package/dist/init-template/.nvmrc +0 -1
  19. package/dist/init-template/AGENTS.md +0 -99
  20. package/dist/init-template/README.azurefunc.md +0 -238
  21. package/dist/init-template/app/.eslintrc.cjs +0 -13
  22. package/dist/init-template/app/browser/README.md +0 -1
  23. package/dist/init-template/app/browser/package.json +0 -36
  24. package/dist/init-template/app/browser/scripts/esbuild/build-browser-plugin.mjs +0 -130
  25. package/dist/init-template/app/browser/scripts/esbuild/plugins/importAsGlobals.mjs +0 -39
  26. package/dist/init-template/app/browser/src/browser.ts +0 -12
  27. package/dist/init-template/app/browser/src/plugin/index.ts +0 -61
  28. package/dist/init-template/app/browser/tsconfig.json +0 -34
  29. package/dist/init-template/app/lib/package.json +0 -46
  30. package/dist/init-template/app/lib/src/index.ts +0 -4
  31. package/dist/init-template/app/lib/src/models/index.ts +0 -29
  32. package/dist/init-template/app/lib/src/validation/index.ts +0 -14
  33. package/dist/init-template/app/lib/tsconfig.json +0 -22
  34. package/dist/init-template/app/server-azurefunc/.eslintrc.cjs +0 -4
  35. package/dist/init-template/app/server-azurefunc/.funcignore +0 -20
  36. package/dist/init-template/app/server-azurefunc/README.md +0 -105
  37. package/dist/init-template/app/server-azurefunc/host.json +0 -31
  38. package/dist/init-template/app/server-azurefunc/local.settings.template.json +0 -30
  39. package/dist/init-template/app/server-azurefunc/package.json +0 -68
  40. package/dist/init-template/app/server-azurefunc/scripts/build.mjs +0 -67
  41. package/dist/init-template/app/server-azurefunc/scripts/dev-queue-setup.js +0 -55
  42. package/dist/init-template/app/server-azurefunc/src/app/api/router.ts +0 -15
  43. package/dist/init-template/app/server-azurefunc/src/app/api/routes/getInstallationSettings.ts +0 -13
  44. package/dist/init-template/app/server-azurefunc/src/app/api/routes/setInstallationSettings.ts +0 -35
  45. package/dist/init-template/app/server-azurefunc/src/app/jobs/index.ts +0 -61
  46. package/dist/init-template/app/server-azurefunc/src/app/logging/index.ts +0 -4
  47. package/dist/init-template/app/server-azurefunc/src/app/models/index.ts +0 -12
  48. package/dist/init-template/app/server-azurefunc/src/app/services/activites.ts +0 -8
  49. package/dist/init-template/app/server-azurefunc/src/functions/healthCheck.ts +0 -19
  50. package/dist/init-template/app/server-azurefunc/src/functions/seekaAppWebhook.ts +0 -204
  51. package/dist/init-template/app/server-azurefunc/src/functions/trackActivityQueueHandler.ts +0 -48
  52. package/dist/init-template/app/server-azurefunc/src/functions/ui.ts +0 -49
  53. package/dist/init-template/app/server-azurefunc/tsconfig.json +0 -24
  54. package/dist/init-template/app/ui/README.md +0 -40
  55. package/dist/init-template/app/ui/index.html +0 -21
  56. package/dist/init-template/app/ui/package.json +0 -72
  57. package/dist/init-template/app/ui/public/favicon.ico +0 -0
  58. package/dist/init-template/app/ui/scripts/copy-output.mjs +0 -30
  59. package/dist/init-template/app/ui/src/App.tsx +0 -72
  60. package/dist/init-template/app/ui/src/assets/app-icon.svg +0 -1
  61. package/dist/init-template/app/ui/src/components/setup/steps/complete/index.tsx +0 -32
  62. package/dist/init-template/app/ui/src/components/setup/steps/first/index.tsx +0 -27
  63. package/dist/init-template/app/ui/src/components/setup/steps/index.tsx +0 -22
  64. package/dist/init-template/app/ui/src/components/setup/steps/second/index.tsx +0 -38
  65. package/dist/init-template/app/ui/src/index.tsx +0 -45
  66. package/dist/init-template/app/ui/src/routes/home/index.tsx +0 -21
  67. package/dist/init-template/app/ui/src/vite-env.d.ts +0 -13
  68. package/dist/init-template/app/ui/tsconfig.json +0 -35
  69. package/dist/init-template/app/ui/tsconfig.node.json +0 -10
  70. package/dist/init-template/app/ui/vite.config.mts +0 -48
  71. package/dist/init-template/package.json +0 -46
  72. package/dist/init-template/tsconfig.json +0 -24
@@ -1,198 +0,0 @@
1
- name: Deploy Azure Function
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - staging
8
- workflow_dispatch:
9
-
10
- permissions:
11
- id-token: write
12
- contents: read
13
- actions: read
14
-
15
- concurrency:
16
- group: deploy-${{ github.ref }}
17
- cancel-in-progress: false
18
-
19
- jobs:
20
- deploy:
21
- runs-on: ubuntu-latest
22
- environment: ${{ github.ref_name == 'main' && 'prod' || 'stag' }}
23
- env:
24
- # Use a project-local Yarn cache that we can persist between runs
25
- YARN_ENABLE_GLOBAL_CACHE: "false"
26
- YARN_CACHE_FOLDER: .yarn/cache
27
-
28
- # Constants / computed
29
- NODE_OPTIONS: --max-old-space-size=8192
30
- DEPLOY_ENVIRONMENT_NAME: ${{ github.ref_name == 'main' && 'prod' || 'stag' }}
31
-
32
- # Repo variable (plain text)
33
- AZURE_FUNC_RESOURCE_NAME: ${{ vars.AZURE_FUNC_RESOURCE_NAME }}
34
-
35
- # GitHub Environment variables (plain text)
36
- AZURE_FUNC_SLOT_NAME: ${{ vars.AZURE_FUNC_SLOT_NAME }}
37
- AZURE_FUNC_RESOURCE_GROUP_NAME: ${{ vars.AZURE_FUNC_RESOURCE_GROUP_NAME }}
38
- VITE_BASE_URL: ${{ vars.VITE_BASE_URL }}
39
- VITE_URLS_SEEKA_API_CORE: ${{ vars.VITE_URLS_SEEKA_API_CORE }}
40
- VITE_URLS_SEEKA_APP_CORE_ORIGIN: ${{ vars.VITE_URLS_SEEKA_APP_CORE_ORIGIN }}
41
- HOSTING_REGION_NAME: ${{ vars.HOSTING_REGION_NAME }}
42
- HOSTING_ENV_NAME: ${{ vars.HOSTING_ENV_NAME }}
43
- SEEKA_APP_SETTINGS: ${{ vars.SEEKA_APP_SETTINGS }}
44
-
45
- # GitHub Environment secrets
46
- SEEKA_APP_CFG_DATA_ENCRYPTION_KEY: ${{ secrets.SEEKA_APP_CFG_DATA_ENCRYPTION_KEY }}
47
- SEEKA_APP_CFG_OTEL_EXPORTER_OTLP_LOGS_HEADERS: ${{ secrets.SEEKA_APP_CFG_OTEL_EXPORTER_OTLP_LOGS_HEADERS }}
48
- SEEKA_APP_CFG_REDIS_CONNECTION_PASSWORD: ${{ secrets.SEEKA_APP_CFG_REDIS_CONNECTION_PASSWORD }}
49
- SEEKA_APP_CFG_SEEKA_APP_SECRET: ${{ secrets.SEEKA_APP_CFG_SEEKA_APP_SECRET }}
50
-
51
- steps:
52
- - name: Checkout
53
- uses: actions/checkout@v5
54
- with:
55
- fetch-depth: 0
56
-
57
- - name: Install Azure CLI
58
- run: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
59
-
60
- - name: Azure login (OIDC)
61
- uses: azure/login@v2
62
- with:
63
- client-id: ${{ vars.AZURE_CLIENT_ID_SEEKA_APP_DEPLOYMENT }}
64
- tenant-id: ${{ vars.AZURE_TENANT_ID }}
65
- subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
66
- # enable-AzPSSession: true
67
-
68
- - name: Enable Corepack
69
- run: corepack enable
70
-
71
- - name: Setup Node
72
- uses: actions/setup-node@v6
73
- with:
74
- cache-dependency-path: 'yarn.lock'
75
- node-version: 22
76
- cache: yarn
77
-
78
- - name: Restore Corepack/Yarn caches
79
- uses: actions/cache@v5
80
- with:
81
- path: |
82
- .corepack
83
- .yarn/cache
84
- node_modules
85
- key: ${{ runner.os }}-npm-${{ hashFiles('yarn.lock') }}
86
- restore-keys: |
87
- ${{ runner.os }}-npm-
88
-
89
- - name: Compute VITE_RELEASE_TAG
90
- shell: bash
91
- run: |
92
- set -euo pipefail
93
- echo "VITE_RELEASE_TAG=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
94
-
95
- - name: Install dependencies
96
- run: yarn install --immutable
97
-
98
- - name: Build
99
- run: yarn clean && yarn build
100
-
101
- - name: Update Azure Function App settings
102
- shell: bash
103
- env:
104
- GITHUB_TOKEN: ${{ github.token }}
105
- run: |
106
- set -euo pipefail
107
-
108
- seeka_basesettings_json="$(jq -n \
109
- --arg NODE_OPTIONS "$NODE_OPTIONS" \
110
- --arg VITE_RELEASE_TAG "$VITE_RELEASE_TAG" \
111
- --arg VITE_BASE_URL "$VITE_BASE_URL" \
112
- --arg VITE_URLS_SEEKA_API_CORE "$VITE_URLS_SEEKA_API_CORE" \
113
- --arg VITE_URLS_SEEKA_APP_CORE_ORIGIN "$VITE_URLS_SEEKA_APP_CORE_ORIGIN" \
114
- --arg HOSTING_REGION_NAME "$HOSTING_REGION_NAME" \
115
- --arg HOSTING_ENV_NAME "$HOSTING_ENV_NAME" \
116
- '{
117
- NODE_OPTIONS: $NODE_OPTIONS,
118
- VITE_RELEASE_TAG: $VITE_RELEASE_TAG,
119
- VITE_BASE_URL: $VITE_BASE_URL,
120
- VITE_URLS_SEEKA_API_CORE: $VITE_URLS_SEEKA_API_CORE,
121
- VITE_URLS_SEEKA_APP_CORE_ORIGIN: $VITE_URLS_SEEKA_APP_CORE_ORIGIN,
122
- HOSTING_REGION_NAME: $HOSTING_REGION_NAME,
123
- HOSTING_ENV_NAME: $HOSTING_ENV_NAME
124
- }')"
125
-
126
- seeka_appsettings_json="{}"
127
- if [[ -n "${SEEKA_APP_SETTINGS:-}" ]]; then
128
- seeka_appsettings_json="$(echo "$SEEKA_APP_SETTINGS" | jq -c '.')"
129
- fi
130
-
131
- # Read any explicitly-mapped SEEKA_APP_CFG_* environment variables
132
- seeka_app_cfg_json="$(jq -n '{}')"
133
- for name in $(compgen -e); do
134
- if [[ "$name" == SEEKA_APP_CFG_* ]]; then
135
- key="${name#SEEKA_APP_CFG_}"
136
- value="${!name}"
137
- seeka_app_cfg_json="$(jq -c --arg k "$key" --arg v "$value" '. + {($k): $v}' <<<"$seeka_app_cfg_json")"
138
- fi
139
- done
140
-
141
- final_json="$(jq -c -s 'reduce .[] as $i ({}; . * $i)' \
142
- <(echo "$seeka_basesettings_json") \
143
- <(echo "$seeka_appsettings_json") \
144
- <(echo "$seeka_app_cfg_json"))"
145
-
146
- echo "$final_json" > appsettings.json
147
-
148
- if [[ -n "${AZURE_FUNC_SLOT_NAME:-}" ]]; then
149
- az functionapp config appsettings set \
150
- --name "$AZURE_FUNC_RESOURCE_NAME" \
151
- --slot "$AZURE_FUNC_SLOT_NAME" \
152
- --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME" \
153
- --settings @appsettings.json \
154
- 1>/dev/null
155
- else
156
- az functionapp config appsettings set \
157
- --name "$AZURE_FUNC_RESOURCE_NAME" \
158
- --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME" \
159
- --settings @appsettings.json \
160
- 1>/dev/null
161
- fi
162
-
163
- - name: Populate app/server/node_modules for deployment
164
- run: |
165
- echo "nodeLinker: node-modules" > .yarnrc.yml
166
- echo -n "nmHoistingLimits: workspaces" >> .yarnrc.yml
167
- cd app/server
168
- yarn workspaces focus --production
169
-
170
- - name: Package Azure Function as zip
171
- working-directory: app/server
172
- run: |
173
- zip -r ../function-app.zip dist node_modules host.json package.json
174
-
175
- - name: Upload function app package as artifact
176
- uses: actions/upload-artifact@v4
177
- with:
178
- name: function-app-package
179
- path: app/function-app.zip
180
- retention-days: 30
181
-
182
- - name: Deploy Azure Function
183
- shell: bash
184
- run: |
185
- if [[ -n "${AZURE_FUNC_SLOT_NAME:-}" ]]; then
186
- az functionapp deployment source config-zip \
187
- --src "app/function-app.zip" \
188
- --build-remote false \
189
- --name "$AZURE_FUNC_RESOURCE_NAME" \
190
- --slot "$AZURE_FUNC_SLOT_NAME" \
191
- --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME"
192
- else
193
- az functionapp deployment source config-zip \
194
- --src "app/function-app.zip" \
195
- --build-remote false \
196
- --name "$AZURE_FUNC_RESOURCE_NAME" \
197
- --resource-group "$AZURE_FUNC_RESOURCE_GROUP_NAME"
198
- fi
@@ -1,67 +0,0 @@
1
- stages:
2
- - deploy
3
-
4
- variables:
5
- AZURE_FUNC_RESOURCE_NAME: seeka-app-example-app-name
6
- CI_DEBUG_TRACE: "true"
7
- NODE_OPTIONS: --max-old-space-size=8192
8
- VITE_RELEASE_TAG: "$CI_COMMIT_SHORT_SHA"
9
- VITE_BASE_URL: "/example-app-name/app/"
10
- VITE_URLS_SEEKA_API_CORE: "https://api.seeka.services"
11
- VITE_URLS_SEEKA_APP_CORE_ORIGIN: "https://seeka.app"
12
-
13
- workflow:
14
- rules:
15
- - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
16
- when: never
17
- - if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
18
- variables:
19
- HOSTING_REGION_NAME: auea
20
- HOSTING_ENV_NAME: prod
21
- when: always
22
- - if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
23
- variables:
24
- HOSTING_REGION_NAME: auea
25
- HOSTING_ENV_NAME: stag
26
- when: always
27
-
28
- azure_func:
29
- cache:
30
- policy: pull-push
31
- key: npmCache_app_example-app-name_$CI_COMMIT_BRANCH
32
- untracked: false
33
- paths:
34
- - node_modules/
35
- - app/server/node_modules/
36
- - .yarn/install-state.gz
37
- stage: deploy
38
- image: node:22
39
- artifacts:
40
- when: on_success
41
- exclude:
42
- - .git/**/*
43
- - .git/
44
- paths:
45
- - app/*/build/**
46
- - app/*/dist/**
47
- environment:
48
- name: $HOSTING_REGION_NAME/$HOSTING_ENV_NAME/apps
49
- before_script:
50
- - echo "installing azure cli"
51
- - curl -sL https://aka.ms/InstallAzureCLIDeb | bash
52
- - az --version
53
- - echo "installing Azure Functions Core Tools"
54
- - npm install -g azure-functions-core-tools@4 --unsafe-perm true
55
- - echo "logging in to azure"
56
- - az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
57
- - az account set --subscription "$AZURE_SUBSCRIPTION_ID"
58
- - corepack enable
59
- script:
60
- - echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT_NAME from branch $CI_COMMIT_BRANCH"
61
- - yarn install --immutable
62
- - yarn clean && yarn build
63
- - cd app/server
64
- - func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
65
- only:
66
- - main
67
- - staging
@@ -1 +0,0 @@
1
- 22
@@ -1,99 +0,0 @@
1
- # AI Context
2
-
3
- This repository is a Seeka app built with the Seeka SDK.
4
-
5
- ## For AI Assistants
6
-
7
- **Read `.seeka/ai/context/README.md` first** for comprehensive context on how to build and extend this app.
8
-
9
- The `.seeka/ai/context/` directory contains:
10
-
11
- - **Architecture documentation** - How Seeka apps are structured
12
- - **Implementation guides** - Patterns for extending the app
13
- - **SDK API reference** - Available SDK functions and types
14
- - **Example apps** - Reference implementations for common features
15
-
16
- ## Quick Reference
17
-
18
- | Task | Documentation |
19
- |------|---------------|
20
- | Understand app structure | `.seeka/ai/context/architecture/v3-structure.md` |
21
- | Add new features | `.seeka/ai/context/guides/getting-started.md` |
22
- | Common patterns | `.seeka/ai/context/guides/common-patterns.md` |
23
- | Data flow | `.seeka/ai/context/guides/data-flow.md` |
24
- | Testing | `.seeka/ai/context/guides/testing.md` |
25
- | SDK API | `.seeka/ai/context/reference/sdk-api.md` |
26
-
27
- ## Key Files in This App
28
-
29
- | File | Purpose |
30
- |------|---------|
31
- | `app/server/src/functions/seekaAppWebhook.ts` | Main webhook handler |
32
- | `app/lib/src/models/index.ts` | Shared data models |
33
- | `app/lib/src/validation/index.ts` | Settings validation |
34
- | `app/server/src/app/services/` | Business logic |
35
-
36
- ## App History
37
-
38
- **Maintain a running history summary in `.seeka/ai/app-history.md`**
39
-
40
- AI agents should keep a concise history of significant actions and changes made to the app. This helps maintain context across sessions and provides continuity when developers interact with the app.
41
-
42
- ### Guidelines
43
-
44
- - **Append to the history** after completing significant actions (e.g., adding features, fixing bugs, refactoring, configuration changes)
45
- - **Keep entries concise** - summarize what was done, not every detail
46
- - **Include timestamps** - use ISO 8601 format (YYYY-MM-DD)
47
- - **Group related changes** - combine small related changes into single entries
48
- - **Focus on outcomes** - describe what changed and why, not step-by-step implementation details
49
-
50
- ### History Format
51
-
52
- ```markdown
53
- ## [YYYY-MM-DD] Brief description of change
54
-
55
- - Key change or feature added
56
- - Files affected (if notable)
57
- - Any important decisions or trade-offs made
58
- ```
59
-
60
- ### Example Entry
61
-
62
- ```markdown
63
- ## [2024-03-15] Added customer lookup feature
64
-
65
- - Implemented customer search by email in plugin
66
- - Added new service method in `app/server/src/app/services/`
67
- - Integrated with existing webhook handler
68
- ```
69
-
70
- ### What to Record
71
-
72
- | Record | Skip |
73
- |--------|------|
74
- | New features added | Minor typo fixes |
75
- | Bug fixes | Formatting changes |
76
- | Configuration changes | Exploratory code reading |
77
- | Architecture decisions | Failed attempts (unless instructive) |
78
- | Integration changes | Routine dependency updates |
79
-
80
- ### Creating the History File
81
-
82
- If `.seeka/ai/app-history.md` doesn't exist, create it with this template:
83
-
84
- ```markdown
85
- # App History
86
-
87
- Running history of significant changes made to this Seeka app.
88
-
89
- ---
90
-
91
- ## [YYYY-MM-DD] Initial setup
92
-
93
- - App created from Seeka template
94
- - Initial configuration completed
95
- ```
96
-
97
- ## SDK Version
98
-
99
- Check `.seeka/ai/context/meta.json` for the SDK version used to generate the context.
@@ -1,238 +0,0 @@
1
- # @example-org-name/example-app-name
2
-
3
- A Seeka app built with the Seeka SDK, deployed to Azure Functions.
4
-
5
- ## Project Structure
6
-
7
- ```
8
- ├── .seeka/ # Seeka configuration directory
9
- ├── app/
10
- │ ├── browser/ # Browser extension plugin
11
- │ ├── lib/ # Shared library (models, validation)
12
- │ ├── server-azurefunc/ # Azure Functions server
13
- │ └── ui/ # UI components
14
- ├── .github/ # GitHub Actions workflows
15
- └── package.json # Root package configuration
16
- ```
17
-
18
- ## The `.seeka` Directory
19
-
20
- The `.seeka` directory contains configuration and context files for your Seeka app:
21
-
22
- | File/Directory | Purpose |
23
- |----------------|---------|
24
- | `init.app.seeka.cli.config.json` | App configuration (org name, app name, template type, SDK version) |
25
- | `init.app.secrets.seeka.cli.config.json` | Environment variables and secrets (gitignored) |
26
- | `ai/context/` | AI assistant context files for development guidance |
27
-
28
- ### AI Context
29
-
30
- The `.seeka/ai/context/` directory contains documentation to help AI assistants understand and extend your app:
31
-
32
- - **Architecture documentation** - How Seeka apps are structured
33
- - **Implementation guides** - Patterns for extending the app
34
- - **SDK API reference** - Available SDK functions and types
35
- - **Example apps** - Reference implementations for common features
36
-
37
- See `AGENTS.md` for AI assistant instructions.
38
-
39
- #### Hydrate Seeka AI context
40
- Below command will download the latest context files to `.seeka/ai/context/` directory to provide guidance for your app development.
41
-
42
- `npx @seeka-labs/cli-apps@latest ai context`
43
-
44
- ## Local Development
45
-
46
- ### Prerequisites
47
-
48
- - Node.js (see `.nvmrc` for version)
49
- - Yarn package manager
50
- - Azure Functions Core Tools ([installation guide](https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-typescript?pivots=nodejs-model-v4#configure-your-environment))
51
- - Docker (for Azure Storage emulation)
52
-
53
- ### First Run
54
-
55
- 1. Initialize the development environment:
56
- ```bash
57
- yarn dev:init
58
- ```
59
-
60
- 2. Start Azure Storage emulator (Azurite):
61
- ```bash
62
- docker run --name azurite -p 10000:10000 -p 10001:10001 -p 10002:10002 --detach mcr.microsoft.com/azure-storage/azurite
63
- ```
64
-
65
- 3. Configure `app/server-azurefunc/local.settings.json`:
66
- - Copy from `local.settings.template.json` if needed
67
- - Set `AzureWebJobsStorage`:
68
- - Standard: `UseDevelopmentStorage=true`
69
- - WSL: Use the connection string with your machine hostname (see server README)
70
-
71
- 4. Install Azure Storage Explorer and create required queues (see `app/server-azurefunc/src/lib/jobs/index.ts` for queue names)
72
-
73
- ### Running the App
74
-
75
- ```bash
76
- # Clean build
77
- yarn clean
78
-
79
- # Start server + browser plugin + UI
80
- yarn start:all
81
-
82
- # Start server + browser plugin only
83
- yarn start:server
84
- ```
85
-
86
- ### Debugging
87
-
88
- VSCode debugging with breakpoints is supported. This is tested on Linux/WSL. For Windows, use WSL with Ubuntu for debugger support.
89
-
90
- ### Live URLs (Ngrok)
91
-
92
- Expose your local app to the internet for testing:
93
-
94
- 1. Sign up for Ngrok and get your auth token
95
- 2. Configure Ngrok:
96
- ```bash
97
- yarn ngrok config add-authtoken [your-auth-token]
98
- ```
99
- 3. Start your app, then in a separate terminal:
100
- ```bash
101
- yarn tunnel
102
- ```
103
- 4. Use the exposed URL as your "Webhook URL" in Seeka app configuration
104
-
105
- ## Updating Packages
106
-
107
- ### Seeka SDK Packages
108
-
109
- ```bash
110
- yarn up "@seeka-labs/*" --mode=update-lockfile && yarn
111
- ```
112
-
113
- ### All Packages
114
-
115
- ```bash
116
- npx npm-check-updates@latest -i --workspaces --target minor && \
117
- npx npm-check-updates@latest -i --workspaces --target minor --dep peer && \
118
- npx npm-check-updates@latest -i --workspaces --target latest && \
119
- npx npm-check-updates@latest -i --workspaces --target latest --dep peer
120
- ```
121
-
122
- ## Included Example Functions
123
-
124
- | Function | File | Purpose |
125
- |----------|------|---------|
126
- | Seeka Webhook | `app/server-azurefunc/src/functions/seekaAppWebhook.ts` | Handles inbound webhooks from Seeka |
127
- | Queue Example | `app/server-azurefunc/src/functions/queueExample.ts` | Demonstrates Azure Storage queue processing |
128
- | Polling Example | `app/server-azurefunc/src/functions/pollingExample.ts` | Demonstrates scheduled function invocation |
129
-
130
- ## Invoking Functions
131
-
132
- ### Development
133
-
134
- ```bash
135
- # Scheduled/timer function
136
- curl -i -d '{"input": null}' -H "Content-Type: application/json" -X POST http://localhost:7072/admin/functions/pollingExample
137
- ```
138
-
139
- ### Azure Cloud
140
-
141
- ```bash
142
- curl -i -d '{"input": null}' -H "Content-Type: application/json" -H "x-functions-key: <key>" -X POST https://your-app.azurewebsites.net/admin/functions/pollingExample
143
- ```
144
-
145
- See [Azure docs](https://learn.microsoft.com/en-us/azure/azure-functions/functions-manually-run-non-http?tabs=azure-portal#get-the-master-key) for obtaining the functions master key.
146
-
147
- ## Logging
148
-
149
- Centralised logging is handled by [Winston](https://www.npmjs.com/package/winston), which is also used in the Seeka SDK packages.
150
-
151
- ### Seq (Optional)
152
-
153
- [Seq](https://datalust.co/seq) Winston transport is included for structured logging.
154
-
155
- 1. Run Seq locally:
156
- ```bash
157
- docker run --name seq -d --restart=always -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:2024.2
158
- ```
159
-
160
- 2. Set environment variable:
161
- - Standard: `LOGGING_SEQ_SERVERURL=http://localhost:5341`
162
- - WSL: `LOGGING_SEQ_SERVERURL=http://[YOUR-MACHINE-NAME].local:5341`
163
-
164
- ## State Management
165
-
166
- App installations and state are stored in Redis. See `app/server-azurefunc/src/lib/state/seeka/installations.ts` for the state management implementation.
167
-
168
- ### Upstash (Optional)
169
-
170
- [Upstash](https://upstash.com/) provides serverless Redis. Create a database and configure the connection strings in your environment. Choose a region closest to your Azure Functions region to minimize latency.
171
-
172
- ## Deployment
173
-
174
- ### Azure Functions Setup
175
-
176
- 1. Create Azure Function App in the portal:
177
- - **Function app name**: your-app-name
178
- - **Code or container image**: Code
179
- - **Runtime stack**: Node.js
180
- - **Version**: 22 LTS
181
- - **Region**: Closest to your Upstash database
182
- - **Operating system**: Linux
183
- - **Hosting**: Consumption
184
- - **Enable public access**: On
185
-
186
- 2. Set environment variables (reference `local.settings.json` values)
187
-
188
- 3. Enable CORS for all origins if your app receives browser calls
189
-
190
- 4. Deploy:
191
- ```bash
192
- yarn deploy
193
- ```
194
-
195
- ### GitHub Actions (CI/CD)
196
-
197
- This repo deploys to Azure Functions via `.github/workflows/deploy-azurefunc.yml` on pushes to `main` and `staging`.
198
-
199
- #### Required GitHub Secrets (Azure OIDC)
200
-
201
- Create an Azure federated credential for this repo/environment, then set:
202
-
203
- - `AZURE_CLIENT_ID`
204
- - `AZURE_TENANT_ID`
205
- - `AZURE_SUBSCRIPTION_ID`
206
-
207
- #### Required GitHub Variables
208
-
209
- **Repository variable:**
210
- - `AZURE_FUNC_RESOURCE_NAME`
211
-
212
- **Environment variables** (define in `prod` and `stag` environments):
213
- - `AZURE_FUNC_SLOT_NAME`
214
- - `VITE_BASE_URL`
215
- - `VITE_URLS_SEEKA_API_CORE`
216
- - `VITE_URLS_SEEKA_APP_CORE_ORIGIN`
217
- - `HOSTING_REGION_NAME`
218
- - `HOSTING_ENV_NAME`
219
- - `SEEKA_APP_SETTINGS` (JSON object string, e.g., `{ "SETTING1": "production" }`)
220
-
221
- #### Azure Service Principal Setup
222
-
223
- 1. Create app registration in Entra ID called `devops-github-seeka-developer-apps`
224
- 2. Assign roles to the service principal:
225
- - Resource group > IAM > Contributor
226
- - Subscription > IAM > Reader
227
- 3. Add federated identity: Certificates and Secrets > Federated Identity > Add credential > GitHub Actions
228
-
229
- ### GitLab CI/CD
230
-
231
- A GitLab CD pipeline is also included (`.gitlab-ci.yml`) for deployments triggered by Git pushes.
232
-
233
- ## References
234
-
235
- - [Azure Functions Documentation](https://learn.microsoft.com/en-us/azure/azure-functions/)
236
- - [Azurite Storage Emulator](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite)
237
- - [Azure Storage Queues Quickstart](https://learn.microsoft.com/en-us/azure/storage/queues/storage-quickstart-queues-nodejs)
238
- - [Seeka Developer Documentation](https://developers.seeka.co)
@@ -1,13 +0,0 @@
1
- /* eslint-env node */
2
- module.exports = {
3
- extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
4
- parser: '@typescript-eslint/parser',
5
- plugins: ['@typescript-eslint'],
6
- root: true,
7
- rules: {
8
- "@typescript-eslint/no-unused-vars": "warn",
9
- "@typescript-eslint/no-empty-function": "warn",
10
- "@typescript-eslint/no-empty-object-type": "warn",
11
- "@typescript-eslint/no-explicit-any": "warn"
12
- }
13
- };
@@ -1 +0,0 @@
1
- # `@example-org-name/example-app-name-browser`
@@ -1,36 +0,0 @@
1
- {
2
- "name": "@example-org-name/example-app-name-browser",
3
- "version": "3.8.10",
4
- "description": "Seeka app browser plugin example-app-name",
5
- "author": "Seeka company <support@seeka.co>",
6
- "private": true,
7
- "license": "MIT",
8
- "files": [
9
- "dist/"
10
- ],
11
- "scripts": {
12
- "lint": "eslint --fix src/ --ext .ts",
13
- "typecheck": "tsc --noEmit",
14
- "clean": "rimraf dist build package",
15
- "build": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin",
16
- "build:dev": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev",
17
- "watch": "node ./scripts/esbuild/build-browser-plugin.mjs seeka-browser-plugin ExampleAppAppConvergeSdkPlugin dev watch"
18
- },
19
- "dependencies": {
20
- "@example-org-name/example-app-name-lib": "workspace:*",
21
- "@seeka-labs/converge": "^1"
22
- },
23
- "devDependencies": {
24
- "@jgoz/esbuild-plugin-typecheck": "^4",
25
- "@types/lodash-es": "^4",
26
- "@types/node": "^22",
27
- "@typescript-eslint/eslint-plugin": "^8",
28
- "@typescript-eslint/parser": "^8",
29
- "esbuild": "^0",
30
- "eslint": "^9",
31
- "eslint-plugin-unused-imports": "^4",
32
- "rimraf": "^6",
33
- "typescript": "^5",
34
- "watch": "^1"
35
- }
36
- }