fairwire-software-licenses 0.0.0-stage → 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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ - First version (Fairwire ver 1).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kurt Francisco
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 CHANGED
@@ -1,3 +1,208 @@
1
- # Temporary Holding Version
1
+ # Fairwire Software Licenses
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Software installs against licences: products installed on more devices than you own licences for, licences nobody uses, software not on your approved list, prohibited software, versions past end of support and several versions of one product. Drafts a true-up note; never uninstalls anything.
4
+
5
+ Part of **Fairwire**, the IT and network family of [Mythos Machines](https://fair-agents.com) agents. The software is free (MIT); you pay a fixed price for the setup on your files. It reads files your IT team exports, on your own computer, and drafts notes. Every change to a live device, firewall, DNS zone, directory or cloud account stays one named person's click.
6
+
7
+ ## What it checks
8
+
9
+ | Finding | What it means |
10
+ |---|---|
11
+ | `prohibited_software` | Software on your prohibited list installed on devices. |
12
+ | `over_deployed` | A product installed on more devices than you own licences for. |
13
+ | `old_version` | Devices running a version older than the minimum you set (often unsupported or with known flaws). |
14
+ | `unapproved_software` | Software that is not on your approved list. |
15
+ | `unused_entitlements` | Licences you pay for that are not installed anywhere (shelfware). |
16
+ | `many_versions` | One product installed in three or more versions, which makes patching harder. |
17
+
18
+ Findings come back worst first (high, medium, low). A finding a named person has reviewed can be accepted as known, with a reason and a date to look again; it then moves to "Accepted as known" instead of counting as open.
19
+
20
+ ## Settings
21
+
22
+ Pass a settings file with `settings`. Every setting is optional; a misspelt setting is refused by name.
23
+
24
+ | Setting | What it does |
25
+ |---|---|
26
+ | `approved` | Product names on your approved list (no check when empty); a name matches installs that start with it |
27
+ | `prohibited` | Product names that must not be installed |
28
+ | `min_versions` | Lowest acceptable version per product, e.g. {"7-Zip": "24.0"} |
29
+ | `shelfware_pct` | Share of licences unused above which a product is flagged (default 20) |
30
+ | `shelfware_min_seats` | Unused licences a product needs before it is flagged (default 5) |
31
+
32
+ ## What it never does
33
+
34
+ - `endpoint_uninstall_software` is refused: Fairwire Software Licenses never uninstalls or blocks software on a device.
35
+ - `vendor_order_licences` is refused: Fairwire Software Licenses never orders licences.
36
+ - `licenses_request_send` waits for one named person's click, even in Auto (`binding_send`).
37
+ - `licenses_accept_learning` waits for one named person's click, even in Auto (`accept_learning`).
38
+ - `licenses_retire_memory` waits for one named person's click, even in Auto (`accept_learning`).
39
+ - `endpoint_uninstall_software` waits for one named person's click, even in Auto (`production_deploy`).
40
+ - `vendor_order_licences` waits for one named person's click, even in Auto (`move_money`).
41
+
42
+ <!-- generated:start -->
43
+
44
+ ## A demo run
45
+
46
+ `npx -y fairwire-software-licenses demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
47
+
48
+ ```text
49
+ Fairwire Software Licenses demo (fictional data) in a temporary folder, Auto on for the draft only
50
+
51
+ ▶ Check the exported files
52
+ status: executed decision: allow
53
+ 36 install(s) of 6 product(s) on 12 device(s), 3 licensed product(s): 6 open finding(s), 2 high.
54
+ high over_deployed Visio Professional
55
+ high prohibited_software uTorrent
56
+ medium old_version 7-Zip 24.08 (x64)
57
+ medium unapproved_software Fun Game Launcher
58
+ low many_versions 7-Zip 24.08 (x64)
59
+ low unused_entitlements Design Suite Pro
60
+
61
+ ▶ Explain one finding
62
+ status: executed decision: allow
63
+ high over_deployed: Visio Professional is installed on 7 device(s) but you own 5 licence(s) (2 short). Fix: Remove it where it is not needed, or buy the difference before the vendor audits you.
64
+
65
+ ▶ Write the worklist
66
+ status: executed decision: allow
67
+ Software installs against licences written: 36 install(s) of 6 product(s) on 12 device(s), 3 licensed product(s): 6 open finding(s), 2 high.
68
+
69
+ ▶ Draft the note for a person
70
+ status: executed decision: allow (auto)
71
+ true up note 2026-11-18 drafted with 1 open marker(s) ([TO CONFIRM software asset manager and procurement]). Nothing was sent.
72
+
73
+ ▶ Auto: approving it still waits for one named person
74
+ status: needs_approval decision: ask
75
+ reason: binding_send stays one-click, even in Auto
76
+
77
+ ▶ The agent tries to change the live system itself
78
+ status: blocked decision: block
79
+ reason: Fairwire Software Licenses never uninstalls or blocks software on a device.
80
+ ```
81
+
82
+ ## Tools
83
+
84
+ | Tool | What it does | Policy |
85
+ |---|---|---|
86
+ | `licenses_check` | Count devices per product and list prohibited, over-deployed, outdated, unapproved, unused and fragmented software. | runs |
87
+ | `licenses_explain` | Every finding for one product. | runs |
88
+ | `licenses_write_report` | Write software-licenses.csv (one row per finding, with blank owner and decision columns) and software-licenses.html into out_dir (default fairwire-out/licenses). | runs |
89
+ | `licenses_draft_true_up_note` | Write drafts/true_up_note-<date>.md: the open findings at or above min_severity (default medium), each with what to do, addressed to software asset manager and procurement. | asks first (Auto can be opted in) |
90
+ | `licenses_request_send` | After one named human click (even in Auto), record that the reviewed true up note draft is approved in true_up_note-requests.csv. | one named click, even in Auto (`binding_send`) |
91
+ | `licenses_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
92
+ | `licenses_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
93
+ | `licenses_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
94
+ | `licenses_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
95
+ | `endpoint_uninstall_software` | Fairwire Software Licenses never uninstalls or blocks software on a device. | refused |
96
+ | `vendor_order_licences` | Fairwire Software Licenses never orders licences. | refused |
97
+
98
+ Any tool name not in this table is blocked, including names a model invents. `refused` tools are listed so a model can see they exist and are refused.
99
+
100
+ ## Columns it reads
101
+
102
+ Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts and counts are read with either decimal mark. Every result lists under `sources` how each file was read.
103
+
104
+ ### Installed software (`installs`)
105
+
106
+ | Column | Type | Also read as | For example, in other languages |
107
+ |---|---|---|---|
108
+ | `device` (required) | text | Device, Device Name, Computer, Computer Name, Hostname, Machine | Gerät, Appareil, デバイス, 设备 |
109
+ | `product` (required) | text | Product, Software, Application, Name, Display Name, Title | Produkt, Produit, 製品, 产品 |
110
+ | `version` | text | Version, Product Version, Display Version | Version, Version, バージョン, 版本 |
111
+ | `publisher` | text | Publisher, Vendor, Manufacturer | Hersteller, Éditeur, 発行元, 发行商 |
112
+
113
+ ### Licences owned (`entitlements`)
114
+
115
+ | Column | Type | Also read as | For example, in other languages |
116
+ |---|---|---|---|
117
+ | `product` (required) | text | Product, Software, Licence, License, Title, SKU Name | Produkt, Produit, 製品, 产品 |
118
+ | `seats` (required) | number | Seats, Licences, Licenses, Quantity, Entitlements, Purchased | Lizenzen, Licences, ライセンス数, 许可数 |
119
+ | `annual_cost` | amount | Annual Cost, Cost, Price per Year, Total Cost | Vertragswert, Valeur du contrat, 契約金額, 合同金额 |
120
+
121
+ ### Files from other countries
122
+
123
+ A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file. [`fixtures/intl/`](fixtures/intl) has both versions of the demo data, and the eval cases `intl-de-*` and `intl-ja-*` require the same results as the English case. Columns named differently? Run `npx fairwire-software-licenses inspect <file>` (names and shapes only, never values) and name them in `fairwire-sources.json`:
124
+
125
+ ```json
126
+ { "files": { "exports/devices.csv": { "columns": { "host": "Gerätename" }, "date_order": "dmy" } } }
127
+ ```
128
+
129
+ ## Memory
130
+
131
+ fairwire-software-licenses can remember facts about your setup so the next run does not have to be told again. `licenses_learn` only proposes a fact; it changes nothing until a named person accepts it with `licenses_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairwire/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused. Run without memory with `--no-memory`.
132
+
133
+ | Kind | What an accepted fact changes |
134
+ |---|---|
135
+ | `known_exception` | that finding is listed under "Accepted as known" instead of as open, until review_by (when given) has passed. |
136
+ | `note` | nothing (shown by recall only) |
137
+
138
+ ```bash
139
+ fairwire-software-licenses memory list
140
+ fairwire-software-licenses memory accept MEM-1a2b3c4d5e6f --as "Your Name"
141
+ fairwire-software-licenses memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "rule removed"
142
+ ```
143
+
144
+ ## Install
145
+
146
+ Node 20 or newer. No other dependencies.
147
+
148
+ ```bash
149
+ npx -y fairwire-software-licenses demo
150
+ npx -y fairwire-software-licenses mcp --root /path/to/your/files
151
+ ```
152
+
153
+ Claude Desktop, Cursor and other MCP hosts:
154
+
155
+ ```json
156
+ {
157
+ "mcpServers": {
158
+ "fairwire-software-licenses": {
159
+ "command": "npx",
160
+ "args": [
161
+ "-y",
162
+ "fairwire-software-licenses",
163
+ "mcp",
164
+ "--root",
165
+ "/path/to/your/files"
166
+ ]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ Claude Code: `claude mcp add fairwire-software-licenses -- npx -y fairwire-software-licenses mcp --root .`, or install the `fairwire-software-licenses` plugin from this repository's marketplace.
173
+
174
+ ## Modes and approvals
175
+
176
+ - **Review** (`--mode review`): reads and reports only.
177
+ - **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairwire-software-licenses approve <id> --as "Your Name"` (or on the local approvals page, `fairwire-software-licenses approvals`), and the same call is repeated.
178
+ - **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairwire-software-licenses kill`). Paying, sending, posting to a ledger or a live system and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
179
+
180
+ ## CLI
181
+
182
+ ```bash
183
+ fairwire-software-licenses tools # every tool, its policy and arguments
184
+ fairwire-software-licenses sources # the columns each input is read from
185
+ fairwire-software-licenses inspect <file> # how a file would be read (names and shapes, never values)
186
+ fairwire-software-licenses call licenses_check '{"installs":"<installs>"}'
187
+ fairwire-software-licenses eval # the private eval cases on the fictional fixtures
188
+ fairwire-software-licenses demo
189
+ ```
190
+
191
+ ## Audit log and data
192
+
193
+ Every call is written to `.fairwire/audit.jsonl` under the root: hash-chained JSON lines, with arguments stored as a hash, signed with an Ed25519 key when you configure one. Everything runs on your machine on files you choose. No network calls, no telemetry, no credentials. The bundled fixtures are fictional.
194
+
195
+ <!-- generated:end -->
196
+
197
+ ## Limits
198
+
199
+ - Reads only the files you export and give it. It does not log in to a firewall, switch, controller, cloud console, identity provider or any other live system.
200
+ - Products are matched by name (case and bracketed editions ignored); licence terms such as per-user, per-core or second-device rights are not modelled, so a vendor's count can differ.
201
+ - Not a licence compliance opinion; your agreement with each vendor decides what you owe.
202
+ - Thresholds are working defaults in a settings file you control; they are not a vendor rule, a requirement of any standard or a security guarantee.
203
+ - It changes nothing on a live device, firewall, DNS zone, directory or cloud account. Every change it suggests is a draft that one named person applies.
204
+ - Export layouts were written from knowledge of common exports and have not been tested on live customer accounts. Run `inspect` on a new export and name columns in `fairwire-sources.json` when they differ.
205
+
206
+ ## Licence
207
+
208
+ MIT. Fictional data only in `fixtures/`.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { main } from 'fairwire-core';
4
+ import { manifest } from '../src/manifest.js';
5
+ import { demo } from '../src/demo.js';
6
+
7
+ main(manifest, { bin: 'fairwire-software-licenses', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
@@ -0,0 +1,342 @@
1
+ {
2
+ "suite": "fairwire-software-licenses",
3
+ "root": "..",
4
+ "data_note": "Fictional software inventory and licences in ../fixtures. No model is called.",
5
+ "cases": [
6
+ {
7
+ "id": "check-totals",
8
+ "tool": "licenses_check",
9
+ "args": {
10
+ "installs": "fixtures/installs.csv",
11
+ "entitlements": "fixtures/entitlements.csv",
12
+ "settings": "fixtures/settings.json"
13
+ },
14
+ "expect": {
15
+ "equals": {
16
+ "result.installs": 36,
17
+ "result.devices": 12,
18
+ "result.products": 6,
19
+ "result.licensed_products": 3,
20
+ "result.open": 6,
21
+ "result.high": 2
22
+ }
23
+ }
24
+ },
25
+ {
26
+ "id": "every-planted-issue",
27
+ "tool": "licenses_check",
28
+ "args": {
29
+ "installs": "fixtures/installs.csv",
30
+ "entitlements": "fixtures/entitlements.csv",
31
+ "settings": "fixtures/settings.json"
32
+ },
33
+ "expect": {
34
+ "contains": [
35
+ "prohibited_software",
36
+ "uTorrent",
37
+ "over_deployed",
38
+ "2 short",
39
+ "old_version",
40
+ "oldest 19.00",
41
+ "unapproved_software",
42
+ "Fun Game Launcher",
43
+ "unused_entitlements",
44
+ "8 of 10",
45
+ "many_versions"
46
+ ],
47
+ "not_contains": [
48
+ "Microsoft 365 Apps for enterprise is installed on"
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "id": "inventory-only",
54
+ "tool": "licenses_check",
55
+ "args": {
56
+ "installs": "fixtures/installs.csv"
57
+ },
58
+ "expect": {
59
+ "equals": {
60
+ "result.open": 1,
61
+ "result.high": 0
62
+ },
63
+ "contains": [
64
+ "many_versions"
65
+ ]
66
+ }
67
+ },
68
+ {
69
+ "id": "code-filter-licences",
70
+ "tool": "licenses_check",
71
+ "args": {
72
+ "installs": "fixtures/installs.csv",
73
+ "entitlements": "fixtures/entitlements.csv",
74
+ "settings": "fixtures/settings.json",
75
+ "code": "over_deployed"
76
+ },
77
+ "expect": {
78
+ "equals": {
79
+ "result.findings": 1
80
+ }
81
+ }
82
+ },
83
+ {
84
+ "id": "explain-visio",
85
+ "tool": "licenses_explain",
86
+ "args": {
87
+ "installs": "fixtures/installs.csv",
88
+ "entitlements": "fixtures/entitlements.csv",
89
+ "settings": "fixtures/settings.json",
90
+ "product": "visio professional"
91
+ },
92
+ "expect": {
93
+ "contains": [
94
+ "over_deployed",
95
+ "7 device(s)"
96
+ ],
97
+ "equals": {
98
+ "result.findings": 1
99
+ }
100
+ }
101
+ },
102
+ {
103
+ "id": "draft-after-approval",
104
+ "tool": "licenses_draft_true_up_note",
105
+ "approve": "Pat Example",
106
+ "args": {
107
+ "installs": "fixtures/installs.csv",
108
+ "entitlements": "fixtures/entitlements.csv",
109
+ "settings": "fixtures/settings.json"
110
+ },
111
+ "expect": {
112
+ "status": "executed",
113
+ "contains": [
114
+ "Nothing was sent"
115
+ ],
116
+ "equals": {
117
+ "result.items": 4,
118
+ "result.open_markers": 1
119
+ }
120
+ }
121
+ },
122
+ {
123
+ "id": "review-mode-still-reads",
124
+ "tool": "licenses_check",
125
+ "mode": "review",
126
+ "args": {
127
+ "installs": "fixtures/installs.csv",
128
+ "entitlements": "fixtures/entitlements.csv",
129
+ "settings": "fixtures/settings.json"
130
+ },
131
+ "expect": {
132
+ "status": "executed",
133
+ "equals": {
134
+ "result.installs": 36,
135
+ "result.devices": 12,
136
+ "result.products": 6,
137
+ "result.licensed_products": 3,
138
+ "result.open": 6,
139
+ "result.high": 2
140
+ }
141
+ },
142
+ "generated": true
143
+ },
144
+ {
145
+ "id": "severity-filter",
146
+ "tool": "licenses_check",
147
+ "args": {
148
+ "installs": "fixtures/installs.csv",
149
+ "entitlements": "fixtures/entitlements.csv",
150
+ "settings": "fixtures/settings.json",
151
+ "severity": "high"
152
+ },
153
+ "expect": {
154
+ "status": "executed",
155
+ "equals": {
156
+ "result.findings": 2
157
+ }
158
+ },
159
+ "generated": true
160
+ },
161
+ {
162
+ "id": "missing-argument-named",
163
+ "tool": "licenses_check",
164
+ "args": {},
165
+ "expect": {
166
+ "status": "error",
167
+ "contains": [
168
+ "installs"
169
+ ]
170
+ },
171
+ "generated": true
172
+ },
173
+ {
174
+ "id": "file-outside-root-refused",
175
+ "tool": "licenses_check",
176
+ "args": {
177
+ "installs": "../../../outside.csv",
178
+ "entitlements": "fixtures/entitlements.csv",
179
+ "settings": "fixtures/settings.json"
180
+ },
181
+ "expect": {
182
+ "status": "error",
183
+ "contains": [
184
+ "outside"
185
+ ]
186
+ },
187
+ "generated": true
188
+ },
189
+ {
190
+ "id": "invented-tool-name-refused",
191
+ "tool": "licenses_apply_every_fix_now",
192
+ "args": {},
193
+ "expect": {
194
+ "status": "blocked"
195
+ },
196
+ "generated": true
197
+ },
198
+ {
199
+ "id": "write-report-writes-files",
200
+ "tool": "licenses_write_report",
201
+ "args": {
202
+ "installs": "fixtures/installs.csv",
203
+ "entitlements": "fixtures/entitlements.csv",
204
+ "settings": "fixtures/settings.json"
205
+ },
206
+ "expect": {
207
+ "status": "executed",
208
+ "contains": [
209
+ "software-licenses.csv",
210
+ "software-licenses.html"
211
+ ]
212
+ },
213
+ "generated": true
214
+ },
215
+ {
216
+ "id": "recall-memory-starts-empty",
217
+ "tool": "licenses_recall",
218
+ "args": {},
219
+ "expect": {
220
+ "status": "executed",
221
+ "contains": [
222
+ "memory is empty"
223
+ ]
224
+ },
225
+ "generated": true
226
+ },
227
+ {
228
+ "id": "accept-learning-stays-one-click",
229
+ "tool": "licenses_accept_learning",
230
+ "mode": "auto",
231
+ "args": {
232
+ "id": "MEM-000000000000",
233
+ "decision": "accept"
234
+ },
235
+ "expect": {
236
+ "status": "needs_approval"
237
+ },
238
+ "generated": true
239
+ },
240
+ {
241
+ "id": "never-endpoint-uninstall-software",
242
+ "tool": "endpoint_uninstall_software",
243
+ "mode": "auto",
244
+ "args": {},
245
+ "expect": {
246
+ "status": "blocked"
247
+ },
248
+ "generated": true
249
+ },
250
+ {
251
+ "id": "never-vendor-order-licences",
252
+ "tool": "vendor_order_licences",
253
+ "mode": "auto",
254
+ "args": {},
255
+ "expect": {
256
+ "status": "blocked"
257
+ },
258
+ "generated": true
259
+ },
260
+ {
261
+ "id": "draft-waits-for-a-person",
262
+ "tool": "licenses_draft_true_up_note",
263
+ "args": {
264
+ "installs": "fixtures/installs.csv",
265
+ "entitlements": "fixtures/entitlements.csv",
266
+ "settings": "fixtures/settings.json"
267
+ },
268
+ "expect": {
269
+ "status": "needs_approval",
270
+ "decision": "ask"
271
+ },
272
+ "generated": true
273
+ },
274
+ {
275
+ "id": "review-mode-drafts-nothing",
276
+ "tool": "licenses_draft_true_up_note",
277
+ "mode": "review",
278
+ "args": {
279
+ "installs": "fixtures/installs.csv",
280
+ "entitlements": "fixtures/entitlements.csv",
281
+ "settings": "fixtures/settings.json"
282
+ },
283
+ "expect": {
284
+ "status": "blocked"
285
+ },
286
+ "generated": true
287
+ },
288
+ {
289
+ "id": "request-stays-one-click",
290
+ "tool": "licenses_request_send",
291
+ "mode": "auto",
292
+ "args": {
293
+ "draft": "fixtures/README.md",
294
+ "draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
295
+ },
296
+ "expect": {
297
+ "status": "needs_approval"
298
+ },
299
+ "generated": true
300
+ },
301
+ {
302
+ "id": "intl-de-check-totals",
303
+ "tool": "licenses_check",
304
+ "args": {
305
+ "installs": "fixtures/intl/de/installs.csv",
306
+ "entitlements": "fixtures/intl/de/entitlements.csv",
307
+ "settings": "fixtures/settings.json"
308
+ },
309
+ "expect": {
310
+ "equals": {
311
+ "result.installs": 36,
312
+ "result.devices": 12,
313
+ "result.products": 6,
314
+ "result.licensed_products": 3,
315
+ "result.open": 6,
316
+ "result.high": 2
317
+ }
318
+ },
319
+ "note": "German export of the same data (fixtures/intl/de); must match the English case \"check-totals\"."
320
+ },
321
+ {
322
+ "id": "intl-ja-check-totals",
323
+ "tool": "licenses_check",
324
+ "args": {
325
+ "installs": "fixtures/intl/ja/installs.csv",
326
+ "entitlements": "fixtures/intl/ja/entitlements.csv",
327
+ "settings": "fixtures/settings.json"
328
+ },
329
+ "expect": {
330
+ "equals": {
331
+ "result.installs": 36,
332
+ "result.devices": 12,
333
+ "result.products": 6,
334
+ "result.licensed_products": 3,
335
+ "result.open": 6,
336
+ "result.high": 2
337
+ }
338
+ },
339
+ "note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"check-totals\"."
340
+ }
341
+ ]
342
+ }
@@ -0,0 +1,7 @@
1
+ # Fairwire Software Licenses fixtures
2
+
3
+ Fictional software inventory for 12 devices.
4
+
5
+ - `installs.csv`: 36 installs. Visio is on 7 devices with 5 licences; 7-Zip runs three versions and six devices are older than 24.0; uTorrent (prohibited) is on two devices; a game launcher is not approved; Design Suite Pro has 10 licences and 2 installs.
6
+ - `entitlements.csv`: licences owned for three paid products.
7
+ - `settings.json`: the approved list, the prohibited list and a minimum 7-Zip version.
@@ -0,0 +1,4 @@
1
+ product,seats,annual_cost
2
+ Microsoft 365 Apps for enterprise,15,3600
3
+ Visio Professional,5,1500
4
+ Design Suite Pro,10,6000
@@ -0,0 +1,37 @@
1
+ device,product,version,publisher
2
+ PC-101,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
3
+ PC-101,7-Zip 24.08 (x64),19.00,Igor Pavlov
4
+ PC-101,Visio Professional,16.0.18129,Microsoft
5
+ PC-101,Design Suite Pro,2025,Example Soft
6
+ PC-102,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
7
+ PC-102,7-Zip 24.08 (x64),19.00,Igor Pavlov
8
+ PC-102,Visio Professional,16.0.18129,Microsoft
9
+ PC-102,Design Suite Pro,2025,Example Soft
10
+ PC-103,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
11
+ PC-103,7-Zip 24.08 (x64),19.00,Igor Pavlov
12
+ PC-103,Visio Professional,16.0.18129,Microsoft
13
+ PC-104,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
14
+ PC-104,7-Zip 24.08 (x64),23.01,Igor Pavlov
15
+ PC-104,Visio Professional,16.0.18129,Microsoft
16
+ PC-104,uTorrent,3.6,BitTorrent
17
+ PC-105,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
18
+ PC-105,7-Zip 24.08 (x64),23.01,Igor Pavlov
19
+ PC-105,Visio Professional,16.0.18129,Microsoft
20
+ PC-105,Fun Game Launcher,1.2,Example Games
21
+ PC-106,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
22
+ PC-106,7-Zip 24.08 (x64),23.01,Igor Pavlov
23
+ PC-106,Visio Professional,16.0.18129,Microsoft
24
+ PC-107,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
25
+ PC-107,7-Zip 24.08 (x64),24.08,Igor Pavlov
26
+ PC-107,Visio Professional,16.0.18129,Microsoft
27
+ PC-108,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
28
+ PC-108,7-Zip 24.08 (x64),24.08,Igor Pavlov
29
+ PC-109,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
30
+ PC-109,7-Zip 24.08 (x64),24.08,Igor Pavlov
31
+ PC-109,uTorrent,3.6,BitTorrent
32
+ PC-110,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
33
+ PC-110,7-Zip 24.08 (x64),24.08,Igor Pavlov
34
+ PC-111,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
35
+ PC-111,7-Zip 24.08 (x64),24.08,Igor Pavlov
36
+ PC-112,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
37
+ PC-112,7-Zip 24.08 (x64),24.08,Igor Pavlov
@@ -0,0 +1,12 @@
1
+ # Fixtures from other countries
2
+
3
+ Generated by `node scripts/make-intl-fixtures.mjs` from the English fixtures one
4
+ folder up. The same fictional data, written the way a local export writes it:
5
+
6
+ - `de/`: German column names, Windows-1252 text, semicolons, comma decimals
7
+ (1.234,56), day-first dotted dates (03.11.2026), kilograms and kilometres.
8
+ - `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/11/03),
9
+ kilograms and kilometres.
10
+
11
+ Values (names, codes, charge wording) stay in English. The eval cases
12
+ `intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
@@ -0,0 +1,4 @@
1
+ Produkt;Lizenzen;Vertragswert
2
+ Microsoft 365 Apps for enterprise;15;3.600,00
3
+ Visio Professional;5;1.500,00
4
+ Design Suite Pro;10;6.000,00
@@ -0,0 +1,37 @@
1
+ Ger�t;Produkt;version;Hersteller
2
+ PC-101;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
3
+ PC-101;7-Zip 24.08 (x64);19.00;Igor Pavlov
4
+ PC-101;Visio Professional;16.0.18129;Microsoft
5
+ PC-101;Design Suite Pro;2025;Example Soft
6
+ PC-102;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
7
+ PC-102;7-Zip 24.08 (x64);19.00;Igor Pavlov
8
+ PC-102;Visio Professional;16.0.18129;Microsoft
9
+ PC-102;Design Suite Pro;2025;Example Soft
10
+ PC-103;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
11
+ PC-103;7-Zip 24.08 (x64);19.00;Igor Pavlov
12
+ PC-103;Visio Professional;16.0.18129;Microsoft
13
+ PC-104;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
14
+ PC-104;7-Zip 24.08 (x64);23.01;Igor Pavlov
15
+ PC-104;Visio Professional;16.0.18129;Microsoft
16
+ PC-104;uTorrent;3.6;BitTorrent
17
+ PC-105;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
18
+ PC-105;7-Zip 24.08 (x64);23.01;Igor Pavlov
19
+ PC-105;Visio Professional;16.0.18129;Microsoft
20
+ PC-105;Fun Game Launcher;1.2;Example Games
21
+ PC-106;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
22
+ PC-106;7-Zip 24.08 (x64);23.01;Igor Pavlov
23
+ PC-106;Visio Professional;16.0.18129;Microsoft
24
+ PC-107;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
25
+ PC-107;7-Zip 24.08 (x64);24.08;Igor Pavlov
26
+ PC-107;Visio Professional;16.0.18129;Microsoft
27
+ PC-108;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
28
+ PC-108;7-Zip 24.08 (x64);24.08;Igor Pavlov
29
+ PC-109;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
30
+ PC-109;7-Zip 24.08 (x64);24.08;Igor Pavlov
31
+ PC-109;uTorrent;3.6;BitTorrent
32
+ PC-110;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
33
+ PC-110;7-Zip 24.08 (x64);24.08;Igor Pavlov
34
+ PC-111;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
35
+ PC-111;7-Zip 24.08 (x64);24.08;Igor Pavlov
36
+ PC-112;Microsoft 365 Apps for enterprise;16.0.18129;Microsoft
37
+ PC-112;7-Zip 24.08 (x64);24.08;Igor Pavlov
@@ -0,0 +1,4 @@
1
+ ���i,���C�Z���X��,�_����z
2
+ Microsoft 365 Apps for enterprise,15,"3,600.00"
3
+ Visio Professional,5,"1,500.00"
4
+ Design Suite Pro,10,"6,000.00"
@@ -0,0 +1,37 @@
1
+ �f�o�C�X,���i,�o�[�W����,���s��
2
+ PC-101,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
3
+ PC-101,7-Zip 24.08 (x64),19.00,Igor Pavlov
4
+ PC-101,Visio Professional,16.0.18129,Microsoft
5
+ PC-101,Design Suite Pro,2025,Example Soft
6
+ PC-102,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
7
+ PC-102,7-Zip 24.08 (x64),19.00,Igor Pavlov
8
+ PC-102,Visio Professional,16.0.18129,Microsoft
9
+ PC-102,Design Suite Pro,2025,Example Soft
10
+ PC-103,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
11
+ PC-103,7-Zip 24.08 (x64),19.00,Igor Pavlov
12
+ PC-103,Visio Professional,16.0.18129,Microsoft
13
+ PC-104,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
14
+ PC-104,7-Zip 24.08 (x64),23.01,Igor Pavlov
15
+ PC-104,Visio Professional,16.0.18129,Microsoft
16
+ PC-104,uTorrent,3.6,BitTorrent
17
+ PC-105,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
18
+ PC-105,7-Zip 24.08 (x64),23.01,Igor Pavlov
19
+ PC-105,Visio Professional,16.0.18129,Microsoft
20
+ PC-105,Fun Game Launcher,1.2,Example Games
21
+ PC-106,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
22
+ PC-106,7-Zip 24.08 (x64),23.01,Igor Pavlov
23
+ PC-106,Visio Professional,16.0.18129,Microsoft
24
+ PC-107,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
25
+ PC-107,7-Zip 24.08 (x64),24.08,Igor Pavlov
26
+ PC-107,Visio Professional,16.0.18129,Microsoft
27
+ PC-108,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
28
+ PC-108,7-Zip 24.08 (x64),24.08,Igor Pavlov
29
+ PC-109,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
30
+ PC-109,7-Zip 24.08 (x64),24.08,Igor Pavlov
31
+ PC-109,uTorrent,3.6,BitTorrent
32
+ PC-110,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
33
+ PC-110,7-Zip 24.08 (x64),24.08,Igor Pavlov
34
+ PC-111,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
35
+ PC-111,7-Zip 24.08 (x64),24.08,Igor Pavlov
36
+ PC-112,Microsoft 365 Apps for enterprise,16.0.18129,Microsoft
37
+ PC-112,7-Zip 24.08 (x64),24.08,Igor Pavlov
@@ -0,0 +1,5 @@
1
+ {
2
+ "approved": ["Microsoft 365 Apps", "Visio Professional", "7-Zip", "Design Suite Pro"],
3
+ "prohibited": ["uTorrent"],
4
+ "min_versions": { "7-Zip": "24.0" }
5
+ }
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "fairwire-software-licenses",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "mcpName": "io.github.fpavia111-creator/fairwire-software-licenses",
5
+ "description": "Fairwire Software Licenses: Software installs against licences: products installed on more devices than you own licences for, licences nobody uses, software not on your approved list, prohibited software, versions past end of support and several versions of one product. Drafts a true-up note; never uninstalls anything.",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "Kurt Francisco",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "main": "src/index.js",
13
+ "exports": {
14
+ ".": "./src/index.js",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "bin": {
18
+ "fairwire-software-licenses": "bin/fairwire-software-licenses.js"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "bin",
23
+ "fixtures",
24
+ "evals",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "LICENSE",
28
+ "server.json"
29
+ ],
30
+ "scripts": {
31
+ "test": "node scripts/run-tests.cjs",
32
+ "demo": "node bin/fairwire-software-licenses.js demo",
33
+ "eval": "node bin/fairwire-software-licenses.js eval"
34
+ },
35
+ "dependencies": {
36
+ "fairwire-core": "^0.1.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/fpavia111-creator/fairwire-agents.git",
41
+ "directory": "packages/fairwire-software-licenses"
42
+ },
43
+ "homepage": "https://github.com/fpavia111-creator/fairwire-agents/tree/master/packages/fairwire-software-licenses#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/fpavia111-creator/fairwire-agents/issues"
46
+ },
47
+ "keywords": [
48
+ "mcp",
49
+ "mcp-server",
50
+ "it-operations",
51
+ "network",
52
+ "fairwire",
53
+ "software-asset-management",
54
+ "sam",
55
+ "true-up",
56
+ "shelfware"
57
+ ]
58
+ }
package/server.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.fpavia111-creator/fairwire-software-licenses",
4
+ "title": "Fairwire Software Licenses",
5
+ "description": "Fairwire Software Licenses: Software installs against licences: products installed on more devices…",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/fpavia111-creator/fairwire-agents",
9
+ "source": "github",
10
+ "subfolder": "packages/fairwire-software-licenses"
11
+ },
12
+ "websiteUrl": "https://fair-agents.com/fairwire.html",
13
+ "packages": [
14
+ {
15
+ "registryType": "npm",
16
+ "identifier": "fairwire-software-licenses",
17
+ "version": "0.1.0",
18
+ "transport": {
19
+ "type": "stdio"
20
+ },
21
+ "packageArguments": [
22
+ {
23
+ "type": "positional",
24
+ "value": "mcp"
25
+ },
26
+ {
27
+ "type": "named",
28
+ "name": "--root",
29
+ "description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
30
+ "isRequired": true,
31
+ "format": "filepath",
32
+ "valueHint": "exports_folder"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
package/src/demo.js ADDED
@@ -0,0 +1,19 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { readFileSync } from 'node:fs';
3
+ import { standardDemo } from 'fairwire-core';
4
+
5
+ // The demo runs the eval case "check-totals" and the agent's draft on the fictional fixtures.
6
+ const cases = JSON.parse(readFileSync(new URL('../evals/cases.json', import.meta.url), 'utf8')).cases;
7
+ const base = cases.find((c) => c.id === 'check-totals');
8
+ const explain = cases.find((c) => /_explain$/.test(c.tool) && !c.expect.status);
9
+ const draft = cases.find((c) => /_draft_/.test(c.tool) && c.approve);
10
+
11
+ export async function demo(manifest) {
12
+ const refused = manifest.tools.filter((t) => (manifest.policy.rules.find((r) => r.tool === t.name) || {}).decision === 'block')[0];
13
+ await standardDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
14
+ title: 'Fairwire Software Licenses demo', args: base.args,
15
+ explain: explain ? { label: 'Explain one finding', args: explain.args } : null,
16
+ draft: draft ? { label: 'Draft the note for a person', args: draft.args } : null,
17
+ refused: refused ? refused.name : null,
18
+ });
19
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { manifest } from './manifest.js';
2
+ export * from './logic.js';
package/src/logic.js ADDED
@@ -0,0 +1,70 @@
1
+ // Fairwire Software Licenses: software installs against licences and your catalogue. Pure functions.
2
+ import { num, str, low, versionCompare, finding } from 'fairwire-core';
3
+
4
+ export const CHECKS = Object.freeze({
5
+ prohibited_software: 'Software on your prohibited list installed on devices.',
6
+ over_deployed: 'A product installed on more devices than you own licences for.',
7
+ old_version: 'Devices running a version older than the minimum you set (often unsupported or with known flaws).',
8
+ unapproved_software: 'Software that is not on your approved list.',
9
+ unused_entitlements: 'Licences you pay for that are not installed anywhere (shelfware).',
10
+ many_versions: 'One product installed in three or more versions, which makes patching harder.',
11
+ });
12
+
13
+ export const INSTALL_FIELDS = Object.freeze({
14
+ device: { aliases: ['Device', 'Device Name', 'Computer', 'Computer Name', 'Hostname', 'Machine'], required: true },
15
+ product: { aliases: ['Product', 'Software', 'Application', 'Name', 'Display Name', 'Title'], required: true },
16
+ version: { aliases: ['Version', 'Product Version', 'Display Version'] },
17
+ publisher: { aliases: ['Publisher', 'Vendor', 'Manufacturer'] },
18
+ });
19
+ export const ENTITLEMENT_FIELDS = Object.freeze({
20
+ product: { aliases: ['Product', 'Software', 'Licence', 'License', 'Title', 'SKU Name'], required: true },
21
+ seats: { type: 'number', aliases: ['Seats', 'Licences', 'Licenses', 'Quantity', 'Entitlements', 'Purchased'], required: true },
22
+ annual_cost: { type: 'money', aliases: ['Annual Cost', 'Cost', 'Price per Year', 'Total Cost'] },
23
+ });
24
+
25
+ export const SETTINGS_SCHEMA = { type: 'object', additionalProperties: false, properties: {
26
+ approved: { type: 'array', items: { type: 'string' }, maxItems: 2000, description: 'Product names on your approved list (no check when empty); a name matches installs that start with it' },
27
+ prohibited: { type: 'array', items: { type: 'string' }, maxItems: 500, description: 'Product names that must not be installed' },
28
+ min_versions: { type: 'object', additionalProperties: { type: 'string' }, description: 'Lowest acceptable version per product, e.g. {"7-Zip": "24.0"}' },
29
+ shelfware_pct: { type: 'number', minimum: 1, maximum: 100, description: 'Share of licences unused above which a product is flagged (default 20)' },
30
+ shelfware_min_seats: { type: 'integer', minimum: 1, description: 'Unused licences a product needs before it is flagged (default 5)' },
31
+ } };
32
+ export const DEFAULTS = Object.freeze({ approved: [], prohibited: [], min_versions: {}, shelfware_pct: 20, shelfware_min_seats: 5 });
33
+
34
+ /** A product name compared plainly: lower case, no bracketed parts, single spaces. */
35
+ export const productKey = (v) => low(v).replace(/\([^)]*\)/g, ' ').replace(/\s+/g, ' ').trim();
36
+ /** A listed name matches every install whose product starts with it (keys are worked out once, not per comparison). */
37
+ const startsWith = (installKey, k) => !!k && installKey.startsWith(k);
38
+
39
+ export function reviewSoftware(installRows, entRows = [], settings = {}) {
40
+ const s = { ...DEFAULTS, ...settings };
41
+ const ins = installRows.filter((r) => str(r.device) && str(r.product)).map((r) => ({ device: low(r.device), product: str(r.product), key: productKey(r.product), version: str(r.version) }));
42
+ const items = []; const byProduct = new Map();
43
+ for (const i of ins) { const l = byProduct.get(i.key); if (l) l.push(i); else byProduct.set(i.key, [i]); }
44
+ const prohibited = s.prohibited.map(productKey); const approved = s.approved.map(productKey);
45
+ const minKeys = Object.keys(s.min_versions).map((p) => [p, productKey(p)]);
46
+ const devicesOf = (list) => new Set(list.map((i) => i.device)).size;
47
+ for (const [key, list] of byProduct) {
48
+ const name = list[0].product; const n = devicesOf(list);
49
+ if (prohibited.some((k) => startsWith(key, k))) items.push(finding('prohibited_software', 'high', name, `${name} is on your prohibited list and is installed on ${n} device(s).`, 'Remove it from these devices and block it in your deployment tool.', { subject: name, devices: n }));
50
+ else if (approved.length && !approved.some((k) => startsWith(key, k))) items.push(finding('unapproved_software', 'medium', name, `${name} is not on your approved list and is installed on ${n} device(s).`, 'Approve it with an owner, or remove it.', { subject: name, devices: n }));
51
+ const minKey = (minKeys.find(([, k]) => startsWith(key, k)) || [])[0];
52
+ if (minKey) { const old = list.filter((i) => i.version && versionCompare(i.version, s.min_versions[minKey]) < 0); if (old.length) items.push(finding('old_version', 'medium', name, `${devicesOf(old)} device(s) run ${name} older than ${s.min_versions[minKey]} (oldest ${old.map((i) => i.version).sort(versionCompare)[0]}).`, 'Update or remove these copies.', { subject: name, devices: devicesOf(old) })); }
53
+ const vers = [...new Set(list.map((i) => i.version).filter(Boolean))];
54
+ if (vers.length >= 3) items.push(finding('many_versions', 'low', name, `${name} is installed in ${vers.length} versions (${vers.sort(versionCompare).join(', ')}).`, 'Standardise on one version in your deployment tool.', { subject: name }));
55
+ }
56
+ const ents = entRows.filter((r) => str(r.product)).map((r) => ({ product: str(r.product), key: productKey(r.product), seats: num(r.seats) || 0, cost: num(r.annual_cost) }));
57
+ // Devices per entitlement key, counted once per distinct key over the product groups (not once per install).
58
+ const devicesByKey = new Map();
59
+ const devicesFor = (k) => {
60
+ if (!devicesByKey.has(k)) { const set = new Set(); if (k) for (const [key, list] of byProduct) if (key.startsWith(k)) for (const i of list) set.add(i.device); devicesByKey.set(k, set.size); }
61
+ return devicesByKey.get(k);
62
+ };
63
+ for (const e of ents) {
64
+ const n = devicesFor(e.key);
65
+ if (n > e.seats) items.push(finding('over_deployed', 'high', e.product, `${e.product} is installed on ${n} device(s) but you own ${e.seats} licence(s) (${n - e.seats} short).`, 'Remove it where it is not needed, or buy the difference before the vendor audits you.', { subject: e.product, short: n - e.seats }));
66
+ const unused = e.seats - n;
67
+ if (unused >= s.shelfware_min_seats && (100 * unused) / Math.max(1, e.seats) > s.shelfware_pct) items.push(finding('unused_entitlements', 'low', e.product, `${unused} of ${e.seats} ${e.product} licence(s) are not installed anywhere${e.cost ? ` (about ${Math.round((e.cost * unused) / e.seats)} a year)` : ''}.`, 'Reduce the count at renewal, or reassign them before buying more.', { subject: e.product, unused }));
68
+ }
69
+ return { installs: ins.length, devices: new Set(ins.map((i) => i.device)).size, products: byProduct.size, licensed_products: ents.length, items };
70
+ }
@@ -0,0 +1,32 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { wireAgent, fileArg, SETTINGS_ARG, settingsFrom, LIMITS } from 'fairwire-core';
3
+ import { INSTALL_FIELDS, ENTITLEMENT_FIELDS, SETTINGS_SCHEMA, DEFAULTS, reviewSoftware } from './logic.js';
4
+
5
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
6
+ const args = {
7
+ installs: fileArg('Software inventory under --root (Intune discovered apps, Configuration Manager, Lansweeper, PDQ or any CSV, Excel or JSON): one row per device and installed product with version and publisher'),
8
+ entitlements: fileArg('Optional licence list: product, seats owned and annual cost'),
9
+ settings: SETTINGS_ARG('approved, prohibited, min_versions, shelfware_pct, shelfware_min_seats'),
10
+ };
11
+
12
+ export const manifest = wireAgent({
13
+ pkg, prefix: 'licenses', title: 'Fairwire Software Licenses',
14
+ description: 'Compares installed software with the licences you own and your catalogue: prohibited software, products installed on more devices than you have licences for, versions older than your minimum, unapproved software, licences nobody uses and products in many versions. Drafts a true-up note; never uninstalls anything.',
15
+ args, required: ['installs'],
16
+ sources: { installs: { label: 'Installed software', args: ['installs'], fields: INSTALL_FIELDS }, entitlements: { label: 'Licences owned', args: ['entitlements'], fields: ENTITLEMENT_FIELDS } },
17
+ configSchemas: { licenses_settings: SETTINGS_SCHEMA },
18
+ run: (a, ctx) => reviewSoftware(ctx.records(a.installs, 'installs'), a.entitlements ? ctx.records(a.entitlements, 'entitlements') : [], settingsFrom(a, ctx, 'licenses_settings', DEFAULTS)),
19
+ summary: (o) => `${o.installs} install(s) of ${o.products} product(s) on ${o.devices} device(s), ${o.licensed_products} licensed product(s): ${o.open} open finding(s), ${o.high} high.`,
20
+ check: { title: 'Review software against licences', description: 'Count devices per product and list prohibited, over-deployed, outdated, unapproved, unused and fragmented software.' },
21
+ explain: { arg: 'product', argSchema: { type: 'string', maxLength: 200, description: 'Product name from licenses_check' }, title: 'Explain one product', description: 'Every finding for one product.', match: (i, v) => String(i.key).toLowerCase() === String(v).toLowerCase() },
22
+ report: {
23
+ title: 'Software installs against licences', base: 'software-licenses',
24
+ limits: [LIMITS.files, 'Products are matched by name (case and bracketed editions ignored); licence terms such as per-user, per-core or second-device rights are not modelled, so a vendor\'s count can differ.', 'Not a licence compliance opinion; your agreement with each vendor decides what you owe.', LIMITS.defaults, LIMITS.live],
25
+ },
26
+ note: { noun: 'true_up_note', verb: 'send', category: 'binding_send', actor: 'the software asset owner', to: 'software asset manager and procurement', subject: 'Software licence gaps and removals', ask: 'Please remove prohibited software first and decide on the shortfalls before the vendor\'s next count.' },
27
+ refused: [
28
+ { name: 'endpoint_uninstall_software', category: 'production_deploy', description: 'Fairwire Software Licenses never uninstalls or blocks software on a device.' },
29
+ { name: 'vendor_order_licences', category: 'move_money', description: 'Fairwire Software Licenses never orders licences.' },
30
+ ],
31
+ prompt: { title: 'Review software and licences', description: 'Walks the host model through a software review with Fairwire Software Licenses.', text: 'You are helping a software asset manager compare installs with licences using fairwire-software-licenses. Fairwire Software Licenses only reads exports. 1. Call licenses_check; lead with prohibited software and over-deployed products. 2. Use licenses_explain for one product. 3. Call licenses_write_report. 4. Offer licenses_draft_true_up_note; licenses_request_send waits for one named click.' },
32
+ });