Skip to content

Commit 04d4919

Browse files
docs: standardize headers and expand source docblocks
Agent-Logs-Url: https://github.com/Starisian-Technologies/sparxstar-user-environment-check/sessions/e2409563-64b1-463f-aaa1-f61cc5d05cd8 Co-authored-by: MaximillianGroup <34328348+MaximillianGroup@users.noreply.github.com>
1 parent ec6ae1e commit 04d4919

32 files changed

Lines changed: 907 additions & 520 deletions

.github/pull_request_template.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Summary
2+
3+
-
4+
5+
## Why
6+
7+
-
8+
9+
## Changes
10+
11+
-
12+
13+
## Validation
14+
15+
- [ ] `composer run lint`
16+
- [ ] `composer run analyze`
17+
- [ ] `composer run test:unit`
18+
- [ ] `pnpm run lint`
19+
- [ ] `pnpm run build`
20+
21+
## Security Review
22+
23+
- [ ] Input sanitization/validation impact reviewed
24+
- [ ] SQL/query safety impact reviewed
25+
- [ ] Auth/nonce/capability impact reviewed
26+
- [ ] No secrets introduced
27+
28+
## Documentation
29+
30+
- [ ] README / architecture / security docs updated if behavior changed
31+
- [ ] Public API/docblocks updated for touched interfaces
32+
33+
## Risk and Rollback
34+
35+
- Risk level: Low / Medium / High
36+
- Rollback plan:

ARCHITECTURE.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Architecture
2+
3+
## Responsibilities
4+
5+
SPARXSTAR User Environment Check is responsible for collecting, receiving, and storing client environment diagnostics for downstream product decisions and support workflows.
6+
7+
## Layer Boundaries
8+
9+
- **Bootstrap:** `sparxstar-user-environment-check.php`
10+
- constants, autoloader, lifecycle hook wiring, orchestrator bootstrap
11+
- **Orchestration:** `src/SparxstarUserEnvironmentCheck.php`
12+
- WordPress hook registration and service startup
13+
- **Dependency Wiring:** `src/core/SparxstarUECKernel.php`
14+
- service construction only (no side effects)
15+
- **REST Layer:** `src/api/SparxstarUECRESTController.php`
16+
- route registration, request validation, payload normalization
17+
- **Persistence Layer:**
18+
- `src/core/SparxstarUECDatabase.php`
19+
- `src/core/SparxstarUECSnapshotRepository.php`
20+
- **Public Facade:** `src/StarUserEnv.php`
21+
- stable read API for external consumers
22+
- **Admin:** `src/admin/SparxstarUECAdmin.php`
23+
- settings and support snapshot viewer
24+
- **Session/Cache Helpers:** `src/includes/*`
25+
26+
## Namespace Conventions
27+
28+
Primary namespace: `Starisian\SparxstarUEC\*`
29+
30+
All plugin-defined global constants/functions are prefixed (`SPX_`, `spx_`, `sparxstar_`).
31+
32+
## Execution Flow
33+
34+
1. Plugin bootstrap defines constants and loads autoloader.
35+
2. Orchestrator singleton initializes services.
36+
3. Frontend scripts collect environment telemetry.
37+
4. Client submits payload to REST endpoint.
38+
5. REST controller validates nonce, enriches server-side data, normalizes payload.
39+
6. Database layer upserts snapshot by fingerprint + device hash.
40+
7. Facade methods read from runtime/session/cache/database in priority order.
41+
42+
## Dependency Expectations
43+
44+
- WordPress runtime APIs available.
45+
- Optional Action Scheduler support.
46+
- Optional GeoIP provider setup.
47+
- Composer autoloader present for production use.
48+
49+
## Security Assumptions
50+
51+
- Nonce-protected snapshot ingestion endpoint.
52+
- Client payload treated as untrusted until sanitized.
53+
- IP/geolocation are sensitive operational data and must remain internal.
54+
55+
## Governance Assumptions
56+
57+
- Internal/private codebase with controlled contribution model.
58+
- Production changes require PR review and validation command evidence.
59+
60+
## Architectural Invariants
61+
62+
- No direct SQL outside dedicated persistence classes.
63+
- No direct superglobal use outside controlled helper/controller contexts.
64+
- No bypass of public facade for external integrations.
65+
- Multisite behavior must remain explicit and network-safe.

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Changelog
2+
3+
All notable changes to this repository are documented in this file.
4+
5+
## [Unreleased]
6+
7+
### Added
8+
9+
- `DEVELOPMENT.md` with setup and validation workflow.
10+
- `ARCHITECTURE.md` documenting boundaries, flow, and invariants.
11+
- `LICENSE.md` summary for proprietary licensing reference.
12+
- `.github/pull_request_template.md` for consistent governance visibility.
13+
14+
### Changed
15+
16+
- Reworked `README.md` for production onboarding clarity.
17+
- Reworked `CONTRIBUTING.md` with repository-specific contribution rules.
18+
- Reworked `SECURITY.md` with explicit trust boundaries and reporting process.
19+
- Standardized source headers and expanded DocBlocks across core PHP/JS modules.
20+
21+
### Notes
22+
23+
- Baseline lint/static-analysis issues exist in repository and are not architectural changes from this pass.

CONTRIBUTING.md

Lines changed: 32 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,49 @@
1-
# Contributing to Sparxstar & Starmus Projects
1+
# Contributing Guide
22

3-
First off, thank you for considering a contribution. Your expertise is valued, and your efforts help us build a better, more resilient platform.
3+
Thank you for contributing to SPARXSTAR User Environment Check.
44

5-
This document provides a set of guidelines for contributing to this repository. These are mostly guidelines, not strict rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
5+
## Access Model
66

7-
**Important Note:** This is a private, managed repository. Contributions are welcome from team members and invited collaborators only. We do not accept unsolicited pull requests from the general public. If you believe you have found a security vulnerability, please follow our [Security Policy](#security-vulnerability-reporting).
7+
This is a managed/private repository. Contributions are accepted from authorized team members and approved collaborators.
88

9-
## Table of Contents
9+
## Contribution Rules
1010

11-
- [Code of Conduct](#code-of-conduct)
12-
- [How Can I Contribute?](#how-can-i-contribute)
13-
- [Reporting Bugs](#reporting-bugs)
14-
- [Suggesting Enhancements](#suggesting-enhancements)
15-
- [Your First Code Contribution](#your-first-code-contribution)
16-
- [Development Setup](#development-setup)
17-
- [Style Guides](#style-guides)
18-
- [Git Commit Messages](#git-commit-messages)
19-
- [JavaScript Style Guide](#javascript-style-guide)
20-
- [PHP Style Guide](#php-style-guide)
21-
- [CSS/Styling Style Guide](#cssstyling-style-guide)
22-
- [Pull Request Process](#pull-request-process)
23-
- [Security Vulnerability Reporting](#security-vulnerability-reporting)
11+
- Keep architecture intact; no major redesign in maintenance changes.
12+
- Use smallest safe change that fully solves the issue.
13+
- Preserve multisite behavior and capability checks.
14+
- Never add unprefixed WordPress globals.
15+
- Sanitize → validate → escape for all external input paths.
16+
- Prepare every SQL query.
2417

25-
## Code of Conduct
18+
## Branching
2619

27-
This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md), [Ethics](ETHICS.md), and [Terms](TERMS.md). By participating, you are expected to uphold these policies c. Please report unacceptable behavior to the project lead.
20+
- Do not commit directly to `main`.
21+
- Use descriptive branches (`fix/...`, `docs/...`, `chore/...`).
2822

29-
## How Can I Contribute?
23+
## Required Checks Before PR
3024

31-
### Reporting Bugs
25+
Run:
3226

33-
Bugs are tracked as GitHub issues. Before opening a new issue, please perform a quick search to see if the problem has already been reported.
34-
35-
When you are creating a bug report, please include as many details as possible:
36-
37-
- **A clear and descriptive title** for the issue.
38-
- **A detailed description of the problem.**
39-
- **Steps to reproduce the behavior.** Be as specific as possible.
40-
- **Expected behavior vs. actual behavior.**
41-
- **Screenshots or screen recordings** are extremely helpful.
42-
- **Environment details:**
43-
- OS and version
44-
- Browser and version
45-
- Device type (if applicable)
46-
- WordPress version
47-
- Active plugins that might be relevant
48-
49-
### Suggesting Enhancements
50-
51-
Enhancement suggestions are tracked as GitHub issues.
52-
53-
- **Use a clear and descriptive title.**
54-
- **Provide a step-by-step description of the suggested enhancement** in as many details as possible.
55-
- **Explain why this enhancement would be useful.** What problem does it solve?
56-
- **Provide examples of how it would work.** Code snippets or mockups are welcome.
57-
58-
### Your First Code Contribution
59-
60-
Unsure where to begin? You can start by looking through `good-first-issue` and `help-wanted` issues.
61-
62-
Before you start working on a feature or bug, **please communicate your intention** by commenting on the relevant issue or creating a new one. This prevents duplicated effort and allows for early architectural feedback.
63-
64-
## Development Setup
65-
66-
1. **Fork & Clone:** Fork the repository to your own GitHub account and clone it to your local machine.
67-
2. **Branch:** Create a new feature branch from the `main` or `develop` branch. Branch names should be descriptive, using prefixes like `feature/`, `bugfix/`, or `refactor/`.
68-
```bash
69-
git checkout -b feature/my-new-feature-name
70-
```
71-
3. **Install Dependencies:** This project uses `pnpm` as its package manager.
72-
```bash
73-
pnpm install
74-
```
75-
4. **Build Assets:** Run the build command to compile JavaScript and CSS.
76-
```bash
77-
pnpm build
78-
```
79-
5. **Linting:** Before committing, ensure your code adheres to our standards by running the linter.
80-
```bash
81-
pnpm lint
82-
```
83-
To automatically fix issues, you can run:
84-
```bash
85-
pnpm format
86-
```
87-
88-
## Style Guides
89-
90-
### Git Commit Messages
91-
92-
- Use the present tense ("Add feature" not "Added feature").
93-
- Use the imperative mood ("Move file to..." not "Moves file to...").
94-
- Limit the first line to 72 characters or less.
95-
- Reference issues and pull requests liberally in the commit body.
96-
97-
Example:
98-
99-
```
100-
feat: Add chunked TUS upload strategy
101-
102-
Implements the resilient, chunked TUS uploader in the Core module.
103-
This allows for the upload of large files (>5MB) without crashing the
104-
browser tab, which is critical for handling external music files.
105-
The upload strategy now correctly falls back to this method based on
106-
the file size and environment profile.
107-
108-
Fixes #42
27+
```bash
28+
composer run lint
29+
composer run analyze
30+
composer run test:unit
31+
pnpm run lint
32+
pnpm run build
10933
```
11034

111-
### JavaScript Style Guide
112-
113-
All JavaScript must adhere to the configuration in our `.eslintrc.js` file.
114-
- Use ES Modules (`import`/`export`) for all new JavaScript.
115-
- Avoid global scope pollution.
116-
- Write clear, self-documenting code. Add JSDoc comments for all public functions and complex logic.
117-
118-
### PHP Style Guide
119-
120-
All PHP code must adhere to the [WordPress PHP Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/).
121-
- Use strict types (`declare(strict_types=1);`) where possible.
122-
- Use namespaces for all classes.
123-
124-
### CSS/Styling Style Guide
125-
126-
- All CSS must adhere to the configuration in our `.stylelintrc.js` file.
127-
- Use BEM (Block, Element, Modifier) naming conventions for CSS classes (e.g., `.starmus-recorder__button--primary`).
128-
129-
## Pull Request Process
35+
If a command fails due an existing repository baseline issue, call it out in the PR and confirm your change did not introduce new failures.
13036

131-
1. **Ensure all tests and linting checks pass** before submitting your PR.
132-
2. **Update the `README.md` and any relevant documentation** with details of changes to the interface, new environment variables, etc.
133-
3. **Create a Pull Request** against the `main` or `develop` branch of the main repository.
134-
4. **Provide a clear title and description** for your PR, explaining the "why" and "what" of your changes. Link to the issue(s) your PR resolves.
135-
5. **Request a Review:** Tag the project lead or relevant team members for review.
136-
6. **Respond to Feedback:** The reviewer may ask for changes. Please be open to discussion and make the required updates. Once your PR is approved, it will be merged by a maintainer.
37+
## Pull Request Expectations
13738

138-
## Security Vulnerability Reporting
39+
Include in every PR:
13940

140-
If you discover a security vulnerability, please **DO NOT** open a public issue. Instead, send a private email to `security@sparxstar.com` (or your designated security contact).
41+
- summary of changes
42+
- rationale (why)
43+
- testing performed
44+
- security impact (if any)
45+
- docs updated (if behavior/public API changed)
14146

142-
We take security seriously and will respond promptly.
47+
## Security Reports
14348

49+
Do not open public issues for vulnerabilities. Follow `SECURITY.md`.

DEVELOPMENT.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Development Guide
2+
3+
## Local Setup
4+
5+
```bash
6+
composer install
7+
corepack enable
8+
corepack prepare pnpm@8.6.0 --activate
9+
npm install
10+
```
11+
12+
## Build and Validation
13+
14+
### PHP checks
15+
16+
```bash
17+
composer run lint
18+
composer run analyze
19+
composer run test:unit
20+
```
21+
22+
### Frontend checks
23+
24+
```bash
25+
pnpm run lint
26+
pnpm run build
27+
```
28+
29+
## Important Development Constraints
30+
31+
- Keep `sparxstar-user-environment-check.php` as a lean bootstrap file.
32+
- Keep database logic in `src/core/SparxstarUECDatabase.php` (and snapshot repository class).
33+
- Keep REST logic in `src/api/SparxstarUECRESTController.php`.
34+
- Expose public consumption via `src/StarUserEnv.php`.
35+
- Use `$wpdb->prefix`; never hardcode `wp_`.
36+
37+
## Documentation Expectations
38+
39+
When changing behavior:
40+
41+
- update docblocks in touched source
42+
- update `README.md` and architecture/security docs where relevant
43+
- record release-note entry in `CHANGELOG.md`

LICENSE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# License Summary
2+
3+
This repository is **proprietary** software owned by Starisian Technologies.
4+
5+
- Copyright (c) 2023-2026 Starisian Technologies
6+
- All Rights Reserved
7+
- No public license grant is provided by default
8+
9+
For legal terms, restrictions, and permitted usage, see the full `LICENSE` file in this repository root.
10+
11+
If you require licensing access or commercial terms, contact Starisian Technologies through authorized internal channels.

0 commit comments

Comments
 (0)