-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/tidy #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feature/tidy #60
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
1fedcc7
era, dots
magmacomputing b6af90b
era, eraYear in/out
magmacomputing 5cf7cab
CHANGELOG
magmacomputing 1c3445f
PR next review
magmacomputing af5d31a
fold-in plugins
magmacomputing ce4c948
npm run build:plugins
magmacomputing d60adf5
PR review
magmacomputing b4cc6d2
PR plugins review
magmacomputing 74dce33
PR final review
magmacomputing e47574a
README badges
magmacomputing 748c03e
CHANGELOG
magmacomputing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| # @magmacomputing/magma-cli | ||
|
|
||
| `magma-cli` is a lightweight, internal command-line tool built to unify build scripts across the Magma Computing monorepo. | ||
|
|
||
| ## Why does this exist? | ||
|
|
||
| Many npm scripts traditionally rely on OS-specific shell commands (like `rm -rf`). This creates a fragile build environment that can break across different operating systems (such as Windows). Instead of pulling in external dependencies like `rimraf` or `del-cli`, `magma-cli` provides native, zero-dependency, cross-platform implementations specifically tailored for our build pipeline. | ||
|
|
||
| ## Usage | ||
|
|
||
| This package registers the `magma-cli` binary. Because it is part of the npm workspace, npm automatically links it to the root `node_modules/.bin/magma-cli`. | ||
|
|
||
| You can use it directly in any `package.json` script within the monorepo: | ||
|
|
||
| ```json | ||
| "scripts": { | ||
| "postbuild": "magma-cli rm dist/src" | ||
| } | ||
| ``` | ||
|
|
||
| Or you can run it manually via `npx` from anywhere in the project: | ||
|
|
||
| ```bash | ||
| npx magma-cli rm dist/src | ||
| ``` | ||
|
|
||
| ## Available Commands | ||
|
|
||
| ### `rm <path...>` | ||
| Recursively and forcefully removes the specified files or directories using Node's built-in `fs.rmSync`. | ||
| - **Example:** `magma-cli rm dist/src build/ temp/` | ||
|
|
||
| ## Adding New Commands | ||
|
|
||
| To extend `magma-cli` with new capabilities (e.g., cross-platform file copying), simply edit `index.js`. The CLI uses a lightweight argument router: | ||
|
|
||
| ```javascript | ||
| const [command, ...args] = process.argv.slice(2); | ||
|
|
||
| if (command === 'rm') { | ||
| // ... | ||
| } else if (command === 'cp') { | ||
| // Add your new command implementation here | ||
| } else { | ||
| console.error(`Unknown command: ${command}`); | ||
| process.exit(1); | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env node | ||
| import fs from 'node:fs'; | ||
| import path from 'node:path'; | ||
|
|
||
| const [command, ...args] = process.argv.slice(2); | ||
|
|
||
| if (command === 'rm') { | ||
| for (const arg of args) { | ||
| if (!arg) continue; | ||
| const fullPath = path.resolve(process.cwd(), arg); | ||
| try { | ||
| fs.rmSync(fullPath, { recursive: true, force: true }); | ||
| } catch (err) { | ||
| console.error(`Failed to remove ${fullPath}:`, err.message); | ||
| process.exitCode = 1; | ||
| } | ||
| } | ||
| } else { | ||
| console.error(`Unknown command: ${command}`); | ||
| process.exit(1); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "name": "@magmacomputing/magma-cli", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "bin": { | ||
| "magma-cli": "./index.js" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to the `@magmacomputing/tempo-plugin-astro` project will be documented in this file. | ||
|
|
||
| ## [2.1.2] - 2026-07-15 | ||
|
|
||
| ### Fixed | ||
| - Fixed an issue where the polynomial algorithm could return mathematical garbage for years outside the Jean Meeus limit. It now strictly enforces the `-1000` to `+3000` year bounds by throwing a `RangeError`. | ||
|
|
||
| ## [2.1.0] - 2026-07-02 | ||
|
|
||
| ### Changed | ||
| - **Open Source Transition**: The Astro plugin is now officially a Community plugin! It is 100% free and open-source under the MIT License. | ||
| - **Licensing Removal**: Removed all proprietary licensing logic (`definePremiumTerm`) and initialization token checks. | ||
| - **Clear-Text Build**: Removed `javascript-obfuscator` from the build pipeline. The published NPM artifact is now fully readable clear-text JavaScript. | ||
| - Updated documentation and README to reflect the new open-source structure. | ||
|
|
||
| ## [1.1.6] - 2026-06-11 | ||
|
|
||
| ### Changed | ||
| - Renamed the metadata payload property `type` to `event` (Equinox vs. Solstice) to better reflect astronomical terminology and reduce naming collisions. | ||
| - Refactored internal `calculateAstroMoment` parameter from `season` to `quarter` to resolve semantic ambiguity between meteorological seasons and astronomical quarters. | ||
| - Augmented the `@magmacomputing/tempo/core` module to natively type the `TempoTermRegistry` for `astro` and `astronomy`, providing full strict IntelliSense autocomplete for IDEs. | ||
|
|
||
| ### Fixed | ||
| - **Type Definitions**: Added missing `start: Tempo` and `end: Tempo` boundaries to the `TempoTermRegistry` augmentation, ensuring accurate typings for the dynamic range boundaries injected by the core resolver. | ||
| - **NPM Registry Metadata**: Explicitly added `README.md`, `CHANGELOG.md`, and `LICENSE` to the `files` array in `package.json` to ensure the npmjs.com registry correctly renders package documentation. | ||
|
|
||
| ## [1.1.3] - 2026-06-07 | ||
|
|
||
| ### Security | ||
| - Migrated licensing enforcement from `jose` to the native WebCrypto Tempo Core primitives. | ||
|
|
||
| ### Fixed | ||
| - Replaced all usage of the global `Date` object with the `instant()` temporal engine in the core validator to ensure timeline consistency. | ||
| - Corrected test environment resolution boundaries that caused unhandled asynchronous Promise verification leaks. | ||
|
|
||
| ## [1.1.2] - 2026-06-04 | ||
|
|
||
| ### Fixed | ||
| - Resolved the "Ghost-Trap" architectural conflict that prevented validation when used with Tempo v3.0.0. | ||
| - Decoupled `definePremiumTerm` and cryptographic validation from the plugin bundle. Licensing engine state and references are now directly imported from the Tempo Core (`@magmacomputing/tempo/plugin`). | ||
| - Removed the `@magmacomputing/tempo-plugin-core` bundled `devDependency` to prevent duplicate initialization. | ||
|
|
||
| ## [1.0.2] - 2026-05-25 | ||
|
|
||
| ### Security | ||
| - Migrated licensing enforcement to the newly decoupled `@magmacomputing/tempo-plugin-core` workspace. | ||
| - The proprietary license verification and string-obfuscation logic is now baked directly into the plugin bundle during the build step, decentralizing the security model and eliminating reliance on the open-source engine for validation. | ||
| - Updated `devDependencies` to automatically resolve the new internal `@core` monorepo symlink via `tsup`. | ||
|
|
||
| ## [1.0.0] - 2026-05-18 | ||
|
|
||
| ### Added | ||
| - Initial release of the Astronomical Seasons plugin. | ||
| - Implements the Jean Meeus polynomial approximation algorithm for precise Equinox and Solstice moments. | ||
| - Returns fully scoped astronomical objects containing: | ||
| - Precise start/end dates for each astronomical season | ||
| - The astronomical `key` (Vernal, Summer, Autumnal, Winter) | ||
| - The colloquial traditional `season` mapping (Spring, Summer, Autumn, Winter) | ||
| - The `event` (Equinox vs. Solstice) | ||
| - Fully supports automatic label inversion for Northern vs. Southern hemisphere configurations (`sphere: 'south'`). | ||
| - Implements the `v2.10.0` Tempo Core Licensing API via cryptographic JSON Web Signatures (JWS). | ||
| - Auto-registers itself via side-effect upon import. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Magma Computing | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
|  | ||
|
|
||
| # @magmacomputing/tempo-plugin-astro | ||
|
|
||
| <p align="center"> | ||
| <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro"><img src="https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-astro?style=flat-square" alt="npm version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo"><img src="https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-astro/peer/@magmacomputing/tempo?style=flat-square" alt="npm peer dependency version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro"><img src="https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-astro?style=flat-square" alt="License" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-blue?logo=typescript&style=flat-square" alt="TypeScript Ready" style="display: inline-block; margin: 0 4px;"></a> <a href="https://magmacomputing.github.io/magma/9-plugins/astro.html"><img src="https://img.shields.io/badge/Docs-VitePress-brightgreen?logo=vitepress&style=flat-square" alt="Documentation" style="display: inline-block; margin: 0 4px;"></a> | ||
| </p> | ||
|
|
||
| This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that provides precise astronomical events (Equinoxes and Solstices) and maps them to traditional season names based on hemisphere. | ||
|
|
||
| 👉 **[View the full documentation on our GitHub Pages](https://magmacomputing.github.io/magma/9-plugins/astro.html)** | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @magmacomputing/tempo-plugin-astro | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```typescript | ||
| import { Tempo } from '@magmacomputing/tempo'; | ||
| import { AstroTerm } from '@magmacomputing/tempo-plugin-astro'; | ||
|
|
||
| // Pass the plugin to `Tempo.init` to register it into the runtime. | ||
| Tempo.init({ | ||
| plugins: [AstroTerm] | ||
| }); | ||
|
|
||
| const t = new Tempo('2026-03-20'); | ||
|
|
||
| // Get the Astronomical Event mapping | ||
| console.log(t.term.astro); | ||
| // Output: 'Vernal' | ||
| ``` | ||
|
|
||
| ### Response Payload | ||
|
|
||
| When resolving the term, the plugin intelligently returns the correct astronomical event and its corresponding traditional season based on your configured hemisphere (`sphere`): | ||
|
|
||
| ```javascript | ||
| { | ||
| key: 'Vernal', // Flips to 'Autumnal' if sphere is set to 'south' | ||
| season: 'Spring', // Flips to 'Autumn' if sphere is set to 'south' | ||
| sphere: 'north', // Flips to 'south' if sphere is set to 'south' | ||
| event: 'Equinox', | ||
| group: 'astronomy', | ||
| year: 2026, | ||
| month: 3, | ||
| // ... | ||
| } | ||
| ``` | ||
|
|
||
| > **Did you know?** | ||
| > `t.term.astronomy.season` returns the *Astronomical* season calculated by the precise timing of solstices and equinoxes. This will often differ from `t.term.season` in the core library, which uses standard Meteorological/Civil calendar boundaries (e.g., 1st of the month). | ||
|
|
||
| ## Documentation | ||
|
|
||
| For full API reference, advanced configuration, and detailed explanations of the astronomical calculations, please visit the official **[Astro Plugin Documentation ↗](https://magmacomputing.github.io/tempo-plugin-docs/astro)**. | ||
|
|
||
| ## Licensing | ||
|
|
||
| This is a **Community** plugin. It is completely free and open-source for personal and commercial use. No license token is required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
|  | ||
|
|
||
| # @magmacomputing/tempo-plugin-astro | ||
|
|
||
| <p align="center"> | ||
| <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro"><img src="https://img.shields.io/npm/v/@magmacomputing/tempo-plugin-astro?style=flat-square" alt="npm version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo"><img src="https://img.shields.io/npm/dependency-version/@magmacomputing/tempo-plugin-astro/peer/@magmacomputing/tempo?style=flat-square" alt="npm peer dependency version" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.npmjs.com/package/@magmacomputing/tempo-plugin-astro"><img src="https://img.shields.io/npm/l/@magmacomputing/tempo-plugin-astro?style=flat-square" alt="License" style="display: inline-block; margin: 0 4px;"></a> <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-Ready-blue?logo=typescript&style=flat-square" alt="TypeScript Ready" style="display: inline-block; margin: 0 4px;"></a> | ||
| </p> | ||
|
|
||
| This is a Community plugin for the [Tempo](https://github.com/magmacomputing/magma) library that calculates the exact astronomical season (Equinoxes and Solstices) for any date using the **Jean Meeus polynomial algorithm**. | ||
|
|
||
| > [!NOTE] | ||
| > **Mean-Polynomial Approximation (Ch. 27)** | ||
| > This plugin specifically implements the mean-polynomial calculation from Chapter 27 of Meeus' *Astronomical Algorithms*. To keep the library extremely lightweight, it omits the massive periodic correction tables required for exact apparent calculations. It is strictly enforced to support the mathematical range of **-1000 to +3000 AD**. | ||
|
|
||
| Because it is a true astronomical calculation rather than a fixed calendar date, it precisely determines the exact minute the sun crosses the celestial equator. It is also **hemisphere-aware**: by configuring your Tempo instance with a `sphere` (e.g., `sphere: 'south'`), the plugin accurately flips the Vernal Equinox from Spring to Autumn. | ||
|
|
||
| ::: info Meteorological vs Astronomical | ||
| Unlike Tempo's built-in **Meteorological** `season` Term — which rigidly snaps to the 1st day of calendar months — this **Astronomical** plugin calculates the dynamic, true solar boundaries that shift slightly year-over-year. | ||
| ::: | ||
| ## Installation | ||
|
|
||
| ```bash | ||
| npm install @magmacomputing/tempo-plugin-astro | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```typescript | ||
| import { Tempo } from '@magmacomputing/tempo'; | ||
| import { AstroTerm } from '@magmacomputing/tempo-plugin-astro'; | ||
|
|
||
| // Pass the plugin to `Tempo.init` to register it into the runtime. | ||
| Tempo.init({ | ||
| plugins: [AstroTerm] | ||
| }); | ||
|
|
||
| const t = new Tempo('2026-03-20'); | ||
|
|
||
| // Get the Astronomical Event mapping | ||
| console.log(t.term.astro); | ||
| // Output: 'Vernal' | ||
| ``` | ||
|
|
||
| ### Response Payload | ||
|
|
||
| When resolving the term, the plugin intelligently returns the correct astronomical event and its corresponding traditional season based on your configured hemisphere (`sphere`): | ||
|
|
||
| ```javascript | ||
| { | ||
| key: 'Vernal', // Flips to 'Autumnal' if sphere is set to 'south' | ||
| season: 'Spring', // Flips to 'Autumn' if sphere is set to 'south' | ||
| sphere: 'north', // Flips to 'south' if sphere is set to 'south' | ||
| event: 'Equinox', | ||
| group: 'astronomy', | ||
| year: 2026, | ||
| month: 3, | ||
| day: 20, | ||
| hour: 14, | ||
| minute: 45, | ||
| second: 0 | ||
| } | ||
| ``` | ||
|
|
||
| You can also access the full metadata object containing the sub-second precision fields via the `astronomy` term: | ||
|
|
||
| ```typescript | ||
| console.log(t.term.astronomy); | ||
| // Output: { key: 'Vernal', group: 'astronomy', year: 2026, month: 3, day: 20, hour: 14, minute: 45, ... } | ||
| ``` | ||
|
|
||
| ::: tip Did you know? | ||
| **Seasons:** `t.term.astronomy.season` returns the *Astronomical* season calculated by the precise timing of solstices and equinoxes. This will often differ from `t.term.season.key` in the core library, which uses standard Meteorological/Civil calendar boundaries (e.g., 1st of the month). | ||
| ::: | ||
|
|
||
| ## Licensing | ||
|
|
||
| This is a **Community** plugin. It is completely free and open-source for personal and commercial use. No license token is required. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.