sp2react 0.1.2__tar.gz → 0.1.3__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.
- sp2react-0.1.3/CHANGELOG.md +76 -0
- {sp2react-0.1.2/src/sp2react.egg-info → sp2react-0.1.3}/PKG-INFO +28 -15
- {sp2react-0.1.2 → sp2react-0.1.3}/README.md +22 -6
- {sp2react-0.1.2 → sp2react-0.1.3}/pyproject.toml +26 -14
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/__init__.py +1 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/core.py +1 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/tasks.py +40 -8
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/aspx.py +15 -2
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/behaviors.py +14 -16
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/fields.py +17 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/inventory.py +34 -9
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/jsscan.py +6 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/checks.py +2 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/config.py +15 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/dbmap.py +4 -6
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/llm/providers.py +4 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/migrate.py +73 -17
- sp2react-0.1.3/src/sp2react/model.py +284 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/net.py +2 -2
- sp2react-0.1.3/src/sp2react/ntlm.py +196 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/pipeline.py +36 -11
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/generate.py +84 -9
- sp2react-0.1.3/src/sp2react/scaffold/released_templates.json +146 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/api.py +75 -15
- sp2react-0.1.3/src/sp2react/scaffold/templates/backend/app/auth.py +45 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/main.py +8 -3
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/rules.py +2 -6
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/sp_repo.py +37 -11
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/sql_repo.py +15 -2
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/store.py +1 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/api.ts +11 -11
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/GenericPage.tsx +1 -1
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/components/sp/LegacyHtml.tsx +8 -0
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/components/sp/ListView.tsx +85 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/fields.tsx +27 -1
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/runtime/caml.ts +141 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/runtime/format.ts +3 -0
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/runtime/sanitize.ts +181 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/runtime/spec.ts +1 -1
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/runtime/values.ts +59 -0
- sp2react-0.1.3/src/sp2react/scaffold/templates/frontend/src/runtime/views.ts +43 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/screens/ListFormScreen.tsx +2 -3
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/styles/sp.css +3 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/sharepoint/client.py +58 -20
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/sharepoint/extract.py +11 -2
- sp2react-0.1.3/src/sp2react/spec/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/spec/base.py +1 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/spec/coverage.py +7 -3
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/spec/model.py +1 -1
- sp2react-0.1.3/src/sp2react/transport.py +322 -0
- sp2react-0.1.3/src/sp2react/yamlish.py +427 -0
- {sp2react-0.1.2 → sp2react-0.1.3/src/sp2react.egg-info}/PKG-INFO +28 -15
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react.egg-info/SOURCES.txt +18 -1
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react.egg-info/requires.txt +1 -4
- sp2react-0.1.3/tests/conftest.py +75 -0
- sp2react-0.1.3/tests/fuzz/fuzz_config_yaml.py +32 -0
- sp2react-0.1.3/tests/fuzz/fuzz_legacy_code.py +29 -0
- sp2react-0.1.3/tests/fuzz/fuzz_spec.py +32 -0
- sp2react-0.1.3/tests/fuzz/fuzz_wire.py +50 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/migrated_db.py +7 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/mock_sharepoint.py +8 -0
- sp2react-0.1.3/tests/test_fidelity.py +170 -0
- sp2react-0.1.3/tests/test_hardening.py +336 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/test_network.py +4 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/test_pipeline.py +4 -5
- sp2react-0.1.3/tests/test_stdlib.py +249 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/ui_walkthrough.py +3 -2
- sp2react-0.1.2/CHANGELOG.md +0 -40
- sp2react-0.1.2/src/sp2react/scaffold/templates/backend/app/auth.py +0 -33
- sp2react-0.1.2/src/sp2react/scaffold/templates/frontend/src/components/sp/LegacyHtml.tsx +0 -9
- sp2react-0.1.2/src/sp2react/scaffold/templates/frontend/src/components/sp/ListView.tsx +0 -59
- sp2react-0.1.2/tests/conftest.py +0 -4
- {sp2react-0.1.2 → sp2react-0.1.3}/LICENSE +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/MANIFEST.in +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/SECURITY.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/setup.cfg +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/setup.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/dbmap.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/fix.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/handler.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/page.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/review.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/agents/prompts/spec.md +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/analysis/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/cli.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/llm/__init__.py +0 -0
- /sp2react-0.1.2/src/sp2react/scaffold/__init__.py → /sp2react-0.1.3/src/sp2react/py.typed +0 -0
- {sp2react-0.1.2/src/sp2react/scaffold/templates/backend/app → sp2react-0.1.3/src/sp2react/scaffold}/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/rule_vectors.json +0 -0
- {sp2react-0.1.2/src/sp2react/sharepoint → sp2react-0.1.3/src/sp2react/scaffold/templates/backend/app}/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/custom/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/app/odata.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/requirements.txt +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/tests/conftest.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/backend/tests/test_rule_vectors.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/index.html +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/package.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/scripts/check-rules.ts +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/Banner.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/DataTable.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/Form.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/Layout.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/components/sp/Tiles.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/custom/types.ts +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/main.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/runtime/rules.ts +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/runtime/user.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/screens/LegacyRedirect.tsx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/src/vite-env.d.ts +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/tsconfig.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react/scaffold/templates/frontend/vite.config.ts +0 -0
- {sp2react-0.1.2/src/sp2react/spec → sp2react-0.1.3/src/sp2react/sharepoint}/__init__.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react.egg-info/dependency_links.txt +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react.egg-info/entry_points.txt +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/src/sp2react.egg-info/top_level.txt +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/agent_responses/dbmap/mapping.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/agent_responses/page/Dashboard.txt +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/agent_responses/spec/Dashboard.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/agent_responses/spec/VendorRequests-form.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/Lists/VendorRequests/Attachments/2/customs-bond.pdf +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/css/dashboard.css +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/css/vendor-request.css +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/html/review-instructions.html +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/js/dashboard.js +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/js/jquery-1.12.4.min.js +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/js/jquery.SPServices-2014.02.min.js +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/files/SiteAssets/js/vendor-request-form.js +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/ComplianceAlerts/fields.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/ComplianceAlerts/items.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/CostCenters/fields.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/CostCenters/items.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/Countries/fields.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/Countries/items.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/Departments/fields.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/Departments/items.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/VendorRequests/fields.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/lists/VendorRequests/items.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/pages/Lists/VendorRequests/DispForm.aspx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/pages/Lists/VendorRequests/EditForm.aspx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/pages/Lists/VendorRequests/NewForm.aspx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/pages/SitePages/Dashboard.aspx +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/pages/SitePages/Dashboard.aspx.webparts.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/rendered/SitePages/Dashboard.html +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/site.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/fixtures/legacy-site/siteusers.json +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/scripted_agents.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/test_agents.py +0 -0
- {sp2react-0.1.2 → sp2react-0.1.3}/tests/test_extract_inventory.py +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `sp2react` are documented here.
|
|
4
|
+
|
|
5
|
+
## [0.1.3] - 2026-11-19
|
|
6
|
+
|
|
7
|
+
Fixes found in a review of 0.1.2, no runtime dependencies, and the release standards of mssql-ocp-migrate and lodestream. Each fix has a test (`tests/test_hardening.py`, `tests/test_fidelity.py`, `tests/test_stdlib.py`) that fails on 0.1.2.
|
|
8
|
+
|
|
9
|
+
### Security
|
|
10
|
+
- Generated app: the catch-all route that serves the front end could return any file on the server (`/..%2fbackend%2f.env`, `/%2Fetc%2Fhostname`). It now serves only files inside `FRONTEND_DIST`
|
|
11
|
+
- Generated app: `AUTH_MODE` now defaults to `header` and fails closed (401 without the identity header). `dev` must be set explicitly, accepts requests from the same machine only, and no longer takes the user from the `?as=` query parameter. **Upgrade note:** set `AUTH_MODE=dev` when you run the app locally (the generated `.env.example` already does)
|
|
12
|
+
- Generated app: `/api/screens` and `/api/specs/{id}` now need a signed-in user
|
|
13
|
+
- Generated app: deleting an item and adding or removing attachments now follow the same role and lock rules as editing it (a locked item answered 204 to `DELETE`); attachment names are checked (no `/`, `\`, `..`, leading dots)
|
|
14
|
+
- Generated app: legacy Content Editor / Script Editor markup is rebuilt from an allow-list (`runtime/sanitize.ts`) instead of three regular expressions that `<svg/onload>`, unquoted and entity-encoded `javascript:` links got past
|
|
15
|
+
- Generated app (`DATA_SOURCE=sharepoint`): a user is matched by exact login, not by the first login that contains the text
|
|
16
|
+
- Agents: file paths proposed by the page, handler and fix agents must be plain relative paths inside the screen's folder; a path with `..` could overwrite `frontend/vite.config.ts` or write outside the output folder. Custom handler names must be identifiers
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- Columns whose internal name starts with `_` or a digit (`2nd Approver` is `_x0032_nd_x0020_Approver`, `OData__x0032_nd_x0020_Approver` in REST) were migrated empty while the reconciliation said every list matched. Fields now record their REST name (`rest_name`), migration and the SharePoint data source read it, and specs from 0.1.2 work through the same naming rule. Reconciliation now fails when a field is in no exported item
|
|
20
|
+
- SharePoint throttling (429, 503) and dropped connections are retried with `Retry-After` (`sharepoint.retries`, `sharepoint.max_retry_wait`). If a list's fields or views, or a page's source, still cannot be read, `extract` fails instead of passing with an empty screen
|
|
21
|
+
- List pages: the "Title (linked to item)" column (`LinkTitle`) showed an empty column headed "LinkTitle"; it is now the Title column linked to the item. The page opens the list's default view with that view's sort order, instead of sorting by `ID desc`
|
|
22
|
+
- Two pages with the same file name in different libraries (`SitePages/Home.aspx`, `Pages/Home.aspx`) no longer share one screen id: both get their folder in the id
|
|
23
|
+
- Regenerating the app overwrote files the team had changed, such as `backend/app/auth.py`. A changed file is now kept, and the new version is written next to it as `<file>.sp2react-new`. Apps generated by 0.1.0 to 0.1.2 are recognised, so their unchanged files are still updated
|
|
24
|
+
- Multi-value lookup columns were edited as a single choice and an edit kept one value; they are now a multi-select list and every value is saved
|
|
25
|
+
- Date-and-time columns showed the UTC clock as local time on the edit form, and saved values had no zone. They are now edited in the browser's time zone and stored in UTC (`...Z`), as SharePoint returns them; values with an offset are converted by the API
|
|
26
|
+
- Hyperlink columns lost their description; they are now `{url, description}` everywhere (form, list, migration, reconciliation; a `description_column` in the database mapping). Managed metadata was stored as the raw REST object (`[object Object]`); terms are now `{label, term_id}` with the label read from the field's hidden note column, shown read-only
|
|
27
|
+
- List views ignored the view's filter and showed only the first page. The `<Where>` of the view is translated to the API filter (comparisons, And/Or, In, Contains, BeginsWith, IsNull, `<UserID />`, `<Today />`), a filter that cannot be translated is reported on the page, and the list pages through all items
|
|
28
|
+
- The list API returned every row when `$top` was not given; like SharePoint it now answers 100 rows by default and at most 5,000
|
|
29
|
+
- Wiki pages: their text lives in the page's `WikiField` column, which was never read, so a wiki page converted to an empty screen. It is now extracted and treated like Content Editor text
|
|
30
|
+
- A list whose URL name contains a space failed the spec gate (`endpoint path ... must contain only path characters`); the API client now also encodes list names in URLs
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
- Supply chain, as in mssql-ocp-migrate and lodestream: hash-locked CI tool sets (`ci/requirements-*.txt`), a `zero-deps` job that installs and runs the package with nothing else installed, weekly `pip-audit` of every tool set and of the generated app's back end plus `npm audit` of its front end, ClusterFuzzLite fuzzing (`tests/fuzz`: config YAML, spec validation, ASPX/JavaScript analysis, NTLM challenges, the generated API's `$filter` parser), and an end-to-end workflow that runs `data_source: database` against real MySQL 8.4 and SQL Server 2022 containers
|
|
34
|
+
- Releases: published from GitHub releases only, with a check that the wheel declares no runtime dependencies, a CycloneDX SBOM, PyPI attestations, and Sigstore-signed wheel, sdist and SBOM on the GitHub release; `verify-release.yml` checks the signatures and that PyPI serves the same files
|
|
35
|
+
- Documentation site configuration for Read the Docs (Sphinx + MyST, warnings are errors), `CONTRIBUTING.md`, `THIRD_PARTY_NOTICES.md`; `ruff` and `mypy` clean
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- **No runtime dependencies.** `requests`, `requests-ntlm`, `pydantic` and `PyYAML` are replaced by standard-library code in the package: an HTTP client (`transport.py`: TLS verification or a CA bundle, proxies from `HTTPS_PROXY`/`NO_PROXY`, redirects checked hop by hop by the network policy), NTLMv2 Windows sign-in with channel binding on HTTPS (`ntlm.py`, checked against the MS-NLMP test vectors), validated records (`model.py`) and a YAML reader for the config file (`yamlish.py`, which refuses anchors, tags, tabs and duplicate keys with a line number). `pip install sp2react` installs one wheel. The `ntlm` extra remains, empty
|
|
39
|
+
- Docs: workflows, event receivers, InfoPath and Power Apps are listed as not detected (they were described as reported); remaining known gaps are listed in [12. Coverage and limitations](https://sp2react.readthedocs.io/en/latest/12-limitations.html)
|
|
40
|
+
|
|
41
|
+
## [0.1.2] - 2026-10-29
|
|
42
|
+
|
|
43
|
+
### Security
|
|
44
|
+
- Generated app front-end template moved to versions with no known vulnerabilities: Vite 6.4.4+ (was 5.4), react-router-dom 7.18.4+ (was 6.28), @vitejs/plugin-react 4.7. `npm audit` on the template reports 0 vulnerabilities; the generated app builds and passes the 29-step browser walkthrough
|
|
45
|
+
- Minimum versions raised past every known advisory: `requests>=2.33.0` (package and generated back end), `pymysql>=1.1.1` (`mysql` extra), `pytest>=9.0.3` (`dev` extra)
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- Dependabot for GitHub Actions, pip and the generated app templates
|
|
49
|
+
- CodeQL code scanning (Python, JavaScript/TypeScript)
|
|
50
|
+
- `setup.py` shim for tools that still call it
|
|
51
|
+
|
|
52
|
+
## [0.1.1] - 2026-10-29
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
- End-to-end documentation in `docs/`: how it works, installation (Windows, JFrog), configuration reference, Bridger and other model providers, SQL Server / MySQL / PostgreSQL and the mapping file, a full walkthrough, command reference, the generated app and deployment, security, troubleshooting, Python API, coverage and limitations
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
- `sp2react init` template and the generated `.env.example` show SQL Server connection URLs and `database.schema_name`
|
|
59
|
+
- README: run the generated API with `uvicorn --env-file .env` (the app does not load `.env` by itself)
|
|
60
|
+
- CI: every GitHub Action pinned to a commit SHA; Scorecard uses an existing `ossf/scorecard-action` release
|
|
61
|
+
|
|
62
|
+
## [0.1.0] - 2026-10-29
|
|
63
|
+
|
|
64
|
+
First public release.
|
|
65
|
+
|
|
66
|
+
### Added
|
|
67
|
+
- Ten-stage pipeline (inputs, extract, inventory, spec, approve spec, convert, review, test, fix, approve) with gating: a stage only starts when the one before it is done
|
|
68
|
+
- Read-only SharePoint extraction: `.aspx` source, browser-added web parts, Script Editor / Content Editor content and links, JSLink, custom scripts and CSS, list schemas, views, forms, groups, navigation
|
|
69
|
+
- Inventory of jQuery / SPServices behaviour with file:line references (show/hide, read-only, defaults, cascades, PreSaveAction validation, group checks, redirects, REST and SPServices calls)
|
|
70
|
+
- Spec model, deterministic base spec and a coverage gate that blocks approval until every required behaviour is covered and legacy texts are verbatim
|
|
71
|
+
- AI agents (Claude through GitHub Copilot Bridger by default; Anthropic, OpenAI and Azure OpenAI also supported) for spec, page, custom handler, review, fix and database mapping, each validated before its output is accepted
|
|
72
|
+
- Generated React (Vite + TypeScript) + FastAPI app: shared list-form engine driven by the spec, the same rule engine in the browser and the API (checked by shared test vectors), legacy URL redirects, SharePoint groups as roles
|
|
73
|
+
- `data_source: database`: the generated API reads and writes your existing tables (MySQL, SQL Server, PostgreSQL via SQLAlchemy) through a reviewed list-to-table mapping drafted by `sp2react map-db`; filters, sorting and paging run as SQL
|
|
74
|
+
- `data_source: sqlite`: full paged export of list items and attachments, loaded into a SQLite copy
|
|
75
|
+
- Field-by-field reconciliation report between SharePoint lists and the app's data (opt-in in database mode)
|
|
76
|
+
- Network policy: every request is checked against the configured SharePoint and model hosts, including redirects; list items, attachments, people and rendered pages are never read in database mode
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sp2react
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: AI-agent pipeline that converts classic SharePoint ASPX/jQuery list forms and pages into a React + FastAPI app on your existing database
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: AI-agent pipeline that converts classic SharePoint ASPX/jQuery list forms and pages into a React + FastAPI app on your existing database. Zero runtime dependencies.
|
|
5
5
|
Author: Karthikeyan Balasundaram
|
|
6
|
-
License: MIT
|
|
6
|
+
License-Expression: MIT
|
|
7
7
|
Project-URL: Homepage, https://github.com/karthikbd/sp2react
|
|
8
8
|
Project-URL: Source Code, https://github.com/karthikbd/sp2react
|
|
9
9
|
Project-URL: Repository, https://github.com/karthikbd/sp2react
|
|
10
10
|
Project-URL: Bug Tracker, https://github.com/karthikbd/sp2react/issues
|
|
11
11
|
Project-URL: Changelog, https://github.com/karthikbd/sp2react/blob/main/CHANGELOG.md
|
|
12
|
-
Project-URL: Documentation, https://
|
|
12
|
+
Project-URL: Documentation, https://sp2react.readthedocs.io
|
|
13
13
|
Keywords: sharepoint,sharepoint migration,react,fastapi,jquery,spservices,aspx,list forms,migration,code conversion,ai agents,claude
|
|
14
14
|
Classifier: Development Status :: 3 - Alpha
|
|
15
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -20,16 +20,12 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
-
Classifier:
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
24
|
Classifier: Operating System :: OS Independent
|
|
25
25
|
Requires-Python: >=3.10
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: pydantic>=2.5
|
|
29
|
-
Requires-Dist: pyyaml>=6.0
|
|
30
|
-
Requires-Dist: requests>=2.33.0
|
|
31
28
|
Provides-Extra: ntlm
|
|
32
|
-
Requires-Dist: requests-ntlm>=1.2; extra == "ntlm"
|
|
33
29
|
Provides-Extra: db
|
|
34
30
|
Requires-Dist: sqlalchemy>=2.0; extra == "db"
|
|
35
31
|
Provides-Extra: mysql
|
|
@@ -44,13 +40,18 @@ Requires-Dist: fastapi>=0.110; extra == "dev"
|
|
|
44
40
|
Requires-Dist: httpx>=0.27; extra == "dev"
|
|
45
41
|
Requires-Dist: uvicorn>=0.27; extra == "dev"
|
|
46
42
|
Requires-Dist: sqlalchemy>=2.0; extra == "dev"
|
|
43
|
+
Requires-Dist: requests>=2.33.0; extra == "dev"
|
|
47
44
|
Dynamic: license-file
|
|
48
45
|
|
|
49
46
|
# sp2react
|
|
50
47
|
|
|
51
48
|
[](https://pypi.org/project/sp2react/)
|
|
52
49
|
[](https://pypi.org/project/sp2react/)
|
|
50
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/tests.yml)
|
|
51
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/e2e.yml)
|
|
52
|
+
[](https://sp2react.readthedocs.io)
|
|
53
53
|
[](LICENSE)
|
|
54
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/cflite_batch.yml)
|
|
54
55
|
[](https://securityscorecards.dev/viewer/?uri=github.com/karthikbd/sp2react)
|
|
55
56
|
|
|
56
57
|
Convert classic SharePoint (2013 / 2016 / 2019 / Subscription Edition) list forms and pages built with **ASPX, jQuery and SPServices** into a **React + FastAPI** app that runs on **your existing database**.
|
|
@@ -102,13 +103,25 @@ Plain code does everything mechanical. AI agents (Claude through your GitHub Cop
|
|
|
102
103
|
## Installation
|
|
103
104
|
|
|
104
105
|
```bash
|
|
105
|
-
pip install
|
|
106
|
-
pip install "sp2react[
|
|
107
|
-
pip install "sp2react[
|
|
106
|
+
pip install sp2react # the tool itself: no other packages are downloaded
|
|
107
|
+
pip install "sp2react[mysql]" # plus SQLAlchemy + PyMySQL, for MySQL / MariaDB tables
|
|
108
|
+
pip install "sp2react[mssql]" # plus SQLAlchemy + pyodbc, for SQL Server tables (also needs Microsoft ODBC Driver 18)
|
|
108
109
|
```
|
|
109
110
|
|
|
111
|
+
**No runtime dependencies.** The HTTP client, Windows (NTLM) sign-in, the YAML reader and the spec validation are
|
|
112
|
+
part of the package and use only the Python standard library, so `pip install sp2react` pulls in nothing else and
|
|
113
|
+
an air-gapped install is one wheel. The database extras are needed only for `data_source: database`.
|
|
114
|
+
|
|
110
115
|
Python 3.10+. Node.js 20+ is needed to build the generated React app.
|
|
111
116
|
|
|
117
|
+
## Security and supply chain
|
|
118
|
+
|
|
119
|
+
No runtime dependencies, no telemetry; connections go only to the SharePoint site and the model endpoint in your
|
|
120
|
+
config. Releases are published with PyPI Trusted Publishing and carry provenance attestations, plus
|
|
121
|
+
Sigstore-signed assets and a CycloneDX SBOM on GitHub. CI is hash-locked, runs a weekly `pip-audit` (and `npm audit`
|
|
122
|
+
of the generated app's front end), CodeQL, OpenSSF Scorecard and ClusterFuzzLite fuzzing of the parsers. See
|
|
123
|
+
[SECURITY.md](SECURITY.md).
|
|
124
|
+
|
|
112
125
|
## Quick Start
|
|
113
126
|
|
|
114
127
|
```bash
|
|
@@ -190,7 +203,7 @@ cd converted-app/frontend && npm install && npm run dev
|
|
|
190
203
|
- Behaviour comes from the spec at runtime. `runtime/rules.ts` (browser) and `app/rules.py` (API) interpret the same rules, and shared vectors keep them in agreement, so a direct API call cannot bypass a rule.
|
|
191
204
|
- The form uses SharePoint's layout, labels and control titles, the legacy site CSS is carried over, and old URLs (`/Lists/X/EditForm.aspx?ID=3&Source=...`) redirect to the new routes.
|
|
192
205
|
- SharePoint groups become roles. Membership comes from your users/groups tables or `data/roles.json`.
|
|
193
|
-
- Authentication: `AUTH_MODE=
|
|
206
|
+
- Authentication: `AUTH_MODE=header` (default) behind your gateway, or Entra ID in `app/auth.py`; `AUTH_MODE=dev` for local work only.
|
|
194
207
|
|
|
195
208
|
## Use it from your own tool
|
|
196
209
|
|
|
@@ -214,8 +227,8 @@ p.state # also written to sp2react-work/state.json
|
|
|
214
227
|
|
|
215
228
|
| Converts | Needs your input, or is not converted yet |
|
|
216
229
|
|---|---|
|
|
217
|
-
| List forms (New/Edit/Display) and their jQuery/SPServices behaviour | Workflows, event receivers, compiled solutions: their code is not reachable over REST.
|
|
218
|
-
| Web part pages (SitePages) with Script Editor / Content Editor JavaScript | InfoPath and Power Apps forms:
|
|
230
|
+
| List forms (New/Edit/Display) and their jQuery/SPServices behaviour | Workflows, event receivers, compiled solutions: their code is not reachable over REST, and sp2react does not detect them yet. Check Site Contents; export the definitions or source to convert them |
|
|
231
|
+
| Web part pages (SitePages) with Script Editor / Content Editor JavaScript | InfoPath and Power Apps forms: not detected, not converted |
|
|
219
232
|
| Basic list views (columns, sort, row limit) | Views with filters and grouping, document libraries, custom master-page branding, rich grids (sort/search/select/export), modal dialogs: planned |
|
|
220
233
|
| SharePoint groups as roles, old URL redirects | Calculated columns are shown but not recomputed; managed metadata, item-level permissions, alert emails |
|
|
221
234
|
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/sp2react/)
|
|
4
4
|
[](https://pypi.org/project/sp2react/)
|
|
5
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/tests.yml)
|
|
6
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/e2e.yml)
|
|
7
|
+
[](https://sp2react.readthedocs.io)
|
|
5
8
|
[](LICENSE)
|
|
9
|
+
[](https://github.com/karthikbd/sp2react/actions/workflows/cflite_batch.yml)
|
|
6
10
|
[](https://securityscorecards.dev/viewer/?uri=github.com/karthikbd/sp2react)
|
|
7
11
|
|
|
8
12
|
Convert classic SharePoint (2013 / 2016 / 2019 / Subscription Edition) list forms and pages built with **ASPX, jQuery and SPServices** into a **React + FastAPI** app that runs on **your existing database**.
|
|
@@ -54,13 +58,25 @@ Plain code does everything mechanical. AI agents (Claude through your GitHub Cop
|
|
|
54
58
|
## Installation
|
|
55
59
|
|
|
56
60
|
```bash
|
|
57
|
-
pip install
|
|
58
|
-
pip install "sp2react[
|
|
59
|
-
pip install "sp2react[
|
|
61
|
+
pip install sp2react # the tool itself: no other packages are downloaded
|
|
62
|
+
pip install "sp2react[mysql]" # plus SQLAlchemy + PyMySQL, for MySQL / MariaDB tables
|
|
63
|
+
pip install "sp2react[mssql]" # plus SQLAlchemy + pyodbc, for SQL Server tables (also needs Microsoft ODBC Driver 18)
|
|
60
64
|
```
|
|
61
65
|
|
|
66
|
+
**No runtime dependencies.** The HTTP client, Windows (NTLM) sign-in, the YAML reader and the spec validation are
|
|
67
|
+
part of the package and use only the Python standard library, so `pip install sp2react` pulls in nothing else and
|
|
68
|
+
an air-gapped install is one wheel. The database extras are needed only for `data_source: database`.
|
|
69
|
+
|
|
62
70
|
Python 3.10+. Node.js 20+ is needed to build the generated React app.
|
|
63
71
|
|
|
72
|
+
## Security and supply chain
|
|
73
|
+
|
|
74
|
+
No runtime dependencies, no telemetry; connections go only to the SharePoint site and the model endpoint in your
|
|
75
|
+
config. Releases are published with PyPI Trusted Publishing and carry provenance attestations, plus
|
|
76
|
+
Sigstore-signed assets and a CycloneDX SBOM on GitHub. CI is hash-locked, runs a weekly `pip-audit` (and `npm audit`
|
|
77
|
+
of the generated app's front end), CodeQL, OpenSSF Scorecard and ClusterFuzzLite fuzzing of the parsers. See
|
|
78
|
+
[SECURITY.md](SECURITY.md).
|
|
79
|
+
|
|
64
80
|
## Quick Start
|
|
65
81
|
|
|
66
82
|
```bash
|
|
@@ -142,7 +158,7 @@ cd converted-app/frontend && npm install && npm run dev
|
|
|
142
158
|
- Behaviour comes from the spec at runtime. `runtime/rules.ts` (browser) and `app/rules.py` (API) interpret the same rules, and shared vectors keep them in agreement, so a direct API call cannot bypass a rule.
|
|
143
159
|
- The form uses SharePoint's layout, labels and control titles, the legacy site CSS is carried over, and old URLs (`/Lists/X/EditForm.aspx?ID=3&Source=...`) redirect to the new routes.
|
|
144
160
|
- SharePoint groups become roles. Membership comes from your users/groups tables or `data/roles.json`.
|
|
145
|
-
- Authentication: `AUTH_MODE=
|
|
161
|
+
- Authentication: `AUTH_MODE=header` (default) behind your gateway, or Entra ID in `app/auth.py`; `AUTH_MODE=dev` for local work only.
|
|
146
162
|
|
|
147
163
|
## Use it from your own tool
|
|
148
164
|
|
|
@@ -166,8 +182,8 @@ p.state # also written to sp2react-work/state.json
|
|
|
166
182
|
|
|
167
183
|
| Converts | Needs your input, or is not converted yet |
|
|
168
184
|
|---|---|
|
|
169
|
-
| List forms (New/Edit/Display) and their jQuery/SPServices behaviour | Workflows, event receivers, compiled solutions: their code is not reachable over REST.
|
|
170
|
-
| Web part pages (SitePages) with Script Editor / Content Editor JavaScript | InfoPath and Power Apps forms:
|
|
185
|
+
| List forms (New/Edit/Display) and their jQuery/SPServices behaviour | Workflows, event receivers, compiled solutions: their code is not reachable over REST, and sp2react does not detect them yet. Check Site Contents; export the definitions or source to convert them |
|
|
186
|
+
| Web part pages (SitePages) with Script Editor / Content Editor JavaScript | InfoPath and Power Apps forms: not detected, not converted |
|
|
171
187
|
| Basic list views (columns, sort, row limit) | Views with filters and grouping, document libraries, custom master-page branding, rich grids (sort/search/select/export), modal dialogs: planned |
|
|
172
188
|
| SharePoint groups as roles, old URL redirects | Calculated columns are shown but not recomputed; managed metadata, item-level permissions, alert emails |
|
|
173
189
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "sp2react"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
authors = [{name = "Karthikeyan Balasundaram"}]
|
|
9
|
-
description = "AI-agent pipeline that converts classic SharePoint ASPX/jQuery list forms and pages into a React + FastAPI app on your existing database"
|
|
9
|
+
description = "AI-agent pipeline that converts classic SharePoint ASPX/jQuery list forms and pages into a React + FastAPI app on your existing database. Zero runtime dependencies."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.10"
|
|
12
|
-
license =
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
13
14
|
keywords = [
|
|
14
15
|
"sharepoint", "sharepoint migration", "react", "fastapi", "jquery", "spservices",
|
|
15
16
|
"aspx", "list forms", "migration", "code conversion", "ai agents", "claude",
|
|
@@ -24,21 +25,17 @@ classifiers = [
|
|
|
24
25
|
"Programming Language :: Python :: 3.11",
|
|
25
26
|
"Programming Language :: Python :: 3.12",
|
|
26
27
|
"Programming Language :: Python :: 3.13",
|
|
27
|
-
"
|
|
28
|
+
"Typing :: Typed",
|
|
28
29
|
"Operating System :: OS Independent",
|
|
29
30
|
]
|
|
30
|
-
dependencies = [
|
|
31
|
-
"pydantic>=2.5",
|
|
32
|
-
"pyyaml>=6.0",
|
|
33
|
-
"requests>=2.33.0",
|
|
34
|
-
]
|
|
31
|
+
dependencies = [] # standard library only: HTTP + NTLM, YAML and validation are part of the package
|
|
35
32
|
|
|
36
33
|
[project.optional-dependencies]
|
|
37
|
-
ntlm = [
|
|
34
|
+
ntlm = [] # kept so `pip install sp2react[ntlm]` still works; NTLM is built in
|
|
38
35
|
db = ["sqlalchemy>=2.0"]
|
|
39
36
|
mysql = ["sqlalchemy>=2.0", "pymysql>=1.1.1"]
|
|
40
37
|
mssql = ["sqlalchemy>=2.0", "pyodbc>=5.0"]
|
|
41
|
-
dev = ["pytest>=9.0.3", "fastapi>=0.110", "httpx>=0.27", "uvicorn>=0.27", "sqlalchemy>=2.0"]
|
|
38
|
+
dev = ["pytest>=9.0.3", "fastapi>=0.110", "httpx>=0.27", "uvicorn>=0.27", "sqlalchemy>=2.0", "requests>=2.33.0"] # sp2react itself needs none; these run the generated app in tests
|
|
42
39
|
|
|
43
40
|
[project.scripts]
|
|
44
41
|
sp2react = "sp2react.cli:main"
|
|
@@ -49,14 +46,29 @@ Homepage = "https://github.com/karthikbd/sp2react"
|
|
|
49
46
|
Repository = "https://github.com/karthikbd/sp2react"
|
|
50
47
|
"Bug Tracker" = "https://github.com/karthikbd/sp2react/issues"
|
|
51
48
|
Changelog = "https://github.com/karthikbd/sp2react/blob/main/CHANGELOG.md"
|
|
52
|
-
Documentation = "https://
|
|
49
|
+
Documentation = "https://sp2react.readthedocs.io"
|
|
53
50
|
|
|
54
51
|
[tool.setuptools.packages.find]
|
|
55
52
|
where = ["src"]
|
|
56
53
|
include = ["sp2react*"]
|
|
57
54
|
|
|
58
55
|
[tool.setuptools.package-data]
|
|
59
|
-
sp2react = ["agents/prompts/*.md", "scaffold/*.json", "scaffold/templates/**/*"]
|
|
56
|
+
sp2react = ["py.typed", "agents/prompts/*.md", "scaffold/*.json", "scaffold/templates/**/*"]
|
|
60
57
|
|
|
61
58
|
[tool.pytest.ini_options]
|
|
62
59
|
testpaths = ["tests"]
|
|
60
|
+
|
|
61
|
+
[tool.ruff]
|
|
62
|
+
line-length = 140
|
|
63
|
+
target-version = "py310"
|
|
64
|
+
src = ["src"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint]
|
|
67
|
+
select = ["E", "F", "W", "B", "SIM"]
|
|
68
|
+
ignore = ["B008", "B023", "B027", "B905", "E501", "E731", "E741", "SIM105", "SIM115"]
|
|
69
|
+
|
|
70
|
+
[tool.mypy]
|
|
71
|
+
python_version = "3.10"
|
|
72
|
+
strict = false
|
|
73
|
+
ignore_missing_imports = true
|
|
74
|
+
exclude = ["src/sp2react/scaffold/templates/"]
|
|
@@ -9,7 +9,7 @@ import tempfile
|
|
|
9
9
|
from pathlib import Path
|
|
10
10
|
from typing import Any, Optional
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from ..model import ValidationError
|
|
13
13
|
|
|
14
14
|
from ..analysis.aspx import load_page
|
|
15
15
|
from ..analysis.inventory import Legacy
|
|
@@ -156,6 +156,35 @@ def run_spec_agent(agent: Agent, legacy: Legacy, inv: dict, base: Spec) -> tuple
|
|
|
156
156
|
return holder["spec"], res
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
# ------------------------------------------------------------ file paths
|
|
160
|
+
SAFE_PART = re.compile(r"^[A-Za-z0-9_][A-Za-z0-9_.\-]*$")
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def path_problem(rel: str, prefix: str = "") -> Optional[str]:
|
|
164
|
+
"""Why an agent-proposed path may not be written, or None. Plain relative paths under `prefix` only:
|
|
165
|
+
no '..', no absolute or drive paths, no backslashes, no hidden or odd file names."""
|
|
166
|
+
if not isinstance(rel, str) or not rel or "\\" in rel or rel.startswith("/") or re.match(r"^[A-Za-z]:", rel):
|
|
167
|
+
return f"{rel}: must be a relative path with forward slashes"
|
|
168
|
+
parts = rel.split("/")
|
|
169
|
+
if any(not SAFE_PART.match(x) for x in parts):
|
|
170
|
+
return f"{rel}: every part of the path must be a plain file or folder name (no '..', '.', spaces or hidden names)"
|
|
171
|
+
if prefix and not rel.startswith(prefix):
|
|
172
|
+
return f"{rel}: files must be under {prefix}"
|
|
173
|
+
return None
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def safe_target(out: Path, rel: str, prefix: str = "") -> Path:
|
|
177
|
+
"""The file to write for an agent-proposed path; raises ValueError if it would land outside `out/prefix`."""
|
|
178
|
+
why = path_problem(rel, prefix)
|
|
179
|
+
if why:
|
|
180
|
+
raise ValueError(why)
|
|
181
|
+
base = (out / prefix).resolve() if prefix else out.resolve()
|
|
182
|
+
target = (out / rel).resolve()
|
|
183
|
+
if base not in target.parents:
|
|
184
|
+
raise ValueError(f"{rel}: resolves outside {base}")
|
|
185
|
+
return target
|
|
186
|
+
|
|
187
|
+
|
|
159
188
|
# -------------------------------------------------------------- page agent
|
|
160
189
|
def ts_problems(out: Path, files: dict[str, str], timeout: int = 120) -> list[str]:
|
|
161
190
|
"""Type-check candidate files inside the generated frontend when its node_modules exist."""
|
|
@@ -166,7 +195,7 @@ def ts_problems(out: Path, files: dict[str, str], timeout: int = 120) -> list[st
|
|
|
166
195
|
backups = {}
|
|
167
196
|
try:
|
|
168
197
|
for rel, content in files.items():
|
|
169
|
-
p = out /
|
|
198
|
+
p = safe_target(out, rel, "frontend/src/")
|
|
170
199
|
backups[p] = p.read_text(encoding="utf-8") if p.exists() else None
|
|
171
200
|
p.parent.mkdir(parents=True, exist_ok=True)
|
|
172
201
|
p.write_text(content, encoding="utf-8")
|
|
@@ -190,8 +219,8 @@ def page_file_problems(files: dict[str, str], prefix: str, must_texts: list[str]
|
|
|
190
219
|
if not any(p == f"{prefix}Page.tsx" for p in files):
|
|
191
220
|
problems.append(f"Missing {prefix}Page.tsx")
|
|
192
221
|
for path, code in files.items():
|
|
193
|
-
if
|
|
194
|
-
problems.append(f"{path}: files must be .ts/.tsx under {prefix}")
|
|
222
|
+
if path_problem(path, prefix) or not path.endswith((".tsx", ".ts")):
|
|
223
|
+
problems.append(path_problem(path, prefix) or f"{path}: files must be .ts/.tsx under {prefix}")
|
|
195
224
|
continue
|
|
196
225
|
for mod in re.findall(r"""from\s+["']([^"']+)["']""", code):
|
|
197
226
|
if mod not in ALLOWED_PAGE_IMPORTS and not mod.startswith("./"):
|
|
@@ -241,7 +270,7 @@ def run_page_agent(agent: Agent, legacy: Legacy, inv: dict, spec: Spec, routes:
|
|
|
241
270
|
}
|
|
242
271
|
res = agent.run(sid, sections, validate)
|
|
243
272
|
for rel, content in res.output["files"].items():
|
|
244
|
-
p = out
|
|
273
|
+
p = safe_target(out, rel, prefix)
|
|
245
274
|
p.parent.mkdir(parents=True, exist_ok=True)
|
|
246
275
|
p.write_text(content, encoding="utf-8")
|
|
247
276
|
return res
|
|
@@ -250,6 +279,8 @@ def run_page_agent(agent: Agent, legacy: Legacy, inv: dict, spec: Spec, routes:
|
|
|
250
279
|
# ----------------------------------------------------------- handler agent
|
|
251
280
|
def run_handler_agent(agent: Agent, legacy: Legacy, inv: dict, spec: Spec, rule: Any, out: Path) -> AgentResult:
|
|
252
281
|
handler = rule.params["handler"]
|
|
282
|
+
if not re.match(r"^[A-Za-z_][A-Za-z0-9_]{0,63}$", str(handler)):
|
|
283
|
+
raise ValueError(f"handler name {handler!r} must be a plain identifier")
|
|
253
284
|
allowed = {f"frontend/src/custom/{handler}.ts", f"backend/app/custom/{handler}.py"}
|
|
254
285
|
|
|
255
286
|
def validate(parsed: dict) -> list[str]:
|
|
@@ -275,8 +306,9 @@ def run_handler_agent(agent: Agent, legacy: Legacy, inv: dict, spec: Spec, rule:
|
|
|
275
306
|
"sources": script_sources(legacy, inv)}
|
|
276
307
|
res = agent.run(f"{spec.screen.id}-{handler}", sections, validate)
|
|
277
308
|
for rel, content in res.output["files"].items():
|
|
278
|
-
|
|
279
|
-
|
|
309
|
+
p = safe_target(out, rel)
|
|
310
|
+
p.parent.mkdir(parents=True, exist_ok=True)
|
|
311
|
+
p.write_text(content, encoding="utf-8")
|
|
280
312
|
return res
|
|
281
313
|
|
|
282
314
|
|
|
@@ -348,7 +380,7 @@ def run_fix_agent(agent: Agent, inv: dict, spec: Spec, failures: str, out: Path,
|
|
|
348
380
|
sections = {"failures": failures[-12000:], "files": files, "spec": compact_spec(spec)}
|
|
349
381
|
res = agent.run(task_id, sections, validate)
|
|
350
382
|
for rel, content in res.output["files"].items():
|
|
351
|
-
(out
|
|
383
|
+
safe_target(out, rel).write_text(content, encoding="utf-8")
|
|
352
384
|
return res, holder.get("spec")
|
|
353
385
|
|
|
354
386
|
|
|
@@ -12,7 +12,7 @@ import json
|
|
|
12
12
|
import re
|
|
13
13
|
from dataclasses import dataclass, field
|
|
14
14
|
from pathlib import Path
|
|
15
|
-
from typing import
|
|
15
|
+
from typing import Optional
|
|
16
16
|
|
|
17
17
|
TAG_VALUE = r"<(?:\w+:)?{tag}\b[^>]*>(.*?)</(?:\w+:)?{tag}>"
|
|
18
18
|
|
|
@@ -244,6 +244,9 @@ def resolve_tokens(url: str, site_rel: str = "") -> str:
|
|
|
244
244
|
return url
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
WIKI_WP_BOX = re.compile(r'<div[^>]*class="[^"]*ms-rte-wpbox[^"]*"[^>]*>.*?</div>\s*</div>', re.S | re.I)
|
|
248
|
+
|
|
249
|
+
|
|
247
250
|
def load_page(legacy_dir: Path, rel_path: str) -> ParsedPage:
|
|
248
251
|
src = (legacy_dir / "pages" / rel_path).read_text(encoding="utf-8", errors="replace")
|
|
249
252
|
wpf = legacy_dir / "pages" / (rel_path + ".webparts.json")
|
|
@@ -251,4 +254,14 @@ def load_page(legacy_dir: Path, rel_path: str) -> ParsedPage:
|
|
|
251
254
|
if wpf.exists():
|
|
252
255
|
data = json.loads(wpf.read_text(encoding="utf-8"))
|
|
253
256
|
wpj = data.get("d", {}).get("results", data) if isinstance(data, dict) else data
|
|
254
|
-
|
|
257
|
+
page = parse_page(rel_path, src, wpj)
|
|
258
|
+
wiki = legacy_dir / "pages" / (rel_path + ".wiki.html")
|
|
259
|
+
if wiki.exists(): # a wiki page's own text (WikiField); its web parts are listed separately
|
|
260
|
+
body = WIKI_WP_BOX.sub("", wiki.read_text(encoding="utf-8", errors="replace"))
|
|
261
|
+
srcs, inline, css, stripped = scan_html(body)
|
|
262
|
+
page.scripts += srcs
|
|
263
|
+
page.stylesheets += css
|
|
264
|
+
page.inline_scripts += [{"where": "wiki", "code": c} for c in inline]
|
|
265
|
+
if stripped:
|
|
266
|
+
page.html_fragments.insert(0, {"web_part": "Page content", "html": stripped})
|
|
267
|
+
return page
|
|
@@ -156,8 +156,6 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
156
156
|
for ln in s.code_lines:
|
|
157
157
|
offsets.append(offsets[-1] + len(ln) + 1)
|
|
158
158
|
|
|
159
|
-
helper_funcs = {f.name for f in s.functions}
|
|
160
|
-
|
|
161
159
|
for i, line_code in enumerate(s.code_lines, start=1):
|
|
162
160
|
if not line_code.strip():
|
|
163
161
|
continue
|
|
@@ -184,10 +182,9 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
184
182
|
# a helper called with a field literal is the behaviour; the helper's own body is "info"
|
|
185
183
|
add("readonly", MUST if flds else INFO, i, off, fields=flds)
|
|
186
184
|
|
|
187
|
-
if SETVAL.search(line_code) and flds and not re.search(r"\.val\(\s*\)", line_code):
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
detail={"value": s.restore(line_code.split(".val(", 1)[1].rsplit(")", 1)[0]).strip()})
|
|
185
|
+
if SETVAL.search(line_code) and flds and not re.search(r"\.val\(\s*\)", line_code) and re.search(r"\$\(", line_code):
|
|
186
|
+
add("set_value", MUST, i, off, fields=flds, condition=if_condition(s, off + 1),
|
|
187
|
+
detail={"value": s.restore(line_code.split(".val(", 1)[1].rsplit(")", 1)[0]).strip()})
|
|
191
188
|
|
|
192
189
|
mm = MESSAGE_CALL.search(line_code)
|
|
193
190
|
if mm:
|
|
@@ -206,8 +203,8 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
206
203
|
if "ms-formvalidation" in lit.value or "ms-error" in lit.value:
|
|
207
204
|
pos = off + line_code.find(f"__S{lit.index}__")
|
|
208
205
|
cands = [(en - st, c) for (st, en, c) in concat_expressions(s) if st <= pos < en and not re.match(r"[\w$.]*\$\(", c)]
|
|
209
|
-
|
|
210
|
-
txt = re.sub(r"<[^>]+>", "", template(s,
|
|
206
|
+
msg_expr = min(cands)[1] if cands else None
|
|
207
|
+
txt = re.sub(r"<[^>]+>", "", template(s, msg_expr)) if msg_expr else re.sub(r"<[^>]+>", "", lit.value)
|
|
211
208
|
add("message", MUST, i, off, fields=flds, message=txt.strip(), condition=if_condition(s, off + 1),
|
|
212
209
|
detail={"presentation": "inline"})
|
|
213
210
|
break
|
|
@@ -236,7 +233,7 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
236
233
|
# ---------------------------------------------------------------- calls
|
|
237
234
|
calls: list[dict] = []
|
|
238
235
|
seen_urls = set()
|
|
239
|
-
for st,
|
|
236
|
+
for st, _en, expr in concat_expressions(s):
|
|
240
237
|
url = template(s, expr)
|
|
241
238
|
if "/_api/" not in url and "_vti_bin" not in url:
|
|
242
239
|
continue
|
|
@@ -245,11 +242,12 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
245
242
|
if parsed.get("resource") in ("list",) and not parsed.get("item") and parsed.get("op") is None and not parsed.get("query"):
|
|
246
243
|
continue # base URL definition such as `listUrl = site + "/_api/web/lists/getbytitle('X')"`
|
|
247
244
|
fn = (s.enclosing(st)[-1].name if s.enclosing(st) else None)
|
|
248
|
-
|
|
249
|
-
if
|
|
245
|
+
seen_key = (url, fn)
|
|
246
|
+
if seen_key in seen_urls:
|
|
250
247
|
continue
|
|
251
|
-
seen_urls.add(
|
|
252
|
-
method
|
|
248
|
+
seen_urls.add(seen_key)
|
|
249
|
+
method = "GET"
|
|
250
|
+
body: dict = {}
|
|
253
251
|
ajax = enclosing_call(s, st, r"(?:\$|jQuery)\.ajax")
|
|
254
252
|
if ajax:
|
|
255
253
|
props = {k: s.restore(v) for k, v in object_props(s, ajax[2]).items()}
|
|
@@ -277,7 +275,7 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
277
275
|
from .jsscan import match_brace
|
|
278
276
|
close_p = match_brace(s.code, open_p)
|
|
279
277
|
args = s.code[open_p + 1:close_p]
|
|
280
|
-
props = {k: (
|
|
278
|
+
props = {k: (lv.value if (lv := s.lit(v)) else s.restore(v)) for k, v in object_props(s, args).items()} if args.strip().startswith("{") else {}
|
|
281
279
|
sub = m.group(1) or "call"
|
|
282
280
|
op = props.get("operation") or sub
|
|
283
281
|
line = s.line_of(m.start())
|
|
@@ -291,8 +289,8 @@ def analyze_script(name: str, source: str, index: FieldIndex, prefer_list: Optio
|
|
|
291
289
|
for key in ("CAMLQuery", "CAMLViewFields"):
|
|
292
290
|
if key in props:
|
|
293
291
|
for fr in re.findall(r"FieldRef\s+Name=['\"](\w+)['\"]", props[key]):
|
|
294
|
-
|
|
295
|
-
flds += index.resolve(fr,
|
|
292
|
+
caml_list = index.list_titles.get((props.get("listName") or "").lower())
|
|
293
|
+
flds += index.resolve(fr, caml_list, internal_ok=True)
|
|
296
294
|
b = add(kind, MUST, line, m.start(), fields=flds, detail={"spservices": sub, "operation": op, **{k: v for k, v in props.items() if k not in ("completefunc",)}})
|
|
297
295
|
calls.append({"behavior": b.id, "type": "spservices", "operation": op, "function": sub, "line": line,
|
|
298
296
|
**{k: v for k, v in props.items() if k in ("listName", "CAMLQuery", "CAMLViewFields", "CAMLRowLimit", "webURL",
|
|
@@ -27,6 +27,13 @@ TYPE_MAP = {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def rest_name(f: dict) -> str:
|
|
31
|
+
"""The property name list items carry in REST: EntityPropertyName (OData__x0032_nd... for internal names
|
|
32
|
+
that start with '_' or a digit). SharePoint 2010 has no EntityPropertyName, so the same rule is applied here."""
|
|
33
|
+
name = f["InternalName"]
|
|
34
|
+
return f.get("EntityPropertyName") or (("OData_" + name) if re.match(r"[_0-9]", name) else name)
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
def _choices(f: dict) -> list[str]:
|
|
31
38
|
c = f.get("Choices")
|
|
32
39
|
return list(unwrap(c) or []) if c else []
|
|
@@ -41,6 +48,8 @@ def map_field(f: dict, list_by_id: dict[str, str]) -> Optional[dict]:
|
|
|
41
48
|
t = f.get("TypeAsString", "Text")
|
|
42
49
|
spec: dict = {"name": name, "label": f.get("Title", name), "type": TYPE_MAP.get(t, "text"), "sp_type": t,
|
|
43
50
|
"required": bool(f.get("Required"))}
|
|
51
|
+
if rest_name(f) != name:
|
|
52
|
+
spec["rest_name"] = rest_name(f)
|
|
44
53
|
if f.get("Description"):
|
|
45
54
|
spec["description"] = f["Description"]
|
|
46
55
|
if t == "Text" and f.get("MaxLength"):
|
|
@@ -72,6 +81,9 @@ def map_field(f: dict, list_by_id: dict[str, str]) -> Optional[dict]:
|
|
|
72
81
|
if t == "Calculated":
|
|
73
82
|
spec["read_only"] = True
|
|
74
83
|
spec["formula"] = f.get("Formula")
|
|
84
|
+
if t.startswith("TaxonomyFieldType"):
|
|
85
|
+
spec["read_only"] = True # terms are shown; choosing terms needs the term store (not generated)
|
|
86
|
+
spec["multi"] = t == "TaxonomyFieldTypeMulti" or bool(f.get("AllowMultipleValues"))
|
|
75
87
|
if f.get("EnforceUniqueValues"):
|
|
76
88
|
spec["unique"] = True
|
|
77
89
|
d = f.get("DefaultValue")
|
|
@@ -94,10 +106,15 @@ def _coerce_default(v, typ):
|
|
|
94
106
|
def map_fields(fields_json: dict, list_by_id: dict[str, str]) -> tuple[list[dict], list[dict]]:
|
|
95
107
|
"""-> (spec fields in schema order, column validation formulas)."""
|
|
96
108
|
out, formulas = [], []
|
|
109
|
+
by_id = {str(f.get("Id", "")).strip("{}").lower(): f for f in unwrap(fields_json)}
|
|
97
110
|
for f in unwrap(fields_json):
|
|
98
111
|
sf = map_field(f, list_by_id)
|
|
99
112
|
if not sf:
|
|
100
113
|
continue
|
|
114
|
+
if sf["type"] == "taxonomy" and f.get("TextField"):
|
|
115
|
+
note = by_id.get(str(f["TextField"]).strip("{}").lower()) # hidden note field holding "Label|TermGuid"
|
|
116
|
+
if note:
|
|
117
|
+
sf["label_field"] = rest_name(note)
|
|
101
118
|
out.append(sf)
|
|
102
119
|
if f.get("ValidationFormula"):
|
|
103
120
|
formulas.append({"field": sf["name"], "formula": f["ValidationFormula"], "message": f.get("ValidationMessage") or ""})
|