opmsec 0.1.4 → 0.1.5

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 (139) hide show
  1. package/.env.example +1 -0
  2. package/README.md +71 -275
  3. package/bun.lock +3 -3
  4. package/docs/architecture/agents.mdx +11 -59
  5. package/docs/architecture/benchmarks.mdx +20 -46
  6. package/docs/architecture/overview.mdx +31 -38
  7. package/docs/architecture/scanner.mdx +11 -37
  8. package/docs/cli/audit.mdx +9 -12
  9. package/docs/cli/check.mdx +12 -26
  10. package/docs/cli/fix.mdx +10 -30
  11. package/docs/cli/info.mdx +12 -19
  12. package/docs/cli/install.mdx +27 -39
  13. package/docs/cli/push.mdx +40 -57
  14. package/docs/cli/register-agent.mdx +21 -53
  15. package/docs/cli/view.mdx +12 -29
  16. package/docs/concepts/ens-records.mdx +44 -0
  17. package/docs/concepts/multi-agent-consensus.mdx +18 -36
  18. package/docs/concepts/on-chain-registry.mdx +22 -49
  19. package/docs/concepts/security-model.mdx +20 -52
  20. package/docs/concepts/zk-agent-verification.mdx +26 -64
  21. package/docs/contract/events.mdx +13 -74
  22. package/docs/contract/functions.mdx +40 -126
  23. package/docs/contract/overview.mdx +17 -36
  24. package/docs/introduction.mdx +22 -25
  25. package/docs/mint.json +1 -0
  26. package/docs/quickstart.mdx +34 -70
  27. package/docs/system-design.png +0 -0
  28. package/package.json +5 -5
  29. package/packages/cli/src/commands/author-view.tsx +87 -2
  30. package/packages/cli/src/commands/check.tsx +18 -5
  31. package/packages/cli/src/commands/fix.tsx +25 -12
  32. package/packages/cli/src/commands/info.tsx +92 -4
  33. package/packages/cli/src/commands/install.tsx +54 -8
  34. package/packages/cli/src/commands/push.tsx +112 -0
  35. package/packages/cli/src/commands/register-agent.tsx +72 -31
  36. package/packages/cli/src/index.tsx +4 -4
  37. package/packages/cli/src/services/ens-records.ts +525 -0
  38. package/packages/core/src/benchmarks.ts +116 -0
  39. package/packages/core/src/constants.ts +18 -6
  40. package/packages/core/src/model-rankings.ts +40 -15
  41. package/packages/core/src/types.ts +10 -0
  42. package/packages/core/src/utils.ts +3 -3
  43. package/packages/scanner/src/index.ts +2 -1
  44. package/packages/scanner/src/queue/memory-queue.ts +7 -2
  45. package/packages/scanner/src/services/benchmark-runner.ts +86 -1
  46. package/packages/scanner/src/services/fileverse.ts +61 -12
  47. package/packages/web/.next/BUILD_ID +1 -1
  48. package/packages/web/.next/app-build-manifest.json +7 -18
  49. package/packages/web/.next/build-manifest.json +6 -19
  50. package/packages/web/.next/images-manifest.json +1 -1
  51. package/packages/web/.next/required-server-files.json +2 -2
  52. package/packages/web/.next/server/app/_not-found/page.js +2 -2
  53. package/packages/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  54. package/packages/web/.next/server/app/_not-found.html +1 -1
  55. package/packages/web/.next/server/app/_not-found.rsc +4 -2
  56. package/packages/web/.next/server/app/index.html +6 -1
  57. package/packages/web/.next/server/app/index.rsc +5 -3
  58. package/packages/web/.next/server/app/page.js +272 -2
  59. package/packages/web/.next/server/app/page_client-reference-manifest.js +1 -1
  60. package/packages/web/.next/server/app-paths-manifest.json +0 -1
  61. package/packages/web/.next/server/middleware-build-manifest.js +22 -1
  62. package/packages/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  63. package/packages/web/.next/server/next-font-manifest.js +1 -1
  64. package/packages/web/.next/server/next-font-manifest.json +1 -1
  65. package/packages/web/.next/server/pages/404.html +1 -1
  66. package/packages/web/.next/server/pages/500.html +1 -1
  67. package/packages/web/.next/server/pages-manifest.json +1 -6
  68. package/packages/web/.next/server/server-reference-manifest.js +1 -1
  69. package/packages/web/.next/server/server-reference-manifest.json +5 -1
  70. package/packages/web/.next/server/webpack-runtime.js +209 -1
  71. package/packages/web/.next/static/chunks/174-5b5efcb3b8efcc01.js +1 -0
  72. package/packages/web/.next/static/chunks/app/layout-de8e841104500505.js +1 -0
  73. package/packages/web/.next/static/chunks/app/layout.js +69 -0
  74. package/packages/web/.next/static/chunks/app/page-7e086379698b9fb0.js +1 -0
  75. package/packages/web/.next/static/chunks/app/page.js +357 -0
  76. package/packages/web/.next/static/chunks/{main-ee293fa6aa18bdd1.js → main-4e8d71b5ef7ee7e3.js} +1 -1
  77. package/packages/web/.next/static/chunks/webpack-0dcd67569eb46132.js +1 -0
  78. package/packages/web/.next/static/chunks/webpack.js +1393 -0
  79. package/packages/web/.next/static/css/102562cf2d0ae9b0.css +3 -0
  80. package/packages/web/.next/static/development/_buildManifest.js +1 -0
  81. package/packages/web/.next/static/development/_ssgManifest.js +1 -0
  82. package/packages/web/.next/static/media/4cf2300e9c8272f7-s.p.woff2 +0 -0
  83. package/packages/web/.next/static/media/747892c23ea88013-s.woff2 +0 -0
  84. package/packages/web/.next/static/media/8d697b304b401681-s.woff2 +0 -0
  85. package/packages/web/.next/static/media/93f479601ee12b01-s.p.woff2 +0 -0
  86. package/packages/web/.next/static/media/9610d9e46709d722-s.woff2 +0 -0
  87. package/packages/web/.next/static/media/ba015fad6dcf6784-s.woff2 +0 -0
  88. package/packages/web/.next/static/webpack/16f18baa938a434c.webpack.hot-update.json +1 -0
  89. package/packages/web/.next/static/webpack/5fe9fe8578f9c3d2.webpack.hot-update.json +1 -0
  90. package/packages/web/.next/static/webpack/653e365406c0d9ac.webpack.hot-update.json +1 -0
  91. package/packages/web/.next/static/webpack/6800169a899e3a8b.webpack.hot-update.json +1 -0
  92. package/packages/web/.next/static/webpack/73c7d02260cc80e4.webpack.hot-update.json +1 -0
  93. package/packages/web/.next/static/webpack/a2d85d19aa028de1.webpack.hot-update.json +1 -0
  94. package/packages/web/.next/static/webpack/app/layout.16f18baa938a434c.hot-update.js +22 -0
  95. package/packages/web/.next/static/webpack/app/layout.5fe9fe8578f9c3d2.hot-update.js +22 -0
  96. package/packages/web/.next/static/webpack/app/layout.653e365406c0d9ac.hot-update.js +22 -0
  97. package/packages/web/.next/static/webpack/app/layout.6800169a899e3a8b.hot-update.js +22 -0
  98. package/packages/web/.next/static/webpack/app/layout.73c7d02260cc80e4.hot-update.js +22 -0
  99. package/packages/web/.next/static/webpack/app/layout.a2d85d19aa028de1.hot-update.js +22 -0
  100. package/packages/web/.next/static/webpack/app/page.653e365406c0d9ac.hot-update.js +22 -0
  101. package/packages/web/.next/static/webpack/app/page.6800169a899e3a8b.hot-update.js +22 -0
  102. package/packages/web/.next/static/webpack/app/page.73c7d02260cc80e4.hot-update.js +22 -0
  103. package/packages/web/.next/static/webpack/app/page.a2d85d19aa028de1.hot-update.js +22 -0
  104. package/packages/web/.next/static/webpack/webpack.16f18baa938a434c.hot-update.js +12 -0
  105. package/packages/web/.next/static/webpack/webpack.5fe9fe8578f9c3d2.hot-update.js +12 -0
  106. package/packages/web/.next/static/webpack/webpack.653e365406c0d9ac.hot-update.js +12 -0
  107. package/packages/web/.next/static/webpack/webpack.6800169a899e3a8b.hot-update.js +12 -0
  108. package/packages/web/.next/static/webpack/webpack.73c7d02260cc80e4.hot-update.js +12 -0
  109. package/packages/web/.next/static/webpack/webpack.a2d85d19aa028de1.hot-update.js +12 -0
  110. package/packages/web/.next/trace +2 -2
  111. package/packages/web/app/globals.css +197 -51
  112. package/packages/web/app/layout.tsx +6 -3
  113. package/packages/web/app/page.tsx +791 -312
  114. package/packages/web/bun.lock +66 -105
  115. package/packages/web/next.config.ts +8 -1
  116. package/packages/web/package.json +5 -2
  117. package/packages/web/postcss.config.mjs +2 -2
  118. package/packages/web/public/apple-icon.png +1 -0
  119. package/packages/web/public/dependency-bottleneck.png +0 -0
  120. package/packages/web/public/icon-dark-32x32.png +1 -0
  121. package/packages/web/public/icon-light-32x32.png +1 -0
  122. package/packages/web/public/icon.svg +1 -0
  123. package/packages/web/public/nextjs-cve-announcement.png +0 -0
  124. package/packages/web/public/phantomraven-npm-attack.png +0 -0
  125. package/packages/web/public/placeholder-logo.png +1 -0
  126. package/packages/web/public/placeholder-logo.svg +1 -0
  127. package/packages/web/public/placeholder-user.jpg +1 -0
  128. package/packages/web/public/placeholder.jpg +1 -0
  129. package/packages/web/public/placeholder.svg +1 -0
  130. package/packages/web/public/react-cve-meme.png +0 -0
  131. package/packages/web/public/wallet-drain-exploit.png +0 -0
  132. package/packages/web/styles/globals.css +125 -0
  133. package/packages/web/.next/static/chunks/app/layout-28a489fb4398663f.js +0 -1
  134. package/packages/web/.next/static/chunks/app/page-e58ccdb78625bce6.js +0 -1
  135. package/packages/web/.next/static/chunks/webpack-e1ae44446e7f7355.js +0 -1
  136. package/packages/web/.next/static/css/21d69157e271f2ab.css +0 -3
  137. package/packages/web/tailwind.config.ts +0 -48
  138. /package/packages/web/.next/static/{2XIFCTTKVZwN_RsNE-Rrr → 0esGzFBCzREfVwijEGDfL}/_buildManifest.js +0 -0
  139. /package/packages/web/.next/static/{2XIFCTTKVZwN_RsNE-Rrr → 0esGzFBCzREfVwijEGDfL}/_ssgManifest.js +0 -0
@@ -5,54 +5,47 @@ description: 'Monorepo structure and data flow.'
5
5
 
6
6
  # Architecture Overview
7
7
 
8
- OPM is a monorepo with five main packages. The flow is: **CLI → Scanner → LLM providers → Contract writer → Base Sepolia**.
8
+ OPM is a monorepo. The flow is: **CLI → Scanner → LLM providers → Contract → Base Sepolia**.
9
9
 
10
- ## Monorepo Structure
10
+ ## Packages
11
11
 
12
12
  | Package | Purpose |
13
- |--------|---------|
14
- | **packages/core** | Types, constants, prompts, benchmarks, risk classification |
15
- | **packages/scanner** | Agents, LLM calls, queue, benchmark runner, ZK verifier |
16
- | **packages/cli** | Ink terminal UI, commands, npm/ENS/OSV integration |
17
- | **packages/contracts** | Solidity (OPMRegistry), Hardhat, Circom circuits |
18
- | **packages/web** | Next.js website |
13
+ |---------|---------|
14
+ | `packages/core` | Types, constants, prompts, benchmarks, risk classification |
15
+ | `packages/scanner` | Agent runner, LLM client, scan queue, benchmark runner, ZK verifier |
16
+ | `packages/cli` | Ink terminal UI, commands, ENS/OSV/npm integration |
17
+ | `packages/contracts` | OPMRegistry.sol, Hardhat config, Circom circuit |
18
+ | `packages/web` | Next.js landing page |
19
19
 
20
20
  ## Data Flow
21
21
 
22
22
  ```
23
- ┌─────────────┐ ┌─────────────┐ ┌──────────────────┐
24
- │ opm push │────▶│ Scanner │────▶│ LLM Providers │
25
- │ opm check │ │ (agents) │ │ OpenRouter/OpenAI
26
- └─────────────┘ └──────┬──────┘ └──────────────────┘
27
- │ │
28
- │ ▼
29
- │ ┌─────────────┐
30
- │ │ Contract │
31
- │ │ Writer │
32
- │ └──────┬──────┘
33
- │ │
34
- ▼ ▼
35
- ┌─────────────┐ ┌─────────────┐
36
- │ npm / ENS │ │ Base Sepolia│
37
- └─────────────┘ └─────────────┘
23
+ CLI (push/install/check)
24
+ Scanner (parallel agent execution)
25
+ LLM providers (OpenRouter / OpenAI)
26
+ → Contract writer (submitScore, registerPackage)
27
+ → Base Sepolia
28
+ → npm registry (publish / install)
29
+ → ENS (text records, contenthash)
30
+ → Fileverse (IPFS report upload)
38
31
  ```
39
32
 
40
33
  ## External Services
41
34
 
42
35
  | Service | Purpose |
43
36
  |---------|---------|
44
- | **OpenRouter / OpenAI** | LLM inference for agents |
45
- | **OSV** | CVE and GHSA advisory lookup |
46
- | **Fileverse** | IPFS-backed report storage (dDocs protocol) |
47
- | **ChainPatrol** | Blocklist fallback for unregistered packages |
48
- | **Artificial Analysis** | Model intelligence/coding indices for weighted scoring |
49
- | **ENS** | Author identity resolution (forward/reverse, text records) |
50
- | **npm Registry** | Package metadata, tarball download |
51
-
52
- ## Key Paths
53
-
54
- - **CLI entry**: <code>packages/cli/src/index.tsx</code>
55
- - **Scanner entry**: <code>packages/scanner/src/index.ts</code>
56
- - **Contract**: <code>packages/contracts/contracts/OPMRegistry.sol</code>
57
- - **Benchmarks**: <code>packages/core/src/benchmarks.ts</code>
58
- - **ZK circuit**: <code>packages/contracts/circuits/accuracy_verifier.circom</code>
37
+ | OpenRouter / OpenAI | LLM inference |
38
+ | OSV | CVE/GHSA lookup |
39
+ | Fileverse | IPFS report storage |
40
+ | ChainPatrol | Blocklist fallback |
41
+ | Artificial Analysis | Model intelligence indices |
42
+ | ENS | Identity resolution + text records |
43
+ | npm | Package metadata + tarball download |
44
+
45
+ ## Key Entry Points
46
+
47
+ - CLI: `packages/cli/src/index.tsx`
48
+ - Scanner: `packages/scanner/src/index.ts`
49
+ - Contract: `packages/contracts/contracts/OPMRegistry.sol`
50
+ - Benchmarks: `packages/core/src/benchmarks.ts`
51
+ - ZK circuit: `packages/contracts/circuits/accuracy_verifier.circom`
@@ -5,49 +5,23 @@ description: 'Scan queue, parallel execution, and integrations.'
5
5
 
6
6
  # Scanner Engine
7
7
 
8
- The scanner is the core security analysis engine. It coordinates package data fetching, LLM calls, and on-chain score submission.
8
+ The scanner coordinates package data fetching, LLM calls, and on-chain score submission.
9
9
 
10
- ## Memory Queue with Deduplication
10
+ ## Scan Queue
11
11
 
12
- Scans are enqueued via <code>enqueueScan(packageName, version, onStatus?, options?)</code>. The queue:
12
+ Scans are enqueued via `enqueueScan(packageName, version)`. The queue deduplicates concurrent scans for the same `name@version` and supports local tarball context for pre-publish scans.
13
13
 
14
- - Deduplicates concurrent scans for the same <code>name@version</code>
15
- - Supports local tarball context for pre-publish scans (no npm download)
14
+ ## Parallel Execution
16
15
 
17
- ## Parallel Agent Execution
18
-
19
- Agents run in parallel via <code>Promise.allSettled</code>:
20
-
21
- - Each agent fetches package data, queries OSV, calls the LLM, and submits its score on-chain
22
- - Failures in one agent do not block others
23
- - Aggregate score is the mean of successful submissions (intelligence-weighted when Artificial Analysis API is configured)
16
+ Agents run via `Promise.allSettled` — failures in one agent don't block others. The aggregate score is the mean of successful submissions, intelligence-weighted when the Artificial Analysis API is configured.
24
17
 
25
18
  ## Source Code Extraction
26
19
 
27
- <AccordionGroup>
28
- <Accordion title="From npm tarball">
29
- Downloads the tarball from the npm registry, extracts to a temp directory, and reads scannable files (<code>.js</code>, <code>.ts</code>, <code>.mjs</code>, <code>.cjs</code>, <code>.json</code>).
30
- </Accordion>
31
- <Accordion title="From local tarball">
32
- When <code>opm push</code> runs, the packed tarball path is passed. The scanner extracts source from the local file instead of downloading from npm.
33
- </Accordion>
34
- </AccordionGroup>
35
-
36
- ## NPM Registry Integration
37
-
38
- - **Metadata**: Package name, version, description, dependencies, scripts
39
- - **Version history**: Recent versions with publish dates and change summaries
40
- - **Tarball URL**: Fetched from <code>versions[version].dist.tarball</code>
41
-
42
- ## Fileverse Upload
43
-
44
- Audit reports are formatted as Markdown and uploaded via the Fileverse API. The returned URI is set on-chain via <code>setReportURI</code>. Requires <code>FILEVERSE_API_KEY</code>.
45
-
46
- ## Contract Writer
47
-
48
- The scanner's contract writer:
20
+ - **From npm**: Downloads tarball, extracts to temp dir, reads scannable files (`.js`, `.ts`, `.mjs`, `.cjs`, `.json`)
21
+ - **From local**: During `opm push`, the packed tarball path is passed directly
49
22
 
50
- - **submitScoreOnChain**: Calls <code>OPMRegistry.submitScore()</code> with agent wallet
51
- - **setReportURIOnChain**: Calls <code>OPMRegistry.setReportURI()</code>
23
+ ## Integrations
52
24
 
53
- Both require the agent to be authorized (owner-set or ZK-verified).
25
+ - **npm registry** Package metadata, version history, tarball URL
26
+ - **Fileverse** — Audit reports formatted as Markdown, uploaded via API, URI set on-chain
27
+ - **Contract writer** — `submitScore()` and `setReportURI()` calls with agent wallet
@@ -1,35 +1,32 @@
1
1
  ---
2
2
  title: 'opm audit'
3
- description: 'On-chain + CVE audit for all dependencies.'
3
+ description: 'Quick on-chain + CVE audit for all dependencies.'
4
4
  ---
5
5
 
6
6
  # opm audit
7
7
 
8
- On-chain + CVE audit for all dependencies. Faster than <code>opm check</code> because it does not call AI agents.
8
+ Fast security audit checks on-chain scores and CVEs for all dependencies without running AI agents.
9
9
 
10
10
  ## What It Does
11
11
 
12
- - Scans all <code>dependencies</code> and <code>devDependencies</code> in <code>package.json</code>
13
12
  - Queries OPMRegistry for on-chain risk scores
14
13
  - Queries OSV for CVE counts
15
- - For packages not in the registry: checks ChainPatrol blocklist
14
+ - Checks ChainPatrol blocklist for unregistered packages
16
15
  - Shows per-package risk level and CVE counts
17
16
 
18
17
  ## Output
19
18
 
20
19
  | Column | Description |
21
20
  |--------|-------------|
22
- | Package | <code>name@version</code> |
21
+ | Package | `name@version` |
23
22
  | On-chain | Risk badge (LOW/MEDIUM/HIGH) or "not in registry" |
24
- | Author | Truncated wallet address (when registered) |
25
- | CVEs | Count of known vulnerabilities (red if HIGH/CRITICAL) |
23
+ | Author | Truncated wallet address |
24
+ | CVEs | Count of known vulnerabilities |
26
25
 
27
- Summary line: <code>X high · Y medium · Z low · W unverified · N CVEs</code>
26
+ Summary: `X high · Y medium · Z low · W unverified · N CVEs`
28
27
 
29
28
  <Tip>
30
- Use <code>opm audit</code> for a quick security overview. Use <code>opm check</code> when you need AI analysis and typosquat detection.
29
+ Use `opm audit` for a quick overview. Use `opm check` when you need AI analysis and typosquat detection.
31
30
  </Tip>
32
31
 
33
- ## Environment Variables
34
-
35
- No environment variables are required. Uses built-in RPC and contract address.
32
+ No environment variables required.
@@ -1,44 +1,30 @@
1
1
  ---
2
2
  title: 'opm check'
3
- description: 'Comprehensive dependency security scan.'
3
+ description: 'Full dependency security scan with AI agents.'
4
4
  ---
5
5
 
6
6
  # opm check
7
7
 
8
- Comprehensive dependency security scan. Scans all dependencies in <code>package.json</code>, runs AI agents, and optionally uploads a report to Fileverse.
8
+ Scans all dependencies for typosquats, CVEs, on-chain risk, and AI-detected threats. Optionally uploads a report to Fileverse.
9
9
 
10
10
  ## What It Scans
11
11
 
12
- <AccordionGroup>
13
- <Accordion title="Typosquat detection">
14
- Uses Levenshtein distance against top npm packages to detect likely typosquats (e.g. <code>lodahs</code> → <code>lodash</code>).
15
- </Accordion>
16
- <Accordion title="CVE lookup (OSV)">
17
- Queries the OSV API for known vulnerabilities per package and version.
18
- </Accordion>
19
- <Accordion title="On-chain score lookup">
20
- Fetches aggregate risk scores from OPMRegistry for registered packages.
21
- </Accordion>
22
- <Accordion title="AI agent analysis">
23
- Three agents analyze the full dependency list in parallel. Each produces findings, severity, and suggested replacements.
24
- </Accordion>
25
- </AccordionGroup>
26
-
27
- ## Report Upload
28
-
29
- When <code>FILEVERSE_API_KEY</code> is set, the scan report is uploaded to Fileverse (IPFS). The report URI can be set on-chain for packages you publish.
12
+ - **Typosquats** — Levenshtein distance against top npm packages
13
+ - **CVEs** — OSV API lookup for known vulnerabilities per package/version
14
+ - **On-chain scores** Aggregate risk from OPMRegistry for registered packages
15
+ - **AI analysis** — 3 agents analyze the full dependency list in parallel, producing severity ratings and suggested replacements
30
16
 
31
17
  ## Output
32
18
 
33
- - **Per-dependency results**: Typosquats, CVE counts, on-chain scores, fix versions
34
- - **AI agent findings**: Per-agent analysis with severity and suggested replacements
35
- - **Overall assessment**: Summary counts (typosquats, CVEs, high-risk, AI flags)
36
- - **Report link**: Fileverse URL when upload succeeds
19
+ - Per-dependency results: typosquats, CVE counts, on-chain scores, fix versions
20
+ - AI agent findings with severity and suggested replacements
21
+ - Summary: total typosquats, CVEs, high-risk, AI flags
22
+ - Fileverse report link when upload succeeds
37
23
 
38
24
  <Note>
39
- <code>opm check</code> requires <code>OPENROUTER_API_KEY</code> or <code>OPENAI_API_KEY</code> for AI agent analysis. Without them, typosquat and CVE checks still run, but agent analysis is skipped.
25
+ Requires `OPENROUTER_API_KEY` or `OPENAI_API_KEY` for AI analysis. Without them, typosquat and CVE checks still run.
40
26
  </Note>
41
27
 
42
28
  <Tip>
43
- Run <code>opm fix</code> to auto-correct typosquats and vulnerable versions identified by <code>opm check</code>.
29
+ Run `opm fix` to auto-apply the fixes identified by `opm check`.
44
30
  </Tip>
package/docs/cli/fix.mdx CHANGED
@@ -5,45 +5,25 @@ description: 'Auto-fix typosquats and vulnerable dependencies.'
5
5
 
6
6
  # opm fix
7
7
 
8
- Same scan as <code>opm check</code> but auto-applies fixes to <code>package.json</code>. Replaces typosquat packages with correct names and updates vulnerable packages to patched versions.
8
+ Runs the same scan as `opm check`, then auto-applies fixes to `package.json`.
9
9
 
10
10
  ## What It Fixes
11
11
 
12
- <AccordionGroup>
13
- <Accordion title="Typosquats">
14
- Replaces package names detected as typosquats with the likely correct name (e.g. <code>lodahs</code> → <code>lodash</code>).
15
- </Accordion>
16
- <Accordion title="Vulnerable packages">
17
- Updates packages with CRITICAL or HIGH CVEs to the patched version suggested by OSV.
18
- </Accordion>
19
- <Accordion title="AI-suggested replacements">
20
- When 2+ agents flag a package and suggest a replacement, the fix is applied if the suggestion is valid.
21
- </Accordion>
22
- </AccordionGroup>
12
+ - **Typosquats** — Renames to the correct package (e.g. `lodahs` → `lodash`)
13
+ - **Vulnerable packages** — Upgrades to patched versions suggested by OSV
14
+ - **AI-flagged packages** Applies replacements when 2+ agents agree on a suggestion
23
15
 
24
16
  ## Process
25
17
 
26
- <Steps>
27
- <Step title="Scan dependencies">
28
- Runs typosquat detection, CVE lookup, and AI agent analysis (same as <code>opm check</code>).
29
- </Step>
30
- <Step title="Collect fixes">
31
- Builds a list of fixes: typosquat renames, CVE upgrades, and AI-suggested replacements.
32
- </Step>
33
- <Step title="Apply to package.json">
34
- Modifies <code>dependencies</code> and <code>devDependencies</code> with the fixes. Preserves version range prefixes (<code>^</code>, <code>~</code>).
35
- </Step>
36
- <Step title="Upload report">
37
- Optionally uploads the scan report to Fileverse when <code>FILEVERSE_API_KEY</code> is set.
38
- </Step>
39
- </Steps>
40
-
41
- ## After Running
18
+ 1. Scans all dependencies (same as `opm check`)
19
+ 2. Collects fixes: typosquat renames, CVE upgrades, AI-suggested replacements
20
+ 3. Modifies `package.json` in place (preserves `^`/`~` prefixes)
21
+ 4. Optionally uploads report to Fileverse
42
22
 
43
23
  <Warning>
44
- <code>opm fix</code> modifies <code>package.json</code> in place. Run <code>npm install</code> (or <code>opm install</code>) to apply the changes and update the lockfile.
24
+ Run `npm install` or `opm install` after `opm fix` to apply changes and update the lockfile.
45
25
  </Warning>
46
26
 
47
27
  <Tip>
48
- Review the diff in <code>package.json</code> before committing. AI-suggested replacements require consensus from 2+ agents before being applied.
28
+ Review the diff before committing. AI replacements require 2+ agent consensus.
49
29
  </Tip>
package/docs/cli/info.mdx CHANGED
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  title: 'opm info'
3
- description: 'Show on-chain security information for a package.'
3
+ description: 'On-chain security metadata and ENS records for a package.'
4
4
  ---
5
5
 
6
6
  # opm info
7
7
 
8
- Show on-chain security information for a package. Displays author, checksum, signature, ENS name, report URI, agent scores, aggregate score, and safest version.
8
+ Display on-chain security information for a package: author, checksum, signature, risk scores, agent assessments, audit report, and ENS records.
9
9
 
10
10
  ## Usage
11
11
 
@@ -21,24 +21,17 @@ opm info lodash@4.17.21
21
21
 
22
22
  </CodeGroup>
23
23
 
24
- ## Output
24
+ ## What It Shows
25
25
 
26
- | Field | Description |
27
- |-------|-------------|
28
- | Author | Wallet address (with ENS resolution when available) |
29
- | Checksum | SHA-256 hash of the tarball |
30
- | Signature | ECDSA signature (verified or unverified) |
31
- | ENS name | Author identity (e.g. <code>vitalik.eth</code>) |
32
- | Report URI | Link to Fileverse audit report |
33
- | Agent scores | Per-agent risk scores and reasoning |
34
- | Aggregate score | Mean risk score (0–100) |
35
- | Safest version | Lowest-risk version in recent releases |
36
-
37
- ## Links
38
-
39
- - **Fileverse report** — Full AI audit when report URI is set
40
- - **BaseScan** — Contract and transaction links
26
+ - **Author** Wallet address with ENS resolution
27
+ - **Checksum** — SHA-256 hash of the tarball
28
+ - **Signature** ECDSA signature (verified/unverified status)
29
+ - **Agent scores** — Per-agent risk scores with reasoning
30
+ - **Aggregate score** Mean risk across all agents
31
+ - **Safest version** Lowest-risk version in recent releases
32
+ - **Report URI** Link to Fileverse audit report
33
+ - **ENS records** `opm.*` text records from the author's ENS name (version, checksum, fileverse, risk score, contenthash)
41
34
 
42
35
  <Note>
43
- If the package is not in the OPM registry, a warning is shown. No env vars are required.
36
+ No environment variables required. If the package isn't in the OPM registry, a warning is shown.
44
37
  </Note>
@@ -5,67 +5,55 @@ description: 'Install packages with on-chain security verification.'
5
5
 
6
6
  # opm install
7
7
 
8
- Install packages with on-chain security verification. OPM runs a verification pipeline before delegating to npm.
8
+ Install packages with on-chain verification, CVE checks, and signature validation.
9
9
 
10
10
  ## Usage
11
11
 
12
12
  <CodeGroup>
13
13
 
14
- ```bash Install specific package
14
+ ```bash Single package
15
15
  opm install lodash
16
16
  ```
17
17
 
18
- ```bash Install with version
18
+ ```bash Specific version
19
19
  opm install lodash@4.17.21
20
20
  ```
21
21
 
22
- ```bash Install all dependencies
22
+ ```bash ENS-based version
23
+ opm install express@djpai.eth
24
+ ```
25
+
26
+ ```bash All dependencies
23
27
  opm install
24
28
  ```
25
29
 
26
30
  </CodeGroup>
27
31
 
28
- ## Aliases
29
-
30
- - <code>opm i</code> — same as <code>opm install</code>
31
- - <code>opm add</code> — same as <code>opm install</code>
32
+ **Aliases**: `opm i`, `opm add`
32
33
 
33
34
  ## Verification Pipeline
34
35
 
35
- <AccordionGroup>
36
- <Accordion title="CVE check (OSV)">
37
- Queries the OSV API for known CVEs and GHSA advisories. **CRITICAL** CVEs block installation.
38
- </Accordion>
39
- <Accordion title="On-chain score lookup">
40
- Fetches aggregate risk score from OPMRegistry. Blocks if score ≥ 70.
41
- </Accordion>
42
- <Accordion title="Signature verification">
43
- Verifies ECDSA signature against tarball checksum for packages in the registry.
44
- </Accordion>
45
- <Accordion title="ChainPatrol blocklist">
46
- For packages not in the OPM registry, falls back to ChainPatrol API. BLOCKED status prevents install.
47
- </Accordion>
48
- </AccordionGroup>
49
-
50
- ## Blocking Rules
36
+ 1. **CVE check** — Queries OSV for known vulnerabilities. CRITICAL CVEs block install.
37
+ 2. **On-chain score** — Fetches aggregate risk from OPMRegistry. Score ≥ 70 blocks install.
38
+ 3. **Signature verification** Verifies ECDSA signature against tarball checksum.
39
+ 4. **ChainPatrol** — Blocklist fallback for packages not in the registry.
51
40
 
52
- <Warning>
53
- Installation is **blocked** if:
54
- - Risk score ≥ 70 (on-chain)
55
- - Any CRITICAL CVE is present (OSV)
56
- - ChainPatrol returns BLOCKED (for unregistered packages)
57
- </Warning>
41
+ If all gates pass, delegates to `npm install`.
58
42
 
59
- ## Fallback Behavior
43
+ ## ENS Version Resolution
60
44
 
61
- <Note>
62
- If a package is **not in the OPM registry**, OPM falls back to standard <code>npm install</code> with a warning. ChainPatrol is consulted when available.
63
- </Note>
45
+ When you specify an ENS name as a version (e.g. `express@djpai.eth`), OPM:
64
46
 
65
- ## Environment Variables
47
+ 1. Resolves the ENS name to an Ethereum address
48
+ 2. Verifies the author is registered on-chain
49
+ 3. Fetches the safest version from the registry
50
+ 4. Checks for CVEs and auto-bumps to a safe version if needed
51
+ 5. Updates `package.json` with the resolved version
66
52
 
67
- No environment variables are required for basic install. Defaults for RPC, contract address, and API URLs are built-in.
53
+ <Warning>
54
+ Installation is **blocked** if risk score ≥ 70, any CRITICAL CVE exists, or ChainPatrol returns BLOCKED.
55
+ </Warning>
68
56
 
69
- <Tip>
70
- For bulk install (<code>opm install</code> with no args), all <code>dependencies</code> and <code>devDependencies</code> are scanned in parallel before npm install runs.
71
- </Tip>
57
+ <Note>
58
+ No environment variables needed. Defaults for RPC and contract address are built-in.
59
+ </Note>
package/docs/cli/push.mdx CHANGED
@@ -1,37 +1,11 @@
1
1
  ---
2
2
  title: 'opm push'
3
- description: 'Sign, scan, publish, and register a package on-chain.'
3
+ description: 'Sign, scan, publish, register on-chain, write ENS records.'
4
4
  ---
5
5
 
6
6
  # opm push
7
7
 
8
- Sign, scan, publish, and register a package on-chain. The full verification pipeline runs before publishing to npm and registering on the OPMRegistry.
9
-
10
- ## What It Does
11
-
12
- <Steps>
13
- <Step title="Pack tarball">
14
- Creates an npm tarball via <code>npm pack</code> and computes SHA-256 checksum over the packed file.
15
- </Step>
16
- <Step title="Sign checksum">
17
- Signs the checksum with ECDSA (secp256k1) using your <code>OPM_SIGNING_KEY</code>.
18
- </Step>
19
- <Step title="Resolve ENS">
20
- Resolves your wallet address to an ENS name (Base Sepolia, then Ethereum Mainnet fallback).
21
- </Step>
22
- <Step title="Security scan">
23
- Runs 3 AI agents in parallel (Claude, Gemini, DeepSeek) to analyze the package. Each agent submits a risk score (0–100) and reasoning on-chain.
24
- </Step>
25
- <Step title="Risk check">
26
- If aggregate score ≥ 80 or risk level is CRITICAL, publishing is blocked.
27
- </Step>
28
- <Step title="Publish to npm">
29
- Publishes the tarball to the npm registry (uses <code>--token</code> or <code>NPM_TOKEN</code> for automation).
30
- </Step>
31
- <Step title="Register on-chain">
32
- Calls <code>OPMRegistry.registerPackage()</code> with package name, version, checksum, signature, and ENS name.
33
- </Step>
34
- </Steps>
8
+ The full publish pipeline: sign your package, scan with 3 AI agents, publish to npm, register on-chain, upload audit report, and write ENS text records.
35
9
 
36
10
  ## Usage
37
11
 
@@ -51,49 +25,58 @@ opm push --otp <code>
51
25
 
52
26
  </CodeGroup>
53
27
 
28
+ ## What Happens
29
+
30
+ <Steps>
31
+ <Step title="Pack & sign">
32
+ Creates tarball via `npm pack`, computes SHA-256 checksum, signs with ECDSA using `OPM_SIGNING_KEY`.
33
+ </Step>
34
+ <Step title="Resolve ENS">
35
+ Resolves your wallet to an ENS name (Sepolia → Mainnet fallback).
36
+ </Step>
37
+ <Step title="AI scan">
38
+ 3 agents (Claude, Gemini, DeepSeek) analyze in parallel. Each submits a risk score on-chain.
39
+ </Step>
40
+ <Step title="Risk gate">
41
+ Aggregate score ≥ 80 or CRITICAL → **publish blocked**.
42
+ </Step>
43
+ <Step title="Publish to npm">
44
+ Publishes tarball to the npm registry.
45
+ </Step>
46
+ <Step title="Register on-chain">
47
+ Calls `OPMRegistry.registerPackage()` with checksum, signature, ENS name.
48
+ </Step>
49
+ <Step title="Upload report">
50
+ Formatted markdown report uploaded to Fileverse (IPFS-backed, encrypted).
51
+ </Step>
52
+ <Step title="Write ENS records">
53
+ Sets `opm.version`, `opm.checksum`, `opm.fileverse`, `opm.risk_score`, and more on your ENS name. Creates package subname (e.g. `express.djpai.eth`) if you own the parent. Sets contenthash to Fileverse IPFS CID.
54
+ </Step>
55
+ </Steps>
56
+
54
57
  ## Required Environment Variables
55
58
 
56
59
  | Variable | Purpose |
57
60
  |----------|---------|
58
- | `OPM_SIGNING_KEY` | Ethereum private key for package signing (ECDSA) |
59
- | `OPENROUTER_API_KEY` or `OPENAI_API_KEY` | At least one required for AI agent scanning |
60
- | `AGENT_PRIVATE_KEY` | Agent wallet for submitting scores on-chain (must hold Base Sepolia ETH for gas) |
61
+ | `OPM_SIGNING_KEY` | Ethereum private key for ECDSA signing |
62
+ | `OPENROUTER_API_KEY` or `OPENAI_API_KEY` | AI agent scanning |
63
+ | `AGENT_PRIVATE_KEY` | Agent wallet for on-chain score submission (needs Base Sepolia ETH) |
61
64
 
62
- ## Optional Environment Variables
65
+ ## Optional
63
66
 
64
67
  | Variable | Purpose |
65
68
  |----------|---------|
66
- | `NPM_TOKEN` | npm automation token (alternative to <code>--token</code> flag) |
67
- | `FILEVERSE_API_KEY` | Upload audit report to IPFS via Fileverse |
68
-
69
- ## Risk Blocking
69
+ | `NPM_TOKEN` | npm automation token (alternative to `--token` flag) |
70
+ | `FILEVERSE_API_KEY` | Audit report uploads |
70
71
 
71
72
  <Warning>
72
- Packages with **risk score ≥ 80** or **CRITICAL** level are blocked from publishing. The scan step fails, npm publish is skipped, and on-chain registration does not occur.
73
+ Packages with **risk score ≥ 80** are blocked. The scan fails, npm publish is skipped, and no on-chain registration occurs.
73
74
  </Warning>
74
75
 
75
- When blocked, the CLI shows which agents scored the package and the aggregate risk. Fix the issues and run <code>opm push</code> again.
76
-
77
- ## What Gets Stored On-Chain
78
-
79
- After a successful push, the following data is recorded on the OPMRegistry:
80
-
81
- | Data | Description |
82
- |------|-------------|
83
- | Package name | From <code>package.json</code> |
84
- | Version | Semantic version |
85
- | Checksum | SHA-256 hash of the tarball |
86
- | Signature | ECDSA signature of the checksum |
87
- | ENS name | Author identity (e.g. <code>vitalik.eth</code>) |
88
- | Agent scores | Per-agent risk scores and reasoning |
89
- | Report URI | Fileverse/IPFS link to the full audit report |
90
-
91
76
  ## Output
92
77
 
93
- - **Etherscan links** for every transaction: score submissions (one per agent) and package registration
94
- - **Report URI** link when uploaded to Fileverse
95
- - **npm package URL** on successful publish
78
+ Every transaction shows a clickable BaseScan link: score submissions, package registration, ENS record writes. Plus the Fileverse report URI and npm package URL.
96
79
 
97
80
  <Note>
98
- If 2FA is enabled on your npm account, use <code>opm push --otp &lt;code&gt;</code> or an npm automation token with "bypass 2FA" enabled.
81
+ See [ENS Text Records](/concepts/ens-records) for the full list of records written during push.
99
82
  </Note>