@opscompass/skills 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.
Files changed (38) hide show
  1. package/README.md +78 -0
  2. package/manifest.json +35 -0
  3. package/package.json +23 -0
  4. package/skills/opscompass-oracle-licensing/.opscompass-runtime/tools/cli-entrypoint.js +15 -0
  5. package/skills/opscompass-oracle-licensing/SKILL.md +211 -0
  6. package/skills/opscompass-oracle-licensing/api/entitlement-compliance/entitlement-compliance.json +189 -0
  7. package/skills/opscompass-oracle-licensing/api/entitlement-deployment/entitlement-deployment +26 -0
  8. package/skills/opscompass-oracle-licensing/api/entitlement-usage/entitlement-usage.json +114 -0
  9. package/skills/opscompass-oracle-licensing/assets/mock-entitlements/deployment-details.json +61 -0
  10. package/skills/opscompass-oracle-licensing/assets/mock-entitlements/license-usage-map.json +70 -0
  11. package/skills/opscompass-oracle-licensing/assets/mock-entitlements/overall-compliance.json +36 -0
  12. package/skills/opscompass-oracle-licensing/package.json +3 -0
  13. package/skills/opscompass-oracle-licensing/references/evidence-model.md +90 -0
  14. package/skills/opscompass-oracle-licensing/references/report-structure.md +54 -0
  15. package/skills/opscompass-oracle-licensing/scripts/fake-entitlements-api.tool.js +31 -0
  16. package/skills/opscompass-oracle-licensing/scripts/fake_entitlements_api.js +72 -0
  17. package/skills/opscompass-oracle-licensing/scripts/tools.js +2 -0
  18. package/skills/opscompass-resources/.opscompass-runtime/tools/cli-entrypoint.js +15 -0
  19. package/skills/opscompass-resources/.opscompass-runtime/tools/index.js +2 -0
  20. package/skills/opscompass-resources/.opscompass-runtime/tools/opsc-cli-context.js +24 -0
  21. package/skills/opscompass-resources/.opscompass-runtime/tools/opsc-cli-defaults.js +125 -0
  22. package/skills/opscompass-resources/.opscompass-runtime/tools/opsc-cli.js +90 -0
  23. package/skills/opscompass-resources/SKILL.md +335 -0
  24. package/skills/opscompass-resources/package.json +3 -0
  25. package/skills/opscompass-resources/references/resources-commands.md +178 -0
  26. package/skills/opscompass-resources/scripts/build-resources-command.tool.js +53 -0
  27. package/skills/opscompass-resources/scripts/build_resources_command.js +240 -0
  28. package/skills/opscompass-resources/scripts/list-and-fetch-latest-configs.tool.js +116 -0
  29. package/skills/opscompass-resources/scripts/list_and_fetch_latest_configs.js +714 -0
  30. package/skills/opscompass-resources/scripts/map-oracle-workloads-to-platform-cpus.tool.js +24 -0
  31. package/skills/opscompass-resources/scripts/map_oracle_workloads_to_platform_cpus.js +273 -0
  32. package/skills/opscompass-resources/scripts/opscompass-defaults.tool.js +80 -0
  33. package/skills/opscompass-resources/scripts/opscompass-resources.tool.js +51 -0
  34. package/skills/opscompass-resources/scripts/summarize-latest-configuration.tool.js +24 -0
  35. package/skills/opscompass-resources/scripts/summarize-resources-list.tool.js +24 -0
  36. package/skills/opscompass-resources/scripts/summarize_latest_configuration.js +254 -0
  37. package/skills/opscompass-resources/scripts/summarize_resources_list.js +126 -0
  38. package/skills/opscompass-resources/scripts/tools.js +16 -0
@@ -0,0 +1,114 @@
1
+ [
2
+ {
3
+ "Product": "Oracle Active Data Guard",
4
+ "Metric": "Processor",
5
+ "Limitation": "Full Use",
6
+ "Limited To": "",
7
+ "Usage": 16
8
+ },
9
+ {
10
+ "Product": "Oracle Advanced Compression",
11
+ "Metric": "Processor",
12
+ "Limitation": "Full Use",
13
+ "Limited To": "",
14
+ "Usage": 16
15
+ },
16
+ {
17
+ "Product": "Oracle Advanced Security",
18
+ "Metric": "Named User Plus",
19
+ "Limitation": "Limited Use Other",
20
+ "Limited To": "Test / Dev",
21
+ "Usage": 400
22
+ },
23
+ {
24
+ "Product": "Oracle Advanced Security",
25
+ "Metric": "Processor",
26
+ "Limitation": "Full Use",
27
+ "Limited To": "",
28
+ "Usage": 32
29
+ },
30
+ {
31
+ "Product": "Oracle Database Enterprise Edition",
32
+ "Metric": "Processor",
33
+ "Limitation": "Full Use",
34
+ "Limited To": "",
35
+ "Usage": 32
36
+ },
37
+ {
38
+ "Product": "Oracle Database Enterprise Edition",
39
+ "Metric": "Named User Plus",
40
+ "Limitation": "Limited Use Other",
41
+ "Limited To": "Test / Dev",
42
+ "Usage": 400
43
+ },
44
+ {
45
+ "Product": "Oracle Database Vault",
46
+ "Metric": "Named User Plus",
47
+ "Limitation": "Limited Use Other",
48
+ "Limited To": "Test / Dev",
49
+ "Usage": 400
50
+ },
51
+ {
52
+ "Product": "Oracle Database Vault",
53
+ "Metric": "Processor",
54
+ "Limitation": "Full Use",
55
+ "Limited To": "",
56
+ "Usage": 32
57
+ },
58
+ {
59
+ "Product": "Oracle Diagnostics Pack",
60
+ "Metric": "Processor",
61
+ "Limitation": "Full Use",
62
+ "Limited To": "",
63
+ "Usage": 16
64
+ },
65
+ {
66
+ "Product": "Oracle Diagnostics Pack",
67
+ "Metric": "Named User Plus",
68
+ "Limitation": "Limited Use Other",
69
+ "Limited To": "Test / Dev",
70
+ "Usage": 400
71
+ },
72
+ {
73
+ "Product": "Oracle GoldenGate",
74
+ "Metric": "Processor",
75
+ "Limitation": "Full Use",
76
+ "Limited To": "",
77
+ "Usage": 16
78
+ },
79
+ {
80
+ "Product": "Oracle GoldenGate",
81
+ "Metric": "Named User Plus",
82
+ "Limitation": "Limited Use Other",
83
+ "Limited To": "Test / Dev",
84
+ "Usage": 400
85
+ },
86
+ {
87
+ "Product": "Oracle Partitioning",
88
+ "Metric": "Processor",
89
+ "Limitation": "Full Use",
90
+ "Limited To": "",
91
+ "Usage": 16
92
+ },
93
+ {
94
+ "Product": "Oracle Partitioning",
95
+ "Metric": "Named User Plus",
96
+ "Limitation": "Limited Use Other",
97
+ "Limited To": "Test / Dev",
98
+ "Usage": 400
99
+ },
100
+ {
101
+ "Product": "Oracle Real Application Clusters",
102
+ "Metric": "Processor",
103
+ "Limitation": "Full Use",
104
+ "Limited To": "",
105
+ "Usage": 32
106
+ },
107
+ {
108
+ "Product": "Oracle Real Application Clusters",
109
+ "Metric": "Named User Plus",
110
+ "Limitation": "Limited Use Other",
111
+ "Limited To": "Test / Dev",
112
+ "Usage": 400
113
+ }
114
+ ]
@@ -0,0 +1,61 @@
1
+ {
2
+ "organization": "OpsCompass Demo",
3
+ "assessmentScope": "oracle-licensing",
4
+ "generatedAt": "2026-04-23T00:00:00Z",
5
+ "deployments": [
6
+ {
7
+ "deploymentId": "prod-microchip",
8
+ "environment": "prod",
9
+ "platform": "nutanix",
10
+ "databaseName": "REPP1",
11
+ "databaseHostname": "NTX-MICROCHIPPROD-LX02",
12
+ "oracleVersion": "19.0.0.0.0",
13
+ "oracleEdition": "Enterprise Edition",
14
+ "vmName": "ntx-microchipprod-lx02",
15
+ "clusterName": "ntx1-prod-dc1",
16
+ "hostName": "ntx1-host08-dc1",
17
+ "provisionedVcpu": 8,
18
+ "estimatedLicensableCores": 8,
19
+ "notes": [
20
+ "Production Oracle workload",
21
+ "Mapped through Nutanix VM latest configuration"
22
+ ]
23
+ },
24
+ {
25
+ "deploymentId": "prod-sensor",
26
+ "environment": "prod",
27
+ "platform": "nutanix",
28
+ "databaseName": "REPP2",
29
+ "databaseHostname": "NTX-SENSORPROD-LX02",
30
+ "oracleVersion": "19.0.0.0.0",
31
+ "oracleEdition": "Enterprise Edition",
32
+ "vmName": "ntx-sensorprod-lx02",
33
+ "clusterName": "ntx3-prod-dc3",
34
+ "hostName": "ntx3-host03-dc3",
35
+ "provisionedVcpu": 16,
36
+ "estimatedLicensableCores": 16,
37
+ "notes": [
38
+ "Production Oracle workload",
39
+ "Higher CPU footprint than standard 8-vCPU pattern"
40
+ ]
41
+ },
42
+ {
43
+ "deploymentId": "dev-bandwidth",
44
+ "environment": "dev",
45
+ "platform": "nutanix",
46
+ "databaseName": "RMANCP1",
47
+ "databaseHostname": "NTX-BANDWIDTHDEV-LX01",
48
+ "oracleVersion": "19.0.0.0.0",
49
+ "oracleEdition": "Enterprise Edition",
50
+ "vmName": "ntx-bandwidthdev-lx01",
51
+ "clusterName": "ntx2-dev-dc1",
52
+ "hostName": "ntx2-host02-dc1",
53
+ "provisionedVcpu": 4,
54
+ "estimatedLicensableCores": 4,
55
+ "notes": [
56
+ "Development Oracle workload",
57
+ "Candidate for lower licensing priority"
58
+ ]
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "organization": "OpsCompass Demo",
3
+ "assessmentScope": "oracle-licensing",
4
+ "generatedAt": "2026-04-23T00:00:00Z",
5
+ "entitlements": [
6
+ {
7
+ "licensePoolId": "ee-processor-pool",
8
+ "licenseMetric": "processor",
9
+ "licenseType": "Oracle Database Enterprise Edition",
10
+ "entitledQuantity": 24,
11
+ "allocatedQuantity": 20,
12
+ "unallocatedQuantity": 4,
13
+ "limitedUse": false
14
+ },
15
+ {
16
+ "licensePoolId": "diag-tuning-pack-pool",
17
+ "licenseMetric": "processor",
18
+ "licenseType": "Diagnostics Pack + Tuning Pack",
19
+ "entitledQuantity": 8,
20
+ "allocatedQuantity": 16,
21
+ "unallocatedQuantity": -8,
22
+ "limitedUse": false
23
+ }
24
+ ],
25
+ "usageMap": [
26
+ {
27
+ "deploymentId": "prod-microchip",
28
+ "databaseName": "REPP1",
29
+ "assignedLicensePoolIds": [
30
+ "ee-processor-pool",
31
+ "diag-tuning-pack-pool"
32
+ ],
33
+ "consumedQuantity": {
34
+ "Oracle Database Enterprise Edition": 8,
35
+ "Diagnostics Pack + Tuning Pack": 8
36
+ },
37
+ "featureSignals": [
38
+ "CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING"
39
+ ]
40
+ },
41
+ {
42
+ "deploymentId": "prod-sensor",
43
+ "databaseName": "REPP2",
44
+ "assignedLicensePoolIds": [
45
+ "ee-processor-pool",
46
+ "diag-tuning-pack-pool"
47
+ ],
48
+ "consumedQuantity": {
49
+ "Oracle Database Enterprise Edition": 16,
50
+ "Diagnostics Pack + Tuning Pack": 16
51
+ },
52
+ "featureSignals": [
53
+ "CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING"
54
+ ]
55
+ },
56
+ {
57
+ "deploymentId": "dev-bandwidth",
58
+ "databaseName": "RMANCP1",
59
+ "assignedLicensePoolIds": [
60
+ "ee-processor-pool"
61
+ ],
62
+ "consumedQuantity": {
63
+ "Oracle Database Enterprise Edition": 4
64
+ },
65
+ "featureSignals": [
66
+ "CONTROL_MANAGEMENT_PACK_ACCESS=NONE"
67
+ ]
68
+ }
69
+ ]
70
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "organization": "OpsCompass Demo",
3
+ "assessmentScope": "oracle-licensing",
4
+ "generatedAt": "2026-04-23T00:00:00Z",
5
+ "summary": {
6
+ "overallStatus": "non-compliant",
7
+ "deploymentsReviewed": 3,
8
+ "deploymentsCompliant": 1,
9
+ "deploymentsWithFindings": 2,
10
+ "licenseDeficiencyCount": 2,
11
+ "limitedUseIssues": 0
12
+ },
13
+ "findings": [
14
+ {
15
+ "deploymentId": "prod-microchip",
16
+ "databaseName": "REPP1",
17
+ "severity": "medium",
18
+ "findingType": "management-pack-overconsumption",
19
+ "message": "Diagnostics Pack + Tuning Pack usage is assigned, but the shared pool is oversubscribed.",
20
+ "recommendedAction": "Reconcile management pack entitlement assignments or reduce pack usage."
21
+ },
22
+ {
23
+ "deploymentId": "prod-sensor",
24
+ "databaseName": "REPP2",
25
+ "severity": "high",
26
+ "findingType": "processor-license-deficiency",
27
+ "message": "Current processor consumption exceeds the remaining available Enterprise Edition entitlement.",
28
+ "recommendedAction": "Add processor entitlements, reallocate underused licenses, or reduce deployment CPU footprint."
29
+ }
30
+ ],
31
+ "recommendations": [
32
+ "Prioritize REPP2 for remediation because it combines the largest CPU footprint with pack usage.",
33
+ "Review whether development environments require Enterprise Edition or can be right-sized.",
34
+ "Use the current deployment map when modeling the AWS target-state license plan."
35
+ ]
36
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -0,0 +1,90 @@
1
+ # Oracle Licensing Evidence Model
2
+
3
+ Use this file when you need to reason about what evidence is required for an Oracle Optimized License Assessment focused on AWS Oracle target-state optimization.
4
+
5
+ Record the selected OpsCompass environment, company scope, and evidence provenance. Use the authoritative host context when supplied; otherwise use the Resources helpers' selected standalone CLI/home. Never combine another environment's defaults or credentials into the assessment. Command previews (`execute: false`) are not collected evidence, and failed retrievals must be recorded as gaps with their actual cause rather than assumed to be expired login.
6
+
7
+ ## Workload Identity
8
+
9
+ For each Oracle workload, try to establish:
10
+ - database name
11
+ - hostname
12
+ - Oracle version
13
+ - Oracle edition
14
+ - environment or business context if available
15
+
16
+ ## Compliance And Usage Evidence
17
+
18
+ Collect:
19
+ - Oracle compliance findings
20
+ - used features, options, packs, or other license-relevant settings
21
+ - concerning configuration values tied to license exposure
22
+ - RAC usage or cluster/RAC indicators that affect AWS edition recommendations
23
+ - Partitioning usage indicators that require Enterprise Edition and affect AWS edition recommendations
24
+
25
+ Treat Oracle compliance findings as Oracle license-relevant evidence unless the user clearly frames the request differently.
26
+
27
+ For Oracle latest-configuration evidence, inspect:
28
+ - `document.productUsageConcerns`
29
+ - `document.parameters` entries where `isConcerning` is `true`
30
+
31
+ Non-empty `productUsageConcerns` is per-database product/feature usage concern evidence. Concerning parameters are license-relevant evidence; for example, `CONTROL_MANAGEMENT_PACK_ACCESS=DIAGNOSTIC+TUNING` indicates Diagnostic Pack and Tuning Pack exposure.
32
+
33
+ Do not conclude that per-database Oracle feature usage is unavailable until both `get-compliance --status open` and `get-latest-configuration` have been checked for that database.
34
+
35
+ ## Hosting And Compute Evidence
36
+
37
+ Try to establish:
38
+ - hosting platform
39
+ - VM or managed-service context
40
+ - host and cluster context where applicable
41
+ - latest hardware configuration of hosts currently supporting Oracle workloads
42
+ - current core or vCPU-related evidence
43
+ - signals that compute exposure may affect licensing
44
+
45
+ For VMware and Nutanix, latest-configuration is the primary infrastructure evidence source. For OLA work, use the OpsCompass resources workflow to fetch latest configuration for the VM and host resources supporting Oracle workloads, then use the host hardware configuration as current-state licensing evidence.
46
+
47
+ Current Oracle environments are often licensed by CPU core. If host hardware configuration or core evidence cannot be established for workloads on infrastructure platforms, the assessment must treat the licensing conclusion as partial.
48
+
49
+ ## Entitlement Evidence
50
+
51
+ Try to establish:
52
+ - available licenses or entitlements
53
+ - Limited Use restrictions
54
+ - assigned versus unassigned entitlement position
55
+ - known limitations or ambiguities in entitlement records
56
+
57
+ If entitlement evidence is incomplete, the assessment must say so explicitly.
58
+
59
+ Use explicit user-provided entitlement records or evidence from sources the user authorizes for this assessment. Record their provenance, terms, quantities, and applicability to the workloads in scope. Observed feature usage and compliance findings do not by themselves establish purchased licenses or contractual rights. Bundled `api/entitlement-*` fixtures and `fake_entitlements_api.js` output are illustrative static examples, not customer records or a live API; never use them to fill entitlement gaps or support a customer compliance conclusion.
60
+
61
+ ## AWS Target-State Evidence
62
+
63
+ When AWS Oracle planning is in scope, try to establish:
64
+ - whether Amazon RDS for Oracle, Oracle on Amazon EC2, or both are in scope
65
+ - whether the user explicitly excluded RDS or EC2
66
+ - planned RDS deployment shape and sizing assumptions when RDS is in scope
67
+ - planned EC2 deployment shape, tenancy, and sizing assumptions when EC2 is in scope
68
+ - whether EC2 Dedicated Hosts are a licensing-relevant candidate
69
+ - target-state vCPU/core assumptions where available
70
+ - licensing-relevant RDS and/or EC2 architecture assumptions
71
+ - which AWS choices appear most license-efficient from the available evidence
72
+ - how current host/core exposure compares to the proposed AWS target assumptions
73
+ - which RDS shapes, EC2 shapes, tenancy choices, and architecture choices best align to the current entitlement position, observed Oracle usage, and current host/core exposure
74
+ - whether memory-optimized AWS families such as R Series, X1, or Z1 are appropriate candidates
75
+ - whether RAC usage blocks a Standard Edition recommendation
76
+ - whether RAC usage blocks an RDS recommendation unless RAC removal or HA redesign is part of the target-state assumption
77
+ - whether RAC retention requires an EC2 target-state recommendation
78
+ - whether Partitioning usage blocks a Standard Edition recommendation
79
+
80
+ Evaluate RDS and EC2 by default unless the user explicitly scopes the assessment to one target or excludes one target. For EC2, treat Dedicated Hosts as a licensing-relevant option that can be favorable but must be validated against entitlement terms, current and target core exposure, consolidation, HA/DR, operations, and cost.
81
+ Do not recommend Oracle Standard Edition when RAC usage is present unless the assessment explicitly assumes RAC removal.
82
+ Do not recommend Amazon RDS for Oracle for workloads that must retain RAC. Oracle RAC is not supported on RDS; RAC workloads must either move off RAC for RDS or target EC2 to retain RAC.
83
+ Do not recommend Oracle Standard Edition when Partitioning usage is present unless the assessment explicitly assumes Partitioning removal. Oracle Partitioning requires Enterprise Edition.
84
+
85
+ ## Confidence Rules
86
+
87
+ For each conclusion, distinguish:
88
+ - directly established evidence
89
+ - strong inference
90
+ - partial conclusion because key evidence is missing
@@ -0,0 +1,54 @@
1
+ # Oracle Licensing Report Structure
2
+
3
+ Use this file when the user wants a written OLA-style assessment focused on optimizing Oracle licensing for AWS.
4
+
5
+ ## Preferred Report Order
6
+
7
+ 1. Assessment summary
8
+ 2. Key findings
9
+ 3. Oracle workloads in scope
10
+ 4. Hosting and compute context
11
+ 5. Entitlement comparison
12
+ 6. Current-state deficiencies or risks
13
+ 7. AWS target-state findings, if applicable
14
+ 8. AWS optimization recommendations
15
+ 9. Evidence gaps and assumptions
16
+
17
+ ## Content Rules
18
+
19
+ - Lead with licensing risk, not raw inventory.
20
+ - Clearly separate observed facts from recommendations.
21
+ - Clearly separate current-state findings from AWS target-state planning conclusions.
22
+ - Surface Limited Use constraints explicitly.
23
+ - Treat Oracle compliance findings and latest-configuration feature signals as license evidence. Include `document.productUsageConcerns` and concerning `document.parameters` when they support a finding.
24
+ - Keep the recommendations focused on optimizing for AWS, not just explaining current-state licensing.
25
+ - Evaluate both Amazon RDS for Oracle and Oracle on Amazon EC2 by default unless the user explicitly excludes one.
26
+ - Include the recommended RDS shapes, EC2 shapes, tenancy choices, sizing posture, and architecture assumptions when the evidence supports them.
27
+ - Tie AWS recommendations back to current entitlement position, observed Oracle usage, and current host/core exposure.
28
+ - Prefer memory-optimized AWS shape candidates for Oracle when supported by the evidence. R Series, X1, and Z1 are common Oracle-friendly candidates.
29
+ - Include EC2 Dedicated Hosts as a licensing-relevant option when EC2 is in scope, but state that Dedicated Hosts are not automatically optimal and must be validated.
30
+ - Do not recommend Oracle Standard Edition when RAC usage is present; RAC is not included in Oracle SE.
31
+ - Do not recommend Amazon RDS for Oracle for workloads that must retain RAC. Oracle RAC is not supported on RDS; RAC workloads must either move off RAC for RDS or target EC2 to retain RAC.
32
+ - Do not recommend Oracle Standard Edition when Partitioning usage is present; Oracle Partitioning requires Enterprise Edition.
33
+ - If the user scopes the assessment to RDS only, EC2 only, or excludes one option, state that scope explicitly and do not analyze the excluded option.
34
+ - Include current host hardware/core evidence when available, because current Oracle environments are often licensed by CPU core.
35
+ - If compute, host hardware, or hosting evidence is missing, say the Oracle licensing conclusion is partial.
36
+ - If entitlement evidence is missing, say the Oracle licensing conclusion is partial.
37
+ - State the selected OpsCompass environment and company scope with evidence provenance. Do not present another environment's results or defaults as evidence for the selected scope.
38
+ - Distinguish executed evidence collection from command previews (`execute: false`). Report retrieval failures and their actual causes as evidence gaps, not automatically as expired login.
39
+ - Base entitlement comparisons on explicit user-provided or user-authorized records. Keep usage signals separate from purchased rights; bundled fixtures and fake entitlement API output are illustrative only and must not support customer findings.
40
+
41
+ ## Recommended Finding Format
42
+
43
+ For each major finding, try to state:
44
+ - the risk or deficiency
45
+ - the affected workload or scope
46
+ - the Oracle feature, option, pack, product usage concern, or concerning parameter involved
47
+ - the hosting platform and compute context
48
+ - the host hardware/core evidence when available
49
+ - the recommended RDS or EC2 shape, tenancy, or architecture implication
50
+ - whether EC2 Dedicated Hosts are relevant to the recommendation
51
+ - any RAC, RDS feasibility, EC2 requirement, Partitioning, or edition constraint affecting the recommendation
52
+ - the evidence supporting the conclusion
53
+ - the confidence level
54
+ - the recommended next step
@@ -0,0 +1,31 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ const API_ROOT = path.resolve(fileURLToPath(new URL("../api", import.meta.url)));
5
+ const PAYLOAD_FILES = {
6
+ "deployment-details": path.join(API_ROOT, "entitlement-deployment", "entitlement-deployment"),
7
+ "license-usage-map": path.join(API_ROOT, "entitlement-usage", "entitlement-usage.json"),
8
+ "overall-compliance": path.join(API_ROOT, "entitlement-compliance", "entitlement-compliance.json"),
9
+ };
10
+ export const fakeEntitlementsApiTool = {
11
+ name: "opscompass_oracle_licensing_fake_entitlements",
12
+ label: "read entitlement fixture",
13
+ description: "Read one of the checked-in Oracle entitlement API fixtures.",
14
+ parameters: {
15
+ type: "object",
16
+ properties: {
17
+ payload: { type: "string", enum: Object.keys(PAYLOAD_FILES) },
18
+ showPath: { type: "boolean" },
19
+ },
20
+ required: ["payload"],
21
+ additionalProperties: false,
22
+ },
23
+ async execute(input) {
24
+ const value = input;
25
+ if (!value?.payload || !Object.hasOwn(PAYLOAD_FILES, value.payload))
26
+ throw new Error("invalid entitlement payload");
27
+ const file = PAYLOAD_FILES[value.payload];
28
+ const text = await readFile(file, "utf8");
29
+ return { content: [{ type: "text", text: value.showPath ? `[entitlements] ${file}\n${text}` : text }] };
30
+ },
31
+ };
@@ -0,0 +1,72 @@
1
+ import { readFileSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { isMainModule } from "../.opscompass-runtime/tools/cli-entrypoint.js";
5
+ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
6
+ const API_ROOT = path.join(ROOT, "api");
7
+ export const PAYLOAD_FILES = {
8
+ "deployment-details": path.join(API_ROOT, "entitlement-deployment", "entitlement-deployment"),
9
+ "license-usage-map": path.join(API_ROOT, "entitlement-usage", "entitlement-usage.json"),
10
+ "overall-compliance": path.join(API_ROOT, "entitlement-compliance", "entitlement-compliance.json"),
11
+ };
12
+ function isPayloadName(value) {
13
+ return typeof value === "string" && Object.hasOwn(PAYLOAD_FILES, value);
14
+ }
15
+ function parseArgs(argv) {
16
+ if (!argv.length) {
17
+ throw new Error("the following arguments are required: payload");
18
+ }
19
+ const payload = argv[0];
20
+ let showPath = false;
21
+ for (const flag of argv.slice(1)) {
22
+ if (flag === "--show-path") {
23
+ showPath = true;
24
+ }
25
+ else {
26
+ throw new Error(`unrecognized arguments: ${flag}`);
27
+ }
28
+ }
29
+ if (!isPayloadName(payload)) {
30
+ throw new Error(`invalid choice: '${payload}' (choose from deployment-details, license-usage-map, overall-compliance)`);
31
+ }
32
+ return { payload, showPath };
33
+ }
34
+ function errorMessage(error) {
35
+ return error instanceof Error ? error.message : String(error);
36
+ }
37
+ function isMissingFileError(error) {
38
+ return error instanceof Error && error.code === "ENOENT";
39
+ }
40
+ export function main(argv = process.argv.slice(2)) {
41
+ try {
42
+ const args = parseArgs(argv);
43
+ const payloadPath = PAYLOAD_FILES[args.payload];
44
+ if (args.showPath) {
45
+ console.error(`[entitlements] ${args.payload} -> ${payloadPath}`);
46
+ }
47
+ let data;
48
+ try {
49
+ data = JSON.parse(readFileSync(payloadPath, "utf8"));
50
+ }
51
+ catch (error) {
52
+ if (isMissingFileError(error)) {
53
+ console.error(`Error: missing payload file: ${payloadPath}`);
54
+ return 2;
55
+ }
56
+ if (error instanceof SyntaxError) {
57
+ console.error(`Error: invalid JSON in ${payloadPath}: ${error.message}`);
58
+ return 2;
59
+ }
60
+ throw error;
61
+ }
62
+ console.log(JSON.stringify(data, null, 2));
63
+ return 0;
64
+ }
65
+ catch (error) {
66
+ console.error(`Error: ${errorMessage(error)}`);
67
+ return 2;
68
+ }
69
+ }
70
+ if (isMainModule(import.meta.url)) {
71
+ process.exitCode = main();
72
+ }
@@ -0,0 +1,2 @@
1
+ import { fakeEntitlementsApiTool } from "./fake-entitlements-api.tool.js";
2
+ export const tools = [fakeEntitlementsApiTool];
@@ -0,0 +1,15 @@
1
+ import { realpathSync, statSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ export function isMainModule(moduleUrl) {
4
+ const entryPoint = process.argv[1];
5
+ if (!entryPoint)
6
+ return false;
7
+ try {
8
+ const entryPath = realpathSync.native(entryPoint);
9
+ return (entryPath === realpathSync.native(fileURLToPath(moduleUrl)) &&
10
+ statSync(entryPath).isFile());
11
+ }
12
+ catch {
13
+ return false;
14
+ }
15
+ }
@@ -0,0 +1,2 @@
1
+ export { resolveCliContext } from "./opsc-cli-context.js";
2
+ export { buildSetDefaultsCommand, buildSetupCommand, commandText, DEFAULTS_PATH, getDefaultCompany, getDefaultsPath, KNOWN_DEFAULTS_PATHS, loadDefaults, resolveCompany, shellQuote, sortObject, } from "./opsc-cli-defaults.js";
@@ -0,0 +1,24 @@
1
+ import os from "node:os";
2
+ import path from "node:path";
3
+ const CLI_COMMANDS = [
4
+ "opscompass",
5
+ "opscompassdev",
6
+ "opscompassdemo",
7
+ ];
8
+ /** Resolve standalone CLI identity; embedded callers supply their trusted context directly. */
9
+ export function resolveCliContext(cliCommand) {
10
+ if (cliCommand !== undefined && !CLI_COMMANDS.includes(cliCommand)) {
11
+ throw new Error(`--cli must be one of: ${CLI_COMMANDS.join(", ")}.`);
12
+ }
13
+ const override = process.env.OPSCOMPASS_CLI_ENTRYPOINT;
14
+ const recognizedOverride = override !== undefined && CLI_COMMANDS.includes(override);
15
+ const selectedCommand = cliCommand ?? (recognizedOverride ? override : "opscompass");
16
+ // An explicit identity wins over an ambient command, while a local executable
17
+ // override may run that identity. Never infer an environment from a file path.
18
+ const cliEntryPoint = override && !recognizedOverride ? override : selectedCommand;
19
+ return {
20
+ cliEntryPoint,
21
+ cliCommand: selectedCommand,
22
+ opscompassHome: path.join(os.homedir(), `.${selectedCommand}`),
23
+ };
24
+ }