Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
208 commits
Select commit Hold shift + click to select a range
50484d8
fix: remove duplicate MCP JSON-RPC sidecar
ROHIT-JR Sep 15, 2026
94b2876
fix: hide incomplete tasks surface on MCP 2026
ROHIT-JR Sep 15, 2026
416fe98
fix(tools): keep null branch in registered outputSchema
Shreyavemana Oct 14, 2026
c6a6bb4
fix(auth): deny CIMD host mismatch, require pinned IP for outbound pe…
AadarshM07 Oct 22, 2026
41ca887
test: capture tools/list baseline before transform pipeline (#61)
Shreyavemana Oct 23, 2026
0bae98a
feat(transforms): add McpTransform protocol, CatalogTransform and Tra…
Shreyavemana Oct 23, 2026
1211d6b
feat(core): apply transforms to tools/list and tools/call, share argu…
Shreyavemana Oct 23, 2026
8464d8a
security: mitigate eMudhra/emSign CA incident (certifi floor, secure …
Shreyavemana Oct 22, 2026
da07f89
test: add baseline catalog, package marker and fixture for transform …
Shreyavemana Oct 24, 2026
0468fe5
build: add pytest-asyncio to dev extras for transform tests (#61)
Shreyavemana Oct 24, 2026
61480e0
Update test_security_config.py
Shreyavemana Oct 24, 2026
0c59e9d
feat(transforms): add SyntheticTool and run it from _invoke_tool (#62)
Shreyavemana Oct 25, 2026
36e9e82
feat(transforms): add BaseSearchTransform and RegexSearchTransform (#62)
Shreyavemana Oct 25, 2026
12d949b
test(transforms): progressive discovery, regex timeout, call_tool dis…
Shreyavemana Oct 25, 2026
af4f3bc
feat(transforms): complete progressive discovery for issue #62
Shreyavemana Oct 25, 2026
234b32a
fix: support async health checks
Shreyavemana Oct 25, 2026
c344dce
test(health): run async health tests with asyncio.run so CI needs no …
Shreyavemana Oct 25, 2026
31e61b3
Merge pull request #81 from Shreyavemana/security/emsign-mitigation
manish-wekan Oct 26, 2026
314e557
Merge pull request #82 from AadarshM07/issue#26
manish-wekan Oct 26, 2026
6ebf6ba
Add log emitter for tooling
Oct 26, 2026
222b9f8
Merge pull request #89 from Shreyavemana/fix/async-health-checks
manish-wekan Oct 27, 2026
7c6e1fa
Delete pr62.md
Shreyavemana Oct 27, 2026
69e316a
Update test_transforms_search_app.py
Shreyavemana Oct 27, 2026
394acb4
fix: hide task_support on the 2026 wire and keep legacy task tests on…
ROHIT-JR Oct 27, 2026
b3a2e13
Merge pull request #88 from Shreyavemana/feat/62-progressive-discover…
manish-wekan Oct 27, 2026
a470e25
Merge upstream/develop into codex/issue-22-official
ROHIT-JR Oct 27, 2026
55512e0
test: drop tests of the removed sidecar classes; park sidecar-only HT…
ROHIT-JR Oct 27, 2026
cbba681
Merge codex/issue-22-official into codex/issue-25-hide-tasks-2026
ROHIT-JR Oct 27, 2026
acb37fb
test: align tests that were hidden by collection errors with the hidd…
ROHIT-JR Oct 27, 2026
4359443
feat(auth): add SecretValue wrapper for secrets (#69)
ROHIT-JR Oct 27, 2026
bf54a4b
Fix lazy log emitter handler installation
Oct 27, 2026
4b11a6b
Make lastResort logging regression test deterministic
Oct 27, 2026
e69fd55
Fix duplicate log emission and stabilize tests
Oct 27, 2026
3a3cc9b
Stabilize log emitter regression tests
Oct 27, 2026
e3a6c5c
Restrict automatic log handler to global emitter
Oct 27, 2026
5bcb5ba
feat: add per-session tool visibility
Oct 27, 2026
113b8dc
feat(transforms): add search tokenizer and pure-Python BM25 engine (#64)
Shreyavemana Oct 27, 2026
28c9cd5
feat(transforms): add Bm25SearchTransform with lazy fingerprinted ind…
Shreyavemana Oct 27, 2026
e5676f8
test(transforms): BM25 scoring, golden ranking, index rebuild count (…
Shreyavemana Oct 27, 2026
fe4e886
feat(transforms): implement code-mode transform and quickjs worker pool
AadarshM07 Oct 28, 2026
860f5e1
feat(auth): add OAuth2 client and secure token stores
jpsiddharth2008 Oct 28, 2026
60461a6
fix(logging): bridge isolated loggers that are registered before subs…
sharma2464 Oct 28, 2026
a56aa78
Merge pull request #90 from Prateep07/logging/log-emitter
manish-wekan Oct 28, 2026
bfa727e
Merge pull request #46 from Shreyavemana/fix/output-schema-keep-null
manish-wekan Oct 28, 2026
c625ff8
Revert "Issue #41 : fix(tools): keep null branch in registered output…
manish-wekan Oct 28, 2026
e9cf1db
Merge pull request #97 from nitrocloudofficial/revert-46-fix/output-s…
manish-wekan Oct 28, 2026
705a751
feat: enforce script timeout during tool calls and revert uv.lock dow…
AadarshM07 Oct 28, 2026
e344548
test(auth): use TracebackException for capture_locals in the tracebac…
ROHIT-JR Oct 28, 2026
0b7e4e5
Merge upstream/develop into codex/issue-22-official
ROHIT-JR Oct 28, 2026
680c722
fix(mcp): restore CORS policy, reject modern initialize, unify reques…
ROHIT-JR Oct 28, 2026
805db05
Merge pull request #34 from ROHIT-JR/codex/issue-22-official
manish-wekan Oct 28, 2026
63ecd92
Merge pull request #93 from ROHIT-JR/feat/69-secret-value
manish-wekan Oct 28, 2026
87ab714
Merge develop into per-session tool visibility
Oct 28, 2026
d240bd1
feat(health): add richer health checks payload
Oct 28, 2026
fdd3002
fix: address visibility review findings
Oct 28, 2026
99311fd
feat(auth): quick-setup helpers and env validation (#70)
ROHIT-JR Oct 29, 2026
0a6291e
feat: add application widget registry and examples resource
jpsiddharth2008 Oct 29, 2026
2cac434
fix(health): bound sync checks and clarify telemetry
Oct 29, 2026
f8b631a
docs(health): clarify worker exit and version fallback
Oct 29, 2026
a7422cb
feat(testing): provider overrides, close() and mocks in NitroTestingM…
ROHIT-JR Oct 29, 2026
3b43218
Add Cursor MCP registration command
Oct 29, 2026
fbd27a7
feat(decorators): LRU-bounded @cache, typed and keyed @rate_limit
Shreyavemana Oct 14, 2026
bcbd54d
fix(decorators): reject invalid rate_limit/cache arguments (max=0 cra…
Shreyavemana Oct 30, 2026
9590f0f
feat(cli): validate checks @widget routes and widgets/out HTML
Shreyavemana Oct 19, 2026
9588be9
fix(cli): ignore vendored SDK widget routes
Shreyavemana Oct 30, 2026
9333345
docs: consolidate widget registry usage in README
jpsiddharth2008 Oct 30, 2026
cd9a2c0
docs: evaluate TypeScript DiscoveryHttpServer against Python discover…
Shreyavemana Nov 1, 2026
1739512
Merge pull request #95 from Shreyavemana/feat/64-bm25-search
manish-wekan Nov 2, 2026
1f3a84a
Merge pull request #96 from AadarshM07/issue#66
manish-wekan Nov 2, 2026
259315a
Merge pull request #99 from Prateep07/feature/health-only-71
manish-wekan Nov 2, 2026
125151b
Merge pull request #94 from Prateep07/feature/visibility-only-develop
manish-wekan Nov 2, 2026
09a12f5
Merge pull request #35 from ROHIT-JR/codex/issue-25-hide-tasks-2026
manish-wekan Nov 2, 2026
2715212
fix(testing): isolate harnesses, order teardown, roll back failed fac…
ROHIT-JR Nov 2, 2026
18d3eec
fix(auth): SecretValue source leak via pickle and env fallback for re…
ROHIT-JR Nov 2, 2026
efdbfb8
feat: add caller-scoped data spillover for large tool results
jpsiddharth2008 Oct 27, 2026
7f222aa
fix: scope spillover ownership to validated transport connections
jpsiddharth2008 Oct 29, 2026
e1b8340
docs: refresh spillover walkthrough and reproducible verification
jpsiddharth2008 Oct 29, 2026
f9f774e
docs: remove spillover reference files and keep README guidance
jpsiddharth2008 Nov 2, 2026
fb5d393
test: exercise spillover background tasks on the legacy wire
jpsiddharth2008 Nov 2, 2026
df1fb27
fix: unify HTTP factory - single CORS, subscribe-flag agreement, publ…
jpsiddharth2008 Sep 15, 2026
d0159a1
test: migrate sidecar coverage to official MCP HTTP handlers
jpsiddharth2008 Oct 27, 2026
f17822a
fix: align resource capabilities and enforce protocol eras in MCP runner
jpsiddharth2008 Oct 27, 2026
26d5cbb
test: retain protocol contract table and response echo coverage
jpsiddharth2008 Oct 27, 2026
97ef013
docs: record PR 36 migration and full test matrix results
jpsiddharth2008 Oct 27, 2026
e6674e9
fix: retain merged browser header coverage with Starlette CORS
jpsiddharth2008 Oct 28, 2026
927b5a7
docs: record develop rebase and refreshed PR 36 validation
jpsiddharth2008 Oct 28, 2026
c222cc8
test: preserve hidden task methods after develop rebase
jpsiddharth2008 Nov 2, 2026
757cd1d
test: send valid MCP 2026 metadata in task visibility probe
jpsiddharth2008 Nov 2, 2026
7a5129a
Merge branch 'develop' into feat/cache-eviction-rate-limit
Shreyavemana Nov 2, 2026
2bb5dfa
fix(mcp): align modern wire behavior and migrate protocol coverage
jpsiddharth2008 Oct 28, 2026
2ad7104
docs: record issue 24 wire decisions and full validation results
jpsiddharth2008 Oct 28, 2026
166bb15
docs: record rebased PR 37 matrix and develop socket comparison
jpsiddharth2008 Oct 28, 2026
c1babfc
fix(testing): rebuild consumers cached before create() so overrides a…
ROHIT-JR Nov 2, 2026
1f880c8
fix(testing): tear down rebuilt consumers on close() while leaving or…
ROHIT-JR Nov 2, 2026
599315c
Merge pull request #47 from Shreyavemana/feat/cache-eviction-rate-limit
manish-wekan Nov 2, 2026
b4d229b
Merge pull request #92 from jpsiddharth2008/feature/issue-67-data-spi…
manish-wekan Nov 2, 2026
95c9755
Merge develop into feat/74-testing-overrides
ROHIT-JR Nov 2, 2026
65f0c08
Merge develop into OAuth client branch and resolve dependency conflicts
jpsiddharth2008 Nov 2, 2026
bae3e4e
fix(tools): keep null branch in registered outputSchema (#41)
ROHIT-JR Nov 2, 2026
bbc2efd
Merge develop into HTTP factory branch
jpsiddharth2008 Nov 2, 2026
12637fd
Fix portable source checks and use the public MCP stdio runner
jpsiddharth2008 Nov 2, 2026
e5ea98d
Merge develop and preserve widget registry public exports
jpsiddharth2008 Nov 2, 2026
fb0faf8
Merge pull request #36 from jpsiddharth2008/feature/issue-23-http-fac…
manish-wekan Nov 2, 2026
000918b
fix(auth): pickle a canonical source label so a str subclass cannot l…
ROHIT-JR Nov 2, 2026
4152c59
feat(cli): add enterprise-search and code-mode project templates (#76)
jpsiddharth2008 Nov 2, 2026
c5bf6b9
all the changes made
Shreyavemana Oct 26, 2026
3fee54d
test: ping returns method-not-found on auto/modern (#24)
Shreyavemana Oct 27, 2026
ac332dc
test: temporarily skip obsolete MCP 2020 checks
Shreyavemana Oct 27, 2026
35d45fd
changes made after rebase
Shreyavemana Oct 30, 2026
cbca700
test: address review - restore pytest config, drop skip, fix ping tests
Shreyavemana Nov 2, 2026
3068a0f
test: address review - restore pytest config, drop skip, replace ping…
Shreyavemana Nov 3, 2026
0501f62
Merge pull request #103 from nitrocloudofficial/feature/python-cursor…
manish-wekan Nov 3, 2026
3671810
Merge pull request #106 from ROHIT-JR/fix/41-output-schema-null
manish-wekan Nov 3, 2026
af10af7
Merge pull request #105 from ROHIT-JR/fix/secret-value-review
manish-wekan Nov 3, 2026
8615640
Merge pull request #102 from ROHIT-JR/feat/74-testing-overrides
manish-wekan Nov 3, 2026
0db9104
Merge pull request #100 from ROHIT-JR/feat/70-quick-setup
manish-wekan Nov 3, 2026
3b2808a
Merge pull request #101 from jpsiddharth2008/feature/issue-73-widget-…
manish-wekan Nov 3, 2026
227a187
Merge pull request #91 from Shreyavemana/feat/24-wire-alignment-refresh
manish-wekan Nov 3, 2026
0d51ee4
Merge pull request #107 from jpsiddharth2008/feature/issue-76-project…
manish-wekan Nov 3, 2026
c5b0427
Merge develop and resolve wire-alignment conflicts
jpsiddharth2008 Nov 3, 2026
3ea41da
docs: complete discovery server investigation with evidence and concl…
Shreyavemana Nov 3, 2026
e73538f
Merge develop into OAuth client branch and preserve test dependencies
jpsiddharth2008 Nov 3, 2026
d43270b
fix(mcp): align modern wire behavior and migrate protocol coverage
jpsiddharth2008 Oct 28, 2026
0dc6bf1
refactor(mcp): drop test-only registries and dead task-guard code
manish-wekan Nov 4, 2026
902c759
Merge pull request #108 from nitrocloudofficial/fix/27-mcp2026-cleanup
manish-wekan Nov 4, 2026
a446231
fix(cache): handle unhashable args and add key= callable
AadarshM07 Nov 4, 2026
928e4bc
fix(cache): include excluded fields in key and scope type by module
AadarshM07 Nov 4, 2026
a73d603
docs: investigate Python file length limit
Nov 4, 2026
ca3e7b8
Merge pull request #110 from AadarshM07/issue#59
manish-wekan Nov 5, 2026
f1137c9
Merge pull request #98 from jpsiddharth2008/feature/issue-68-oauth-cl…
manish-wekan Nov 5, 2026
a7b6f8e
Merge pull request #58 from Shreyavemana/feat/validate-widgets
manish-wekan Nov 5, 2026
331bebe
Merge pull request #114 from Prateep07/docs/file-length-limit-investi…
manish-wekan Nov 5, 2026
fddd0b7
fix: skip init prompts when stdin is not a TTY
manish-wekan Sep 4, 2026
35fa72b
fix(cli): never read a non-TTY stdin in any init prompt
manish-wekan Nov 5, 2026
f7cf319
Merge develop and retain upstream wire cleanup
jpsiddharth2008 Nov 5, 2026
459b242
Merge pull request #37 from jpsiddharth2008/feature/issue-24-wire-ali…
manish-wekan Nov 5, 2026
e27546a
Merge pull request #104 from Shreyavemana/docs/77-discovery-server-ev…
manish-wekan Nov 5, 2026
12e65b1
Merge pull request #16 from nitrocloudofficial/fix/cli-skip-init-prom…
manish-wekan Nov 5, 2026
4591cb5
docs: remove PR #37 review logs
manish-wekan Nov 5, 2026
2d9e574
docs: update file length issue breakdown
Nov 5, 2026
0841e86
docs: separate OAuth and transport issue scopes
Nov 5, 2026
cecb0f1
docs: include flight example in CLI split scope
Nov 5, 2026
400d32c
ci: enforce 500-line Python file-length ratchet
AadarshM07 Nov 5, 2026
7820425
fix(auth): accept provider expiry strings and bound token-store overhead
jpsiddharth2008 Nov 5, 2026
8a40090
feat(auth): add managed access tokens and local revocation fallback
jpsiddharth2008 Nov 5, 2026
79c3fdf
docs(auth): document OAuth follow-ups and remove historical test report
jpsiddharth2008 Nov 5, 2026
c876158
fix(cli): validate collects @widget routes passed through a helper (#…
ROHIT-JR Nov 6, 2026
8ba596b
Add posthog dependency for CLI analytics.
manish-wekan Nov 6, 2026
208f8c6
Add opt-out PostHog telemetry module and analytics docs.
manish-wekan Nov 6, 2026
3eba809
Wire CLI events: commands, init, pack deploy, login identity.
manish-wekan Nov 6, 2026
beaa6e2
refactor: split core application modules
Nov 6, 2026
40cc0cf
docs: refresh file length issue statuses
Nov 6, 2026
ce5306f
Default PostHog project key for CLI telemetry with optional env overr…
manish-wekan Nov 6, 2026
89d9d94
refactor(cli): extract template text assets and project defaults
jpsiddharth2008 Nov 6, 2026
10af795
refactor(cli): separate command implementations from compatibility en…
jpsiddharth2008 Nov 6, 2026
217a621
refactor(examples): split flight booking into cohesive local modules
jpsiddharth2008 Nov 6, 2026
7d22631
style: remove whitespace inherited by extracted Python modules
jpsiddharth2008 Nov 6, 2026
b1f4dac
refactor(auth): split OAuth client types and follow-up tests
jpsiddharth2008 Nov 7, 2026
6d746c1
refactor(cli): extract packaging file selection and metadata
jpsiddharth2008 Nov 7, 2026
5801247
refactor(cli): extract wheel assembly with compatible build callbacks
jpsiddharth2008 Nov 7, 2026
7c3c9dd
fix(cli): only treat helpers that build a WidgetOptions as widget rou…
ROHIT-JR Nov 7, 2026
d0acac8
refactor(auth): split oauth.py into types, cache, token and discovery…
ROHIT-JR Nov 7, 2026
2abfea0
refactor(widgets): split route templates and views by widget family (…
ROHIT-JR Nov 7, 2026
e26a077
fix(cli): resolve widget helpers by data flow and import binding (#116)
ROHIT-JR Nov 8, 2026
87840a4
Merge pull request #124 from Prateep07/docs/file-length-limit-investi…
manish-wekan Nov 9, 2026
fb744f6
Merge pull request #118 from nitrocloudofficial/docs/remove-pr37-revi…
manish-wekan Nov 9, 2026
fc85319
Merge pull request #127 from ROHIT-JR/fix/116-validate-helper-widgets
manish-wekan Nov 9, 2026
e9e81ba
Merge pull request #132 from ROHIT-JR/refactor/122-split-oauth
manish-wekan Nov 9, 2026
c22877a
Merge pull request #133 from ROHIT-JR/refactor/121-split-widget-views
manish-wekan Nov 9, 2026
a82a614
Merge pull request #126 from AadarshM07/issue#111
manish-wekan Nov 9, 2026
d88ec06
Handle missing posthog and drop it from vendored pyproject.
manish-wekan Nov 9, 2026
d3f1029
Rewrite telemetry opt-out tests using telemetry_env.
manish-wekan Nov 9, 2026
7971e3f
Document telemetry flush limits and pack dry-run.
manish-wekan Nov 9, 2026
b5f6c3d
fix(cli): follow re-exported SDK names and ignore non-SDK .widget dec…
ROHIT-JR Nov 10, 2026
ee1ea1d
fix(auth): retry on busy port and report bound port in discovery serv…
AadarshM07 Nov 10, 2026
a957f3c
refactor: split HTTP transport into modules
Shreyavemana Nov 10, 2026
416e932
Merge pull request #136 from ROHIT-JR/fix/widget-routes-reexport-and-…
manish-wekan Nov 12, 2026
6cc83aa
Merge pull request #137 from Shreyavemana/refactor/125-split-http-tra…
manish-wekan Nov 12, 2026
e4fe095
Merge pull request #129 from Prateep07/refactor/split-core-app
manish-wekan Nov 12, 2026
4fd4e5c
Merge pull request #131 from jpsiddharth2008/feature/issue-123-pack-r…
manish-wekan Nov 12, 2026
de7cace
Merge pull request #130 from jpsiddharth2008/feature/issue-119-cli-ex…
manish-wekan Nov 12, 2026
ed2b725
Merge pull request #128 from jpsiddharth2008/feature/issue-115-oauth-…
manish-wekan Nov 12, 2026
22c1934
Merge develop into feature/analytics-telemetry
manish-wekan Nov 25, 2026
02bd3dc
Merge pull request #134 from AadarshM07/issue#117
manish-wekan Nov 25, 2026
199e40a
Merge pull request #135 from nitrocloudofficial/feature/analytics-tel…
manish-wekan Nov 25, 2026
0ad9b27
Merge main into develop
manish-wekan Nov 25, 2026
c9daf8c
feat(core): default app mode to openai (TS 1.1.3)
manish-wekan Nov 25, 2026
432e333
feat(core): expose tool arguments on ExecutionContext.input (TS #373)
manish-wekan Nov 25, 2026
d4e0263
feat(transports): configurable JSON body limit (TS #366)
manish-wekan Nov 25, 2026
5ac26d3
fix(templates): harden starter calculator tools (TS #368)
manish-wekan Nov 25, 2026
1ba549c
fix: review fixes for TS sync
manish-wekan Nov 25, 2026
717b713
fix: review fixes for TS sync
manish-wekan Nov 25, 2026
063cf32
fix: review fixes for TS sync
manish-wekan Nov 25, 2026
b064874
fix: review fixes for TS sync
manish-wekan Nov 25, 2026
2b5765f
fix: review fixes for TS sync
manish-wekan Nov 25, 2026
bcf98e0
perf(tools/list): cache tool input JSON schemas at bootstrap (130 -> …
manish-wekan Nov 25, 2026
e9606ff
fix(templates): ship main and app_module in packed wheels
manish-wekan Nov 25, 2026
e3bffa9
fix(tools/list): lazy spillover/schema cache and isolate inputSchema …
manish-wekan Nov 25, 2026
751a454
perf(import): lazy public API + lightweight nitrostack-py entry (~500…
manish-wekan Nov 25, 2026
e21f75f
fix(core): deterministic tools/list order
manish-wekan Nov 25, 2026
4416f5b
fix(import): keep subpackage attribute access with lazy exports
manish-wekan Nov 25, 2026
1f80153
fix(cli): dev hot reload restarts child reliably and serves new code
manish-wekan Nov 25, 2026
7ce8d8f
fix(cli): pin minimum nitrostack version in generated/packed projects
manish-wekan Nov 25, 2026
fd6514a
fix(cli): keep dev server output visible
manish-wekan Nov 26, 2026
5367c50
chore: restore release automation removed by c625ff8
manish-wekan Nov 26, 2026
2a3c007
chore(release): 0.5.0
manish-wekan Nov 26, 2026
364e412
fix(cli): only signal process groups that dev created
manish-wekan Nov 26, 2026
20fe2c1
Merge pull request #138 from nitrocloudofficial/feat/ts-sync-1.1.3
manish-wekan Nov 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NitroStack Python SDK / CLI — analytics (see docs/analytics-events.md)
# Optional: override the built-in public PostHog project key (never commit non-public values).
NITROSTACK_POSTHOG_KEY=
# Optional: PostHog ingest host (default US Cloud).
NITROSTACK_POSTHOG_HOST=https://us.i.posthog.com
# production | staging | development (default: inferred from NODE_ENV / CI).
NITROSTACK_ENVIRONMENT=
# Set to 0/false/off to disable CLI telemetry (DO_NOT_TRACK=1 also disables).
NITROSTACK_TELEMETRY=
14 changes: 14 additions & 0 deletions .file_length_baseline.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"examples/flight_booking_server.py": 582,
"nitrostack/auth/oauth.py": 516,
"nitrostack/core/app.py": 2273,
"nitrostack/transports/http.py": 797,
"nitrostack/widgets/route_templates.py": 870,
"nitrostack/widgets/views.py": 569,
"tests/test_cli.py": 1589,
"tests/test_oauth.py": 1011,
"tests/test_secret_value.py": 515,
"tests/test_tasks.py": 574,
"tests/test_transports.py": 732,
"tests/test_widgets.py": 629
}
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,17 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Secure pip bootstrap (eMudhra/emSign advisory)
run: |
python -m pip install "pip @ https://files.pythonhosted.org/packages/3f/06/3e4420302363fbb71be3c7f35ce042f54bfca330e3e66b3a2e3c4cca579f/pip-26.2.2-py3-none-any.whl#sha256=fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70"
python -m pip install --upgrade "certifi>=2026.10.19"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
python -m pip install -e ".[dev]"

- name: Check Python file length policy
run: python scripts/check_file_lengths.py

- name: Run pytest with coverage
run: pytest tests --cov=nitrostack --cov-report=term-missing --timeout=60
56 changes: 56 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Contributing to Nitrostack Python SDK

Welcome! This guide explains our development workflow and coding policies to help you contribute smoothly.

---

## Quick Start for Developers

```bash
# 1. Set up virtual environment and install dev dependencies
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# 2. Run tests
pytest tests

# 3. Check Python file-length policy
python scripts/check_file_lengths.py
```

---

## Python File-Length Policy

To keep modules focused and reviewable, we enforce a **500 physical-line limit** on Python files.

### The Rule
* **New files & standard files:** Must be **500 lines or fewer**.
* **Lines counted:** Total physical lines (including blanks, comments, docstrings, and multiline strings).
* **Scope:** Tracked `*.py` files in `nitrostack/`, `tests/`, `examples/`, and `scripts/`. Embedded templates in Python files count toward this limit.
* **Exempt:** Documentation (`.md`), static assets (HTML/CSS/JS), lockfiles, vendored packages, and generated build output.

---

## Working with Existing Oversized Files (The Ratchet)

A set of pre-existing legacy files exceed 500 lines. Instead of forcing immediate file splits, we use a **ratchet** tracked in [`.file_length_baseline.json`](.file_length_baseline.json):

1. **They cannot grow:** CI fails if any legacy file exceeds its current baseline number.
2. **They can shrink:** When you refactor or shrink an oversized file, lower its baseline automatically with:
```bash
python scripts/check_file_lengths.py --update-baseline
```
Then commit the updated `.file_length_baseline.json` with your PR.
3. **Graduation:** Once a legacy file reaches 500 lines or fewer, `--update-baseline` automatically removes it from the baseline. From that point on, it is capped at 500 lines forever.

> **Need an exception?** Any baseline increase is exceptional and must be explicitly justified and approved during code review.

---

## Continuous Integration (CI)

Our GitHub Actions workflow automatically checks every PR across Python 3.10, 3.11, and 3.12:
1. **File-length check:** Runs `python scripts/check_file_lengths.py`.
2. **Test suite:** Runs `pytest tests --cov=nitrostack --cov-report=term-missing --timeout=60`.
666 changes: 456 additions & 210 deletions README.md

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions docs/analytics-events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# NitroStack Python SDK CLI — analytics events

Telemetry uses a **built-in public PostHog project key** (same ingest as the TypeScript CLI). Set `NITROSTACK_POSTHOG_KEY` only if you need to override that key. Telemetry is **off** when `DO_NOT_TRACK=1`, when `NITROSTACK_TELEMETRY=0` (or `false`/`off`/`no`), during pytest (`PYTEST_CURRENT_TEST`), and in CI when `NITROSTACK_TELEMETRY` is unset (set it to a truthy value to allow capture in CI).

On process exit the CLI runs a **best-effort flush** (PostHog `shutdown` on a background thread, joined for up to **2 seconds**). Events still in the queue after that window may not be delivered; command completion is never blocked longer than that timeout.

`pack --dry-run` lists files that would be packed but does **not** emit `cli_deploy_completed` or `cli_deploy_failed`.

## Super properties

Sent on every captured event:

| Property | Description |
|----------|-------------|
| `product` | `python_sdk` |
| `surface` | `terminal` |
| `environment` | `production`, `staging`, or `development` (from `NITROSTACK_ENVIRONMENT` or heuristics) |
| `app_version` | Installed `nitrostack` package version |
| `python_version` | Interpreter version |
| `sdk_version` | Same as `app_version` |
| `os_platform` | `sys.platform` |
| `os_arch` | `platform.machine()` |

## Events

| Event | When | Properties |
|-------|------|------------|
| `cli_command_invoked` | Every subcommand after parse | `command`: subcommand name (`init`, `pack`, …) |
| `cli_init_completed` | `init` finishes successfully | `template`, `skip_install`, `duration_ms`, `has_custom_description` |
| `cli_login_completed` | After `nitrostack-py login` succeeds (identity helper) | `user_email`, `cloud_user_id` (+ super properties) |
| `cli_deploy_completed` | `pack` writes a valid wheel | none beyond super properties |
| `cli_deploy_failed` | `pack` raises before success | `error_code`: exception type name (truncated) |

## Identity

- **Anonymous:** distinct id = first 16 hex chars of SHA-256(`hostname`:`username`), same scheme as the TypeScript CLI.
- **Login:** `login` runs `alias(anonymous, user_id)`, `identify(user_id, { email })`, optional `group_identify('organization', org_id)`, then `cli_login_completed`. Subsequent events use the Cloud user id as distinct id.

## Code locations

- Module: `nitrostack/cli/telemetry.py`
- CLI wiring: `nitrostack/cli/main.py` (`track_command_invoked`, `login`, `shutdown_telemetry`)
- Init: `nitrostack/cli/_project_init.py` (`cli_init_completed`)
- Deploy: `nitrostack/cli/pack.py` (`cli_deploy_*`)
85 changes: 85 additions & 0 deletions docs/investigations/discovery-http-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Investigation: TypeScript `DiscoveryHttpServer` vs the Python SDK (#77)

Checked against: Python `nitrostack-python-sdk` `develop` at `fb0faf8`;
TypeScript `nitrocloudofficial/nitrostack` at `10859bef`. Date: 2026-11-03.

## 1. What the TypeScript server does
File: `typescript/packages/core/src/core/transports/discovery-http-server.ts`

- Options (`:11-18`): `port`, `autoRetry`, `maxRetries`.
- Defaults (`:53-67`): with an options object, `port` 3005, `autoRetry` true,
`maxRetries` 10. With the legacy numeric constructor, `autoRetry` false.
- Retry (`:23-45`, `:97-109`): when `autoRetry` is on, `findAvailablePort` probes
`port`, `port+1`, ... up to `maxRetries` using a throwaway `net` server, then
listens on the first free port. It throws if none is free.
- Without `autoRetry`, an `EADDRINUSE` error is logged with a hint to set
`OAUTH_DISCOVERY_PORT` and the start promise rejects (`:117-127`).
- Reporting (`:93-95`): `getPort()` returns the port actually used.
- Routing (`:72-87`): exact-match path handlers registered with `on(path, handler)`;
unknown paths return 404. Bind address is not passed to `listen`, so Node's default applies.

## 2. Consumers in the TypeScript stack
| Consumer | File:line | Use |
|---|---|---|
| `OAuthModule.start()` | `core/oauth-module.ts:560-569` | In stdio mode, creates the server with `autoRetry` (env `OAUTH_DISCOVERY_AUTO_RETRY`, default on, `:549`) and `maxRetries: 50` (`:554`), reads `getPort()`, then emits the port to the client. |
| `OAuthModule.start()` fallback | `core/oauth-module.ts:610-617` | Starts the same server if the HTTP transport is missing in http/dual mode. |
| `registerDiscoveryHandlers` | `core/oauth-module.ts:667-673` | Registers `/.well-known/oauth-authorization-server`, `/.well-known/oauth-protected-resource`, and `/oauth/v2/register` when client registration is enabled. |
| `notifyClientAboutOAuth` | `core/oauth-module.ts:639-657` | Writes `[NITROSTACK_OAUTH]{...}[/NITROSTACK_OAUTH]` to stderr with the actual port and well-known URLs. |
| CLI template docs | `packages/cli/templates/typescript-oauth/OAUTH_SETUP.md:97,210,350` | Documents port 3005 and the startup log line. |
| Tests | `transport.http.test.ts:111-172`, `transports.test.ts:244-288`, `oauth.extended.test.ts:39-41` | Cover the retry and no-retry options (ports 34508/34509). |

Within `typescript/packages`, outside tests and templates, the only consumer is
`OAuthModule`. No other code in that tree (including the CLI sources) references it.
**Not checked:** NitroStudio's source is not in this repository, so whether Studio
parses the `[NITROSTACK_OAUTH]` marker could not be verified.

## 3. Current Python behaviour
| Concern | Location | Behaviour |
|---|---|---|
| Startup | `nitrostack/core/app.py:1958-1966` | `McpApplication.start()` calls `OAuthService.start_discovery_server()` only when an `OAuthService` is registered in the container. |
| Bind | `nitrostack/auth/oauth.py:259-274` | A daemon thread builds `HTTPServer(("localhost", port), DiscoveryHandler)` once. No probing and no retry. |
| Port setting | `nitrostack/auth/oauth.py:261` | `int(os.environ.get("OAUTH_DISCOVERY_PORT", self.discovery_port))`: the **environment variable wins** over the `for_root(discovery_port=...)` value. `oauth_module.py` contains no port logic. |
| Failure | `nitrostack/auth/oauth.py:275-277` | Any exception is written to stderr and swallowed. The thread ends, `_server` stays `None`, and the app keeps running with no discovery server. |
| Reporting | `nitrostack/auth/oauth.py:264-273` | Writes `[NITROSTACK_OAUTH]{port, resource_uri, authorization_servers}[/NITROSTACK_OAUTH]` to stderr. The TypeScript marker carries more fields: `type`, `scopesSupported` and `wellKnownEndpoints`. |
| CLI ports | `nitrostack/cli/main.py` `_resolve_runtime_ports`, `_normalize_port` | Resolve the MCP and widget ports (`--port`, `--widget`, env, defaults 3000/3001). Unrelated to OAuth discovery; no retry. |

### Probe: preferred port already in use
`scripts/probe_discovery_port.py` reserves a port, then starts the Python discovery server on it.
Output on Windows (Python 3.12):
busy port: 58380
Failed to start OAuth Discovery Server on port 58380: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
server object: None
bound to: None
GET failed: TimeoutError timed out

The server does not start, no port is reported, and the application is not told.
Note: Windows returned `WinError 10013` rather than the usual address-in-use error,
which is how it reports binding to a port held by another socket here.

## 4. Comparison
| Capability | TypeScript | Python | Gap? |
|---|---|---|---|
| Separate discovery server | yes, stdio mode and as fallback | yes, always a background thread when OAuth is registered | no |
| Preferred port | option, default 3005, env `OAUTH_DISCOVERY_PORT` | env or `discovery_port` | no |
| Retry on busy port | `autoRetry`, `maxRetries` (50 in OAuthModule) | none | **yes** |
| Actual port available to code | `getPort()` and `OAuthModule.discoveryInfo` | no | yes |
| Port reported to the host tool | stderr marker with port and well-known URLs | stderr marker with port only | partial |
| Behaviour on bind failure | start promise rejects | logged and swallowed; no server | yes |
| Only started when OAuth is configured | yes | yes | no |

## 5. Conclusion
**Open an implementation issue; do not close this one.** The two servers match in
purpose, endpoints and stderr marker. They differ in port conflicts: TypeScript tries
up to 50 ports and reports the one it used, while Python makes one attempt and silently
runs without discovery when the port is taken, as the probe shows. A client that reads
the marker will then never receive a port.

Proposed scope for the follow-up (link here once opened):
- Retry on a busy port, controlled by `OAUTH_DISCOVERY_AUTO_RETRY` and a max-retries
limit, with the same defaults as TypeScript (on, 50).
- Store the actual port on `OAuthService` and put it in the stderr marker.
- Surface bind failures instead of swallowing them.
- Tests: busy port with retry, retries exhausted, port reported.

Out of scope: matching the TypeScript marker's extra fields, until it is known
whether NitroStudio consumes them.
Loading
Loading