mithai 0.12.0__tar.gz

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 (195) hide show
  1. mithai-0.12.0/.dockerignore +23 -0
  2. mithai-0.12.0/.github/ISSUE_TEMPLATE/bug_report.yml +31 -0
  3. mithai-0.12.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. mithai-0.12.0/.github/ISSUE_TEMPLATE/feature_request.yml +23 -0
  5. mithai-0.12.0/.github/ISSUE_TEMPLATE/security.md +9 -0
  6. mithai-0.12.0/.github/PULL_REQUEST_TEMPLATE.md +8 -0
  7. mithai-0.12.0/.github/dependabot.yml +10 -0
  8. mithai-0.12.0/.github/workflows/ci.yml +65 -0
  9. mithai-0.12.0/.github/workflows/docs.yml +50 -0
  10. mithai-0.12.0/.github/workflows/promote-stable.yml +87 -0
  11. mithai-0.12.0/.github/workflows/release.yml +311 -0
  12. mithai-0.12.0/.gitignore +31 -0
  13. mithai-0.12.0/AUTHORS +11 -0
  14. mithai-0.12.0/CHANGELOG.md +9 -0
  15. mithai-0.12.0/CLAUDE.md +93 -0
  16. mithai-0.12.0/CODE_OF_CONDUCT.md +16 -0
  17. mithai-0.12.0/CONTRIBUTING.md +38 -0
  18. mithai-0.12.0/LICENSE +190 -0
  19. mithai-0.12.0/Makefile +55 -0
  20. mithai-0.12.0/PKG-INFO +358 -0
  21. mithai-0.12.0/README.md +294 -0
  22. mithai-0.12.0/SECURITY.md +24 -0
  23. mithai-0.12.0/config.single-agent.yaml +117 -0
  24. mithai-0.12.0/config.yaml +132 -0
  25. mithai-0.12.0/deploy/.dockerignore +19 -0
  26. mithai-0.12.0/deploy/Dockerfile +46 -0
  27. mithai-0.12.0/deploy/helm/mithai/Chart.yaml +16 -0
  28. mithai-0.12.0/deploy/helm/mithai/templates/NOTES.txt +35 -0
  29. mithai-0.12.0/deploy/helm/mithai/templates/_helpers.tpl +65 -0
  30. mithai-0.12.0/deploy/helm/mithai/templates/clusterrole-operator.yaml +28 -0
  31. mithai-0.12.0/deploy/helm/mithai/templates/clusterrole-reader.yaml +51 -0
  32. mithai-0.12.0/deploy/helm/mithai/templates/clusterrolebinding.yaml +33 -0
  33. mithai-0.12.0/deploy/helm/mithai/templates/configmap.yaml +94 -0
  34. mithai-0.12.0/deploy/helm/mithai/templates/deployment.yaml +75 -0
  35. mithai-0.12.0/deploy/helm/mithai/templates/ingress.yaml +42 -0
  36. mithai-0.12.0/deploy/helm/mithai/templates/namespace.yaml +8 -0
  37. mithai-0.12.0/deploy/helm/mithai/templates/secret.yaml +27 -0
  38. mithai-0.12.0/deploy/helm/mithai/templates/service.yaml +18 -0
  39. mithai-0.12.0/deploy/helm/mithai/templates/serviceaccount.yaml +13 -0
  40. mithai-0.12.0/deploy/helm/mithai/values.yaml +240 -0
  41. mithai-0.12.0/docs/concepts.md +471 -0
  42. mithai-0.12.0/docs/configuration.md +446 -0
  43. mithai-0.12.0/docs/deployment.md +472 -0
  44. mithai-0.12.0/docs/examples.md +429 -0
  45. mithai-0.12.0/docs/getting-started.md +251 -0
  46. mithai-0.12.0/docs/index.md +95 -0
  47. mithai-0.12.0/docs/security.md +205 -0
  48. mithai-0.12.0/docs/skills-reference.md +435 -0
  49. mithai-0.12.0/docs/slack-manifest.yaml +49 -0
  50. mithai-0.12.0/docs/solutions/integration-issues/orphaned-tool-use-blocks-on-max-tokens.md +93 -0
  51. mithai-0.12.0/docs/testing.md +509 -0
  52. mithai-0.12.0/docs/troubleshooting.md +709 -0
  53. mithai-0.12.0/docs/your-first-skill.md +619 -0
  54. mithai-0.12.0/docs-site/astro.config.mjs +63 -0
  55. mithai-0.12.0/docs-site/migrate.py +119 -0
  56. mithai-0.12.0/docs-site/package-lock.json +6762 -0
  57. mithai-0.12.0/docs-site/package.json +15 -0
  58. mithai-0.12.0/docs-site/public/_routes.json +5 -0
  59. mithai-0.12.0/docs-site/public/slack-manifest.yaml +49 -0
  60. mithai-0.12.0/docs-site/src/assets/logo-dark.svg +3 -0
  61. mithai-0.12.0/docs-site/src/assets/logo-light.svg +3 -0
  62. mithai-0.12.0/docs-site/src/content.config.ts +7 -0
  63. mithai-0.12.0/docs-site/src/styles/custom.css +24 -0
  64. mithai-0.12.0/docs-site/tsconfig.json +3 -0
  65. mithai-0.12.0/install.sh +117 -0
  66. mithai-0.12.0/mithai.spec +227 -0
  67. mithai-0.12.0/pyproject.toml +89 -0
  68. mithai-0.12.0/skills/http_checker/prompt.md +2 -0
  69. mithai-0.12.0/skills/http_checker/tools.py +52 -0
  70. mithai-0.12.0/skills/kubernetes/prompt.md +13 -0
  71. mithai-0.12.0/skills/kubernetes/tools.py +294 -0
  72. mithai-0.12.0/skills/memory/prompt.md +20 -0
  73. mithai-0.12.0/skills/memory/tools.py +92 -0
  74. mithai-0.12.0/skills/scheduling/prompt.md +29 -0
  75. mithai-0.12.0/skills/scheduling/tools.py +406 -0
  76. mithai-0.12.0/skills/sessions/prompt.md +3 -0
  77. mithai-0.12.0/skills/sessions/tools.py +77 -0
  78. mithai-0.12.0/skills/shell/prompt.md +4 -0
  79. mithai-0.12.0/skills/shell/tools.py +100 -0
  80. mithai-0.12.0/src/mithai/__init__.py +49 -0
  81. mithai-0.12.0/src/mithai/__main__.py +5 -0
  82. mithai-0.12.0/src/mithai/adapters/__init__.py +0 -0
  83. mithai-0.12.0/src/mithai/adapters/api.py +39 -0
  84. mithai-0.12.0/src/mithai/adapters/base.py +135 -0
  85. mithai-0.12.0/src/mithai/adapters/cli.py +465 -0
  86. mithai-0.12.0/src/mithai/adapters/formatters.py +481 -0
  87. mithai-0.12.0/src/mithai/adapters/slack.py +806 -0
  88. mithai-0.12.0/src/mithai/adapters/slack_http.py +139 -0
  89. mithai-0.12.0/src/mithai/adapters/telegram.py +168 -0
  90. mithai-0.12.0/src/mithai/cli/__init__.py +0 -0
  91. mithai-0.12.0/src/mithai/cli/agent_cmd.py +434 -0
  92. mithai-0.12.0/src/mithai/cli/chat_cmd.py +98 -0
  93. mithai-0.12.0/src/mithai/cli/doctor_cmd.py +328 -0
  94. mithai-0.12.0/src/mithai/cli/init_cmd.py +450 -0
  95. mithai-0.12.0/src/mithai/cli/logs_cmd.py +162 -0
  96. mithai-0.12.0/src/mithai/cli/main.py +68 -0
  97. mithai-0.12.0/src/mithai/cli/run_cmd.py +766 -0
  98. mithai-0.12.0/src/mithai/cli/service_cmd.py +415 -0
  99. mithai-0.12.0/src/mithai/cli/skill_cmd.py +457 -0
  100. mithai-0.12.0/src/mithai/cli/status_cmd.py +96 -0
  101. mithai-0.12.0/src/mithai/cli/style.py +208 -0
  102. mithai-0.12.0/src/mithai/cli/ui_cmd.py +51 -0
  103. mithai-0.12.0/src/mithai/core/__init__.py +0 -0
  104. mithai-0.12.0/src/mithai/core/config.py +457 -0
  105. mithai-0.12.0/src/mithai/core/context.py +35 -0
  106. mithai-0.12.0/src/mithai/core/engine.py +1052 -0
  107. mithai-0.12.0/src/mithai/core/heartbeat.py +144 -0
  108. mithai-0.12.0/src/mithai/core/mcp_manager.py +377 -0
  109. mithai-0.12.0/src/mithai/core/reflection.py +69 -0
  110. mithai-0.12.0/src/mithai/core/session.py +163 -0
  111. mithai-0.12.0/src/mithai/core/skill_loader.py +225 -0
  112. mithai-0.12.0/src/mithai/core/tool_router.py +225 -0
  113. mithai-0.12.0/src/mithai/core/verifier.py +74 -0
  114. mithai-0.12.0/src/mithai/human/__init__.py +0 -0
  115. mithai-0.12.0/src/mithai/human/mcp.py +120 -0
  116. mithai-0.12.0/src/mithai/integrations/__init__.py +0 -0
  117. mithai-0.12.0/src/mithai/integrations/slack.py +533 -0
  118. mithai-0.12.0/src/mithai/llm/__init__.py +0 -0
  119. mithai-0.12.0/src/mithai/llm/_bedrock_translate.py +164 -0
  120. mithai-0.12.0/src/mithai/llm/anthropic.py +187 -0
  121. mithai-0.12.0/src/mithai/llm/base.py +53 -0
  122. mithai-0.12.0/src/mithai/llm/bedrock.py +222 -0
  123. mithai-0.12.0/src/mithai/memory/__init__.py +0 -0
  124. mithai-0.12.0/src/mithai/memory/base.py +84 -0
  125. mithai-0.12.0/src/mithai/memory/filesystem.py +132 -0
  126. mithai-0.12.0/src/mithai/memory/inmemory.py +83 -0
  127. mithai-0.12.0/src/mithai/memory/redis.py +106 -0
  128. mithai-0.12.0/src/mithai/memory/s3.py +133 -0
  129. mithai-0.12.0/src/mithai/state/__init__.py +0 -0
  130. mithai-0.12.0/src/mithai/state/base.py +33 -0
  131. mithai-0.12.0/src/mithai/state/filesystem.py +45 -0
  132. mithai-0.12.0/src/mithai/state/memory.py +27 -0
  133. mithai-0.12.0/src/mithai/telemetry/__init__.py +6 -0
  134. mithai-0.12.0/src/mithai/telemetry/metrics.py +151 -0
  135. mithai-0.12.0/src/mithai/telemetry/tracer.py +172 -0
  136. mithai-0.12.0/src/mithai/ui/__init__.py +1 -0
  137. mithai-0.12.0/src/mithai/ui/app.py +360 -0
  138. mithai-0.12.0/src/mithai/ui/data.py +179 -0
  139. mithai-0.12.0/src/mithai/ui/static/htmx.min.js +1 -0
  140. mithai-0.12.0/src/mithai/ui/templates/approvals.html +331 -0
  141. mithai-0.12.0/src/mithai/ui/templates/base.html +702 -0
  142. mithai-0.12.0/src/mithai/ui/templates/config.html +27 -0
  143. mithai-0.12.0/src/mithai/ui/templates/dashboard.html +104 -0
  144. mithai-0.12.0/src/mithai/ui/templates/memory.html +75 -0
  145. mithai-0.12.0/src/mithai/ui/templates/memory_file.html +29 -0
  146. mithai-0.12.0/src/mithai/ui/templates/session_detail.html +112 -0
  147. mithai-0.12.0/src/mithai/ui/templates/sessions.html +56 -0
  148. mithai-0.12.0/src/mithai/ui/templates/skills.html +61 -0
  149. mithai-0.12.0/tests/__init__.py +0 -0
  150. mithai-0.12.0/tests/conftest.py +122 -0
  151. mithai-0.12.0/tests/test_agent_create.py +126 -0
  152. mithai-0.12.0/tests/test_api_adapter.py +276 -0
  153. mithai-0.12.0/tests/test_cli_adapter.py +284 -0
  154. mithai-0.12.0/tests/test_config.py +269 -0
  155. mithai-0.12.0/tests/test_doctor_cmd.py +129 -0
  156. mithai-0.12.0/tests/test_engine_extra_system_prompt.py +175 -0
  157. mithai-0.12.0/tests/test_engine_images.py +382 -0
  158. mithai-0.12.0/tests/test_engine_late_bind_roster.py +96 -0
  159. mithai-0.12.0/tests/test_engine_tool_xml_leak.py +283 -0
  160. mithai-0.12.0/tests/test_formatters.py +185 -0
  161. mithai-0.12.0/tests/test_heartbeat.py +442 -0
  162. mithai-0.12.0/tests/test_human_mcp.py +104 -0
  163. mithai-0.12.0/tests/test_init_cmd.py +78 -0
  164. mithai-0.12.0/tests/test_k8s_skill_e2e.py +93 -0
  165. mithai-0.12.0/tests/test_kubernetes_skill.py +143 -0
  166. mithai-0.12.0/tests/test_listen_mode.py +471 -0
  167. mithai-0.12.0/tests/test_llm_bedrock.py +246 -0
  168. mithai-0.12.0/tests/test_llm_bedrock_translate.py +262 -0
  169. mithai-0.12.0/tests/test_llm_dispatch.py +82 -0
  170. mithai-0.12.0/tests/test_mcp_manager.py +326 -0
  171. mithai-0.12.0/tests/test_memory_backend.py +145 -0
  172. mithai-0.12.0/tests/test_memory_flock.py +220 -0
  173. mithai-0.12.0/tests/test_memory_skill.py +130 -0
  174. mithai-0.12.0/tests/test_multi_agent.py +770 -0
  175. mithai-0.12.0/tests/test_nudge.py +403 -0
  176. mithai-0.12.0/tests/test_onboarding.py +1097 -0
  177. mithai-0.12.0/tests/test_reflection.py +120 -0
  178. mithai-0.12.0/tests/test_scheduling_skill.py +359 -0
  179. mithai-0.12.0/tests/test_session.py +137 -0
  180. mithai-0.12.0/tests/test_skill_loader.py +141 -0
  181. mithai-0.12.0/tests/test_skill_loader_mcp.py +180 -0
  182. mithai-0.12.0/tests/test_slack_client.py +1064 -0
  183. mithai-0.12.0/tests/test_slack_events_endpoint.py +122 -0
  184. mithai-0.12.0/tests/test_slack_http_adapter.py +1383 -0
  185. mithai-0.12.0/tests/test_state.py +37 -0
  186. mithai-0.12.0/tests/test_telemetry.py +755 -0
  187. mithai-0.12.0/tests/test_thread_context.py +692 -0
  188. mithai-0.12.0/tests/test_tool_router.py +56 -0
  189. mithai-0.12.0/tests/test_tool_router_with_mcp.py +467 -0
  190. mithai-0.12.0/tests/test_ui_app.py +338 -0
  191. mithai-0.12.0/tests/test_ui_cmd.py +26 -0
  192. mithai-0.12.0/tests/test_ui_data.py +252 -0
  193. mithai-0.12.0/tests/test_ui_transport.py +234 -0
  194. mithai-0.12.0/tests/test_verifier.py +400 -0
  195. mithai-0.12.0/uv.lock +1653 -0
@@ -0,0 +1,23 @@
1
+ .git
2
+ .gitignore
3
+ .github
4
+ .claude
5
+ .env
6
+ .env.*
7
+ .venv
8
+ .mithai
9
+ __pycache__
10
+ *.pyc
11
+ *.pyo
12
+ *.pyd
13
+ *.egg-info
14
+ dist/
15
+ build/
16
+ deploy/
17
+ tests/
18
+ docs/
19
+ docs-site/
20
+ memory/
21
+ TESTING.md
22
+ SPEC-*.md
23
+ uv.lock
@@ -0,0 +1,31 @@
1
+ name: Bug report
2
+ description: Report a reproducible problem in Mithai.
3
+ labels: ["bug"]
4
+ body:
5
+ - type: textarea
6
+ id: summary
7
+ attributes:
8
+ label: Summary
9
+ description: What happened?
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: reproduce
14
+ attributes:
15
+ label: Reproduction
16
+ description: Steps, config shape, and commands needed to reproduce.
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: expected
21
+ attributes:
22
+ label: Expected behavior
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ id: environment
27
+ attributes:
28
+ label: Environment
29
+ description: Mithai version, Python version, OS, adapter, and LLM provider.
30
+ validations:
31
+ required: true
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security reports
4
+ url: mailto:security@last9.io
5
+ about: Report vulnerabilities privately.
@@ -0,0 +1,23 @@
1
+ name: Feature request
2
+ description: Propose an improvement or new capability.
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: Problem
9
+ description: What user workflow or operational need is blocked?
10
+ validations:
11
+ required: true
12
+ - type: textarea
13
+ id: proposal
14
+ attributes:
15
+ label: Proposal
16
+ description: What should Mithai do differently?
17
+ validations:
18
+ required: true
19
+ - type: textarea
20
+ id: alternatives
21
+ attributes:
22
+ label: Alternatives
23
+ description: Any workarounds or designs considered?
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: Security report
3
+ about: Do not file public security issues.
4
+ labels: security
5
+ ---
6
+
7
+ Please do not include vulnerability details in a public issue.
8
+
9
+ Email security@last9.io with the affected version or commit, reproduction steps, impact, and logs with secrets removed.
@@ -0,0 +1,8 @@
1
+ ## Summary
2
+
3
+ ## Testing
4
+
5
+ ## Notes
6
+
7
+ - [ ] I did not commit secrets, runtime state, `.env`, `.mithai/`, `.wrangler/`, or `memory/`.
8
+ - [ ] I updated docs for user-facing behavior or configuration changes.
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "npm"
8
+ directory: "/docs-site"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,65 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [master, main]
6
+ pull_request:
7
+ branches: [master, main]
8
+
9
+ jobs:
10
+ test:
11
+ name: Test (Python ${{ matrix.python-version }})
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.11", "3.12", "3.13"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Install uv
21
+ uses: astral-sh/setup-uv@v4
22
+ with:
23
+ version: "latest"
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ run: uv python install ${{ matrix.python-version }}
27
+
28
+ - name: Install dependencies
29
+ run: uv sync --all-extras
30
+
31
+ - name: Lint
32
+ run: uv run ruff check src/ tests/
33
+
34
+ - name: Run tests
35
+ run: uv run pytest tests/ -v
36
+
37
+ build-smoke:
38
+ name: Binary smoke test
39
+ runs-on: ubuntu-latest
40
+ needs: test
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+
44
+ - name: Install uv
45
+ uses: astral-sh/setup-uv@v4
46
+ with:
47
+ version: "latest"
48
+
49
+ - name: Set up Python
50
+ run: uv python install 3.13
51
+
52
+ - name: Install dependencies
53
+ run: uv sync --all-extras
54
+
55
+ - name: Build binary
56
+ run: |
57
+ uv run pyinstaller mithai.spec --noconfirm
58
+ ls -lh dist/mithai-*
59
+
60
+ - name: Smoke test
61
+ run: |
62
+ BINARY=$(ls dist/mithai-*)
63
+ chmod +x "$BINARY"
64
+ "$BINARY" --version
65
+ "$BINARY" --help
@@ -0,0 +1,50 @@
1
+ name: Deploy docs
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ paths:
7
+ - 'docs/**'
8
+ - 'docs-site/**'
9
+ pull_request:
10
+ paths:
11
+ - 'docs/**'
12
+ - 'docs-site/**'
13
+
14
+ jobs:
15
+ build-and-deploy:
16
+ name: Build and deploy docs
17
+ runs-on: ubuntu-latest
18
+ env:
19
+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
20
+ CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
21
+ permissions:
22
+ contents: read
23
+ deployments: write
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Migrate docs to Starlight content
28
+ run: python3 docs-site/migrate.py
29
+
30
+ - uses: actions/setup-node@v4
31
+ with:
32
+ node-version: 22
33
+ cache: npm
34
+ cache-dependency-path: docs-site/package-lock.json
35
+
36
+ - name: Install dependencies
37
+ run: npm ci --legacy-peer-deps
38
+ working-directory: docs-site
39
+
40
+ - name: Build
41
+ run: npm run build
42
+ working-directory: docs-site
43
+
44
+ - name: Deploy to Cloudflare Pages
45
+ if: github.event_name == 'push' && github.ref == 'refs/heads/master' && env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != ''
46
+ uses: cloudflare/wrangler-action@v3
47
+ with:
48
+ apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
49
+ accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
50
+ command: pages deploy docs-site/dist --project-name=mithai-docs --branch=${{ github.ref_name }}
@@ -0,0 +1,87 @@
1
+ name: Promote to Stable
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ tag:
7
+ description: "Tag to promote as stable (e.g. v0.4.0)"
8
+ required: true
9
+ type: string
10
+
11
+ permissions:
12
+ contents: write
13
+
14
+ jobs:
15
+ promote:
16
+ name: Promote ${{ inputs.tag }} to stable
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - name: Validate tag exists
24
+ env:
25
+ TAG: ${{ inputs.tag }}
26
+ run: |
27
+ if ! git rev-parse "refs/tags/$TAG" >/dev/null 2>&1; then
28
+ echo "::error::Tag $TAG does not exist"
29
+ exit 1
30
+ fi
31
+
32
+ - name: Validate release exists
33
+ env:
34
+ TAG: ${{ inputs.tag }}
35
+ GH_TOKEN: ${{ github.token }}
36
+ run: |
37
+ if ! gh release view "$TAG" >/dev/null 2>&1; then
38
+ echo "::error::No GitHub release found for $TAG. Run the release workflow first."
39
+ exit 1
40
+ fi
41
+
42
+ - name: Download assets from tagged release
43
+ env:
44
+ TAG: ${{ inputs.tag }}
45
+ GH_TOKEN: ${{ github.token }}
46
+ run: |
47
+ mkdir -p stable-assets/
48
+ gh release download "$TAG" --dir stable-assets/
49
+ echo "=== Downloaded assets ==="
50
+ ls -lh stable-assets/
51
+
52
+ - name: Create or update stable release
53
+ env:
54
+ TAG: ${{ inputs.tag }}
55
+ GH_TOKEN: ${{ github.token }}
56
+ REPO: ${{ github.repository }}
57
+ run: |
58
+ # Get the tagged release notes
59
+ ORIGINAL_NOTES=$(gh release view "$TAG" --json body --jq .body)
60
+
61
+ # Build stable release notes
62
+ STABLE_NOTES=$(cat <<EOF
63
+ ## Stable Release
64
+
65
+ Promoted from [\`$TAG\`](https://github.com/$REPO/releases/tag/$TAG).
66
+
67
+ ---
68
+
69
+ $ORIGINAL_NOTES
70
+ EOF
71
+ )
72
+
73
+ # Delete existing stable release if present
74
+ gh release delete stable --yes 2>/dev/null || true
75
+ git push origin :refs/tags/stable 2>/dev/null || true
76
+
77
+ # Create stable tag pointing to the same commit as the source tag
78
+ TAG_SHA=$(git rev-parse "refs/tags/$TAG")
79
+ git tag -f stable "$TAG_SHA"
80
+ git push origin stable --force
81
+
82
+ # Create the stable release with the same assets
83
+ gh release create stable \
84
+ --title "stable ($TAG)" \
85
+ --notes "$STABLE_NOTES" \
86
+ --latest \
87
+ stable-assets/*
@@ -0,0 +1,311 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ # Keep manual trigger for dry runs
9
+ workflow_dispatch:
10
+ inputs:
11
+ dry_run:
12
+ description: "Dry run — build everything but don't publish"
13
+ required: false
14
+ type: boolean
15
+ default: true
16
+
17
+ permissions:
18
+ contents: write
19
+ packages: write
20
+
21
+ jobs:
22
+ # ── Extract version from tag or pyproject.toml ──
23
+ meta:
24
+ name: Extract version
25
+ runs-on: ubuntu-latest
26
+ outputs:
27
+ version: ${{ steps.ver.outputs.version }}
28
+ is_tag: ${{ steps.ver.outputs.is_tag }}
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Determine version
33
+ id: ver
34
+ run: |
35
+ if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
36
+ TAG_VERSION="${GITHUB_REF#refs/tags/}"
37
+ echo "version=$TAG_VERSION" >> "$GITHUB_OUTPUT"
38
+ echo "is_tag=true" >> "$GITHUB_OUTPUT"
39
+ else
40
+ PY_VERSION="v$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
41
+ echo "version=$PY_VERSION" >> "$GITHUB_OUTPUT"
42
+ echo "is_tag=false" >> "$GITHUB_OUTPUT"
43
+ fi
44
+
45
+ - name: Verify pyproject.toml matches tag
46
+ if: startsWith(github.ref, 'refs/tags/v')
47
+ run: |
48
+ PY_VERSION="v$(python3 -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")"
49
+ TAG_VERSION="${GITHUB_REF#refs/tags/}"
50
+ if [ "$PY_VERSION" != "$TAG_VERSION" ]; then
51
+ echo "::error::pyproject.toml version ($PY_VERSION) does not match tag ($TAG_VERSION)"
52
+ exit 1
53
+ fi
54
+
55
+ # ── Fast Linux test job ──
56
+ test:
57
+ name: Test (linux-amd64)
58
+ needs: meta
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+
63
+ - name: Install uv
64
+ uses: astral-sh/setup-uv@v4
65
+ with:
66
+ version: "latest"
67
+
68
+ - name: Set up Python
69
+ run: uv python install 3.13
70
+
71
+ - name: Install dependencies
72
+ run: uv sync --all-extras
73
+
74
+ - name: Run tests
75
+ run: uv run pytest tests/ -v
76
+
77
+ # ── Build platform binaries ──
78
+ build-binaries:
79
+ name: Build ${{ matrix.platform }}
80
+ needs: meta
81
+ runs-on: ${{ matrix.runner }}
82
+ strategy:
83
+ fail-fast: false
84
+ matrix:
85
+ include:
86
+ - runner: macos-14
87
+ platform: darwin-arm64
88
+ - runner: ubuntu-latest
89
+ platform: linux-amd64
90
+ - runner: ubuntu-24.04-arm
91
+ platform: linux-arm64
92
+
93
+ steps:
94
+ - uses: actions/checkout@v4
95
+
96
+ - name: Install uv
97
+ uses: astral-sh/setup-uv@v4
98
+ with:
99
+ version: "latest"
100
+
101
+ - name: Set up Python
102
+ run: uv python install 3.13
103
+
104
+ - name: Install dependencies
105
+ run: uv sync --all-extras
106
+
107
+ - name: Run tests
108
+ run: uv run pytest tests/ -v
109
+
110
+ - name: Build binary
111
+ run: |
112
+ uv run pyinstaller mithai.spec --noconfirm
113
+ ls -lh dist/mithai-*
114
+
115
+ - name: Smoke test binary
116
+ shell: bash
117
+ run: |
118
+ BINARY=$(ls dist/mithai-*)
119
+ chmod +x "$BINARY" 2>/dev/null || true
120
+ "$BINARY" --version
121
+ "$BINARY" --help
122
+ echo "Smoke tests passed for $BINARY"
123
+
124
+ - name: Upload artifact
125
+ uses: actions/upload-artifact@v4
126
+ with:
127
+ name: mithai-${{ matrix.platform }}
128
+ path: dist/mithai-*
129
+ if-no-files-found: error
130
+
131
+ # ── Build Python package ──
132
+ build-python-package:
133
+ name: Build Python package
134
+ needs: [meta, test]
135
+ runs-on: ubuntu-latest
136
+ steps:
137
+ - uses: actions/checkout@v4
138
+
139
+ - name: Install uv
140
+ uses: astral-sh/setup-uv@v4
141
+ with:
142
+ version: "latest"
143
+
144
+ - name: Set up Python
145
+ run: uv python install 3.13
146
+
147
+ - name: Build wheel and sdist
148
+ run: uv build
149
+
150
+ - name: Validate package metadata
151
+ run: uvx twine check dist/*
152
+
153
+ - name: Upload Python package artifact
154
+ uses: actions/upload-artifact@v4
155
+ with:
156
+ name: python-dist
157
+ path: dist/*
158
+ if-no-files-found: error
159
+
160
+ # ── Build and publish container image ──
161
+ build-container:
162
+ name: Build container image
163
+ needs: [meta, test]
164
+ runs-on: ubuntu-latest
165
+ permissions:
166
+ contents: read
167
+ packages: write
168
+ steps:
169
+ - uses: actions/checkout@v4
170
+
171
+ - name: Set up Docker Buildx
172
+ uses: docker/setup-buildx-action@v3
173
+
174
+ - name: Log in to GitHub Container Registry
175
+ if: ${{ needs.meta.outputs.is_tag == 'true' && !inputs.dry_run }}
176
+ uses: docker/login-action@v3
177
+ with:
178
+ registry: ghcr.io
179
+ username: ${{ github.actor }}
180
+ password: ${{ github.token }}
181
+
182
+ - name: Extract image metadata
183
+ id: meta
184
+ uses: docker/metadata-action@v5
185
+ with:
186
+ images: ghcr.io/last9/mithai
187
+ tags: |
188
+ type=semver,pattern={{version}},value=${{ needs.meta.outputs.version }}
189
+ type=semver,pattern={{major}}.{{minor}},value=${{ needs.meta.outputs.version }}
190
+ type=raw,value=latest,enable=${{ needs.meta.outputs.is_tag == 'true' }}
191
+
192
+ - name: Build and optionally push image
193
+ uses: docker/build-push-action@v6
194
+ with:
195
+ context: .
196
+ file: deploy/Dockerfile
197
+ platforms: linux/amd64
198
+ push: ${{ needs.meta.outputs.is_tag == 'true' && !inputs.dry_run }}
199
+ tags: ${{ steps.meta.outputs.tags }}
200
+ labels: ${{ steps.meta.outputs.labels }}
201
+ cache-from: type=gha
202
+ cache-to: type=gha,mode=max
203
+
204
+ # ── Publish Python package ──
205
+ publish-pypi:
206
+ name: Publish to PyPI
207
+ needs: [meta, build-python-package]
208
+ if: ${{ needs.meta.outputs.is_tag == 'true' && !inputs.dry_run }}
209
+ runs-on: ubuntu-latest
210
+ environment:
211
+ name: pypi
212
+ url: https://pypi.org/project/mithai/
213
+ permissions:
214
+ contents: read
215
+ steps:
216
+ - name: Verify PYPI_API_TOKEN is configured
217
+ env:
218
+ PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
219
+ run: |
220
+ if [ -z "$PYPI_API_TOKEN" ]; then
221
+ echo "::error::PYPI_API_TOKEN secret is required to publish mithai to PyPI"
222
+ exit 1
223
+ fi
224
+
225
+ - name: Download Python package artifact
226
+ uses: actions/download-artifact@v4
227
+ with:
228
+ name: python-dist
229
+ path: dist/
230
+
231
+ - name: Publish package distributions to PyPI
232
+ uses: pypa/gh-action-pypi-publish@release/v1
233
+ with:
234
+ password: ${{ secrets.PYPI_API_TOKEN }}
235
+
236
+ # ── Create GitHub Release ──
237
+ release:
238
+ name: Create GitHub Release
239
+ needs: [meta, build-binaries, build-container, publish-pypi]
240
+ if: ${{ needs.meta.outputs.is_tag == 'true' && !inputs.dry_run }}
241
+ runs-on: ubuntu-latest
242
+ steps:
243
+ - uses: actions/checkout@v4
244
+ with:
245
+ fetch-depth: 0
246
+
247
+ - name: Download binary artifacts
248
+ uses: actions/download-artifact@v4
249
+ with:
250
+ pattern: mithai-*
251
+ path: artifacts/
252
+
253
+ - name: Prepare release assets
254
+ run: |
255
+ mkdir -p release/
256
+ find artifacts/ -name 'mithai-*' -type f -exec mv {} release/ \;
257
+ chmod +x release/mithai-* 2>/dev/null || true
258
+
259
+ cd release
260
+ sha256sum mithai-* > checksums.txt 2>/dev/null || shasum -a 256 mithai-* > checksums.txt
261
+ echo "=== Release assets ==="
262
+ ls -lh
263
+ echo ""
264
+ echo "=== Checksums ==="
265
+ cat checksums.txt
266
+
267
+ - name: Generate release notes
268
+ id: notes
269
+ env:
270
+ RELEASE_VERSION: ${{ needs.meta.outputs.version }}
271
+ run: |
272
+ PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
273
+
274
+ {
275
+ echo "NOTES<<EOF"
276
+ echo "## Mithai ${RELEASE_VERSION}"
277
+ echo ""
278
+ echo "### What's changed"
279
+ echo ""
280
+ if [ -n "$PREV_TAG" ]; then
281
+ git log --pretty=format:"- %s" "${PREV_TAG}..HEAD" -- | head -30
282
+ else
283
+ git log --pretty=format:"- %s" -20
284
+ fi
285
+ echo ""
286
+ echo ""
287
+ echo "### Checksums (SHA256)"
288
+ echo ""
289
+ echo '```'
290
+ cat release/checksums.txt
291
+ echo '```'
292
+ echo "EOF"
293
+ } >> "$GITHUB_OUTPUT"
294
+
295
+ - name: Create GitHub Release
296
+ env:
297
+ RELEASE_VERSION: ${{ needs.meta.outputs.version }}
298
+ RELEASE_NOTES: ${{ steps.notes.outputs.NOTES }}
299
+ GH_TOKEN: ${{ github.token }}
300
+ run: |
301
+ PRERELEASE_FLAG=""
302
+ case "$RELEASE_VERSION" in
303
+ *-*) PRERELEASE_FLAG="--prerelease" ;;
304
+ esac
305
+
306
+ gh release create "$RELEASE_VERSION" \
307
+ --title "$RELEASE_VERSION" \
308
+ --notes "$RELEASE_NOTES" \
309
+ $PRERELEASE_FLAG \
310
+ release/mithai-* \
311
+ release/checksums.txt
@@ -0,0 +1,31 @@
1
+ .env
2
+ .claude/
3
+ .mithai/
4
+ .wrangler/
5
+ .venv/
6
+ /memory/
7
+ __pycache__/
8
+ *.pyc
9
+ *.pyo
10
+ *.egg-info/
11
+ dist/
12
+ build/
13
+ .eggs/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+ *.egg
17
+ deploy/k8s/secret.yaml
18
+ deploy/helm/values-private.yaml
19
+ ideas/
20
+
21
+ # Docs site
22
+ docs-site/node_modules/
23
+ docs-site/.astro/
24
+ docs-site/dist/
25
+ docs-site/src/content/docs/
26
+ .DS_Store
27
+
28
+ # Local binaries
29
+ /mithai
30
+ /mithai-*
31
+ !mithai*.spec
mithai-0.12.0/AUTHORS ADDED
@@ -0,0 +1,11 @@
1
+ # Authors
2
+
3
+ Mithai's public history includes contributions from:
4
+
5
+ - Nishant Modak <nishantmodak@users.noreply.github.com>
6
+ - Prathamesh Sonpatki <csonpatki@gmail.com>
7
+ - Shekhar Patil <cshekhar.patil@gmail.com>
8
+ - Sahil Khan <1988.sahil@gmail.com>
9
+ - Kapil Neurgaonkar <kapil.neurgaonkar@gmail.com>
10
+
11
+ Automated dependency updates may appear from dependabot[bot].
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable public changes will be documented here.
4
+
5
+ ## 0.12.0
6
+
7
+ - Prepare Mithai for open-source publication.
8
+ - Sanitize public history and remove private infrastructure defaults.
9
+ - Add community health files and public-safe release defaults.