@org-design-studio/core 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Rohan Aggrawal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,108 @@
1
+ # ORG DESIGN STUDIO
2
+
3
+ A consulting-grade HR org-design and workforce-modelling web application. Upload employee data,
4
+ visualize the organization, run spans & layers diagnostics, model future-state scenarios, and
5
+ generate board-ready insights and reports — the kind of analysis typically produced by top
6
+ org-design consulting teams.
7
+
8
+ ## Quick start
9
+
10
+ ```bash
11
+ npm install
12
+ npm run dev # development — http://localhost:3000
13
+ # or production:
14
+ npm run build && npx next start
15
+ ```
16
+
17
+ Then either click **Load demo organization** (a deterministic ~300-person company,
18
+ "Meridian Global Services", with intentional structural issues to explore), or go to
19
+ **Upload** and import your own CSV/XLSX (a downloadable template is provided; columns are
20
+ auto-mapped with a manual mapping step).
21
+
22
+ ```bash
23
+ npm test # vitest — 100 unit/integration tests over the analytics engine and store
24
+ npm run lint
25
+ npx tsc --noEmit
26
+ ```
27
+
28
+ Browser-driven e2e scenarios live in `tests/e2e/*.md` (runnable with Claude Code's `/e2e`
29
+ skill once the chrome-devtools MCP server is connected).
30
+
31
+ ## Embedding the engine (`@org-design-studio/core`)
32
+
33
+ The entire analytics engine (spans & layers metrics, validation, scenario economics, insights,
34
+ headless org-chart layout) is packaged as an embeddable library so other HR tools and
35
+ consultancies can run the methodology on their own data with their own UI. The public surface is
36
+ the curated barrel `src/lib/core.ts` — pure TypeScript, no React/DOM, only `d3-hierarchy` as a
37
+ runtime dependency.
38
+
39
+ ```bash
40
+ npm run build:core # tsup → dist-core/ (ESM + CJS + .d.ts)
41
+ npm run check:core # fast build without type declarations
42
+ ```
43
+
44
+ The publish manifest template lives at `packages/core-package.json`. Full API reference,
45
+ quickstart, and the embedding guide: **[docs/API.md](docs/API.md)**.
46
+
47
+ ## Privacy
48
+
49
+ All workforce data is processed **locally in the browser** (zustand + localStorage). Nothing is
50
+ sent to any server. Handle real salary/personal data securely regardless.
51
+
52
+ ## Architecture
53
+
54
+ ```
55
+ src/lib/ The analytical brain — pure, tested functions
56
+ types.ts Data model: Employee, OrgMetrics, Scenario, Assumptions, Insight, …
57
+ hierarchy.ts Tree building, layers, spans, rollups, cycle/orphan detection
58
+ analytics.ts OrgMetrics: spans/layers/cost/duplication/AI exposure/org health
59
+ validation.ts Upload parsing, field auto-mapping, data-quality score (0–100)
60
+ scenario.ts Immutable-baseline scenario engine, transition costs, change risk, scoring
61
+ insights.ts Rule-based, ranked consulting insights (AI-ready interface)
62
+ demo-data.ts Seeded deterministic demo organization
63
+ store.ts Zustand store + memoized derived-data hooks
64
+ src/components/ UI kit (shadcn-style), charts (Recharts + custom), org chart, app shell
65
+ src/app/ 11 routes: / upload org diagnostics cost scenarios compare insights report settings help
66
+ ```
67
+
68
+ Key design decisions:
69
+ - **Baseline is immutable.** A scenario is an ordered list of changes replayed onto the baseline;
70
+ undo = drop the last change. Every metric is recomputed from the derived employee list.
71
+ - **Every number is traceable.** No mock values anywhere; all charts/KPIs derive from the loaded
72
+ dataset through `computeMetrics`.
73
+ - **Assumption-driven.** Span bands by level, layer benchmarks, savings capture rates, transition
74
+ cost (severance/backfill/change cost), location multipliers, scoring weights and AI-augmentation
75
+ mappings are all configurable in Settings and flow through every calculation.
76
+ - **AI-ready insights.** `generateInsights(data, assumptions, scenarios)` is a clean interface; an
77
+ LLM generator can be swapped in later without touching UI.
78
+
79
+ ## Methodology notes
80
+
81
+ - **Spans are level-aware**: managers are assessed against the target span band for their level
82
+ (default: executives 5–8, middle 6–10, frontline 8–15); flat thresholds apply only as a fallback
83
+ for unleveled employees.
84
+ - **Opportunity levers are disjoint** between delayering (narrow managers with 3+ reports) and
85
+ span optimization (managers of 1–2); duplication is presented as a separate lens. All figures
86
+ are framed as *indicative opportunity requiring validation*, never committed savings.
87
+ - **Scenario financials are net-of-transition**: role eliminations and location shifts incur
88
+ severance (by level, on baseline cost), backfill drag and per-move change costs; the scenario
89
+ score uses net year-1 saving, with run-rate shown alongside.
90
+ - **Change risk** scales with employees moved, roles eliminated, senior/critical roles affected,
91
+ functions/locations impacted and layer/cost deltas, mapped to Low → Very High with
92
+ implementation guidance.
93
+
94
+ ## Scenario actions implemented
95
+
96
+ Move employee/team (cycle-safe) · Remove role (3 report-handling modes) · Add role · Merge teams ·
97
+ Delayer (by layer × function/BU scope) · Apply target spans (rule-based consolidation suggestions,
98
+ criticality-aware) · Shift location (cost multipliers) · Change cost — all logged with
99
+ before/after metrics, undoable, resettable.
100
+
101
+ ## Known limitations / future enhancements
102
+
103
+ - Org chart image export and PDF generation rely on the print-friendly report view (`Print / PDF`).
104
+ - Sankey movement diagram not yet implemented (movement summary table covers the from-to flow).
105
+ - Insights are rule-based; the LLM insight generator is architected but not wired.
106
+ - Role-based access is a placeholder concept only — the app is single-user, local-first.
107
+ - Benchmarks are point estimates, not percentile bands against a peer database.
108
+ - The e2e markdown scenarios require a chrome-devtools MCP connection to execute.